Ticket #1733 (closed bug: fixed)

Opened 11 years ago

Last modified 11 years ago

calling convention broken

Reported by: fperrad Owned by:
Priority: normal Milestone:
Component: core Version: 2.6.0
Severity: high Keywords:
Cc: Language:
Patch status: Platform:

Description

The scheme of calling convention used by Lua is broken.

With Lua, all known parameters are optional, and extra parameters or vararg are collected by a final slurpy.

The following PIR code shows the problem :

.sub 'main' :main
    $P1 = box "p1"
    $P2 = box "p2"
    $P3 = box "p3"
    f($P1, $P2, $P3) # ok
    f($P1, $P2) # ok
    f($P1) # fails
.end

# f() has 2 known parameters
.sub 'f' 
    .param pmc p1 :optional
    .param int has_p1 :opt_flag
    .param pmc p2 :optional
    .param int has_p2 :opt_flag
    .param pmc extra :slurpy
    unless has_p1 goto L1
    say p1
    unless has_p2 goto L1
    say p2
    $P0 = iter extra
  L2:
    unless $P0 goto L1
    $P1 = shift $P0
    say $P1
    goto L2
  L1:
.end

Here, the current output :

p1
p2
p3
p1
p2
FixedPMCArray: Cannot set array size to a negative number (-1)
current instr.: 'f' pc 45 (prm.pir:8)
called from Sub 'main' pc 40 (prm.pir:8)

Change History

Changed 11 years ago by chromatic

On Friday 06 August 2010 at 15:25, Parrot  wrote:

>  The scheme of calling convention used by Lua is broken.

Is r48327 the culprit?

-- c 

Changed 11 years ago by NotFound

Fixed in r48357. Need test.

Changed 11 years ago by fperrad

Lua is fixed.

$ ./setup.pir test
setenv LUA_INIT = platform = { lua=[[/usr/local/bin/parrot lua.pbc]], osname=[[linux]], intsize=4, longsize=4 }
...
All tests successful.
Files=58, Tests=1625,  185.957 wallclock secs
Result: PASS

Changed 11 years ago by fperrad

sample code added as test in r48454

Changed 11 years ago by fperrad

  • status changed from new to closed
  • resolution set to fixed
Note: See TracTickets for help on using tickets.