[MLton] Spill in x86 codegen

Wesley W. Terpstra wesley at terpstra.ca
Fri Feb 12 10:00:31 PST 2010


There's a bug relating to '-format library' in the x86 codegen. I had
to reserve the register ebx to point to the global offset table in PIC
code. Things seem to work most of the time, but some programs run into
a Spill exception. The only two regression tests that demonstrate the
problem are conversion and fixed-integer.

./build/bin/mlton -format library ./regression/conversion.sml
chooseRegister:
entries:
%esp MEM<l>{StaticNonTemp}[(c_stackP)+(0x0)] 1054 false NO
%ebx MEM<l>{StaticNonTemp}[(_GLOBAL_OFFSET_TABLE_)+(0x0)] 2013 true NO
%dh MEM<b>{Stack}[(MEM<l>{GCStateHold}[((gcState+0x8))+(0x0)])+(0x50)]
999 true NO
%ebp MEM<l>{GCStateHold}[((gcState+0x8))+(0x0)] 989 false NO
%ecx MEM<l>{GCStateHold}[((gcState+0x0))+(0x0)] 2013 false NO
reserved:
%ebx
%esp
%eax
%ax
%al
%ah
%ecx
%cx
%cl
%ch
%edx
%dx
%dl
%dh
fltstack:
size = b
supports = []
saves = [%dh]
force = [%ebx, %bx, %bl, %bh, %edi, %di, %esi, %si]
reserved = [%dh, %dl, %dx, %edx, %ch, %cl, %cx, %ecx, %ah, %al, %ax,
%eax, %esp, %ebx]
depth = 1
Raising Spill in chooseRegister

As the error message shows, ebx contains the _GLOBAL_OFFSET_TABLE_, as
it should. Don't release MLton yet please. :)



More information about the MLton mailing list