[Haskell] [ANNOUNCE] yhc - York Haskell Compiler

Tom Shackell shackell at cs.york.ac.uk
Sun Nov 13 11:47:58 EST 2005


David Frech wrote:

> I'm curious. Can you be more specific about what you thought
> wanted/needed changing in nhc98's VM and/or compiler?

Well there were a number of issues:

- nhc98's existing VM had a very substantial bug because it was 
originally designed to use the top bit of an address to store 
information the VM doesn't work on any system that allocates memory in 
the high-mem area (which is quite common now days). This was built into 
the runtime pretty deeply.

- nhc98's bytecode worked by writing a C file that contained an array
with all the bytes in it. i.e.

unsigned char bytecodes[] = {
    ...
};

This was used to get linking for free but has several disadvantages. 
Most of all it ensures that while the bytecode is in theory portable the 
binaries that nhc produces aren't.

- nhc98's runtime is written in a less than obvious way. Rewriting it
quite substantially reduced the size, and increased the readability of 
the code.

- the bytecode itself could be very much simplified. The original nhc98 
bytecode had instructions for directly manipulating both stack and heap. 
  Yhc simplifies this by moving all the work to be on the stack and then 
having simple instructions to build heap nodes using data on the stack. 
   This gives quite a substantial reduction in the number of 
instructions needed to do something.

- Reducing the number of instructions, so leaving more space for 
specialised versions of simple instructions (e.g. a PUSH_1 instructions 
rather than PUSH, 1), this means almost all instructions fit in a single 
byte, improving performance.

> I haven't played around with nhc98 yet, but I was intrigued by its
> small size and its (modestly-sized and simple) bytecoded
> implementation. Should I now be more interested in Yhc instead? ;-)

Well things are still in an early stages of development but it could 
certainly be worth considering :-)

> I'd like to build a web-publishing framework in Haskell that is
> totally self-contained, very portable, and easy to bootstrap ... and
> nhc98 or Yhc might be a nice place to start.

That's the idea ;-)

> Are you documenting your thoughts about the Yhc implementation somewhere?

There's the blog, the wiki and the webpage (all mentioned in an earlier 
post). We're in a period of documenting things. The implementation is 
not ideally documented at the moment but that's something I hope to fix 
soon.


Thanks

Tom


More information about the Haskell mailing list