[MLton] Re: PIC in amd64 assembly
Wesley W. Terpstra
wesley at terpstra.ca
Sun Aug 24 20:40:55 PDT 2008
On Mon, Aug 25, 2008 at 6:08 AM, Matthew Fluet <fluet at tti-c.org> wrote:
> On Fri, 22 Aug 2008, Wesley W. Terpstra wrote:
>> Anyway, since MLton does a lot of symbol accessing, and since 'call' is
>> expensive to get to work (we'd have to save %esp, restore it to the C
>> call, pop, restore %esp, ...), I think the only real option is to load the
>> offset of the GOT into %ebx at MLton_jumpToSML time (while I can still
>> easily use %esp) and make %ebx unavailable for use as a general purpose
>> register. Yes this sucks for performance, but PIC code on i386 is always
> Seems reasonable. Since the MLton_jumpToSML code is generated assembly, you
> can do the 'pop %ebx' without another 'call'.
The reason I used a 'call' as opposed to 'pop' is because
_GLOBAL_OFFSET_TABLE_ is calculated relative to the instruction where it's
used. If I did the pop then addl %ebx would need some symbol arithmetic
which doesn't fit nicely into the Immediate abstraction. I figured the extra
one instruction was a small price to pay. :-)
Mimic the uses of 'reserveEsp' in x86-generate-transfers.fun. You'll want to
> remove %ebx from the list of available registers for intra-procedural
> (inter-block) transfers (the 'transferRegs' value). You'll also want to
> assume that %ebx is reserved at the beginning of each block (the
> 'blockAssumes' function).
Your reply comes too late. Do an 'svn update'. ;-) But thanks.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the MLton