[MLton] Crashes with 64-bit native code generator on Windows

Matthew Fluet matthew.fluet at gmail.com
Mon Nov 30 18:24:01 PST 2009


On Mon, Nov 30, 2009 at 4:19 PM, David Hansel
<hansel at reactive-systems.com>wrote:

> I tried using "-native-commented 6" but (due to the size of the code
> involved)
> compilation (in the "outputAssembly" stage) seems to take a VERY long time.
> I also tried "-native-commented 5" with the same result.  A setting of "4"
> worked much faster and I have uploaded a file hansel-20091130-1.s
> containing
> the basic block.
>

That seems to be enough to provide a hint.  I think that the issue is that
the function address got placed in %r11, which is a caller save register.
The contents of caller save registers are pushed to memory immediately
before the call instruction, for any register whose content is live after
the call and purged from the register allocation.  Of course, the function
address is still live *at* the call instruction, although it is not live
after the call instruction.  Small examples seem to favor %r15 as the
register into which the function address is placed, which is not caller
save, and so not susceptible to this issue.  It also fits with small changes
near the indirect function call eliminating the segfault; such changes alter
the liveness and used registers and presumably the function address get
stored in a non-caller save register.  If this is indeed the source of the
issue, then it is simply a native amd64 codegen bug (and, possibly, a latent
x86 codegen bug as well) and is independent of the target OS; that is, it is
not mingw specific.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mlton.org/pipermail/mlton/attachments/20091130/68e1f273/attachment.html


More information about the MLton mailing list