Ticket #133 (closed bug: fixed)

Opened 6 years ago

Last modified 4 years ago

methodtailcall broken

Reported by: kjs Owned by: whiteknight
Priority: major Milestone:
Component: core Version: trunk
Severity: medium Keywords: method tailcall
Cc: parrot-dev@… Language:
Patch status: Platform:

Description (last modified by kjs) (diff)

methodtailcalls are broken. The next example shows this.
the call to foo() fails, whereas the semantic equivalent call to bar() is ok. foo() returns with a method tailcall, bar() returns with a normal return statement.

.sub main
    say "ok 1"
    $P0 = foo() ## fails :-(
    $P0 = bar() ## ok.
    say "ok 2"
    $I0 = $P0
    say "ok 3"
    say $I0
    say "ok 4"

.sub foo
    .local pmc p
    p = new "Class"
    .tailcall p."attributes"()

.sub bar
    .local pmc  p
    p = new "Class"
    $P0 = p."attributes"()
    .return ($P0)

Change History

Changed 6 years ago by kjs

  • description modified (diff)

Changed 6 years ago by whiteknight

Don't method tailcalls use the methodtailcall opcode instead of the tailcall one? Does the .tailcall directive properly recognize this and use the appropriate opcodes for each?

Changed 6 years ago by whiteknight

I looked this up in IMCC and the code appears to trace out correctly: IMCC is identifying the tailcall as a method tailcall and is generating a tailcallmethod op to handle it. It appears that method tailcalls are used in several places during the build, but I haven't had the time to look to see how any of those cases are different from the test case presented here.

Changed 5 years ago by coke

This test passes for me in r38816.

Changed 5 years ago by coke

whoops. The test generates "ok 1\n" and stops; I missed additional output was expected; This sample should be added as a test.

Changed 5 years ago by whiteknight

  • owner set to whiteknight
  • status changed from new to assigned
  • milestone 1.3 deleted

Changed 4 years ago by NotFound

Testing with r45981 in debian/amd64:

ok 1
ok 2
ok 3
ok 4

Is this the expected result?

Changed 4 years ago by bacek

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


NotFound, yes, this is expected result. Test added at r46468. Resolving ticket.

-- Bacek

Note: See TracTickets for help on using tickets.