.
This commit is contained in:
21
doc/BYTECODE
21
doc/BYTECODE
@@ -3,22 +3,23 @@ Bytecode format
|
||||
|
||||
The bytecode file is composed of the following sections:
|
||||
|
||||
* 16-byte header
|
||||
[0:3]: Magic
|
||||
[4]: VM format
|
||||
* Index: pointers to each one of the sections, up to 8
|
||||
Each pointer: 4 bytes
|
||||
Each count: 4 bytes
|
||||
* [0x0] Constants indexes: all constants (such as strings) used in the code
|
||||
* HEADER: 16-byte header
|
||||
[0:3]: Magic
|
||||
[4]: VM format
|
||||
[rest]: Reserved for future use
|
||||
* TABLE_OF_CONTENTS: list of 8 records pointing to each one of the sections
|
||||
Each record (6 bytes):
|
||||
- Pointer to section: 4 bytes
|
||||
- Number of records in section: 2 bytes
|
||||
* [0x0] Constants indexes: pointers to each of the constant locations
|
||||
* Table of 4-byte constant indexes with pointer to constant
|
||||
(counter start at beginning of raw constants)
|
||||
* [0x1] Functions indexes: Pointer to functions within the code
|
||||
[0:3]: function pointer
|
||||
[0:3]: function pointer (counter start at the beginning of executable code)
|
||||
[4:5]: number of parameters
|
||||
[6:7]: number of local variables
|
||||
* [0x2] Constants raw data
|
||||
* [0x3] Code: executable code
|
||||
[1-byte]: operation
|
||||
[variable]: operand (see value encoding below)
|
||||
* [0x4] Debugging info
|
||||
???
|
||||
|
||||
|
||||
Reference in New Issue
Block a user