[nhc-users] Native code generation

Malcolm Wallace Malcolm.Wallace at cs.york.ac.uk
Mon Nov 22 09:25:46 EST 2004


Arunkumar S Jadhav <arunk at it.iitb.ac.in> writes:

> 	As I understand it, nhc98 generates byte-code out of a
> program that is interpreted by mutator.

Yes.

> I've developed a native
> code generator (for i386) that takes as input G-code which is
> described in SPJ's book. Now I would like to do the same for
> G-code produced by nhc98. I would like to know.
> 
> 1) Has any one tried this (nhc G-code to native code generation) ? 
> 	If yes then it would be great if we can share some of the ideas.

About 8-9 years ago, David Wakeling wrote a native code-generator
for nhc13.  The performance of the resulting code was not a big
improvement on byte-code interpretation - about a 2x speedup.
He speculated that the basic G-code was not a good starting place,
and that an STG machine intermediate language would probably lead to
better code generation, with more room for further optimisations.

> 2) Is it possible to generate native code fully *just* by looking at
> 	G-code and symbol table generated by nhc98 ?

Almost.  In addition, the generated code must co-operate with the
runtime system (e.g. GC).  The code generator needs to know such
things as: the layout patterns of values in memory; where the
constant-table for a function is stored; and so on.

If you do develop an i386 code-generator for nhc98, do please make it
available, either as a separate distribution, or by feeding patches
back to us to incorporate into the main CVS repository.

Regards,
    Malcolm


More information about the Nhc-users mailing list