Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Calling conventions, IMC

6 views
Skip to first unread message

Will Coleda

unread,
Jan 19, 2004, 12:55:51 PM1/19/04
to perl6-i...@perl.org
(Thanks for the quick response on the last email)

I have another problem. I have a 405-line file (containing a single
.pcc_sub) that is being included from my main .imc.

I get:

error:imcc:pcc_return not inside pcc subroutine

in file 'lib/interpret.imc' line 397
included from 'tcl.imc' sub '__interpret' line 116

...

Though the file contains:

1 .pcc_sub __interpret prototyped
2 # An array of commands to interpret.
3 .param PerlArray orig_commands
...
392 DONE:
393 .debug("final retval is '")
394 .debug(retval)
395 .debug("'\n")
396 .pcc_begin_return
397 .return retval
398 .pcc_end_return

(I know the macro support is going away soon, I'm just trying to get
things working with the current snapshot.)

So, I /am/ inside a pcc subroutine when I .return.

I'm trying to slim this down into a smaller test, but thought I'd post
this in the meantime.

Regards.
--
Will "Coke" Coleda will at coleda
dot com

Dan Sugalski

unread,
Jan 19, 2004, 1:13:18 PM1/19/04
to Will Coleda, perl6-i...@perl.org
At 12:55 PM -0500 1/19/04, Will Coleda wrote:
>Though the file contains:
>
> 1 .pcc_sub __interpret prototyped
> 2 # An array of commands to interpret.
> 3 .param PerlArray orig_commands
>...
> 392 DONE:
> 393 .debug("final retval is '")
> 394 .debug(retval)
> 395 .debug("'\n")
> 396 .pcc_begin_return
> 397 .return retval
> 398 .pcc_end_return

Is there a .end at the end of this?
--
Dan

--------------------------------------"it's like this"-------------------
Dan Sugalski even samurai
d...@sidhe.org have teddy bears and even
teddy bears get drunk

Will Coleda

unread,
Jan 19, 2004, 1:23:13 PM1/19/04
to Dan Sugalski, perl6-i...@perl.org
(has a .end) Yup.

Managed to shrink it down to:

.pcc_sub __interpret prototyped
newsub P1, .Sub, __interpret
.pcc_begin_return
.return 0
.pcc_end_return
.end

It appears that creating a Sub that refers to the sub you're currently
in is the trigger. If I change the sub name to "foo", it complains
about not finding "foo". Comment it out, it compiles.

Sorry I didn't narrow down to a test case first -- after months of not
touching this, I wasn't sure how long it would take me. =-)

Leopold Toetsch

unread,
Jan 19, 2004, 1:52:00 PM1/19/04
to Will Coleda, perl6-i...@perl.org
Will Coleda <wi...@coleda.com> wrote:

> 1 .pcc_sub __interpret prototyped
> 2 # An array of commands to interpret.
> 3 .param PerlArray orig_commands

Please note that between .pcc_sub and .param nothing is allowed, not even
a comment.

leo

Leopold Toetsch

unread,
Jan 19, 2004, 1:54:24 PM1/19/04
to Will Coleda, perl6-i...@perl.org
Will Coleda <wi...@coleda.com> wrote:
> (has a .end) Yup.

> Managed to shrink it down to:

> .pcc_sub __interpret prototyped
> newsub P1, .Sub, __interpret
> .pcc_begin_return
> .return 0
> .pcc_end_return
> .end

Two problems: You are overriding the already existing Sub with that name
and 2) you destroy your return continuation, which could be already in P1.

leo

Melvin Smith

unread,
Jan 19, 2004, 7:10:45 PM1/19/04
to Luke Palmer, Will Coleda, l...@toetsch.at, perl6-i...@perl.org
At 03:16 PM 1/19/2004 -0700, Luke Palmer wrote:
>Will Coleda writes:
> > I didn't expect the code to be very usable, merely compilable. =-)
> >
> > If I want to call myself from myself, how do I do that then?
> >
> > For anything else, I do:
> >
> > .local Sub foo_sub
> > newsub foo_sub, .Sub, __foo
> >
> > .pcc_begin prototyped
> > .arg $S1
> > .pcc_call foo_sub
> > tellmeagainwhyineedthislabel:
> > .result $S1
> > .pcc_end
> >
> >
> > If I can't explicitly create foo_sub if I'm in the middle of __foo, how
> > do I recurse using calling conventions
>
>You could use P0, which holds the subroutine object. Like using &_ in
>Perl 6.


I'll commit a fix shortly.

-Melvin


0 new messages