Jotting down an idea I had while working on other things.
Lots of GC data is really short. Yet it is stored as FUNCDATA, which means that the data must go in a separate symbol, with all the overhead that such indirection entails (bits to point to the data, cache misses fetching the data, toolchain work processing the data). We have a way to store scalar data (PCDATA). We could use a PCDATA entry associated with the entry PC of a function to store GC info when that GC info is short. The runtime would check the relevant PCDATA entry first and then fall back to the FUNCDATA as needed.
I don't have a good instinct about whether this would end up being better, but it seems like it might be.
The text was updated successfully, but these errors were encountered:
I'm not sure PCDATA is a good way to store such information. It has its own complexities (e.g. the use of varint). And using the PC seems confusing (and unnecessary).
If it matters, we could let FUNCDATA pseudo-instruction accept a constant (along with a symbol). We could use a bit in the func table to distinguish pointer and scalar. (Mixing pointer and scalar is okay here as this is read-only data and not scanned by the GC.)Then the "fallback" is simple, just checking a bit, instead of switching from PCDATA to FUNCDATA, which are stored quite differently.