@bytecodealliance/jco 1.21.0 → 1.22.0

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/obj/wasm-tools.js CHANGED
@@ -217,26 +217,8 @@ async function _withGlobalCurrentTaskMetaAsync(args) {
217
217
  if (args.taskID === undefined) { throw new TypeError('missing task ID'); }
218
218
  if (args.componentIdx === undefined) { throw new TypeError('missing component idx'); }
219
219
  if (!args.fn) { throw new TypeError('missing fn'); }
220
- const { taskID, componentIdx, fn } = args;
221
220
 
222
- // If there is already an async task executing, we must wait for it
223
- // to complete before we can can run the closure we were given
224
- //
225
- let current = CURRENT_TASK_META[componentIdx];
226
- let cstate;
227
- if (current && current.taskID !== taskID) {
228
- cstate = getOrCreateAsyncState(componentIdx);
229
- while (current && current.taskID !== taskID) {
230
- const { promise, resolve } = Promise.withResolvers();
231
- cstate.onNextExclusiveRelease(resolve);
232
- await promise;
233
- current = CURRENT_TASK_META[componentIdx];
234
- }
235
-
236
- // Since we've just waited for the component to not be locked, re-lock
237
- // exclusivity so we can run the fn below (likely a callee/callback)
238
- cstate.exclusiveLock();
239
- }
221
+ const { taskID, componentIdx, fn } = args;
240
222
 
241
223
  try {
242
224
  CURRENT_TASK_META[componentIdx] = { taskID, componentIdx };
@@ -617,6 +599,7 @@ class AsyncSubtask {
617
599
  subtaskID: this.#id,
618
600
  parentTaskID: this.parentTaskID(),
619
601
  fnName: this.fnName,
602
+ args,
620
603
  });
621
604
 
622
605
  if (this.#onProgressFn) { this.#onProgressFn(); }
@@ -1016,12 +999,22 @@ function _asyncStartCall(args, callee, paramCount, resultCount, flags) {
1016
999
  // If a helper function was provided we are likely in a fused guest->guest call,
1017
1000
  // and the result will be delivered (lift/lowered) via helper function
1018
1001
  if (subtaskCallMeta && subtaskCallMeta.returnFn) {
1019
- _debugLog('[_asyncStartCall()] return function present while handling subtask result, returning early (skipping lower)');
1002
+ _debugLog('[_asyncStartCall()] return function present while handling subtask result, returning early (skipping lower)', {
1003
+ calleeTaskID: calleeTask.id(),
1004
+ calleeComponentIdx,
1005
+ });
1020
1006
 
1021
1007
  // TODO: centralize calling of returnFn to *one place* (if possible)
1022
1008
  if (subtaskCallMeta.returnFnCalled) { return; }
1023
1009
 
1024
- subtaskCallMeta.returnFn.apply(null, [subtaskCallMeta.resultPtr]);
1010
+ const res = subtaskCallMeta.returnFn.apply(null, [subtaskCallMeta.resultPtr]);
1011
+
1012
+ _debugLog('[_asyncStartCall()] finished calling return fn', {
1013
+ calleeTaskID: calleeTask.id(),
1014
+ calleeComponentIdx,
1015
+ res,
1016
+ });
1017
+
1025
1018
  return;
1026
1019
  }
1027
1020
 
@@ -1080,15 +1073,31 @@ function _asyncStartCall(args, callee, paramCount, resultCount, flags) {
1080
1073
  });
1081
1074
  });
1082
1075
 
