Help needed to update Lua with pcc

François Perrad francois.perrad at gadz.org
Sun Oct 25 21:47:03 UTC 2009


2009/10/25 Allison Randal <allison at parrot.org>:
> François Perrad wrote:
>>
>> I try without success to update Lua PMC (see attached patch)
>>
>> I obtain the following error :
>>  $ parrot lua.pbc
>>  attempt to access code outside of current code segment
>>  current instr.: 'main' pc 4 (lua.pir:94)
>>
>> and the line 94 of lua.pir is :
>>  .sub 'main' :anon :main
>
> I suggest using 'Parrot_ext_call', which is part of the external API instead
> of 'Parrot_pcc_invoke_sub_from_c_args', which is for internal use. (But,
> that wouldn't cause your error.)
>

bacek already supplies a patch with Parrot_ext_call and fixes some
issues in Parrot.
So, Lua is now upgraded.
TT #752 was closed (and 180 tests are unskipped).

The next step is to implement the Lua metamethod __call
see VTABLE_invoke in src/pmc/luaany.pmc#261
see TODO tests in t/lua-TestMore/test_lua51/231-metatable.t#238-262
I need something like :
        PMC *args = somewhere_in(next or CURRENT_CONTEXT(interp));
        VTABLE_unshift_pmc(INTERP, args, SELF);
        next = VTABLE_invoke(INTERP, meth, next);

François

> Are these method calls or sub calls? The code object is named 'meth', and
> SELF is the first argument, so I'm thinking they're method calls:
>
> -            PMC * const retval = Parrot_runops_fromc_args(INTERP, meth,
> "PPP",
> -                                                          SELF, key);
> +            PMC * retval;
> +            Parrot_pcc_invoke_sub_from_c_args(INTERP, meth, "PP->P", SELF,
> key, &retval);
>
> If you want it to be called as a method, change the signature so the SELF
> argument is marked as 'Pi' instead of just 'P' ('i' is for "invocant"). For
> example:
>
>  Parrot_ext_call(INTERP, meth, "PiP->P", SELF, key, &retval);
>
>
> If they aren't meant to be method calls, I could use a little more
> information about what the code is doing.
>
> Allison
>
>


More information about the parrot-dev mailing list