cranelift: Remove srcloc from emit state on all targets #8122
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
In #2426, @cfallin wrote:
That PR changed both backends that existed at the time to check both the source location and the memory flags to determine whether a memory access could trap.
Then in #2685, @cfallin wrote:
However that PR did not apply the same change to other backends. Since then, the pattern from #2426 has been copied to new backends.
I believe checking the source location has been unnecessary since #2426 and is now just a source of confusion at best, and possibly bugs at worst. So this PR makes all targets match the behavior of the x64 backend.
In addition, this pattern was the only reason why source locations were provided to any backend's emit state, so I'm removing that entirely. The
cur_srcloc
field has been unused on x64 since #2685.This change is mostly straightforward, but there are two questionable changes in the riscv64 backend:
The riscv64 backend had one use of this pattern for a BadConversionToInteger trap. All other uses on all backends were for HeapOutOfBounds traps. I suspect that was a copy-paste bug so I've removed it just like all the others.
The riscv64
Inst::Atomic
does not have a MemFlags field, so this means the HeapOutOfBounds trap metadata is added unconditionally for such instructions.