From: Jim Cromie Date: Sun, 5 Feb 2006 05:31:14 +0000 (-0700) Subject: [patch] rework arenas - repair arenasets X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=476a1e16f1a85a366e08179098d846acf0b42939;p=p5sagit%2Fp5-mst-13.2.git [patch] rework arenas - repair arenasets Message-ID: <43E5F012.1080203@gmail.com> Date: Sun, 05 Feb 2006 05:31:14 -0700 p4raw-id: //depot/perl@27097 --- diff --git a/hv.c b/hv.c index bec2ddb..ca509aa 100644 --- a/hv.c +++ b/hv.c @@ -44,8 +44,6 @@ S_more_he(pTHX) HE* heend; he = (HE*) Perl_get_arena(aTHX_ PERL_ARENA_SIZE); - HeNEXT(he) = (HE*) PL_body_arenas; - PL_body_arenas = he; heend = &he[PERL_ARENA_SIZE / sizeof(HE) - 1]; PL_body_roots[HE_SVSLOT] = ++he; diff --git a/sv.c b/sv.c index d7703e2..8b00fb5 100644 --- a/sv.c +++ b/sv.c @@ -722,36 +722,29 @@ Perl_get_arena(pTHX_ int arena_size) #else struct arena_desc* adesc; - struct arena_set *newroot, *aroot = (struct arena_set*) PL_body_arenas; + struct arena_set *newroot, **aroot = (struct arena_set**) &PL_body_arenas; int curr; - if (!arena_size) - arena_size = PERL_ARENA_SIZE; + /* shouldnt need this + if (!arena_size) arena_size = PERL_ARENA_SIZE; + */ /* may need new arena-set to hold new arena */ - if (!aroot || aroot->curr >= aroot->set_size) { + if (!*aroot || (*aroot)->curr >= (*aroot)->set_size) { Newxz(newroot, 1, struct arena_set); newroot->set_size = ARENAS_PER_SET; - newroot->next = aroot; - aroot = newroot; - DEBUG_m(PerlIO_printf(Perl_debug_log, "new arenaset %p\n", aroot)); + newroot->next = *aroot; + *aroot = newroot; + DEBUG_m(PerlIO_printf(Perl_debug_log, "new arenaset %p\n", *aroot)); } /* ok, now have arena-set with at least 1 empty/available arena-desc */ - curr = aroot->curr++; - adesc = &aroot->set[curr]; + curr = (*aroot)->curr++; + adesc = &((*aroot)->set[curr]); assert(!adesc->arena); - /* old fixed-size way - Newxz(adesc->arena, 1, union arena); - adesc->size = sizeof(union arena); - */ - /* new buggy way */ Newxz(adesc->arena, arena_size, char); adesc->size = arena_size; - - /* adesc->count = sizeof(struct arena)/size; */ - DEBUG_m(PerlIO_printf(Perl_debug_log, "arena %d added: %p\n", curr, aroot)); return adesc->arena; @@ -767,7 +760,7 @@ S_more_bodies (pTHX_ size_t size, svtype sv_type) const char *end; const size_t count = PERL_ARENA_SIZE / size; - start = (char*) Perl_get_arena(aTHX_ PERL_ARENA_SIZE); /* get a raw arena */ + start = (char*) Perl_get_arena(aTHX_ PERL_ARENA_SIZE); end = start + (count-1) * size;