3 ms·
So he needs to patchup * all pointers in all new objects, * all pointers into the old-range, * and all live on-stack values into their new on-stack locations
by rurban 4y ago
So he needs to patchup
* all pointers in all new objects,
* all pointers into the old-range,
* and all live on-stack values into their new on-stack locations.
Did I forget something? using volatile-only vars would solve only the third problem.
- erwincoumans 4y agoIt would help to replace pointers by integer offsets, and keep the base in only one location. Using offsets is also useful if you move your code to GPU.
- rurban 4y agoA pointer offset or pointer compression optimization would need a complete rewrite. Nobody does that. It would only work in a VM (bytecode or jit).
- MereInterest 4y agoAll pointers that could be deterministically generated from existing values. I could store a pointer in a 64-bit field, or I could go mad with power, break it up into 11-bit chunks, and store it in the unused exponent of half a dozen float64 values, to be recombined later on. It's not to say that this would be a reasonable thing to do, but that these sort of shenanigans may be done (e.g. to pass data across an excessively narrow API callback)
- Joker_vD 4y ago* all structs whose definitions have changed, * all arrays of such structs. Dealing with deleted fields is more or less straightforward, but what should be put into newly added fields is anyone's guess.
- Asooka 4y agoOr have global pointers be in a specific range, then replace pointer dereference with a check if the pointer is in that range and if yes, read the real pointer value from a table. Keeping the fake pointer values consistent would be tricky, but not impossible given that you have a full view of the program. Edit: Or just live with the fact that certain kinds of changes require a program restart.