Ticket #2191 (closed bug: fixed)

Opened 10 years ago

Last modified 10 years ago

Problems with IMCCompiler PMC

Reported by: whiteknight Owned by:
Priority: normal Milestone:
Component: imcc Version: master
Severity: medium Keywords:
Cc: Language:
Patch status: Platform:


I've been seeing some weird problems with methods on the IMCCompiler PMC lately. IMCC has never been very friendly with contexts and preserving things across calls, and there have been several optimizations made lately to master that affect PCC.

Here are two files, test1.pir and test2.pir. Compile the second one to test2.pbc. Then, run test1.pir. The result is random. I've seen anything from segfaults and core dumps, to throwing weird exceptions for code that doesn't appear to be in the program. This suggests that the context is screwed up following the call to .'compile'(), and it is attempting to execute a random place in memory.


.sub main :main
    say "test1: main"

    # Works fine
    $P0 = compreg "PIR"
    say "test1: compiling"
    $P1 = $P0.'compile'(".sub main :main\nsay 'in compile main'\n.end\n")

    say "test1: loading"
    load_bytecode "test2.pbc"
    $P0 = get_global ["Foo"], "test"
    $P1 = $P0()
    # Never gets here


.namespace ["Foo"]
.sub test
    # This part works
    say "test2: test"
    $P0 = compreg "PIR"
    say "test2: compiling"
    $P1 = $P0.'compile'(".sub main :main\nsay 'in compile main'\n.end\n")

    # The weirdness starts here.
    say "test2: compiled"
    $P2 = $P1.'main_sub'()

I'm digging into this issue, but I wanted to create a ticket to help track it.

Change History

in reply to: ↑ description   Changed 10 years ago by plobsing

Replying to whiteknight:

Should be fixed by 65669fd. interp->current_pf and interp->code had become de-synched, leading to interp->code being incorrectly restored by imcc.

  Changed 10 years ago by whiteknight

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

This is indeed fixed. Thanks!

I'll see if I can put together a concise test case somewhere.

Note: See TracTickets for help on using tickets.