-
Notifications
You must be signed in to change notification settings - Fork 10
Heap
Last bit:
- non-zero - pointer
- zero - small integer
undefined
, null
are just a pointers to the non-movable heap with a value,
known ahead of time during compilation.
First word (quad- or double-) is a pointer to map, all next data is a map's body.
[map pointer] [body...]
Map has the same structure as an Object.
There are some special, pre-defined maps: Number, Function, Object, ...
[Number map] [8-byte floating point value]
[Function map] [context] [Code]
[String map] [len] [len x bytes...]
[Cons-String map] [left] [right]
TBD
[Dense-Array map] [len] [len x pointers...]
[Context map] [parent] [num] [num x pointers...]
[Code map] [clen] [tlen] [rlen]
[clen x bytes...] # Actual machine code
[tlen x Type Info] # Various type info collected inside it
[rlen x Relocation Info] # Info for relocating stuff in code object and
# referencing other objects in heap
Stores generated machine code, allocated in exectuable heap.
[Object map] [space-size] [space-size x bytes...]
Note that map does also serve as a prototype chain.
A pointer-sized bitfield:
- 0000000 - unknown
- 0000010 - smi
- 0000011 - heap number
- 0000010 - number
- 0000100 - string
- 0001000 - function
- 0010000 - dense-array
- 0100000 - object
All stubs record their incoming types, making the info available at the CFG level.
A pointer sized relative offset (from the start of assembly code section in Code object).
Every time the runtime is entered from C++ - following structure is pushed on-stack:
0x................ <- pointer to a previous runtime's stack
0xdeadbeefbadbadb0