Ticket #1172 (closed bug: fixed)

Opened 12 years ago

Last modified 11 years ago

Lexical Associations Not Thawed with Tailcalls

Reported by: chromatic Owned by:
Priority: normal Milestone:
Component: none Version:
Severity: medium Keywords:
Cc: Language:
Patch status: Platform:

Description

From t/pmc/exception.t test #26:

.sub main :main .local pmc a .lex 'a', a a = new 'Integer' a = 42 push_eh handler exit 0 handler: .tailcall exit_handler() .end

.sub exit_handler :outer(main) say "at_exit" .local pmc a a = find_lex 'a' print 'a = ' say a .end

When run as PIR, the output shows that a is 42. When compiled to PBC and run from PBC, this produces:

at_exit a = Null PMC in say current instr.: 'exit_handler' pc 24 (t/op/exceptions_23.pir:17)

Remove .tailcall, recompile to PBC, and you get the correct answer.

-- c

Change History

Changed 12 years ago by coke

This was originally opened as  http://rt.perl.org/rt3//Public/Bug/Display.html?id=60650. On that ticket, allison referenced TT #325.

Changed 12 years ago by mikehh

two tests which reference this ticket in testr had to go from TODO to SKIP after the merge of the pcc_hackathon_6Mar10 branch. The tests which are essentially the same are test 23 in t/op/exceptions.t and test 22 in t/pmc/exception_old.t hung when running testr.

The pir code is as follows:

.sub main :main
    .local pmc a
    .lex 'a', a
    a = new 'Integer'
    a = 42
    push_eh handler
    exit 0
handler:
    .tailcall exit_handler()
.end

.sub exit_handler :outer(main)
    say "at_exit"
    .local pmc a
    a = find_lex 'a'
    print 'a = '
    say a
.end

when the code is run as .pbc this just hangs.

I changed the TODO to a SKIP for the moment at r46132 in both files

Changed 12 years ago by bacek

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

Actually problem was with freezing/thawing Sub.outer_sub. Fixed in r45133. Closing ticket.

Changed 12 years ago by bacek

  • status changed from closed to reopened
  • resolution fixed deleted

Commit reverted. It broke too many other things including Rakudo.

Changed 11 years ago by plobsing

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

As per pmichaud on TT #1764, the outer subs must capture_lex on their inners. After this change, these tests work.

Tests unskipped, closing ticket.

Note: See TracTickets for help on using tickets.