This folder will serve as a source of information relating to LLVM's way of organizing the memory of a wasm32 program, as well as the way Diep's developer (Zeach) structured his game's memory.
LLVM's memory is layed out similarly to how a real computer lays out its programs. There are 4 main sections of the wasm memory, and they are present in all code compiled with LLVM -> wasm32
. Also - for more information about the wasm32
compilation target, read <unexistant>
.
TODO: Make links point to header3s (with horizontal rules) down below
- The Heap (
#heap
)
Stores all dynamically allocated data. Anytime the program callsmalloc()
(or another native dynamic allocation function), the allocation is stored somewhere in this range. - The Stack (
#stack
)
Function's variables are stored in scopes pushed onto the stack. - The Data Section (
#data
)
Stores static data (initialized or uninitialized) that the wasm uses to execute. For example, strings or global variabes are stored here. - The Void (
#void
)
An empty area in the memory.
This following image shows their placement in the memory. The top of the image represents the higher addresses, and the bottom of the image represents address 0.