@fluffylabs/anan-as 1.2.0-69743c7 → 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
|
@@ -1,6 +1,18 @@
|
|
|
1
1
|
declare namespace __AdaptedExports {
|
|
2
2
|
/** Exported memory */
|
|
3
3
|
export const memory: WebAssembly.Memory;
|
|
4
|
+
/**
|
|
5
|
+
* assembly/api-internal/getAssembly
|
|
6
|
+
* @param p `assembly/program/Program`
|
|
7
|
+
* @returns `~lib/string/String`
|
|
8
|
+
*/
|
|
9
|
+
export function getAssembly(p: __Internref28): string;
|
|
10
|
+
/**
|
|
11
|
+
* assembly/program-build/wrapAsProgram
|
|
12
|
+
* @param bytecode `~lib/typedarray/Uint8Array`
|
|
13
|
+
* @returns `~lib/typedarray/Uint8Array`
|
|
14
|
+
*/
|
|
15
|
+
export function wrapAsProgram(bytecode: Uint8Array): Uint8Array;
|
|
4
16
|
/**
|
|
5
17
|
* assembly/api-debugger/resetJAM
|
|
6
18
|
* @param program `~lib/array/Array<u8>`
|
|
@@ -105,47 +117,6 @@ declare namespace __AdaptedExports {
|
|
|
105
117
|
* @returns `bool`
|
|
106
118
|
*/
|
|
107
119
|
export function setMemory(address: number, data: Uint8Array): boolean;
|
|
108
|
-
/**
|
|
109
|
-
* assembly/api-internal/getAssembly
|
|
110
|
-
* @param p `assembly/program/Program`
|
|
111
|
-
* @returns `~lib/string/String`
|
|
112
|
-
*/
|
|
113
|
-
export function getAssembly(p: __Internref26): string;
|
|
114
|
-
/**
|
|
115
|
-
* assembly/api-internal/buildMemory
|
|
116
|
-
* @param builder `assembly/memory/MemoryBuilder`
|
|
117
|
-
* @param pages `~lib/array/Array<assembly/api-types/InitialPage>`
|
|
118
|
-
* @param chunks `~lib/array/Array<assembly/api-types/InitialChunk>`
|
|
119
|
-
* @returns `assembly/memory/Memory`
|
|
120
|
-
*/
|
|
121
|
-
export function buildMemory(builder: __Internref41, pages: Array<__Record44<undefined>>, chunks: Array<__Record46<undefined>>): __Internref15;
|
|
122
|
-
/**
|
|
123
|
-
* assembly/api-internal/vmInit
|
|
124
|
-
* @param input `assembly/api-types/VmInput`
|
|
125
|
-
* @param useSbrkGas `bool`
|
|
126
|
-
* @returns `assembly/interpreter/Interpreter`
|
|
127
|
-
*/
|
|
128
|
-
export function vmInit(input: __Internref49, useSbrkGas?: boolean): __Internref25;
|
|
129
|
-
/**
|
|
130
|
-
* assembly/api-internal/vmRunOnce
|
|
131
|
-
* @param input `assembly/api-types/VmInput`
|
|
132
|
-
* @param options `assembly/api-types/VmRunOptions`
|
|
133
|
-
* @returns `assembly/api-types/VmOutput`
|
|
134
|
-
*/
|
|
135
|
-
export function vmRunOnce(input: __Internref49, options: __Record50<undefined>): __Record51<never>;
|
|
136
|
-
/**
|
|
137
|
-
* assembly/api-internal/vmExecute
|
|
138
|
-
* @param int `assembly/interpreter/Interpreter`
|
|
139
|
-
* @param logs `bool`
|
|
140
|
-
*/
|
|
141
|
-
export function vmExecute(int: __Internref25, logs?: boolean): void;
|
|
142
|
-
/**
|
|
143
|
-
* assembly/api-internal/vmDestroy
|
|
144
|
-
* @param int `assembly/interpreter/Interpreter`
|
|
145
|
-
* @param dumpMemory `bool`
|
|
146
|
-
* @returns `assembly/api-types/VmOutput`
|
|
147
|
-
*/
|
|
148
|
-
export function vmDestroy(int: __Internref25, dumpMemory?: boolean): __Record51<never>;
|
|
149
120
|
/** assembly/api-utils/InputKind */
|
|
150
121
|
export enum InputKind {
|
|
151
122
|
/** @type `i32` */
|
|
@@ -167,7 +138,7 @@ declare namespace __AdaptedExports {
|
|
|
167
138
|
* @param withMetadata `i32`
|
|
168
139
|
* @returns `~lib/array/Array<assembly/gas-costs/BlockGasCost>`
|
|
169
140
|
*/
|
|
170
|
-
export function getGasCosts(input: Array<number>, kind: number, withMetadata: number): Array<
|
|
141
|
+
export function getGasCosts(input: Array<number>, kind: number, withMetadata: number): Array<__Record53<never>>;
|
|
171
142
|
/**
|
|
172
143
|
* assembly/api-utils/disassemble
|
|
173
144
|
* @param input `~lib/array/Array<u8>`
|
|
@@ -188,7 +159,7 @@ declare namespace __AdaptedExports {
|
|
|
188
159
|
* @param preallocateMemoryPages `u32`
|
|
189
160
|
* @returns `assembly/spi/StandardProgram`
|
|
190
161
|
*/
|
|
191
|
-
export function prepareProgram(kind: number, hasMetadata: number, program: Array<number>, initialRegisters: Array<bigint>, initialPageMap: Array<
|
|
162
|
+
export 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;
|
|
192
163
|
/**
|
|
193
164
|
* assembly/api-utils/runProgram
|
|
194
165
|
* @param program `assembly/spi/StandardProgram`
|
|
@@ -199,20 +170,20 @@ declare namespace __AdaptedExports {
|
|
|
199
170
|
* @param dumpMemory `bool`
|
|
200
171
|
* @returns `assembly/api-types/VmOutput`
|
|
201
172
|
*/
|
|
202
|
-
export function runProgram(program:
|
|
173
|
+
export function runProgram(program: __Internref45, initialGas?: bigint, programCounter?: number, logs?: boolean, useSbrkGas?: boolean, dumpMemory?: boolean): __Record58<never>;
|
|
203
174
|
/**
|
|
204
175
|
* assembly/api-utils/pvmStart
|
|
205
176
|
* @param program `assembly/spi/StandardProgram`
|
|
206
177
|
* @param useSbrkGas `bool`
|
|
207
178
|
* @returns `u32`
|
|
208
179
|
*/
|
|
209
|
-
export function pvmStart(program:
|
|
180
|
+
export function pvmStart(program: __Internref45, useSbrkGas?: boolean): number;
|
|
210
181
|
/**
|
|
211
182
|
* assembly/api-utils/pvmDestroy
|
|
212
183
|
* @param pvmId `u32`
|
|
213
184
|
* @returns `assembly/api-types/VmOutput | null`
|
|
214
185
|
*/
|
|
215
|
-
export function pvmDestroy(pvmId: number):
|
|
186
|
+
export function pvmDestroy(pvmId: number): __Record58<never> | null;
|
|
216
187
|
/**
|
|
217
188
|
* assembly/api-utils/pvmSetRegisters
|
|
218
189
|
* @param pvmId `u32`
|
|
@@ -250,26 +221,22 @@ declare namespace __AdaptedExports {
|
|
|
250
221
|
* @param logs `bool`
|
|
251
222
|
* @returns `assembly/api-types/VmPause | null`
|
|
252
223
|
*/
|
|
253
|
-
export function pvmResume(pvmId: number, gas: bigint, pc: number, logs?: boolean):
|
|
254
|
-
/**
|
|
255
|
-
* assembly/program-build/wrapAsProgram
|
|
256
|
-
* @param bytecode `~lib/typedarray/Uint8Array`
|
|
257
|
-
* @returns `~lib/typedarray/Uint8Array`
|
|
258
|
-
*/
|
|
259
|
-
export function wrapAsProgram(bytecode: Uint8Array): Uint8Array;
|
|
224
|
+
export function pvmResume(pvmId: number, gas: bigint, pc: number, logs?: boolean): __Record64<never> | null;
|
|
260
225
|
}
|
|
261
226
|
/** assembly/program/Program */
|
|
262
|
-
declare class
|
|
263
|
-
private
|
|
227
|
+
declare class __Internref28 extends Number {
|
|
228
|
+
private __nominal28: symbol;
|
|
264
229
|
private __nominal0: symbol;
|
|
265
230
|
}
|
|
266
|
-
/** assembly/
|
|
267
|
-
declare
|
|
268
|
-
|
|
269
|
-
|
|
231
|
+
/** assembly/gas-costs/BlockGasCost */
|
|
232
|
+
declare interface __Record53<TOmittable> {
|
|
233
|
+
/** @type `u32` */
|
|
234
|
+
pc: number | TOmittable;
|
|
235
|
+
/** @type `u64` */
|
|
236
|
+
gas: bigint | TOmittable;
|
|
270
237
|
}
|
|
271
238
|
/** assembly/api-types/InitialPage */
|
|
272
|
-
declare interface
|
|
239
|
+
declare interface __Record49<TOmittable> {
|
|
273
240
|
/** @type `u32` */
|
|
274
241
|
address: number | TOmittable;
|
|
275
242
|
/** @type `u32` */
|
|
@@ -278,38 +245,19 @@ declare interface __Record44<TOmittable> {
|
|
|
278
245
|
access: number | TOmittable;
|
|
279
246
|
}
|
|
280
247
|
/** assembly/api-types/InitialChunk */
|
|
281
|
-
declare interface
|
|
248
|
+
declare interface __Record51<TOmittable> {
|
|
282
249
|
/** @type `u32` */
|
|
283
250
|
address: number | TOmittable;
|
|
284
251
|
/** @type `~lib/array/Array<u8>` */
|
|
285
252
|
data: Array<number>;
|
|
286
253
|
}
|
|
287
|
-
/** assembly/
|
|
288
|
-
declare class
|
|
289
|
-
private
|
|
290
|
-
private __nominal0: symbol;
|
|
291
|
-
}
|
|
292
|
-
/** assembly/api-types/VmInput */
|
|
293
|
-
declare class __Internref49 extends Number {
|
|
294
|
-
private __nominal49: symbol;
|
|
295
|
-
private __nominal0: symbol;
|
|
296
|
-
}
|
|
297
|
-
/** assembly/interpreter/Interpreter */
|
|
298
|
-
declare class __Internref25 extends Number {
|
|
299
|
-
private __nominal25: symbol;
|
|
254
|
+
/** assembly/spi/StandardProgram */
|
|
255
|
+
declare class __Internref45 extends Number {
|
|
256
|
+
private __nominal45: symbol;
|
|
300
257
|
private __nominal0: symbol;
|
|
301
258
|
}
|
|
302
|
-
/** assembly/api-types/VmRunOptions */
|
|
303
|
-
declare interface __Record50<TOmittable> {
|
|
304
|
-
/** @type `bool` */
|
|
305
|
-
useSbrkGas: boolean | TOmittable;
|
|
306
|
-
/** @type `bool` */
|
|
307
|
-
logs: boolean | TOmittable;
|
|
308
|
-
/** @type `bool` */
|
|
309
|
-
dumpMemory: boolean | TOmittable;
|
|
310
|
-
}
|
|
311
259
|
/** assembly/api-types/VmOutput */
|
|
312
|
-
declare interface
|
|
260
|
+
declare interface __Record58<TOmittable> {
|
|
313
261
|
/** @type `i32` */
|
|
314
262
|
status: number | TOmittable;
|
|
315
263
|
/** @type `u32` */
|
|
@@ -323,22 +271,10 @@ declare interface __Record51<TOmittable> {
|
|
|
323
271
|
/** @type `~lib/array/Array<u64>` */
|
|
324
272
|
registers: Array<bigint>;
|
|
325
273
|
/** @type `~lib/array/Array<assembly/api-types/InitialChunk>` */
|
|
326
|
-
memory: Array<
|
|
327
|
-
}
|
|
328
|
-
/** assembly/gas-costs/BlockGasCost */
|
|
329
|
-
declare interface __Record56<TOmittable> {
|
|
330
|
-
/** @type `u32` */
|
|
331
|
-
pc: number | TOmittable;
|
|
332
|
-
/** @type `u64` */
|
|
333
|
-
gas: bigint | TOmittable;
|
|
334
|
-
}
|
|
335
|
-
/** assembly/spi/StandardProgram */
|
|
336
|
-
declare class __Internref40 extends Number {
|
|
337
|
-
private __nominal40: symbol;
|
|
338
|
-
private __nominal0: symbol;
|
|
274
|
+
memory: Array<__Record51<never>>;
|
|
339
275
|
}
|
|
340
276
|
/** assembly/api-types/VmPause */
|
|
341
|
-
declare interface
|
|
277
|
+
declare interface __Record64<TOmittable> {
|
|
342
278
|
/** @type `i32` */
|
|
343
279
|
status: number | TOmittable;
|
|
344
280
|
/** @type `u32` */
|
package/dist/build/debug-raw.js
CHANGED
|
@@ -22,11 +22,21 @@ export 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 @@ export 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 @@ export 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 @@ export 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 @@ export 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 @@ export 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 @@ export 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 @@ export 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 @@ export 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 @@ export 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 @@ export 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 @@ export 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 =>
|
|
306
|
-
};
|
|
307
|
-
}
|
|
308
|
-
function __liftRecord56(pointer) {
|
|
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),
|
|
260
|
+
memory: __liftArray(pointer => __liftRecord51(__getU32(pointer)), 2, __getU32(pointer + 32)),
|
|
315
261
|
};
|
|
316
262
|
}
|
|
317
|
-
function
|
|
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;
|
|
Binary file
|