@fluffylabs/anan-as 1.1.3-e3864a9 → 1.1.3-eee81bd
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/README.md +47 -10
- package/dist/bin/index.js +174 -102
- package/dist/bin/{fuzz.js → src/fuzz.js} +3 -20
- package/dist/bin/src/log-host-call.js +41 -0
- package/dist/bin/src/trace-parse.js +315 -0
- package/dist/bin/src/trace-replay.js +130 -0
- package/dist/bin/src/tracer.js +64 -0
- package/dist/bin/src/utils.js +25 -0
- package/dist/bin/test.js +1 -3
- package/dist/build/compiler-inline.js +1 -1
- package/dist/build/compiler.d.ts +2 -2
- package/dist/build/compiler.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 +113 -57
- package/dist/build/debug-raw.js +97 -61
- package/dist/build/debug-raw.wasm +0 -0
- package/dist/build/debug.d.ts +113 -57
- package/dist/build/debug.js +107 -64
- package/dist/build/debug.wasm +0 -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 +113 -57
- package/dist/build/release-mini.js +107 -64
- package/dist/build/release-mini.wasm +0 -0
- package/dist/build/release-stub-inline.js +1 -1
- package/dist/build/release-stub.d.ts +113 -57
- package/dist/build/release-stub.js +107 -64
- package/dist/build/release-stub.wasm +0 -0
- package/dist/build/release.d.ts +113 -57
- package/dist/build/release.js +107 -64
- 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-as.js +3 -0
- package/dist/{bin → test}/test-gas-cost.js +1 -1
- package/dist/test/test-trace-replay.js +19 -0
- package/dist/{bin → test}/test-w3f.js +3 -1
- package/package.json +5 -5
- /package/dist/bin/{test-json.js → src/test-json.js} +0 -0
|
@@ -106,27 +106,41 @@ declare namespace __AdaptedExports {
|
|
|
106
106
|
*/
|
|
107
107
|
export function getAssembly(p: __Internref26): string;
|
|
108
108
|
/**
|
|
109
|
-
* assembly/api-internal/
|
|
109
|
+
* assembly/api-internal/buildMemory
|
|
110
|
+
* @param builder `assembly/memory/MemoryBuilder`
|
|
111
|
+
* @param pages `~lib/array/Array<assembly/api-types/InitialPage>`
|
|
112
|
+
* @param chunks `~lib/array/Array<assembly/api-types/InitialChunk>`
|
|
113
|
+
* @returns `assembly/memory/Memory`
|
|
114
|
+
*/
|
|
115
|
+
export function buildMemory(builder: __Internref41, pages: Array<__Record44<undefined>>, chunks: Array<__Record46<undefined>>): __Internref15;
|
|
116
|
+
/**
|
|
117
|
+
* assembly/api-internal/vmInit
|
|
118
|
+
* @param input `assembly/api-types/VmInput`
|
|
119
|
+
* @param useSbrkGas `bool`
|
|
120
|
+
* @returns `assembly/interpreter/Interpreter`
|
|
121
|
+
*/
|
|
122
|
+
export function vmInit(input: __Internref49, useSbrkGas?: boolean): __Internref25;
|
|
123
|
+
/**
|
|
124
|
+
* assembly/api-internal/vmRunOnce
|
|
110
125
|
* @param input `assembly/api-types/VmInput`
|
|
111
126
|
* @param logs `bool`
|
|
112
127
|
* @param useSbrkGas `bool`
|
|
113
128
|
* @returns `assembly/api-types/VmOutput`
|
|
114
129
|
*/
|
|
115
|
-
export function
|
|
130
|
+
export function vmRunOnce(input: __Internref49, logs?: boolean, useSbrkGas?: boolean): __Record50<never>;
|
|
116
131
|
/**
|
|
117
|
-
* assembly/api-internal/
|
|
118
|
-
* @param
|
|
119
|
-
* @
|
|
132
|
+
* assembly/api-internal/vmExecute
|
|
133
|
+
* @param int `assembly/interpreter/Interpreter`
|
|
134
|
+
* @param logs `bool`
|
|
120
135
|
*/
|
|
121
|
-
export function
|
|
136
|
+
export function vmExecute(int: __Internref25, logs?: boolean): void;
|
|
122
137
|
/**
|
|
123
|
-
* assembly/api-internal/
|
|
124
|
-
* @param
|
|
125
|
-
* @param
|
|
126
|
-
* @
|
|
127
|
-
* @returns `assembly/memory/Memory`
|
|
138
|
+
* assembly/api-internal/vmDestroy
|
|
139
|
+
* @param int `assembly/interpreter/Interpreter`
|
|
140
|
+
* @param dumpMemory `bool`
|
|
141
|
+
* @returns `assembly/api-types/VmOutput`
|
|
128
142
|
*/
|
|
129
|
-
export function
|
|
143
|
+
export function vmDestroy(int: __Internref25, dumpMemory?: boolean): __Record50<never>;
|
|
130
144
|
/** assembly/api-utils/InputKind */
|
|
131
145
|
export enum InputKind {
|
|
132
146
|
/** @type `i32` */
|
|
@@ -148,7 +162,7 @@ declare namespace __AdaptedExports {
|
|
|
148
162
|
* @param withMetadata `i32`
|
|
149
163
|
* @returns `~lib/array/Array<assembly/gas-costs/BlockGasCost>`
|
|
150
164
|
*/
|
|
151
|
-
export function getGasCosts(input: Array<number>, kind: number, withMetadata: number): Array<
|
|
165
|
+
export function getGasCosts(input: Array<number>, kind: number, withMetadata: number): Array<__Record55<never>>;
|
|
152
166
|
/**
|
|
153
167
|
* assembly/api-utils/disassemble
|
|
154
168
|
* @param input `~lib/array/Array<u8>`
|
|
@@ -168,7 +182,7 @@ declare namespace __AdaptedExports {
|
|
|
168
182
|
* @param args `~lib/array/Array<u8>`
|
|
169
183
|
* @returns `assembly/spi/StandardProgram`
|
|
170
184
|
*/
|
|
171
|
-
export function prepareProgram(kind: number, hasMetadata: number, program: Array<number>, initialRegisters: Array<bigint>, initialPageMap: Array<
|
|
185
|
+
export function prepareProgram(kind: number, hasMetadata: number, program: Array<number>, initialRegisters: Array<bigint>, initialPageMap: Array<__Record44<undefined>>, initialMemory: Array<__Record46<undefined>>, args: Array<number>): __Internref40;
|
|
172
186
|
/**
|
|
173
187
|
* assembly/api-utils/runProgram
|
|
174
188
|
* @param program `assembly/spi/StandardProgram`
|
|
@@ -178,18 +192,51 @@ declare namespace __AdaptedExports {
|
|
|
178
192
|
* @param useSbrkGas `bool`
|
|
179
193
|
* @returns `assembly/api-types/VmOutput`
|
|
180
194
|
*/
|
|
181
|
-
export function runProgram(program:
|
|
195
|
+
export function runProgram(program: __Internref40, initialGas?: bigint, programCounter?: number, logs?: boolean, useSbrkGas?: boolean): __Record50<never>;
|
|
182
196
|
/**
|
|
183
|
-
* assembly/api-utils/
|
|
184
|
-
* @param
|
|
197
|
+
* assembly/api-utils/pvmStart
|
|
198
|
+
* @param program `assembly/spi/StandardProgram`
|
|
199
|
+
* @param useSbrkGas `bool`
|
|
200
|
+
* @returns `u32`
|
|
201
|
+
*/
|
|
202
|
+
export function pvmStart(program: __Internref40, useSbrkGas?: boolean): number;
|
|
203
|
+
/**
|
|
204
|
+
* assembly/api-utils/pvmDestroy
|
|
205
|
+
* @param pvmId `u32`
|
|
206
|
+
* @returns `assembly/api-types/VmOutput | null`
|
|
207
|
+
*/
|
|
208
|
+
export function pvmDestroy(pvmId: number): __Record50<never> | null;
|
|
209
|
+
/**
|
|
210
|
+
* assembly/api-utils/pvmSetRegisters
|
|
211
|
+
* @param pvmId `u32`
|
|
212
|
+
* @param registers `~lib/array/Array<u64>`
|
|
213
|
+
*/
|
|
214
|
+
export function pvmSetRegisters(pvmId: number, registers: Array<bigint>): void;
|
|
215
|
+
/**
|
|
216
|
+
* assembly/api-utils/pvmReadMemory
|
|
217
|
+
* @param pvmId `u32`
|
|
218
|
+
* @param address `u32`
|
|
219
|
+
* @param length `u32`
|
|
220
|
+
* @returns `~lib/typedarray/Uint8Array | null`
|
|
221
|
+
*/
|
|
222
|
+
export function pvmReadMemory(pvmId: number, address: number, length: number): Uint8Array | null;
|
|
223
|
+
/**
|
|
224
|
+
* assembly/api-utils/pvmWriteMemory
|
|
225
|
+
* @param pvmId `u32`
|
|
226
|
+
* @param address `u32`
|
|
227
|
+
* @param data `~lib/typedarray/Uint8Array`
|
|
228
|
+
* @returns `bool`
|
|
229
|
+
*/
|
|
230
|
+
export function pvmWriteMemory(pvmId: number, address: number, data: Uint8Array): boolean;
|
|
231
|
+
/**
|
|
232
|
+
* assembly/api-utils/pvmResume
|
|
233
|
+
* @param pvmId `u32`
|
|
185
234
|
* @param gas `i64`
|
|
186
|
-
* @param
|
|
187
|
-
* @param args `~lib/array/Array<u8>`
|
|
235
|
+
* @param pc `u32`
|
|
188
236
|
* @param logs `bool`
|
|
189
|
-
* @
|
|
190
|
-
* @returns `assembly/api-types/ReturnValue`
|
|
237
|
+
* @returns `assembly/api-types/VmPause | null`
|
|
191
238
|
*/
|
|
192
|
-
export function
|
|
239
|
+
export function pvmResume(pvmId: number, gas: bigint, pc: number, logs?: boolean): __Record59<never> | null;
|
|
193
240
|
/**
|
|
194
241
|
* assembly/program-build/wrapAsProgram
|
|
195
242
|
* @param bytecode `~lib/typedarray/Uint8Array`
|
|
@@ -202,76 +249,85 @@ declare class __Internref26 extends Number {
|
|
|
202
249
|
private __nominal26: symbol;
|
|
203
250
|
private __nominal0: symbol;
|
|
204
251
|
}
|
|
205
|
-
/** assembly/
|
|
206
|
-
declare class
|
|
207
|
-
private
|
|
252
|
+
/** assembly/memory/MemoryBuilder */
|
|
253
|
+
declare class __Internref41 extends Number {
|
|
254
|
+
private __nominal41: symbol;
|
|
208
255
|
private __nominal0: symbol;
|
|
209
256
|
}
|
|
257
|
+
/** assembly/api-types/InitialPage */
|
|
258
|
+
declare interface __Record44<TOmittable> {
|
|
259
|
+
/** @type `u32` */
|
|
260
|
+
address: number | TOmittable;
|
|
261
|
+
/** @type `u32` */
|
|
262
|
+
length: number | TOmittable;
|
|
263
|
+
/** @type `i32` */
|
|
264
|
+
access: number | TOmittable;
|
|
265
|
+
}
|
|
210
266
|
/** assembly/api-types/InitialChunk */
|
|
211
|
-
declare interface
|
|
267
|
+
declare interface __Record46<TOmittable> {
|
|
212
268
|
/** @type `u32` */
|
|
213
269
|
address: number | TOmittable;
|
|
214
270
|
/** @type `~lib/array/Array<u8>` */
|
|
215
271
|
data: Array<number>;
|
|
216
272
|
}
|
|
217
|
-
/** assembly/api-types/VmOutput */
|
|
218
|
-
declare interface __Record49<TOmittable> {
|
|
219
|
-
/** @type `i32` */
|
|
220
|
-
status: number | TOmittable;
|
|
221
|
-
/** @type `~lib/array/Array<u64>` */
|
|
222
|
-
registers: Array<bigint>;
|
|
223
|
-
/** @type `u32` */
|
|
224
|
-
pc: number | TOmittable;
|
|
225
|
-
/** @type `~lib/array/Array<assembly/api-types/InitialChunk>` */
|
|
226
|
-
memory: Array<__Record45<never>>;
|
|
227
|
-
/** @type `i64` */
|
|
228
|
-
gas: bigint | TOmittable;
|
|
229
|
-
/** @type `u32` */
|
|
230
|
-
exitCode: number | TOmittable;
|
|
231
|
-
}
|
|
232
273
|
/** assembly/memory/Memory */
|
|
233
274
|
declare class __Internref15 extends Number {
|
|
234
275
|
private __nominal15: symbol;
|
|
235
276
|
private __nominal0: symbol;
|
|
236
277
|
}
|
|
237
|
-
/** assembly/
|
|
238
|
-
declare class
|
|
239
|
-
private
|
|
278
|
+
/** assembly/api-types/VmInput */
|
|
279
|
+
declare class __Internref49 extends Number {
|
|
280
|
+
private __nominal49: symbol;
|
|
240
281
|
private __nominal0: symbol;
|
|
241
282
|
}
|
|
242
|
-
/** assembly/
|
|
243
|
-
declare
|
|
283
|
+
/** assembly/interpreter/Interpreter */
|
|
284
|
+
declare class __Internref25 extends Number {
|
|
285
|
+
private __nominal25: symbol;
|
|
286
|
+
private __nominal0: symbol;
|
|
287
|
+
}
|
|
288
|
+
/** assembly/api-types/VmOutput */
|
|
289
|
+
declare interface __Record50<TOmittable> {
|
|
290
|
+
/** @type `i32` */
|
|
291
|
+
status: number | TOmittable;
|
|
244
292
|
/** @type `u32` */
|
|
245
|
-
|
|
293
|
+
exitCode: number | TOmittable;
|
|
246
294
|
/** @type `u32` */
|
|
247
|
-
|
|
248
|
-
/** @type `
|
|
249
|
-
|
|
295
|
+
pc: number | TOmittable;
|
|
296
|
+
/** @type `i64` */
|
|
297
|
+
gas: bigint | TOmittable;
|
|
298
|
+
/** @type `~lib/array/Array<u8>` */
|
|
299
|
+
result: Array<number>;
|
|
300
|
+
/** @type `~lib/array/Array<u64>` */
|
|
301
|
+
registers: Array<bigint>;
|
|
302
|
+
/** @type `~lib/array/Array<assembly/api-types/InitialChunk>` */
|
|
303
|
+
memory: Array<__Record46<never>>;
|
|
250
304
|
}
|
|
251
305
|
/** assembly/gas-costs/BlockGasCost */
|
|
252
|
-
declare interface
|
|
306
|
+
declare interface __Record55<TOmittable> {
|
|
253
307
|
/** @type `u32` */
|
|
254
308
|
pc: number | TOmittable;
|
|
255
309
|
/** @type `u64` */
|
|
256
310
|
gas: bigint | TOmittable;
|
|
257
311
|
}
|
|
258
312
|
/** assembly/spi/StandardProgram */
|
|
259
|
-
declare class
|
|
260
|
-
private
|
|
313
|
+
declare class __Internref40 extends Number {
|
|
314
|
+
private __nominal40: symbol;
|
|
261
315
|
private __nominal0: symbol;
|
|
262
316
|
}
|
|
263
|
-
/** assembly/api-types/
|
|
264
|
-
declare interface
|
|
317
|
+
/** assembly/api-types/VmPause */
|
|
318
|
+
declare interface __Record59<TOmittable> {
|
|
265
319
|
/** @type `i32` */
|
|
266
320
|
status: number | TOmittable;
|
|
267
321
|
/** @type `u32` */
|
|
268
322
|
exitCode: number | TOmittable;
|
|
269
323
|
/** @type `u32` */
|
|
270
324
|
pc: number | TOmittable;
|
|
325
|
+
/** @type `u32` */
|
|
326
|
+
nextPc: number | TOmittable;
|
|
271
327
|
/** @type `i64` */
|
|
272
328
|
gas: bigint | TOmittable;
|
|
273
|
-
/** @type `~lib/array/Array<
|
|
274
|
-
|
|
329
|
+
/** @type `~lib/array/Array<u64>` */
|
|
330
|
+
registers: Array<bigint>;
|
|
275
331
|
}
|
|
276
332
|
/** Instantiates the compiled WebAssembly module with the given imports. */
|
|
277
333
|
export declare function instantiate(module: WebAssembly.Module, imports: {
|
package/dist/build/debug-raw.js
CHANGED
|
@@ -113,24 +113,11 @@ export async function instantiate(module, imports = {}) {
|
|
|
113
113
|
p = __lowerInternref(p) || __notnull();
|
|
114
114
|
return __liftString(exports.getAssembly(p) >>> 0);
|
|
115
115
|
},
|
|
116
|
-
runVm(input, logs, useSbrkGas) {
|
|
117
|
-
// assembly/api-internal/runVm(assembly/api-types/VmInput, bool?, bool?) => assembly/api-types/VmOutput
|
|
118
|
-
input = __lowerInternref(input) || __notnull();
|
|
119
|
-
logs = logs ? 1 : 0;
|
|
120
|
-
useSbrkGas = useSbrkGas ? 1 : 0;
|
|
121
|
-
exports.__setArgumentsLength(arguments.length);
|
|
122
|
-
return __liftRecord49(exports.runVm(input, logs, useSbrkGas) >>> 0);
|
|
123
|
-
},
|
|
124
|
-
getOutputChunks(memory) {
|
|
125
|
-
// assembly/api-internal/getOutputChunks(assembly/memory/Memory) => ~lib/array/Array<assembly/api-types/InitialChunk>
|
|
126
|
-
memory = __lowerInternref(memory) || __notnull();
|
|
127
|
-
return __liftArray(pointer => __liftRecord45(__getU32(pointer)), 2, exports.getOutputChunks(memory) >>> 0);
|
|
128
|
-
},
|
|
129
116
|
buildMemory(builder, pages, chunks) {
|
|
130
117
|
// assembly/api-internal/buildMemory(assembly/memory/MemoryBuilder, ~lib/array/Array<assembly/api-types/InitialPage>, ~lib/array/Array<assembly/api-types/InitialChunk>) => assembly/memory/Memory
|
|
131
118
|
builder = __retain(__lowerInternref(builder) || __notnull());
|
|
132
|
-
pages = __retain(__lowerArray((pointer, value) => { __setU32(pointer,
|
|
133
|
-
chunks = __lowerArray((pointer, value) => { __setU32(pointer,
|
|
119
|
+
pages = __retain(__lowerArray((pointer, value) => { __setU32(pointer, __lowerRecord44(value) || __notnull()); }, 45, 2, pages) || __notnull());
|
|
120
|
+
chunks = __lowerArray((pointer, value) => { __setU32(pointer, __lowerRecord46(value) || __notnull()); }, 47, 2, chunks) || __notnull();
|
|
134
121
|
try {
|
|
135
122
|
return __liftInternref(exports.buildMemory(builder, pages, chunks) >>> 0);
|
|
136
123
|
} finally {
|
|
@@ -138,6 +125,35 @@ export async function instantiate(module, imports = {}) {
|
|
|
138
125
|
__release(pages);
|
|
139
126
|
}
|
|
140
127
|
},
|
|
128
|
+
vmInit(input, useSbrkGas) {
|
|
129
|
+
// assembly/api-internal/vmInit(assembly/api-types/VmInput, bool?) => assembly/interpreter/Interpreter
|
|
130
|
+
input = __lowerInternref(input) || __notnull();
|
|
131
|
+
useSbrkGas = useSbrkGas ? 1 : 0;
|
|
132
|
+
exports.__setArgumentsLength(arguments.length);
|
|
133
|
+
return __liftInternref(exports.vmInit(input, useSbrkGas) >>> 0);
|
|
134
|
+
},
|
|
135
|
+
vmRunOnce(input, logs, useSbrkGas) {
|
|
136
|
+
// assembly/api-internal/vmRunOnce(assembly/api-types/VmInput, bool?, bool?) => assembly/api-types/VmOutput
|
|
137
|
+
input = __lowerInternref(input) || __notnull();
|
|
138
|
+
logs = logs ? 1 : 0;
|
|
139
|
+
useSbrkGas = useSbrkGas ? 1 : 0;
|
|
140
|
+
exports.__setArgumentsLength(arguments.length);
|
|
141
|
+
return __liftRecord50(exports.vmRunOnce(input, logs, useSbrkGas) >>> 0);
|
|
142
|
+
},
|
|
143
|
+
vmExecute(int, logs) {
|
|
144
|
+
// assembly/api-internal/vmExecute(assembly/interpreter/Interpreter, bool?) => void
|
|
145
|
+
int = __lowerInternref(int) || __notnull();
|
|
146
|
+
logs = logs ? 1 : 0;
|
|
147
|
+
exports.__setArgumentsLength(arguments.length);
|
|
148
|
+
exports.vmExecute(int, logs);
|
|
149
|
+
},
|
|
150
|
+
vmDestroy(int, dumpMemory) {
|
|
151
|
+
// assembly/api-internal/vmDestroy(assembly/interpreter/Interpreter, bool?) => assembly/api-types/VmOutput
|
|
152
|
+
int = __lowerInternref(int) || __notnull();
|
|
153
|
+
dumpMemory = dumpMemory ? 1 : 0;
|
|
154
|
+
exports.__setArgumentsLength(arguments.length);
|
|
155
|
+
return __liftRecord50(exports.vmDestroy(int, dumpMemory) >>> 0);
|
|
156
|
+
},
|
|
141
157
|
InputKind: (values => (
|
|
142
158
|
// assembly/api-utils/InputKind
|
|
143
159
|
values[values.Generic = exports["InputKind.Generic"].valueOf()] = "Generic",
|
|
@@ -153,7 +169,7 @@ export async function instantiate(module, imports = {}) {
|
|
|
153
169
|
getGasCosts(input, kind, withMetadata) {
|
|
154
170
|
// assembly/api-utils/getGasCosts(~lib/array/Array<u8>, i32, i32) => ~lib/array/Array<assembly/gas-costs/BlockGasCost>
|
|
155
171
|
input = __lowerArray(__setU8, 6, 0, input) || __notnull();
|
|
156
|
-
return __liftArray(pointer =>
|
|
172
|
+
return __liftArray(pointer => __liftRecord55(__getU32(pointer)), 2, exports.getGasCosts(input, kind, withMetadata) >>> 0);
|
|
157
173
|
},
|
|
158
174
|
disassemble(input, kind, withMetadata) {
|
|
159
175
|
// assembly/api-utils/disassemble(~lib/array/Array<u8>, i32, i32) => ~lib/string/String
|
|
@@ -163,9 +179,9 @@ export async function instantiate(module, imports = {}) {
|
|
|
163
179
|
prepareProgram(kind, hasMetadata, program, initialRegisters, initialPageMap, initialMemory, args) {
|
|
164
180
|
// 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>) => assembly/spi/StandardProgram
|
|
165
181
|
program = __retain(__lowerArray(__setU8, 6, 0, program) || __notnull());
|
|
166
|
-
initialRegisters = __retain(__lowerArray(__setU64,
|
|
167
|
-
initialPageMap = __retain(__lowerArray((pointer, value) => { __setU32(pointer,
|
|
168
|
-
initialMemory = __retain(__lowerArray((pointer, value) => { __setU32(pointer,
|
|
182
|
+
initialRegisters = __retain(__lowerArray(__setU64, 51, 3, initialRegisters) || __notnull());
|
|
183
|
+
initialPageMap = __retain(__lowerArray((pointer, value) => { __setU32(pointer, __lowerRecord44(value) || __notnull()); }, 45, 2, initialPageMap) || __notnull());
|
|
184
|
+
initialMemory = __retain(__lowerArray((pointer, value) => { __setU32(pointer, __lowerRecord46(value) || __notnull()); }, 47, 2, initialMemory) || __notnull());
|
|
169
185
|
args = __lowerArray(__setU8, 6, 0, args) || __notnull();
|
|
170
186
|
try {
|
|
171
187
|
return __liftInternref(exports.prepareProgram(kind, hasMetadata, program, initialRegisters, initialPageMap, initialMemory, args) >>> 0);
|
|
@@ -183,21 +199,39 @@ export async function instantiate(module, imports = {}) {
|
|
|
183
199
|
logs = logs ? 1 : 0;
|
|
184
200
|
useSbrkGas = useSbrkGas ? 1 : 0;
|
|
185
201
|
exports.__setArgumentsLength(arguments.length);
|
|
186
|
-
return
|
|
202
|
+
return __liftRecord50(exports.runProgram(program, initialGas, programCounter, logs, useSbrkGas) >>> 0);
|
|
203
|
+
},
|
|
204
|
+
pvmStart(program, useSbrkGas) {
|
|
205
|
+
// assembly/api-utils/pvmStart(assembly/spi/StandardProgram, bool?) => u32
|
|
206
|
+
program = __lowerInternref(program) || __notnull();
|
|
207
|
+
useSbrkGas = useSbrkGas ? 1 : 0;
|
|
208
|
+
exports.__setArgumentsLength(arguments.length);
|
|
209
|
+
return exports.pvmStart(program, useSbrkGas) >>> 0;
|
|
210
|
+
},
|
|
211
|
+
pvmDestroy(pvmId) {
|
|
212
|
+
// assembly/api-utils/pvmDestroy(u32) => assembly/api-types/VmOutput | null
|
|
213
|
+
return __liftRecord50(exports.pvmDestroy(pvmId) >>> 0);
|
|
214
|
+
},
|
|
215
|
+
pvmSetRegisters(pvmId, registers) {
|
|
216
|
+
// assembly/api-utils/pvmSetRegisters(u32, ~lib/array/Array<u64>) => void
|
|
217
|
+
registers = __lowerArray(__setU64, 51, 3, registers) || __notnull();
|
|
218
|
+
exports.pvmSetRegisters(pvmId, registers);
|
|
219
|
+
},
|
|
220
|
+
pvmReadMemory(pvmId, address, length) {
|
|
221
|
+
// assembly/api-utils/pvmReadMemory(u32, u32, u32) => ~lib/typedarray/Uint8Array | null
|
|
222
|
+
return __liftTypedArray(Uint8Array, exports.pvmReadMemory(pvmId, address, length) >>> 0);
|
|
223
|
+
},
|
|
224
|
+
pvmWriteMemory(pvmId, address, data) {
|
|
225
|
+
// assembly/api-utils/pvmWriteMemory(u32, u32, ~lib/typedarray/Uint8Array) => bool
|
|
226
|
+
data = __lowerTypedArray(Uint8Array, 10, 0, data) || __notnull();
|
|
227
|
+
return exports.pvmWriteMemory(pvmId, address, data) != 0;
|
|
187
228
|
},
|
|
188
|
-
|
|
189
|
-
// assembly/api-utils/
|
|
229
|
+
pvmResume(pvmId, gas, pc, logs) {
|
|
230
|
+
// assembly/api-utils/pvmResume(u32, i64, u32, bool?) => assembly/api-types/VmPause | null
|
|
190
231
|
gas = gas || 0n;
|
|
191
|
-
program = __retain(__lowerArray(__setU8, 6, 0, program) || __notnull());
|
|
192
|
-
args = __lowerArray(__setU8, 6, 0, args) || __notnull();
|
|
193
232
|
logs = logs ? 1 : 0;
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
exports.__setArgumentsLength(arguments.length);
|
|
197
|
-
return __liftRecord58(exports.runJAM(pc, gas, program, args, logs, useSbrkGas) >>> 0);
|
|
198
|
-
} finally {
|
|
199
|
-
__release(program);
|
|
200
|
-
}
|
|
233
|
+
exports.__setArgumentsLength(arguments.length);
|
|
234
|
+
return __liftRecord59(exports.pvmResume(pvmId, gas, pc, logs) >>> 0);
|
|
201
235
|
},
|
|
202
236
|
wrapAsProgram(bytecode) {
|
|
203
237
|
// assembly/program-build/wrapAsProgram(~lib/typedarray/Uint8Array) => ~lib/typedarray/Uint8Array
|
|
@@ -205,50 +239,51 @@ export async function instantiate(module, imports = {}) {
|
|
|
205
239
|
return __liftTypedArray(Uint8Array, exports.wrapAsProgram(bytecode) >>> 0);
|
|
206
240
|
},
|
|
207
241
|
}, exports);
|
|
208
|
-
function
|
|
209
|
-
// assembly/api-types/InitialChunk
|
|
210
|
-
// Hint: Opt-out from lifting as a record by providing an empty constructor
|
|
211
|
-
if (!pointer) return null;
|
|
212
|
-
return {
|
|
213
|
-
address: __getU32(pointer + 0),
|
|
214
|
-
data: __liftArray(__getU8, 0, __getU32(pointer + 4)),
|
|
215
|
-
};
|
|
216
|
-
}
|
|
217
|
-
function __liftRecord49(pointer) {
|
|
218
|
-
// assembly/api-types/VmOutput
|
|
219
|
-
// Hint: Opt-out from lifting as a record by providing an empty constructor
|
|
220
|
-
if (!pointer) return null;
|
|
221
|
-
return {
|
|
222
|
-
status: __getI32(pointer + 0),
|
|
223
|
-
registers: __liftArray(pointer => BigInt.asUintN(64, __getU64(pointer)), 3, __getU32(pointer + 4)),
|
|
224
|
-
pc: __getU32(pointer + 8),
|
|
225
|
-
memory: __liftArray(pointer => __liftRecord45(__getU32(pointer)), 2, __getU32(pointer + 12)),
|
|
226
|
-
gas: __getI64(pointer + 16),
|
|
227
|
-
exitCode: __getU32(pointer + 24),
|
|
228
|
-
};
|
|
229
|
-
}
|
|
230
|
-
function __lowerRecord43(value) {
|
|
242
|
+
function __lowerRecord44(value) {
|
|
231
243
|
// assembly/api-types/InitialPage
|
|
232
244
|
// Hint: Opt-out from lowering as a record by providing an empty constructor
|
|
233
245
|
if (value == null) return 0;
|
|
234
|
-
const pointer = exports.__pin(exports.__new(12,
|
|
246
|
+
const pointer = exports.__pin(exports.__new(12, 44));
|
|
235
247
|
__setU32(pointer + 0, value.address);
|
|
236
248
|
__setU32(pointer + 4, value.length);
|
|
237
249
|
__setU32(pointer + 8, value.access);
|
|
238
250
|
exports.__unpin(pointer);
|
|
239
251
|
return pointer;
|
|
240
252
|
}
|
|
241
|
-
function
|
|
253
|
+
function __lowerRecord46(value) {
|
|
242
254
|
// assembly/api-types/InitialChunk
|
|
243
255
|
// Hint: Opt-out from lowering as a record by providing an empty constructor
|
|
244
256
|
if (value == null) return 0;
|
|
245
|
-
const pointer = exports.__pin(exports.__new(8,
|
|
257
|
+
const pointer = exports.__pin(exports.__new(8, 46));
|
|
246
258
|
__setU32(pointer + 0, value.address);
|
|
247
259
|
__setU32(pointer + 4, __lowerArray(__setU8, 6, 0, value.data) || __notnull());
|
|
248
260
|
exports.__unpin(pointer);
|
|
249
261
|
return pointer;
|
|
250
262
|
}
|
|
251
|
-
function
|
|
263
|
+
function __liftRecord46(pointer) {
|
|
264
|
+
// assembly/api-types/InitialChunk
|
|
265
|
+
// Hint: Opt-out from lifting as a record by providing an empty constructor
|
|
266
|
+
if (!pointer) return null;
|
|
267
|
+
return {
|
|
268
|
+
address: __getU32(pointer + 0),
|
|
269
|
+
data: __liftArray(__getU8, 0, __getU32(pointer + 4)),
|
|
270
|
+
};
|
|
271
|
+
}
|
|
272
|
+
function __liftRecord50(pointer) {
|
|
273
|
+
// assembly/api-types/VmOutput
|
|
274
|
+
// Hint: Opt-out from lifting as a record by providing an empty constructor
|
|
275
|
+
if (!pointer) return null;
|
|
276
|
+
return {
|
|
277
|
+
status: __getI32(pointer + 0),
|
|
278
|
+
exitCode: __getU32(pointer + 4),
|
|
279
|
+
pc: __getU32(pointer + 8),
|
|
280
|
+
gas: __getI64(pointer + 16),
|
|
281
|
+
result: __liftArray(__getU8, 0, __getU32(pointer + 24)),
|
|
282
|
+
registers: __liftArray(pointer => BigInt.asUintN(64, __getU64(pointer)), 3, __getU32(pointer + 28)),
|
|
283
|
+
memory: __liftArray(pointer => __liftRecord46(__getU32(pointer)), 2, __getU32(pointer + 32)),
|
|
284
|
+
};
|
|
285
|
+
}
|
|
286
|
+
function __liftRecord55(pointer) {
|
|
252
287
|
// assembly/gas-costs/BlockGasCost
|
|
253
288
|
// Hint: Opt-out from lifting as a record by providing an empty constructor
|
|
254
289
|
if (!pointer) return null;
|
|
@@ -257,16 +292,17 @@ export async function instantiate(module, imports = {}) {
|
|
|
257
292
|
gas: __getU64(pointer + 8),
|
|
258
293
|
};
|
|
259
294
|
}
|
|
260
|
-
function
|
|
261
|
-
// assembly/api-types/
|
|
295
|
+
function __liftRecord59(pointer) {
|
|
296
|
+
// assembly/api-types/VmPause
|
|
262
297
|
// Hint: Opt-out from lifting as a record by providing an empty constructor
|
|
263
298
|
if (!pointer) return null;
|
|
264
299
|
return {
|
|
265
300
|
status: __getI32(pointer + 0),
|
|
266
301
|
exitCode: __getU32(pointer + 4),
|
|
267
302
|
pc: __getU32(pointer + 8),
|
|
303
|
+
nextPc: __getU32(pointer + 12),
|
|
268
304
|
gas: __getI64(pointer + 16),
|
|
269
|
-
|
|
305
|
+
registers: __liftArray(pointer => BigInt.asUintN(64, __getU64(pointer)), 3, __getU32(pointer + 24)),
|
|
270
306
|
};
|
|
271
307
|
}
|
|
272
308
|
function __liftString(pointer) {
|
|
Binary file
|