Expand description
Memory convention used in this crate:
- A memory page is contiguous memory of size 2^32 words, aligned to 2^32 word boundaries. There is one exception: due to the base field’s prime being 2^64 - 2^32 + 1, the last page, starting at address 2^64 - 2^32, is of size 1.
- The dynamic allocator lives at address
DYN_MALLOC_ADDRESS
, i.e., -1. It is a single word, containing a counter of allocated pages. It occupies the only page that is not of size 2^32 words. - Page 0 is reserved for non-deterministically initialized memory.
- The last full page, number (2^32)-2, starting at address 2^64 - 2·(2^32), is reserved for static allocations.
- The two preceding pages, number 2^32-4 and 2^32-3 are used by the STARK verifier (when standard memory layouts are used).
- Pages 1 through 2^31-1 are dynamically allocated by the dynamic allocator snippet.
- Pages 2^31 through 2^32-5 are not in use by this crate.
Modules§
Constants§
- Non-deterministically initialized memory lives in the range $[0: 2^{32})$
Functions§
- Stores the encoding of the given object into memory at the given address, and returns the address of the first untouched memory cell after.
- Returns the address of the first unpopulated word belonging to the memory region designated for non-determinism.
- Returns the address of the last populated word belonging to the memory region designated for non-determinism.
- Return the code to read
n
words from memory. Top of stack must point to last word of words to read. Leaves mutated pointer on top of stack. - Return the code to read
n
words from memory. Top of stack must point to last word of words to read. Pops the memory pointer from the stack. - Return the code to write
n
words to memory. Leaves a modified pointer on the stack. - Return the code to write
n
words to memory. Pops the memory pointer.