// run-only image: the runtime, a collector root set, and start. there is no // resident compiler and none of its tables. put this between rt.zc and a // program that defines main, and compile with zc0 (the program has to stay in // the stage-0 subset: no types, no quote, no parse words). // // cat build/run/rt.zc src/runtime/run.zc examples/hello.zc | ./zc0 >build/run/genome.h // the program's entry point, written by the program (see start). int main(); // the collector's roots: the code and globals, the program's frames and the // operand stack. the collector marks from these before it frees anything. int gc_roots() { markrange(0, CODE_END); markrange(GORG, GORG[6]); gc_frames(); markrange(dsp(), data_top); return 0; } // the first code a run-only image executes: it sets up the heap, runs main and halts. int start() { heap_init(); main(); halt(); return 0; }