@@ -134,64 +134,7 @@ struct Module {
134
134
135
135
## Byte Code
136
136
137
- This format is designed for fast and straightforward serialization and doesn't depend on a particular VM implementation.
138
-
139
- ** Requirements:**
140
- - VM serializer/deserializer should be very simple.
141
- - string: UTF16
142
- - number: in a binary format
143
- - bigint: in a binary format
144
- - len: u32
145
- - the byte code doesn't know anything about importing modules or I/O functions.
146
- - the byte code shouldn't contain syntax sugar.
147
- - serialized in a byte array so we can save it into a file. One byte is one unit.
148
- - least-significant byte first.
149
-
150
- ``` rust
151
- struct Array <T > {
152
- len : u32 ,
153
- array : [T ; self . len],
154
- }
155
-
156
- type String = Array <u16 >;
157
-
158
- // LSB first.
159
- type BigUInt = Array <u64 >;
160
-
161
- type Object = Array <(String , Any )>;
162
-
163
- // This is the main structure for serialization.
164
- type Code = Array <u8 >;
165
-
166
- struct Function {
167
- length : u32
168
- code : Code
169
- }
170
-
171
- // This structure is not for serialization because
172
- // a serialized module should resolve all imports.
173
- struct Module {
174
- import : Array <String >
175
- code : Code
176
- }
177
- ```
178
-
179
- | type| any | tag| | |
180
- | ----| --------------| ---| -----------------------| -----------------------------|
181
- | JSON| null | 00| | |
182
- | | number | 01| u64 | |
183
- | | false | 02| | |
184
- | | true | 03| | |
185
- | | string | 04| String | |
186
- | | object | 05| Object | |
187
- | | array | 06| Array<Any > | |
188
- | DJS | bigint+ | 07| BigUInt | |
189
- | | bigint- | 08| BigUInt | |
190
- | | local_ref | 09| u32 | consts[ i] |
191
- | FJS | arg_ref | 0A| u32 | args[ i] |
192
- | | undefined | 0B| | |
193
- | | function | 0C| Function | the last constant is a return|
194
- | | ... | | | |
137
+ See [ https://github.com/functionalscript/functionalscript/main/doc/ ] ( https://github.com/functionalscript/functionalscript/blob/main/doc/byte-code.md ) .
195
138
196
139
## Architecture
197
140
0 commit comments