@milaboratories/pframes-rs-wasm 1.1.7 → 1.1.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/__external/.pnpm/@rollup_plugin-typescript@12.3.0_rollup@4.55.1_tslib@2.8.1_typescript@5.6.3/__external/tslib/tslib.es6.js +74 -0
- package/dist/__external/.pnpm/@rollup_plugin-typescript@12.3.0_rollup@4.55.1_tslib@2.8.1_typescript@5.6.3/__external/tslib/tslib.es6.js.map +1 -0
- package/dist/axes.d.ts.map +1 -1
- package/dist/axes.js +30 -2
- package/dist/axes.js.map +1 -1
- package/dist/generated/pframes_rs_wasm.core.wasm +0 -0
- package/dist/generated/pframes_rs_wasm.js +612 -279
- package/dist/generated/pframes_rs_wasm.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -2
- package/dist/index.js.map +1 -1
- package/dist/p-frame.d.ts.map +1 -1
- package/dist/p-frame.js +0 -2
- package/dist/p-frame.js.map +1 -1
- package/dist/table.d.ts +3 -0
- package/dist/table.d.ts.map +1 -0
- package/dist/table.js +25 -0
- package/dist/table.js.map +1 -0
- package/package.json +12 -11
|
@@ -147,6 +147,164 @@ if (getRandomU64=== undefined) {
|
|
|
147
147
|
}
|
|
148
148
|
|
|
149
149
|
|
|
150
|
+
const _debugLog = (...args) => {
|
|
151
|
+
if (!globalThis?.process?.env?.JCO_DEBUG) { return; }
|
|
152
|
+
console.debug(...args);
|
|
153
|
+
};
|
|
154
|
+
|
|
155
|
+
class GlobalComponentAsyncLowers {
|
|
156
|
+
static map = new Map();
|
|
157
|
+
|
|
158
|
+
constructor() { throw new Error('GlobalComponentAsyncLowers should not be constructed'); }
|
|
159
|
+
|
|
160
|
+
static define(args) {
|
|
161
|
+
const { componentIdx, qualifiedImportFn, fn } = args;
|
|
162
|
+
let inner = GlobalComponentAsyncLowers.map.get(componentIdx);
|
|
163
|
+
if (!inner) {
|
|
164
|
+
inner = new Map();
|
|
165
|
+
GlobalComponentAsyncLowers.map.set(componentIdx, inner);
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
inner.set(qualifiedImportFn, fn);
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
static lookup(componentIdx, qualifiedImportFn) {
|
|
172
|
+
let inner = GlobalComponentAsyncLowers.map.get(componentIdx);
|
|
173
|
+
if (!inner) {
|
|
174
|
+
inner = new Map();
|
|
175
|
+
GlobalComponentAsyncLowers.map.set(componentIdx, inner);
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
const found = inner.get(qualifiedImportFn);
|
|
179
|
+
if (found) { return found; }
|
|
180
|
+
|
|
181
|
+
// In some cases, async lowers are *not* host provided, and
|
|
182
|
+
// but contain/will call an async function in the host.
|
|
183
|
+
//
|
|
184
|
+
// One such case is `stream.write`/`stream.read` trampolines which are
|
|
185
|
+
// actually re-exported through a patch up container *before*
|
|
186
|
+
// they call the relevant async host trampoline.
|
|
187
|
+
//
|
|
188
|
+
// So the path of execution from a component export would be:
|
|
189
|
+
//
|
|
190
|
+
// async guest export --> stream.write import (host wired) -> guest export (patch component) -> async host trampoline
|
|
191
|
+
//
|
|
192
|
+
// On top of all this, the trampoline that is eventually called is async,
|
|
193
|
+
// so we must await the patched guest export call.
|
|
194
|
+
//
|
|
195
|
+
if (qualifiedImportFn.includes("[stream-write-") || qualifiedImportFn.includes("[stream-read-")) {
|
|
196
|
+
return async (...args) => {
|
|
197
|
+
const [originalFn, ...params] = args;
|
|
198
|
+
return await originalFn(...params);
|
|
199
|
+
};
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
// All other cases can call the registered function directly
|
|
203
|
+
return (...args) => {
|
|
204
|
+
const [originalFn, ...params] = args;
|
|
205
|
+
return originalFn(...params);
|
|
206
|
+
};
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
class GlobalComponentMemories {
|
|
211
|
+
static map = new Map();
|
|
212
|
+
|
|
213
|
+
constructor() { throw new Error('GlobalComponentMemories should not be constructed'); }
|
|
214
|
+
|
|
215
|
+
static save(args) {
|
|
216
|
+
const { idx, componentIdx, memory } = args;
|
|
217
|
+
let inner = GlobalComponentMemories.map.get(componentIdx);
|
|
218
|
+
if (!inner) {
|
|
219
|
+
inner = [];
|
|
220
|
+
GlobalComponentMemories.map.set(componentIdx, inner);
|
|
221
|
+
}
|
|
222
|
+
inner.push({ memory, idx });
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
static getMemoriesForComponentIdx(componentIdx) {
|
|
226
|
+
const metas = GlobalComponentMemories.map.get(componentIdx);
|
|
227
|
+
return metas.map(meta => meta.memory);
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
static getMemory(componentIdx, idx) {
|
|
231
|
+
const metas = GlobalComponentMemories.map.get(componentIdx);
|
|
232
|
+
return metas.find(meta => meta.idx === idx)?.memory;
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
class RepTable {
|
|
237
|
+
#data = [0, null];
|
|
238
|
+
#target;
|
|
239
|
+
|
|
240
|
+
constructor(args) {
|
|
241
|
+
this.target = args?.target;
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
insert(val) {
|
|
245
|
+
_debugLog('[RepTable#insert()] args', { val, target: this.target });
|
|
246
|
+
const freeIdx = this.#data[0];
|
|
247
|
+
if (freeIdx === 0) {
|
|
248
|
+
this.#data.push(val);
|
|
249
|
+
this.#data.push(null);
|
|
250
|
+
return (this.#data.length >> 1) - 1;
|
|
251
|
+
}
|
|
252
|
+
this.#data[0] = this.#data[freeIdx << 1];
|
|
253
|
+
const placementIdx = freeIdx << 1;
|
|
254
|
+
this.#data[placementIdx] = val;
|
|
255
|
+
this.#data[placementIdx + 1] = null;
|
|
256
|
+
return freeIdx;
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
get(rep) {
|
|
260
|
+
_debugLog('[RepTable#get()] args', { rep, target: this.target });
|
|
261
|
+
const baseIdx = rep << 1;
|
|
262
|
+
const val = this.#data[baseIdx];
|
|
263
|
+
return val;
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
contains(rep) {
|
|
267
|
+
_debugLog('[RepTable#contains()] args', { rep, target: this.target });
|
|
268
|
+
const baseIdx = rep << 1;
|
|
269
|
+
return !!this.#data[baseIdx];
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
remove(rep) {
|
|
273
|
+
_debugLog('[RepTable#remove()] args', { rep, target: this.target });
|
|
274
|
+
if (this.#data.length === 2) { throw new Error('invalid'); }
|
|
275
|
+
|
|
276
|
+
const baseIdx = rep << 1;
|
|
277
|
+
const val = this.#data[baseIdx];
|
|
278
|
+
if (val === 0) { throw new Error('invalid resource rep (cannot be 0)'); }
|
|
279
|
+
|
|
280
|
+
this.#data[baseIdx] = this.#data[0];
|
|
281
|
+
this.#data[0] = rep;
|
|
282
|
+
|
|
283
|
+
return val;
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
clear() {
|
|
287
|
+
_debugLog('[RepTable#clear()] args', { rep, target: this.target });
|
|
288
|
+
this.#data = [0, null];
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
const ASYNC_CURRENT_TASK_IDS = [];
|
|
292
|
+
const ASYNC_CURRENT_COMPONENT_IDXS = [];
|
|
293
|
+
|
|
294
|
+
function promiseWithResolvers() {
|
|
295
|
+
if (Promise.withResolvers) {
|
|
296
|
+
return Promise.withResolvers();
|
|
297
|
+
} else {
|
|
298
|
+
let resolve;
|
|
299
|
+
let reject;
|
|
300
|
+
const promise = new Promise((res, rej) => {
|
|
301
|
+
resolve = res;
|
|
302
|
+
reject = rej;
|
|
303
|
+
});
|
|
304
|
+
return { promise, resolve, reject };
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
|
|
150
308
|
const emptyFunc = () => {};
|
|
151
309
|
|
|
152
310
|
let dv = new DataView(new ArrayBuffer());
|
|
@@ -170,7 +328,7 @@ function _utf8AllocateAndEncode(s, realloc, memory) {
|
|
|
170
328
|
|
|
171
329
|
const T_FLAG = 1 << 30;
|
|
172
330
|
|
|
173
|
-
function rscTableCreateOwn
|
|
331
|
+
function rscTableCreateOwn(table, rep) {
|
|
174
332
|
const free = table[0] & ~T_FLAG;
|
|
175
333
|
if (free === 0) {
|
|
176
334
|
table.push(0);
|
|
@@ -183,12 +341,14 @@ function rscTableCreateOwn (table, rep) {
|
|
|
183
341
|
return free;
|
|
184
342
|
}
|
|
185
343
|
|
|
186
|
-
function rscTableRemove
|
|
344
|
+
function rscTableRemove(table, handle) {
|
|
187
345
|
const scope = table[handle << 1];
|
|
188
346
|
const val = table[(handle << 1) + 1];
|
|
189
347
|
const own = (val & T_FLAG) !== 0;
|
|
190
348
|
const rep = val & ~T_FLAG;
|
|
191
|
-
if (val === 0 || (scope & T_FLAG) !== 0)
|
|
349
|
+
if (val === 0 || (scope & T_FLAG) !== 0) {
|
|
350
|
+
throw new TypeError("Invalid handle");
|
|
351
|
+
}
|
|
192
352
|
table[handle << 1] = table[0] | T_FLAG;
|
|
193
353
|
table[0] = handle | T_FLAG;
|
|
194
354
|
return { rep, scope, own };
|
|
@@ -287,8 +447,6 @@ function endCurrentTask(componentIdx, taskID) {
|
|
|
287
447
|
return taskMeta.task;
|
|
288
448
|
}
|
|
289
449
|
const ASYNC_TASKS_BY_COMPONENT_IDX = new Map();
|
|
290
|
-
const ASYNC_CURRENT_TASK_IDS = [];
|
|
291
|
-
const ASYNC_CURRENT_COMPONENT_IDXS = [];
|
|
292
450
|
|
|
293
451
|
class AsyncTask {
|
|
294
452
|
static _ID = 0n;
|
|
@@ -589,7 +747,7 @@ class AsyncTask {
|
|
|
589
747
|
|
|
590
748
|
async yieldUntil(opts) {
|
|
591
749
|
const { readyFn, cancellable } = opts;
|
|
592
|
-
_debugLog('[AsyncTask#
|
|
750
|
+
_debugLog('[AsyncTask#yieldUntil()] args', { taskID: this.#id, cancellable });
|
|
593
751
|
|
|
594
752
|
const keepGoing = await this.suspendUntil({ readyFn, cancellable });
|
|
595
753
|
if (!keepGoing) {
|
|
@@ -642,7 +800,9 @@ class AsyncTask {
|
|
|
642
800
|
|
|
643
801
|
const cstate = getOrCreateAsyncState(this.#componentIdx);
|
|
644
802
|
|
|
803
|
+
// TODO(fix): update this to tick until there is no more action to take.
|
|
645
804
|
setTimeout(() => cstate.tick(), 0);
|
|
805
|
+
|
|
646
806
|
const taskWait = await cstate.suspendTask({ task: this, readyFn });
|
|
647
807
|
const keepGoing = await taskWait;
|
|
648
808
|
return keepGoing;
|
|
@@ -844,6 +1004,7 @@ function _lowerImport(args, exportFn) {
|
|
|
844
1004
|
subtask.registerOnResolveHandler((res) => {
|
|
845
1005
|
_debugLog('[_lowerImport()] handling subtask result', { res, subtaskID: subtask.id() });
|
|
846
1006
|
const { memory, resultPtr, realloc } = subtask.getCallMetadata();
|
|
1007
|
+
if (resultLowerFns.length === 0) { return; }
|
|
847
1008
|
resultLowerFns[0]({ componentIdx, memory, realloc, vals: [res], storagePtr: resultPtr });
|
|
848
1009
|
});
|
|
849
1010
|
|
|
@@ -884,54 +1045,63 @@ function _lowerImport(args, exportFn) {
|
|
|
884
1045
|
|
|
885
1046
|
function _liftFlatU8(ctx) {
|
|
886
1047
|
_debugLog('[_liftFlatU8()] args', { ctx });
|
|
887
|
-
|
|
888
1048
|
let val;
|
|
1049
|
+
|
|
889
1050
|
if (ctx.useDirectParams) {
|
|
890
1051
|
if (ctx.params.length === 0) { throw new Error('expected at least a single i32 argument'); }
|
|
891
1052
|
val = ctx.params[0];
|
|
892
1053
|
ctx.params = ctx.params.slice(1);
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
1054
|
+
return [val, ctx];
|
|
1055
|
+
}
|
|
1056
|
+
|
|
1057
|
+
if (ctx.storageLen !== undefined && ctx.storageLen < ctx.storagePtr + 1) {
|
|
1058
|
+
throw new Error('not enough storage remaining for lift');
|
|
898
1059
|
}
|
|
1060
|
+
val = new DataView(ctx.memory.buffer).getUint8(ctx.storagePtr, true);
|
|
1061
|
+
ctx.storagePtr += 1;
|
|
1062
|
+
if (ctx.storageLen !== undefined) { ctx.storageLen -= 1; }
|
|
899
1063
|
|
|
900
1064
|
return [val, ctx];
|
|
901
1065
|
}
|
|
902
1066
|
|
|
903
1067
|
function _liftFlatU16(ctx) {
|
|
904
1068
|
_debugLog('[_liftFlatU16()] args', { ctx });
|
|
905
|
-
|
|
906
1069
|
let val;
|
|
1070
|
+
|
|
907
1071
|
if (ctx.useDirectParams) {
|
|
908
1072
|
if (params.length === 0) { throw new Error('expected at least a single i32 argument'); }
|
|
909
1073
|
val = ctx.params[0];
|
|
910
1074
|
ctx.params = ctx.params.slice(1);
|
|
911
|
-
|
|
912
|
-
if (ctx.storageLen < ctx.storagePtr + 2) { throw new Error('not enough storage remaining for lift'); }
|
|
913
|
-
val = new DataView(ctx.memory.buffer).getUint16(ctx.storagePtr);
|
|
914
|
-
ctx.storagePtr += 2;
|
|
915
|
-
ctx.storageLen -= 2;
|
|
1075
|
+
return [val, ctx];
|
|
916
1076
|
}
|
|
917
1077
|
|
|
1078
|
+
if (ctx.storageLen !== undefined && ctx.storageLen < ctx.storagePtr + 2) {
|
|
1079
|
+
throw new Error('not enough storage remaining for lift');
|
|
1080
|
+
}
|
|
1081
|
+
val = new DataView(ctx.memory.buffer).getUint16(ctx.storagePtr, true);
|
|
1082
|
+
ctx.storagePtr += 2;
|
|
1083
|
+
if (ctx.storageLen !== undefined) { ctx.storageLen -= 2; }
|
|
1084
|
+
|
|
918
1085
|
return [val, ctx];
|
|
919
1086
|
}
|
|
920
1087
|
|
|
921
1088
|
function _liftFlatU32(ctx) {
|
|
922
1089
|
_debugLog('[_liftFlatU32()] args', { ctx });
|
|
923
|
-
|
|
924
1090
|
let val;
|
|
1091
|
+
|
|
925
1092
|
if (ctx.useDirectParams) {
|
|
926
1093
|
if (ctx.params.length === 0) { throw new Error('expected at least a single i34 argument'); }
|
|
927
1094
|
val = ctx.params[0];
|
|
928
1095
|
ctx.params = ctx.params.slice(1);
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
1096
|
+
return [val, ctx];
|
|
1097
|
+
}
|
|
1098
|
+
|
|
1099
|
+
if (ctx.storageLen !== undefined && ctx.storageLen < ctx.storagePtr + 4) {
|
|
1100
|
+
throw new Error('not enough storage remaining for lift');
|
|
934
1101
|
}
|
|
1102
|
+
val = new DataView(ctx.memory.buffer).getUint32(ctx.storagePtr, true);
|
|
1103
|
+
ctx.storagePtr += 4;
|
|
1104
|
+
if (ctx.storageLen !== undefined) { ctx.storageLen -= 4; }
|
|
935
1105
|
|
|
936
1106
|
return [val, ctx];
|
|
937
1107
|
}
|
|
@@ -987,9 +1157,9 @@ function _liftFlatResult(casesAndLiftFns) {
|
|
|
987
1157
|
}
|
|
988
1158
|
}
|
|
989
1159
|
|
|
990
|
-
function
|
|
991
|
-
_debugLog('[
|
|
992
|
-
throw new Error('flat lift for
|
|
1160
|
+
function _liftFlatBorrow(componentTableIdx, size, memory, vals, storagePtr, storageLen) {
|
|
1161
|
+
_debugLog('[_liftFlatBorrow()] args', { size, memory, vals, storagePtr, storageLen });
|
|
1162
|
+
throw new Error('flat lift for borrowed resources not yet implemented!');
|
|
993
1163
|
}
|
|
994
1164
|
|
|
995
1165
|
function _lowerFlatU8(ctx) {
|
|
@@ -1015,16 +1185,17 @@ function _lowerFlatU16(memory, vals, storagePtr, storageLen) {
|
|
|
1015
1185
|
}
|
|
1016
1186
|
|
|
1017
1187
|
function _lowerFlatU32(ctx) {
|
|
1018
|
-
_debugLog('[_lowerFlatU32()] args', ctx);
|
|
1188
|
+
_debugLog('[_lowerFlatU32()] args', { ctx });
|
|
1019
1189
|
const { memory, realloc, vals, storagePtr, storageLen } = ctx;
|
|
1020
1190
|
if (vals.length !== 1) { throw new Error('expected single value to lower, got (' + vals.length + ')'); }
|
|
1021
1191
|
if (vals[0] > 4_294_967_295 || vals[0] < 0) { throw new Error('invalid value for core value representing u32'); }
|
|
1022
1192
|
|
|
1023
|
-
// TODO(
|
|
1193
|
+
// TODO(refactor): fail loudly on misaligned flat lowers?
|
|
1024
1194
|
const rem = ctx.storagePtr % 4;
|
|
1025
1195
|
if (rem !== 0) { ctx.storagePtr += (4 - rem); }
|
|
1026
1196
|
|
|
1027
1197
|
new DataView(memory.buffer).setUint32(storagePtr, vals[0], true);
|
|
1198
|
+
|
|
1028
1199
|
return 4;
|
|
1029
1200
|
}
|
|
1030
1201
|
|
|
@@ -1075,16 +1246,48 @@ function _lowerFlatVariant(metadata, extra) {
|
|
|
1075
1246
|
}
|
|
1076
1247
|
}
|
|
1077
1248
|
|
|
1078
|
-
function _lowerFlatList(
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1249
|
+
function _lowerFlatList(args) {
|
|
1250
|
+
const { elemLowerFn } = args;
|
|
1251
|
+
if (!elemLowerFn) { throw new TypeError("missing/invalid element lower fn for list"); }
|
|
1252
|
+
|
|
1253
|
+
return function _lowerFlatListInner(ctx) {
|
|
1254
|
+
_debugLog('[_lowerFlatList()] args', { ctx });
|
|
1255
|
+
|
|
1256
|
+
if (ctx.params.length < 2) { throw new Error('insufficient params left to lower list'); }
|
|
1257
|
+
const storagePtr = ctx.params[0];
|
|
1258
|
+
ctx.params[1];
|
|
1259
|
+
ctx.params = ctx.params.slice(2);
|
|
1260
|
+
|
|
1261
|
+
if (ctx.useDirectParams) {
|
|
1262
|
+
const list = ctx.vals[0];
|
|
1263
|
+
if (!list) { throw new Error("missing direct param value"); }
|
|
1264
|
+
|
|
1265
|
+
const elemLowerCtx = { storagePtr, memory: ctx.memory };
|
|
1266
|
+
for (let idx = 0; idx < list.length; idx++) {
|
|
1267
|
+
elemLowerCtx.vals = list.slice(idx, idx+1);
|
|
1268
|
+
elemLowerCtx.storagePtr += elemLowerFn(elemLowerCtx);
|
|
1269
|
+
}
|
|
1270
|
+
|
|
1271
|
+
const bytesLowered = elemLowerCtx.storagePtr - ctx.storagePtr;
|
|
1272
|
+
ctx.storagePtr = elemLowerCtx.storagePtr;
|
|
1273
|
+
return bytesLowered;
|
|
1274
|
+
}
|
|
1275
|
+
|
|
1276
|
+
|
|
1277
|
+
if (ctx.vals.length !== 2) {
|
|
1278
|
+
throw new Error('indirect parameter loading must have a pointer and length as vals');
|
|
1279
|
+
}
|
|
1280
|
+
let [valStartPtr, valLen] = ctx.vals;
|
|
1281
|
+
const totalSizeBytes = valLen * size;
|
|
1282
|
+
if (ctx.storageLen !== undefined && totalSizeBytes > ctx.storageLen) {
|
|
1283
|
+
throw new Error('not enough storage remaining for list flat lower');
|
|
1284
|
+
}
|
|
1285
|
+
|
|
1286
|
+
const data = new Uint8Array(memory.buffer, valStartPtr, totalSizeBytes);
|
|
1287
|
+
new Uint8Array(memory.buffer, storagePtr, totalSizeBytes).set(data);
|
|
1288
|
+
|
|
1289
|
+
return totalSizeBytes;
|
|
1084
1290
|
}
|
|
1085
|
-
const data = new Uint8Array(memory.buffer, start, totalSizeBytes);
|
|
1086
|
-
new Uint8Array(memory.buffer, storagePtr, totalSizeBytes).set(data);
|
|
1087
|
-
return data.byteLength;
|
|
1088
1291
|
}
|
|
1089
1292
|
|
|
1090
1293
|
function _lowerFlatTuple(size, memory, vals, storagePtr, storageLen) {
|
|
@@ -1155,6 +1358,8 @@ class ComponentAsyncState {
|
|
|
1155
1358
|
|
|
1156
1359
|
mayLeave = true;
|
|
1157
1360
|
|
|
1361
|
+
#streams;
|
|
1362
|
+
|
|
1158
1363
|
waitableSets;
|
|
1159
1364
|
waitables;
|
|
1160
1365
|
subtasks;
|
|
@@ -1164,9 +1369,11 @@ class ComponentAsyncState {
|
|
|
1164
1369
|
this.waitableSets = new RepTable({ target: `component [${this.#componentIdx}] waitable sets` });
|
|
1165
1370
|
this.waitables = new RepTable({ target: `component [${this.#componentIdx}] waitables` });
|
|
1166
1371
|
this.subtasks = new RepTable({ target: `component [${this.#componentIdx}] subtasks` });
|
|
1372
|
+
this.#streams = new Map();
|
|
1167
1373
|
};
|
|
1168
1374
|
|
|
1169
1375
|
componentIdx() { return this.#componentIdx; }
|
|
1376
|
+
streams() { return this.#streams; }
|
|
1170
1377
|
|
|
1171
1378
|
errored() { return this.#errored !== null; }
|
|
1172
1379
|
setErrored(err) {
|
|
@@ -1379,203 +1586,151 @@ class ComponentAsyncState {
|
|
|
1379
1586
|
|
|
1380
1587
|
tick() {
|
|
1381
1588
|
_debugLog('[ComponentAsyncState#tick()]', { suspendedTaskIDs: this.#suspendedTaskIDs });
|
|
1382
|
-
|
|
1383
|
-
for (const taskID of
|
|
1589
|
+
const resumableTasks = this.#suspendedTaskIDs.filter(t => t !== null);
|
|
1590
|
+
for (const taskID of resumableTasks) {
|
|
1384
1591
|
const meta = this.#suspendedTasksByTaskID.get(taskID);
|
|
1385
1592
|
if (!meta || !meta.readyFn) {
|
|
1386
|
-
throw new Error(
|
|
1593
|
+
throw new Error(`missing/invalid task despite ID [${taskID}] being present`);
|
|
1387
1594
|
}
|
|
1388
|
-
|
|
1389
|
-
|
|
1595
|
+
|
|
1596
|
+
const isReady = meta.readyFn();
|
|
1597
|
+
if (!isReady) { continue; }
|
|
1598
|
+
|
|
1390
1599
|
this.resumeTaskByID(taskID);
|
|
1391
1600
|
}
|
|
1392
|
-
|
|
1601
|
+
|
|
1602
|
+
return this.#suspendedTaskIDs.filter(t => t !== null).length === 0;
|
|
1393
1603
|
}
|
|
1394
1604
|
|
|
1395
1605
|
addPendingTask(task) {
|
|
1396
1606
|
this.#pendingTasks.push(task);
|
|
1397
1607
|
}
|
|
1398
|
-
}
|
|
1399
|
-
|
|
1400
|
-
function promiseWithResolvers() {
|
|
1401
|
-
if (Promise.withResolvers) {
|
|
1402
|
-
return Promise.withResolvers();
|
|
1403
|
-
} else {
|
|
1404
|
-
let resolve;
|
|
1405
|
-
let reject;
|
|
1406
|
-
const promise = new Promise((res, rej) => {
|
|
1407
|
-
resolve = res;
|
|
1408
|
-
reject = rej;
|
|
1409
|
-
});
|
|
1410
|
-
return { promise, resolve, reject };
|
|
1411
|
-
}
|
|
1412
|
-
}
|
|
1413
|
-
|
|
1414
|
-
const _debugLog = (...args) => {
|
|
1415
|
-
if (!globalThis?.process?.env?.JCO_DEBUG) { return; }
|
|
1416
|
-
console.debug(...args);
|
|
1417
|
-
};
|
|
1418
|
-
|
|
1419
|
-
const base64Compile = str => WebAssembly.compile(typeof Buffer !== 'undefined' ? Buffer.from(str, 'base64') : Uint8Array.from(atob(str), b => b.charCodeAt(0)));
|
|
1420
|
-
|
|
1421
|
-
const isNode = typeof process !== 'undefined' && process.versions && process.versions.node;
|
|
1422
|
-
let _fs;
|
|
1423
|
-
async function fetchCompile (url) {
|
|
1424
|
-
if (isNode) {
|
|
1425
|
-
_fs = _fs || await import('node:fs/promises');
|
|
1426
|
-
return WebAssembly.compile(await _fs.readFile(url));
|
|
1427
|
-
}
|
|
1428
|
-
return fetch(url).then(WebAssembly.compileStreaming);
|
|
1429
|
-
}
|
|
1430
|
-
|
|
1431
|
-
const symbolCabiDispose = Symbol.for('cabiDispose');
|
|
1432
|
-
|
|
1433
|
-
const symbolRscHandle = Symbol('handle');
|
|
1434
|
-
|
|
1435
|
-
const symbolRscRep = Symbol.for('cabiRep');
|
|
1436
|
-
|
|
1437
|
-
const symbolDispose = Symbol.dispose || Symbol.for('dispose');
|
|
1438
|
-
|
|
1439
|
-
function finalizationRegistryCreate (unregister) {
|
|
1440
|
-
if (typeof FinalizationRegistry === 'undefined') {
|
|
1441
|
-
return { unregister () {} };
|
|
1442
|
-
}
|
|
1443
|
-
return new FinalizationRegistry(unregister);
|
|
1444
|
-
}
|
|
1445
|
-
|
|
1446
|
-
class ComponentError extends Error {
|
|
1447
|
-
constructor (value) {
|
|
1448
|
-
const enumerable = typeof value !== 'string';
|
|
1449
|
-
super(enumerable ? `${String(value)} (see error.payload)` : value);
|
|
1450
|
-
Object.defineProperty(this, 'payload', { value, enumerable });
|
|
1451
|
-
}
|
|
1452
|
-
}
|
|
1453
|
-
|
|
1454
|
-
function getErrorPayload(e) {
|
|
1455
|
-
if (e && hasOwnProperty.call(e, 'payload')) return e.payload;
|
|
1456
|
-
if (e instanceof Error) throw e;
|
|
1457
|
-
return e;
|
|
1458
|
-
}
|
|
1459
|
-
|
|
1460
|
-
class RepTable {
|
|
1461
|
-
#data = [0, null];
|
|
1462
|
-
#target;
|
|
1463
|
-
|
|
1464
|
-
constructor(args) {
|
|
1465
|
-
if (args?.target) { this.target = args.target; }
|
|
1466
|
-
}
|
|
1467
1608
|
|
|
1468
|
-
|
|
1469
|
-
_debugLog('[
|
|
1470
|
-
const
|
|
1471
|
-
|
|
1472
|
-
|
|
1473
|
-
|
|
1474
|
-
|
|
1609
|
+
addStreamEnd(args) {
|
|
1610
|
+
_debugLog('[ComponentAsyncState#addStreamEnd()] args', args);
|
|
1611
|
+
const { tableIdx, streamEnd } = args;
|
|
1612
|
+
|
|
1613
|
+
let tbl = this.#streams.get(tableIdx);
|
|
1614
|
+
if (!tbl) {
|
|
1615
|
+
tbl = new RepTable({ target: `component [${this.#componentIdx}] streams` });
|
|
1616
|
+
this.#streams.set(tableIdx, tbl);
|
|
1475
1617
|
}
|
|
1476
|
-
|
|
1477
|
-
const
|
|
1478
|
-
|
|
1479
|
-
this.#data[placementIdx + 1] = null;
|
|
1480
|
-
return freeIdx;
|
|
1481
|
-
}
|
|
1482
|
-
|
|
1483
|
-
get(rep) {
|
|
1484
|
-
_debugLog('[RepTable#get()] args', { rep, target: this.target });
|
|
1485
|
-
const baseIdx = rep << 1;
|
|
1486
|
-
const val = this.#data[baseIdx];
|
|
1487
|
-
return val;
|
|
1488
|
-
}
|
|
1489
|
-
|
|
1490
|
-
contains(rep) {
|
|
1491
|
-
_debugLog('[RepTable#contains()] args', { rep, target: this.target });
|
|
1492
|
-
const baseIdx = rep << 1;
|
|
1493
|
-
return !!this.#data[baseIdx];
|
|
1618
|
+
|
|
1619
|
+
const streamIdx = tbl.insert(streamEnd);
|
|
1620
|
+
return streamIdx;
|
|
1494
1621
|
}
|
|
1495
1622
|
|
|
1496
|
-
|
|
1497
|
-
_debugLog('[
|
|
1498
|
-
|
|
1623
|
+
createStream(args) {
|
|
1624
|
+
_debugLog('[ComponentAsyncState#createStream()] args', args);
|
|
1625
|
+
const { tableIdx, elemMeta } = args;
|
|
1626
|
+
if (tableIdx === undefined) { throw new Error("missing table idx while adding stream"); }
|
|
1627
|
+
if (elemMeta === undefined) { throw new Error("missing element metadata while adding stream"); }
|
|
1499
1628
|
|
|
1500
|
-
|
|
1501
|
-
|
|
1502
|
-
|
|
1629
|
+
let tbl = this.#streams.get(tableIdx);
|
|
1630
|
+
if (!tbl) {
|
|
1631
|
+
tbl = new RepTable({ target: `component [${this.#componentIdx}] streams` });
|
|
1632
|
+
this.#streams.set(tableIdx, tbl);
|
|
1633
|
+
}
|
|
1503
1634
|
|
|
1504
|
-
|
|
1505
|
-
|
|
1635
|
+
const stream = new InternalStream({
|
|
1636
|
+
tableIdx,
|
|
1637
|
+
componentIdx: this.#componentIdx,
|
|
1638
|
+
elemMeta,
|
|
1639
|
+
});
|
|
1640
|
+
const writeEndIdx = tbl.insert(stream.getWriteEnd());
|
|
1641
|
+
stream.setWriteEndIdx(writeEndIdx);
|
|
1642
|
+
const readEndIdx = tbl.insert(stream.getReadEnd());
|
|
1643
|
+
stream.setReadEndIdx(readEndIdx);
|
|
1506
1644
|
|
|
1507
|
-
|
|
1645
|
+
const rep = STREAMS.insert(stream);
|
|
1646
|
+
stream.setRep(rep);
|
|
1647
|
+
|
|
1648
|
+
return { writeEndIdx, readEndIdx };
|
|
1508
1649
|
}
|
|
1509
1650
|
|
|
1510
|
-
|
|
1511
|
-
_debugLog('[
|
|
1512
|
-
|
|
1513
|
-
|
|
1514
|
-
}
|
|
1515
|
-
|
|
1516
|
-
const
|
|
1517
|
-
|
|
1518
|
-
|
|
1519
|
-
|
|
1520
|
-
class GlobalComponentAsyncLowers {
|
|
1521
|
-
static map = new Map();
|
|
1522
|
-
|
|
1523
|
-
constructor() { throw new Error('GlobalComponentAsyncLowers should not be constructed'); }
|
|
1524
|
-
|
|
1525
|
-
static define(args) {
|
|
1526
|
-
const { componentIdx, qualifiedImportFn, fn } = args;
|
|
1527
|
-
let inner = GlobalComponentAsyncLowers.map.get(componentIdx);
|
|
1528
|
-
if (!inner) {
|
|
1529
|
-
inner = new Map();
|
|
1530
|
-
GlobalComponentAsyncLowers.map.set(componentIdx, inner);
|
|
1651
|
+
getStreamEnd(args) {
|
|
1652
|
+
_debugLog('[ComponentAsyncState#getStreamEnd()] args', args);
|
|
1653
|
+
const { tableIdx, streamIdx } = args;
|
|
1654
|
+
if (tableIdx === undefined) { throw new Error('missing table idx while retrieveing stream end'); }
|
|
1655
|
+
if (streamIdx === undefined) { throw new Error('missing stream idx while retrieveing stream end'); }
|
|
1656
|
+
|
|
1657
|
+
const tbl = this.#streams.get(tableIdx);
|
|
1658
|
+
if (!tbl) {
|
|
1659
|
+
throw new Error(`missing stream table [${tableIdx}] in component [${this.#componentIdx}] while getting stream`);
|
|
1531
1660
|
}
|
|
1532
1661
|
|
|
1533
|
-
|
|
1662
|
+
const stream = tbl.get(streamIdx);
|
|
1663
|
+
return stream;
|
|
1534
1664
|
}
|
|
1535
1665
|
|
|
1536
|
-
|
|
1537
|
-
|
|
1538
|
-
|
|
1539
|
-
|
|
1540
|
-
|
|
1541
|
-
}
|
|
1666
|
+
removeStreamEnd(args) {
|
|
1667
|
+
_debugLog('[ComponentAsyncState#removeStreamEnd()] args', args);
|
|
1668
|
+
const { tableIdx, streamIdx } = args;
|
|
1669
|
+
if (tableIdx === undefined) { throw new Error("missing table idx while removing stream end"); }
|
|
1670
|
+
if (streamIdx === undefined) { throw new Error("missing stream idx while removing stream end"); }
|
|
1542
1671
|
|
|
1543
|
-
const
|
|
1544
|
-
if (
|
|
1672
|
+
const tbl = this.#streams.get(tableIdx);
|
|
1673
|
+
if (!tbl) {
|
|
1674
|
+
throw new Error(`missing stream table [${tableIdx}] in component [${this.#componentIdx}] while removing stream end`);
|
|
1675
|
+
}
|
|
1545
1676
|
|
|
1546
|
-
|
|
1547
|
-
|
|
1548
|
-
|
|
1549
|
-
|
|
1677
|
+
const stream = tbl.get(streamIdx);
|
|
1678
|
+
if (!stream) { throw new Error(`component [${this.#componentIdx}] missing stream [${streamIdx}]`); }
|
|
1679
|
+
|
|
1680
|
+
const removed = tbl.remove(streamIdx);
|
|
1681
|
+
if (!removed) {
|
|
1682
|
+
throw new Error(`missing stream [${streamIdx}] (table [${tableIdx}]) in component [${this.#componentIdx}] while removing stream end`);
|
|
1683
|
+
}
|
|
1684
|
+
|
|
1685
|
+
return stream;
|
|
1550
1686
|
}
|
|
1551
1687
|
}
|
|
1552
1688
|
|
|
1553
|
-
|
|
1554
|
-
|
|
1555
|
-
|
|
1556
|
-
|
|
1557
|
-
|
|
1558
|
-
|
|
1559
|
-
|
|
1560
|
-
|
|
1561
|
-
if (!inner) {
|
|
1562
|
-
inner = [];
|
|
1563
|
-
GlobalComponentMemories.map.set(componentIdx, inner);
|
|
1564
|
-
}
|
|
1565
|
-
inner.push({ memory, idx });
|
|
1689
|
+
const base64Compile = str => WebAssembly.compile(typeof Buffer !== 'undefined' ? Buffer.from(str, 'base64') : Uint8Array.from(atob(str), b => b.charCodeAt(0)));
|
|
1690
|
+
|
|
1691
|
+
const isNode = typeof process !== 'undefined' && process.versions && process.versions.node;
|
|
1692
|
+
let _fs;
|
|
1693
|
+
async function fetchCompile (url) {
|
|
1694
|
+
if (isNode) {
|
|
1695
|
+
_fs = _fs || await import('node:fs/promises');
|
|
1696
|
+
return WebAssembly.compile(await _fs.readFile(url));
|
|
1566
1697
|
}
|
|
1567
|
-
|
|
1568
|
-
|
|
1569
|
-
|
|
1570
|
-
|
|
1698
|
+
return fetch(url).then(WebAssembly.compileStreaming);
|
|
1699
|
+
}
|
|
1700
|
+
|
|
1701
|
+
const symbolCabiDispose = Symbol.for('cabiDispose');
|
|
1702
|
+
|
|
1703
|
+
const symbolRscHandle = Symbol('handle');
|
|
1704
|
+
|
|
1705
|
+
const symbolRscRep = Symbol.for('cabiRep');
|
|
1706
|
+
|
|
1707
|
+
const symbolDispose = Symbol.dispose || Symbol.for('dispose');
|
|
1708
|
+
|
|
1709
|
+
function finalizationRegistryCreate (unregister) {
|
|
1710
|
+
if (typeof FinalizationRegistry === 'undefined') {
|
|
1711
|
+
return { unregister () {} };
|
|
1571
1712
|
}
|
|
1572
|
-
|
|
1573
|
-
|
|
1574
|
-
|
|
1575
|
-
|
|
1713
|
+
return new FinalizationRegistry(unregister);
|
|
1714
|
+
}
|
|
1715
|
+
|
|
1716
|
+
class ComponentError extends Error {
|
|
1717
|
+
constructor (value) {
|
|
1718
|
+
const enumerable = typeof value !== 'string';
|
|
1719
|
+
super(enumerable ? `${String(value)} (see error.payload)` : value);
|
|
1720
|
+
Object.defineProperty(this, 'payload', { value, enumerable });
|
|
1576
1721
|
}
|
|
1577
1722
|
}
|
|
1578
1723
|
|
|
1724
|
+
function getErrorPayload(e) {
|
|
1725
|
+
if (e && hasOwnProperty.call(e, 'payload')) return e.payload;
|
|
1726
|
+
if (e instanceof Error) throw e;
|
|
1727
|
+
return e;
|
|
1728
|
+
}
|
|
1729
|
+
|
|
1730
|
+
const hasOwnProperty = Object.prototype.hasOwnProperty;
|
|
1731
|
+
|
|
1732
|
+
const instantiateCore = WebAssembly.instantiate;
|
|
1733
|
+
|
|
1579
1734
|
|
|
1580
1735
|
let exports0;
|
|
1581
1736
|
|
|
@@ -1587,7 +1742,7 @@ let lowered_import_0_metadata = {
|
|
|
1587
1742
|
|
|
1588
1743
|
function trampoline0() {
|
|
1589
1744
|
_debugLog('[iface="wasi:random/random@0.2.6", function="get-random-u64"] [Instruction::CallInterface] (sync, @ enter)');
|
|
1590
|
-
getRandomU64
|
|
1745
|
+
getRandomU64?._isHostProvided;
|
|
1591
1746
|
|
|
1592
1747
|
let parentTask;
|
|
1593
1748
|
|
|
@@ -1631,7 +1786,7 @@ let lowered_import_1_metadata = {
|
|
|
1631
1786
|
};
|
|
1632
1787
|
|
|
1633
1788
|
|
|
1634
|
-
function
|
|
1789
|
+
function trampoline11(arg0) {
|
|
1635
1790
|
let variant0;
|
|
1636
1791
|
switch (arg0) {
|
|
1637
1792
|
case 0: {
|
|
@@ -1653,7 +1808,7 @@ function trampoline10(arg0) {
|
|
|
1653
1808
|
}
|
|
1654
1809
|
}
|
|
1655
1810
|
_debugLog('[iface="wasi:cli/exit@0.2.6", function="exit"] [Instruction::CallInterface] (sync, @ enter)');
|
|
1656
|
-
exit
|
|
1811
|
+
exit?._isHostProvided;
|
|
1657
1812
|
|
|
1658
1813
|
let parentTask;
|
|
1659
1814
|
|
|
@@ -1698,7 +1853,7 @@ const handleTable0 = [T_FLAG, 0];
|
|
|
1698
1853
|
const captureTable0= new Map();
|
|
1699
1854
|
let captureCnt0 = 0;
|
|
1700
1855
|
|
|
1701
|
-
function
|
|
1856
|
+
function trampoline12(arg0) {
|
|
1702
1857
|
var handle1 = arg0;
|
|
1703
1858
|
var rep2 = handleTable0[(handle1 << 1) + 1] & ~T_FLAG;
|
|
1704
1859
|
var rsc0 = captureTable0.get(rep2);
|
|
@@ -1709,7 +1864,7 @@ function trampoline11(arg0) {
|
|
|
1709
1864
|
}
|
|
1710
1865
|
curResourceBorrows.push(rsc0);
|
|
1711
1866
|
_debugLog('[iface="wasi:io/poll@0.2.6", function="[method]pollable.block"] [Instruction::CallInterface] (sync, @ enter)');
|
|
1712
|
-
rsc0.block
|
|
1867
|
+
rsc0.block?._isHostProvided;
|
|
1713
1868
|
|
|
1714
1869
|
let parentTask;
|
|
1715
1870
|
|
|
@@ -1758,7 +1913,7 @@ const handleTable3 = [T_FLAG, 0];
|
|
|
1758
1913
|
const captureTable3= new Map();
|
|
1759
1914
|
let captureCnt3 = 0;
|
|
1760
1915
|
|
|
1761
|
-
function
|
|
1916
|
+
function trampoline13(arg0) {
|
|
1762
1917
|
var handle1 = arg0;
|
|
1763
1918
|
var rep2 = handleTable3[(handle1 << 1) + 1] & ~T_FLAG;
|
|
1764
1919
|
var rsc0 = captureTable3.get(rep2);
|
|
@@ -1769,7 +1924,7 @@ function trampoline12(arg0) {
|
|
|
1769
1924
|
}
|
|
1770
1925
|
curResourceBorrows.push(rsc0);
|
|
1771
1926
|
_debugLog('[iface="wasi:io/streams@0.2.6", function="[method]output-stream.subscribe"] [Instruction::CallInterface] (sync, @ enter)');
|
|
1772
|
-
rsc0.subscribe
|
|
1927
|
+
rsc0.subscribe?._isHostProvided;
|
|
1773
1928
|
|
|
1774
1929
|
let parentTask;
|
|
1775
1930
|
|
|
@@ -1829,9 +1984,9 @@ const handleTable2 = [T_FLAG, 0];
|
|
|
1829
1984
|
const captureTable2= new Map();
|
|
1830
1985
|
let captureCnt2 = 0;
|
|
1831
1986
|
|
|
1832
|
-
function
|
|
1987
|
+
function trampoline14() {
|
|
1833
1988
|
_debugLog('[iface="wasi:cli/stdin@0.2.6", function="get-stdin"] [Instruction::CallInterface] (sync, @ enter)');
|
|
1834
|
-
getStdin
|
|
1989
|
+
getStdin?._isHostProvided;
|
|
1835
1990
|
|
|
1836
1991
|
let parentTask;
|
|
1837
1992
|
|
|
@@ -1884,9 +2039,9 @@ let lowered_import_5_metadata = {
|
|
|
1884
2039
|
};
|
|
1885
2040
|
|
|
1886
2041
|
|
|
1887
|
-
function
|
|
2042
|
+
function trampoline15() {
|
|
1888
2043
|
_debugLog('[iface="wasi:cli/stdout@0.2.6", function="get-stdout"] [Instruction::CallInterface] (sync, @ enter)');
|
|
1889
|
-
getStdout
|
|
2044
|
+
getStdout?._isHostProvided;
|
|
1890
2045
|
|
|
1891
2046
|
let parentTask;
|
|
1892
2047
|
|
|
@@ -1939,9 +2094,9 @@ let lowered_import_6_metadata = {
|
|
|
1939
2094
|
};
|
|
1940
2095
|
|
|
1941
2096
|
|
|
1942
|
-
function
|
|
2097
|
+
function trampoline16() {
|
|
1943
2098
|
_debugLog('[iface="wasi:cli/stderr@0.2.6", function="get-stderr"] [Instruction::CallInterface] (sync, @ enter)');
|
|
1944
|
-
getStderr
|
|
2099
|
+
getStderr?._isHostProvided;
|
|
1945
2100
|
|
|
1946
2101
|
let parentTask;
|
|
1947
2102
|
|
|
@@ -1997,9 +2152,9 @@ let lowered_import_7_metadata = {
|
|
|
1997
2152
|
};
|
|
1998
2153
|
|
|
1999
2154
|
|
|
2000
|
-
function
|
|
2155
|
+
function trampoline17(arg0) {
|
|
2001
2156
|
_debugLog('[iface="wasi:random/insecure-seed@0.2.6", function="insecure-seed"] [Instruction::CallInterface] (sync, @ enter)');
|
|
2002
|
-
insecureSeed
|
|
2157
|
+
insecureSeed?._isHostProvided;
|
|
2003
2158
|
|
|
2004
2159
|
let parentTask;
|
|
2005
2160
|
|
|
@@ -2048,7 +2203,7 @@ const handleTable1 = [T_FLAG, 0];
|
|
|
2048
2203
|
const captureTable1= new Map();
|
|
2049
2204
|
let captureCnt1 = 0;
|
|
2050
2205
|
|
|
2051
|
-
function
|
|
2206
|
+
function trampoline18(arg0, arg1) {
|
|
2052
2207
|
var handle1 = arg0;
|
|
2053
2208
|
var rep2 = handleTable3[(handle1 << 1) + 1] & ~T_FLAG;
|
|
2054
2209
|
var rsc0 = captureTable3.get(rep2);
|
|
@@ -2059,7 +2214,7 @@ function trampoline17(arg0, arg1) {
|
|
|
2059
2214
|
}
|
|
2060
2215
|
curResourceBorrows.push(rsc0);
|
|
2061
2216
|
_debugLog('[iface="wasi:io/streams@0.2.6", function="[method]output-stream.check-write"] [Instruction::CallInterface] (sync, @ enter)');
|
|
2062
|
-
rsc0.checkWrite
|
|
2217
|
+
rsc0.checkWrite?._isHostProvided;
|
|
2063
2218
|
|
|
2064
2219
|
let parentTask;
|
|
2065
2220
|
|
|
@@ -2155,7 +2310,7 @@ let lowered_import_9_metadata = {
|
|
|
2155
2310
|
};
|
|
2156
2311
|
|
|
2157
2312
|
|
|
2158
|
-
function
|
|
2313
|
+
function trampoline19(arg0, arg1, arg2, arg3) {
|
|
2159
2314
|
var handle1 = arg0;
|
|
2160
2315
|
var rep2 = handleTable3[(handle1 << 1) + 1] & ~T_FLAG;
|
|
2161
2316
|
var rsc0 = captureTable3.get(rep2);
|
|
@@ -2169,7 +2324,7 @@ function trampoline18(arg0, arg1, arg2, arg3) {
|
|
|
2169
2324
|
var len3 = arg2;
|
|
2170
2325
|
var result3 = new Uint8Array(memory0.buffer.slice(ptr3, ptr3 + len3 * 1));
|
|
2171
2326
|
_debugLog('[iface="wasi:io/streams@0.2.6", function="[method]output-stream.write"] [Instruction::CallInterface] (sync, @ enter)');
|
|
2172
|
-
rsc0.write
|
|
2327
|
+
rsc0.write?._isHostProvided;
|
|
2173
2328
|
|
|
2174
2329
|
let parentTask;
|
|
2175
2330
|
|
|
@@ -2264,7 +2419,7 @@ let lowered_import_10_metadata = {
|
|
|
2264
2419
|
};
|
|
2265
2420
|
|
|
2266
2421
|
|
|
2267
|
-
function
|
|
2422
|
+
function trampoline20(arg0, arg1) {
|
|
2268
2423
|
var handle1 = arg0;
|
|
2269
2424
|
var rep2 = handleTable3[(handle1 << 1) + 1] & ~T_FLAG;
|
|
2270
2425
|
var rsc0 = captureTable3.get(rep2);
|
|
@@ -2275,7 +2430,7 @@ function trampoline19(arg0, arg1) {
|
|
|
2275
2430
|
}
|
|
2276
2431
|
curResourceBorrows.push(rsc0);
|
|
2277
2432
|
_debugLog('[iface="wasi:io/streams@0.2.6", function="[method]output-stream.blocking-flush"] [Instruction::CallInterface] (sync, @ enter)');
|
|
2278
|
-
rsc0.blockingFlush
|
|
2433
|
+
rsc0.blockingFlush?._isHostProvided;
|
|
2279
2434
|
|
|
2280
2435
|
let parentTask;
|
|
2281
2436
|
|
|
@@ -2370,9 +2525,9 @@ let lowered_import_11_metadata = {
|
|
|
2370
2525
|
};
|
|
2371
2526
|
|
|
2372
2527
|
|
|
2373
|
-
function
|
|
2528
|
+
function trampoline21(arg0) {
|
|
2374
2529
|
_debugLog('[iface="wasi:cli/environment@0.2.6", function="get-environment"] [Instruction::CallInterface] (sync, @ enter)');
|
|
2375
|
-
getEnvironment
|
|
2530
|
+
getEnvironment?._isHostProvided;
|
|
2376
2531
|
|
|
2377
2532
|
let parentTask;
|
|
2378
2533
|
|
|
@@ -2441,9 +2596,9 @@ const handleTable4 = [T_FLAG, 0];
|
|
|
2441
2596
|
const captureTable4= new Map();
|
|
2442
2597
|
let captureCnt4 = 0;
|
|
2443
2598
|
|
|
2444
|
-
function
|
|
2599
|
+
function trampoline22(arg0) {
|
|
2445
2600
|
_debugLog('[iface="wasi:cli/terminal-stdin@0.2.6", function="get-terminal-stdin"] [Instruction::CallInterface] (sync, @ enter)');
|
|
2446
|
-
getTerminalStdin
|
|
2601
|
+
getTerminalStdin?._isHostProvided;
|
|
2447
2602
|
|
|
2448
2603
|
let parentTask;
|
|
2449
2604
|
|
|
@@ -2506,9 +2661,9 @@ const handleTable5 = [T_FLAG, 0];
|
|
|
2506
2661
|
const captureTable5= new Map();
|
|
2507
2662
|
let captureCnt5 = 0;
|
|
2508
2663
|
|
|
2509
|
-
function
|
|
2664
|
+
function trampoline23(arg0) {
|
|
2510
2665
|
_debugLog('[iface="wasi:cli/terminal-stdout@0.2.6", function="get-terminal-stdout"] [Instruction::CallInterface] (sync, @ enter)');
|
|
2511
|
-
getTerminalStdout
|
|
2666
|
+
getTerminalStdout?._isHostProvided;
|
|
2512
2667
|
|
|
2513
2668
|
let parentTask;
|
|
2514
2669
|
|
|
@@ -2568,9 +2723,9 @@ let lowered_import_14_metadata = {
|
|
|
2568
2723
|
};
|
|
2569
2724
|
|
|
2570
2725
|
|
|
2571
|
-
function
|
|
2726
|
+
function trampoline24(arg0) {
|
|
2572
2727
|
_debugLog('[iface="wasi:cli/terminal-stderr@0.2.6", function="get-terminal-stderr"] [Instruction::CallInterface] (sync, @ enter)');
|
|
2573
|
-
getTerminalStderr
|
|
2728
|
+
getTerminalStderr?._isHostProvided;
|
|
2574
2729
|
|
|
2575
2730
|
let parentTask;
|
|
2576
2731
|
|
|
@@ -2668,7 +2823,13 @@ function trampoline3(handle) {
|
|
|
2668
2823
|
exports0['9'](handleEntry.rep);
|
|
2669
2824
|
}
|
|
2670
2825
|
}
|
|
2671
|
-
|
|
2826
|
+
const handleTable8 = [T_FLAG, 0];
|
|
2827
|
+
const finalizationRegistry8 = finalizationRegistryCreate((handle) => {
|
|
2828
|
+
const { rep } = rscTableRemove(handleTable8, handle);
|
|
2829
|
+
exports0['10'](rep);
|
|
2830
|
+
});
|
|
2831
|
+
const trampoline4 = rscTableCreateOwn.bind(null, handleTable8);
|
|
2832
|
+
function trampoline5(handle) {
|
|
2672
2833
|
const handleEntry = rscTableRemove(handleTable1, handle);
|
|
2673
2834
|
if (handleEntry.own) {
|
|
2674
2835
|
|
|
@@ -2681,7 +2842,7 @@ function trampoline4(handle) {
|
|
|
2681
2842
|
}
|
|
2682
2843
|
}
|
|
2683
2844
|
}
|
|
2684
|
-
function
|
|
2845
|
+
function trampoline6(handle) {
|
|
2685
2846
|
const handleEntry = rscTableRemove(handleTable0, handle);
|
|
2686
2847
|
if (handleEntry.own) {
|
|
2687
2848
|
|
|
@@ -2694,7 +2855,7 @@ function trampoline5(handle) {
|
|
|
2694
2855
|
}
|
|
2695
2856
|
}
|
|
2696
2857
|
}
|
|
2697
|
-
function
|
|
2858
|
+
function trampoline7(handle) {
|
|
2698
2859
|
const handleEntry = rscTableRemove(handleTable2, handle);
|
|
2699
2860
|
if (handleEntry.own) {
|
|
2700
2861
|
|
|
@@ -2707,7 +2868,7 @@ function trampoline6(handle) {
|
|
|
2707
2868
|
}
|
|
2708
2869
|
}
|
|
2709
2870
|
}
|
|
2710
|
-
function
|
|
2871
|
+
function trampoline8(handle) {
|
|
2711
2872
|
const handleEntry = rscTableRemove(handleTable3, handle);
|
|
2712
2873
|
if (handleEntry.own) {
|
|
2713
2874
|
|
|
@@ -2720,7 +2881,7 @@ function trampoline7(handle) {
|
|
|
2720
2881
|
}
|
|
2721
2882
|
}
|
|
2722
2883
|
}
|
|
2723
|
-
function
|
|
2884
|
+
function trampoline9(handle) {
|
|
2724
2885
|
const handleEntry = rscTableRemove(handleTable4, handle);
|
|
2725
2886
|
if (handleEntry.own) {
|
|
2726
2887
|
|
|
@@ -2733,7 +2894,7 @@ function trampoline8(handle) {
|
|
|
2733
2894
|
}
|
|
2734
2895
|
}
|
|
2735
2896
|
}
|
|
2736
|
-
function
|
|
2897
|
+
function trampoline10(handle) {
|
|
2737
2898
|
const handleEntry = rscTableRemove(handleTable5, handle);
|
|
2738
2899
|
if (handleEntry.own) {
|
|
2739
2900
|
|
|
@@ -2753,7 +2914,7 @@ GlobalComponentAsyncLowers.define({
|
|
|
2753
2914
|
fn: _lowerImport.bind(
|
|
2754
2915
|
null,
|
|
2755
2916
|
{
|
|
2756
|
-
trampolineIdx:
|
|
2917
|
+
trampolineIdx: 11,
|
|
2757
2918
|
componentIdx: 0,
|
|
2758
2919
|
isAsync: false,
|
|
2759
2920
|
paramLiftFns: [_liftFlatResult([['ok', null, null],['error', null, null],])],
|
|
@@ -2776,10 +2937,10 @@ GlobalComponentAsyncLowers.define({
|
|
|
2776
2937
|
fn: _lowerImport.bind(
|
|
2777
2938
|
null,
|
|
2778
2939
|
{
|
|
2779
|
-
trampolineIdx:
|
|
2940
|
+
trampolineIdx: 12,
|
|
2780
2941
|
componentIdx: 0,
|
|
2781
2942
|
isAsync: false,
|
|
2782
|
-
paramLiftFns: [
|
|
2943
|
+
paramLiftFns: [_liftFlatBorrow.bind(null, 0)],
|
|
2783
2944
|
metadata: lowered_import_2_metadata,
|
|
2784
2945
|
resultLowerFns: [],
|
|
2785
2946
|
getCallbackFn: () => null,
|
|
@@ -2799,10 +2960,10 @@ GlobalComponentAsyncLowers.define({
|
|
|
2799
2960
|
fn: _lowerImport.bind(
|
|
2800
2961
|
null,
|
|
2801
2962
|
{
|
|
2802
|
-
trampolineIdx:
|
|
2963
|
+
trampolineIdx: 13,
|
|
2803
2964
|
componentIdx: 0,
|
|
2804
2965
|
isAsync: false,
|
|
2805
|
-
paramLiftFns: [
|
|
2966
|
+
paramLiftFns: [_liftFlatBorrow.bind(null, 3)],
|
|
2806
2967
|
metadata: lowered_import_3_metadata,
|
|
2807
2968
|
resultLowerFns: [_lowerFlatOwn.bind(null, 0)],
|
|
2808
2969
|
getCallbackFn: () => null,
|
|
@@ -2822,7 +2983,7 @@ GlobalComponentAsyncLowers.define({
|
|
|
2822
2983
|
fn: _lowerImport.bind(
|
|
2823
2984
|
null,
|
|
2824
2985
|
{
|
|
2825
|
-
trampolineIdx:
|
|
2986
|
+
trampolineIdx: 14,
|
|
2826
2987
|
componentIdx: 0,
|
|
2827
2988
|
isAsync: false,
|
|
2828
2989
|
paramLiftFns: [],
|
|
@@ -2845,7 +3006,7 @@ GlobalComponentAsyncLowers.define({
|
|
|
2845
3006
|
fn: _lowerImport.bind(
|
|
2846
3007
|
null,
|
|
2847
3008
|
{
|
|
2848
|
-
trampolineIdx:
|
|
3009
|
+
trampolineIdx: 15,
|
|
2849
3010
|
componentIdx: 0,
|
|
2850
3011
|
isAsync: false,
|
|
2851
3012
|
paramLiftFns: [],
|
|
@@ -2868,7 +3029,7 @@ GlobalComponentAsyncLowers.define({
|
|
|
2868
3029
|
fn: _lowerImport.bind(
|
|
2869
3030
|
null,
|
|
2870
3031
|
{
|
|
2871
|
-
trampolineIdx:
|
|
3032
|
+
trampolineIdx: 16,
|
|
2872
3033
|
componentIdx: 0,
|
|
2873
3034
|
isAsync: false,
|
|
2874
3035
|
paramLiftFns: [],
|
|
@@ -2891,7 +3052,7 @@ GlobalComponentAsyncLowers.define({
|
|
|
2891
3052
|
fn: _lowerImport.bind(
|
|
2892
3053
|
null,
|
|
2893
3054
|
{
|
|
2894
|
-
trampolineIdx:
|
|
3055
|
+
trampolineIdx: 17,
|
|
2895
3056
|
componentIdx: 0,
|
|
2896
3057
|
isAsync: false,
|
|
2897
3058
|
paramLiftFns: [],
|
|
@@ -2914,10 +3075,10 @@ GlobalComponentAsyncLowers.define({
|
|
|
2914
3075
|
fn: _lowerImport.bind(
|
|
2915
3076
|
null,
|
|
2916
3077
|
{
|
|
2917
|
-
trampolineIdx:
|
|
3078
|
+
trampolineIdx: 18,
|
|
2918
3079
|
componentIdx: 0,
|
|
2919
3080
|
isAsync: false,
|
|
2920
|
-
paramLiftFns: [
|
|
3081
|
+
paramLiftFns: [_liftFlatBorrow.bind(null, 3)],
|
|
2921
3082
|
metadata: lowered_import_8_metadata,
|
|
2922
3083
|
resultLowerFns: [_lowerFlatResult([{ discriminant: 0, tag: 'ok', lowerFn: _lowerFlatU64, align32: 8 },{ discriminant: 1, tag: 'error', lowerFn: _lowerFlatVariant({ discriminantSizeBytes: 1, lowerMetas: [{ discriminant: 0, tag: 'last-operation-failed', lowerFn: _lowerFlatOwn.bind(null, 1), align32: 4, },{ discriminant: 1, tag: 'closed', lowerFn: null, align32: null, },] }), align32: 4 },])],
|
|
2923
3084
|
getCallbackFn: () => null,
|
|
@@ -2937,10 +3098,10 @@ GlobalComponentAsyncLowers.define({
|
|
|
2937
3098
|
fn: _lowerImport.bind(
|
|
2938
3099
|
null,
|
|
2939
3100
|
{
|
|
2940
|
-
trampolineIdx:
|
|
3101
|
+
trampolineIdx: 19,
|
|
2941
3102
|
componentIdx: 0,
|
|
2942
3103
|
isAsync: false,
|
|
2943
|
-
paramLiftFns: [
|
|
3104
|
+
paramLiftFns: [_liftFlatBorrow.bind(null, 3),_liftFlatList.bind(null, 0)],
|
|
2944
3105
|
metadata: lowered_import_9_metadata,
|
|
2945
3106
|
resultLowerFns: [_lowerFlatResult([{ discriminant: 0, tag: 'ok', lowerFn: null, align32: null },{ discriminant: 1, tag: 'error', lowerFn: _lowerFlatVariant({ discriminantSizeBytes: 1, lowerMetas: [{ discriminant: 0, tag: 'last-operation-failed', lowerFn: _lowerFlatOwn.bind(null, 1), align32: 4, },{ discriminant: 1, tag: 'closed', lowerFn: null, align32: null, },] }), align32: 4 },])],
|
|
2946
3107
|
getCallbackFn: () => null,
|
|
@@ -2960,10 +3121,10 @@ GlobalComponentAsyncLowers.define({
|
|
|
2960
3121
|
fn: _lowerImport.bind(
|
|
2961
3122
|
null,
|
|
2962
3123
|
{
|
|
2963
|
-
trampolineIdx:
|
|
3124
|
+
trampolineIdx: 20,
|
|
2964
3125
|
componentIdx: 0,
|
|
2965
3126
|
isAsync: false,
|
|
2966
|
-
paramLiftFns: [
|
|
3127
|
+
paramLiftFns: [_liftFlatBorrow.bind(null, 3)],
|
|
2967
3128
|
metadata: lowered_import_10_metadata,
|
|
2968
3129
|
resultLowerFns: [_lowerFlatResult([{ discriminant: 0, tag: 'ok', lowerFn: null, align32: null },{ discriminant: 1, tag: 'error', lowerFn: _lowerFlatVariant({ discriminantSizeBytes: 1, lowerMetas: [{ discriminant: 0, tag: 'last-operation-failed', lowerFn: _lowerFlatOwn.bind(null, 1), align32: 4, },{ discriminant: 1, tag: 'closed', lowerFn: null, align32: null, },] }), align32: 4 },])],
|
|
2969
3130
|
getCallbackFn: () => null,
|
|
@@ -2983,12 +3144,12 @@ GlobalComponentAsyncLowers.define({
|
|
|
2983
3144
|
fn: _lowerImport.bind(
|
|
2984
3145
|
null,
|
|
2985
3146
|
{
|
|
2986
|
-
trampolineIdx:
|
|
3147
|
+
trampolineIdx: 21,
|
|
2987
3148
|
componentIdx: 0,
|
|
2988
3149
|
isAsync: false,
|
|
2989
3150
|
paramLiftFns: [],
|
|
2990
3151
|
metadata: lowered_import_11_metadata,
|
|
2991
|
-
resultLowerFns: [_lowerFlatList.bind(null,
|
|
3152
|
+
resultLowerFns: [_lowerFlatList({ elemLowerFn: _lowerFlatTuple.bind(null, 7)})],
|
|
2992
3153
|
getCallbackFn: () => null,
|
|
2993
3154
|
getPostReturnFn: () => null,
|
|
2994
3155
|
isCancellable: false,
|
|
@@ -3006,7 +3167,7 @@ GlobalComponentAsyncLowers.define({
|
|
|
3006
3167
|
fn: _lowerImport.bind(
|
|
3007
3168
|
null,
|
|
3008
3169
|
{
|
|
3009
|
-
trampolineIdx:
|
|
3170
|
+
trampolineIdx: 22,
|
|
3010
3171
|
componentIdx: 0,
|
|
3011
3172
|
isAsync: false,
|
|
3012
3173
|
paramLiftFns: [],
|
|
@@ -3029,7 +3190,7 @@ GlobalComponentAsyncLowers.define({
|
|
|
3029
3190
|
fn: _lowerImport.bind(
|
|
3030
3191
|
null,
|
|
3031
3192
|
{
|
|
3032
|
-
trampolineIdx:
|
|
3193
|
+
trampolineIdx: 23,
|
|
3033
3194
|
componentIdx: 0,
|
|
3034
3195
|
isAsync: false,
|
|
3035
3196
|
paramLiftFns: [],
|
|
@@ -3052,7 +3213,7 @@ GlobalComponentAsyncLowers.define({
|
|
|
3052
3213
|
fn: _lowerImport.bind(
|
|
3053
3214
|
null,
|
|
3054
3215
|
{
|
|
3055
|
-
trampolineIdx:
|
|
3216
|
+
trampolineIdx: 24,
|
|
3056
3217
|
componentIdx: 0,
|
|
3057
3218
|
isAsync: false,
|
|
3058
3219
|
paramLiftFns: [],
|
|
@@ -3461,6 +3622,173 @@ Frame.prototype.rewriteLegacyQuery = function rewriteLegacyQuery(arg1) {
|
|
|
3461
3622
|
|
|
3462
3623
|
|
|
3463
3624
|
|
|
3625
|
+
if (typeof retCopy === 'object' && retCopy.tag === 'err') {
|
|
3626
|
+
throw new ComponentError(retCopy.val);
|
|
3627
|
+
}
|
|
3628
|
+
return retCopy.val;
|
|
3629
|
+
|
|
3630
|
+
};
|
|
3631
|
+
let specStaticTableFromJson;
|
|
3632
|
+
|
|
3633
|
+
class Table{
|
|
3634
|
+
constructor () {
|
|
3635
|
+
throw new Error('"Table" resource does not define a constructor');
|
|
3636
|
+
}
|
|
3637
|
+
}
|
|
3638
|
+
|
|
3639
|
+
Table.fromJson = function fromJson(arg0) {
|
|
3640
|
+
|
|
3641
|
+
var encodeRes = _utf8AllocateAndEncode(arg0, realloc0, memory0);
|
|
3642
|
+
var ptr0= encodeRes.ptr;
|
|
3643
|
+
var len0 = encodeRes.len;
|
|
3644
|
+
|
|
3645
|
+
_debugLog('[iface="milaboratories:pframes/spec", function="[static]table.from-json"][Instruction::CallWasm] enter', {
|
|
3646
|
+
funcName: '[static]table.from-json',
|
|
3647
|
+
paramCount: 2,
|
|
3648
|
+
async: false,
|
|
3649
|
+
postReturn: true,
|
|
3650
|
+
});
|
|
3651
|
+
|
|
3652
|
+
createNewCurrentTask({
|
|
3653
|
+
componentIdx: 0,
|
|
3654
|
+
isAsync: false,
|
|
3655
|
+
entryFnName: 'specStaticTableFromJson',
|
|
3656
|
+
getCallbackFn: () => null,
|
|
3657
|
+
callbackFnName: 'null',
|
|
3658
|
+
errHandling: 'throw-result-err',
|
|
3659
|
+
callingWasmExport: true,
|
|
3660
|
+
});
|
|
3661
|
+
|
|
3662
|
+
let ret = specStaticTableFromJson(ptr0, len0);
|
|
3663
|
+
endCurrentTask(0);
|
|
3664
|
+
let variant4;
|
|
3665
|
+
switch (dataView(memory0).getUint8(ret + 0, true)) {
|
|
3666
|
+
case 0: {
|
|
3667
|
+
var handle2 = dataView(memory0).getInt32(ret + 4, true);
|
|
3668
|
+
var rsc1 = new.target === Table ? this : Object.create(Table.prototype);
|
|
3669
|
+
Object.defineProperty(rsc1, symbolRscHandle, { writable: true, value: handle2});
|
|
3670
|
+
finalizationRegistry8.register(rsc1, handle2, rsc1);
|
|
3671
|
+
Object.defineProperty(rsc1, symbolDispose, { writable: true, value: function () {
|
|
3672
|
+
finalizationRegistry8.unregister(rsc1);
|
|
3673
|
+
rscTableRemove(handleTable8, handle2);
|
|
3674
|
+
rsc1[symbolDispose] = emptyFunc;
|
|
3675
|
+
rsc1[symbolRscHandle] = undefined;
|
|
3676
|
+
exports0['10'](handleTable8[(handle2 << 1) + 1] & ~T_FLAG);
|
|
3677
|
+
}});
|
|
3678
|
+
variant4= {
|
|
3679
|
+
tag: 'ok',
|
|
3680
|
+
val: rsc1
|
|
3681
|
+
};
|
|
3682
|
+
break;
|
|
3683
|
+
}
|
|
3684
|
+
case 1: {
|
|
3685
|
+
var ptr3 = dataView(memory0).getUint32(ret + 4, true);
|
|
3686
|
+
var len3 = dataView(memory0).getUint32(ret + 8, true);
|
|
3687
|
+
var result3 = TEXT_DECODER_UTF8.decode(new Uint8Array(memory0.buffer, ptr3, len3));
|
|
3688
|
+
variant4= {
|
|
3689
|
+
tag: 'err',
|
|
3690
|
+
val: result3
|
|
3691
|
+
};
|
|
3692
|
+
break;
|
|
3693
|
+
}
|
|
3694
|
+
default: {
|
|
3695
|
+
throw new TypeError('invalid variant discriminant for expected');
|
|
3696
|
+
}
|
|
3697
|
+
}
|
|
3698
|
+
_debugLog('[iface="milaboratories:pframes/spec", function="[static]table.from-json"][Instruction::Return]', {
|
|
3699
|
+
funcName: '[static]table.from-json',
|
|
3700
|
+
paramCount: 1,
|
|
3701
|
+
async: false,
|
|
3702
|
+
postReturn: true
|
|
3703
|
+
});
|
|
3704
|
+
const retCopy = variant4;
|
|
3705
|
+
|
|
3706
|
+
let cstate = getOrCreateAsyncState(0);
|
|
3707
|
+
cstate.mayLeave = false;
|
|
3708
|
+
postReturn0(ret);
|
|
3709
|
+
cstate.mayLeave = true;
|
|
3710
|
+
|
|
3711
|
+
|
|
3712
|
+
|
|
3713
|
+
if (typeof retCopy === 'object' && retCopy.tag === 'err') {
|
|
3714
|
+
throw new ComponentError(retCopy.val);
|
|
3715
|
+
}
|
|
3716
|
+
return retCopy.val;
|
|
3717
|
+
|
|
3718
|
+
};
|
|
3719
|
+
let specMethodTableFindColumn;
|
|
3720
|
+
|
|
3721
|
+
Table.prototype.findColumn = function findColumn(arg1) {
|
|
3722
|
+
var handle1 = this[symbolRscHandle];
|
|
3723
|
+
if (!handle1 || (handleTable8[(handle1 << 1) + 1] & T_FLAG) === 0) {
|
|
3724
|
+
throw new TypeError('Resource error: Not a valid "Table" resource.');
|
|
3725
|
+
}
|
|
3726
|
+
var handle0 = handleTable8[(handle1 << 1) + 1] & ~T_FLAG;
|
|
3727
|
+
|
|
3728
|
+
var encodeRes = _utf8AllocateAndEncode(arg1, realloc0, memory0);
|
|
3729
|
+
var ptr2= encodeRes.ptr;
|
|
3730
|
+
var len2 = encodeRes.len;
|
|
3731
|
+
|
|
3732
|
+
_debugLog('[iface="milaboratories:pframes/spec", function="[method]table.find-column"][Instruction::CallWasm] enter', {
|
|
3733
|
+
funcName: '[method]table.find-column',
|
|
3734
|
+
paramCount: 3,
|
|
3735
|
+
async: false,
|
|
3736
|
+
postReturn: true,
|
|
3737
|
+
});
|
|
3738
|
+
|
|
3739
|
+
createNewCurrentTask({
|
|
3740
|
+
componentIdx: 0,
|
|
3741
|
+
isAsync: false,
|
|
3742
|
+
entryFnName: 'specMethodTableFindColumn',
|
|
3743
|
+
getCallbackFn: () => null,
|
|
3744
|
+
callbackFnName: 'null',
|
|
3745
|
+
errHandling: 'throw-result-err',
|
|
3746
|
+
callingWasmExport: true,
|
|
3747
|
+
});
|
|
3748
|
+
|
|
3749
|
+
let ret = specMethodTableFindColumn(handle0, ptr2, len2);
|
|
3750
|
+
endCurrentTask(0);
|
|
3751
|
+
let variant5;
|
|
3752
|
+
switch (dataView(memory0).getUint8(ret + 0, true)) {
|
|
3753
|
+
case 0: {
|
|
3754
|
+
var ptr3 = dataView(memory0).getUint32(ret + 4, true);
|
|
3755
|
+
var len3 = dataView(memory0).getUint32(ret + 8, true);
|
|
3756
|
+
var result3 = TEXT_DECODER_UTF8.decode(new Uint8Array(memory0.buffer, ptr3, len3));
|
|
3757
|
+
variant5= {
|
|
3758
|
+
tag: 'ok',
|
|
3759
|
+
val: result3
|
|
3760
|
+
};
|
|
3761
|
+
break;
|
|
3762
|
+
}
|
|
3763
|
+
case 1: {
|
|
3764
|
+
var ptr4 = dataView(memory0).getUint32(ret + 4, true);
|
|
3765
|
+
var len4 = dataView(memory0).getUint32(ret + 8, true);
|
|
3766
|
+
var result4 = TEXT_DECODER_UTF8.decode(new Uint8Array(memory0.buffer, ptr4, len4));
|
|
3767
|
+
variant5= {
|
|
3768
|
+
tag: 'err',
|
|
3769
|
+
val: result4
|
|
3770
|
+
};
|
|
3771
|
+
break;
|
|
3772
|
+
}
|
|
3773
|
+
default: {
|
|
3774
|
+
throw new TypeError('invalid variant discriminant for expected');
|
|
3775
|
+
}
|
|
3776
|
+
}
|
|
3777
|
+
_debugLog('[iface="milaboratories:pframes/spec", function="[method]table.find-column"][Instruction::Return]', {
|
|
3778
|
+
funcName: '[method]table.find-column',
|
|
3779
|
+
paramCount: 1,
|
|
3780
|
+
async: false,
|
|
3781
|
+
postReturn: true
|
|
3782
|
+
});
|
|
3783
|
+
const retCopy = variant5;
|
|
3784
|
+
|
|
3785
|
+
let cstate = getOrCreateAsyncState(0);
|
|
3786
|
+
cstate.mayLeave = false;
|
|
3787
|
+
postReturn1(ret);
|
|
3788
|
+
cstate.mayLeave = true;
|
|
3789
|
+
|
|
3790
|
+
|
|
3791
|
+
|
|
3464
3792
|
if (typeof retCopy === 'object' && retCopy.tag === 'err') {
|
|
3465
3793
|
throw new ComponentError(retCopy.val);
|
|
3466
3794
|
}
|
|
@@ -3786,35 +4114,36 @@ Axes.prototype.find = function find(arg1) {
|
|
|
3786
4114
|
const $init = (() => {
|
|
3787
4115
|
let gen = (function* _initGenerator () {
|
|
3788
4116
|
const module0 = fetchCompile(new URL('./pframes_rs_wasm.core.wasm', import.meta.url));
|
|
3789
|
-
const module1 = base64Compile('AGFzbQEAAAABEQNgAX8AYAJ/fwBgBH9/
|
|
3790
|
-
const module2 = base64Compile('AGFzbQEAAAABEQNgAX8AYAJ/fwBgBH9/
|
|
4117
|
+
const module1 = base64Compile('AGFzbQEAAAABEQNgAX8AYAJ/fwBgBH9/f38AAwwLAAECAQAAAAAAAAAEBQFwAQsLBzkMATAAAAExAAEBMgACATMAAwE0AAQBNQAFATYABgE3AAcBOAAIATkACQIxMAAKCCRpbXBvcnRzAQAKeQsJACAAQQARAAALCwAgACABQQERAQALDwAgACABIAIgA0ECEQIACwsAIAAgAUEDEQEACwkAIABBBBEAAAsJACAAQQURAAALCQAgAEEGEQAACwkAIABBBxEAAAsJACAAQQgRAAALCQAgAEEJEQAACwkAIABBChEAAAsALwlwcm9kdWNlcnMBDHByb2Nlc3NlZC1ieQENd2l0LWNvbXBvbmVudAcwLjI0MS4y');
|
|
4118
|
+
const module2 = base64Compile('AGFzbQEAAAABEQNgAX8AYAJ/fwBgBH9/f38AAkgMAAEwAAAAATEAAQABMgACAAEzAAEAATQAAAABNQAAAAE2AAAAATcAAAABOAAAAAE5AAAAAjEwAAAACCRpbXBvcnRzAXABCwsJEQEAQQALCwABAgMEBQYHCAkKAC8JcHJvZHVjZXJzAQxwcm9jZXNzZWQtYnkBDXdpdC1jb21wb25lbnQHMC4yNDEuMg');
|
|
3791
4119
|
({ exports: exports0 } = yield instantiateCore(yield module1));
|
|
3792
4120
|
({ exports: exports1 } = yield instantiateCore(yield module0, {
|
|
3793
4121
|
'[export]milaboratories:pframes/spec': {
|
|
3794
4122
|
'[resource-drop]frame': trampoline3,
|
|
3795
4123
|
'[resource-new]axes': trampoline1,
|
|
3796
4124
|
'[resource-new]frame': trampoline2,
|
|
4125
|
+
'[resource-new]table': trampoline4,
|
|
3797
4126
|
},
|
|
3798
4127
|
'wasi:cli/environment@0.2.0': {
|
|
3799
4128
|
'get-environment': exports0['4'],
|
|
3800
4129
|
},
|
|
3801
4130
|
'wasi:cli/exit@0.2.0': {
|
|
3802
|
-
exit:
|
|
4131
|
+
exit: trampoline11,
|
|
3803
4132
|
},
|
|
3804
4133
|
'wasi:cli/stderr@0.2.0': {
|
|
3805
|
-
'get-stderr':
|
|
4134
|
+
'get-stderr': trampoline16,
|
|
3806
4135
|
},
|
|
3807
4136
|
'wasi:cli/stdin@0.2.0': {
|
|
3808
|
-
'get-stdin':
|
|
4137
|
+
'get-stdin': trampoline14,
|
|
3809
4138
|
},
|
|
3810
4139
|
'wasi:cli/stdout@0.2.0': {
|
|
3811
|
-
'get-stdout':
|
|
4140
|
+
'get-stdout': trampoline15,
|
|
3812
4141
|
},
|
|
3813
4142
|
'wasi:cli/terminal-input@0.2.0': {
|
|
3814
|
-
'[resource-drop]terminal-input':
|
|
4143
|
+
'[resource-drop]terminal-input': trampoline9,
|
|
3815
4144
|
},
|
|
3816
4145
|
'wasi:cli/terminal-output@0.2.0': {
|
|
3817
|
-
'[resource-drop]terminal-output':
|
|
4146
|
+
'[resource-drop]terminal-output': trampoline10,
|
|
3818
4147
|
},
|
|
3819
4148
|
'wasi:cli/terminal-stderr@0.2.0': {
|
|
3820
4149
|
'get-terminal-stderr': exports0['7'],
|
|
@@ -3826,19 +4155,19 @@ const $init = (() => {
|
|
|
3826
4155
|
'get-terminal-stdout': exports0['6'],
|
|
3827
4156
|
},
|
|
3828
4157
|
'wasi:io/error@0.2.0': {
|
|
3829
|
-
'[resource-drop]error':
|
|
4158
|
+
'[resource-drop]error': trampoline5,
|
|
3830
4159
|
},
|
|
3831
4160
|
'wasi:io/poll@0.2.0': {
|
|
3832
|
-
'[method]pollable.block':
|
|
3833
|
-
'[resource-drop]pollable':
|
|
4161
|
+
'[method]pollable.block': trampoline12,
|
|
4162
|
+
'[resource-drop]pollable': trampoline6,
|
|
3834
4163
|
},
|
|
3835
4164
|
'wasi:io/streams@0.2.0': {
|
|
3836
4165
|
'[method]output-stream.blocking-flush': exports0['3'],
|
|
3837
4166
|
'[method]output-stream.check-write': exports0['1'],
|
|
3838
|
-
'[method]output-stream.subscribe':
|
|
4167
|
+
'[method]output-stream.subscribe': trampoline13,
|
|
3839
4168
|
'[method]output-stream.write': exports0['2'],
|
|
3840
|
-
'[resource-drop]input-stream':
|
|
3841
|
-
'[resource-drop]output-stream':
|
|
4169
|
+
'[resource-drop]input-stream': trampoline7,
|
|
4170
|
+
'[resource-drop]output-stream': trampoline8,
|
|
3842
4171
|
},
|
|
3843
4172
|
'wasi:random/insecure-seed@0.2.4': {
|
|
3844
4173
|
'insecure-seed': exports0['0'],
|
|
@@ -3853,14 +4182,15 @@ const $init = (() => {
|
|
|
3853
4182
|
({ exports: exports2 } = yield instantiateCore(yield module2, {
|
|
3854
4183
|
'': {
|
|
3855
4184
|
$imports: exports0.$imports,
|
|
3856
|
-
'0':
|
|
3857
|
-
'1':
|
|
3858
|
-
'
|
|
3859
|
-
'
|
|
3860
|
-
'
|
|
3861
|
-
'
|
|
3862
|
-
'
|
|
3863
|
-
'
|
|
4185
|
+
'0': trampoline17,
|
|
4186
|
+
'1': trampoline18,
|
|
4187
|
+
'10': exports1['milaboratories:pframes/spec#[dtor]table'],
|
|
4188
|
+
'2': trampoline19,
|
|
4189
|
+
'3': trampoline20,
|
|
4190
|
+
'4': trampoline21,
|
|
4191
|
+
'5': trampoline22,
|
|
4192
|
+
'6': trampoline23,
|
|
4193
|
+
'7': trampoline24,
|
|
3864
4194
|
'8': exports1['milaboratories:pframes/spec#[dtor]axes'],
|
|
3865
4195
|
'9': exports1['milaboratories:pframes/spec#[dtor]frame'],
|
|
3866
4196
|
},
|
|
@@ -3872,6 +4202,8 @@ const $init = (() => {
|
|
|
3872
4202
|
specMethodFrameFindColumns = exports1['milaboratories:pframes/spec#[method]frame.find-columns'];
|
|
3873
4203
|
specMethodFrameEvaluateQuery = exports1['milaboratories:pframes/spec#[method]frame.evaluate-query'];
|
|
3874
4204
|
specMethodFrameRewriteLegacyQuery = exports1['milaboratories:pframes/spec#[method]frame.rewrite-legacy-query'];
|
|
4205
|
+
specStaticTableFromJson = exports1['milaboratories:pframes/spec#[static]table.from-json'];
|
|
4206
|
+
specMethodTableFindColumn = exports1['milaboratories:pframes/spec#[method]table.find-column'];
|
|
3875
4207
|
specStaticAxesFromJson = exports1['milaboratories:pframes/spec#[static]axes.from-json'];
|
|
3876
4208
|
specStaticAxesCollapse = exports1['milaboratories:pframes/spec#[static]axes.collapse'];
|
|
3877
4209
|
specMethodAxesExpand = exports1['milaboratories:pframes/spec#[method]axes.expand'];
|
|
@@ -3904,6 +4236,7 @@ await $init;
|
|
|
3904
4236
|
const spec = {
|
|
3905
4237
|
Axes: Axes,
|
|
3906
4238
|
Frame: Frame,
|
|
4239
|
+
Table: Table,
|
|
3907
4240
|
|
|
3908
4241
|
};
|
|
3909
4242
|
|