A Hugs bytecode interpreter

Tore Lund tl001@online.no
Tue, 03 Apr 2001 11:15:26 +0200

Malcolm Wallace wrote:
> > Do you know roughly how small nhc98 can get?
> > Even if a 16-bit system is impossible, having a small 32-bit Haskell
> > could be of interest in other connections.
> The executable for a "hello world" type program currently comes out
> at about 115kb code size when compiled with nhc98.  We have done
> some tests on manually stripping the excess dead weight from that (by
> removing class overloading, simplifying the error-handling, cutting
> out big Integers, etc. etc.), and ended up with a 45kb executable.

Okay.  Now, if those 45K consist of e.g. 40K code (or "text") and 5K
data, this leaves us with 24K free in the code segement and 59K minus
heap/stack in the data segment.  That should be abundant for a small
system.  In fact, if bytecode is kept in the data segment - which I
suppose it is - one would not have to pare down the code ("text") that

> Provided you have a C cross-compiler for the 16-bit machine, that 
> should be all you need.

Well, I don't, so I suppose I would have to use a 16-bit compiler.  And
this probably means having to change a good deal of Unix-specific
stuff.  This is the sort of thing one would also have to do for a Win32
port, so it's not a bad form of exercise at all.  But it would probably
take a good deal of effort.

In short, I don't think I have the time or inclination at the moment to
get into nhc98 internals.  So if you are able to lend me makefiles for
that 45K version and/or give some advice on which files to exclude,
where to place #ifdefs etc., then I *might* try to make a 16-bit nhc98. 
Otherwise, I shall have to look elsewhere.