At 7:42 PM +0200 4/19/02, Marco Baringer wrote:
>Dan Sugalski <[EMAIL PROTECTED]> writes:
>
>>  Ah, this is incorrect. goto ADDRESS should go to an absolute address,
>>  period. It's for use in those times when you *have* an absolute
>>  address--for example when you've just fetched the address of a
>>  subroutine from a symbol table.
>
>but what do i put in the symbol table?

The absolute address.

>every address i have in the
>symbol is, unless my understanding is severly flawed, determined at
>compile time by the assembler and is relative to the start of the byte
>code.

The addresses are always absolute, and are determined at load or 
runtime. Branches are relative, and can be determined at compile time.

>if i have code like (perl5 syntax to avoid confusion)
>
>my $f = sub { print "hello" };
>$f->();
>
>i imagine that will become more or less: (in pseudo pasm)
>
>closure_000:
>         print "hello"
>         ret
>
>main:
>         set_sym P0, '$f', [closure_000]
>         fetch_sym I0, P0, '$f'
>         jsr I0

Something like that. But in this case, the set_sym (which'll probably 
be 'make_closure' or something) will store the absolute address into 
the symbol table or PMC in P0.

>  >                                 Jumping from the start of the
>>  bytecode segment is an interesting idea, but since it's only valid
>>  when used to transfer control from within the current segment, you
>>  might as well just use goto OFFSET instead.
>
>sorry, but i don't understand.

There's no real functional difference between "offset from current 
spot" and "offset from beginning of segment", so I'm unwilling to 
have two separate relative addressing modes.

>  > --
>
>all i want to be able to do is:
>
>set I0, [whatever]
>....
>jsr I0
>
>or
>
>set I0, [wherever]
>....
>jump I0
>
>and as far as i know i can't currently do this.

Right. There's currently no way to get the absolute address of a 
label. That should be fixed--in fact, it will be as soon as the 
current run of tests I've got going are done and checked in. (Okay, 
after they're done since they're for other things, but...)

it really looks like you're trying to work around a deficiency in the 
current scheme. Better to fix the deficiency. :)


>post scriptum - did my patch to lib/Parrot/Assembler get lost in the haze or
>was there something wrong with it?

If it's not in, it got lost in the haze. Which assembler was it against?0

>post post scriptum - i noticed a mention of #parrot in some email,
>which network is that on?

irc.rhizomatic.net.
-- 
                                         Dan

--------------------------------------"it's like this"-------------------
Dan Sugalski                          even samurai
[EMAIL PROTECTED]                         have teddy bears and even
                                       teddy bears get drunk

Reply via email to