Spill in x86 codegen

"Wesley W. Terpstra" <[email protected]>
Newsgroups gmane.comp.lang.ml.mlton.devel
Message-ID <[email protected]>
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. :)
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.