[MLton] osx compiles again in x86_64 branch

Matthew Fluet fluet@cs.cornell.edu
Tue, 23 May 2006 16:52:46 -0400 (EDT)


> I do get these warnings now (new):
> ../runtime/basis-ffi.h:1005: warning: 'WordS16_quot' used but never defined
> ../runtime/basis-ffi.h:1006: warning: 'WordS16_rem' used but never defined

This is presumably a consequence of r4564, which allows the C-side 
implementation of some primitives to be shared between libmlton.a (from 
which they are almost never used, but are there as a fallback), the 
C-codegen (which uses them as static inlines) and the bytecode-codegen 
(which also uses them as static inlines in the bytecode interpreter).

However, I don't get any of these warnings on linux; nor do I understand 
how the declaration in basis-ffi.h constitutes a use.  It is interesting 
that the warned functions are the WordS<N>_{quot,rem} functions, which are 
precisely the primitives that we don't inline with the C-codegen (the gcc 
optimizer uses flexibility in the C spec to optimize constant arguments in 
a way that is inconsistent with the Basis Library specification.).

> Also, Matthew, you might want to use 'vmmap' on *BSD too...

I'll look into it.

> The problem is now that compiled programs segfault! :-)
> Program received signal EXC_BAD_ACCESS, Could not access memory.
> Reason: KERN_INVALID_ADDRESS at address: 0x00514e24
> 0x00140d3c in performGC ()
> (gdb) bt
> #0  0x00140d3c in performGC ()
> #1  0x00142d98 in GC_collect ()
> #2  0x00013848 in Chunk25 ()
> #3  0x001396a4 in main ()
>
> I'll look into this in more detail shortly.

If you haven't tried it already, I'd recommend doing a 'make clean' in the 
x86_64 sources and bootstrap with mlton-20051205.  There were a couple of 
times when I got segfaults with the C-codegen on linux, but I couldn't 
reproduce them when I rebuilt from clean sources.  (I suspect the 
underlying issue is that the Makefiles don't accurately reflect all of the 
real dependencies, and sometimes you can introduce inconsistencies when 
hacking on the runtime.)