[MLton] Building MLton

John Skaller skaller@users.sourceforge.net
Mon, 04 Jul 2005 16:03:12 +1000

Content-Type: text/plain
Content-Transfer-Encoding: quoted-printable

On Sun, 2005-07-03 at 14:57 -0400, Matthew Fluet wrote:
> > I note I have these switches:
> >=20
> > -mtune=3Dopteron -m32
> >=20
> > which means it should be trying to build a 32 bit version.
> > The best way to get C code to work 64 bit is to try it :)
> You can try it, but we can tell you right now it won't even come close to=
> working. =20

You're right .. the problem is I cannot build 32 bit codes
at the moment, -m32 doesn't work on my system: the compiler
can't generate i386 code (not sure why), and MLton breaks on
64 bit system... bottom line being I can't get it to build
from source at all.

I could use a binary i386 version .. however at the moment
I'm doing performance tests .. MLton is supposed to generate
fast code .. it is going to look very bad if I try to
compare good i386 code with x86-64 code on an amd64 ..
the i386 code is going to run a LOT slower.

> The C-codegen, while emitting C, is still very carefully=20
> constructed C code, with _many_ implicit and explicit dependencies on=20
> 32-bit pointers.

I would beg to differ on the 'carefully constructed' wording ;(

I have two suggestions (yes I am willing to do some of the drudge
work but I may need some help to do so):

1. Simple hack -- not good but it may get a result fastest:
  use 'unsigned long' instead of 'unsigned int' for a word.
  That's the same size as a pointer on gcc/x86-64 at the moment.
  Downside: more storage for system 'integer' type.

2. Do it properly -- make the architecture fully abstract, hopefully
  macros will be enough to do this. 'inline' functions are better,
  they should work in C99 and C++ and will work for most gcc

John Skaller <skaller at users dot sourceforge dot net>
Download Felix: http://felix.sf.net

Content-Type: application/pgp-signature; name=signature.asc
Content-Description: This is a digitally signed message part

Version: GnuPG v1.2.5 (GNU/Linux)