[MLton] Re: [MLton-user] FFI and pointer relocation

Matthew Fluet fluet at tti-c.org
Sun Dec 16 19:55:11 PST 2007


On Wed, 28 Nov 2007, Wesley W. Terpstra wrote:
> Since the TIME signature creates value via the IntInf conversion path, I 
> doubt changing the representation will help without first solving the more 
> crucial failure to catch (IntX.fromLarge o IntY.toLarge). I've looked into 
> how to do this and the main problem seems to be that all the Overflow 
> handling logic is inside the basis. This prevents a rewrite rule from being 
> written in the SSA stages.

It's true that the logic is in the Basis Library and that prevents a 
simple rewrite rule from being written for the SSA IL.

> I think the right thing to do is:
> 1. remove the conversion/overflow code from the basis

That's a lot of logic to move to the compiler.  It's nice to have big 
sequences of code in the Basis Library.

> 2. add smarter prim apps:
>  RealX_{to,from}IntInf => checks for size mess-ups
>  Word[1-64]_{to,from}[Un]SignedIntInf  => ditto
> 3. detect composition of the 'smart' prim apps
> 4. translate the smarter prim apps during SSA into the existing:
>  Word_extdToWord -- does NOT check for bounds
>
> As an aside, there is an mpz_set_d one can use for converting doubles into 
> IntInfs.
>
> However, this is a big project for another day.

Indeed.  Though, it would be nice to improve the integer conversions.



More information about the MLton mailing list