Help needed to update Lua with pcc

Allison Randal allison at parrot.org
Sun Oct 25 19:26:39 UTC 2009


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.)

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