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