@milaboratories/pframes-rs-wasm 0.1.1 → 0.1.2

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 (36) hide show
  1. package/dist/axes.d.ts +5 -0
  2. package/dist/axes.d.ts.map +1 -0
  3. package/dist/axes.js +14 -0
  4. package/dist/axes.js.map +1 -0
  5. package/{generated → dist/generated}/pframes_rs_wasm.core.wasm +0 -0
  6. package/{generated → dist/generated}/pframes_rs_wasm.js +57 -715
  7. package/dist/generated/pframes_rs_wasm.js.map +1 -0
  8. package/dist/index.d.ts +3 -0
  9. package/dist/index.d.ts.map +1 -0
  10. package/dist/index.js +12 -0
  11. package/dist/index.js.map +1 -0
  12. package/dist/p-frame.d.ts +12 -0
  13. package/dist/p-frame.d.ts.map +1 -0
  14. package/dist/p-frame.js +81 -0
  15. package/dist/p-frame.js.map +1 -0
  16. package/package.json +26 -13
  17. package/generated/interfaces/milaboratories-pframes-spec.d.ts +0 -24
  18. package/generated/interfaces/wasi-cli-environment.d.ts +0 -2
  19. package/generated/interfaces/wasi-cli-exit.d.ts +0 -3
  20. package/generated/interfaces/wasi-cli-stderr.d.ts +0 -3
  21. package/generated/interfaces/wasi-cli-stdin.d.ts +0 -3
  22. package/generated/interfaces/wasi-cli-stdout.d.ts +0 -3
  23. package/generated/interfaces/wasi-cli-terminal-input.d.ts +0 -8
  24. package/generated/interfaces/wasi-cli-terminal-output.d.ts +0 -8
  25. package/generated/interfaces/wasi-cli-terminal-stderr.d.ts +0 -3
  26. package/generated/interfaces/wasi-cli-terminal-stdin.d.ts +0 -3
  27. package/generated/interfaces/wasi-cli-terminal-stdout.d.ts +0 -3
  28. package/generated/interfaces/wasi-io-error.d.ts +0 -8
  29. package/generated/interfaces/wasi-io-poll.d.ts +0 -9
  30. package/generated/interfaces/wasi-io-streams.d.ts +0 -29
  31. package/generated/interfaces/wasi-random-insecure-seed.d.ts +0 -2
  32. package/generated/interfaces/wasi-random-random.d.ts +0 -2
  33. package/generated/pframes_rs_wasm.d.ts +0 -17
  34. package/src/axes.ts +0 -20
  35. package/src/index.ts +0 -15
  36. package/src/p-frame.ts +0 -106
@@ -1,6 +1,7 @@
1
- "use jco";import { environment, exit as exit$1, stderr, stdin, stdout, terminalInput, terminalOutput, terminalStderr, terminalStdin, terminalStdout } from '@bytecodealliance/preview2-shim/cli';
1
+ import { environment, exit as exit$1, stderr, stdin, stdout, terminalInput, terminalOutput, terminalStderr, terminalStdin, terminalStdout } from '@bytecodealliance/preview2-shim/cli';
2
2
  import { error, poll, streams } from '@bytecodealliance/preview2-shim/io';
3
3
  import { insecureSeed as insecureSeed$1, random } from '@bytecodealliance/preview2-shim/random';
4
+
4
5
  const { getEnvironment } = environment;
5
6
  getEnvironment._isHostProvided = true;
6
7
 
@@ -369,7 +370,7 @@ class AsyncTask {
369
370
 
370
371
  this.#onResolveHandlers.push((results) => {
371
372
  resolveCompletionPromise(results);
372
- })
373
+ });
373
374
 
