develooper Front page | perl.perl6.internals | Postings from August 2001

Re: Opcode Dispatch

Thread Previous | Thread Next
From:
Dan Sugalski
Date:
August 6, 2001 12:45
Subject:
Re: Opcode Dispatch
Message ID:
5.1.0.14.0.20010806153833.023ae738@tuatha.sidhe.org
At 09:35 PM 8/6/2001 -0400, Stephane Payrard wrote:
>Can we expect that perl6 bytecode will be used to implement the Perl
>equivalent of shared libraries.

Yes, in fact we can. :)

Perl bytecode will have three sections:

1) Fixup section. RW. This has all the real-address pointers and suchlike 
things stored in it. It will  be abused as needed when bytecode is loaded, 
and all the bytecode that needs to deal with things will use fixed-position 
slots in the fixup section to vector to the real things.

2) Constants section. RO. Holds constants. (I bet that was a surprise... :) 
Things like string data and integer constants and such. The loader mangles 
the fixup section to point to constants here.

3) Instruction section. RO. Holds the actual bytecode. Everything here's 
position independent--it either refers to things relative to the current 
location (for branches within code, for example), in the fixup section, or 
symbolically.

The constants and instruction sections might be write-once if the 
bytecode's not in platform-native integer/float format. (Wrong endianness 
or floating point format mainly) If we need to, we'll read in and byteswap 
the whole thing, and then leave it read-only. We'd rather not, though, if 
we can manage, since that means we need to touch, and I hate touching.

There might be separate source, syntax tree, and unoptimized bytecode 
sections as well, but generally they'd stay on disk. (We might overlap the 
constants and source sections so that if you had some monster string 
constant we wouldn't have two copies--the one in your source and the one in 
the constants section)

					Dan

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


Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About