summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicholas Clark <nick@ccl4.org>2010-08-20 14:14:34 +0100
committerNicholas Clark <nick@ccl4.org>2010-08-20 17:34:39 +0100
commit029821316c3d1268a765152507ac4ffb64746558 (patch)
treeea3380126d503c6a06b58ff518a2ebaaf5c5a803
parent29657bb6c05aaef4172308097542f56a92e02a08 (diff)
downloadperl-029821316c3d1268a765152507ac4ffb64746558.tar.gz
In sv.c, pass in values to S_more_bodies, instead of using bodies_by_type.
Also fix one value passed to the debugging *_printf() in the #else block.
-rw-r--r--embed.fnc3
-rw-r--r--embed.h2
-rw-r--r--proto.h2
-rw-r--r--sv.c27
4 files changed, 18 insertions, 16 deletions
diff --git a/embed.fnc b/embed.fnc
index 1e27e88bc7..76cd2f804c 100644
--- a/embed.fnc
+++ b/embed.fnc
@@ -1907,7 +1907,8 @@ sn |char * |F0convert |NV nv|NN char *const endbuf|NN STRLEN *const len
sM |void |sv_release_COW |NN SV *sv|NN const char *pvx|NN SV *after
# endif
s |SV * |more_sv
-s |void * |more_bodies |const svtype sv_type
+s |void * |more_bodies |const svtype sv_type|const size_t body_size \
+ |const size_t arena_size
s |bool |sv_2iuv_common |NN SV *const sv
s |void |glob_assign_glob|NN SV *const dstr|NN SV *const sstr \
|const int dtype
diff --git a/embed.h b/embed.h
index 51be599588..d45e8bbba7 100644
--- a/embed.h
+++ b/embed.h
@@ -4070,7 +4070,7 @@
# endif
#ifdef PERL_CORE
#define more_sv() S_more_sv(aTHX)
-#define more_bodies(a) S_more_bodies(aTHX_ a)
+#define more_bodies(a,b,c) S_more_bodies(aTHX_ a,b,c)
#define sv_2iuv_common(a) S_sv_2iuv_common(aTHX_ a)
#define glob_assign_glob(a,b,c) S_glob_assign_glob(aTHX_ a,b,c)
#define glob_assign_ref(a,b) S_glob_assign_ref(aTHX_ a,b)
diff --git a/proto.h b/proto.h
index 17c32129d9..9aba97f47a 100644
--- a/proto.h
+++ b/proto.h
@@ -5886,7 +5886,7 @@ STATIC void S_sv_release_COW(pTHX_ SV *sv, const char *pvx, SV *after)
# endif
STATIC SV * S_more_sv(pTHX);
-STATIC void * S_more_bodies(pTHX_ const svtype sv_type);
+STATIC void * S_more_bodies(pTHX_ const svtype sv_type, const size_t body_size, const size_t arena_size);
STATIC bool S_sv_2iuv_common(pTHX_ SV *const sv)
__attribute__nonnull__(pTHX_1);
#define PERL_ARGS_ASSERT_SV_2IUV_COMMON \
diff --git a/sv.c b/sv.c
index bf1adc0574..1430c10bda 100644
--- a/sv.c
+++ b/sv.c
@@ -1025,15 +1025,14 @@ static const struct body_details bodies_by_type[] = {
safecalloc((details)->body_size + (details)->offset, 1)
STATIC void *
-S_more_bodies (pTHX_ const svtype sv_type)
+S_more_bodies (pTHX_ const svtype sv_type, const size_t body_size,
+ const size_t arena_size)
{
dVAR;
void ** const root = &PL_body_roots[sv_type];
- const struct body_details * const bdp = &bodies_by_type[sv_type];
- const size_t body_size = bdp->body_size;
char *start;
const char *end;
- const size_t arena_size = Perl_malloc_good_size(bdp->arena_size);
+ const size_t good_arena_size = Perl_malloc_good_size(arena_size);
#if defined(DEBUGGING) && !defined(PERL_GLOBAL_STRUCT_PRIVATE)
static bool done_sanity_check;
@@ -1049,28 +1048,28 @@ S_more_bodies (pTHX_ const svtype sv_type)
}
#endif
- assert(bdp->arena_size);
+ assert(arena_size);
- start = (char*) Perl_get_arena(aTHX_ arena_size, sv_type);
+ start = (char*) Perl_get_arena(aTHX_ good_arena_size, sv_type);
/* Get the address of the byte after the end of the last body we can fit.
Remember, this is integer division: */
- end = start + arena_size / body_size * body_size;
+ end = start + good_arena_size / body_size * body_size;
/* computed count doesnt reflect the 1st slot reservation */
#if defined(MYMALLOC) || defined(HAS_MALLOC_GOOD_SIZE)
DEBUG_m(PerlIO_printf(Perl_debug_log,
"arena %p end %p arena-size %d (from %d) type %d "
"size %d ct %d\n",
- (void*)start, (void*)end, (int)arena_size,
- (int)bdp->arena_size, sv_type, (int)body_size,
- (int)arena_size / (int)body_size));
+ (void*)start, (void*)end, (int)good_arena_size,
+ (int)arena_size, sv_type, (int)body_size,
+ (int)good_arena_size / (int)body_size));
#else
DEBUG_m(PerlIO_printf(Perl_debug_log,
"arena %p end %p arena-size %d type %d size %d ct %d\n",
(void*)start, (void*)end,
- (int)bdp->arena_size, sv_type, (int)body_size,
- (int)bdp->arena_size / (int)body_size));
+ (int)arena_size, sv_type, (int)body_size,
+ (int)good_arena_size / (int)body_size));
#endif
*root = (void *)start;
@@ -1099,7 +1098,9 @@ S_more_bodies (pTHX_ const svtype sv_type)
STMT_START { \
void ** const r3wt = &PL_body_roots[sv_type]; \
xpv = (PTR_TBL_ENT_t*) (*((void **)(r3wt)) \
- ? *((void **)(r3wt)) : more_bodies(sv_type)); \
+ ? *((void **)(r3wt)) : more_bodies(sv_type, \
+ bodies_by_type[sv_type].body_size,\
+ bodies_by_type[sv_type].arena_size)); \
*(r3wt) = *(void**)(xpv); \
} STMT_END