--- Dan Sugalski <[EMAIL PROTECTED]> wrote:
> At 06:07 PM 9/25/2001 -0700, Benjamin Stuhl wrote:
> >Just to make sure that it's making the _right_ sense,
> the
> >fixup section is basically our single level of
> indirection
> >so that we can make the bytecode itself be
> >position-independant, right?
>
> Yup.
>
> >But why store it in this
> >format? What we really need to store is the list of what
> we
> >expect in the table and where.
>
> We have 8 bytes per entry. We can store a lot in there.
> :)
But not enought to allow us to vector Perl-level variable
references - to support run-time aliasing, we need to have
the fixup table entry be built from the symbol names:
e.g. for accessing $Foo::bar, we need
index in bytecode (offset in current fixup table) -> fixup
table entry (constructed by looking up "$Foo::bar" in the
symbol table and getting the address of it's symtab entry)
-> the PMC * from the symtab entry
This extra level of indirection lets us be sure that all
the references to a variable are updated when someone does
%Foo::{'$bar'} = \$glock;
> >Can't we just have the bytecode header
> >have
> >
> >int32 *data_template;
> >int32 fixup_space_needed;
> >
> >and build the final table as needed?
>
> If we do that, the fixup section won't be part of the
> same section of
> memory as the bytecode, which means we'll need to touch
> at least some of
> the actual bytecode so we can set the absolute address of
> the fixups.
> Sticking it on the end means we can access it relatively,
> and padding to 8k
> means the section should start on its own memory page so
> we won't be making
> a private copy of anything but the fixup section.
But it should be just as cheap to have a pointer to the
current fixup section in the interpreter structure and just
vector off of that, rather than doing relative lookups.
Besides, for non-constant entries in the fixup table (PMCs,
again), the fixup section needs to be per-interpreter,
since different interpreters will want to reference their
own PMCs, not someone else's.
-- BKS
__________________________________________________
Do You Yahoo!?
Get email alerts & NEW webcam video instant messaging with Yahoo! Messenger.
http://im.yahoo.com