Re: Native code generation
Malcolm Wallace <[email protected]> Mon, 22 Nov 2004 14:25:46 +0000
| Newsgroups | gmane.comp.lang.haskell.nhc.user |
|---|---|
| Organization | Dept of Computer Science, University of York |
| Message-ID | <[email protected]> |
Arunkumar S Jadhav <[email protected]> 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