3 ms·
With provenance, it's important to remember that this is less about adopting a new model that allows miscompilations, and more about addressing current, already
by carbotaniuman 3y ago
With provenance, it's important to remember that this is less about adopting a new model that allows miscompilations, and more about addressing current, already existing miscompilations.
Pointer provenance does nothing to stop you from accessing stuff at a fixed address, it simply justifies things that current compilers already do and will not change. For example, even if you were to guess the address of a local, pointer provenance prevents you from changing it. This enables (really basic!) optimizations like moving variables into registers.
- JonChesterfield 3y agoMem2reg works fine on variables whose addresses have not escaped. Compilers do extensive alias analysis anyway, because even given an oracle that says double* does not alias long*, you still want to work out which double*s can alias. Type based alias analysis is a hack from separate compilation using compilers on limited hardware resources. It should be dropped as an unnecessary compromise to language expressivity, not leaned into as a law of nature.
- sanxiyn 3y agoWithout pointer provenance, all addresses escape. Just cast integer to pointer. I agree strict aliasing is a relic of the past that should be abolished ASAP, but that's quite different from pointer provenance.
- jcranmer 3y ago> Mem2reg works fine on variables whose addresses have not escaped. The question of pointer provenance is really about trying to formalize a workable definition of "escape." This turns out to be far harder than it looks, because it turns out that converting a pointer to integer necessarily needs to be an escape, and all of a sudden, there are all sorts of hidden places that causes pointers to become integers that you never expected (such as storing a pointer in a stack variable, if memory is untyped).