[MLton] Re: Bytecode misses function call?

Wesley W. Terpstra wesley at terpstra.ca
Mon Sep 22 05:30:07 PDT 2008


On Mon, Sep 22, 2008 at 1:27 PM, Wesley W. Terpstra <wesley at terpstra.ca>wrote:

> Attached is a minimal test case. The expected output (as produced by the C
> and native codegens):
> > m5_open called
> > libm3smlFnPublic called
> The output when compiled with the bytecode codegen:
> > libm3smlFnPublic called
> > m5_open called
> libm3smlFnPublic pointers don't match!
> > libm3smlFnPublic called
>
> Compile line:
> mlton -default-ann 'allowFFI true' -codegen bytecode foo.sml foo.c
>
> Problem appears in both svn/HEAD and 20070826.
>

Found and squashed. The problem was that the bytecodegen only looked at a
symbol name for use in its MLton_callC function. This meant it used the same
code to access the address of a symbol and also to call the symbol (if it is
a function).

To fix this, I added an additional field to the key used in the hash table
(symbol : bool) backing MLton_callC.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mlton.org/pipermail/mlton/attachments/20080922/c9528042/attachment.html


More information about the MLton mailing list