3 ms·
This is one of those cases where active memory might prove extremely useful. Imagine store instructions that can tell memory some metadata about what's stored.
by cryptonector 8y ago
This is one of those cases where active memory might prove extremely useful.
Imagine store instructions that can tell memory some metadata about what's stored. "This is a pointer in an object at offset O to another object". "This is an object with a header you can use to paint objects". "This is no longer an object or a pointer". Also imagine instructions like "clear all object paint", "do a one layer trace", and "report unreachable objects". The one-layer trace would have every cell that has a pointer paint the pointed to object with either a "reachable by a reachable object" or "reachable by an object whose reachable state is unknown".
Then GC could proceed as follows: clear all object painting, use the CPU to scan roots to the first objects on the heap and mark those reachable, do two runs of one-layer traces, report unreachable objects and reclaim them.
Something like that.
- mruts 8y agoThat would be pretty awesome if a compiler could infer the lifetimes of (some) objects. It would especially help for paradigm that involve a lot of short-term allocations, like FP.
- sitkack 8y agoWhat if memory was so cheap and there were other read and write paths for words that you could have a multitude of extra metadata associated with a location. I have toyed with a language that had bidirectional references so a piece of referenced data would know every originating pointer. It would then be an O(#pointers) operation to move a piece of data on the heap.
- monocasa 8y agoThe thermal budget of something like that would be bananas I would think.
- cryptonector 8y agoIt needn't all happen at once. Memory talking to memory is still subject to bandwidth limits. It would take time, but not CPU, and it should run faster than a CPU could do it.