3 ms·
So, the double pointer dereference is to handle moving memory with C. The idea is we can't (reasonably) change every pointer to a piece of memory (as in raw C t
by CJefferson 7y ago
So, the double pointer dereference is to handle moving memory with C.
The idea is we can't (reasonably) change every pointer to a piece of memory (as in raw C the compiler can hide pointers, and we scan the stack, so we don't know if things we find there are pointers or integers).
So, x points to a well knowm place, and that contains a pointer to the place where the data is stored. When we GC, we change where the data is stored, and also change x to point to the new location. Then anyone with x can use x to find the new location of the memory.
This does mean every memory access goes through this "lookup" pointers, and those lookup pointers can't move.
In practice the fix was "tell people not to put BAG on the left hand side of assignments", rather than change this macro which occurs everywhere (although we are also slowly phasing it out)