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

question about global labels in imcc

6 views
Skip to first unread message

Togos

unread,
Jan 19, 2004, 3:16:11 PM1/19/04
to perl6-i...@perl.org
Hi.

In IMCC, how can I get the address of a label in a
different compilation unit? Is there a way to do this
at compile time? I've looked through the latest docs
but according to imcc/docs/parsing.pod, global labels
get stored in global variables that you must look up
at run time (yuck).

It seems that newsub does some magic regarding this,
as

.sub _main
# This doesn't work
set $I1, _baz
print "_baz: "
print $I1
print "\n"

_shindig:
# But this does
newsub $P1, .Sub, _baz
get_addr $I1, $P1
print "_baz (fancy): "
print $I1
print "\n"

exit 0
.end

.sub _main2
_baz:
exit 0
.end

outputs

_baz: -1
_baz (fancy): 136929824

Is there any way I can get that magic without having
to
actually create a new .Sub object?

thanks,
- TOGoS

__________________________________
Do you Yahoo!?
Yahoo! Hotjobs: Enter the "Signing Bonus" Sweepstakes
http://hotjobs.sweepstakes.yahoo.com/signingbonus

Dan Sugalski

unread,
Jan 19, 2004, 3:31:26 PM1/19/04
to TOGoS, perl6-i...@perl.org
At 12:16 PM -0800 1/19/04, TOGoS wrote:
>Hi.
>
>In IMCC, how can I get the address of a label in a
>different compilation unit?

Don't. The only way to transfer control to code in a different
compilation unit (arguably in a different sub in the same compilation
unit) is via invoke or one of its relatives.
--
Dan

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

0 new messages