Sometimes reuse stack addresses #3487
Labels
A-interpreter
Area: affects the core interpreter
C-enhancement
Category: a PR with an enhancement or an issue tracking an accepted enhancement
In real executions, when a function returns and the same function is called again, variables will often get the same address again. In Miri this never happens; address reuse is disabled for stack variables currently. This is because the reuse pool is shared among all threads, and address reuse induces synchronization, so by reusing stack addresses from different threads we basically kill weak memory emulation and data race detection as everything is always synchronized.
We could still do address reuse for stack allocations within the same thread though. This should probably be a separate per-thread reuse pool. Stack allocations are very common so we need to be careful with the performance impact.
The text was updated successfully, but these errors were encountered: