Ticket #1230 (closed bug: fixed)

Opened 12 years ago

Last modified 11 years ago

src/pmc/eval.pmc: Walk the fixups, locate globals and nullify the Sub PMC

Reported by: jkeenan Owned by: plobsing
Priority: normal Milestone:
Component: core Version: 1.7.0
Severity: medium Keywords:
Cc: Language:
Patch status: Platform:

Description

This ticket moves into the Trac system an issue previously discussed in the RT system as  RT #46683.

139 =item C<opcode_t *invoke(void *next)>
140 
141 Invokes the first subroutine in the eval code.
142 
143 =cut
144 
145 */
146 
147     VTABLE opcode_t *invoke(void *next) {
148         PMC *sub = SELF.get_pmc_keyed_int(0);
149         return VTABLE_invoke(INTERP, sub, next);
150     }
151 
152     VTABLE void destroy() {
153         /*
154          * If the compiled code contained any .sub (or .pcc.sub)
155          * subroutines, these subs got installed in the globals
156          * during compiling this bytecode segment.
157          *
158          * These globals still exist, calling them will segfault
159          * as the segment is destroyed now.
160          *
161          * RT#46683 walk the fixups for this segment, locate globals
162          *      and nullify the Sub PMC.
163          * This probably needs a pointer into the globals.
164          *
165          * OTOH - if the global exists - this eval pmc ought
166          *        to be alive and destroy isn't called.
167          */
168         PackFile_Segment  *seg;
169         PackFile_ByteCode *cur_cs;
170         Parrot_Sub_attributes *sub_data;
171 
...

kid51

Change History

Changed 12 years ago by jkeenan

  • component changed from none to core

Changed 11 years ago by jkeenan

Is there anyone who could evaluate the issues raised in this ticket which originated in the RT system?

Thank you very much.

kid51

Changed 11 years ago by plobsing

  • owner set to plobsing

Changed 11 years ago by plobsing

  • status changed from new to closed
  • resolution set to fixed

If the sub still exists as a global, the code backing the sub should remain live. Invalidating the sub to avoid a segfault is very, very wrong.

The current solution is to have subs mark the eval_pmc backing them. This is the correct solution, as it exposes the object dependancy to the GC.

Note: See TracTickets for help on using tickets.