On Monday 10 March 2008 09:43:11 François Perrad wrote:

> After reverting commit 26097 ([core] Implement does_pmc and ...), I see
> a different behavior between trunk and ppd17pmc :
>
> on trunk :
> parrot --no-gc lua.pbc -e "print(-nil)"
> lua.pbc: EVAL_1:30: attempt to perform arithmetic on a nil value
> stack traceback:
>          EVAL_1:30 in function '&main_10'
>          languages/lua/lib/luaaux.pir:599 in function 'docall'
>          lua.pir:353 in function 'dostring'
>          lua.pir:247 in function 'runargs'
>          lua.pir:120 in function 'main'
>
> parrot --no-gc lua.pbc -e "print(#nil)"
> lua.pbc: EVAL_1:30: attempt to get length of a nil value
> stack traceback:
>          EVAL_1:30 in function '&main_10'
>          languages/lua/lib/luaaux.pir:599 in function 'docall'
>          lua.pir:353 in function 'dostring'
>          lua.pir:247 in function 'runargs'
>          lua.pir:120 in function 'main'
>
> on ppd17pmc :
> parrot --no-gc lua.pbc -e "print(-nil)"
> lua.pbc: EVAL_1:30: attempt to perform arithmetic on a nil value
> stack traceback:
>          EVAL_1:30 in function '&main_10'
>          languages/lua/lib/luaaux.pir:597 in function 'docall'
>          lua.pir:353 in function 'dostring'
>          lua.pir:247 in function 'runargs'
>          lua.pir:120 in function 'main'
>
> parrot --no-gc lua.pbc -e "print(#nil)"
> lua.pbc: (unknown file):-1: attempt to get length of a nil value
> stack traceback:
>          (unknown file):-1 in function '&main_10'
>          EVAL_1:30 in function '&main_10'
>          languages/lua/lib/luaaux.pir:597 in function 'docall'
>          lua.pir:353 in function 'dostring'
>          lua.pir:247 in function 'runargs'
>          lua.pir:120 in function 'main'
>
> The compiler generates :
>   - a call to VTABLE_neg (in luaany.pmc) when "print(-nil)"
>   - a call to METHOD len (in luaany.pmc) when "print(#nil)", # is the
> Lua length operator
> After that, in ppd17pmc, the method caller (in lua.pmc) find a new level
>   in the call stack when METHOD len is called.

METHODs now use Parrot's calling conventions, so if you're examining the 
context call chain, you'll see an extra level in there representing the 
level.

> I don't know if it's a expected behavior in ppd17pmc.
> I'll update the test files to accept the output "(unknown file):-1".

I think you can go up one more level in your caller() method and get the right 
behavior.

(By the way, things worked for me without the --no-gc flag.)

-- c

Reply via email to