From: Nicholas Clark Date: Sat, 2 Jul 2005 13:07:26 +0000 (+0000) Subject: Don't inline offer_nice_chunk, as it's rarely called. X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=77354fb48907e3618a62531aa2e90772ef4375d9;p=p5sagit%2Fp5-mst-13.2.git Don't inline offer_nice_chunk, as it's rarely called. p4raw-id: //depot/perl@25047 --- diff --git a/embed.fnc b/embed.fnc index af4f2cc..646416f 100644 --- a/embed.fnc +++ b/embed.fnc @@ -1525,6 +1525,8 @@ p |void |dump_sv_child |SV *sv Ap |GV* |gv_SVadd |NN GV* gv #endif +p |void |offer_nice_chunk |NN void *chunk|U32 chunk_size + END_EXTERN_C /* * ex: set ts=8 sts=4 sw=4 noet: diff --git a/embed.h b/embed.h index e2dab2d..0c1bb8b 100644 --- a/embed.h +++ b/embed.h @@ -1640,6 +1640,9 @@ #ifdef PERL_DONT_CREATE_GVSV #define gv_SVadd Perl_gv_SVadd #endif +#ifdef PERL_CORE +#define offer_nice_chunk Perl_offer_nice_chunk +#endif #define ck_anoncode Perl_ck_anoncode #define ck_bitop Perl_ck_bitop #define ck_concat Perl_ck_concat @@ -3615,6 +3618,9 @@ #ifdef PERL_DONT_CREATE_GVSV #define gv_SVadd(a) Perl_gv_SVadd(aTHX_ a) #endif +#ifdef PERL_CORE +#define offer_nice_chunk(a,b) Perl_offer_nice_chunk(aTHX_ a,b) +#endif #define ck_anoncode(a) Perl_ck_anoncode(aTHX_ a) #define ck_bitop(a) Perl_ck_bitop(aTHX_ a) #define ck_concat(a) Perl_ck_concat(aTHX_ a) diff --git a/perl.h b/perl.h index 22d41f1..bb8f217 100644 --- a/perl.h +++ b/perl.h @@ -4753,26 +4753,6 @@ typedef struct am_table_short AMTS; #define PERL_ALLOC_CHECK(p) NOOP #endif -/* - * nice_chunk and nice_chunk size need to be set - * and queried under the protection of sv_mutex - */ -#define offer_nice_chunk(chunk, chunk_size) STMT_START { \ - void *new_chunk; \ - U32 new_chunk_size; \ - LOCK_SV_MUTEX; \ - new_chunk = (void *)(chunk); \ - new_chunk_size = (chunk_size); \ - if (new_chunk_size > PL_nice_chunk_size) { \ - Safefree(PL_nice_chunk); \ - PL_nice_chunk = (char *) new_chunk; \ - PL_nice_chunk_size = new_chunk_size; \ - } else { \ - Safefree(chunk); \ - } \ - UNLOCK_SV_MUTEX; \ - } STMT_END - #ifdef HAS_SEM # include # include diff --git a/proto.h b/proto.h index a75cb74..2fa6e91 100644 --- a/proto.h +++ b/proto.h @@ -2997,6 +2997,10 @@ PERL_CALLCONV GV* Perl_gv_SVadd(pTHX_ GV* gv) #endif +PERL_CALLCONV void Perl_offer_nice_chunk(pTHX_ void *chunk, U32 chunk_size) + __attribute__nonnull__(pTHX_1); + + END_EXTERN_C /* * ex: set ts=8 sts=4 sw=4 noet: diff --git a/sv.c b/sv.c index e3a8a29..038192b 100644 --- a/sv.c +++ b/sv.c @@ -165,6 +165,27 @@ Public API: * "A time to plant, and a time to uproot what was planted..." */ +/* + * nice_chunk and nice_chunk size need to be set + * and queried under the protection of sv_mutex + */ +void +Perl_offer_nice_chunk(pTHX_ void *chunk, U32 chunk_size) +{ + void *new_chunk; + U32 new_chunk_size; + LOCK_SV_MUTEX; + new_chunk = (void *)(chunk); + new_chunk_size = (chunk_size); + if (new_chunk_size > PL_nice_chunk_size) { + Safefree(PL_nice_chunk); + PL_nice_chunk = (char *) new_chunk; + PL_nice_chunk_size = new_chunk_size; + } else { + Safefree(chunk); + } + UNLOCK_SV_MUTEX; +} #ifdef DEBUG_LEAKING_SCALARS # ifdef NETWARE