@fluffylabs/anan-as 1.2.0-e8a5af8 → 1.2.0-ef04361
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bin/src/trace-replay.js +2 -2
- package/dist/build/compiler-inline.js +1 -1
- package/dist/build/compiler.wasm +0 -0
- package/dist/build/debug-inline.js +1 -1
- package/dist/build/debug-raw-inline.js +1 -1
- package/dist/build/debug-raw.d.ts +34 -98
- package/dist/build/debug-raw.js +51 -105
- package/dist/build/debug-raw.wasm +0 -0
- package/dist/build/debug.d.ts +34 -98
- package/dist/build/debug.js +53 -112
- package/dist/build/debug.wasm +0 -0
- package/dist/build/js/assembly/api-debugger.d.ts +55 -0
- package/dist/build/js/assembly/api-debugger.js +245 -0
- package/dist/build/js/assembly/api-internal.d.ts +13 -0
- package/dist/build/js/assembly/api-internal.js +192 -0
- package/dist/build/js/assembly/api-types.d.ts +45 -0
- package/dist/build/js/assembly/api-types.js +53 -0
- package/dist/build/js/assembly/api-utils.d.ts +71 -0
- package/dist/build/js/assembly/api-utils.js +206 -0
- package/dist/build/js/assembly/arguments.d.ts +44 -0
- package/dist/build/js/assembly/arguments.js +164 -0
- package/dist/build/js/assembly/codec.d.ts +24 -0
- package/dist/build/js/assembly/codec.js +139 -0
- package/dist/build/js/assembly/gas-costs.d.ts +6 -0
- package/dist/build/js/assembly/gas-costs.js +39 -0
- package/dist/build/js/assembly/gas.d.ts +16 -0
- package/dist/build/js/assembly/gas.js +23 -0
- package/dist/build/js/assembly/index-shared.d.ts +4 -0
- package/dist/build/js/assembly/index-shared.js +4 -0
- package/dist/build/js/assembly/instructions/bit.d.ts +11 -0
- package/dist/build/js/assembly/instructions/bit.js +53 -0
- package/dist/build/js/assembly/instructions/branch.d.ts +17 -0
- package/dist/build/js/assembly/instructions/branch.js +120 -0
- package/dist/build/js/assembly/instructions/jump.d.ts +5 -0
- package/dist/build/js/assembly/instructions/jump.js +21 -0
- package/dist/build/js/assembly/instructions/load.d.ts +17 -0
- package/dist/build/js/assembly/instructions/load.js +134 -0
- package/dist/build/js/assembly/instructions/logic.d.ts +10 -0
- package/dist/build/js/assembly/instructions/logic.js +47 -0
- package/dist/build/js/assembly/instructions/math.d.ts +28 -0
- package/dist/build/js/assembly/instructions/math.js +225 -0
- package/dist/build/js/assembly/instructions/misc.d.ts +6 -0
- package/dist/build/js/assembly/instructions/misc.js +22 -0
- package/dist/build/js/assembly/instructions/mov.d.ts +6 -0
- package/dist/build/js/assembly/instructions/mov.js +35 -0
- package/dist/build/js/assembly/instructions/outcome.d.ts +30 -0
- package/dist/build/js/assembly/instructions/outcome.js +63 -0
- package/dist/build/js/assembly/instructions/rot.d.ts +15 -0
- package/dist/build/js/assembly/instructions/rot.js +66 -0
- package/dist/build/js/assembly/instructions/set.d.ts +7 -0
- package/dist/build/js/assembly/instructions/set.js +36 -0
- package/dist/build/js/assembly/instructions/shift.d.ts +19 -0
- package/dist/build/js/assembly/instructions/shift.js +121 -0
- package/dist/build/js/assembly/instructions/store.d.ts +17 -0
- package/dist/build/js/assembly/instructions/store.js +101 -0
- package/dist/build/js/assembly/instructions/utils.d.ts +23 -0
- package/dist/build/js/assembly/instructions/utils.js +75 -0
- package/dist/build/js/assembly/instructions-exe.d.ts +2 -0
- package/dist/build/js/assembly/instructions-exe.js +245 -0
- package/dist/build/js/assembly/instructions.d.ts +11 -0
- package/dist/build/js/assembly/instructions.js +252 -0
- package/dist/build/js/assembly/interpreter.d.ts +29 -0
- package/dist/build/js/assembly/interpreter.js +229 -0
- package/dist/build/js/assembly/math.d.ts +8 -0
- package/dist/build/js/assembly/math.js +14 -0
- package/dist/build/js/assembly/memory-page.d.ts +38 -0
- package/dist/build/js/assembly/memory-page.js +68 -0
- package/dist/build/js/assembly/memory.d.ts +82 -0
- package/dist/build/js/assembly/memory.js +386 -0
- package/dist/build/js/assembly/portable.d.ts +24 -0
- package/dist/build/js/assembly/portable.js +362 -0
- package/dist/build/js/assembly/program-build.d.ts +2 -0
- package/dist/build/js/assembly/program-build.js +104 -0
- package/dist/build/js/assembly/program.d.ts +78 -0
- package/dist/build/js/assembly/program.js +284 -0
- package/dist/build/js/assembly/registers.d.ts +6 -0
- package/dist/build/js/assembly/registers.js +9 -0
- package/dist/build/js/assembly/spi.d.ts +92 -0
- package/dist/build/js/assembly/spi.js +152 -0
- package/dist/build/js/portable/bootstrap.d.ts +1 -0
- package/dist/build/js/portable/bootstrap.js +5 -0
- package/dist/build/js/portable/index.d.ts +4 -0
- package/dist/build/js/portable/index.js +6 -0
- package/dist/build/js/portable-bundle.js +4309 -0
- package/dist/build/release-inline.js +1 -1
- package/dist/build/release-mini-inline.js +1 -1
- package/dist/build/release-mini.d.ts +34 -98
- package/dist/build/release-mini.js +53 -112
- package/dist/build/release-mini.wasm +0 -0
- package/dist/build/release-stub-inline.js +1 -1
- package/dist/build/release-stub.d.ts +34 -98
- package/dist/build/release-stub.js +53 -112
- package/dist/build/release-stub.wasm +0 -0
- package/dist/build/release.d.ts +34 -98
- package/dist/build/release.js +53 -112
- package/dist/build/release.wasm +0 -0
- package/dist/build/test-inline.js +1 -1
- package/dist/build/test.wasm +0 -0
- package/dist/test/test-w3f-common.js +126 -0
- package/dist/test/test-w3f-portable.js +5 -0
- package/dist/test/test-w3f.js +3 -120
- package/package.json +11 -4
|
@@ -6,6 +6,18 @@ export declare function __pin(ptr: number): number;
|
|
|
6
6
|
export declare function __unpin(ptr: number): void;
|
|
7
7
|
export declare function __collect(): void;
|
|
8
8
|
export declare const __rtti_base: number;
|
|
9
|
+
/**
|
|
10
|
+
* assembly/api-internal/getAssembly
|
|
11
|
+
* @param p `assembly/program/Program`
|
|
12
|
+
* @returns `~lib/string/String`
|
|
13
|
+
*/
|
|
14
|
+
export declare function getAssembly(p: __Internref28): string;
|
|
15
|
+
/**
|
|
16
|
+
* assembly/program-build/wrapAsProgram
|
|
17
|
+
* @param bytecode `~lib/typedarray/Uint8Array`
|
|
18
|
+
* @returns `~lib/typedarray/Uint8Array`
|
|
19
|
+
*/
|
|
20
|
+
export declare function wrapAsProgram(bytecode: Uint8Array): Uint8Array;
|
|
9
21
|
/**
|
|
10
22
|
* assembly/api-debugger/resetJAM
|
|
11
23
|
* @param program `~lib/array/Array<u8>`
|
|
@@ -110,47 +122,6 @@ export declare function getMemory(address: number, length: number): Uint8Array |
|
|
|
110
122
|
* @returns `bool`
|
|
111
123
|
*/
|
|
112
124
|
export declare function setMemory(address: number, data: Uint8Array): boolean;
|
|
113
|
-
/**
|
|
114
|
-
* assembly/api-internal/getAssembly
|
|
115
|
-
* @param p `assembly/program/Program`
|
|
116
|
-
* @returns `~lib/string/String`
|
|
117
|
-
*/
|
|
118
|
-
export declare function getAssembly(p: __Internref26): string;
|
|
119
|
-
/**
|
|
120
|
-
* assembly/api-internal/buildMemory
|
|
121
|
-
* @param builder `assembly/memory/MemoryBuilder`
|
|
122
|
-
* @param pages `~lib/array/Array<assembly/api-types/InitialPage>`
|
|
123
|
-
* @param chunks `~lib/array/Array<assembly/api-types/InitialChunk>`
|
|
124
|
-
* @returns `assembly/memory/Memory`
|
|
125
|
-
*/
|
|
126
|
-
export declare function buildMemory(builder: __Internref41, pages: Array<__Record44<undefined>>, chunks: Array<__Record46<undefined>>): __Internref15;
|
|
127
|
-
/**
|
|
128
|
-
* assembly/api-internal/vmInit
|
|
129
|
-
* @param input `assembly/api-types/VmInput`
|
|
130
|
-
* @param useSbrkGas `bool`
|
|
131
|
-
* @returns `assembly/interpreter/Interpreter`
|
|
132
|
-
*/
|
|
133
|
-
export declare function vmInit(input: __Internref49, useSbrkGas?: boolean): __Internref25;
|
|
134
|
-
/**
|
|
135
|
-
* assembly/api-internal/vmRunOnce
|
|
136
|
-
* @param input `assembly/api-types/VmInput`
|
|
137
|
-
* @param options `assembly/api-types/VmRunOptions`
|
|
138
|
-
* @returns `assembly/api-types/VmOutput`
|
|
139
|
-
*/
|
|
140
|
-
export declare function vmRunOnce(input: __Internref49, options: __Record50<undefined>): __Record51<never>;
|
|
141
|
-
/**
|
|
142
|
-
* assembly/api-internal/vmExecute
|
|
143
|
-
* @param int `assembly/interpreter/Interpreter`
|
|
144
|
-
* @param logs `bool`
|
|
145
|
-
*/
|
|
146
|
-
export declare function vmExecute(int: __Internref25, logs?: boolean): void;
|
|
147
|
-
/**
|
|
148
|
-
* assembly/api-internal/vmDestroy
|
|
149
|
-
* @param int `assembly/interpreter/Interpreter`
|
|
150
|
-
* @param dumpMemory `bool`
|
|
151
|
-
* @returns `assembly/api-types/VmOutput`
|
|
152
|
-
*/
|
|
153
|
-
export declare function vmDestroy(int: __Internref25, dumpMemory?: boolean): __Record51<never>;
|
|
154
125
|
/** assembly/api-utils/InputKind */
|
|
155
126
|
export declare enum InputKind {
|
|
156
127
|
/** @type `i32` */
|
|
@@ -172,7 +143,7 @@ export declare enum HasMetadata {
|
|
|
172
143
|
* @param withMetadata `i32`
|
|
173
144
|
* @returns `~lib/array/Array<assembly/gas-costs/BlockGasCost>`
|
|
174
145
|
*/
|
|
175
|
-
export declare function getGasCosts(input: Array<number>, kind: number, withMetadata: number): Array<
|
|
146
|
+
export declare function getGasCosts(input: Array<number>, kind: number, withMetadata: number): Array<__Record53<never>>;
|
|
176
147
|
/**
|
|
177
148
|
* assembly/api-utils/disassemble
|
|
178
149
|
* @param input `~lib/array/Array<u8>`
|
|
@@ -193,7 +164,7 @@ export declare function disassemble(input: Array<number>, kind: number, withMeta
|
|
|
193
164
|
* @param preallocateMemoryPages `u32`
|
|
194
165
|
* @returns `assembly/spi/StandardProgram`
|
|
195
166
|
*/
|
|
196
|
-
export declare function prepareProgram(kind: number, hasMetadata: number, program: Array<number>, initialRegisters: Array<bigint>, initialPageMap: Array<
|
|
167
|
+
export declare function prepareProgram(kind: number, hasMetadata: number, program: Array<number>, initialRegisters: Array<bigint>, initialPageMap: Array<__Record49<undefined>>, initialMemory: Array<__Record51<undefined>>, args: Array<number>, preallocateMemoryPages: number): __Internref45;
|
|
197
168
|
/**
|
|
198
169
|
* assembly/api-utils/runProgram
|
|
199
170
|
* @param program `assembly/spi/StandardProgram`
|
|
@@ -204,20 +175,20 @@ export declare function prepareProgram(kind: number, hasMetadata: number, progra
|
|
|
204
175
|
* @param dumpMemory `bool`
|
|
205
176
|
* @returns `assembly/api-types/VmOutput`
|
|
206
177
|
*/
|
|
207
|
-
export declare function runProgram(program:
|
|
178
|
+
export declare function runProgram(program: __Internref45, initialGas?: bigint, programCounter?: number, logs?: boolean, useSbrkGas?: boolean, dumpMemory?: boolean): __Record58<never>;
|
|
208
179
|
/**
|
|
209
180
|
* assembly/api-utils/pvmStart
|
|
210
181
|
* @param program `assembly/spi/StandardProgram`
|
|
211
182
|
* @param useSbrkGas `bool`
|
|
212
183
|
* @returns `u32`
|
|
213
184
|
*/
|
|
214
|
-
export declare function pvmStart(program:
|
|
185
|
+
export declare function pvmStart(program: __Internref45, useSbrkGas?: boolean): number;
|
|
215
186
|
/**
|
|
216
187
|
* assembly/api-utils/pvmDestroy
|
|
217
188
|
* @param pvmId `u32`
|
|
218
189
|
* @returns `assembly/api-types/VmOutput | null`
|
|
219
190
|
*/
|
|
220
|
-
export declare function pvmDestroy(pvmId: number):
|
|
191
|
+
export declare function pvmDestroy(pvmId: number): __Record58<never> | null;
|
|
221
192
|
/**
|
|
222
193
|
* assembly/api-utils/pvmSetRegisters
|
|
223
194
|
* @param pvmId `u32`
|
|
@@ -255,25 +226,21 @@ export declare function pvmWriteMemory(pvmId: number, address: number, data: Uin
|
|
|
255
226
|
* @param logs `bool`
|
|
256
227
|
* @returns `assembly/api-types/VmPause | null`
|
|
257
228
|
*/
|
|
258
|
-
export declare function pvmResume(pvmId: number, gas: bigint, pc: number, logs?: boolean):
|
|
259
|
-
/**
|
|
260
|
-
* assembly/program-build/wrapAsProgram
|
|
261
|
-
* @param bytecode `~lib/typedarray/Uint8Array`
|
|
262
|
-
* @returns `~lib/typedarray/Uint8Array`
|
|
263
|
-
*/
|
|
264
|
-
export declare function wrapAsProgram(bytecode: Uint8Array): Uint8Array;
|
|
229
|
+
export declare function pvmResume(pvmId: number, gas: bigint, pc: number, logs?: boolean): __Record64<never> | null;
|
|
265
230
|
/** assembly/program/Program */
|
|
266
|
-
declare class
|
|
267
|
-
private
|
|
231
|
+
declare class __Internref28 extends Number {
|
|
232
|
+
private __nominal28: symbol;
|
|
268
233
|
private __nominal0: symbol;
|
|
269
234
|
}
|
|
270
|
-
/** assembly/
|
|
271
|
-
declare
|
|
272
|
-
|
|
273
|
-
|
|
235
|
+
/** assembly/gas-costs/BlockGasCost */
|
|
236
|
+
declare interface __Record53<TOmittable> {
|
|
237
|
+
/** @type `u32` */
|
|
238
|
+
pc: number | TOmittable;
|
|
239
|
+
/** @type `u64` */
|
|
240
|
+
gas: bigint | TOmittable;
|
|
274
241
|
}
|
|
275
242
|
/** assembly/api-types/InitialPage */
|
|
276
|
-
declare interface
|
|
243
|
+
declare interface __Record49<TOmittable> {
|
|
277
244
|
/** @type `u32` */
|
|
278
245
|
address: number | TOmittable;
|
|
279
246
|
/** @type `u32` */
|
|
@@ -282,38 +249,19 @@ declare interface __Record44<TOmittable> {
|
|
|
282
249
|
access: number | TOmittable;
|
|
283
250
|
}
|
|
284
251
|
/** assembly/api-types/InitialChunk */
|
|
285
|
-
declare interface
|
|
252
|
+
declare interface __Record51<TOmittable> {
|
|
286
253
|
/** @type `u32` */
|
|
287
254
|
address: number | TOmittable;
|
|
288
255
|
/** @type `~lib/array/Array<u8>` */
|
|
289
256
|
data: Array<number>;
|
|
290
257
|
}
|
|
291
|
-
/** assembly/
|
|
292
|
-
declare class
|
|
293
|
-
private
|
|
294
|
-
private __nominal0: symbol;
|
|
295
|
-
}
|
|
296
|
-
/** assembly/api-types/VmInput */
|
|
297
|
-
declare class __Internref49 extends Number {
|
|
298
|
-
private __nominal49: symbol;
|
|
299
|
-
private __nominal0: symbol;
|
|
300
|
-
}
|
|
301
|
-
/** assembly/interpreter/Interpreter */
|
|
302
|
-
declare class __Internref25 extends Number {
|
|
303
|
-
private __nominal25: symbol;
|
|
258
|
+
/** assembly/spi/StandardProgram */
|
|
259
|
+
declare class __Internref45 extends Number {
|
|
260
|
+
private __nominal45: symbol;
|
|
304
261
|
private __nominal0: symbol;
|
|
305
262
|
}
|
|
306
|
-
/** assembly/api-types/VmRunOptions */
|
|
307
|
-
declare interface __Record50<TOmittable> {
|
|
308
|
-
/** @type `bool` */
|
|
309
|
-
useSbrkGas: boolean | TOmittable;
|
|
310
|
-
/** @type `bool` */
|
|
311
|
-
logs: boolean | TOmittable;
|
|
312
|
-
/** @type `bool` */
|
|
313
|
-
dumpMemory: boolean | TOmittable;
|
|
314
|
-
}
|
|
315
263
|
/** assembly/api-types/VmOutput */
|
|
316
|
-
declare interface
|
|
264
|
+
declare interface __Record58<TOmittable> {
|
|
317
265
|
/** @type `i32` */
|
|
318
266
|
status: number | TOmittable;
|
|
319
267
|
/** @type `u32` */
|
|
@@ -327,22 +275,10 @@ declare interface __Record51<TOmittable> {
|
|
|
327
275
|
/** @type `~lib/array/Array<u64>` */
|
|
328
276
|
registers: Array<bigint>;
|
|
329
277
|
/** @type `~lib/array/Array<assembly/api-types/InitialChunk>` */
|
|
330
|
-
memory: Array<
|
|
331
|
-
}
|
|
332
|
-
/** assembly/gas-costs/BlockGasCost */
|
|
333
|
-
declare interface __Record56<TOmittable> {
|
|
334
|
-
/** @type `u32` */
|
|
335
|
-
pc: number | TOmittable;
|
|
336
|
-
/** @type `u64` */
|
|
337
|
-
gas: bigint | TOmittable;
|
|
338
|
-
}
|
|
339
|
-
/** assembly/spi/StandardProgram */
|
|
340
|
-
declare class __Internref40 extends Number {
|
|
341
|
-
private __nominal40: symbol;
|
|
342
|
-
private __nominal0: symbol;
|
|
278
|
+
memory: Array<__Record51<never>>;
|
|
343
279
|
}
|
|
344
280
|
/** assembly/api-types/VmPause */
|
|
345
|
-
declare interface
|
|
281
|
+
declare interface __Record64<TOmittable> {
|
|
346
282
|
/** @type `i32` */
|
|
347
283
|
status: number | TOmittable;
|
|
348
284
|
/** @type `u32` */
|
|
@@ -22,11 +22,21 @@ async function instantiate(module, imports = {}) {
|
|
|
22
22
|
const { exports } = await WebAssembly.instantiate(module, adaptedImports);
|
|
23
23
|
const memory = exports.memory || imports.env.memory;
|
|
24
24
|
const adaptedExports = Object.setPrototypeOf({
|
|
25
|
+
getAssembly(p) {
|
|
26
|
+
// assembly/api-internal/getAssembly(assembly/program/Program) => ~lib/string/String
|
|
27
|
+
p = __lowerInternref(p) || __notnull();
|
|
28
|
+
return __liftString(exports.getAssembly(p) >>> 0);
|
|
29
|
+
},
|
|
30
|
+
wrapAsProgram(bytecode) {
|
|
31
|
+
// assembly/program-build/wrapAsProgram(~lib/typedarray/Uint8Array) => ~lib/typedarray/Uint8Array
|
|
32
|
+
bytecode = __lowerTypedArray(Uint8Array, 12, 0, bytecode) || __notnull();
|
|
33
|
+
return __liftTypedArray(Uint8Array, exports.wrapAsProgram(bytecode) >>> 0);
|
|
34
|
+
},
|
|
25
35
|
resetJAM(program, pc, initialGas, args, hasMetadata) {
|
|
26
36
|
// assembly/api-debugger/resetJAM(~lib/array/Array<u8>, u32, i64, ~lib/array/Array<u8>, bool?) => void
|
|
27
|
-
program = __retain(__lowerArray(__setU8,
|
|
37
|
+
program = __retain(__lowerArray(__setU8, 7, 0, program) || __notnull());
|
|
28
38
|
initialGas = initialGas || 0n;
|
|
29
|
-
args = __lowerArray(__setU8,
|
|
39
|
+
args = __lowerArray(__setU8, 7, 0, args) || __notnull();
|
|
30
40
|
hasMetadata = hasMetadata ? 1 : 0;
|
|
31
41
|
try {
|
|
32
42
|
exports.__setArgumentsLength(arguments.length);
|
|
@@ -37,8 +47,8 @@ async function instantiate(module, imports = {}) {
|
|
|
37
47
|
},
|
|
38
48
|
resetGeneric(program, flatRegisters, initialGas, hasMetadata) {
|
|
39
49
|
// assembly/api-debugger/resetGeneric(~lib/array/Array<u8>, ~lib/array/Array<u8>, i64, bool?) => void
|
|
40
|
-
program = __retain(__lowerArray(__setU8,
|
|
41
|
-
flatRegisters = __lowerArray(__setU8,
|
|
50
|
+
program = __retain(__lowerArray(__setU8, 7, 0, program) || __notnull());
|
|
51
|
+
flatRegisters = __lowerArray(__setU8, 7, 0, flatRegisters) || __notnull();
|
|
42
52
|
initialGas = initialGas || 0n;
|
|
43
53
|
hasMetadata = hasMetadata ? 1 : 0;
|
|
44
54
|
try {
|
|
@@ -50,10 +60,10 @@ async function instantiate(module, imports = {}) {
|
|
|
50
60
|
},
|
|
51
61
|
resetGenericWithMemory(program, flatRegisters, pageMap, chunks, initialGas, hasMetadata) {
|
|
52
62
|
// assembly/api-debugger/resetGenericWithMemory(~lib/array/Array<u8>, ~lib/array/Array<u8>, ~lib/typedarray/Uint8Array, ~lib/typedarray/Uint8Array, i64, bool?) => void
|
|
53
|
-
program = __retain(__lowerArray(__setU8,
|
|
54
|
-
flatRegisters = __retain(__lowerArray(__setU8,
|
|
55
|
-
pageMap = __retain(__lowerTypedArray(Uint8Array,
|
|
56
|
-
chunks = __lowerTypedArray(Uint8Array,
|
|
63
|
+
program = __retain(__lowerArray(__setU8, 7, 0, program) || __notnull());
|
|
64
|
+
flatRegisters = __retain(__lowerArray(__setU8, 7, 0, flatRegisters) || __notnull());
|
|
65
|
+
pageMap = __retain(__lowerTypedArray(Uint8Array, 12, 0, pageMap) || __notnull());
|
|
66
|
+
chunks = __lowerTypedArray(Uint8Array, 12, 0, chunks) || __notnull();
|
|
57
67
|
initialGas = initialGas || 0n;
|
|
58
68
|
hasMetadata = hasMetadata ? 1 : 0;
|
|
59
69
|
try {
|
|
@@ -92,7 +102,7 @@ async function instantiate(module, imports = {}) {
|
|
|
92
102
|
},
|
|
93
103
|
setRegisters(flatRegisters) {
|
|
94
104
|
// assembly/api-debugger/setRegisters(~lib/array/Array<u8>) => void
|
|
95
|
-
flatRegisters = __lowerArray(__setU8,
|
|
105
|
+
flatRegisters = __lowerArray(__setU8, 7, 0, flatRegisters) || __notnull();
|
|
96
106
|
exports.setRegisters(flatRegisters);
|
|
97
107
|
},
|
|
98
108
|
getPageDump(index) {
|
|
@@ -109,57 +119,9 @@ async function instantiate(module, imports = {}) {
|
|
|
109
119
|
},
|
|
110
120
|
setMemory(address, data) {
|
|
111
121
|
// assembly/api-debugger/setMemory(u32, ~lib/typedarray/Uint8Array) => bool
|
|
112
|
-
data = __lowerTypedArray(Uint8Array,
|
|
122
|
+
data = __lowerTypedArray(Uint8Array, 12, 0, data) || __notnull();
|
|
113
123
|
return exports.setMemory(address, data) != 0;
|
|
114
124
|
},
|
|
115
|
-
getAssembly(p) {
|
|
116
|
-
// assembly/api-internal/getAssembly(assembly/program/Program) => ~lib/string/String
|
|
117
|
-
p = __lowerInternref(p) || __notnull();
|
|
118
|
-
return __liftString(exports.getAssembly(p) >>> 0);
|
|
119
|
-
},
|
|
120
|
-
buildMemory(builder, pages, chunks) {
|
|
121
|
-
// assembly/api-internal/buildMemory(assembly/memory/MemoryBuilder, ~lib/array/Array<assembly/api-types/InitialPage>, ~lib/array/Array<assembly/api-types/InitialChunk>) => assembly/memory/Memory
|
|
122
|
-
builder = __retain(__lowerInternref(builder) || __notnull());
|
|
123
|
-
pages = __retain(__lowerArray((pointer, value) => { __setU32(pointer, __lowerRecord44(value) || __notnull()); }, 45, 2, pages) || __notnull());
|
|
124
|
-
chunks = __lowerArray((pointer, value) => { __setU32(pointer, __lowerRecord46(value) || __notnull()); }, 47, 2, chunks) || __notnull();
|
|
125
|
-
try {
|
|
126
|
-
return __liftInternref(exports.buildMemory(builder, pages, chunks) >>> 0);
|
|
127
|
-
} finally {
|
|
128
|
-
__release(builder);
|
|
129
|
-
__release(pages);
|
|
130
|
-
}
|
|
131
|
-
},
|
|
132
|
-
vmInit(input, useSbrkGas) {
|
|
133
|
-
// assembly/api-internal/vmInit(assembly/api-types/VmInput, bool?) => assembly/interpreter/Interpreter
|
|
134
|
-
input = __lowerInternref(input) || __notnull();
|
|
135
|
-
useSbrkGas = useSbrkGas ? 1 : 0;
|
|
136
|
-
exports.__setArgumentsLength(arguments.length);
|
|
137
|
-
return __liftInternref(exports.vmInit(input, useSbrkGas) >>> 0);
|
|
138
|
-
},
|
|
139
|
-
vmRunOnce(input, options) {
|
|
140
|
-
// assembly/api-internal/vmRunOnce(assembly/api-types/VmInput, assembly/api-types/VmRunOptions) => assembly/api-types/VmOutput
|
|
141
|
-
input = __retain(__lowerInternref(input) || __notnull());
|
|
142
|
-
options = __lowerRecord50(options) || __notnull();
|
|
143
|
-
try {
|
|
144
|
-
return __liftRecord51(exports.vmRunOnce(input, options) >>> 0);
|
|
145
|
-
} finally {
|
|
146
|
-
__release(input);
|
|
147
|
-
}
|
|
148
|
-
},
|
|
149
|
-
vmExecute(int, logs) {
|
|
150
|
-
// assembly/api-internal/vmExecute(assembly/interpreter/Interpreter, bool?) => void
|
|
151
|
-
int = __lowerInternref(int) || __notnull();
|
|
152
|
-
logs = logs ? 1 : 0;
|
|
153
|
-
exports.__setArgumentsLength(arguments.length);
|
|
154
|
-
exports.vmExecute(int, logs);
|
|
155
|
-
},
|
|
156
|
-
vmDestroy(int, dumpMemory) {
|
|
157
|
-
// assembly/api-internal/vmDestroy(assembly/interpreter/Interpreter, bool?) => assembly/api-types/VmOutput
|
|
158
|
-
int = __lowerInternref(int) || __notnull();
|
|
159
|
-
dumpMemory = dumpMemory ? 1 : 0;
|
|
160
|
-
exports.__setArgumentsLength(arguments.length);
|
|
161
|
-
return __liftRecord51(exports.vmDestroy(int, dumpMemory) >>> 0);
|
|
162
|
-
},
|
|
163
125
|
InputKind: (values => (
|
|
164
126
|
// assembly/api-utils/InputKind
|
|
165
127
|
values[values.Generic = exports["InputKind.Generic"].valueOf()] = "Generic",
|
|
@@ -174,21 +136,21 @@ async function instantiate(module, imports = {}) {
|
|
|
174
136
|
))({}),
|
|
175
137
|
getGasCosts(input, kind, withMetadata) {
|
|
176
138
|
// assembly/api-utils/getGasCosts(~lib/array/Array<u8>, i32, i32) => ~lib/array/Array<assembly/gas-costs/BlockGasCost>
|
|
177
|
-
input = __lowerArray(__setU8,
|
|
178
|
-
return __liftArray(pointer =>
|
|
139
|
+
input = __lowerArray(__setU8, 7, 0, input) || __notnull();
|
|
140
|
+
return __liftArray(pointer => __liftRecord53(__getU32(pointer)), 2, exports.getGasCosts(input, kind, withMetadata) >>> 0);
|
|
179
141
|
},
|
|
180
142
|
disassemble(input, kind, withMetadata) {
|
|
181
143
|
// assembly/api-utils/disassemble(~lib/array/Array<u8>, i32, i32) => ~lib/string/String
|
|
182
|
-
input = __lowerArray(__setU8,
|
|
144
|
+
input = __lowerArray(__setU8, 7, 0, input) || __notnull();
|
|
183
145
|
return __liftString(exports.disassemble(input, kind, withMetadata) >>> 0);
|
|
184
146
|
},
|
|
185
147
|
prepareProgram(kind, hasMetadata, program, initialRegisters, initialPageMap, initialMemory, args, preallocateMemoryPages) {
|
|
186
148
|
// assembly/api-utils/prepareProgram(i32, i32, ~lib/array/Array<u8>, ~lib/array/Array<u64>, ~lib/array/Array<assembly/api-types/InitialPage>, ~lib/array/Array<assembly/api-types/InitialChunk>, ~lib/array/Array<u8>, u32) => assembly/spi/StandardProgram
|
|
187
|
-
program = __retain(__lowerArray(__setU8,
|
|
188
|
-
initialRegisters = __retain(__lowerArray(__setU64,
|
|
189
|
-
initialPageMap = __retain(__lowerArray((pointer, value) => { __setU32(pointer,
|
|
190
|
-
initialMemory = __retain(__lowerArray((pointer, value) => { __setU32(pointer,
|
|
191
|
-
args = __lowerArray(__setU8,
|
|
149
|
+
program = __retain(__lowerArray(__setU8, 7, 0, program) || __notnull());
|
|
150
|
+
initialRegisters = __retain(__lowerArray(__setU64, 55, 3, initialRegisters) || __notnull());
|
|
151
|
+
initialPageMap = __retain(__lowerArray((pointer, value) => { __setU32(pointer, __lowerRecord49(value) || __notnull()); }, 50, 2, initialPageMap) || __notnull());
|
|
152
|
+
initialMemory = __retain(__lowerArray((pointer, value) => { __setU32(pointer, __lowerRecord51(value) || __notnull()); }, 52, 2, initialMemory) || __notnull());
|
|
153
|
+
args = __lowerArray(__setU8, 7, 0, args) || __notnull();
|
|
192
154
|
try {
|
|
193
155
|
return __liftInternref(exports.prepareProgram(kind, hasMetadata, program, initialRegisters, initialPageMap, initialMemory, args, preallocateMemoryPages) >>> 0);
|
|
194
156
|
} finally {
|
|
@@ -206,7 +168,7 @@ async function instantiate(module, imports = {}) {
|
|
|
206
168
|
useSbrkGas = useSbrkGas ? 1 : 0;
|
|
207
169
|
dumpMemory = dumpMemory ? 1 : 0;
|
|
208
170
|
exports.__setArgumentsLength(arguments.length);
|
|
209
|
-
return
|
|
171
|
+
return __liftRecord58(exports.runProgram(program, initialGas, programCounter, logs, useSbrkGas, dumpMemory) >>> 0);
|
|
210
172
|
},
|
|
211
173
|
pvmStart(program, useSbrkGas) {
|
|
212
174
|
// assembly/api-utils/pvmStart(assembly/spi/StandardProgram, bool?) => u32
|
|
@@ -217,11 +179,11 @@ async function instantiate(module, imports = {}) {
|
|
|
217
179
|
},
|
|
218
180
|
pvmDestroy(pvmId) {
|
|
219
181
|
// assembly/api-utils/pvmDestroy(u32) => assembly/api-types/VmOutput | null
|
|
220
|
-
return
|
|
182
|
+
return __liftRecord58(exports.pvmDestroy(pvmId) >>> 0);
|
|
221
183
|
},
|
|
222
184
|
pvmSetRegisters(pvmId, registers) {
|
|
223
185
|
// assembly/api-utils/pvmSetRegisters(u32, ~lib/array/Array<u64>) => void
|
|
224
|
-
registers = __lowerArray(__setU64,
|
|
186
|
+
registers = __lowerArray(__setU64, 55, 3, registers) || __notnull();
|
|
225
187
|
exports.pvmSetRegisters(pvmId, registers);
|
|
226
188
|
},
|
|
227
189
|
pvmReadMemory(pvmId, address, length) {
|
|
@@ -234,7 +196,7 @@ async function instantiate(module, imports = {}) {
|
|
|
234
196
|
},
|
|
235
197
|
pvmWriteMemory(pvmId, address, data) {
|
|
236
198
|
// assembly/api-utils/pvmWriteMemory(u32, u32, ~lib/typedarray/Uint8Array) => bool
|
|
237
|
-
data = __lowerTypedArray(Uint8Array,
|
|
199
|
+
data = __lowerTypedArray(Uint8Array, 12, 0, data) || __notnull();
|
|
238
200
|
return exports.pvmWriteMemory(pvmId, address, data) != 0;
|
|
239
201
|
},
|
|
240
202
|
pvmResume(pvmId, gas, pc, logs) {
|
|
@@ -242,47 +204,40 @@ async function instantiate(module, imports = {}) {
|
|
|
242
204
|
gas = gas || 0n;
|
|
243
205
|
logs = logs ? 1 : 0;
|
|
244
206
|
exports.__setArgumentsLength(arguments.length);
|
|
245
|
-
return
|
|
246
|
-
},
|
|
247
|
-
wrapAsProgram(bytecode) {
|
|
248
|
-
// assembly/program-build/wrapAsProgram(~lib/typedarray/Uint8Array) => ~lib/typedarray/Uint8Array
|
|
249
|
-
bytecode = __lowerTypedArray(Uint8Array, 10, 0, bytecode) || __notnull();
|
|
250
|
-
return __liftTypedArray(Uint8Array, exports.wrapAsProgram(bytecode) >>> 0);
|
|
207
|
+
return __liftRecord64(exports.pvmResume(pvmId, gas, pc, logs) >>> 0);
|
|
251
208
|
},
|
|
252
209
|
}, exports);
|
|
253
|
-
function
|
|
210
|
+
function __liftRecord53(pointer) {
|
|
211
|
+
// assembly/gas-costs/BlockGasCost
|
|
212
|
+
// Hint: Opt-out from lifting as a record by providing an empty constructor
|
|
213
|
+
if (!pointer) return null;
|
|
214
|
+
return {
|
|
215
|
+
pc: __getU32(pointer + 0),
|
|
216
|
+
gas: __getU64(pointer + 8),
|
|
217
|
+
};
|
|
218
|
+
}
|
|
219
|
+
function __lowerRecord49(value) {
|
|
254
220
|
// assembly/api-types/InitialPage
|
|
255
221
|
// Hint: Opt-out from lowering as a record by providing an empty constructor
|
|
256
222
|
if (value == null) return 0;
|
|
257
|
-
const pointer = exports.__pin(exports.__new(12,
|
|
223
|
+
const pointer = exports.__pin(exports.__new(12, 49));
|
|
258
224
|
__setU32(pointer + 0, value.address);
|
|
259
225
|
__setU32(pointer + 4, value.length);
|
|
260
226
|
__setU32(pointer + 8, value.access);
|
|
261
227
|
exports.__unpin(pointer);
|
|
262
228
|
return pointer;
|
|
263
229
|
}
|
|
264
|
-
function
|
|
230
|
+
function __lowerRecord51(value) {
|
|
265
231
|
// assembly/api-types/InitialChunk
|
|
266
232
|
// Hint: Opt-out from lowering as a record by providing an empty constructor
|
|
267
233
|
if (value == null) return 0;
|
|
268
|
-
const pointer = exports.__pin(exports.__new(8,
|
|
234
|
+
const pointer = exports.__pin(exports.__new(8, 51));
|
|
269
235
|
__setU32(pointer + 0, value.address);
|
|
270
|
-
__setU32(pointer + 4, __lowerArray(__setU8,
|
|
236
|
+
__setU32(pointer + 4, __lowerArray(__setU8, 7, 0, value.data) || __notnull());
|
|
271
237
|
exports.__unpin(pointer);
|
|
272
238
|
return pointer;
|
|
273
239
|
}
|
|
274
|
-
function
|
|
275
|
-
// assembly/api-types/VmRunOptions
|
|
276
|
-
// Hint: Opt-out from lowering as a record by providing an empty constructor
|
|
277
|
-
if (value == null) return 0;
|
|
278
|
-
const pointer = exports.__pin(exports.__new(3, 50));
|
|
279
|
-
__setU8(pointer + 0, value.useSbrkGas ? 1 : 0);
|
|
280
|
-
__setU8(pointer + 1, value.logs ? 1 : 0);
|
|
281
|
-
__setU8(pointer + 2, value.dumpMemory ? 1 : 0);
|
|
282
|
-
exports.__unpin(pointer);
|
|
283
|
-
return pointer;
|
|
284
|
-
}
|
|
285
|
-
function __liftRecord46(pointer) {
|
|
240
|
+
function __liftRecord51(pointer) {
|
|
286
241
|
// assembly/api-types/InitialChunk
|
|
287
242
|
// Hint: Opt-out from lifting as a record by providing an empty constructor
|
|
288
243
|
if (!pointer) return null;
|
|
@@ -291,7 +246,7 @@ async function instantiate(module, imports = {}) {
|
|
|
291
246
|
data: __liftArray(__getU8, 0, __getU32(pointer + 4)),
|
|
292
247
|
};
|
|
293
248
|
}
|
|
294
|
-
function
|
|
249
|
+
function __liftRecord58(pointer) {
|
|
295
250
|
// assembly/api-types/VmOutput
|
|
296
251
|
// Hint: Opt-out from lifting as a record by providing an empty constructor
|
|
297
252
|
if (!pointer) return null;
|
|
@@ -302,19 +257,10 @@ async function instantiate(module, imports = {}) {
|
|
|
302
257
|
gas: __getI64(pointer + 16),
|
|
303
258
|
result: __liftArray(__getU8, 0, __getU32(pointer + 24)),
|
|
304
259
|
registers: __liftArray(pointer => BigInt.asUintN(64, __getU64(pointer)), 3, __getU32(pointer + 28)),
|
|
305
|
-
memory: __liftArray(pointer =>
|
|
260
|
+
memory: __liftArray(pointer => __liftRecord51(__getU32(pointer)), 2, __getU32(pointer + 32)),
|
|
306
261
|
};
|
|
307
262
|
}
|
|
308
|
-
function
|
|
309
|
-
// assembly/gas-costs/BlockGasCost
|
|
310
|
-
// Hint: Opt-out from lifting as a record by providing an empty constructor
|
|
311
|
-
if (!pointer) return null;
|
|
312
|
-
return {
|
|
313
|
-
pc: __getU32(pointer + 0),
|
|
314
|
-
gas: __getU64(pointer + 8),
|
|
315
|
-
};
|
|
316
|
-
}
|
|
317
|
-
function __liftRecord60(pointer) {
|
|
263
|
+
function __liftRecord64(pointer) {
|
|
318
264
|
// assembly/api-types/VmPause
|
|
319
265
|
// Hint: Opt-out from lifting as a record by providing an empty constructor
|
|
320
266
|
if (!pointer) return null;
|
|
@@ -490,6 +436,8 @@ export const {
|
|
|
490
436
|
__unpin,
|
|
491
437
|
__collect,
|
|
492
438
|
__rtti_base,
|
|
439
|
+
getAssembly,
|
|
440
|
+
wrapAsProgram,
|
|
493
441
|
resetJAM,
|
|
494
442
|
resetGeneric,
|
|
495
443
|
resetGenericWithMemory,
|
|
@@ -507,12 +455,6 @@ export const {
|
|
|
507
455
|
getPagePointer,
|
|
508
456
|
getMemory,
|
|
509
457
|
setMemory,
|
|
510
|
-
getAssembly,
|
|
511
|
-
buildMemory,
|
|
512
|
-
vmInit,
|
|
513
|
-
vmRunOnce,
|
|
514
|
-
vmExecute,
|
|
515
|
-
vmDestroy,
|
|
516
458
|
InputKind,
|
|
517
459
|
HasMetadata,
|
|
518
460
|
getGasCosts,
|
|
@@ -526,7 +468,6 @@ export const {
|
|
|
526
468
|
pvmGetPagePointer,
|
|
527
469
|
pvmWriteMemory,
|
|
528
470
|
pvmResume,
|
|
529
|
-
wrapAsProgram,
|
|
530
471
|
} = await (async url => instantiate(
|
|
531
472
|
await (async () => {
|
|
532
473
|
const isNodeOrBun = typeof process != "undefined" && process.versions != null && (process.versions.node != null || process.versions.bun != null);
|
|
Binary file
|