[MLton] Debian: sparc works

Stephen Weeks MLton@mlton.org
Wed, 22 Dec 2004 14:21:49 -0800


> > I propose to eliminate the distinction between those constants in the
> > runtime, and to eliminate the __i386__ and __sun__ implementations of
> > Real64_class, leaving only the C99 one.
> 
> I didn't do this mostly b/c I was trying to be conservative.
> The comment about nanSignalling scared me. =)

I've eliminated all but the C99 implementation, as well as cleaned it
up to remove the conversion between C99 names for classes and MLton
names for classes.

> > In fact, it might even be simpler to eliminate the C wrapper altogether,
> > and call fpclassify directly from the basis library.
> 
> Be warned that fpclassify is a macro on many systems.

OK, I left the C wrapper.

> > BTW, why is there no C99 implementation for Real32_class?
> 
> Because the existing method appeared already portable. =)
> fpclassify works for both float+double, so if you want to use it just
> cut-and-paste the code for the switch on double.

Done.  The definition is now quite simple.

Int Real32_class (Real32 f) {
	return fpclassify (f);
}

> For alpha, 'int' in SML should be 64 bit! There are no 
> 32-bit registers and doing 32-bit math requires emulation.
...
> Here are all sorts of assumptions about types:
> Word=Cpointer?
> Int=Size?
> Word=Uid?
> Int=Pid?
> 
> Those are all assumptions which are wrong on at least one platform.
> The '!!!' is something I put in places whenever I see a bug.
> That was something I needed still to change to get 64bit platforms to work.

Makes sense.  We actually have a lot of work to do here, since there
are a number of hardwired type definitions in the basis library
sources (in particular in misc/primitive.sml and posix/primitive.sml).
The one idea I've had along these lines is to automatically generate
for each target an SML prelude for the basis library implementation
that defines all the types.  We might even add to the prelude
definitions for all the constants from the constants file, but keep in
mind we need to keep the constants file in an easy to parse format
because other code looks at it.