1083
- // Start the (event) driver loop that will resolve the task
1084
- queueMicrotask(async () => {
1076
+ // Start the (event) driver loop that will resolve the subtask
1077
+ // in a new JS task
1078
+ setTimeout(async () => {
1079
+ _debugLog('[_asyncStartCall()] continuing started subtask (in JS task)', {
1080
+ taskID: preparedTask.id(),
1081
+ subtaskID: subtask.id(),
1082
+ callerComponentIdx,
1083
+ calleeComponentIdx,
1084
+ });
1085
+
1085
1086
  let startRes = subtask.onStart({ startFnParams: params });
1086
1087
  startRes = Array.isArray(startRes) ? startRes : [startRes];
1087
1088
 
1088
- await calleeComponentState.suspendTask({
1089
- task: preparedTask,
1090
- readyFn: () => !calleeComponentState.isExclusivelyLocked(),
1091
- });
1089
+ if (calleeComponentState.isExclusivelyLocked()) {
1090
+ _debugLog('[_asyncStartCall()] during continuation callee is exclusively locked, suspending...', {
1091
+ taskID: preparedTask.id(),
1092
+ subtaskID: subtask.id(),
1093
+ callerComponentIdx,
1094
+ calleeComponentIdx,
1095
+ });
1096
+ await calleeComponentState.suspendTask({
1097
+ task: preparedTask,
1098
+ readyFn: () => !calleeComponentState.isExclusivelyLocked(),
1099
+ });
1100
+ }
1092
1101
 
1093
1102
  const started = await preparedTask.enter();
1094
1103
  if (!started) {
@@ -1171,7 +1180,7 @@ function _asyncStartCall(args, callee, paramCount, resultCount, flags) {
1171
1180
  _debugLog("[AsyncStartCall] drive loop call failure", { err });
1172
1181
  }
1173
1182
 
1174
- });
1183
+ }, 0);
1175
1184
 
1176
1185
  const subtaskState = subtask.getStateNumber();
1177
1186
  if (subtaskState < 0 || subtaskState > 2**5) {
@@ -1204,6 +1213,8 @@ class Waitable {
1204
1213
 
1205
1214
  #waitableSet = null;
1206
1215
 
1216
+ #hasSyncWaiter = false;
1217
+
1207
1218
  #idx = null; // to component-global waitables
1208
1219
 
1209
1220
  target;
@@ -1273,14 +1284,22 @@ class Waitable {
1273
1284
  _debugLog('[Waitable#join()] args', {
1274
1285
  waitable: this,
1275
1286
  waitableSet: waitableSet,
1287
+ isRemoval: waitableSet === null,
1276
1288
  });
1277
- if (this.#waitableSet) { this.#waitableSet.removeWaitable(this); }
1278
- if (!waitableSet) {
1279
- this.#waitableSet = null;
1280
- return;
1289
+
1290
+ if (this.#waitableSet === undefined) {
1291
+ throw new TypeError('waitable set must be not be undefined');
1292
+ }
1293
+
1294
+ if (this.#waitableSet) {
1295
+ this.#waitableSet.removeWaitable(this);
1281
1296
  }
1282
- waitableSet.addWaitable(this);
1297
+
1283
1298
  this.#waitableSet = waitableSet;
1299
+
1300
+ if (waitableSet) {
1301
+ this.#waitableSet.addWaitable(this);
1302
+ }
1284
1303
  }
1285
1304
 
1286
1305
  drop() {
@@ -1294,6 +1313,21 @@ class Waitable {
1294
1313
  this.join(null);
1295
1314
  }
1296
1315
 
1316
+ async waitForPendingEvent(args) {
1317
+ const { cstate } = args;
1318
+ if (!cstate) { throw new TypeError('missing component state'); }
1319
+
1320
+ if (this.#waitableSet !== null || this.#hasSyncWaiter) {
1321
+ throw new Error("waitable is already in a set/has a sync waiter");
1322
+ }
1323
+ this.#hasSyncWaiter = true;
1324
+ await cstate.waitUntil({
1325
+ cancellable: false,
1326
+ readyFn: () => this.hasPendingEvent(),
1327
+ });
1328
+ this.#hasSyncWaiter = false;
1329
+ }
1330
+
1297
1331
  }
1298
1332
 
1299
1333
  const ERR_CTX_TABLES = {};
@@ -1678,6 +1712,7 @@ class Waitable {
1678
1712
  taskID: this.#id,
1679
1713
  componentIdx: this.#componentIdx,
1680
1714
  subtaskID: this.getParentSubtask()?.id(),
1715
+ args: opts,
1681
1716
  entryFnName: this.#entryFnName,
1682
1717
  });
1683
1718
 
@@ -1687,11 +1722,16 @@ class Waitable {
1687
1722
 
1688
1723
  const cstate = getOrCreateAsyncState(this.#componentIdx);
1689
1724
 
1725
+ if (opts?.isHost) {
1726
+ this.#entered = true;
1727
+ return this.#entered;
1728
+ }
1729
+
1690
1730
  await cstate.nextTaskExecutionSlot({ task: this });
1691
1731
 
1692
- // If a task is either synchronous or host-provided (e.g. a host import, whether sync or async)
1693
- // then we can avoid component-relevant tracking and immediately enter
1694
- if (this.isSync() || opts?.isHost) {
1732
+ // If a task is synchronous then we can avoid component-relevant
1733
+ // tracking and immediately enter.
1734
+ if (this.isSync()) {
1695
1735
  this.#entered = true;
1696
1736
 
1697
1737
  // TODO(breaking): remove once manually-specifying async fns is removed
@@ -1761,7 +1801,7 @@ class Waitable {
1761
1801
 
1762
1802
  async waitUntil(opts) {
1763
1803
  const { readyFn, cancellable } = opts;
1764
- _debugLog('[AsyncTask#waitUntil()] args', { taskID: this.#id, cancellable });
1804
+ _debugLog('[AsyncTask#waitUntil()] args', { taskID: this.#id, args: { cancellable } });
1765
1805
 
1766
1806
  // TODO(fix): check for cancel
1767
1807
  // TODO(fix): determinism
@@ -1777,7 +1817,13 @@ class Waitable {
1777
1817
 
1778
1818
  async yieldUntil(opts) {
1779
1819
  const { readyFn, cancellable } = opts;
1780
- _debugLog('[AsyncTask#yieldUntil()] args', { taskID: this.#id, cancellable });
1820
+ _debugLog('[AsyncTask#yieldUntil()]', {
1821
+ taskID: this.#id,
1822
+ args: {
1823
+ cancellable,
1824
+ },
1825
+ componentIdx: this.#componentIdx,
1826
+ });
1781
1827
 
1782
1828
  const keepGoing = await this.suspendUntil({ readyFn, cancellable });
1783
1829
  if (keepGoing) {
@@ -1797,7 +1843,13 @@ class Waitable {
1797
1843
 
1798
1844
  async suspendUntil(opts) {
1799
1845
  const { cancellable, readyFn } = opts;
1800
- _debugLog('[AsyncTask#suspendUntil()] args', { cancellable });
1846
+ _debugLog('[AsyncTask#suspendUntil()] args', {
1847
+ taskID: this.#id,
1848
+ args: {
1849
+ cancellable,
1850
+ },
1851
+ componentIdx: this.#componentIdx,
1852
+ });
1801
1853
 
1802
1854
  const pendingCancelled = this.deliverPendingCancel({ cancellable });
1803
1855
  if (pendingCancelled) { return false; }
@@ -1809,7 +1861,14 @@ class Waitable {
1809
1861
  // TODO(threads): equivalent to thread.suspend_until()
1810
1862
  async immediateSuspendUntil(opts) {
1811
1863
  const { cancellable, readyFn } = opts;
1812
- _debugLog('[AsyncTask#immediateSuspendUntil()] args', { cancellable, readyFn });
1864
+ _debugLog('[AsyncTask#immediateSuspendUntil()] args', {
1865
+ args: {
1866
+ cancellable,
1867
+ readyFn,
1868
+ },
1869
+ taskID: this.#id,
1870
+ componentIdx: this.#componentIdx,
1871
+ });
1813
1872
 
1814
1873
  const ready = readyFn();
1815
1874
  if (ready && ASYNC_DETERMINISM === 'random') {
@@ -1836,7 +1895,11 @@ class Waitable {
1836
1895
 
1837
1896
  deliverPendingCancel(opts) {
1838
1897
  const { cancellable } = opts;
1839
- _debugLog('[AsyncTask#deliverPendingCancel()] args', { cancellable });
1898
+ _debugLog('[AsyncTask#deliverPendingCancel()]', {
1899
+ args: { cancellable },
1900
+ taskID: this.#id,
1901
+ componentIdx: this.#componentIdx,
1902
+ });
1840
1903
 
1841
1904
  if (cancellable && this.#state === AsyncTask.State.PENDING_CANCEL) {
1842
1905
  this.#state = AsyncTask.State.CANCEL_DELIVERED;
@@ -1864,7 +1927,6 @@ class Waitable {
1864
1927
  this.#onResolveHandlers = [];
1865
1928
  for (const f of handlers) {
1866
1929
  try {
1867
- // TODO(fix): resolve handlers getting called a ton?
1868
1930
  f(taskValue);
1869
1931
  } catch (err) {
1870
1932
  _debugLog("[AsyncTask#onResolve] error during task resolve handler", err);
@@ -3391,7 +3453,10 @@ class ComponentAsyncState {
3391
3453
  }
3392
3454
 
3393
3455
  #removeSuspendedTaskMeta(taskID) {
3394
- _debugLog('[ComponentAsyncState#removeSuspendedTaskMeta()] removing suspended task', { taskID });
3456
+ _debugLog('[ComponentAsyncState#removeSuspendedTaskMeta()] removing suspended task', {
3457
+ taskID,
3458
+ componentIdx: this.#componentIdx,
3459
+ });
3395
3460
  const idx = this.#suspendedTaskIDs.findIndex(t => t === taskID);
3396
3461
  const meta = this.#suspendedTasksByTaskID.get(taskID);
3397
3462
  this.#suspendedTaskIDs[idx] = null;
@@ -3413,6 +3478,7 @@ class ComponentAsyncState {
3413
3478
  suspendTask(args) {
3414
3479
  const { task, readyFn } = args;
3415
3480
  const taskID = task.id();
3481
+ const componentIdx = task.componentIdx();
3416
3482
  _debugLog('[ComponentAsyncState#suspendTask()]', {
3417
3483
  taskID,
3418
3484
  componentIdx: this.#componentIdx,
@@ -3420,6 +3486,10 @@ class ComponentAsyncState {
3420
3486
  subtask: task.getParentSubtask(),
3421
3487
  });
3422
3488
 
3489
+ if (componentIdx !== this.#componentIdx) {
3490
+ throw new Error('assert: task component idx should match async state');
3491
+ }
3492
+
3423
3493
  if (this.#getSuspendedTaskMeta(taskID)) {
3424
3494
  throw new Error(`task [${taskID}] already suspended`);
3425
3495
  }
@@ -3430,7 +3500,10 @@ class ComponentAsyncState {
3430
3500
  taskID,
3431
3501
  readyFn,
3432
3502
  resume: () => {
3433
- _debugLog('[ComponentAsyncState#suspendTask()] resuming suspended task', { taskID });
3503
+ _debugLog('[ComponentAsyncState] resuming suspended task', {
3504
+ taskID,
3505
+ componentIdx: this.#componentIdx,
3506
+ });
3434
3507
  // TODO(threads): it's thread cancellation we should be checking for below, not task
3435
3508
  resolve(!task.isCancelled());
3436
3509
  },
@@ -3474,7 +3547,7 @@ class ComponentAsyncState {
3474
3547
  // If the task failed via any means, allow the task to resume because
3475
3548
  // it's been cancelled -- the callback should immediately exit as well
3476
3549
  if (meta.task.isRejected()) {
3477
- _debugLog('[ComponentAsyncState#suspendTask()] detected task rejection, leaving early', { meta });
3550
+ _debugLog('[ComponentAsyncState#tick()] detected task rejection, leaving early', { meta });
3478
3551
  this.resumeTaskByID(taskID);
3479
3552
  return;
3480
3553
  }
@@ -3482,6 +3555,10 @@ class ComponentAsyncState {
3482
3555
  const isReady = meta.readyFn();
3483
3556
  if (!isReady) { continue; }
3484
3557
 
3558
+ _debugLog('[ComponentAsyncState#tick()] resuming task via tick', {
3559
+ taskID,
3560
+ componentIdx: this.#componentIdx,
3561
+ });
3485
3562
  this.resumeTaskByID(taskID);
3486
3563
  }
3487
3564
 
@@ -3896,7 +3973,7 @@ HANDLE_TABLES[2] = handleTable2;
3896
3973
 
3897
3974
  const _trampoline5 = function() {
3898
3975
  _debugLog('[iface="wasi:cli/stderr@0.2.3", function="get-stderr"] [Instruction::CallInterface] (sync, @ enter)');
3899
- let hostProvided = true;
3976
+ const hostProvided = true;
3900
3977
 
3901
3978
  let parentTask;
3902
3979
  let task;
@@ -3950,6 +4027,11 @@ const _trampoline5 = function() {
3950
4027
  ;
3951
4028
  } catch (err) {
3952
4029
 
4030
+ _debugLog('[Instruction::CallInterface] error during sync call', {
4031
+ taskID: task.id(),
4032
+ subtaskID: currentSubtask?.id(),
4033
+ err,
4034
+ });
3953
4035
  task.setErrored(err);
3954
4036
  task.reject(err);
3955
4037
  task.exit();
@@ -3991,7 +4073,7 @@ HANDLE_TABLES[1] = handleTable1;
3991
4073
 
3992
4074
  const _trampoline8 = function() {
3993
4075
  _debugLog('[iface="wasi:cli/stdin@0.2.3", function="get-stdin"] [Instruction::CallInterface] (sync, @ enter)');
3994
- let hostProvided = true;
4076
+ const hostProvided = true;
3995
4077
 
3996
4078
  let parentTask;
3997
4079
  let task;
@@ -4045,6 +4127,11 @@ const _trampoline8 = function() {
4045
4127
  ;
4046
4128
  } catch (err) {
4047
4129
 
4130
+ _debugLog('[Instruction::CallInterface] error during sync call', {
4131
+ taskID: task.id(),
4132
+ subtaskID: currentSubtask?.id(),
4133
+ err,
4134
+ });
4048
4135
  task.setErrored(err);
4049
4136
  task.reject(err);
4050
4137
  task.exit();
@@ -4077,7 +4164,7 @@ _trampoline8.fnName = 'wasi:cli/stdin@0.2.3#getStdin';
4077
4164
 
4078
4165
  const _trampoline9 = function() {
4079
4166
  _debugLog('[iface="wasi:cli/stdout@0.2.3", function="get-stdout"] [Instruction::CallInterface] (sync, @ enter)');
4080
- let hostProvided = true;
4167
+ const hostProvided = true;
4081
4168
 
4082
4169
  let parentTask;
4083
4170
  let task;
@@ -4131,6 +4218,11 @@ const _trampoline9 = function() {
4131
4218
  ;
4132
4219
  } catch (err) {
4133
4220
 
4221
+ _debugLog('[Instruction::CallInterface] error during sync call', {
4222
+ taskID: task.id(),
4223
+ subtaskID: currentSubtask?.id(),
4224
+ err,
4225
+ });
4134
4226
  task.setErrored(err);
4135
4227
  task.reject(err);
4136
4228
  task.exit();
@@ -4183,7 +4275,7 @@ const _trampoline10 = function(arg0) {
4183
4275
  }
4184
4276
  }
4185
4277
  _debugLog('[iface="wasi:cli/exit@0.2.3", function="exit"] [Instruction::CallInterface] (sync, @ enter)');
4186
- let hostProvided = true;
4278
+ const hostProvided = true;
4187
4279
 
4188
4280
  let parentTask;
4189
4281
  let task;
@@ -4237,6 +4329,11 @@ const _trampoline10 = function(arg0) {
4237
4329
  ;
4238
4330
  } catch (err) {
4239
4331
 
4332
+ _debugLog('[Instruction::CallInterface] error during sync call', {
4333
+ taskID: task.id(),
4334
+ subtaskID: currentSubtask?.id(),
4335
+ err,
4336
+ });
4240
4337
  task.setErrored(err);
4241
4338
  task.reject(err);
4242
4339
  task.exit();
@@ -4261,7 +4358,7 @@ let realloc0Async;
4261
4358
 
4262
4359
  const _trampoline11 = function(arg0) {
4263
4360
  _debugLog('[iface="wasi:cli/environment@0.2.3", function="get-environment"] [Instruction::CallInterface] (sync, @ enter)');
4264
- let hostProvided = true;
4361
+ const hostProvided = true;
4265
4362
 
4266
4363
  let parentTask;
4267
4364
  let task;
@@ -4315,6 +4412,11 @@ const _trampoline11 = function(arg0) {
4315
4412
  ;
4316
4413
  } catch (err) {
4317
4414
 
4415
+ _debugLog('[Instruction::CallInterface] error during sync call', {
4416
+ taskID: task.id(),
4417
+ subtaskID: currentSubtask?.id(),
4418
+ err,
4419
+ });
4318
4420
  task.setErrored(err);
4319
4421
  task.reject(err);
4320
4422
  task.exit();
@@ -4378,7 +4480,7 @@ const _trampoline12 = function(arg0, arg1) {
4378
4480
 
4379
4481
  curResourceBorrows.push(rsc0);
4380
4482
  _debugLog('[iface="wasi:filesystem/types@0.2.3", function="[method]descriptor.get-flags"] [Instruction::CallInterface] (sync, @ enter)');
4381
- let hostProvided = true;
4483
+ const hostProvided = true;
4382
4484
 
4383
4485
  let parentTask;
4384
4486
  let task;
@@ -4647,7 +4749,7 @@ const _trampoline13 = function(arg0, arg1) {
4647
4749
 
4648
4750
  curResourceBorrows.push(rsc0);
4649
4751
  _debugLog('[iface="wasi:filesystem/types@0.2.3", function="[method]descriptor.get-type"] [Instruction::CallInterface] (sync, @ enter)');
4650
- let hostProvided = true;
4752
+ const hostProvided = true;
4651
4753
 
4652
4754
  let parentTask;
4653
4755
  let task;
@@ -4953,7 +5055,7 @@ const _trampoline14 = function(arg0, arg1) {
4953
5055
 
4954
5056
  curResourceBorrows.push(rsc0);
4955
5057
  _debugLog('[iface="wasi:filesystem/types@0.2.3", function="[method]descriptor.metadata-hash"] [Instruction::CallInterface] (sync, @ enter)');
4956
- let hostProvided = true;
5058
+ const hostProvided = true;
4957
5059
 
4958
5060
  let parentTask;
4959
5061
  let task;
@@ -5227,7 +5329,7 @@ const _trampoline15 = function(arg0, arg1) {
5227
5329
 
5228
5330
  curResourceBorrows.push(rsc0);
5229
5331
  _debugLog('[iface="wasi:filesystem/types@0.2.3", function="filesystem-error-code"] [Instruction::CallInterface] (sync, @ enter)');
5230
- let hostProvided = true;
5332
+ const hostProvided = true;
5231
5333
 
5232
5334
  let parentTask;
5233
5335
  let task;
@@ -5281,6 +5383,11 @@ const _trampoline15 = function(arg0, arg1) {
5281
5383
  ;
5282
5384
  } catch (err) {
5283
5385
 
5386
+ _debugLog('[Instruction::CallInterface] error during sync call', {
5387
+ taskID: task.id(),
5388
+ subtaskID: currentSubtask?.id(),
5389
+ err,
5390
+ });
5284
5391
  task.setErrored(err);
5285
5392
  task.reject(err);
5286
5393
  task.exit();
@@ -5492,7 +5599,7 @@ const _trampoline16 = function(arg0, arg1, arg2, arg3, arg4) {
5492
5599
  var len4 = arg3;
5493
5600
  var result4 = TEXT_DECODER_UTF8.decode(new Uint8Array(memory0.buffer, ptr4, len4));
5494
5601
  _debugLog('[iface="wasi:filesystem/types@0.2.3", function="[method]descriptor.metadata-hash-at"] [Instruction::CallInterface] (sync, @ enter)');
5495
- let hostProvided = true;
5602
+ const hostProvided = true;
5496
5603
 
5497
5604
  let parentTask;
5498
5605
  let task;
@@ -5757,7 +5864,7 @@ const _trampoline17 = function(arg0, arg1, arg2) {
5757
5864
 
5758
5865
  curResourceBorrows.push(rsc0);
5759
5866
  _debugLog('[iface="wasi:filesystem/types@0.2.3", function="[method]descriptor.read-via-stream"] [Instruction::CallInterface] (sync, @ enter)');
5760
- let hostProvided = true;
5867
+ const hostProvided = true;
5761
5868
 
5762
5869
  let parentTask;
5763
5870
  let task;
@@ -6031,7 +6138,7 @@ const _trampoline18 = function(arg0, arg1, arg2) {
6031
6138
 
6032
6139
  curResourceBorrows.push(rsc0);
6033
6140
  _debugLog('[iface="wasi:filesystem/types@0.2.3", function="[method]descriptor.write-via-stream"] [Instruction::CallInterface] (sync, @ enter)');
6034
- let hostProvided = true;
6141
+ const hostProvided = true;
6035
6142
 
6036
6143
  let parentTask;
6037
6144
  let task;
@@ -6305,7 +6412,7 @@ const _trampoline19 = function(arg0, arg1) {
6305
6412
 
6306
6413
  curResourceBorrows.push(rsc0);
6307
6414
  _debugLog('[iface="wasi:filesystem/types@0.2.3", function="[method]descriptor.append-via-stream"] [Instruction::CallInterface] (sync, @ enter)');
6308
- let hostProvided = true;
6415
+ const hostProvided = true;
6309
6416
 
6310
6417
  let parentTask;
6311
6418
  let task;
@@ -6588,7 +6695,7 @@ const _trampoline20 = function(arg0, arg1) {
6588
6695
 
6589
6696
  curResourceBorrows.push(rsc0);
6590
6697
  _debugLog('[iface="wasi:filesystem/types@0.2.3", function="[method]descriptor.read-directory"] [Instruction::CallInterface] (sync, @ enter)');
6591
- let hostProvided = true;
6698
+ const hostProvided = true;
6592
6699
 
6593
6700
  let parentTask;
6594
6701
  let task;
@@ -6862,7 +6969,7 @@ const _trampoline21 = function(arg0, arg1) {
6862
6969
 
6863
6970
  curResourceBorrows.push(rsc0);
6864
6971
  _debugLog('[iface="wasi:filesystem/types@0.2.3", function="[method]descriptor.stat"] [Instruction::CallInterface] (sync, @ enter)');
6865
- let hostProvided = true;
6972
+ const hostProvided = true;
6866
6973
 
6867
6974
  let parentTask;
6868
6975
  let task;
@@ -7210,7 +7317,7 @@ const _trampoline22 = function(arg0, arg1, arg2, arg3, arg4) {
7210
7317
  var len4 = arg3;
7211
7318
  var result4 = TEXT_DECODER_UTF8.decode(new Uint8Array(memory0.buffer, ptr4, len4));
7212
7319
  _debugLog('[iface="wasi:filesystem/types@0.2.3", function="[method]descriptor.stat-at"] [Instruction::CallInterface] (sync, @ enter)');
7213
- let hostProvided = true;
7320
+ const hostProvided = true;
7214
7321
 
7215
7322
  let parentTask;
7216
7323
  let task;
@@ -7578,7 +7685,7 @@ const _trampoline23 = function(arg0, arg1, arg2, arg3, arg4, arg5, arg6) {
7578
7685
  mutateDirectory: Boolean(arg5 & 32),
7579
7686
  };
7580
7687
  _debugLog('[iface="wasi:filesystem/types@0.2.3", function="[method]descriptor.open-at"] [Instruction::CallInterface] (sync, @ enter)');
7581
- let hostProvided = true;
7688
+ const hostProvided = true;
7582
7689
 
7583
7690
  let parentTask;
7584
7691
  let task;
@@ -7852,7 +7959,7 @@ const _trampoline24 = function(arg0, arg1) {
7852
7959
 
7853
7960
  curResourceBorrows.push(rsc0);
7854
7961
  _debugLog('[iface="wasi:filesystem/types@0.2.3", function="[method]directory-entry-stream.read-directory-entry"] [Instruction::CallInterface] (sync, @ enter)');
7855
- let hostProvided = true;
7962
+ const hostProvided = true;
7856
7963
 
7857
7964
  let parentTask;
7858
7965
  let task;
@@ -8173,7 +8280,7 @@ const _trampoline25 = function(arg0, arg1, arg2) {
8173
8280
 
8174
8281
  curResourceBorrows.push(rsc0);
8175
8282
  _debugLog('[iface="wasi:io/streams@0.2.3", function="[method]input-stream.read"] [Instruction::CallInterface] (sync, @ enter)');
8176
- let hostProvided = true;
8283
+ const hostProvided = true;
8177
8284
 
8178
8285
  let parentTask;
8179
8286
  let task;
@@ -8326,7 +8433,7 @@ const _trampoline26 = function(arg0, arg1, arg2) {
8326
8433
 
8327
8434
  curResourceBorrows.push(rsc0);
8328
8435
  _debugLog('[iface="wasi:io/streams@0.2.3", function="[method]input-stream.blocking-read"] [Instruction::CallInterface] (sync, @ enter)');
8329
- let hostProvided = true;
8436
+ const hostProvided = true;
8330
8437
 
8331
8438
  let parentTask;
8332
8439
  let task;
@@ -8479,7 +8586,7 @@ const _trampoline27 = function(arg0, arg1) {
8479
8586
 
8480
8587
  curResourceBorrows.push(rsc0);
8481
8588
  _debugLog('[iface="wasi:io/streams@0.2.3", function="[method]output-stream.check-write"] [Instruction::CallInterface] (sync, @ enter)');
8482
- let hostProvided = true;
8589
+ const hostProvided = true;
8483
8590
 
8484
8591
  let parentTask;
8485
8592
  let task;
@@ -8612,7 +8719,7 @@ const _trampoline28 = function(arg0, arg1, arg2, arg3) {
8612
8719
  var len3 = arg2;
8613
8720
  var result3 = new Uint8Array(memory0.buffer.slice(ptr3, ptr3 + len3 * 1));
8614
8721
  _debugLog('[iface="wasi:io/streams@0.2.3", function="[method]output-stream.write"] [Instruction::CallInterface] (sync, @ enter)');
8615
- let hostProvided = true;
8722
+ const hostProvided = true;
8616
8723
 
8617
8724
  let parentTask;
8618
8725
  let task;
@@ -8744,7 +8851,7 @@ const _trampoline29 = function(arg0, arg1, arg2, arg3) {
8744
8851
  var len3 = arg2;
8745
8852
  var result3 = new Uint8Array(memory0.buffer.slice(ptr3, ptr3 + len3 * 1));
8746
8853
  _debugLog('[iface="wasi:io/streams@0.2.3", function="[method]output-stream.blocking-write-and-flush"] [Instruction::CallInterface] (sync, @ enter)');
8747
- let hostProvided = true;
8854
+ const hostProvided = true;
8748
8855
 
8749
8856
  let parentTask;
8750
8857
  let task;
@@ -8873,7 +8980,7 @@ const _trampoline30 = function(arg0, arg1) {
8873
8980
 
8874
8981
  curResourceBorrows.push(rsc0);
8875
8982
  _debugLog('[iface="wasi:io/streams@0.2.3", function="[method]output-stream.blocking-flush"] [Instruction::CallInterface] (sync, @ enter)');
8876
- let hostProvided = true;
8983
+ const hostProvided = true;
8877
8984
 
8878
8985
  let parentTask;
8879
8986
  let task;
@@ -8991,7 +9098,7 @@ _trampoline30.fnName = 'wasi:io/streams@0.2.3#blockingFlush';
8991
9098
 
8992
9099
  const _trampoline31 = function(arg0, arg1) {
8993
9100
  _debugLog('[iface="wasi:random/random@0.2.3", function="get-random-bytes"] [Instruction::CallInterface] (sync, @ enter)');
8994
- let hostProvided = true;
9101
+ const hostProvided = true;
8995
9102
 
8996
9103
  let parentTask;
8997
9104
  let task;
@@ -9045,6 +9152,11 @@ const _trampoline31 = function(arg0, arg1) {
9045
9152
  ;
9046
9153
  } catch (err) {
9047
9154
 
9155
+ _debugLog('[Instruction::CallInterface] error during sync call', {
9156
+ taskID: task.id(),
9157
+ subtaskID: currentSubtask?.id(),
9158
+ err,
9159
+ });
9048
9160
  task.setErrored(err);
9049
9161
  task.reject(err);
9050
9162
  task.exit();
@@ -9089,7 +9201,7 @@ _trampoline31.fnName = 'wasi:random/random@0.2.3#getRandomBytes';
9089
9201
 
9090
9202
  const _trampoline32 = function(arg0) {
9091
9203
  _debugLog('[iface="wasi:filesystem/preopens@0.2.3", function="get-directories"] [Instruction::CallInterface] (sync, @ enter)');
9092
- let hostProvided = true;
9204
+ const hostProvided = true;
9093
9205
 
9094
9206
  let parentTask;
9095
9207
  let task;
@@ -9143,6 +9255,11 @@ const _trampoline32 = function(arg0) {
9143
9255
  ;
9144
9256
  } catch (err) {
9145
9257
 
9258
+ _debugLog('[Instruction::CallInterface] error during sync call', {
9259
+ taskID: task.id(),
9260
+ subtaskID: currentSubtask?.id(),
9261
+ err,
9262
+ });
9146
9263
  task.setErrored(err);
9147
9264
  task.reject(err);
9148
9265
  task.exit();
@@ -9200,7 +9317,7 @@ HANDLE_TABLES[3] = handleTable3;
9200
9317
 
9201
9318
  const _trampoline33 = function(arg0) {
9202
9319
  _debugLog('[iface="wasi:cli/terminal-stdin@0.2.3", function="get-terminal-stdin"] [Instruction::CallInterface] (sync, @ enter)');
9203
- let hostProvided = true;
9320
+ const hostProvided = true;
9204
9321
 
9205
9322
  let parentTask;
9206
9323
  let task;
@@ -9254,6 +9371,11 @@ const _trampoline33 = function(arg0) {
9254
9371
  ;
9255
9372
  } catch (err) {
9256
9373
 
9374
+ _debugLog('[Instruction::CallInterface] error during sync call', {
9375
+ taskID: task.id(),
9376
+ subtaskID: currentSubtask?.id(),
9377
+ err,
9378
+ });
9257
9379
  task.setErrored(err);
9258
9380
  task.reject(err);
9259
9381
  task.exit();
@@ -9302,7 +9424,7 @@ HANDLE_TABLES[4] = handleTable4;
9302
9424
 
9303
9425
  const _trampoline34 = function(arg0) {
9304
9426
  _debugLog('[iface="wasi:cli/terminal-stdout@0.2.3", function="get-terminal-stdout"] [Instruction::CallInterface] (sync, @ enter)');
9305
- let hostProvided = true;
9427
+ const hostProvided = true;
9306
9428
 
9307
9429
  let parentTask;
9308
9430
  let task;
@@ -9356,6 +9478,11 @@ const _trampoline34 = function(arg0) {
9356
9478
  ;
9357
9479
  } catch (err) {
9358
9480
 
9481
+ _debugLog('[Instruction::CallInterface] error during sync call', {
9482
+ taskID: task.id(),
9483
+ subtaskID: currentSubtask?.id(),
9484
+ err,
9485
+ });
9359
9486
  task.setErrored(err);
9360
9487
  task.reject(err);
9361
9488
  task.exit();
@@ -9395,7 +9522,7 @@ _trampoline34.fnName = 'wasi:cli/terminal-stdout@0.2.3#getTerminalStdout';
9395
9522
 
9396
9523
  const _trampoline35 = function(arg0) {
9397
9524
  _debugLog('[iface="wasi:cli/terminal-stderr@0.2.3", function="get-terminal-stderr"] [Instruction::CallInterface] (sync, @ enter)');
9398
- let hostProvided = true;
9525
+ const hostProvided = true;
9399
9526
 
9400
9527
  let parentTask;
9401
9528
  let task;
@@ -9449,6 +9576,11 @@ const _trampoline35 = function(arg0) {
9449
9576
  ;
9450
9577
  } catch (err) {
9451
9578
 
9579
+ _debugLog('[Instruction::CallInterface] error during sync call', {
9580
+ taskID: task.id(),
9581
+ subtaskID: currentSubtask?.id(),
9582
+ err,
9583
+ });
9452
9584
  task.setErrored(err);
9453
9585
  task.reject(err);
9454
9586
  task.exit();
@@ -9540,6 +9672,10 @@ function parse(arg0) {
9540
9672
  });
9541
9673
  } catch (err) {
9542
9674
 
9675
+ _debugLog('[Instruction::CallWasm] error during sync call', {
9676
+ taskID: task.id(),
9677
+ err,
9678
+ });
9543
9679
  task.setErrored(err);
9544
9680
  task.reject(err);
9545
9681
  task.exit();
@@ -9659,6 +9795,10 @@ function print(arg0) {
9659
9795
  });
9660
9796
  } catch (err) {
9661
9797
 
9798
+ _debugLog('[Instruction::CallWasm] error during sync call', {
9799
+ taskID: task.id(),
9800
+ err,
9801
+ });
9662
9802
  task.setErrored(err);
9663
9803
  task.reject(err);
9664
9804
  task.exit();
@@ -9830,6 +9970,10 @@ function componentNew(arg0, arg1) {
9830
9970
  });
9831
9971
  } catch (err) {
9832
9972
 
9973
+ _debugLog('[Instruction::CallWasm] error during sync call', {
9974
+ taskID: task.id(),
9975
+ err,
9976
+ });
9833
9977
  task.setErrored(err);
9834
9978
  task.reject(err);
9835
9979
  task.exit();
@@ -9949,6 +10093,10 @@ function componentWit(arg0) {
9949
10093
  });
9950
10094
  } catch (err) {
9951
10095
 
10096
+ _debugLog('[Instruction::CallWasm] error during sync call', {
10097
+ taskID: task.id(),
10098
+ err,
10099
+ });
9952
10100
  task.setErrored(err);
9953
10101
  task.reject(err);
9954
10102
  task.exit();
@@ -10098,6 +10246,10 @@ function componentWitMetadataForWorld(arg0, arg1) {
10098
10246
  });
10099
10247
  } catch (err) {
10100
10248
 
10249
+ _debugLog('[Instruction::CallWasm] error during sync call', {
10250
+ taskID: task.id(),
10251
+ err,
10252
+ });
10101
10253
  task.setErrored(err);
10102
10254
  task.reject(err);
10103
10255
  task.exit();
@@ -10542,6 +10694,10 @@ function componentEmbed(arg0) {
10542
10694
  });
10543
10695
  } catch (err) {
10544
10696
 
10697
+ _debugLog('[Instruction::CallWasm] error during sync call', {
10698
+ taskID: task.id(),
10699
+ err,
10700
+ });
10545
10701
  task.setErrored(err);
10546
10702
  task.reject(err);
10547
10703
  task.exit();
@@ -10661,6 +10817,10 @@ function metadataShow(arg0) {
10661
10817
  });
10662
10818
  } catch (err) {
10663
10819
 
10820
+ _debugLog('[Instruction::CallWasm] error during sync call', {
10821
+ taskID: task.id(),
10822
+ err,
10823
+ });
10664
10824
  task.setErrored(err);
10665
10825
  task.reject(err);
10666
10826
  task.exit();
@@ -10900,6 +11060,10 @@ function metadataAdd(arg0, arg1) {
10900
11060
  });
10901
11061
  } catch (err) {
10902
11062
 
11063
+ _debugLog('[Instruction::CallWasm] error during sync call', {
11064
+ taskID: task.id(),
11065
+ err,
11066
+ });
10903
11067
  task.setErrored(err);
10904
11068
  task.reject(err);
10905
11069
  task.exit();