@fluffylabs/anan-as 1.2.0-ef04361 → 1.3.0-1ebcf8f

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.
Files changed (85) hide show
  1. package/dist/bin/index.js +138 -5
  2. package/dist/bin/src/fuzz.js +2 -2
  3. package/dist/bin/src/test-json.js +2 -6
  4. package/dist/bin/src/trace-parse.js +1 -0
  5. package/dist/bin/src/trace-replay.js +14 -9
  6. package/dist/bin/src/tracer.js +16 -13
  7. package/dist/bin/src/utils.js +2 -2
  8. package/dist/build/compiler-inline.js +1 -1
  9. package/dist/build/compiler.d.ts +17 -13
  10. package/dist/build/compiler.js +13 -21
  11. package/dist/build/compiler.wasm +0 -0
  12. package/dist/build/debug-inline.js +1 -1
  13. package/dist/build/debug-raw-inline.js +1 -1
  14. package/dist/build/debug-raw.d.ts +34 -32
  15. package/dist/build/debug-raw.js +62 -69
  16. package/dist/build/debug-raw.wasm +0 -0
  17. package/dist/build/debug.d.ts +34 -32
  18. package/dist/build/debug.js +63 -70
  19. package/dist/build/debug.wasm +0 -0
  20. package/dist/build/js/assembly/api-debugger.d.ts +4 -4
  21. package/dist/build/js/assembly/api-debugger.js +6 -6
  22. package/dist/build/js/assembly/api-internal.d.ts +1 -1
  23. package/dist/build/js/assembly/api-internal.js +2 -3
  24. package/dist/build/js/assembly/api-types.d.ts +4 -4
  25. package/dist/build/js/assembly/api-types.js +3 -4
  26. package/dist/build/js/assembly/api-utils.d.ts +14 -6
  27. package/dist/build/js/assembly/api-utils.js +28 -13
  28. package/dist/build/js/assembly/arguments.d.ts +4 -4
  29. package/dist/build/js/assembly/arguments.js +10 -10
  30. package/dist/build/js/assembly/gas.d.ts +8 -13
  31. package/dist/build/js/assembly/gas.js +17 -7
  32. package/dist/build/js/assembly/instructions/bit.js +22 -22
  33. package/dist/build/js/assembly/instructions/branch.js +56 -56
  34. package/dist/build/js/assembly/instructions/jump.js +10 -10
  35. package/dist/build/js/assembly/instructions/load.js +41 -41
  36. package/dist/build/js/assembly/instructions/logic.js +20 -20
  37. package/dist/build/js/assembly/instructions/math.js +105 -105
  38. package/dist/build/js/assembly/instructions/misc.js +10 -10
  39. package/dist/build/js/assembly/instructions/mov.js +16 -16
  40. package/dist/build/js/assembly/instructions/outcome.d.ts +7 -7
  41. package/dist/build/js/assembly/instructions/outcome.js +63 -38
  42. package/dist/build/js/assembly/instructions/rot.js +18 -18
  43. package/dist/build/js/assembly/instructions/set.js +18 -18
  44. package/dist/build/js/assembly/instructions/shift.js +59 -59
  45. package/dist/build/js/assembly/instructions/store.js +29 -29
  46. package/dist/build/js/assembly/instructions/utils.d.ts +6 -4
  47. package/dist/build/js/assembly/instructions/utils.js +32 -16
  48. package/dist/build/js/assembly/instructions.d.ts +2 -3
  49. package/dist/build/js/assembly/instructions.js +4 -4
  50. package/dist/build/js/assembly/interpreter.d.ts +0 -1
  51. package/dist/build/js/assembly/interpreter.js +30 -38
  52. package/dist/build/js/assembly/math.d.ts +6 -8
  53. package/dist/build/js/assembly/math.js +21 -13
  54. package/dist/build/js/assembly/memory-page.d.ts +2 -4
  55. package/dist/build/js/assembly/memory-page.js +13 -7
  56. package/dist/build/js/assembly/memory.d.ts +1 -0
  57. package/dist/build/js/assembly/memory.js +119 -23
  58. package/dist/build/js/assembly/portable.js +1 -0
  59. package/dist/build/js/assembly/program-build.js +4 -4
  60. package/dist/build/js/assembly/program.d.ts +15 -8
  61. package/dist/build/js/assembly/program.js +95 -39
  62. package/dist/build/js/assembly/spi.d.ts +1 -1
  63. package/dist/build/js/assembly/spi.js +2 -2
  64. package/dist/build/js/portable/bootstrap.js +1 -0
  65. package/dist/build/js/portable-bundle.js +829 -641
  66. package/dist/build/release-inline.js +1 -1
  67. package/dist/build/release-mini-inline.js +1 -1
  68. package/dist/build/release-mini.d.ts +34 -32
  69. package/dist/build/release-mini.js +63 -70
  70. package/dist/build/release-mini.wasm +0 -0
  71. package/dist/build/release-stub-inline.js +1 -1
  72. package/dist/build/release-stub.d.ts +34 -32
  73. package/dist/build/release-stub.js +63 -70
  74. package/dist/build/release-stub.wasm +0 -0
  75. package/dist/build/release.d.ts +34 -32
  76. package/dist/build/release.js +63 -70
  77. package/dist/build/release.wasm +0 -0
  78. package/dist/build/test-inline.js +1 -1
  79. package/dist/build/test.wasm +0 -0
  80. package/dist/test/test-gas-cost.js +2 -3
  81. package/dist/test/test-trace-format.js +166 -0
  82. package/dist/test/test-w3f-common.js +1 -2
  83. package/package.json +14 -10
  84. package/dist/build/js/assembly/gas-costs.d.ts +0 -6
  85. package/dist/build/js/assembly/gas-costs.js +0 -39
