larsbrinkhoff / lbForth

Self-hosting metacompiled Forth, bootstrapping from a few lines of C; targets Linux, Windows, ARM, RISC-V, 68000, PDP-11, asm.js.
GNU General Public License v3.0
418 stars 112 forks source link

Clean up C target metacompiler. #14

Open larsbrinkhoff opened 10 years ago

larsbrinkhoff commented 8 years ago

The x86 target uses a new metacompiler written from scratch. The C target might adopt that.

larsbrinkhoff commented 7 years ago

@pipcet used the new metacompiler for the asm.js target. Maybe do something similar for C?

pipcet commented 7 years ago

I think we'd have to use cell offsets into a global data space rather than pointers for this to work. Or somehow remember which cells need to be relocated and which ones don't, but that sounds hairy.

larsbrinkhoff commented 7 years ago

The present C metacompiler does remember relocation information. It's a little bit hairy, but not too bad. There is a , for data, and a a, for relocatable addresses.

That said, I'm not sure I want to add that hair to the generic metacompiler unless there are more targets that can use it. (Actually, having a metacompiler for the C target isn't important because it's only used for bootstrapping and the Lisp metacompiler does that.)