On Tue 19 Jun 2012 05:52, Noah Lavine <noah.b.lav...@gmail.com> writes:
> Time for my next RTL question - how do I use the toplevel-ref > instruction? It looks like I need to make a variable object in the > instruction stream, or at a known offset from it. I think I should use > either make-non-immediate or the linker to do that, but I don't quite > know how. I haven't yet wired that up. You have it right: a variable object in the object file. It's not actually in the instruction stream: it's in another section. The other section will be writable and end up on a different page in memory, so that we share the text but not the writable data. Also the writable data section will be added as a GC root. I think the thing to do is to add a macro-instruction that emits a toplevel ref, adds a variable object to the constant table, and adds a relocation so that the offset is fixed up at link time. Another option would be to implement inline caches for toplevel references, and also toplevel calls. A reference would be a thunk call. The first reference would update the cache. You could share the caches for accesses to the same toplevel within a function. They have to be very few (bytecode) instructions in the hot case though, otherwise that would be a lose. Dunno. That part is still unsettled, basically! Andy -- http://wingolog.org/