@@ -6,7 +6,7 @@ declare namespace __AdaptedExports {
6
6
  * @param p `assembly/program/Program`
7
7
  * @returns `~lib/string/String`
8
8
  */
9
- export function getAssembly(p: __Internref28): string;
9
+ export function getAssembly(p: __Internref35): string;
10
10
  /**
11
11
  * assembly/program-build/wrapAsProgram
12
12
  * @param bytecode `~lib/typedarray/Uint8Array`
@@ -17,29 +17,32 @@ declare namespace __AdaptedExports {
17
17
  * assembly/api-debugger/resetJAM
18
18
  * @param program `~lib/array/Array<u8>`
19
19
  * @param pc `u32`
20
- * @param initialGas `i64`
20
+ * @param initialGas `u64`
21
21
  * @param args `~lib/array/Array<u8>`
22
22
  * @param hasMetadata `bool`
23
+ * @param useBlockGas `bool`
23
24
  */
24
- export function resetJAM(program: Array<number>, pc: number, initialGas: bigint, args: Array<number>, hasMetadata?: boolean): void;
25
+ export function resetJAM(program: Array<number>, pc: number, initialGas: bigint, args: Array<number>, hasMetadata?: boolean, useBlockGas?: boolean): void;
25
26
  /**
26
27
  * assembly/api-debugger/resetGeneric
27
28
  * @param program `~lib/array/Array<u8>`
28
29
  * @param flatRegisters `~lib/array/Array<u8>`
29
- * @param initialGas `i64`
30
+ * @param initialGas `u64`
30
31
  * @param hasMetadata `bool`
32
+ * @param useBlockGas `bool`
31
33
  */
32
- export function resetGeneric(program: Array<number>, flatRegisters: Array<number>, initialGas: bigint, hasMetadata?: boolean): void;
34
+ export function resetGeneric(program: Array<number>, flatRegisters: Array<number>, initialGas: bigint, hasMetadata?: boolean, useBlockGas?: boolean): void;
33
35
  /**
34
36
  * assembly/api-debugger/resetGenericWithMemory
35
37
  * @param program `~lib/array/Array<u8>`
36
38
  * @param flatRegisters `~lib/array/Array<u8>`
37
39
  * @param pageMap `~lib/typedarray/Uint8Array`
38
40
  * @param chunks `~lib/typedarray/Uint8Array`
39
- * @param initialGas `i64`
41
+ * @param initialGas `u64`
40
42
  * @param hasMetadata `bool`
43
+ * @param useBlockGas `bool`
41
44
  */
42
- export function resetGenericWithMemory(program: Array<number>, flatRegisters: Array<number>, pageMap: Uint8Array, chunks: Uint8Array, initialGas: bigint, hasMetadata?: boolean): void;
45
+ export function resetGenericWithMemory(program: Array<number>, flatRegisters: Array<number>, pageMap: Uint8Array, chunks: Uint8Array, initialGas: bigint, hasMetadata?: boolean, useBlockGas?: boolean): void;
43
46
  /**
44
47
  * assembly/api-debugger/nextStep
45
48
  * @returns `bool`
@@ -78,7 +81,7 @@ declare namespace __AdaptedExports {
78
81
  export function getGasLeft(): bigint;
79
82
  /**
80
83
  * assembly/api-debugger/setGasLeft
81
- * @param gas `i64`
84
+ * @param gas `u64`
82
85
  */
83
86
  export function setGasLeft(gas: bigint): void;
84
87
  /**
@@ -132,13 +135,13 @@ declare namespace __AdaptedExports {
132
135
  No,
133
136
  }
134
137
  /**
135
- * assembly/api-utils/getGasCosts
138
+ * assembly/api-utils/getBlockGasCosts
136
139
  * @param input `~lib/array/Array<u8>`
137
140
  * @param kind `i32`
138
141
  * @param withMetadata `i32`
139
- * @returns `~lib/array/Array<assembly/gas-costs/BlockGasCost>`
142
+ * @returns `~lib/array/Array<assembly/api-utils/BlockGasCost>`
140
143
  */
141
- export function getGasCosts(input: Array<number>, kind: number, withMetadata: number): Array<__Record53<never>>;
144
+ export function getBlockGasCosts(input: Array<number>, kind: number, withMetadata: number): Array<__Record58<never>>;
142
145
  /**
143
146
  * assembly/api-utils/disassemble
144
147
  * @param input `~lib/array/Array<u8>`
@@ -157,33 +160,32 @@ declare namespace __AdaptedExports {
157
160
  * @param initialMemory `~lib/array/Array<assembly/api-types/InitialChunk>`
158
161
  * @param args `~lib/array/Array<u8>`
159
162
  * @param preallocateMemoryPages `u32`
163
+ * @param useBlockGas `bool`
160
164
  * @returns `assembly/spi/StandardProgram`
161
165
  */
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;
166
+ export function prepareProgram(kind: number, hasMetadata: number, program: Array<number>, initialRegisters: Array<bigint>, initialPageMap: Array<__Record54<undefined>>, initialMemory: Array<__Record56<undefined>>, args: Array<number>, preallocateMemoryPages: number, useBlockGas: boolean): __Internref51;
163
167
  /**
164
168
  * assembly/api-utils/runProgram
165
169
  * @param program `assembly/spi/StandardProgram`
166
170
  * @param initialGas `i64`
167
171
  * @param programCounter `u32`
168
172
  * @param logs `bool`
169
- * @param useSbrkGas `bool`
170
173
  * @param dumpMemory `bool`
171
174
  * @returns `assembly/api-types/VmOutput`
172
175
  */
173
- export function runProgram(program: __Internref45, initialGas?: bigint, programCounter?: number, logs?: boolean, useSbrkGas?: boolean, dumpMemory?: boolean): __Record58<never>;
176
+ export function runProgram(program: __Internref51, initialGas?: bigint, programCounter?: number, logs?: boolean, dumpMemory?: boolean): __Record62<never>;
174
177
  /**
175
178
  * assembly/api-utils/pvmStart
176
179
  * @param program `assembly/spi/StandardProgram`
177
- * @param useSbrkGas `bool`
178
180
  * @returns `u32`
179
181
  */
180
- export function pvmStart(program: __Internref45, useSbrkGas?: boolean): number;
182
+ export function pvmStart(program: __Internref51): number;
181
183
  /**
182
184
  * assembly/api-utils/pvmDestroy
183
185
  * @param pvmId `u32`
184
186
  * @returns `assembly/api-types/VmOutput | null`
185
187
  */
186
- export function pvmDestroy(pvmId: number): __Record58<never> | null;
188
+ export function pvmDestroy(pvmId: number): __Record62<never> | null;
187
189
  /**
188
190
  * assembly/api-utils/pvmSetRegisters
189
191
  * @param pvmId `u32`
@@ -216,27 +218,27 @@ declare namespace __AdaptedExports {
216
218
  /**
217
219
  * assembly/api-utils/pvmResume
218
220
  * @param pvmId `u32`
219
- * @param gas `i64`
221
+ * @param gas `u64`
220
222
  * @param pc `u32`
221
223
  * @param logs `bool`
222
224
  * @returns `assembly/api-types/VmPause | null`
223
225
  */
224
- export function pvmResume(pvmId: number, gas: bigint, pc: number, logs?: boolean): __Record64<never> | null;
226
+ export function pvmResume(pvmId: number, gas: bigint, pc: number, logs?: boolean): __Record68<never> | null;
225
227
  }
