Front page | perl.perl6.internals |
Postings from July 2002
Re: Subs?
Thread Previous
|
Thread Next
From:
Jonathan Sillito
Date:
July 18, 2002 13:17
Subject:
Re: Subs?
Message ID:
1027023372.2746.30.camel@localhost.localdomain
On Wed, 2002-07-17 at 22:01, Melvin Smith wrote:
> Subs, co-routines and continuations are at a very limited, but functional
> state.
>
> Basically you can create a PMC with a bytecode address or label
> and use the call/callco/callcc ops on it.
>
Subs seem to be broken right now. Here is a pasm file
set_addr I0, MYSUB
new P0, .Sub, I0
call
end
MYSUB:
print "this is the sub\n"
ret
and the output from running the associated pbc file
> ./parrot rough.pbc
Segmentation fault
> ./parrot -t rough.pbc
PC=0; OP=65 (set_addr_i_ic); ARGS=(I0=0, 9)
PC=3; OP=727 (new_p_ic_i); ARGS=(P0=0x81403c0, 9, I0=135578484)
PC=7; OP=757 (call)
If I understand things correctly, the problem is that the address
argument (i.e. the last argument) to the new op is being ignored, and
sub->init is always set to 0. So the call op is returning 0 as the next
op for the interpreter (in core.ops):
goto ADDRESS(sub->init); /* always 0 */
Is there a different pasm syntax I should be using for creating and
calling subs? I seem to remember some discussion about changing how
things are passed to constructors but I am not sure what the conclusion
was.
--
Jonathan Sillito
Thread Previous
|
Thread Next