virtual-machine 0.0.10 → 0.0.14

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.
@@ -1,8 +1,13 @@
1
1
  // pkg/riscv_vm.js
2
2
  var wasm;
3
- function isLikeNone(x) {
4
- return x === void 0 || x === null;
3
+ function addToExternrefTable0(obj) {
4
+ const idx = wasm.__externref_table_alloc();
5
+ wasm.__wbindgen_externrefs.set(idx, obj);
6
+ return idx;
5
7
  }
8
+ var CLOSURE_DTORS = typeof FinalizationRegistry === "undefined" ? { register: () => {
9
+ }, unregister: () => {
10
+ } } : new FinalizationRegistry((state) => state.dtor(state.a, state.b));
6
11
  function debugString(val) {
7
12
  const type = typeof val;
8
13
  if (type == "number" || type == "boolean" || val == null) {
@@ -59,7 +64,21 @@ ${val.stack}`;
59
64
  }
60
65
  return className;
61
66
  }
62
- var WASM_VECTOR_LEN = 0;
67
+ function getArrayU8FromWasm0(ptr, len) {
68
+ ptr = ptr >>> 0;
69
+ return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
70
+ }
71
+ var cachedDataViewMemory0 = null;
72
+ function getDataViewMemory0() {
73
+ if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || cachedDataViewMemory0.buffer.detached === void 0 && cachedDataViewMemory0.buffer !== wasm.memory.buffer) {
74
+ cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
75
+ }
76
+ return cachedDataViewMemory0;
77
+ }
78
+ function getStringFromWasm0(ptr, len) {
79
+ ptr = ptr >>> 0;
80
+ return decodeText(ptr, len);
81
+ }
63
82
  var cachedUint8ArrayMemory0 = null;
64
83
  function getUint8ArrayMemory0() {
65
84
  if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
@@ -67,16 +86,45 @@ function getUint8ArrayMemory0() {
67
86
  }
68
87
  return cachedUint8ArrayMemory0;
69
88
  }
70
- var cachedTextEncoder = new TextEncoder();
71
- if (!("encodeInto" in cachedTextEncoder)) {
72
- cachedTextEncoder.encodeInto = function(arg, view) {
73
- const buf = cachedTextEncoder.encode(arg);
74
- view.set(buf);
75
- return {
76
- read: arg.length,
77
- written: buf.length
78
- };
89
+ function handleError(f, args) {
90
+ try {
91
+ return f.apply(this, args);
92
+ } catch (e) {
93
+ const idx = addToExternrefTable0(e);
94
+ wasm.__wbindgen_exn_store(idx);
95
+ }
96
+ }
97
+ function isLikeNone(x) {
98
+ return x === void 0 || x === null;
99
+ }
100
+ function makeMutClosure(arg0, arg1, dtor, f) {
101
+ const state = { a: arg0, b: arg1, cnt: 1, dtor };
102
+ const real = (...args) => {
103
+ state.cnt++;
104
+ const a = state.a;
105
+ state.a = 0;
106
+ try {
107
+ return f(a, state.b, ...args);
108
+ } finally {
109
+ state.a = a;
110
+ real._wbg_cb_unref();
111
+ }
79
112
  };
113
+ real._wbg_cb_unref = () => {
114
+ if (--state.cnt === 0) {
115
+ state.dtor(state.a, state.b);
116
+ state.a = 0;
117
+ CLOSURE_DTORS.unregister(state);
118
+ }
119
+ };
120
+ CLOSURE_DTORS.register(real, state, state);
121
+ return real;
122
+ }
123
+ function passArray8ToWasm0(arg, malloc) {
124
+ const ptr = malloc(arg.length * 1, 1) >>> 0;
125
+ getUint8ArrayMemory0().set(arg, ptr / 1);
126
+ WASM_VECTOR_LEN = arg.length;
127
+ return ptr;
80
128
  }
81
129
  function passStringToWasm0(arg, malloc, realloc) {
82
130
  if (realloc === void 0) {
@@ -108,12 +156,10 @@ function passStringToWasm0(arg, malloc, realloc) {
108
156
  WASM_VECTOR_LEN = offset;
109
157
  return ptr;
110
158
  }
111
- var cachedDataViewMemory0 = null;
112
- function getDataViewMemory0() {
113
- if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || cachedDataViewMemory0.buffer.detached === void 0 && cachedDataViewMemory0.buffer !== wasm.memory.buffer) {
114
- cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
115
- }
116
- return cachedDataViewMemory0;
159
+ function takeFromExternrefTable0(idx) {
160
+ const value = wasm.__wbindgen_externrefs.get(idx);
161
+ wasm.__externref_table_dealloc(idx);
162
+ return value;
117
163
  }
118
164
  var cachedTextDecoder = new TextDecoder("utf-8", { ignoreBOM: true, fatal: true });
119
165
  cachedTextDecoder.decode();
@@ -128,67 +174,24 @@ function decodeText(ptr, len) {
128
174
  }
129
175
  return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
130
176
  }
131
- function getStringFromWasm0(ptr, len) {
132
- ptr = ptr >>> 0;
133
- return decodeText(ptr, len);
134
- }
135
- function addToExternrefTable0(obj) {
136
- const idx = wasm.__externref_table_alloc();
137
- wasm.__wbindgen_externrefs.set(idx, obj);
138
- return idx;
139
- }
140
- function handleError(f, args) {
141
- try {
142
- return f.apply(this, args);
143
- } catch (e) {
144
- const idx = addToExternrefTable0(e);
145
- wasm.__wbindgen_exn_store(idx);
146
- }
147
- }
148
- function getArrayU8FromWasm0(ptr, len) {
149
- ptr = ptr >>> 0;
150
- return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
151
- }
152
- var CLOSURE_DTORS = typeof FinalizationRegistry === "undefined" ? { register: () => {
153
- }, unregister: () => {
154
- } } : new FinalizationRegistry((state) => state.dtor(state.a, state.b));
155
- function makeMutClosure(arg0, arg1, dtor, f) {
156
- const state = { a: arg0, b: arg1, cnt: 1, dtor };
157
- const real = (...args) => {
158
- state.cnt++;
159
- const a = state.a;
160
- state.a = 0;
161
- try {
162
- return f(a, state.b, ...args);
163
- } finally {
164
- state.a = a;
165
- real._wbg_cb_unref();
166
- }
167
- };
168
- real._wbg_cb_unref = () => {
169
- if (--state.cnt === 0) {
170
- state.dtor(state.a, state.b);
171
- state.a = 0;
172
- CLOSURE_DTORS.unregister(state);
173
- }
177
+ var cachedTextEncoder = new TextEncoder();
178
+ if (!("encodeInto" in cachedTextEncoder)) {
179
+ cachedTextEncoder.encodeInto = function(arg, view) {
180
+ const buf = cachedTextEncoder.encode(arg);
181
+ view.set(buf);
182
+ return {
183
+ read: arg.length,
184
+ written: buf.length
185
+ };
174
186
  };
175
- CLOSURE_DTORS.register(real, state, state);
176
- return real;
177
- }
178
- function takeFromExternrefTable0(idx) {
179
- const value = wasm.__wbindgen_externrefs.get(idx);
180
- wasm.__externref_table_dealloc(idx);
181
- return value;
182
187
  }
183
- function passArray8ToWasm0(arg, malloc) {
184
- const ptr = malloc(arg.length * 1, 1) >>> 0;
185
- getUint8ArrayMemory0().set(arg, ptr / 1);
186
- WASM_VECTOR_LEN = arg.length;
187
- return ptr;
188
- }
189
- function wasm_bindgen__convert__closures_____invoke__hf80474e20f8b36e4(arg0, arg1, arg2) {
190
- wasm.wasm_bindgen__convert__closures_____invoke__hf80474e20f8b36e4(arg0, arg1, arg2);
188
+ var WASM_VECTOR_LEN = 0;
189
+ function wasm_bindgen__convert__closures_____invoke__h6709295d3f31b919(arg0, arg1, arg2) {
190
+ wasm.wasm_bindgen__convert__closures_____invoke__h6709295d3f31b919(arg0, arg1, arg2);
191
191
  }
192
+ var WasmVmFinalization = typeof FinalizationRegistry === "undefined" ? { register: () => {
193
+ }, unregister: () => {
194
+ } } : new FinalizationRegistry((ptr) => wasm.__wbg_wasmvm_free(ptr >>> 0, 1));
192
195
  var NetworkStatus = Object.freeze({
193
196
  Disconnected: 0,
194
197
  "0": "Disconnected",
@@ -199,9 +202,6 @@ var NetworkStatus = Object.freeze({
199
202
  Error: 3,
200
203
  "3": "Error"
201
204
  });
202
- var WasmVmFinalization = typeof FinalizationRegistry === "undefined" ? { register: () => {
203
- }, unregister: () => {
204
- } } : new FinalizationRegistry((ptr) => wasm.__wbg_wasmvm_free(ptr >>> 0, 1));
205
205
  var WasmVm = class {
206
206
  __destroy_into_raw() {
207
207
  const ptr = this.__wbg_ptr;
@@ -327,39 +327,39 @@ async function __wbg_load(module, imports) {
327
327
  function __wbg_get_imports() {
328
328
  const imports = {};
329
329
  imports.wbg = {};
330
- imports.wbg.__wbg___wbindgen_boolean_get_6d5a1ee65bab5f68 = function(arg0) {
330
+ imports.wbg.__wbg___wbindgen_boolean_get_dea25b33882b895b = function(arg0) {
331
331
  const v = arg0;
332
332
  const ret = typeof v === "boolean" ? v : void 0;
333
333
  return isLikeNone(ret) ? 16777215 : ret ? 1 : 0;
334
334
  };
335
- imports.wbg.__wbg___wbindgen_debug_string_df47ffb5e35e6763 = function(arg0, arg1) {
335
+ imports.wbg.__wbg___wbindgen_debug_string_adfb662ae34724b6 = function(arg0, arg1) {
336
336
  const ret = debugString(arg1);
337
337
  const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
338
338
  const len1 = WASM_VECTOR_LEN;
339
339
  getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
340
340
  getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
341
341
  };
342
- imports.wbg.__wbg___wbindgen_is_function_ee8a6c5833c90377 = function(arg0) {
342
+ imports.wbg.__wbg___wbindgen_is_function_8d400b8b1af978cd = function(arg0) {
343
343
  const ret = typeof arg0 === "function";
344
344
  return ret;
345
345
  };
346
- imports.wbg.__wbg___wbindgen_is_undefined_2d472862bd29a478 = function(arg0) {
346
+ imports.wbg.__wbg___wbindgen_is_undefined_f6b95eab589e0269 = function(arg0) {
347
347
  const ret = arg0 === void 0;
348
348
  return ret;
349
349
  };
350
- imports.wbg.__wbg___wbindgen_throw_b855445ff6a94295 = function(arg0, arg1) {
350
+ imports.wbg.__wbg___wbindgen_throw_dd24417ed36fc46e = function(arg0, arg1) {
351
351
  throw new Error(getStringFromWasm0(arg0, arg1));
352
352
  };
353
- imports.wbg.__wbg__wbg_cb_unref_2454a539ea5790d9 = function(arg0) {
353
+ imports.wbg.__wbg__wbg_cb_unref_87dfb5aaa0cbcea7 = function(arg0) {
354
354
  arg0._wbg_cb_unref();
355
355
  };
356
- imports.wbg.__wbg_call_e762c39fa8ea36bf = function() {
356
+ imports.wbg.__wbg_call_abb4ff46ce38be40 = function() {
357
357
  return handleError(function(arg0, arg1) {
358
358
  const ret = arg0.call(arg1);
359
359
  return ret;
360
360
  }, arguments);
361
361
  };
362
- imports.wbg.__wbg_datagrams_d3815636dcdca421 = function(arg0) {
362
+ imports.wbg.__wbg_datagrams_05d12f8029dbc662 = function(arg0) {
363
363
  const ret = arg0.datagrams;
364
364
  return ret;
365
365
  };
@@ -374,31 +374,35 @@ function __wbg_get_imports() {
374
374
  wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
375
375
  }
376
376
  };
377
- imports.wbg.__wbg_getReader_15e2d3098e32c359 = function(arg0) {
377
+ imports.wbg.__wbg_getReader_b6676f6d8b326942 = function(arg0) {
378
378
  const ret = arg0.getReader();
379
379
  return ret;
380
380
  };
381
- imports.wbg.__wbg_getWriter_c891ce50cc187493 = function() {
381
+ imports.wbg.__wbg_getWriter_bbffb7cf601bec61 = function() {
382
382
  return handleError(function(arg0) {
383
383
  const ret = arg0.getWriter();
384
384
  return ret;
385
385
  }, arguments);
386
386
  };
387
- imports.wbg.__wbg_get_efcb449f58ec27c2 = function() {
387
+ imports.wbg.__wbg_get_af9dab7e9603ea93 = function() {
388
388
  return handleError(function(arg0, arg1) {
389
389
  const ret = Reflect.get(arg0, arg1);
390
390
  return ret;
391
391
  }, arguments);
392
392
  };
393
- imports.wbg.__wbg_length_69bca3cb64fc8748 = function(arg0) {
393
+ imports.wbg.__wbg_length_22ac23eaec9d8053 = function(arg0) {
394
394
  const ret = arg0.length;
395
395
  return ret;
396
396
  };
397
- imports.wbg.__wbg_new_1acc0b6eea89d040 = function() {
397
+ imports.wbg.__wbg_new_1ba21ce319a06297 = function() {
398
398
  const ret = new Object();
399
399
  return ret;
400
400
  };
401
- imports.wbg.__wbg_new_5a79be3ab53b8aa5 = function(arg0) {
401
+ imports.wbg.__wbg_new_25f239778d6112b9 = function() {
402
+ const ret = new Array();
403
+ return ret;
404
+ };
405
+ imports.wbg.__wbg_new_6421f6084cc5bc5a = function(arg0) {
402
406
  const ret = new Uint8Array(arg0);
403
407
  return ret;
404
408
  };
@@ -406,61 +410,57 @@ function __wbg_get_imports() {
406
410
  const ret = new Error();
407
411
  return ret;
408
412
  };
409
- imports.wbg.__wbg_new_e17d9f43105b08be = function() {
410
- const ret = new Array();
411
- return ret;
412
- };
413
- imports.wbg.__wbg_new_from_slice_92f4d78ca282a2d2 = function(arg0, arg1) {
413
+ imports.wbg.__wbg_new_from_slice_f9c22b9153b26992 = function(arg0, arg1) {
414
414
  const ret = new Uint8Array(getArrayU8FromWasm0(arg0, arg1));
415
415
  return ret;
416
416
  };
417
- imports.wbg.__wbg_new_no_args_ee98eee5275000a4 = function(arg0, arg1) {
417
+ imports.wbg.__wbg_new_no_args_cb138f77cf6151ee = function(arg0, arg1) {
418
418
  const ret = new Function(getStringFromWasm0(arg0, arg1));
419
419
  return ret;
420
420
  };
421
- imports.wbg.__wbg_new_with_options_9965f8e85fa9c22f = function() {
421
+ imports.wbg.__wbg_new_with_options_661ae023a99756d4 = function() {
422
422
  return handleError(function(arg0, arg1, arg2) {
423
423
  const ret = new WebTransport(getStringFromWasm0(arg0, arg1), arg2);
424
424
  return ret;
425
425
  }, arguments);
426
426
  };
427
- imports.wbg.__wbg_prototypesetcall_2a6620b6922694b2 = function(arg0, arg1, arg2) {
427
+ imports.wbg.__wbg_prototypesetcall_dfe9b766cdc1f1fd = function(arg0, arg1, arg2) {
428
428
  Uint8Array.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), arg2);
429
429
  };
430
- imports.wbg.__wbg_push_df81a39d04db858c = function(arg0, arg1) {
430
+ imports.wbg.__wbg_push_7d9be8f38fc13975 = function(arg0, arg1) {
431
431
  const ret = arg0.push(arg1);
432
432
  return ret;
433
433
  };
434
- imports.wbg.__wbg_queueMicrotask_34d692c25c47d05b = function(arg0) {
434
+ imports.wbg.__wbg_queueMicrotask_9b549dfce8865860 = function(arg0) {
435
435
  const ret = arg0.queueMicrotask;
436
436
  return ret;
437
437
  };
438
- imports.wbg.__wbg_queueMicrotask_9d76cacb20c84d58 = function(arg0) {
438
+ imports.wbg.__wbg_queueMicrotask_fca69f5bfad613a5 = function(arg0) {
439
439
  queueMicrotask(arg0);
440
440
  };
441
- imports.wbg.__wbg_read_48f1593df542f968 = function(arg0) {
441
+ imports.wbg.__wbg_read_39c4b35efcd03c25 = function(arg0) {
442
442
  const ret = arg0.read();
443
443
  return ret;
444
444
  };
445
- imports.wbg.__wbg_readable_86145f8eb068e7c2 = function(arg0) {
445
+ imports.wbg.__wbg_readable_91b7193a7ae57e51 = function(arg0) {
446
446
  const ret = arg0.readable;
447
447
  return ret;
448
448
  };
449
- imports.wbg.__wbg_ready_310519d62d77aaae = function(arg0) {
449
+ imports.wbg.__wbg_ready_a3e887a4174c582b = function(arg0) {
450
450
  const ret = arg0.ready;
451
451
  return ret;
452
452
  };
453
- imports.wbg.__wbg_resolve_caf97c30b83f7053 = function(arg0) {
453
+ imports.wbg.__wbg_resolve_fd5bfbaa4ce36e1e = function(arg0) {
454
454
  const ret = Promise.resolve(arg0);
455
455
  return ret;
456
456
  };
457
- imports.wbg.__wbg_set_algorithm_8f54a80aa7f1ccb1 = function(arg0, arg1, arg2) {
457
+ imports.wbg.__wbg_set_algorithm_f5b9d6dae15e63e3 = function(arg0, arg1, arg2) {
458
458
  arg0.algorithm = getStringFromWasm0(arg1, arg2);
459
459
  };
460
- imports.wbg.__wbg_set_server_certificate_hashes_0936192963851de7 = function(arg0, arg1) {
460
+ imports.wbg.__wbg_set_server_certificate_hashes_d12c95e03a45bcd5 = function(arg0, arg1) {
461
461
  arg0.serverCertificateHashes = arg1;
462
462
  };
463
- imports.wbg.__wbg_set_value_49be14618c9b991a = function(arg0, arg1) {
463
+ imports.wbg.__wbg_set_value_3371f9dc48a34104 = function(arg0, arg1) {
464
464
  arg0.value = arg1;
465
465
  };
466
466
  imports.wbg.__wbg_stack_0ed75d68575b0f3c = function(arg0, arg1) {
@@ -470,40 +470,40 @@ function __wbg_get_imports() {
470
470
  getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
471
471
  getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
472
472
  };
473
- imports.wbg.__wbg_static_accessor_GLOBAL_89e1d9ac6a1b250e = function() {
473
+ imports.wbg.__wbg_static_accessor_GLOBAL_769e6b65d6557335 = function() {
474
474
  const ret = typeof global === "undefined" ? null : global;
475
475
  return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
476
476
  };
477
- imports.wbg.__wbg_static_accessor_GLOBAL_THIS_8b530f326a9e48ac = function() {
477
+ imports.wbg.__wbg_static_accessor_GLOBAL_THIS_60cf02db4de8e1c1 = function() {
478
478
  const ret = typeof globalThis === "undefined" ? null : globalThis;
479
479
  return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
480
480
  };
481
- imports.wbg.__wbg_static_accessor_SELF_6fdf4b64710cc91b = function() {
481
+ imports.wbg.__wbg_static_accessor_SELF_08f5a74c69739274 = function() {
482
482
  const ret = typeof self === "undefined" ? null : self;
483
483
  return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
484
484
  };
485
- imports.wbg.__wbg_static_accessor_WINDOW_b45bfc5a37f6cfa2 = function() {
485
+ imports.wbg.__wbg_static_accessor_WINDOW_a8924b26aa92d024 = function() {
486
486
  const ret = typeof window === "undefined" ? null : window;
487
487
  return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
488
488
  };
489
- imports.wbg.__wbg_then_4f46f6544e6b4a28 = function(arg0, arg1) {
490
- const ret = arg0.then(arg1);
489
+ imports.wbg.__wbg_then_429f7caf1026411d = function(arg0, arg1, arg2) {
490
+ const ret = arg0.then(arg1, arg2);
491
491
  return ret;
492
492
  };
493
- imports.wbg.__wbg_then_70d05cf780a18d77 = function(arg0, arg1, arg2) {
494
- const ret = arg0.then(arg1, arg2);
493
+ imports.wbg.__wbg_then_4f95312d68691235 = function(arg0, arg1) {
494
+ const ret = arg0.then(arg1);
495
495
  return ret;
496
496
  };
497
- imports.wbg.__wbg_writable_9ade33d14ef66806 = function(arg0) {
497
+ imports.wbg.__wbg_writable_523e68bd72433329 = function(arg0) {
498
498
  const ret = arg0.writable;
499
499
  return ret;
500
500
  };
501
- imports.wbg.__wbg_write_5f693b62e780062e = function(arg0, arg1) {
501
+ imports.wbg.__wbg_write_0823b42435137c02 = function(arg0, arg1) {
502
502
  const ret = arg0.write(arg1);
503
503
  return ret;
504
504
  };
505
505
  imports.wbg.__wbindgen_cast_19eead9c9e92d417 = function(arg0, arg1) {
506
- const ret = makeMutClosure(arg0, arg1, wasm.wasm_bindgen__closure__destroy__hb58eefa6e6233209, wasm_bindgen__convert__closures_____invoke__hf80474e20f8b36e4);
506
+ const ret = makeMutClosure(arg0, arg1, wasm.wasm_bindgen__closure__destroy__hb099e2ae98169675, wasm_bindgen__convert__closures_____invoke__h6709295d3f31b919);
507
507
  return ret;
508
508
  };
509
509
  imports.wbg.__wbindgen_cast_2241b6af4c4b2941 = function(arg0, arg1) {
@@ -518,7 +518,6 @@ function __wbg_get_imports() {
518
518
  table.set(offset + 1, null);
519
519
  table.set(offset + 2, true);
520
520
  table.set(offset + 3, false);
521
- ;
522
521
  };
523
522
  return imports;
524
523
  }