226
228
  /** assembly/program/Program */
227
- declare class __Internref28 extends Number {
228
- private __nominal28: symbol;
229
+ declare class __Internref35 extends Number {
230
+ private __nominal35: symbol;
229
231
  private __nominal0: symbol;
230
232
  }
231
- /** assembly/gas-costs/BlockGasCost */
232
- declare interface __Record53<TOmittable> {
233
+ /** assembly/api-utils/BlockGasCost */
234
+ declare interface __Record58<TOmittable> {
233
235
  /** @type `u32` */
234
236
  pc: number | TOmittable;
235
237
  /** @type `u64` */
236
238
  gas: bigint | TOmittable;
237
239
  }
238
240
  /** assembly/api-types/InitialPage */
239
- declare interface __Record49<TOmittable> {
241
+ declare interface __Record54<TOmittable> {
240
242
  /** @type `u32` */
241
243
  address: number | TOmittable;
242
244
  /** @type `u32` */
@@ -245,36 +247,36 @@ declare interface __Record49<TOmittable> {
245
247
  access: number | TOmittable;
246
248
  }
247
249
  /** assembly/api-types/InitialChunk */
248
- declare interface __Record51<TOmittable> {
250
+ declare interface __Record56<TOmittable> {
249
251
  /** @type `u32` */
250
252
  address: number | TOmittable;
251
253
  /** @type `~lib/array/Array<u8>` */
252
254
  data: Array<number>;
253
255
  }
254
256
  /** assembly/spi/StandardProgram */
255
- declare class __Internref45 extends Number {
256
- private __nominal45: symbol;
257
+ declare class __Internref51 extends Number {
258
+ private __nominal51: symbol;
257
259
  private __nominal0: symbol;
258
260
  }
259
261
  /** assembly/api-types/VmOutput */
260
- declare interface __Record58<TOmittable> {
262
+ declare interface __Record62<TOmittable> {
261
263
  /** @type `i32` */
262
264
  status: number | TOmittable;
263
265
  /** @type `u32` */
264
266
  exitCode: number | TOmittable;
265
267
  /** @type `u32` */
266
268
  pc: number | TOmittable;
267
- /** @type `i64` */
269
+ /** @type `u64` */
268
270
  gas: bigint | TOmittable;
269
271
  /** @type `~lib/array/Array<u8>` */
270
272
  result: Array<number>;
271
273
  /** @type `~lib/array/Array<u64>` */
272
274
  registers: Array<bigint>;
273
275
  /** @type `~lib/array/Array<assembly/api-types/InitialChunk>` */
274
- memory: Array<__Record51<never>>;
276
+ memory: Array<__Record56<never>>;
275
277
  }
276
278
  /** assembly/api-types/VmPause */
277
- declare interface __Record64<TOmittable> {
279
+ declare interface __Record68<TOmittable> {
278
280
  /** @type `i32` */
279
281
  status: number | TOmittable;
280
282
  /** @type `u32` */
@@ -283,7 +285,7 @@ declare interface __Record64<TOmittable> {
283
285
  pc: number | TOmittable;
284
286
  /** @type `u32` */
285
287
  nextPc: number | TOmittable;
286
- /** @type `i64` */
288
+ /** @type `u64` */
287
289
  gas: bigint | TOmittable;
288
290
  /** @type `~lib/array/Array<u64>` */
289
291
  registers: Array<bigint>;
@@ -29,46 +29,49 @@ export async function instantiate(module, imports = {}) {
29
29
  },
30
30
  wrapAsProgram(bytecode) {
31
31
  // assembly/program-build/wrapAsProgram(~lib/typedarray/Uint8Array) => ~lib/typedarray/Uint8Array
32
- bytecode = __lowerTypedArray(Uint8Array, 12, 0, bytecode) || __notnull();
32
+ bytecode = __lowerTypedArray(Uint8Array, 15, 0, bytecode) || __notnull();
33
33
  return __liftTypedArray(Uint8Array, exports.wrapAsProgram(bytecode) >>> 0);
34
34
  },
35
- resetJAM(program, pc, initialGas, args, hasMetadata) {
36
- // assembly/api-debugger/resetJAM(~lib/array/Array<u8>, u32, i64, ~lib/array/Array<u8>, bool?) => void
37
- program = __retain(__lowerArray(__setU8, 7, 0, program) || __notnull());
35
+ resetJAM(program, pc, initialGas, args, hasMetadata, useBlockGas) {
36
+ // assembly/api-debugger/resetJAM(~lib/array/Array<u8>, u32, u64, ~lib/array/Array<u8>, bool?, bool?) => void
37
+ program = __retain(__lowerArray(__setU8, 32, 0, program) || __notnull());
38
38
  initialGas = initialGas || 0n;
39
- args = __lowerArray(__setU8, 7, 0, args) || __notnull();
39
+ args = __lowerArray(__setU8, 32, 0, args) || __notnull();
40
40
  hasMetadata = hasMetadata ? 1 : 0;
41
+ useBlockGas = useBlockGas ? 1 : 0;
41
42
  try {
42
43
  exports.__setArgumentsLength(arguments.length);
43
- exports.resetJAM(program, pc, initialGas, args, hasMetadata);
44
+ exports.resetJAM(program, pc, initialGas, args, hasMetadata, useBlockGas);
44
45
  } finally {
45
46
  __release(program);
46
47
  }
47
48
  },
48
- resetGeneric(program, flatRegisters, initialGas, hasMetadata) {
49
- // assembly/api-debugger/resetGeneric(~lib/array/Array<u8>, ~lib/array/Array<u8>, i64, bool?) => void
50
- program = __retain(__lowerArray(__setU8, 7, 0, program) || __notnull());
51
- flatRegisters = __lowerArray(__setU8, 7, 0, flatRegisters) || __notnull();
49
+ resetGeneric(program, flatRegisters, initialGas, hasMetadata, useBlockGas) {
50
+ // assembly/api-debugger/resetGeneric(~lib/array/Array<u8>, ~lib/array/Array<u8>, u64, bool?, bool?) => void
51
+ program = __retain(__lowerArray(__setU8, 32, 0, program) || __notnull());
52
+ flatRegisters = __lowerArray(__setU8, 32, 0, flatRegisters) || __notnull();
52
53
  initialGas = initialGas || 0n;
53
54
  hasMetadata = hasMetadata ? 1 : 0;
55
+ useBlockGas = useBlockGas ? 1 : 0;
54
56
  try {
55
57
  exports.__setArgumentsLength(arguments.length);
56
- exports.resetGeneric(program, flatRegisters, initialGas, hasMetadata);
58
+ exports.resetGeneric(program, flatRegisters, initialGas, hasMetadata, useBlockGas);
57
59
  } finally {
58
60
  __release(program);
59
61
  }
60
62
  },
61
- resetGenericWithMemory(program, flatRegisters, pageMap, chunks, initialGas, hasMetadata) {
62
- // assembly/api-debugger/resetGenericWithMemory(~lib/array/Array<u8>, ~lib/array/Array<u8>, ~lib/typedarray/Uint8Array, ~lib/typedarray/Uint8Array, i64, bool?) => void
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();
63
+ resetGenericWithMemory(program, flatRegisters, pageMap, chunks, initialGas, hasMetadata, useBlockGas) {
64
+ // assembly/api-debugger/resetGenericWithMemory(~lib/array/Array<u8>, ~lib/array/Array<u8>, ~lib/typedarray/Uint8Array, ~lib/typedarray/Uint8Array, u64, bool?, bool?) => void
65
+ program = __retain(__lowerArray(__setU8, 32, 0, program) || __notnull());
66
+ flatRegisters = __retain(__lowerArray(__setU8, 32, 0, flatRegisters) || __notnull());
67
+ pageMap = __retain(__lowerTypedArray(Uint8Array, 15, 0, pageMap) || __notnull());
68
+ chunks = __lowerTypedArray(Uint8Array, 15, 0, chunks) || __notnull();
67
69
  initialGas = initialGas || 0n;
68
70
  hasMetadata = hasMetadata ? 1 : 0;
71
+ useBlockGas = useBlockGas ? 1 : 0;
69
72
  try {
70
73
  exports.__setArgumentsLength(arguments.length);
71
- exports.resetGenericWithMemory(program, flatRegisters, pageMap, chunks, initialGas, hasMetadata);
74
+ exports.resetGenericWithMemory(program, flatRegisters, pageMap, chunks, initialGas, hasMetadata, useBlockGas);
72
75
  } finally {
73
76
  __release(program);
74
77
  __release(flatRegisters);
@@ -92,7 +95,7 @@ export async function instantiate(module, imports = {}) {
92
95
  return exports.getExitArg() >>> 0;
93
96
  },
94
97
  setGasLeft(gas) {
95
- // assembly/api-debugger/setGasLeft(i64) => void
98
+ // assembly/api-debugger/setGasLeft(u64) => void
96
99
  gas = gas || 0n;
97
100
  exports.setGasLeft(gas);
98
101
  },
@@ -102,7 +105,7 @@ export async function instantiate(module, imports = {}) {
102
105
  },
103
106
  setRegisters(flatRegisters) {
104
107
  // assembly/api-debugger/setRegisters(~lib/array/Array<u8>) => void
105
- flatRegisters = __lowerArray(__setU8, 7, 0, flatRegisters) || __notnull();
108
+ flatRegisters = __lowerArray(__setU8, 32, 0, flatRegisters) || __notnull();
106
109
  exports.setRegisters(flatRegisters);
107
110
  },
108
111
  getPageDump(index) {
@@ -119,7 +122,7 @@ export async function instantiate(module, imports = {}) {
119
122
  },
120
123
  setMemory(address, data) {
121
124
  // assembly/api-debugger/setMemory(u32, ~lib/typedarray/Uint8Array) => bool
122
- data = __lowerTypedArray(Uint8Array, 12, 0, data) || __notnull();
125
+ data = __lowerTypedArray(Uint8Array, 15, 0, data) || __notnull();
123
126
  return exports.setMemory(address, data) != 0;
124
127
  },
125
128
  InputKind: (values => (
@@ -134,25 +137,26 @@ export async function instantiate(module, imports = {}) {
134
137
  values[values.No = exports["HasMetadata.No"].valueOf()] = "No",
135
138
  values
136
139
  ))({}),
137
- getGasCosts(input, kind, withMetadata) {
138
- // assembly/api-utils/getGasCosts(~lib/array/Array<u8>, i32, i32) => ~lib/array/Array<assembly/gas-costs/BlockGasCost>
139
- input = __lowerArray(__setU8, 7, 0, input) || __notnull();
140
- return __liftArray(pointer => __liftRecord53(__getU32(pointer)), 2, exports.getGasCosts(input, kind, withMetadata) >>> 0);
140
+ getBlockGasCosts(input, kind, withMetadata) {
141
+ // assembly/api-utils/getBlockGasCosts(~lib/array/Array<u8>, i32, i32) => ~lib/array/Array<assembly/api-utils/BlockGasCost>
142
+ input = __lowerArray(__setU8, 32, 0, input) || __notnull();
143
+ return __liftArray(pointer => __liftRecord58(__getU32(pointer)), 2, exports.getBlockGasCosts(input, kind, withMetadata) >>> 0);
141
144
  },
142
145
  disassemble(input, kind, withMetadata) {
143
146
  // assembly/api-utils/disassemble(~lib/array/Array<u8>, i32, i32) => ~lib/string/String
144
- input = __lowerArray(__setU8, 7, 0, input) || __notnull();
147
+ input = __lowerArray(__setU8, 32, 0, input) || __notnull();
145
148
  return __liftString(exports.disassemble(input, kind, withMetadata) >>> 0);
146
149
  },
147
- prepareProgram(kind, hasMetadata, program, initialRegisters, initialPageMap, initialMemory, args, preallocateMemoryPages) {
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
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();
150
+ prepareProgram(kind, hasMetadata, program, initialRegisters, initialPageMap, initialMemory, args, preallocateMemoryPages, useBlockGas) {
151
+ // 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, bool) => assembly/spi/StandardProgram
152
+ program = __retain(__lowerArray(__setU8, 32, 0, program) || __notnull());
153
+ initialRegisters = __retain(__lowerArray(__setU64, 60, 3, initialRegisters) || __notnull());
154
+ initialPageMap = __retain(__lowerArray((pointer, value) => { __setU32(pointer, __lowerRecord54(value) || __notnull()); }, 55, 2, initialPageMap) || __notnull());
155
+ initialMemory = __retain(__lowerArray((pointer, value) => { __setU32(pointer, __lowerRecord56(value) || __notnull()); }, 57, 2, initialMemory) || __notnull());
156
+ args = __lowerArray(__setU8, 32, 0, args) || __notnull();
157
+ useBlockGas = useBlockGas ? 1 : 0;
154
158
  try {
155
- return __liftInternref(exports.prepareProgram(kind, hasMetadata, program, initialRegisters, initialPageMap, initialMemory, args, preallocateMemoryPages) >>> 0);
159
+ return __liftInternref(exports.prepareProgram(kind, hasMetadata, program, initialRegisters, initialPageMap, initialMemory, args, preallocateMemoryPages, useBlockGas) >>> 0);
156
160
  } finally {
157
161
  __release(program);
158
162
  __release(initialRegisters);
@@ -160,30 +164,27 @@ export async function instantiate(module, imports = {}) {
160
164
  __release(initialMemory);
161
165
  }
162
166
  },
163
- runProgram(program, initialGas, programCounter, logs, useSbrkGas, dumpMemory) {
164
- // assembly/api-utils/runProgram(assembly/spi/StandardProgram, i64?, u32?, bool?, bool?, bool?) => assembly/api-types/VmOutput
167
+ runProgram(program, initialGas, programCounter, logs, dumpMemory) {
168
+ // assembly/api-utils/runProgram(assembly/spi/StandardProgram, i64?, u32?, bool?, bool?) => assembly/api-types/VmOutput
165
169
  program = __lowerInternref(program) || __notnull();
166
170
  initialGas = initialGas || 0n;
167
171
  logs = logs ? 1 : 0;
168
- useSbrkGas = useSbrkGas ? 1 : 0;
169
172
  dumpMemory = dumpMemory ? 1 : 0;
170
173
  exports.__setArgumentsLength(arguments.length);
171
- return __liftRecord58(exports.runProgram(program, initialGas, programCounter, logs, useSbrkGas, dumpMemory) >>> 0);
174
+ return __liftRecord62(exports.runProgram(program, initialGas, programCounter, logs, dumpMemory) >>> 0);
172
175
  },
173
- pvmStart(program, useSbrkGas) {
174
- // assembly/api-utils/pvmStart(assembly/spi/StandardProgram, bool?) => u32
176
+ pvmStart(program) {
177
+ // assembly/api-utils/pvmStart(assembly/spi/StandardProgram) => u32
175
178
  program = __lowerInternref(program) || __notnull();
176
- useSbrkGas = useSbrkGas ? 1 : 0;
177
- exports.__setArgumentsLength(arguments.length);
178
- return exports.pvmStart(program, useSbrkGas) >>> 0;
179
+ return exports.pvmStart(program) >>> 0;
179
180
  },
180
181
  pvmDestroy(pvmId) {
181
182
  // assembly/api-utils/pvmDestroy(u32) => assembly/api-types/VmOutput | null
182
- return __liftRecord58(exports.pvmDestroy(pvmId) >>> 0);
183
+ return __liftRecord62(exports.pvmDestroy(pvmId) >>> 0);
183
184
  },
184
185
  pvmSetRegisters(pvmId, registers) {
185
186
  // assembly/api-utils/pvmSetRegisters(u32, ~lib/array/Array<u64>) => void
186
- registers = __lowerArray(__setU64, 55, 3, registers) || __notnull();
187
+ registers = __lowerArray(__setU64, 60, 3, registers) || __notnull();
187
188
  exports.pvmSetRegisters(pvmId, registers);
188
189
  },
189
190
  pvmReadMemory(pvmId, address, length) {
@@ -196,19 +197,19 @@ export async function instantiate(module, imports = {}) {
196
197
  },
197
198
  pvmWriteMemory(pvmId, address, data) {
198
199
  // assembly/api-utils/pvmWriteMemory(u32, u32, ~lib/typedarray/Uint8Array) => bool
199
- data = __lowerTypedArray(Uint8Array, 12, 0, data) || __notnull();
200
+ data = __lowerTypedArray(Uint8Array, 15, 0, data) || __notnull();
200
201
  return exports.pvmWriteMemory(pvmId, address, data) != 0;
201
202
  },
202
203
  pvmResume(pvmId, gas, pc, logs) {
203
- // assembly/api-utils/pvmResume(u32, i64, u32, bool?) => assembly/api-types/VmPause | null
204
+ // assembly/api-utils/pvmResume(u32, u64, u32, bool?) => assembly/api-types/VmPause | null
204
205
  gas = gas || 0n;
205
206
  logs = logs ? 1 : 0;
206
207
  exports.__setArgumentsLength(arguments.length);
207
- return __liftRecord64(exports.pvmResume(pvmId, gas, pc, logs) >>> 0);
208
+ return __liftRecord68(exports.pvmResume(pvmId, gas, pc, logs) >>> 0);
208
209
  },
209
210
  }, exports);
210
- function __liftRecord53(pointer) {
211
- // assembly/gas-costs/BlockGasCost
211
+ function __liftRecord58(pointer) {
212
+ // assembly/api-utils/BlockGasCost
212
213
  // Hint: Opt-out from lifting as a record by providing an empty constructor
213
214
  if (!pointer) return null;
214
215
  return {
@@ -216,28 +217,28 @@ export async function instantiate(module, imports = {}) {
216
217
  gas: __getU64(pointer + 8),
217
218
  };
218
219
  }
219
- function __lowerRecord49(value) {
220
+ function __lowerRecord54(value) {
220
221
  // assembly/api-types/InitialPage
221
222
  // Hint: Opt-out from lowering as a record by providing an empty constructor
222
223
  if (value == null) return 0;
223
- const pointer = exports.__pin(exports.__new(12, 49));
224
+ const pointer = exports.__pin(exports.__new(12, 54));
224
225
  __setU32(pointer + 0, value.address);
225
226
  __setU32(pointer + 4, value.length);
226
227
  __setU32(pointer + 8, value.access);
227
228
  exports.__unpin(pointer);
228
229
  return pointer;
229
230
  }
230
- function __lowerRecord51(value) {
231
+ function __lowerRecord56(value) {
231
232
  // assembly/api-types/InitialChunk
232
233
  // Hint: Opt-out from lowering as a record by providing an empty constructor
233
234
  if (value == null) return 0;
234
- const pointer = exports.__pin(exports.__new(8, 51));
235
+ const pointer = exports.__pin(exports.__new(8, 56));
235
236
  __setU32(pointer + 0, value.address);
236
- __setU32(pointer + 4, __lowerArray(__setU8, 7, 0, value.data) || __notnull());
237
+ __setU32(pointer + 4, __lowerArray(__setU8, 32, 0, value.data) || __notnull());
237
238
  exports.__unpin(pointer);
238
239
  return pointer;
239
240
  }
240
- function __liftRecord51(pointer) {
241
+ function __liftRecord56(pointer) {
241
242
  // assembly/api-types/InitialChunk
242
243
  // Hint: Opt-out from lifting as a record by providing an empty constructor
243
244
  if (!pointer) return null;
@@ -246,7 +247,7 @@ export async function instantiate(module, imports = {}) {
246
247
  data: __liftArray(__getU8, 0, __getU32(pointer + 4)),
247
248
  };
248
249
  }
249
- function __liftRecord58(pointer) {
250
+ function __liftRecord62(pointer) {
250
251
  // assembly/api-types/VmOutput
251
252
  // Hint: Opt-out from lifting as a record by providing an empty constructor
252
253
  if (!pointer) return null;
@@ -254,13 +255,13 @@ export async function instantiate(module, imports = {}) {
254
255
  status: __getI32(pointer + 0),
255
256
  exitCode: __getU32(pointer + 4),
256
257
  pc: __getU32(pointer + 8),
257
- gas: __getI64(pointer + 16),
258
+ gas: __getU64(pointer + 16),
258
259
  result: __liftArray(__getU8, 0, __getU32(pointer + 24)),
259
260
  registers: __liftArray(pointer => BigInt.asUintN(64, __getU64(pointer)), 3, __getU32(pointer + 28)),
260
- memory: __liftArray(pointer => __liftRecord51(__getU32(pointer)), 2, __getU32(pointer + 32)),
261
+ memory: __liftArray(pointer => __liftRecord56(__getU32(pointer)), 2, __getU32(pointer + 32)),
261
262
  };
262
263
  }
263
- function __liftRecord64(pointer) {
264
+ function __liftRecord68(pointer) {
264
265
  // assembly/api-types/VmPause
265
266
  // Hint: Opt-out from lifting as a record by providing an empty constructor
266
267
  if (!pointer) return null;
@@ -269,7 +270,7 @@ export async function instantiate(module, imports = {}) {
269
270
  exitCode: __getU32(pointer + 4),
270
271
  pc: __getU32(pointer + 8),
271
272
  nextPc: __getU32(pointer + 12),
272
- gas: __getI64(pointer + 16),
273
+ gas: __getU64(pointer + 16),
273
274
  registers: __liftArray(pointer => BigInt.asUintN(64, __getU64(pointer)), 3, __getU32(pointer + 24)),
274
275
  };
275
276
  }
@@ -411,14 +412,6 @@ export async function instantiate(module, imports = {}) {
411
412
  return __dataview.getUint32(pointer, true);
412
413
  }
413
414
  }
414
- function __getI64(pointer) {
415
- try {
416
- return __dataview.getBigInt64(pointer, true);
417
- } catch {
418
- __dataview = new DataView(memory.buffer);
419
- return __dataview.getBigInt64(pointer, true);
420
- }
421
- }
422
415
  function __getU64(pointer) {
423
416
  try {
424
417
  return __dataview.getBigUint64(pointer, true);
Binary file