summaryrefslogtreecommitdiff
path: root/chapter20/README.md
diff options
context:
space:
mode:
authorCliff Click <cliffc@acm.org>2026-09-30 09:06:50 -0700
committerCliff Click <cliffc@acm.org>2026-09-30 09:06:50 -0700
commitf01ee0522e63b0266314b4e88e524ea2da95cf0d (patch)
tree679036250cf5bc135d482da39b14be98a6c1791f /chapter20/README.md
parent612555ee37f733ff3f902b2ab149b318db334aec (diff)
downloadSimple-f01ee0522e63b0266314b4e88e524ea2da95cf0d.tar.gz
Simple-f01ee0522e63b0266314b4e88e524ea2da95cf0d.zip
ch 20 forward port memory
Diffstat (limited to 'chapter20/README.md')
-rw-r--r--chapter20/README.md31
1 files changed, 28 insertions, 3 deletions
diff --git a/chapter20/README.md b/chapter20/README.md
index e463831a..271653c6 100644
--- a/chapter20/README.md
+++ b/chapter20/README.md
@@ -152,6 +152,11 @@ represent mutable bitsets with the allocator routinely masking off bits when
accumulating a set of constraints. To help keep these uses apart, the
`RegMask` class includes mutable and immutable variants.
+#### Memory
+
+Memory edges exist to enforce ordering, but do not get any registers.
+The allocator basically ignores them.
+
### Callee/Caller Save Registers
@@ -505,21 +510,41 @@ checks, not additional program benchmarks.
| Program-test cohort | Allocator chapter | Compilations | Split moves | Loop-weighted moves |
|---|---:|---:|---:|---:|
-| Chapter 20 | 20 | 39 | 238 | 357 |
+| Chapter 20 | 20 | 39 | 234 | 360 |
`_spills` counts surviving split moves, including register-to-register copies;
it does not count only stack stores. `_spillScaled` weights each move by
`8^loopDepth`, a rough cost estimate rather than measured execution frequency.
-The weighted subtotals are 154 for x86-64, 101 for RISC-V, and 102 for ARM.
+The weighted subtotals are 161 for x86-64, 100 for RISC-V, and 99 for ARM.
### Comments on the measurements
Before the correctness fixes, this cohort had 235 moves / 354 weighted moves.
-The final corrected baseline costs three more of each. The final narrow x86
+The corrected baseline before lazy memory cost three more of each. The final narrow x86
store-mask backport accounts for two of those moves: an integer byte/short store
cannot consume an XMM register. This is a correctness cost, not a quality gain.
The fixed-neighbor color-bias correction changes no counts in this cohort.
+With lazy memory and selected-read ordering, the same 39 compilations have
+234 moves / 360 weighted moves, versus 238 / 357 before the port. Register
+legality passes on every target; allocator heuristics are unchanged. The changed
+programs are:
+
+| Program | Target | Moves before / after | Weighted before / after |
+|---|---|---:|---:|
+| Array access (`testAlloc2`) | x86-64 | 1 / 2 | 1 / 2 |
+| Array prefix sum (`testArray1`) | x86-64 | 5 / 6 | 5 / 13 |
+| String hash | x86-64 | 7 / 5 | 21 / 19 |
+| String hash | RISC-V | 4 / 3 | 4 / 3 |
+| String hash | ARM | 5 / 3 | 5 / 3 |
+| Merge sort | ARM | 37 / 36 | 37 / 36 |
+
+The prefix sum's extra loop move follows from scheduling selected reads before
+clobbering writes. A diagnostic build omitting that ordering returns to 5 / 5;
+it is not a valid alternative schedule. These are changed frontend and scheduling
+graphs, not a comparison of allocator heuristics. The new memory-allocation
+regressions check legality but do not add entries to this measured cohort.
+
Later chapters will add one quality technique at a time and end with this kind
of table: Chapter 21 will measure both the Chapter 20 and Chapter 21 program
cohorts using its allocator, and Chapter 25 will have rows for cohorts 20-25.