docs: Fix Hot-Cold Splitting contradiction

Rule 4.2 states: "If a basic block is deemed cold, it should move to a
separate buffer." This violates Rule 3.1 Implicit Indexing. If v100 is
located at instructions[100] and we move it to a cold buffer, it id no
longer at index 100. If we keep the index 100 but store the data
elsewhere, you break the linear memory array performance benefits.

Hot-cols splitting will be done during code generation.

Signed-off-by: Ronald Caesar <github43132@proton.me>
This commit is contained in:
Ronald Caesar
2026-01-06 18:13:44 -04:00
parent cf805cdd86
commit 020aa8dca8

View File

@@ -376,11 +376,7 @@ Therefore we replace dead code with `NOP`. If the ratio of `NOP`'s to
The Compaction Pass will create a new `instructions[]`, remmaping all SSA
indices to be contiguous again, and discards the old array.
### Rule 4.2: Hot-Cold Splitting
If a basic block is deemed cold, it should move to a separate buffer.
### Rule 4.3: Source Variables
### Rule 4.2: Source Variables
Throw away `source_variables[]` after SSA construction. Do not keep it in
memory.
@@ -539,6 +535,9 @@ We switch to tier 2 when a basic block turns hot.
## Tier 2: Optimized Translation
* Run all required optimizations passes.
* During code generation, if a basic block is deemed cold, it should move to a
separate buffer in a memory region far away.
## Required Optimization Passes