Native programs in a caller-owned memory window #
MemoryWindow.compile translates standard native code to use a runtime memory base. Three
additional registers hold the base, the source word modulus and an address temporary. A load
executes an addition, a load and a remainder; a store executes an addition and a store. Other
instructions and all branch decisions retain the source register values.
MemoryWindow.view clips memory words to the source width. Consequently arbitrary dirty memory
in the caller's window is allowed: no bulk initialization or copying of that window is implicit
in the translation. The view is only a relation between ordinary native data, not a new machine
or execution semantics. Source executions must still be established using WordRAM.Exec.
This compiler is original native program work. It does not supply an algorithm, an execution certificate or a bound for any source program.
Runtime address of source memory cell zero.
Instances For
Runtime value 2^w for the source word width w.
Instances For
Temporary absolute address used by translated loads and stores.
Instances For
One source instruction with actual address additions and load normalization.
Instances For
Rebase all memory accesses, retaining ordinary native branching and loop control.
Instances For
Ordinary value equalities relating source and target native data.
The source register bank and clipped memory agree.
The base register has the chosen runtime address.
The modulus register has the source word modulus.
Instances For
The compiler expands a flat instruction into at most three instructions.
Branches and loop overhead also satisfy the factor-three code-size bound.
Memory rebasing introduces no reads of the physical word width.
The compiled code reads the word width exactly when the source does.
A translated source instruction has actual native execution within three instructions. All source addresses fit the bounded source word, so the only writes are inside the runtime window. Dirty words are normalized by the translated load itself.
Clipped memory is source-word bounded whenever the represented register bank is bounded. No condition is imposed on the unnormalized physical memory words.
Every actual bounded deterministic source execution gives an actual target execution with
at most three times its charged instructions. The base and modulus survive, source registers
and clipped memory agree, and the entire caller memory outside the reserved window survives.
This is a compiler correctness rule over the existing native Exec, not an assumed execution
contract for an algorithm.
The bounded-time form of memory-window compiler correctness.
Normalize a static list of source registers, retaining the runtime base and modulus.
Instances For
A fixed instruction sequence normalizing each source register once. The final self-copy also makes the zero-register case an ordinary nonempty native program.
Instances For
Actual register normalization supplies a bounded source view without clearing any memory. The base, modulus and every caller memory cell are preserved.