374
375
  if (opts.callbackFn) { this.#callbackFn = opts.callbackFn; }
375
376
  if (opts.callbackFnName) { this.#callbackFnName = opts.callbackFnName; }
@@ -622,10 +623,7 @@ class AsyncTask {
622
623
  const { cancellable, readyFn } = opts;
623
624
  _debugLog('[AsyncTask#immediateSuspendUntil()] args', { cancellable, readyFn });
624
625
 
625
- const ready = readyFn();
626
- if (ready && !ASYNC_DETERMINISM && _coinFlip()) {
627
- return true;
628
- }
626
+ readyFn();
629
627
 
630
628
  const cstate = getOrCreateAsyncState(this.#componentIdx);
631
629
  cstate.addPendingTask(this);
@@ -795,19 +793,6 @@ endCurrentSubtask() {
795
793
  }
796
794
  }
797
795
 
798
- function unpackCallbackResult(result) {
799
- _debugLog('[unpackCallbackResult()] args', { result });
800
- if (!(_typeCheckValidI32(result))) { throw new Error('invalid callback return value [' + result + '], not a valid i32'); }
801
- const eventCode = result & 0xF;
802
- if (eventCode < 0 || eventCode > 3) {
803
- throw new Error('invalid async return value [' + eventCode + '], outside callback code range');
804
- }
805
- if (result < 0 || result >= 2**32) { throw new Error('invalid callback result'); }
806
- // TODO: table max length check?
807
- const waitableSetRep = result >> 4;
808
- return [eventCode, waitableSetRep];
809
- }
810
-
811
796
  function _lowerImport(args, exportFn) {
812
797
  const params = [...arguments].slice(2);
813
798
  _debugLog('[_lowerImport()] args', { args, params, exportFn });
@@ -955,11 +940,10 @@ function _liftFlatVariant(casesAndLiftFns) {
955
940
  return function _liftFlatVariantInner(ctx) {
956
941
  _debugLog('[_liftFlatVariant()] args', { ctx });
957
942
 
958
- const origUseParams = ctx.useDirectParams;
943
+ ctx.useDirectParams;
959
944
 
960
945
  let caseIdx;
961
946
  if (casesAndLiftFns.length < 256) {
962
- let discriminantByteLen = 1;
963
947
  const [idx, newCtx] = _liftFlatU8(ctx);
964
948
  caseIdx = idx;
965
949
  ctx = newCtx;
@@ -994,56 +978,6 @@ function _liftFlatVariant(casesAndLiftFns) {
994
978
  }
995
979
 
996
980
  function _liftFlatList(elemLiftFn, alignment32, knownLen) {
997
- function _liftFlatListInner(ctx) {
998
- _debugLog('[_liftFlatList()] args', { ctx });
999
-
1000
- let metaPtr;
1001
- let dataPtr;
1002
- let len;
1003
- if (ctx.useDirectParams) {
1004
- if (knownLen) {
1005
- dataPtr = _liftFlatU32(ctx);
1006
- } else {
1007
- metaPtr = _liftFlatU32(ctx);
1008
- }
1009
- } else {
1010
- if (knownLen) {
1011
- dataPtr = _liftFlatU32(ctx);
1012
- } else {
1013
- metaPtr = _liftFlatU32(ctx);
1014
- }
1015
- }
1016
-
1017
- if (metaPtr) {
1018
- if (dataPtr !== undefined) { throw new Error('both meta and data pointers should not be set yet'); }
1019
-
1020
- if (ctx.useDirectParams) {
1021
- ctx.useDirectParams = false;
1022
- ctx.storagePtr = metaPtr;
1023
- ctx.storageLen = 8;
1024
-
1025
- dataPtr = _liftFlatU32(ctx);
1026
- len = _liftFlatU32(ctx);
1027
-
1028
- ctx.useDirectParams = true;
1029
- ctx.storagePtr = null;
1030
- ctx.storageLen = null;
1031
- } else {
1032
- dataPtr = _liftFlatU32(ctx);
1033
- len = _liftFlatU32(ctx);
1034
- }
1035
- }
1036
-
1037
- const val = [];
1038
- for (var i = 0; i < len; i++) {
1039
- ctx.storagePtr = Math.ceil(ctx.storagePtr / alignment32) * alignment32;
1040
- const [res, nextCtx] = elemLiftFn(ctx);
1041
- val.push(res);
1042
- ctx = nextCtx;
1043
- }
1044
-
1045
- return [val, ctx];
1046
- }
1047
981
  }
1048
982
 
1049
983
  function _liftFlatResult(casesAndLiftFns) {
@@ -1116,7 +1050,7 @@ function _lowerFlatVariant(metadata, extra) {
1116
1050
  if (!variant.discriminant) { throw new Error(`missing/invalid discriminant for variant [${variant}]`); }
1117
1051
 
1118
1052
  let bytesWritten;
1119
- let discriminantLowerArgs = { memory, realloc, vals: [variant.discriminant], storagePtr, componentIdx }
1053
+ let discriminantLowerArgs = { memory, realloc, vals: [variant.discriminant], storagePtr, componentIdx };
1120
1054
  switch (discriminantSizeBytes) {
1121
1055
  case 1:
1122
1056
  bytesWritten = _lowerFlatU8(discriminantLowerArgs);
@@ -1176,12 +1110,12 @@ function _lowerFlatOption(size, memory, vals, storagePtr, storageLen) {
1176
1110
  }
1177
1111
 
1178
1112
  function _lowerFlatResult(lowerMetas) {
1179
- const invalidTag = lowerMetas.find(t => t.tag !== 'ok' && t.tag !== 'error')
1113
+ const invalidTag = lowerMetas.find(t => t.tag !== 'ok' && t.tag !== 'error');
1180
1114
  if (invalidTag) { throw new Error(`invalid variant tag [${invalidTag}] found for result`); }
1181
1115
 
1182
1116
  return function _lowerFlatResultInner() {
1183
1117
  _debugLog('[_lowerFlatResult()] args', { lowerMetas });
1184
- let lowerFn = _lowerFlatVariant({ discriminantSizeBytes: 1, lowerMetas }, { forResult: true });
1118
+ let lowerFn = _lowerFlatVariant({ discriminantSizeBytes: 1, lowerMetas });
1185
1119
  return lowerFn.apply(null, arguments);
1186
1120
  };
1187
1121
  }
@@ -1239,7 +1173,7 @@ class ComponentAsyncState {
1239
1173
  _debugLog('[ComponentAsyncState#setErrored()] component errored', { err, componentIdx: this.#componentIdx });
1240
1174
  if (this.#errored) { return; }
1241
1175
  if (!err) {
1242
- err = new Error('error elswehere (see other component instance error)')
1176
+ err = new Error('error elswehere (see other component instance error)');
1243
1177
  err.componentIdx = this.#componentIdx;
1244
1178
  }
1245
1179
  this.#errored = err;
@@ -1313,7 +1247,7 @@ class ComponentAsyncState {
1313
1247
  let handlers = this.#handlerMap.get(event);
1314
1248
  if (!handlers) {
1315
1249
  handlers = [];
1316
- this.#handlerMap.set(event, handlers)
1250
+ this.#handlerMap.set(event, handlers);
1317
1251
  }
1318
1252
 
1319
1253
  handlers.push({ id: handlerID, fn, event });
@@ -1383,7 +1317,7 @@ class ComponentAsyncState {
1383
1317
  componentIdx: this.#componentIdx,
1384
1318
  });
1385
1319
 
1386
- this.#locked = false
1320
+ this.#locked = false;
1387
1321
  }
1388
1322
 
1389
1323
  isExclusivelyLocked() { return this.#locked === true; }
@@ -1463,370 +1397,6 @@ class ComponentAsyncState {
1463
1397
  }
1464
1398
  }
1465
1399
 
1466
- function _prepareCall(
1467
- memoryIdx,
1468
- getMemoryFn,
1469
- startFn,
1470
- returnFn,
1471
- callerInstanceIdx,
1472
- calleeInstanceIdx,
1473
- taskReturnTypeIdx,
1474
- isCalleeAsyncInt,
1475
- stringEncoding,
1476
- resultCountOrAsync,
1477
- ) {
1478
- _debugLog('[_prepareCall()]', {
1479
- callerInstanceIdx,
1480
- calleeInstanceIdx,
1481
- taskReturnTypeIdx,
1482
- isCalleeAsyncInt,
1483
- stringEncoding,
1484
- resultCountOrAsync,
1485
- });
1486
- const argArray = [...arguments];
1487
-
1488
- // Since Rust will happily pass large u32s over, resultCountOrAsync should be one of:
1489
- // (a) u32 max size => callee is async fn with no result
1490
- // (b) u32 max size - 1 => callee is async fn with result
1491
- // (c) any other value => callee is sync with the given result count
1492
- //
1493
- // Due to JS handling the value as 2s complement, the `resultCountOrAsync` ends up being:
1494
- // (a) -1 as u32 max size
1495
- // (b) -2 as u32 max size - 1
1496
- // (c) x
1497
- //
1498
- // Due to JS mishandling the value as 2s complement, the actual values we get are:
1499
- // see. https://github.com/wasm-bindgen/wasm-bindgen/issues/1388
1500
- let isAsync = false;
1501
- let hasResultPointer = false;
1502
- if (resultCountOrAsync === -1) {
1503
- isAsync = true;
1504
- hasResultPointer = false;
1505
- } else if (resultCountOrAsync === -2) {
1506
- isAsync = true;
1507
- hasResultPointer = true;
1508
- }
1509
-
1510
- const currentCallerTaskMeta = getCurrentTask(callerInstanceIdx);
1511
- if (!currentCallerTaskMeta) {
1512
- throw new Error('invalid/missing current task for caller during prepare call');
1513
- }
1514
-
1515
- const currentCallerTask = currentCallerTaskMeta.task;
1516
- if (!currentCallerTask) {
1517
- throw new Error('unexpectedly missing task in meta for caller during prepare call');
1518
- }
1519
-
1520
- if (currentCallerTask.componentIdx() !== callerInstanceIdx) {
1521
- throw new Error(`task component idx [${ currentCallerTask.componentIdx() }] !== [${ callerInstanceIdx }] (callee ${ calleeInstanceIdx })`);
1522
- }
1523
-
1524
- let getCalleeParamsFn;
1525
- let resultPtr = null;
1526
- if (hasResultPointer) {
1527
- const directParamsArr = argArray.slice(11);
1528
- getCalleeParamsFn = () => directParamsArr;
1529
- resultPtr = argArray[10];
1530
- } else {
1531
- const directParamsArr = argArray.slice(10);
1532
- getCalleeParamsFn = () => directParamsArr;
1533
- }
1534
-
1535
- let encoding;
1536
- switch (stringEncoding) {
1537
- case 0:
1538
- encoding = 'utf8';
1539
- break;
1540
- case 1:
1541
- encoding = 'utf16';
1542
- break;
1543
- case 2:
1544
- encoding = 'compact-utf16';
1545
- break;
1546
- default:
1547
- throw new Error(`unrecognized string encoding enum [${stringEncoding}]`);
1548
- }
1549
-
1550
- const [newTask, newTaskID] = createNewCurrentTask({
1551
- componentIdx: calleeInstanceIdx,
1552
- isAsync: isCalleeAsyncInt !== 0,
1553
- getCalleeParamsFn,
1554
- // TODO: find a way to pass the import name through here
1555
- entryFnName: 'task/' + currentCallerTask.id() + '/new-prepare-task',
1556
- stringEncoding,
1557
- });
1558
-
1559
- const subtask = currentCallerTask.createSubtask({
1560
- componentIdx: callerInstanceIdx,
1561
- parentTask: currentCallerTask,
1562
- childTask: newTask,
1563
- callMetadata: {
1564
- memory: getMemoryFn(),
1565
- memoryIdx,
1566
- resultPtr,
1567
- returnFn,
1568
- startFn,
1569
- }
1570
- });
1571
-
1572
- newTask.setParentSubtask(subtask);
1573
- // NOTE: This isn't really a return memory idx for the caller, it's for checking
1574
- // against the task.return (which will be called from the callee)
1575
- newTask.setReturnMemoryIdx(memoryIdx);
1576
- }
1577
-
1578
- function _asyncStartCall(args, callee, paramCount, resultCount, flags) {
1579
- const { getCallbackFn, callbackIdx, getPostReturnFn, postReturnIdx } = args;
1580
- _debugLog('[_asyncStartCall()] args', args);
1581
-
1582
- const taskMeta = getCurrentTask(ASYNC_CURRENT_COMPONENT_IDXS.at(-1), ASYNC_CURRENT_TASK_IDS.at(-1));
1583
- if (!taskMeta) { throw new Error('invalid/missing current async task meta during prepare call'); }
1584
-
1585
- const argArray = [...arguments];
1586
-
1587
- // NOTE: at this point we know the current task is the one that was started
1588
- // in PrepareCall, so we *should* be able to pop it back off and be left with
1589
- // the previous task
1590
- const preparedTask = taskMeta.task;
1591
- if (!preparedTask) { throw new Error('unexpectedly missing task in task meta during prepare call'); }
1592
-
1593
- if (resultCount < 0 || resultCount > 1) { throw new Error('invalid/unsupported result count'); }
1594
-
1595
- const callbackFnName = 'callback_' + callbackIdx;
1596
- const callbackFn = getCallbackFn();
1597
- preparedTask.setCallbackFn(callbackFn, callbackFnName);
1598
- preparedTask.setPostReturnFn(getPostReturnFn());
1599
-
1600
- const subtask = preparedTask.getParentSubtask();
1601
-
1602
- if (resultCount < 0 || resultCount > 1) { throw new Error(`unsupported result count [${ resultCount }]`); }
1603
-
1604
- const params = preparedTask.getCalleeParams();
1605
- if (paramCount !== params.length) {
1606
- throw new Error(`unexpected callee param count [${ params.length }], _asyncStartCall invocation expected [${ paramCount }]`);
1607
- }
1608
-
1609
- subtask.setOnProgressFn(() => {
1610
- subtask.setPendingEventFn(() => {
1611
- if (subtask.resolved()) { subtask.deliverResolve(); }
1612
- return {
1613
- code: ASYNC_EVENT_CODE.SUBTASK,
1614
- index: rep,
1615
- result: subtask.getStateNumber(),
1616
- }
1617
- });
1618
- });
1619
-
1620
- const subtaskState = subtask.getStateNumber();
1621
- if (subtaskState < 0 || subtaskState > 2**5) {
1622
- throw new Error('invalid subtask state, out of valid range');
1623
- }
1624
-
1625
- const callerComponentState = getOrCreateAsyncState(subtask.componentIdx());
1626
- const rep = callerComponentState.subtasks.insert(subtask);
1627
- subtask.setRep(rep);
1628
-
1629
- const calleeComponentState = getOrCreateAsyncState(preparedTask.componentIdx());
1630
- const calleeBackpressure = calleeComponentState.hasBackpressure();
1631
-
1632
- // Set up a handler on subtask completion to lower results from the call into the caller's memory region.
1633
- //
1634
- // NOTE: during fused guest->guest calls this handler is triggered, but does not actually perform
1635
- // lowering manually, as fused modules provider helper functions that can
1636
- subtask.registerOnResolveHandler((res) => {
1637
- _debugLog('[_asyncStartCall()] handling subtask result', { res, subtaskID: subtask.id() });
1638
- let subtaskCallMeta = subtask.getCallMetadata();
1639
-
1640
- // NOTE: in the case of guest -> guest async calls, there may be no memory/realloc present,
1641
- // as the host will intermediate the value storage/movement between calls.
1642
- //
1643
- // We can simply take the value and lower it as a parameter
1644
- if (subtaskCallMeta.memory || subtaskCallMeta.realloc) {
1645
- throw new Error("call metadata unexpectedly contains memory/realloc for guest->guest call");
1646
- }
1647
-
1648
- const callerTask = subtask.getParentTask();
1649
- const calleeTask = preparedTask;
1650
- const callerMemoryIdx = callerTask.getReturnMemoryIdx();
1651
- const callerComponentIdx = callerTask.componentIdx();
1652
-
1653
- // If a helper function was provided we are likely in a fused guest->guest call,
1654
- // and the result will be delivered (lift/lowered) via helper function
1655
- if (subtaskCallMeta.returnFn) {
1656
- _debugLog('[_asyncStartCall()] return function present while ahndling subtask result, returning early (skipping lower)');
1657
- return;
1658
- }
1659
-
1660
- // If there is no where to lower the results, exit early
1661
- if (!subtaskCallMeta.resultPtr) {
1662
- _debugLog('[_asyncStartCall()] no result ptr during subtask result handling, returning early (skipping lower)');
1663
- return;
1664
- }
1665
-
1666
- let callerMemory;
1667
- if (callerMemoryIdx) {
1668
- callerMemory = GlobalComponentMemories.getMemory(callerComponentIdx, callerMemoryIdx);
1669
- } else {
1670
- const callerMemories = GlobalComponentMemories.getMemoriesForComponentIdx(callerComponentIdx);
1671
- if (callerMemories.length != 1) { throw new Error(`unsupported amount of caller memories`); }
1672
- callerMemory = callerMemories[0];
1673
- }
1674
-
1675
- if (!callerMemory) {
1676
- throw new Error(`missing memory for to guest->guest call result (subtask [${subtask.id()}])`);
1677
- }
1678
-
1679
- const lowerFns = calleeTask.getReturnLowerFns();
1680
- if (!lowerFns || lowerFns.length === 0) {
1681
- throw new Error(`missing result lower metadata for guest->guests call (subtask [${subtask.id()}])`);
1682
- }
1683
-
1684
- if (lowerFns.length !== 1) {
1685
- throw new Error(`only single result supported for guest->guest calls (subtask [${subtask.id()}])`);
1686
- }
1687
-
1688
- lowerFns[0]({
1689
- realloc: undefined,
1690
- memory: callerMemory,
1691
- vals: [res],
1692
- storagePtr: subtaskCallMeta.resultPtr,
1693
- componentIdx: callerComponentIdx
1694
- });
1695
-
1696
- });
1697
-
1698
- // Build call params
1699
- const subtaskCallMeta = subtask.getCallMetadata();
1700
- let startFnParams = [];
1701
- let calleeParams = [];
1702
- if (subtaskCallMeta.startFn && subtaskCallMeta.resultPtr) {
1703
- // If we're using a fused component start fn and a result pointer is present,
1704
- // then we need to pass the result pointer and other params to the start fn
1705
- startFnParams.push(subtaskCallMeta.resultPtr, ...params);
1706
- } else {
1707
- // if not we need to pass params to the callee instead
1708
- startFnParams.push(...params);
1709
- calleeParams.push(...params);
1710
- }
1711
-
1712
- preparedTask.registerOnResolveHandler((res) => {
1713
- _debugLog('[_asyncStartCall()] signaling subtask completion due to task completion', {
1714
- childTaskID: preparedTask.id(),
1715
- subtaskID: subtask.id(),
1716
- parentTaskID: subtask.getParentTask().id(),
1717
- });
1718
- subtask.onResolve(res);
1719
- });
1720
-
1721
- // TODO(fix): start fns sometimes produce results, how should they be used?
1722
- // the result should theoretically be used for flat lowering, but fused components do
1723
- // this automatically!
1724
- subtask.onStart({ startFnParams });
1725
-
1726
- _debugLog("[_asyncStartCall()] initial call", {
1727
- task: preparedTask.id(),
1728
- subtaskID: subtask.id(),
1729
- calleeFnName: callee.name,
1730
- });
1731
-
1732
- const callbackResult = callee.apply(null, calleeParams);
1733
-
1734
- _debugLog("[_asyncStartCall()] after initial call", {
1735
- task: preparedTask.id(),
1736
- subtaskID: subtask.id(),
1737
- calleeFnName: callee.name,
1738
- });
1739
-
1740
- const doSubtaskResolve = () => {
1741
- subtask.deliverResolve();
1742
- };
1743
-
1744
- // If a single call resolved the subtask and there is no backpressure in the guest,
1745
- // we can return immediately
1746
- if (subtask.resolved() && !calleeBackpressure) {
1747
- _debugLog("[_asyncStartCall()] instantly resolved", {
1748
- calleeComponentIdx: preparedTask.componentIdx(),
1749
- task: preparedTask.id(),
1750
- subtaskID: subtask.id(),
1751
- callerComponentIdx: subtask.componentIdx(),
1752
- });
1753
-
1754
- // If a fused component return function was specified for the subtask,
1755
- // we've likely already called it during resolution of the task.
1756
- //
1757
- // In this case, we do not want to actually return 2 AKA "RETURNED",
1758
- // but the normal started task state, because the fused component expects to get
1759
- // the waitable + the original subtask state (0 AKA "STARTING")
1760
- //
1761
- if (subtask.getCallMetadata().returnFn) {
1762
- return Number(subtask.waitableRep()) << 4 | subtaskState;
1763
- }
1764
-
1765
- doSubtaskResolve();
1766
- return AsyncSubtask.State.RETURNED;
1767
- }
1768
-
1769
- // Start the (event) driver loop that will resolve the task
1770
- new Promise(async (resolve, reject) => {
1771
- if (subtask.resolved() && calleeBackpressure) {
1772
- await calleeComponentState.waitForBackpressure();
1773
-
1774
- _debugLog("[_asyncStartCall()] instantly resolved after cleared backpressure", {
1775
- calleeComponentIdx: preparedTask.componentIdx(),
1776
- task: preparedTask.id(),
1777
- subtaskID: subtask.id(),
1778
- callerComponentIdx: subtask.componentIdx(),
1779
- });
1780
- return;
1781
- }
1782
-
1783
- const started = await preparedTask.enter();
1784
- if (!started) {
1785
- _debugLog('[_asyncStartCall()] task failed early', {
1786
- taskID: preparedTask.id(),
1787
- subtaskID: subtask.id(),
1788
- });
1789
- throw new Error("task failed to start");
1790
- return;
1791
- }
1792
-
1793
- // TODO: retrieve/pass along actual fn name the callback corresponds to
1794
- // (at least something like `<lifted fn name>_callback`)
1795
- const fnName = [
1796
- '<task ',
1797
- subtask.parentTaskID(),
1798
- '/subtask ',
1799
- subtask.id(),
1800
- '/task ',
1801
- preparedTask.id(),
1802
- '>',
1803
- ].join("");
1804
-
1805
- try {
1806
- _debugLog("[_asyncStartCall()] starting driver loop", { fnName, componentIdx: preparedTask.componentIdx(), });
1807
- await _driverLoop({
1808
- componentState: calleeComponentState,
1809
- task: preparedTask,
1810
- fnName,
1811
- isAsync: true,
1812
- callbackResult,
1813
- resolve,
1814
- reject
1815
- });
1816
- } catch (err) {
1817
- _debugLog("[AsyncStartCall] drive loop call failure", { err });
1818
- }
1819
-
1820
- });
1821
-
1822
- return Number(subtask.waitableRep()) << 4 | subtaskState;
1823
- }
1824
-
1825
- function _syncStartCall(callbackIdx) {
1826
- _debugLog('[_syncStartCall()] args', { callbackIdx });
1827
- throw new Error('synchronous start call not implemented!');
1828
- }
1829
-
1830
1400
  function promiseWithResolvers() {
1831
1401
  if (Promise.withResolvers) {
1832
1402
  return Promise.withResolvers();
@@ -1844,19 +1414,8 @@ function promiseWithResolvers() {
1844
1414
  const _debugLog = (...args) => {
1845
1415
  if (!globalThis?.process?.env?.JCO_DEBUG) { return; }
1846
1416
  console.debug(...args);
1847
- }
1848
- const ASYNC_DETERMINISM = 'random';
1849
- const _coinFlip = () => { return Math.random() > 0.5; };
1850
- const I32_MAX = 2_147_483_647;
1851
- const I32_MIN = -2_147_483_648;
1852
- const _typeCheckValidI32 = (n) => typeof n === 'number' && n >= I32_MIN && n <= I32_MAX;
1853
-
1854
- const _typeCheckAsyncFn= (f) => {
1855
- return f instanceof ASYNC_FN_CTOR;
1856
1417
  };
1857
1418
 
1858
- const ASYNC_FN_CTOR = (async () => {}).constructor;
1859
-
1860
1419
  const base64Compile = str => WebAssembly.compile(typeof Buffer !== 'undefined' ? Buffer.from(str, 'base64') : Uint8Array.from(atob(str), b => b.charCodeAt(0)));
1861
1420
 
1862
1421
  const isNode = typeof process !== 'undefined' && process.versions && process.versions.node;
@@ -1877,8 +1436,6 @@ const symbolRscRep = Symbol.for('cabiRep');
1877
1436
 
1878
1437
  const symbolDispose = Symbol.dispose || Symbol.for('dispose');
1879
1438
 
1880
- const handleTables = [];
1881
-
1882
1439
  function finalizationRegistryCreate (unregister) {
1883
1440
  if (typeof FinalizationRegistry === 'undefined') {
1884
1441
  return { unregister () {} };
@@ -1905,7 +1462,7 @@ class RepTable {
1905
1462
  #target;
1906
1463
 
1907
1464
  constructor(args) {
1908
- if (args?.target) { this.target = args.target }
1465
+ if (args?.target) { this.target = args.target; }
1909
1466
  }
1910
1467
 
1911
1468
  insert(val) {
@@ -2030,14 +1587,12 @@ let lowered_import_0_metadata = {
2030
1587
 
2031
1588
  function trampoline0() {
2032
1589
  _debugLog('[iface="wasi:random/random@0.2.6", function="get-random-u64"] [Instruction::CallInterface] (sync, @ enter)');
2033
- const hostProvided = getRandomU64._isHostProvided;
1590
+ getRandomU64._isHostProvided;
2034
1591
 
2035
1592
  let parentTask;
2036
- let task;
2037
- let subtask;
2038
1593
 
2039
1594
  const createTask = () => {
2040
- const results = createNewCurrentTask({
1595
+ createNewCurrentTask({
2041
1596
  componentIdx: 0,
2042
1597
  isAsync: false,
2043
1598
  entryFnName: 'getRandomU64',
@@ -2046,7 +1601,6 @@ function trampoline0() {
2046
1601
  errHandling: 'none',
2047
1602
  callingWasmExport: false,
2048
1603
  });
2049
- task = results[0];
2050
1604
  };
2051
1605
 
2052
1606
  taskCreation: {
@@ -2057,16 +1611,6 @@ function trampoline0() {
2057
1611
  }
2058
1612
 
2059
1613
  createTask();
2060
-
2061
- const isHostAsyncImport = hostProvided && false;
2062
- if (isHostAsyncImport) {
2063
- subtask = parentTask.getLatestSubtask();
2064
- if (!subtask) {
2065
- throw new Error("Missing subtask for host import, has the import been lowered? (ensure asyncImports are set properly)");
2066
- }
2067
- subtask.setChildTask(task);
2068
- task.setParentSubtask(subtask);
2069
- }
2070
1614
  }
2071
1615
 
2072
1616
  let ret = getRandomU64();
@@ -2109,14 +1653,12 @@ function trampoline10(arg0) {
2109
1653
  }
2110
1654
  }
2111
1655
  _debugLog('[iface="wasi:cli/exit@0.2.6", function="exit"] [Instruction::CallInterface] (sync, @ enter)');
2112
- const hostProvided = exit._isHostProvided;
1656
+ exit._isHostProvided;
2113
1657
 
2114
1658
  let parentTask;
2115
- let task;
2116
- let subtask;
2117
1659
 
2118
1660
  const createTask = () => {
2119
- const results = createNewCurrentTask({
1661
+ createNewCurrentTask({
2120
1662
  componentIdx: 0,
2121
1663
  isAsync: false,
2122
1664
  entryFnName: 'exit',
@@ -2125,7 +1667,6 @@ function trampoline10(arg0) {
2125
1667
  errHandling: 'none',
2126
1668
  callingWasmExport: false,
2127
1669
  });
2128
- task = results[0];
2129
1670
  };
2130
1671
 
2131
1672
  taskCreation: {
@@ -2136,19 +1677,8 @@ function trampoline10(arg0) {
2136
1677
  }
2137
1678
 
2138
1679
  createTask();
2139
-
2140
- const isHostAsyncImport = hostProvided && false;
2141
- if (isHostAsyncImport) {
2142
- subtask = parentTask.getLatestSubtask();
2143
- if (!subtask) {
2144
- throw new Error("Missing subtask for host import, has the import been lowered? (ensure asyncImports are set properly)");
2145
- }
2146
- subtask.setChildTask(task);
2147
- task.setParentSubtask(subtask);
2148
- }
2149
1680
  }
2150
-
2151
- let ret; exit(variant0);
1681
+ exit(variant0);
2152
1682
  endCurrentTask(0);
2153
1683
  _debugLog('[iface="wasi:cli/exit@0.2.6", function="exit"][Instruction::Return]', {
2154
1684
  funcName: 'exit',
@@ -2167,7 +1697,6 @@ let lowered_import_2_metadata = {
2167
1697
  const handleTable0 = [T_FLAG, 0];
2168
1698
  const captureTable0= new Map();
2169
1699
  let captureCnt0 = 0;
2170
- handleTables[0] = handleTable0;
2171
1700
 
2172
1701
  function trampoline11(arg0) {
2173
1702
  var handle1 = arg0;
@@ -2180,14 +1709,12 @@ function trampoline11(arg0) {
2180
1709
  }
2181
1710
  curResourceBorrows.push(rsc0);
2182
1711
  _debugLog('[iface="wasi:io/poll@0.2.6", function="[method]pollable.block"] [Instruction::CallInterface] (sync, @ enter)');
2183
- const hostProvided = rsc0.block._isHostProvided;
1712
+ rsc0.block._isHostProvided;
2184
1713
 
2185
1714
  let parentTask;
2186
- let task;
2187
- let subtask;
2188
1715
 
2189
1716
  const createTask = () => {
2190
- const results = createNewCurrentTask({
1717
+ createNewCurrentTask({
2191
1718
  componentIdx: 0,
2192
1719
  isAsync: false,
2193
1720
  entryFnName: 'block',
@@ -2196,7 +1723,6 @@ function trampoline11(arg0) {
2196
1723
  errHandling: 'none',
2197
1724
  callingWasmExport: false,
2198
1725
  });
2199
- task = results[0];
2200
1726
  };
2201
1727
 
2202
1728
  taskCreation: {
@@ -2207,19 +1733,8 @@ function trampoline11(arg0) {
2207
1733
  }
2208
1734
 
2209
1735
  createTask();
2210
-
2211
- const isHostAsyncImport = hostProvided && false;
2212
- if (isHostAsyncImport) {
2213
- subtask = parentTask.getLatestSubtask();
2214
- if (!subtask) {
2215
- throw new Error("Missing subtask for host import, has the import been lowered? (ensure asyncImports are set properly)");
2216
- }
2217
- subtask.setChildTask(task);
2218
- task.setParentSubtask(subtask);
2219
- }
2220
1736
  }
2221
-
2222
- let ret; rsc0.block();
1737
+ rsc0.block();
2223
1738
  for (const rsc of curResourceBorrows) {
2224
1739
  rsc[symbolRscHandle] = undefined;
2225
1740
  }
@@ -2242,7 +1757,6 @@ let lowered_import_3_metadata = {
2242
1757
  const handleTable3 = [T_FLAG, 0];
2243
1758
  const captureTable3= new Map();
2244
1759
  let captureCnt3 = 0;
2245
- handleTables[3] = handleTable3;
2246
1760
 
2247
1761
  function trampoline12(arg0) {
2248
1762
  var handle1 = arg0;
@@ -2255,14 +1769,12 @@ function trampoline12(arg0) {
2255
1769
  }
2256
1770
  curResourceBorrows.push(rsc0);
2257
1771
  _debugLog('[iface="wasi:io/streams@0.2.6", function="[method]output-stream.subscribe"] [Instruction::CallInterface] (sync, @ enter)');
2258
- const hostProvided = rsc0.subscribe._isHostProvided;
1772
+ rsc0.subscribe._isHostProvided;
2259
1773
 
2260
1774
  let parentTask;
2261
- let task;
2262
- let subtask;
2263
1775
 
2264
1776
  const createTask = () => {
2265
- const results = createNewCurrentTask({
1777
+ createNewCurrentTask({
2266
1778
  componentIdx: 0,
2267
1779
  isAsync: false,
2268
1780
  entryFnName: 'subscribe',
@@ -2271,7 +1783,6 @@ function trampoline12(arg0) {
2271
1783
  errHandling: 'none',
2272
1784
  callingWasmExport: false,
2273
1785
  });
2274
- task = results[0];
2275
1786
  };
2276
1787
 
2277
1788
  taskCreation: {
@@ -2282,16 +1793,6 @@ function trampoline12(arg0) {
2282
1793
  }
2283
1794
 
2284
1795
  createTask();
2285
-
2286
- const isHostAsyncImport = hostProvided && false;
2287
- if (isHostAsyncImport) {
2288
- subtask = parentTask.getLatestSubtask();
2289
- if (!subtask) {
2290
- throw new Error("Missing subtask for host import, has the import been lowered? (ensure asyncImports are set properly)");
2291
- }
2292
- subtask.setChildTask(task);
2293
- task.setParentSubtask(subtask);
2294
- }
2295
1796
  }
2296
1797
 
2297
1798
  let ret = rsc0.subscribe();
@@ -2327,18 +1828,15 @@ let lowered_import_4_metadata = {
2327
1828
  const handleTable2 = [T_FLAG, 0];
2328
1829
  const captureTable2= new Map();
2329
1830
  let captureCnt2 = 0;
2330
- handleTables[2] = handleTable2;
2331
1831
 
2332
1832
  function trampoline13() {
2333
1833
  _debugLog('[iface="wasi:cli/stdin@0.2.6", function="get-stdin"] [Instruction::CallInterface] (sync, @ enter)');
2334
- const hostProvided = getStdin._isHostProvided;
1834
+ getStdin._isHostProvided;
2335
1835
 
2336
1836
  let parentTask;
2337
- let task;
2338
- let subtask;
2339
1837
 
2340
1838
  const createTask = () => {
2341
- const results = createNewCurrentTask({
1839
+ createNewCurrentTask({
2342
1840
  componentIdx: 0,
2343
1841
  isAsync: false,
2344
1842
  entryFnName: 'getStdin',
@@ -2347,7 +1845,6 @@ function trampoline13() {
2347
1845
  errHandling: 'none',
2348
1846
  callingWasmExport: false,
2349
1847
  });
2350
- task = results[0];
2351
1848
  };
2352
1849
 
2353
1850
  taskCreation: {
@@ -2358,16 +1855,6 @@ function trampoline13() {
2358
1855
  }
2359
1856
 
2360
1857
  createTask();
2361
-
2362
- const isHostAsyncImport = hostProvided && false;
2363
- if (isHostAsyncImport) {
2364
- subtask = parentTask.getLatestSubtask();
2365
- if (!subtask) {
2366
- throw new Error("Missing subtask for host import, has the import been lowered? (ensure asyncImports are set properly)");
2367
- }
2368
- subtask.setChildTask(task);
2369
- task.setParentSubtask(subtask);
2370
- }
2371
1858
  }
2372
1859
 
2373
1860
  let ret = getStdin();
@@ -2399,14 +1886,12 @@ let lowered_import_5_metadata = {
2399
1886
 
2400
1887
  function trampoline14() {
2401
1888
  _debugLog('[iface="wasi:cli/stdout@0.2.6", function="get-stdout"] [Instruction::CallInterface] (sync, @ enter)');
2402
- const hostProvided = getStdout._isHostProvided;
1889
+ getStdout._isHostProvided;
2403
1890
 
2404
1891
  let parentTask;
2405
- let task;
2406
- let subtask;
2407
1892
 
2408
1893
  const createTask = () => {
2409
- const results = createNewCurrentTask({
1894
+ createNewCurrentTask({
2410
1895
  componentIdx: 0,
2411
1896
  isAsync: false,
2412
1897
  entryFnName: 'getStdout',
@@ -2415,7 +1900,6 @@ function trampoline14() {
2415
1900
  errHandling: 'none',
2416
1901
  callingWasmExport: false,
2417
1902
  });
2418
- task = results[0];
2419
1903
  };
2420
1904
 
2421
1905
  taskCreation: {
@@ -2426,16 +1910,6 @@ function trampoline14() {
2426
1910
  }
2427
1911
 
2428
1912
  createTask();
2429
-
2430
- const isHostAsyncImport = hostProvided && false;
2431
- if (isHostAsyncImport) {
2432
- subtask = parentTask.getLatestSubtask();
2433
- if (!subtask) {
2434
- throw new Error("Missing subtask for host import, has the import been lowered? (ensure asyncImports are set properly)");
2435
- }
2436
- subtask.setChildTask(task);
2437
- task.setParentSubtask(subtask);
2438
- }
2439
1913
  }
2440
1914
 
2441
1915
  let ret = getStdout();
@@ -2467,14 +1941,12 @@ let lowered_import_6_metadata = {
2467
1941
 
2468
1942
  function trampoline15() {
2469
1943
  _debugLog('[iface="wasi:cli/stderr@0.2.6", function="get-stderr"] [Instruction::CallInterface] (sync, @ enter)');
2470
- const hostProvided = getStderr._isHostProvided;
1944
+ getStderr._isHostProvided;
2471
1945
 
2472
1946
  let parentTask;
2473
- let task;
2474
- let subtask;
2475
1947
 
2476
1948
  const createTask = () => {
2477
- const results = createNewCurrentTask({
1949
+ createNewCurrentTask({
2478
1950
  componentIdx: 0,
2479
1951
  isAsync: false,
2480
1952
  entryFnName: 'getStderr',
@@ -2483,7 +1955,6 @@ function trampoline15() {
2483
1955
  errHandling: 'none',
2484
1956
  callingWasmExport: false,
2485
1957
  });
2486
- task = results[0];
2487
1958
  };
2488
1959
 
2489
1960
  taskCreation: {
@@ -2494,16 +1965,6 @@ function trampoline15() {
2494
1965
  }
2495
1966
 
2496
1967
  createTask();
2497
-
2498
- const isHostAsyncImport = hostProvided && false;
2499
- if (isHostAsyncImport) {
2500
- subtask = parentTask.getLatestSubtask();
2501
- if (!subtask) {
2502
- throw new Error("Missing subtask for host import, has the import been lowered? (ensure asyncImports are set properly)");
2503
- }
2504
- subtask.setChildTask(task);
2505
- task.setParentSubtask(subtask);
2506
- }
2507
1968
  }
2508
1969
 
2509
1970
  let ret = getStderr();
@@ -2538,14 +1999,12 @@ let lowered_import_7_metadata = {
2538
1999
 
2539
2000
  function trampoline16(arg0) {
2540
2001
  _debugLog('[iface="wasi:random/insecure-seed@0.2.6", function="insecure-seed"] [Instruction::CallInterface] (sync, @ enter)');
2541
- const hostProvided = insecureSeed._isHostProvided;
2002
+ insecureSeed._isHostProvided;
2542
2003
 
2543
2004
  let parentTask;
2544
- let task;
2545
- let subtask;
2546
2005
 
2547
2006
  const createTask = () => {
2548
- const results = createNewCurrentTask({
2007
+ createNewCurrentTask({
2549
2008
  componentIdx: 0,
2550
2009
  isAsync: false,
2551
2010
  entryFnName: 'insecureSeed',
@@ -2554,7 +2013,6 @@ function trampoline16(arg0) {
2554
2013
  errHandling: 'none',
2555
2014
  callingWasmExport: false,
2556
2015
  });
2557
- task = results[0];
2558
2016
  };
2559
2017
 
2560
2018
  taskCreation: {
@@ -2565,16 +2023,6 @@ function trampoline16(arg0) {
2565
2023
  }
2566
2024
 
2567
2025
  createTask();
2568
-
2569
- const isHostAsyncImport = hostProvided && false;
2570
- if (isHostAsyncImport) {
2571
- subtask = parentTask.getLatestSubtask();
2572
- if (!subtask) {
2573
- throw new Error("Missing subtask for host import, has the import been lowered? (ensure asyncImports are set properly)");
2574
- }
2575
- subtask.setChildTask(task);
2576
- task.setParentSubtask(subtask);
2577
- }
2578
2026
  }
2579
2027
 
2580
2028
  let ret = insecureSeed();
@@ -2599,7 +2047,6 @@ let lowered_import_8_metadata = {
2599
2047
  const handleTable1 = [T_FLAG, 0];
2600
2048
  const captureTable1= new Map();
2601
2049
  let captureCnt1 = 0;
2602
- handleTables[1] = handleTable1;
2603
2050
 
2604
2051
  function trampoline17(arg0, arg1) {
2605
2052
  var handle1 = arg0;
@@ -2612,14 +2059,12 @@ function trampoline17(arg0, arg1) {
2612
2059
  }
2613
2060
  curResourceBorrows.push(rsc0);
2614
2061
  _debugLog('[iface="wasi:io/streams@0.2.6", function="[method]output-stream.check-write"] [Instruction::CallInterface] (sync, @ enter)');
2615
- const hostProvided = rsc0.checkWrite._isHostProvided;
2062
+ rsc0.checkWrite._isHostProvided;
2616
2063
 
2617
2064
  let parentTask;
2618
- let task;
2619
- let subtask;
2620
2065
 
2621
2066
  const createTask = () => {
2622
- const results = createNewCurrentTask({
2067
+ createNewCurrentTask({
2623
2068
  componentIdx: 0,
2624
2069
  isAsync: false,
2625
2070
  entryFnName: 'checkWrite',
@@ -2628,7 +2073,6 @@ function trampoline17(arg0, arg1) {
2628
2073
  errHandling: 'result-catch-handler',
2629
2074
  callingWasmExport: false,
2630
2075
  });
2631
- task = results[0];
2632
2076
  };
2633
2077
 
2634
2078
  taskCreation: {
@@ -2639,16 +2083,6 @@ function trampoline17(arg0, arg1) {
2639
2083
  }
2640
2084
 
2641
2085
  createTask();
2642
-
2643
- const isHostAsyncImport = hostProvided && false;
2644
- if (isHostAsyncImport) {
2645
- subtask = parentTask.getLatestSubtask();
2646
- if (!subtask) {
2647
- throw new Error("Missing subtask for host import, has the import been lowered? (ensure asyncImports are set properly)");
2648
- }
2649
- subtask.setChildTask(task);
2650
- task.setParentSubtask(subtask);
2651
- }
2652
2086
  }
2653
2087
 
2654
2088
 
@@ -2735,14 +2169,12 @@ function trampoline18(arg0, arg1, arg2, arg3) {
2735
2169
  var len3 = arg2;
2736
2170
  var result3 = new Uint8Array(memory0.buffer.slice(ptr3, ptr3 + len3 * 1));
2737
2171
  _debugLog('[iface="wasi:io/streams@0.2.6", function="[method]output-stream.write"] [Instruction::CallInterface] (sync, @ enter)');
2738
- const hostProvided = rsc0.write._isHostProvided;
2172
+ rsc0.write._isHostProvided;
2739
2173
 
2740
2174
  let parentTask;
2741
- let task;
2742
- let subtask;
2743
2175
 
2744
2176
  const createTask = () => {
2745
- const results = createNewCurrentTask({
2177
+ createNewCurrentTask({
2746
2178
  componentIdx: 0,
2747
2179
  isAsync: false,
2748
2180
  entryFnName: 'write',
@@ -2751,7 +2183,6 @@ function trampoline18(arg0, arg1, arg2, arg3) {
2751
2183
  errHandling: 'result-catch-handler',
2752
2184
  callingWasmExport: false,
2753
2185
  });
2754
- task = results[0];
2755
2186
  };
2756
2187
 
2757
2188
  taskCreation: {
@@ -2762,16 +2193,6 @@ function trampoline18(arg0, arg1, arg2, arg3) {
2762
2193
  }
2763
2194
 
2764
2195
  createTask();
2765
-
2766
- const isHostAsyncImport = hostProvided && false;
2767
- if (isHostAsyncImport) {
2768
- subtask = parentTask.getLatestSubtask();
2769
- if (!subtask) {
2770
- throw new Error("Missing subtask for host import, has the import been lowered? (ensure asyncImports are set properly)");
2771
- }
2772
- subtask.setChildTask(task);
2773
- task.setParentSubtask(subtask);
2774
- }
2775
2196
  }
2776
2197
 
2777
2198
 
@@ -2790,7 +2211,7 @@ function trampoline18(arg0, arg1, arg2, arg3) {
2790
2211
  var variant6 = ret;
2791
2212
  switch (variant6.tag) {
2792
2213
  case 'ok': {
2793
- const e = variant6.val;
2214
+ variant6.val;
2794
2215
  dataView(memory0).setInt8(arg3 + 0, 0, true);
2795
2216
  break;
2796
2217
  }
@@ -2854,14 +2275,12 @@ function trampoline19(arg0, arg1) {
2854
2275
  }
2855
2276
  curResourceBorrows.push(rsc0);
2856
2277
  _debugLog('[iface="wasi:io/streams@0.2.6", function="[method]output-stream.blocking-flush"] [Instruction::CallInterface] (sync, @ enter)');
2857
- const hostProvided = rsc0.blockingFlush._isHostProvided;
2278
+ rsc0.blockingFlush._isHostProvided;
2858
2279
 
2859
2280
  let parentTask;
2860
- let task;
2861
- let subtask;
2862
2281
 
2863
2282
  const createTask = () => {
2864
- const results = createNewCurrentTask({
2283
+ createNewCurrentTask({
2865
2284
  componentIdx: 0,
2866
2285
  isAsync: false,
2867
2286
  entryFnName: 'blockingFlush',
@@ -2870,7 +2289,6 @@ function trampoline19(arg0, arg1) {
2870
2289
  errHandling: 'result-catch-handler',
2871
2290
  callingWasmExport: false,
2872
2291
  });
2873
- task = results[0];
2874
2292
  };
2875
2293
 
2876
2294
  taskCreation: {
@@ -2881,16 +2299,6 @@ function trampoline19(arg0, arg1) {
2881
2299
  }
2882
2300
 
2883
2301
  createTask();
2884
-
2885
- const isHostAsyncImport = hostProvided && false;
2886
- if (isHostAsyncImport) {
2887
- subtask = parentTask.getLatestSubtask();
2888
- if (!subtask) {
2889
- throw new Error("Missing subtask for host import, has the import been lowered? (ensure asyncImports are set properly)");
2890
- }
2891
- subtask.setChildTask(task);
2892
- task.setParentSubtask(subtask);
2893
- }
2894
2302
  }
2895
2303
 
2896
2304
 
@@ -2909,7 +2317,7 @@ function trampoline19(arg0, arg1) {
2909
2317
  var variant5 = ret;
2910
2318
  switch (variant5.tag) {
2911
2319
  case 'ok': {
2912
- const e = variant5.val;
2320
+ variant5.val;
2913
2321
  dataView(memory0).setInt8(arg1 + 0, 0, true);
2914
2322
  break;
2915
2323
  }
@@ -2964,14 +2372,12 @@ let lowered_import_11_metadata = {
2964
2372
 
2965
2373
  function trampoline20(arg0) {
2966
2374
  _debugLog('[iface="wasi:cli/environment@0.2.6", function="get-environment"] [Instruction::CallInterface] (sync, @ enter)');
2967
- const hostProvided = getEnvironment._isHostProvided;
2375
+ getEnvironment._isHostProvided;
2968
2376
 
2969
2377
  let parentTask;
2970
- let task;
2971
- let subtask;
2972
2378
 
2973
2379
  const createTask = () => {
2974
- const results = createNewCurrentTask({
2380
+ createNewCurrentTask({
2975
2381
  componentIdx: 0,
2976
2382
  isAsync: false,
2977
2383
  entryFnName: 'getEnvironment',
@@ -2980,7 +2386,6 @@ function trampoline20(arg0) {
2980
2386
  errHandling: 'none',
2981
2387
  callingWasmExport: false,
2982
2388
  });
2983
- task = results[0];
2984
2389
  };
2985
2390
 
2986
2391
  taskCreation: {
@@ -2991,16 +2396,6 @@ function trampoline20(arg0) {
2991
2396
  }
2992
2397
 
2993
2398
  createTask();
2994
-
2995
- const isHostAsyncImport = hostProvided && false;
2996
- if (isHostAsyncImport) {
2997
- subtask = parentTask.getLatestSubtask();
2998
- if (!subtask) {
2999
- throw new Error("Missing subtask for host import, has the import been lowered? (ensure asyncImports are set properly)");
3000
- }
3001
- subtask.setChildTask(task);
3002
- task.setParentSubtask(subtask);
3003
- }
3004
2399
  }
3005
2400
 
3006
2401
  let ret = getEnvironment();
@@ -3045,18 +2440,15 @@ let lowered_import_12_metadata = {
3045
2440
  const handleTable4 = [T_FLAG, 0];
3046
2441
  const captureTable4= new Map();
3047
2442
  let captureCnt4 = 0;
3048
- handleTables[4] = handleTable4;
3049
2443
 
3050
2444
  function trampoline21(arg0) {
3051
2445
  _debugLog('[iface="wasi:cli/terminal-stdin@0.2.6", function="get-terminal-stdin"] [Instruction::CallInterface] (sync, @ enter)');
3052
- const hostProvided = getTerminalStdin._isHostProvided;
2446
+ getTerminalStdin._isHostProvided;
3053
2447
 
3054
2448
  let parentTask;
3055
- let task;
3056
- let subtask;
3057
2449
 
3058
2450
  const createTask = () => {
3059
- const results = createNewCurrentTask({
2451
+ createNewCurrentTask({
3060
2452
  componentIdx: 0,
3061
2453
  isAsync: false,
3062
2454
  entryFnName: 'getTerminalStdin',
@@ -3065,7 +2457,6 @@ function trampoline21(arg0) {
3065
2457
  errHandling: 'none',
3066
2458
  callingWasmExport: false,
3067
2459
  });
3068
- task = results[0];
3069
2460
  };
3070
2461
 
3071
2462
  taskCreation: {
@@ -3076,16 +2467,6 @@ function trampoline21(arg0) {
3076
2467
  }
3077
2468
 
3078
2469
  createTask();
3079
-
3080
- const isHostAsyncImport = hostProvided && false;
3081
- if (isHostAsyncImport) {
3082
- subtask = parentTask.getLatestSubtask();
3083
- if (!subtask) {
3084
- throw new Error("Missing subtask for host import, has the import been lowered? (ensure asyncImports are set properly)");
3085
- }
3086
- subtask.setChildTask(task);
3087
- task.setParentSubtask(subtask);
3088
- }
3089
2470
  }
3090
2471
 
3091
2472
  let ret = getTerminalStdin();
@@ -3124,18 +2505,15 @@ let lowered_import_13_metadata = {
3124
2505
  const handleTable5 = [T_FLAG, 0];
3125
2506
  const captureTable5= new Map();
3126
2507
  let captureCnt5 = 0;
3127
- handleTables[5] = handleTable5;
3128
2508
 
3129
2509
  function trampoline22(arg0) {
3130
2510
  _debugLog('[iface="wasi:cli/terminal-stdout@0.2.6", function="get-terminal-stdout"] [Instruction::CallInterface] (sync, @ enter)');
3131
- const hostProvided = getTerminalStdout._isHostProvided;
2511
+ getTerminalStdout._isHostProvided;
3132
2512
 
3133
2513
  let parentTask;
3134
- let task;
3135
- let subtask;
3136
2514
 
3137
2515
  const createTask = () => {
3138
- const results = createNewCurrentTask({
2516
+ createNewCurrentTask({
3139
2517
  componentIdx: 0,
3140
2518
  isAsync: false,
3141
2519
  entryFnName: 'getTerminalStdout',
@@ -3144,7 +2522,6 @@ function trampoline22(arg0) {
3144
2522
  errHandling: 'none',
3145
2523
  callingWasmExport: false,
3146
2524
  });
3147
- task = results[0];
3148
2525
  };
3149
2526
 
3150
2527
  taskCreation: {
@@ -3155,16 +2532,6 @@ function trampoline22(arg0) {
3155
2532
  }
3156
2533
 
3157
2534
  createTask();
3158
-
3159
- const isHostAsyncImport = hostProvided && false;
3160
- if (isHostAsyncImport) {
3161
- subtask = parentTask.getLatestSubtask();
3162
- if (!subtask) {
3163
- throw new Error("Missing subtask for host import, has the import been lowered? (ensure asyncImports are set properly)");
3164
- }
3165
- subtask.setChildTask(task);
3166
- task.setParentSubtask(subtask);
3167
- }
3168
2535
  }
3169
2536
 
3170
2537
  let ret = getTerminalStdout();
@@ -3203,14 +2570,12 @@ let lowered_import_14_metadata = {
3203
2570
 
3204
2571
  function trampoline23(arg0) {
3205
2572
  _debugLog('[iface="wasi:cli/terminal-stderr@0.2.6", function="get-terminal-stderr"] [Instruction::CallInterface] (sync, @ enter)');
3206
- const hostProvided = getTerminalStderr._isHostProvided;
2573
+ getTerminalStderr._isHostProvided;
3207
2574
 
3208
2575
  let parentTask;
3209
- let task;
3210
- let subtask;
3211
2576
 
3212
2577
  const createTask = () => {
3213
- const results = createNewCurrentTask({
2578
+ createNewCurrentTask({
3214
2579
  componentIdx: 0,
3215
2580
  isAsync: false,
3216
2581
  entryFnName: 'getTerminalStderr',
@@ -3219,7 +2584,6 @@ function trampoline23(arg0) {
3219
2584
  errHandling: 'none',
3220
2585
  callingWasmExport: false,
3221
2586
  });
3222
- task = results[0];
3223
2587
  };
3224
2588
 
3225
2589
  taskCreation: {
@@ -3230,16 +2594,6 @@ function trampoline23(arg0) {
3230
2594
  }
3231
2595
 
3232
2596
  createTask();
3233
-
3234
- const isHostAsyncImport = hostProvided && false;
3235
- if (isHostAsyncImport) {
3236
- subtask = parentTask.getLatestSubtask();
3237
- if (!subtask) {
3238
- throw new Error("Missing subtask for host import, has the import been lowered? (ensure asyncImports are set properly)");
3239
- }
3240
- subtask.setChildTask(task);
3241
- task.setParentSubtask(subtask);
3242
- }
3243
2597
  }
3244
2598
 
3245
2599
  let ret = getTerminalStderr();
@@ -3300,16 +2654,12 @@ const finalizationRegistry6 = finalizationRegistryCreate((handle) => {
3300
2654
  const { rep } = rscTableRemove(handleTable6, handle);
3301
2655
  exports0['8'](rep);
3302
2656
  });
3303
-
3304
- handleTables[6] = handleTable6;
3305
2657
  const trampoline1 = rscTableCreateOwn.bind(null, handleTable6);
3306
2658
  const handleTable7 = [T_FLAG, 0];
3307
2659
  const finalizationRegistry7 = finalizationRegistryCreate((handle) => {
3308
2660
  const { rep } = rscTableRemove(handleTable7, handle);
3309
2661
  exports0['9'](rep);
3310
2662
  });
3311
-
3312
- handleTables[7] = handleTable7;
3313
2663
  const trampoline2 = rscTableCreateOwn.bind(null, handleTable7);
3314
2664
  function trampoline3(handle) {
3315
2665
  const handleEntry = rscTableRemove(handleTable7, handle);
@@ -3738,9 +3088,8 @@ Frame.fromJson = function fromJson(arg0) {
3738
3088
  async: false,
3739
3089
  postReturn: true,
3740
3090
  });
3741
- const hostProvided = false;
3742
3091
 
3743
- const [task, _wasm_call_currentTaskID] = createNewCurrentTask({
3092
+ createNewCurrentTask({
3744
3093
  componentIdx: 0,
3745
3094
  isAsync: false,
3746
3095
  entryFnName: 'specStaticFrameFromJson',
@@ -3821,9 +3170,8 @@ Frame.deleteColumns = function deleteColumns(arg0) {
3821
3170
  async: false,
3822
3171
  postReturn: true,
3823
3172
  });
3824
- const hostProvided = false;
3825
3173
 
3826
- const [task, _wasm_call_currentTaskID] = createNewCurrentTask({
3174
+ createNewCurrentTask({
3827
3175
  componentIdx: 0,
3828
3176
  isAsync: false,
3829
3177
  entryFnName: 'specStaticFrameDeleteColumns',
@@ -3901,9 +3249,8 @@ Frame.prototype.findColumns = function findColumns(arg1) {
3901
3249
  async: false,
3902
3250
  postReturn: true,
3903
3251
  });
3904
- const hostProvided = false;
3905
3252
 
3906
- const [task, _wasm_call_currentTaskID] = createNewCurrentTask({
3253
+ createNewCurrentTask({
3907
3254
  componentIdx: 0,
3908
3255
  isAsync: false,
3909
3256
  entryFnName: 'specMethodFrameFindColumns',
@@ -3981,9 +3328,8 @@ Frame.prototype.evaluateQuery = function evaluateQuery(arg1) {
3981
3328
  async: false,
3982
3329
  postReturn: true,
3983
3330
  });
3984
- const hostProvided = false;
3985
3331
 
3986
- const [task, _wasm_call_currentTaskID] = createNewCurrentTask({
3332
+ createNewCurrentTask({
3987
3333
  componentIdx: 0,
3988
3334
  isAsync: false,
3989
3335
  entryFnName: 'specMethodFrameEvaluateQuery',
@@ -4061,9 +3407,8 @@ Frame.prototype.rewriteLegacyQuery = function rewriteLegacyQuery(arg1) {
4061
3407
  async: false,
4062
3408
  postReturn: true,
4063
3409
  });
4064
- const hostProvided = false;
4065
3410
 
4066
- const [task, _wasm_call_currentTaskID] = createNewCurrentTask({
3411
+ createNewCurrentTask({
4067
3412
  componentIdx: 0,
4068
3413
  isAsync: false,
4069
3414
  entryFnName: 'specMethodFrameRewriteLegacyQuery',
@@ -4142,9 +3487,8 @@ Axes.fromJson = function fromJson(arg0) {
4142
3487
  async: false,
4143
3488
  postReturn: true,
4144
3489
  });
4145
- const hostProvided = false;
4146
3490
 
4147
- const [task, _wasm_call_currentTaskID] = createNewCurrentTask({
3491
+ createNewCurrentTask({
4148
3492
  componentIdx: 0,
4149
3493
  isAsync: false,
4150
3494
  entryFnName: 'specStaticAxesFromJson',
@@ -4225,9 +3569,8 @@ Axes.collapse = function collapse(arg0) {
4225
3569
  async: false,
4226
3570
  postReturn: true,
4227
3571
  });
4228
- const hostProvided = false;
4229
3572
 
4230
- const [task, _wasm_call_currentTaskID] = createNewCurrentTask({
3573
+ createNewCurrentTask({
4231
3574
  componentIdx: 0,
4232
3575
  isAsync: false,
4233
3576
  entryFnName: 'specStaticAxesCollapse',
@@ -4300,9 +3643,8 @@ Axes.prototype.expand = function expand() {
4300
3643
  async: false,
4301
3644
  postReturn: true,
4302
3645
  });
4303
- const hostProvided = false;
4304
3646
 
4305
- const [task, _wasm_call_currentTaskID] = createNewCurrentTask({
3647
+ createNewCurrentTask({
4306
3648
  componentIdx: 0,
4307
3649
  isAsync: false,
4308
3650
  entryFnName: 'specMethodAxesExpand',
@@ -4380,9 +3722,8 @@ Axes.prototype.find = function find(arg1) {
4380
3722
  async: false,
4381
3723
  postReturn: true,
4382
3724
  });
4383
- const hostProvided = false;
4384
3725
 
4385
- const [task, _wasm_call_currentTaskID] = createNewCurrentTask({
3726
+ createNewCurrentTask({
4386
3727
  componentIdx: 0,
4387
3728
  isAsync: false,
4388
3729
  entryFnName: 'specMethodAxesFind',
@@ -4566,4 +3907,5 @@ const spec = {
4566
3907
 
4567
3908
  };
4568
3909
 
4569
- export { spec, }
3910
+ export { spec };
3911
+ //# sourceMappingURL=pframes_rs_wasm.js.map