Skip to content

Commit

Permalink
Consolidate address calculations for atomics (#3143)
Browse files Browse the repository at this point in the history
* Consolidate address calculations for atomics

This commit consolidates all calcuations of guest addresses into one
`prepare_addr` function. This notably remove the atomics-specifics paths
as well as the `prepare_load` function (now renamed to `prepare_addr`
and folded into `get_heap_addr`).

The goal of this commit is to simplify how addresses are managed in the
code generator for atomics to use all the shared infrastrucutre of other
loads/stores as well. This additionally fixes #3132 via the use of
`heap_addr` in clif for all operations.

I also added a number of tests for loads/stores with varying alignments.
Originally I was going to allow loads/stores to not be aligned since
that's what the current formal specification says, but the overview of
the threads proposal disagrees with the formal specification, so I
figured I'd leave it as-is but adding tests probably doesn't hurt.

Closes #3132

* Fix old backend

* Guarantee misalignment checks happen before out-of-bounds
  • Loading branch information
alexcrichton authored Aug 4, 2021
1 parent 91d24b8 commit 85f16f4
Show file tree
Hide file tree
Showing 6 changed files with 328 additions and 208 deletions.
Loading

0 comments on commit 85f16f4

Please sign in to comment.