Ticket #656 (closed todo: fixed)
Optimization in src/pmc/RetContinuation.pmc:invoke causes segfault
Reported by: | whiteknight | Owned by: | |
---|---|---|---|
Priority: | normal | Milestone: | |
Component: | none | Version: | 1.1.0 |
Severity: | medium | Keywords: | |
Cc: | Language: | ||
Patch status: | Platform: |
Description
After the GC API refactor, there is now a line in src/pmc/retcontinuation.pmc:invoke() that is commented out:
/* Parrot_gc_free_pmc_header(interp, SELF); */
Prior to the refactor, this line was replaced by this sequence:
VTABLE_destroy(interp, SELF); { Arenas *arena_base = interp->arena_base; Small_Object_Pool *pool = arena_base->pmc_pool; Small_Object_Pool *ext_pool = arena_base->pmc_ext_pool; ext_pool->add_free_object(interp, ext_pool, (PObj *)SELF->pmc_ext); PObj_flags_SETTO((PObj *)SELF, PObj_on_free_list_FLAG); pool->add_free_object(interp, pool, (PObj *)SELF); pool->num_free_objects++; }
As far as I can trace it, the two sequences should perform the same exact sequence of steps in the same order (call the destroy VTABLE, free the pmc_ext, set the on_free_list flag for the pmc, free the pmc, increment the number of items on the free list).
After the refactor, this line of code causes a segfault in t/pmc/packfiledirectory.t, for reasons that I can't figure out. If we can figure out the segfault, we can uncomment this line and get a performance win. (I think chromatic said it was something like 2.25%).