@arborium/arborium 1.2.3 → 1.2.4
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/arborium_host.js
CHANGED
|
@@ -1,3084 +1,482 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
const utf8Decoder = new TextDecoder();
|
|
13
|
-
|
|
14
|
-
const utf8Encoder = new TextEncoder();
|
|
15
|
-
let utf8EncodedLen = 0;
|
|
16
|
-
function utf8Encode(s, realloc, memory) {
|
|
17
|
-
if (typeof s !== 'string') throw new TypeError('expected a string');
|
|
18
|
-
if (s.length === 0) {
|
|
19
|
-
utf8EncodedLen = 0;
|
|
20
|
-
return 1;
|
|
21
|
-
}
|
|
22
|
-
let buf = utf8Encoder.encode(s);
|
|
23
|
-
let ptr = realloc(0, 0, 1, buf.length);
|
|
24
|
-
new Uint8Array(memory.buffer).set(buf, ptr);
|
|
25
|
-
utf8EncodedLen = buf.length;
|
|
26
|
-
return ptr;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
const T_FLAG = 1 << 30;
|
|
30
|
-
|
|
31
|
-
function rscTableCreateOwn (table, rep) {
|
|
32
|
-
const free = table[0] & ~T_FLAG;
|
|
33
|
-
if (free === 0) {
|
|
34
|
-
table.push(0);
|
|
35
|
-
table.push(rep | T_FLAG);
|
|
36
|
-
return (table.length >> 1) - 1;
|
|
37
|
-
}
|
|
38
|
-
table[0] = table[free << 1];
|
|
39
|
-
table[free << 1] = 0;
|
|
40
|
-
table[(free << 1) + 1] = rep | T_FLAG;
|
|
41
|
-
return free;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
function rscTableRemove (table, handle) {
|
|
45
|
-
const scope = table[handle << 1];
|
|
46
|
-
const val = table[(handle << 1) + 1];
|
|
47
|
-
const own = (val & T_FLAG) !== 0;
|
|
48
|
-
const rep = val & ~T_FLAG;
|
|
49
|
-
if (val === 0 || (scope & T_FLAG) !== 0) throw new TypeError('Invalid handle');
|
|
50
|
-
table[handle << 1] = table[0] | T_FLAG;
|
|
51
|
-
table[0] = handle | T_FLAG;
|
|
52
|
-
return { rep, scope, own };
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
let curResourceBorrows = [];
|
|
56
|
-
|
|
57
|
-
let NEXT_TASK_ID = 0n;
|
|
58
|
-
function startCurrentTask(componentIdx, isAsync, entryFnName) {
|
|
59
|
-
_debugLog('[startCurrentTask()] args', { componentIdx, isAsync });
|
|
60
|
-
if (componentIdx === undefined || componentIdx === null) {
|
|
61
|
-
throw new Error('missing/invalid component instance index while starting task');
|
|
62
|
-
}
|
|
63
|
-
const tasks = ASYNC_TASKS_BY_COMPONENT_IDX.get(componentIdx);
|
|
64
|
-
|
|
65
|
-
const nextId = ++NEXT_TASK_ID;
|
|
66
|
-
const newTask = new AsyncTask({ id: nextId, componentIdx, isAsync, entryFnName });
|
|
67
|
-
const newTaskMeta = { id: nextId, componentIdx, task: newTask };
|
|
68
|
-
|
|
69
|
-
ASYNC_CURRENT_TASK_IDS.push(nextId);
|
|
70
|
-
ASYNC_CURRENT_COMPONENT_IDXS.push(componentIdx);
|
|
71
|
-
|
|
72
|
-
if (!tasks) {
|
|
73
|
-
ASYNC_TASKS_BY_COMPONENT_IDX.set(componentIdx, [newTaskMeta]);
|
|
74
|
-
return nextId;
|
|
75
|
-
} else {
|
|
76
|
-
tasks.push(newTaskMeta);
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
return nextId;
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
function endCurrentTask(componentIdx, taskId) {
|
|
83
|
-
_debugLog('[endCurrentTask()] args', { componentIdx });
|
|
84
|
-
componentIdx ??= ASYNC_CURRENT_COMPONENT_IDXS.at(-1);
|
|
85
|
-
taskId ??= ASYNC_CURRENT_TASK_IDS.at(-1);
|
|
86
|
-
if (componentIdx === undefined || componentIdx === null) {
|
|
87
|
-
throw new Error('missing/invalid component instance index while ending current task');
|
|
88
|
-
}
|
|
89
|
-
const tasks = ASYNC_TASKS_BY_COMPONENT_IDX.get(componentIdx);
|
|
90
|
-
if (!tasks || !Array.isArray(tasks)) {
|
|
91
|
-
throw new Error('missing/invalid tasks for component instance while ending task');
|
|
92
|
-
}
|
|
93
|
-
if (tasks.length == 0) {
|
|
94
|
-
throw new Error('no current task(s) for component instance while ending task');
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
if (taskId) {
|
|
98
|
-
const last = tasks[tasks.length - 1];
|
|
99
|
-
if (last.id !== taskId) {
|
|
100
|
-
throw new Error('current task does not match expected task ID');
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
ASYNC_CURRENT_TASK_IDS.pop();
|
|
105
|
-
ASYNC_CURRENT_COMPONENT_IDXS.pop();
|
|
106
|
-
|
|
107
|
-
return tasks.pop();
|
|
108
|
-
}
|
|
109
|
-
const ASYNC_TASKS_BY_COMPONENT_IDX = new Map();
|
|
110
|
-
const ASYNC_CURRENT_TASK_IDS = [];
|
|
111
|
-
const ASYNC_CURRENT_COMPONENT_IDXS = [];
|
|
112
|
-
|
|
113
|
-
class AsyncTask {
|
|
114
|
-
static State = {
|
|
115
|
-
INITIAL: 'initial',
|
|
116
|
-
CANCELLED: 'cancelled',
|
|
117
|
-
CANCEL_PENDING: 'cancel-pending',
|
|
118
|
-
CANCEL_DELIVERED: 'cancel-delivered',
|
|
119
|
-
RESOLVED: 'resolved',
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
static BlockResult = {
|
|
123
|
-
CANCELLED: 'block.cancelled',
|
|
124
|
-
NOT_CANCELLED: 'block.not-cancelled',
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
#id;
|
|
128
|
-
#componentIdx;
|
|
129
|
-
#state;
|
|
130
|
-
#isAsync;
|
|
131
|
-
#onResolve = null;
|
|
132
|
-
#entryFnName = null;
|
|
133
|
-
#subtasks = [];
|
|
134
|
-
#completionPromise = null;
|
|
135
|
-
|
|
136
|
-
cancelled = false;
|
|
137
|
-
requested = false;
|
|
138
|
-
alwaysTaskReturn = false;
|
|
139
|
-
|
|
140
|
-
returnCalls = 0;
|
|
141
|
-
storage = [0, 0];
|
|
142
|
-
borrowedHandles = {};
|
|
143
|
-
|
|
144
|
-
awaitableResume = null;
|
|
145
|
-
awaitableCancel = null;
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
constructor(opts) {
|
|
149
|
-
if (opts?.id === undefined) { throw new TypeError('missing task ID during task creation'); }
|
|
150
|
-
this.#id = opts.id;
|
|
151
|
-
if (opts?.componentIdx === undefined) {
|
|
152
|
-
throw new TypeError('missing component id during task creation');
|
|
153
|
-
}
|
|
154
|
-
this.#componentIdx = opts.componentIdx;
|
|
155
|
-
this.#state = AsyncTask.State.INITIAL;
|
|
156
|
-
this.#isAsync = opts?.isAsync ?? false;
|
|
157
|
-
this.#entryFnName = opts.entryFnName;
|
|
158
|
-
|
|
159
|
-
const {
|
|
160
|
-
promise: completionPromise,
|
|
161
|
-
resolve: resolveCompletionPromise,
|
|
162
|
-
reject: rejectCompletionPromise,
|
|
163
|
-
} = Promise.withResolvers();
|
|
164
|
-
this.#completionPromise = completionPromise;
|
|
165
|
-
|
|
166
|
-
this.#onResolve = (results) => {
|
|
167
|
-
// TODO: handle external facing cancellation (should likely be a rejection)
|
|
168
|
-
resolveCompletionPromise(results);
|
|
169
|
-
}
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
taskState() { return this.#state.slice(); }
|
|
173
|
-
id() { return this.#id; }
|
|
174
|
-
componentIdx() { return this.#componentIdx; }
|
|
175
|
-
isAsync() { return this.#isAsync; }
|
|
176
|
-
entryFnName() { return this.#entryFnName; }
|
|
177
|
-
completionPromise() { return this.#completionPromise; }
|
|
178
|
-
|
|
179
|
-
mayEnter(task) {
|
|
180
|
-
const cstate = getOrCreateAsyncState(this.#componentIdx);
|
|
181
|
-
if (!cstate.backpressure) {
|
|
182
|
-
_debugLog('[AsyncTask#mayEnter()] disallowed due to backpressure', { taskID: this.#id });
|
|
183
|
-
return false;
|
|
184
|
-
}
|
|
185
|
-
if (!cstate.callingSyncImport()) {
|
|
186
|
-
_debugLog('[AsyncTask#mayEnter()] disallowed due to sync import call', { taskID: this.#id });
|
|
187
|
-
return false;
|
|
188
|
-
}
|
|
189
|
-
const callingSyncExportWithSyncPending = cstate.callingSyncExport && !task.isAsync;
|
|
190
|
-
if (!callingSyncExportWithSyncPending) {
|
|
191
|
-
_debugLog('[AsyncTask#mayEnter()] disallowed due to sync export w/ sync pending', { taskID: this.#id });
|
|
192
|
-
return false;
|
|
193
|
-
}
|
|
194
|
-
return true;
|
|
195
|
-
}
|
|
196
|
-
|
|
197
|
-
async enter() {
|
|
198
|
-
_debugLog('[AsyncTask#enter()] args', { taskID: this.#id });
|
|
199
|
-
|
|
200
|
-
// TODO: assert scheduler locked
|
|
201
|
-
// TODO: trap if on the stack
|
|
202
|
-
|
|
203
|
-
const cstate = getOrCreateAsyncState(this.#componentIdx);
|
|
204
|
-
|
|
205
|
-
let mayNotEnter = !this.mayEnter(this);
|
|
206
|
-
const componentHasPendingTasks = cstate.pendingTasks > 0;
|
|
207
|
-
if (mayNotEnter || componentHasPendingTasks) {
|
|
208
|
-
throw new Error('in enter()'); // TODO: remove
|
|
209
|
-
cstate.pendingTasks.set(this.#id, new Awaitable(new Promise()));
|
|
210
|
-
|
|
211
|
-
const blockResult = await this.onBlock(awaitable);
|
|
212
|
-
if (blockResult) {
|
|
213
|
-
// TODO: find this pending task in the component
|
|
214
|
-
const pendingTask = cstate.pendingTasks.get(this.#id);
|
|
215
|
-
if (!pendingTask) {
|
|
216
|
-
throw new Error('pending task [' + this.#id + '] not found for component instance');
|
|
217
|
-
}
|
|
218
|
-
cstate.pendingTasks.remove(this.#id);
|
|
219
|
-
this.#onResolve(new Error('failed enter'));
|
|
220
|
-
return false;
|
|
221
|
-
}
|
|
222
|
-
|
|
223
|
-
mayNotEnter = !this.mayEnter(this);
|
|
224
|
-
if (!mayNotEnter || !cstate.startPendingTask) {
|
|
225
|
-
throw new Error('invalid component entrance/pending task resolution');
|
|
226
|
-
}
|
|
227
|
-
cstate.startPendingTask = false;
|
|
228
|
-
}
|
|
229
|
-
|
|
230
|
-
if (!this.isAsync) { cstate.callingSyncExport = true; }
|
|
231
|
-
|
|
232
|
-
return true;
|
|
233
|
-
}
|
|
234
|
-
|
|
235
|
-
async waitForEvent(opts) {
|
|
236
|
-
const { waitableSetRep, isAsync } = opts;
|
|
237
|
-
_debugLog('[AsyncTask#waitForEvent()] args', { taskID: this.#id, waitableSetRep, isAsync });
|
|
238
|
-
|
|
239
|
-
if (this.#isAsync !== isAsync) {
|
|
240
|
-
throw new Error('async waitForEvent called on non-async task');
|
|
241
|
-
}
|
|
242
|
-
|
|
243
|
-
if (this.status === AsyncTask.State.CANCEL_PENDING) {
|
|
244
|
-
this.#state = AsyncTask.State.CANCEL_DELIVERED;
|
|
245
|
-
return {
|
|
246
|
-
code: ASYNC_EVENT_CODE.TASK_CANCELLED,
|
|
247
|
-
};
|
|
248
|
-
}
|
|
249
|
-
|
|
250
|
-
const state = getOrCreateAsyncState(this.#componentIdx);
|
|
251
|
-
const waitableSet = state.waitableSets.get(waitableSetRep);
|
|
252
|
-
if (!waitableSet) { throw new Error('missing/invalid waitable set'); }
|
|
253
|
-
|
|
254
|
-
waitableSet.numWaiting += 1;
|
|
255
|
-
let event = null;
|
|
256
|
-
|
|
257
|
-
while (event == null) {
|
|
258
|
-
const awaitable = new Awaitable(waitableSet.getPendingEvent());
|
|
259
|
-
const waited = await this.blockOn({ awaitable, isAsync, isCancellable: true });
|
|
260
|
-
if (waited) {
|
|
261
|
-
if (this.#state !== AsyncTask.State.INITIAL) {
|
|
262
|
-
throw new Error('task should be in initial state found [' + this.#state + ']');
|
|
263
|
-
}
|
|
264
|
-
this.#state = AsyncTask.State.CANCELLED;
|
|
265
|
-
return {
|
|
266
|
-
code: ASYNC_EVENT_CODE.TASK_CANCELLED,
|
|
267
|
-
};
|
|
268
|
-
}
|
|
269
|
-
|
|
270
|
-
event = waitableSet.poll();
|
|
271
|
-
}
|
|
272
|
-
|
|
273
|
-
waitableSet.numWaiting -= 1;
|
|
274
|
-
return event;
|
|
1
|
+
let wasm;
|
|
2
|
+
|
|
3
|
+
function addToExternrefTable0(obj) {
|
|
4
|
+
const idx = wasm.__externref_table_alloc();
|
|
5
|
+
wasm.__wbindgen_externrefs.set(idx, obj);
|
|
6
|
+
return idx;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
function _assertClass(instance, klass) {
|
|
10
|
+
if (!(instance instanceof klass)) {
|
|
11
|
+
throw new Error(`expected instance of ${klass.name}`);
|
|
275
12
|
}
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
const CLOSURE_DTORS = (typeof FinalizationRegistry === 'undefined')
|
|
16
|
+
? { register: () => {}, unregister: () => {} }
|
|
17
|
+
: new FinalizationRegistry(state => state.dtor(state.a, state.b));
|
|
18
|
+
|
|
19
|
+
let cachedDataViewMemory0 = null;
|
|
20
|
+
function getDataViewMemory0() {
|
|
21
|
+
if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
|
|
22
|
+
cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
|
|
279
23
|
}
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
24
|
+
return cachedDataViewMemory0;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
function getStringFromWasm0(ptr, len) {
|
|
28
|
+
ptr = ptr >>> 0;
|
|
29
|
+
return decodeText(ptr, len);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
let cachedUint8ArrayMemory0 = null;
|
|
33
|
+
function getUint8ArrayMemory0() {
|
|
34
|
+
if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
|
|
35
|
+
cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
|
|
290
36
|
}
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
37
|
+
return cachedUint8ArrayMemory0;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
function handleError(f, args) {
|
|
41
|
+
try {
|
|
42
|
+
return f.apply(this, args);
|
|
43
|
+
} catch (e) {
|
|
44
|
+
const idx = addToExternrefTable0(e);
|
|
45
|
+
wasm.__wbindgen_exn_store(idx);
|
|
294
46
|
}
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
const
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
const acquired = new Awaitable(cstate.exclusiveLock());
|
|
317
|
-
cancelled = await this.onBlock(acquired);
|
|
318
|
-
if (cancelled === AsyncTask.BlockResult.CANCELLED) {
|
|
319
|
-
const secondCancel = await this.onBlock(acquired);
|
|
320
|
-
if (secondCancel !== AsyncTask.BlockResult.NOT_CANCELLED) {
|
|
321
|
-
throw new Error('uncancellable callback task was canceled despite second onBlock()');
|
|
322
|
-
}
|
|
323
|
-
}
|
|
324
|
-
}
|
|
325
|
-
|
|
326
|
-
if (cancelled === AsyncTask.BlockResult.CANCELLED) {
|
|
327
|
-
if (this.#state !== AsyncTask.State.INITIAL) {
|
|
328
|
-
throw new Error('cancelled task is not at initial state');
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
function isLikeNone(x) {
|
|
50
|
+
return x === undefined || x === null;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
function makeMutClosure(arg0, arg1, dtor, f) {
|
|
54
|
+
const state = { a: arg0, b: arg1, cnt: 1, dtor };
|
|
55
|
+
const real = (...args) => {
|
|
56
|
+
|
|
57
|
+
// First up with a closure we increment the internal reference
|
|
58
|
+
// count. This ensures that the Rust closure environment won't
|
|
59
|
+
// be deallocated while we're invoking it.
|
|
60
|
+
state.cnt++;
|
|
61
|
+
const a = state.a;
|
|
62
|
+
state.a = 0;
|
|
63
|
+
try {
|
|
64
|
+
return f(a, state.b, ...args);
|
|
65
|
+
} finally {
|
|
66
|
+
state.a = a;
|
|
67
|
+
real._wbg_cb_unref();
|
|
329
68
|
}
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
69
|
+
};
|
|
70
|
+
real._wbg_cb_unref = () => {
|
|
71
|
+
if (--state.cnt === 0) {
|
|
72
|
+
state.dtor(state.a, state.b);
|
|
73
|
+
state.a = 0;
|
|
74
|
+
CLOSURE_DTORS.unregister(state);
|
|
336
75
|
}
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
const { promise, resolve, reject } = Promise.withResolvers();
|
|
350
|
-
this.awaitableResume = () => {
|
|
351
|
-
_debugLog('[AsyncTask] resuming after onBlock', { taskID: this.#id });
|
|
352
|
-
resolve();
|
|
353
|
-
};
|
|
354
|
-
this.awaitableCancel = (err) => {
|
|
355
|
-
_debugLog('[AsyncTask] rejecting after onBlock', { taskID: this.#id, err });
|
|
356
|
-
reject(err);
|
|
357
|
-
};
|
|
358
|
-
|
|
359
|
-
// Park this task/execution to be handled later
|
|
360
|
-
const state = getOrCreateAsyncState(this.#componentIdx);
|
|
361
|
-
state.parkTaskOnAwaitable({ awaitable, task: this });
|
|
362
|
-
|
|
363
|
-
try {
|
|
364
|
-
await promise;
|
|
365
|
-
return AsyncTask.BlockResult.NOT_CANCELLED;
|
|
366
|
-
} catch (err) {
|
|
367
|
-
// rejection means task cancellation
|
|
368
|
-
return AsyncTask.BlockResult.CANCELLED;
|
|
369
|
-
}
|
|
76
|
+
};
|
|
77
|
+
CLOSURE_DTORS.register(real, state, state);
|
|
78
|
+
return real;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
function passStringToWasm0(arg, malloc, realloc) {
|
|
82
|
+
if (realloc === undefined) {
|
|
83
|
+
const buf = cachedTextEncoder.encode(arg);
|
|
84
|
+
const ptr = malloc(buf.length, 1) >>> 0;
|
|
85
|
+
getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
|
|
86
|
+
WASM_VECTOR_LEN = buf.length;
|
|
87
|
+
return ptr;
|
|
370
88
|
}
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
89
|
+
|
|
90
|
+
let len = arg.length;
|
|
91
|
+
let ptr = malloc(len, 1) >>> 0;
|
|
92
|
+
|
|
93
|
+
const mem = getUint8ArrayMemory0();
|
|
94
|
+
|
|
95
|
+
let offset = 0;
|
|
96
|
+
|
|
97
|
+
for (; offset < len; offset++) {
|
|
98
|
+
const code = arg.charCodeAt(offset);
|
|
99
|
+
if (code > 0x7F) break;
|
|
100
|
+
mem[ptr + offset] = code;
|
|
101
|
+
}
|
|
102
|
+
if (offset !== len) {
|
|
103
|
+
if (offset !== 0) {
|
|
104
|
+
arg = arg.slice(offset);
|
|
105
|
+
}
|
|
106
|
+
ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
|
|
107
|
+
const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
|
|
108
|
+
const ret = cachedTextEncoder.encodeInto(arg, view);
|
|
109
|
+
|
|
110
|
+
offset += ret.written;
|
|
111
|
+
ptr = realloc(ptr, len, offset, 1) >>> 0;
|
|
390
112
|
}
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
}
|
|
417
|
-
this.#state = AsyncTask.State.CANCELLED;
|
|
113
|
+
|
|
114
|
+
WASM_VECTOR_LEN = offset;
|
|
115
|
+
return ptr;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
|
119
|
+
cachedTextDecoder.decode();
|
|
120
|
+
const MAX_SAFARI_DECODE_BYTES = 2146435072;
|
|
121
|
+
let numBytesDecoded = 0;
|
|
122
|
+
function decodeText(ptr, len) {
|
|
123
|
+
numBytesDecoded += len;
|
|
124
|
+
if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) {
|
|
125
|
+
cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
|
126
|
+
cachedTextDecoder.decode();
|
|
127
|
+
numBytesDecoded = len;
|
|
128
|
+
}
|
|
129
|
+
return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
const cachedTextEncoder = new TextEncoder();
|
|
133
|
+
|
|
134
|
+
if (!('encodeInto' in cachedTextEncoder)) {
|
|
135
|
+
cachedTextEncoder.encodeInto = function (arg, view) {
|
|
136
|
+
const buf = cachedTextEncoder.encode(arg);
|
|
137
|
+
view.set(buf);
|
|
418
138
|
return {
|
|
419
|
-
|
|
420
|
-
|
|
139
|
+
read: arg.length,
|
|
140
|
+
written: buf.length
|
|
421
141
|
};
|
|
422
|
-
}
|
|
423
|
-
|
|
424
|
-
return {
|
|
425
|
-
code: ASYNC_EVENT_CODE.NONE,
|
|
426
|
-
payload: [0, 0],
|
|
427
|
-
};
|
|
428
|
-
}
|
|
429
|
-
|
|
430
|
-
yieldSync(opts) {
|
|
431
|
-
throw new Error('AsyncTask#yieldSync() not implemented')
|
|
432
|
-
}
|
|
433
|
-
|
|
434
|
-
cancel() {
|
|
435
|
-
_debugLog('[AsyncTask#cancel()] args', { });
|
|
436
|
-
if (!this.taskState() !== AsyncTask.State.CANCEL_DELIVERED) {
|
|
437
|
-
throw new Error('invalid task state for cancellation');
|
|
438
|
-
}
|
|
439
|
-
if (this.borrowedHandles.length > 0) { throw new Error('task still has borrow handles'); }
|
|
440
|
-
|
|
441
|
-
this.#onResolve(new Error('cancelled'));
|
|
442
|
-
this.#state = AsyncTask.State.RESOLVED;
|
|
443
|
-
}
|
|
444
|
-
|
|
445
|
-
resolve(results) {
|
|
446
|
-
_debugLog('[AsyncTask#resolve()] args', { results });
|
|
447
|
-
if (this.#state === AsyncTask.State.RESOLVED) {
|
|
448
|
-
throw new Error('task is already resolved');
|
|
449
|
-
}
|
|
450
|
-
if (this.borrowedHandles.length > 0) { throw new Error('task still has borrow handles'); }
|
|
451
|
-
this.#onResolve(results.length === 1 ? results[0] : results);
|
|
452
|
-
this.#state = AsyncTask.State.RESOLVED;
|
|
453
|
-
}
|
|
454
|
-
|
|
455
|
-
exit() {
|
|
456
|
-
_debugLog('[AsyncTask#exit()] args', { });
|
|
457
|
-
|
|
458
|
-
// TODO: ensure there is only one task at a time (scheduler.lock() functionality)
|
|
459
|
-
if (this.#state !== AsyncTask.State.RESOLVED) {
|
|
460
|
-
throw new Error('task exited without resolution');
|
|
461
|
-
}
|
|
462
|
-
if (this.borrowedHandles > 0) {
|
|
463
|
-
throw new Error('task exited without clearing borrowed handles');
|
|
464
|
-
}
|
|
465
|
-
|
|
466
|
-
const state = getOrCreateAsyncState(this.#componentIdx);
|
|
467
|
-
if (!state) { throw new Error('missing async state for component [' + this.#componentIdx + ']'); }
|
|
468
|
-
if (!this.#isAsync && !state.inSyncExportCall) {
|
|
469
|
-
throw new Error('sync task must be run from components known to be in a sync export call');
|
|
470
|
-
}
|
|
471
|
-
state.inSyncExportCall = false;
|
|
472
|
-
|
|
473
|
-
this.startPendingTask();
|
|
474
|
-
}
|
|
475
|
-
|
|
476
|
-
startPendingTask(args) {
|
|
477
|
-
_debugLog('[AsyncTask#startPendingTask()] args', args);
|
|
478
|
-
throw new Error('AsyncTask#startPendingTask() not implemented');
|
|
479
|
-
}
|
|
480
|
-
|
|
481
|
-
createSubtask(args) {
|
|
482
|
-
_debugLog('[AsyncTask#createSubtask()] args', args);
|
|
483
|
-
const newSubtask = new AsyncSubtask({
|
|
484
|
-
componentIdx: this.componentIdx(),
|
|
485
|
-
taskID: this.id(),
|
|
486
|
-
memoryIdx: args?.memoryIdx,
|
|
487
|
-
});
|
|
488
|
-
this.#subtasks.push(newSubtask);
|
|
489
|
-
return newSubtask;
|
|
490
|
-
}
|
|
491
|
-
|
|
492
|
-
currentSubtask() {
|
|
493
|
-
_debugLog('[AsyncTask#currentSubtask()]');
|
|
494
|
-
if (this.#subtasks.length === 0) { throw new Error('no current subtask'); }
|
|
495
|
-
return this.#subtasks.at(-1);
|
|
496
|
-
}
|
|
497
|
-
|
|
498
|
-
endCurrentSubtask() {
|
|
499
|
-
_debugLog('[AsyncTask#endCurrentSubtask()]');
|
|
500
|
-
if (this.#subtasks.length === 0) { throw new Error('cannot end current subtask: no current subtask'); }
|
|
501
|
-
const subtask = this.#subtasks.pop();
|
|
502
|
-
subtask.drop();
|
|
503
|
-
return subtask;
|
|
504
142
|
}
|
|
505
|
-
}
|
|
506
|
-
|
|
507
|
-
function unpackCallbackResult(result) {
|
|
508
|
-
_debugLog('[unpackCallbackResult()] args', { result });
|
|
509
|
-
if (!(_typeCheckValidI32(result))) { throw new Error('invalid callback return value [' + result + '], not a valid i32'); }
|
|
510
|
-
const eventCode = result & 0xF;
|
|
511
|
-
if (eventCode < 0 || eventCode > 3) {
|
|
512
|
-
throw new Error('invalid async return value [' + eventCode + '], outside callback code range');
|
|
513
|
-
}
|
|
514
|
-
if (result < 0 || result >= 2**32) { throw new Error('invalid callback result'); }
|
|
515
|
-
// TODO: table max length check?
|
|
516
|
-
const waitableSetIdx = result >> 4;
|
|
517
|
-
return [eventCode, waitableSetIdx];
|
|
518
|
-
}
|
|
519
|
-
const ASYNC_STATE = new Map();
|
|
520
|
-
|
|
521
|
-
function getOrCreateAsyncState(componentIdx, init) {
|
|
522
|
-
if (!ASYNC_STATE.has(componentIdx)) {
|
|
523
|
-
ASYNC_STATE.set(componentIdx, new ComponentAsyncState());
|
|
524
|
-
}
|
|
525
|
-
return ASYNC_STATE.get(componentIdx);
|
|
526
|
-
}
|
|
527
|
-
|
|
528
|
-
class ComponentAsyncState {
|
|
529
|
-
#callingAsyncImport = false;
|
|
530
|
-
#syncImportWait = Promise.withResolvers();
|
|
531
|
-
#lock = null;
|
|
532
|
-
|
|
533
|
-
mayLeave = true;
|
|
534
|
-
waitableSets = new RepTable();
|
|
535
|
-
waitables = new RepTable();
|
|
536
|
-
|
|
537
|
-
#parkedTasks = new Map();
|
|
538
|
-
|
|
539
|
-
callingSyncImport(val) {
|
|
540
|
-
if (val === undefined) { return this.#callingAsyncImport; }
|
|
541
|
-
if (typeof val !== 'boolean') { throw new TypeError('invalid setting for async import'); }
|
|
542
|
-
const prev = this.#callingAsyncImport;
|
|
543
|
-
this.#callingAsyncImport = val;
|
|
544
|
-
if (prev === true && this.#callingAsyncImport === false) {
|
|
545
|
-
this.#notifySyncImportEnd();
|
|
546
|
-
}
|
|
547
|
-
}
|
|
548
|
-
|
|
549
|
-
#notifySyncImportEnd() {
|
|
550
|
-
const existing = this.#syncImportWait;
|
|
551
|
-
this.#syncImportWait = Promise.withResolvers();
|
|
552
|
-
existing.resolve();
|
|
553
|
-
}
|
|
554
|
-
|
|
555
|
-
async waitForSyncImportCallEnd() {
|
|
556
|
-
await this.#syncImportWait.promise;
|
|
557
|
-
}
|
|
558
|
-
|
|
559
|
-
parkTaskOnAwaitable(args) {
|
|
560
|
-
if (!args.awaitable) { throw new TypeError('missing awaitable when trying to park'); }
|
|
561
|
-
if (!args.task) { throw new TypeError('missing task when trying to park'); }
|
|
562
|
-
const { awaitable, task } = args;
|
|
563
|
-
|
|
564
|
-
let taskList = this.#parkedTasks.get(awaitable.id());
|
|
565
|
-
if (!taskList) {
|
|
566
|
-
taskList = [];
|
|
567
|
-
this.#parkedTasks.set(awaitable.id(), taskList);
|
|
568
|
-
}
|
|
569
|
-
taskList.push(task);
|
|
570
|
-
|
|
571
|
-
this.wakeNextTaskForAwaitable(awaitable);
|
|
572
|
-
}
|
|
573
|
-
|
|
574
|
-
wakeNextTaskForAwaitable(awaitable) {
|
|
575
|
-
if (!awaitable) { throw new TypeError('missing awaitable when waking next task'); }
|
|
576
|
-
const awaitableID = awaitable.id();
|
|
577
|
-
|
|
578
|
-
const taskList = this.#parkedTasks.get(awaitableID);
|
|
579
|
-
if (!taskList || taskList.length === 0) {
|
|
580
|
-
_debugLog('[ComponentAsyncState] no tasks waiting for awaitable', { awaitableID: awaitable.id() });
|
|
581
|
-
return;
|
|
582
|
-
}
|
|
583
|
-
|
|
584
|
-
let task = taskList.shift(); // todo(perf)
|
|
585
|
-
if (!task) { throw new Error('no task in parked list despite previous check'); }
|
|
586
|
-
|
|
587
|
-
if (!task.awaitableResume) {
|
|
588
|
-
throw new Error('task ready due to awaitable is missing resume', { taskID: task.id(), awaitableID });
|
|
589
|
-
}
|
|
590
|
-
task.awaitableResume();
|
|
591
|
-
}
|
|
592
|
-
|
|
593
|
-
async exclusiveLock() { // TODO: use atomics
|
|
594
|
-
if (this.#lock === null) {
|
|
595
|
-
this.#lock = { ticket: 0n };
|
|
596
|
-
}
|
|
597
|
-
|
|
598
|
-
// Take a ticket for the next valid usage
|
|
599
|
-
const ticket = ++this.#lock.ticket;
|
|
600
|
-
|
|
601
|
-
_debugLog('[ComponentAsyncState#exclusiveLock()] locking', {
|
|
602
|
-
currentTicket: ticket - 1n,
|
|
603
|
-
ticket
|
|
604
|
-
});
|
|
605
|
-
|
|
606
|
-
// If there is an active promise, then wait for it
|
|
607
|
-
let finishedTicket;
|
|
608
|
-
while (this.#lock.promise) {
|
|
609
|
-
finishedTicket = await this.#lock.promise;
|
|
610
|
-
if (finishedTicket === ticket - 1n) { break; }
|
|
611
|
-
}
|
|
612
|
-
|
|
613
|
-
const { promise, resolve } = Promise.withResolvers();
|
|
614
|
-
this.#lock = {
|
|
615
|
-
ticket,
|
|
616
|
-
promise,
|
|
617
|
-
resolve,
|
|
618
|
-
};
|
|
619
|
-
|
|
620
|
-
return this.#lock.promise;
|
|
621
|
-
}
|
|
622
|
-
|
|
623
|
-
exclusiveRelease() {
|
|
624
|
-
_debugLog('[ComponentAsyncState#exclusiveRelease()] releasing', {
|
|
625
|
-
currentTicket: this.#lock === null ? 'none' : this.#lock.ticket,
|
|
626
|
-
});
|
|
627
|
-
|
|
628
|
-
if (this.#lock === null) { return; }
|
|
629
|
-
|
|
630
|
-
const existingLock = this.#lock;
|
|
631
|
-
this.#lock = null;
|
|
632
|
-
existingLock.resolve(existingLock.ticket);
|
|
633
|
-
}
|
|
634
|
-
|
|
635
|
-
isExclusivelyLocked() { return this.#lock !== null; }
|
|
636
|
-
|
|
637
143
|
}
|
|
638
144
|
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
if (!taskMeta) { throw new Error('invalid/missing current async task meta during prepare call'); }
|
|
644
|
-
|
|
645
|
-
const task = taskMeta.task;
|
|
646
|
-
if (!task) { throw new Error('unexpectedly missing task in task meta during prepare call'); }
|
|
647
|
-
|
|
648
|
-
const state = getOrCreateAsyncState(task.componentIdx());
|
|
649
|
-
if (!state) {
|
|
650
|
-
throw new Error('invalid/missing async state for component instance [' + componentInstanceID + ']');
|
|
651
|
-
}
|
|
652
|
-
|
|
653
|
-
const subtask = task.createSubtask({
|
|
654
|
-
memoryIdx,
|
|
655
|
-
});
|
|
656
|
-
|
|
145
|
+
let WASM_VECTOR_LEN = 0;
|
|
146
|
+
|
|
147
|
+
function wasm_bindgen__convert__closures_____invoke__hdf270ce0da308ff1(arg0, arg1, arg2) {
|
|
148
|
+
wasm.wasm_bindgen__convert__closures_____invoke__hdf270ce0da308ff1(arg0, arg1, arg2);
|
|
657
149
|
}
|
|
658
150
|
|
|
659
|
-
function
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
const taskMeta = getCurrentTask(ASYNC_CURRENT_COMPONENT_IDXS.at(-1), ASYNC_CURRENT_TASK_IDS.at(-1));
|
|
663
|
-
if (!taskMeta) { throw new Error('invalid/missing current async task meta during prepare call'); }
|
|
664
|
-
|
|
665
|
-
const task = taskMeta.task;
|
|
666
|
-
if (!task) { throw new Error('unexpectedly missing task in task meta during prepare call'); }
|
|
667
|
-
|
|
668
|
-
const subtask = task.currentSubtask();
|
|
669
|
-
if (!subtask) { throw new Error('invalid/missing subtask during async start call'); }
|
|
670
|
-
|
|
671
|
-
return Number(subtask.waitableRep()) << 4 | subtask.getStateNumber();
|
|
151
|
+
function wasm_bindgen__convert__closures_____invoke__h089a09d160a6520b(arg0, arg1, arg2, arg3) {
|
|
152
|
+
wasm.wasm_bindgen__convert__closures_____invoke__h089a09d160a6520b(arg0, arg1, arg2, arg3);
|
|
672
153
|
}
|
|
673
154
|
|
|
674
|
-
|
|
675
|
-
|
|
155
|
+
const HighlightConfigFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
156
|
+
? { register: () => {}, unregister: () => {} }
|
|
157
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_highlightconfig_free(ptr >>> 0, 1));
|
|
158
|
+
|
|
159
|
+
/**
|
|
160
|
+
* Configuration for highlighting.
|
|
161
|
+
*/
|
|
162
|
+
export class HighlightConfig {
|
|
163
|
+
__destroy_into_raw() {
|
|
164
|
+
const ptr = this.__wbg_ptr;
|
|
165
|
+
this.__wbg_ptr = 0;
|
|
166
|
+
HighlightConfigFinalization.unregister(this);
|
|
167
|
+
return ptr;
|
|
168
|
+
}
|
|
169
|
+
free() {
|
|
170
|
+
const ptr = this.__destroy_into_raw();
|
|
171
|
+
wasm.__wbg_highlightconfig_free(ptr, 0);
|
|
172
|
+
}
|
|
173
|
+
/**
|
|
174
|
+
* @param {number} depth
|
|
175
|
+
*/
|
|
176
|
+
setMaxInjectionDepth(depth) {
|
|
177
|
+
wasm.highlightconfig_setMaxInjectionDepth(this.__wbg_ptr, depth);
|
|
178
|
+
}
|
|
179
|
+
constructor() {
|
|
180
|
+
const ret = wasm.highlightconfig_new();
|
|
181
|
+
this.__wbg_ptr = ret >>> 0;
|
|
182
|
+
HighlightConfigFinalization.register(this, this.__wbg_ptr, this);
|
|
183
|
+
return this;
|
|
184
|
+
}
|
|
676
185
|
}
|
|
186
|
+
if (Symbol.dispose) HighlightConfig.prototype[Symbol.dispose] = HighlightConfig.prototype.free;
|
|
677
187
|
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
188
|
+
/**
|
|
189
|
+
* Highlight source code, resolving injections recursively.
|
|
190
|
+
*
|
|
191
|
+
* This uses the shared `AsyncHighlighter` from `arborium_highlight`,
|
|
192
|
+
* ensuring the same injection handling logic as Rust native.
|
|
193
|
+
* @param {string} language
|
|
194
|
+
* @param {string} source
|
|
195
|
+
* @returns {Promise<string>}
|
|
196
|
+
*/
|
|
197
|
+
export function highlight(language, source) {
|
|
198
|
+
const ptr0 = passStringToWasm0(language, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
199
|
+
const len0 = WASM_VECTOR_LEN;
|
|
200
|
+
const ptr1 = passStringToWasm0(source, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
201
|
+
const len1 = WASM_VECTOR_LEN;
|
|
202
|
+
const ret = wasm.highlight(ptr0, len0, ptr1, len1);
|
|
203
|
+
return ret;
|
|
688
204
|
}
|
|
689
205
|
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
206
|
+
/**
|
|
207
|
+
* Highlight with custom configuration.
|
|
208
|
+
* @param {string} language
|
|
209
|
+
* @param {string} source
|
|
210
|
+
* @param {HighlightConfig} config
|
|
211
|
+
* @returns {Promise<string>}
|
|
212
|
+
*/
|
|
213
|
+
export function highlightWithConfig(language, source, config) {
|
|
214
|
+
const ptr0 = passStringToWasm0(language, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
215
|
+
const len0 = WASM_VECTOR_LEN;
|
|
216
|
+
const ptr1 = passStringToWasm0(source, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
217
|
+
const len1 = WASM_VECTOR_LEN;
|
|
218
|
+
_assertClass(config, HighlightConfig);
|
|
219
|
+
var ptr2 = config.__destroy_into_raw();
|
|
220
|
+
const ret = wasm.highlightWithConfig(ptr0, len0, ptr1, len1, ptr2);
|
|
221
|
+
return ret;
|
|
693
222
|
}
|
|
694
|
-
const ASYNC_DETERMINISM = 'random';
|
|
695
|
-
const _coinFlip = () => { return Math.random() > 0.5; };
|
|
696
|
-
const I32_MAX = 2_147_483_647;
|
|
697
|
-
const I32_MIN = -2_147_483_648;
|
|
698
|
-
const _typeCheckValidI32 = (n) => typeof n === 'number' && n >= I32_MIN && n <= I32_MAX;
|
|
699
223
|
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
224
|
+
/**
|
|
225
|
+
* Check if a language is available for highlighting.
|
|
226
|
+
* @param {string} language
|
|
227
|
+
* @returns {boolean}
|
|
228
|
+
*/
|
|
229
|
+
export function isLanguageAvailable(language) {
|
|
230
|
+
const ptr0 = passStringToWasm0(language, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
231
|
+
const len0 = WASM_VECTOR_LEN;
|
|
232
|
+
const ret = wasm.isLanguageAvailable(ptr0, len0);
|
|
233
|
+
return ret !== 0;
|
|
708
234
|
}
|
|
709
235
|
|
|
710
|
-
const
|
|
236
|
+
const EXPECTED_RESPONSE_TYPES = new Set(['basic', 'cors', 'default']);
|
|
711
237
|
|
|
712
|
-
|
|
238
|
+
async function __wbg_load(module, imports) {
|
|
239
|
+
if (typeof Response === 'function' && module instanceof Response) {
|
|
240
|
+
if (typeof WebAssembly.instantiateStreaming === 'function') {
|
|
241
|
+
try {
|
|
242
|
+
return await WebAssembly.instantiateStreaming(module, imports);
|
|
243
|
+
} catch (e) {
|
|
244
|
+
const validResponse = module.ok && EXPECTED_RESPONSE_TYPES.has(module.type);
|
|
713
245
|
|
|
714
|
-
|
|
246
|
+
if (validResponse && module.headers.get('Content-Type') !== 'application/wasm') {
|
|
247
|
+
console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve Wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n", e);
|
|
715
248
|
|
|
716
|
-
|
|
249
|
+
} else {
|
|
250
|
+
throw e;
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
}
|
|
717
254
|
|
|
718
|
-
const
|
|
255
|
+
const bytes = await module.arrayBuffer();
|
|
256
|
+
return await WebAssembly.instantiate(bytes, imports);
|
|
257
|
+
} else {
|
|
258
|
+
const instance = await WebAssembly.instantiate(module, imports);
|
|
719
259
|
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
260
|
+
if (instance instanceof WebAssembly.Instance) {
|
|
261
|
+
return { instance, module };
|
|
262
|
+
} else {
|
|
263
|
+
return instance;
|
|
264
|
+
}
|
|
265
|
+
}
|
|
724
266
|
}
|
|
725
267
|
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
268
|
+
function __wbg_get_imports() {
|
|
269
|
+
const imports = {};
|
|
270
|
+
imports.wbg = {};
|
|
271
|
+
imports.wbg.__wbg___wbindgen_boolean_get_dea25b33882b895b = function(arg0) {
|
|
272
|
+
const v = arg0;
|
|
273
|
+
const ret = typeof(v) === 'boolean' ? v : undefined;
|
|
274
|
+
return isLikeNone(ret) ? 0xFFFFFF : ret ? 1 : 0;
|
|
275
|
+
};
|
|
276
|
+
imports.wbg.__wbg___wbindgen_is_function_8d400b8b1af978cd = function(arg0) {
|
|
277
|
+
const ret = typeof(arg0) === 'function';
|
|
278
|
+
return ret;
|
|
279
|
+
};
|
|
280
|
+
imports.wbg.__wbg___wbindgen_is_null_dfda7d66506c95b5 = function(arg0) {
|
|
281
|
+
const ret = arg0 === null;
|
|
282
|
+
return ret;
|
|
283
|
+
};
|
|
284
|
+
imports.wbg.__wbg___wbindgen_is_undefined_f6b95eab589e0269 = function(arg0) {
|
|
285
|
+
const ret = arg0 === undefined;
|
|
286
|
+
return ret;
|
|
287
|
+
};
|
|
288
|
+
imports.wbg.__wbg___wbindgen_number_get_9619185a74197f95 = function(arg0, arg1) {
|
|
289
|
+
const obj = arg1;
|
|
290
|
+
const ret = typeof(obj) === 'number' ? obj : undefined;
|
|
291
|
+
getDataViewMemory0().setFloat64(arg0 + 8 * 1, isLikeNone(ret) ? 0 : ret, true);
|
|
292
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
|
|
293
|
+
};
|
|
294
|
+
imports.wbg.__wbg___wbindgen_string_get_a2a31e16edf96e42 = function(arg0, arg1) {
|
|
295
|
+
const obj = arg1;
|
|
296
|
+
const ret = typeof(obj) === 'string' ? obj : undefined;
|
|
297
|
+
var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
298
|
+
var len1 = WASM_VECTOR_LEN;
|
|
299
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
300
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
301
|
+
};
|
|
302
|
+
imports.wbg.__wbg___wbindgen_throw_dd24417ed36fc46e = function(arg0, arg1) {
|
|
303
|
+
throw new Error(getStringFromWasm0(arg0, arg1));
|
|
304
|
+
};
|
|
305
|
+
imports.wbg.__wbg__wbg_cb_unref_87dfb5aaa0cbcea7 = function(arg0) {
|
|
306
|
+
arg0._wbg_cb_unref();
|
|
307
|
+
};
|
|
308
|
+
imports.wbg.__wbg_call_3020136f7a2d6e44 = function() { return handleError(function (arg0, arg1, arg2) {
|
|
309
|
+
const ret = arg0.call(arg1, arg2);
|
|
310
|
+
return ret;
|
|
311
|
+
}, arguments) };
|
|
312
|
+
imports.wbg.__wbg_call_abb4ff46ce38be40 = function() { return handleError(function (arg0, arg1) {
|
|
313
|
+
const ret = arg0.call(arg1);
|
|
314
|
+
return ret;
|
|
315
|
+
}, arguments) };
|
|
316
|
+
imports.wbg.__wbg_from_29a8414a7a7cd19d = function(arg0) {
|
|
317
|
+
const ret = Array.from(arg0);
|
|
318
|
+
return ret;
|
|
319
|
+
};
|
|
320
|
+
imports.wbg.__wbg_get_6b7bd52aca3f9671 = function(arg0, arg1) {
|
|
321
|
+
const ret = arg0[arg1 >>> 0];
|
|
322
|
+
return ret;
|
|
323
|
+
};
|
|
324
|
+
imports.wbg.__wbg_get_af9dab7e9603ea93 = function() { return handleError(function (arg0, arg1) {
|
|
325
|
+
const ret = Reflect.get(arg0, arg1);
|
|
326
|
+
return ret;
|
|
327
|
+
}, arguments) };
|
|
328
|
+
imports.wbg.__wbg_isLanguageAvailable_34dd470608352293 = function(arg0, arg1) {
|
|
329
|
+
const ret = arboriumHost.isLanguageAvailable(getStringFromWasm0(arg0, arg1));
|
|
330
|
+
return ret;
|
|
331
|
+
};
|
|
332
|
+
imports.wbg.__wbg_length_d45040a40c570362 = function(arg0) {
|
|
333
|
+
const ret = arg0.length;
|
|
334
|
+
return ret;
|
|
335
|
+
};
|
|
336
|
+
imports.wbg.__wbg_loadGrammar_3b1f0071cede0f25 = function() { return handleError(function (arg0, arg1) {
|
|
337
|
+
const ret = arboriumHost.loadGrammar(getStringFromWasm0(arg0, arg1));
|
|
338
|
+
return ret;
|
|
339
|
+
}, arguments) };
|
|
340
|
+
imports.wbg.__wbg_new_ff12d2b041fb48f1 = function(arg0, arg1) {
|
|
341
|
+
try {
|
|
342
|
+
var state0 = {a: arg0, b: arg1};
|
|
343
|
+
var cb0 = (arg0, arg1) => {
|
|
344
|
+
const a = state0.a;
|
|
345
|
+
state0.a = 0;
|
|
346
|
+
try {
|
|
347
|
+
return wasm_bindgen__convert__closures_____invoke__h089a09d160a6520b(a, state0.b, arg0, arg1);
|
|
348
|
+
} finally {
|
|
349
|
+
state0.a = a;
|
|
350
|
+
}
|
|
351
|
+
};
|
|
352
|
+
const ret = new Promise(cb0);
|
|
353
|
+
return ret;
|
|
354
|
+
} finally {
|
|
355
|
+
state0.a = state0.b = 0;
|
|
356
|
+
}
|
|
357
|
+
};
|
|
358
|
+
imports.wbg.__wbg_new_no_args_cb138f77cf6151ee = function(arg0, arg1) {
|
|
359
|
+
const ret = new Function(getStringFromWasm0(arg0, arg1));
|
|
360
|
+
return ret;
|
|
361
|
+
};
|
|
362
|
+
imports.wbg.__wbg_parse_4dfd6e8a8b8e03d3 = function(arg0, arg1, arg2) {
|
|
363
|
+
const ret = arboriumHost.parse(arg0 >>> 0, getStringFromWasm0(arg1, arg2));
|
|
364
|
+
return ret;
|
|
365
|
+
};
|
|
366
|
+
imports.wbg.__wbg_queueMicrotask_9b549dfce8865860 = function(arg0) {
|
|
367
|
+
const ret = arg0.queueMicrotask;
|
|
368
|
+
return ret;
|
|
369
|
+
};
|
|
370
|
+
imports.wbg.__wbg_queueMicrotask_fca69f5bfad613a5 = function(arg0) {
|
|
371
|
+
queueMicrotask(arg0);
|
|
372
|
+
};
|
|
373
|
+
imports.wbg.__wbg_resolve_fd5bfbaa4ce36e1e = function(arg0) {
|
|
374
|
+
const ret = Promise.resolve(arg0);
|
|
375
|
+
return ret;
|
|
376
|
+
};
|
|
377
|
+
imports.wbg.__wbg_static_accessor_GLOBAL_769e6b65d6557335 = function() {
|
|
378
|
+
const ret = typeof global === 'undefined' ? null : global;
|
|
379
|
+
return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
|
|
380
|
+
};
|
|
381
|
+
imports.wbg.__wbg_static_accessor_GLOBAL_THIS_60cf02db4de8e1c1 = function() {
|
|
382
|
+
const ret = typeof globalThis === 'undefined' ? null : globalThis;
|
|
383
|
+
return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
|
|
384
|
+
};
|
|
385
|
+
imports.wbg.__wbg_static_accessor_SELF_08f5a74c69739274 = function() {
|
|
386
|
+
const ret = typeof self === 'undefined' ? null : self;
|
|
387
|
+
return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
|
|
388
|
+
};
|
|
389
|
+
imports.wbg.__wbg_static_accessor_WINDOW_a8924b26aa92d024 = function() {
|
|
390
|
+
const ret = typeof window === 'undefined' ? null : window;
|
|
391
|
+
return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
|
|
392
|
+
};
|
|
393
|
+
imports.wbg.__wbg_then_429f7caf1026411d = function(arg0, arg1, arg2) {
|
|
394
|
+
const ret = arg0.then(arg1, arg2);
|
|
395
|
+
return ret;
|
|
396
|
+
};
|
|
397
|
+
imports.wbg.__wbg_then_4f95312d68691235 = function(arg0, arg1) {
|
|
398
|
+
const ret = arg0.then(arg1);
|
|
399
|
+
return ret;
|
|
400
|
+
};
|
|
401
|
+
imports.wbg.__wbindgen_cast_2241b6af4c4b2941 = function(arg0, arg1) {
|
|
402
|
+
// Cast intrinsic for `Ref(String) -> Externref`.
|
|
403
|
+
const ret = getStringFromWasm0(arg0, arg1);
|
|
404
|
+
return ret;
|
|
405
|
+
};
|
|
406
|
+
imports.wbg.__wbindgen_cast_3b1a32895b770b74 = function(arg0, arg1) {
|
|
407
|
+
// Cast intrinsic for `Closure(Closure { dtor_idx: 10, function: Function { arguments: [Externref], shim_idx: 11, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
|
|
408
|
+
const ret = makeMutClosure(arg0, arg1, wasm.wasm_bindgen__closure__destroy__hd7b7e163837b9c9e, wasm_bindgen__convert__closures_____invoke__hdf270ce0da308ff1);
|
|
409
|
+
return ret;
|
|
410
|
+
};
|
|
411
|
+
imports.wbg.__wbindgen_init_externref_table = function() {
|
|
412
|
+
const table = wasm.__wbindgen_externrefs;
|
|
413
|
+
const offset = table.grow(4);
|
|
414
|
+
table.set(0, undefined);
|
|
415
|
+
table.set(offset + 0, undefined);
|
|
416
|
+
table.set(offset + 1, null);
|
|
417
|
+
table.set(offset + 2, true);
|
|
418
|
+
table.set(offset + 3, false);
|
|
419
|
+
};
|
|
420
|
+
|
|
421
|
+
return imports;
|
|
775
422
|
}
|
|
776
423
|
|
|
777
|
-
|
|
424
|
+
function __wbg_finalize_init(instance, module) {
|
|
425
|
+
wasm = instance.exports;
|
|
426
|
+
__wbg_init.__wbindgen_wasm_module = module;
|
|
427
|
+
cachedDataViewMemory0 = null;
|
|
428
|
+
cachedUint8ArrayMemory0 = null;
|
|
778
429
|
|
|
779
430
|
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
const module2 = getCoreModule('arborium_host.core3.wasm');
|
|
784
|
-
const module3 = getCoreModule('arborium_host.core4.wasm');
|
|
431
|
+
wasm.__wbindgen_start();
|
|
432
|
+
return wasm;
|
|
433
|
+
}
|
|
785
434
|
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
const { Descriptor, filesystemErrorCode } = imports['wasi:filesystem/types'];
|
|
794
|
-
const { Error: Error$1 } = imports['wasi:io/error'];
|
|
795
|
-
const { InputStream, OutputStream } = imports['wasi:io/streams'];
|
|
796
|
-
let gen = (function* _initGenerator () {
|
|
797
|
-
let exports0;
|
|
798
|
-
|
|
799
|
-
function trampoline0(arg0, arg1) {
|
|
800
|
-
_debugLog('[iface="arborium:host/plugin-provider@0.1.0", function="plugin-cancel"] [Instruction::CallInterface] (async? sync, @ enter)');
|
|
801
|
-
const _interface_call_currentTaskID = startCurrentTask(0, false, 'plugin-cancel');
|
|
802
|
-
pluginCancel(arg0 >>> 0, arg1 >>> 0);
|
|
803
|
-
_debugLog('[iface="arborium:host/plugin-provider@0.1.0", function="plugin-cancel"] [Instruction::CallInterface] (sync, @ post-call)');
|
|
804
|
-
endCurrentTask(0);
|
|
805
|
-
_debugLog('[iface="arborium:host/plugin-provider@0.1.0", function="plugin-cancel"][Instruction::Return]', {
|
|
806
|
-
funcName: 'plugin-cancel',
|
|
807
|
-
paramCount: 0,
|
|
808
|
-
async: false,
|
|
809
|
-
postReturn: false
|
|
810
|
-
});
|
|
811
|
-
}
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
function trampoline1(arg0, arg1) {
|
|
815
|
-
_debugLog('[iface="arborium:host/plugin-provider@0.1.0", function="free-plugin-session"] [Instruction::CallInterface] (async? sync, @ enter)');
|
|
816
|
-
const _interface_call_currentTaskID = startCurrentTask(0, false, 'free-plugin-session');
|
|
817
|
-
freePluginSession(arg0 >>> 0, arg1 >>> 0);
|
|
818
|
-
_debugLog('[iface="arborium:host/plugin-provider@0.1.0", function="free-plugin-session"] [Instruction::CallInterface] (sync, @ post-call)');
|
|
819
|
-
endCurrentTask(0);
|
|
820
|
-
_debugLog('[iface="arborium:host/plugin-provider@0.1.0", function="free-plugin-session"][Instruction::Return]', {
|
|
821
|
-
funcName: 'free-plugin-session',
|
|
822
|
-
paramCount: 0,
|
|
823
|
-
async: false,
|
|
824
|
-
postReturn: false
|
|
825
|
-
});
|
|
826
|
-
}
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
function trampoline2(arg0) {
|
|
830
|
-
_debugLog('[iface="arborium:host/plugin-provider@0.1.0", function="create-plugin-session"] [Instruction::CallInterface] (async? sync, @ enter)');
|
|
831
|
-
const _interface_call_currentTaskID = startCurrentTask(0, false, 'create-plugin-session');
|
|
832
|
-
const ret = createPluginSession(arg0 >>> 0);
|
|
833
|
-
_debugLog('[iface="arborium:host/plugin-provider@0.1.0", function="create-plugin-session"] [Instruction::CallInterface] (sync, @ post-call)');
|
|
834
|
-
endCurrentTask(0);
|
|
835
|
-
_debugLog('[iface="arborium:host/plugin-provider@0.1.0", function="create-plugin-session"][Instruction::Return]', {
|
|
836
|
-
funcName: 'create-plugin-session',
|
|
837
|
-
paramCount: 1,
|
|
838
|
-
async: false,
|
|
839
|
-
postReturn: false
|
|
840
|
-
});
|
|
841
|
-
return toUint32(ret);
|
|
842
|
-
}
|
|
843
|
-
|
|
844
|
-
let exports1;
|
|
845
|
-
const handleTable1 = [T_FLAG, 0];
|
|
846
|
-
const captureTable1= new Map();
|
|
847
|
-
let captureCnt1 = 0;
|
|
848
|
-
handleTables[1] = handleTable1;
|
|
849
|
-
|
|
850
|
-
function trampoline7() {
|
|
851
|
-
_debugLog('[iface="wasi:cli/stderr@0.2.3", function="get-stderr"] [Instruction::CallInterface] (async? sync, @ enter)');
|
|
852
|
-
const _interface_call_currentTaskID = startCurrentTask(0, false, 'get-stderr');
|
|
853
|
-
const ret = getStderr();
|
|
854
|
-
_debugLog('[iface="wasi:cli/stderr@0.2.3", function="get-stderr"] [Instruction::CallInterface] (sync, @ post-call)');
|
|
855
|
-
endCurrentTask(0);
|
|
856
|
-
if (!(ret instanceof OutputStream)) {
|
|
857
|
-
throw new TypeError('Resource error: Not a valid "OutputStream" resource.');
|
|
858
|
-
}
|
|
859
|
-
var handle0 = ret[symbolRscHandle];
|
|
860
|
-
if (!handle0) {
|
|
861
|
-
const rep = ret[symbolRscRep] || ++captureCnt1;
|
|
862
|
-
captureTable1.set(rep, ret);
|
|
863
|
-
handle0 = rscTableCreateOwn(handleTable1, rep);
|
|
864
|
-
}
|
|
865
|
-
_debugLog('[iface="wasi:cli/stderr@0.2.3", function="get-stderr"][Instruction::Return]', {
|
|
866
|
-
funcName: 'get-stderr',
|
|
867
|
-
paramCount: 1,
|
|
868
|
-
async: false,
|
|
869
|
-
postReturn: false
|
|
870
|
-
});
|
|
871
|
-
return handle0;
|
|
872
|
-
}
|
|
873
|
-
|
|
874
|
-
const handleTable2 = [T_FLAG, 0];
|
|
875
|
-
const captureTable2= new Map();
|
|
876
|
-
let captureCnt2 = 0;
|
|
877
|
-
handleTables[2] = handleTable2;
|
|
878
|
-
|
|
879
|
-
function trampoline8() {
|
|
880
|
-
_debugLog('[iface="wasi:cli/stdin@0.2.3", function="get-stdin"] [Instruction::CallInterface] (async? sync, @ enter)');
|
|
881
|
-
const _interface_call_currentTaskID = startCurrentTask(0, false, 'get-stdin');
|
|
882
|
-
const ret = getStdin();
|
|
883
|
-
_debugLog('[iface="wasi:cli/stdin@0.2.3", function="get-stdin"] [Instruction::CallInterface] (sync, @ post-call)');
|
|
884
|
-
endCurrentTask(0);
|
|
885
|
-
if (!(ret instanceof InputStream)) {
|
|
886
|
-
throw new TypeError('Resource error: Not a valid "InputStream" resource.');
|
|
887
|
-
}
|
|
888
|
-
var handle0 = ret[symbolRscHandle];
|
|
889
|
-
if (!handle0) {
|
|
890
|
-
const rep = ret[symbolRscRep] || ++captureCnt2;
|
|
891
|
-
captureTable2.set(rep, ret);
|
|
892
|
-
handle0 = rscTableCreateOwn(handleTable2, rep);
|
|
893
|
-
}
|
|
894
|
-
_debugLog('[iface="wasi:cli/stdin@0.2.3", function="get-stdin"][Instruction::Return]', {
|
|
895
|
-
funcName: 'get-stdin',
|
|
896
|
-
paramCount: 1,
|
|
897
|
-
async: false,
|
|
898
|
-
postReturn: false
|
|
899
|
-
});
|
|
900
|
-
return handle0;
|
|
901
|
-
}
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
function trampoline9() {
|
|
905
|
-
_debugLog('[iface="wasi:cli/stdout@0.2.3", function="get-stdout"] [Instruction::CallInterface] (async? sync, @ enter)');
|
|
906
|
-
const _interface_call_currentTaskID = startCurrentTask(0, false, 'get-stdout');
|
|
907
|
-
const ret = getStdout();
|
|
908
|
-
_debugLog('[iface="wasi:cli/stdout@0.2.3", function="get-stdout"] [Instruction::CallInterface] (sync, @ post-call)');
|
|
909
|
-
endCurrentTask(0);
|
|
910
|
-
if (!(ret instanceof OutputStream)) {
|
|
911
|
-
throw new TypeError('Resource error: Not a valid "OutputStream" resource.');
|
|
912
|
-
}
|
|
913
|
-
var handle0 = ret[symbolRscHandle];
|
|
914
|
-
if (!handle0) {
|
|
915
|
-
const rep = ret[symbolRscRep] || ++captureCnt1;
|
|
916
|
-
captureTable1.set(rep, ret);
|
|
917
|
-
handle0 = rscTableCreateOwn(handleTable1, rep);
|
|
918
|
-
}
|
|
919
|
-
_debugLog('[iface="wasi:cli/stdout@0.2.3", function="get-stdout"][Instruction::Return]', {
|
|
920
|
-
funcName: 'get-stdout',
|
|
921
|
-
paramCount: 1,
|
|
922
|
-
async: false,
|
|
923
|
-
postReturn: false
|
|
924
|
-
});
|
|
925
|
-
return handle0;
|
|
926
|
-
}
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
function trampoline10(arg0) {
|
|
930
|
-
let variant0;
|
|
931
|
-
switch (arg0) {
|
|
932
|
-
case 0: {
|
|
933
|
-
variant0= {
|
|
934
|
-
tag: 'ok',
|
|
935
|
-
val: undefined
|
|
936
|
-
};
|
|
937
|
-
break;
|
|
938
|
-
}
|
|
939
|
-
case 1: {
|
|
940
|
-
variant0= {
|
|
941
|
-
tag: 'err',
|
|
942
|
-
val: undefined
|
|
943
|
-
};
|
|
944
|
-
break;
|
|
945
|
-
}
|
|
946
|
-
default: {
|
|
947
|
-
throw new TypeError('invalid variant discriminant for expected');
|
|
948
|
-
}
|
|
949
|
-
}
|
|
950
|
-
_debugLog('[iface="wasi:cli/exit@0.2.3", function="exit"] [Instruction::CallInterface] (async? sync, @ enter)');
|
|
951
|
-
const _interface_call_currentTaskID = startCurrentTask(0, false, 'exit');
|
|
952
|
-
exit(variant0);
|
|
953
|
-
_debugLog('[iface="wasi:cli/exit@0.2.3", function="exit"] [Instruction::CallInterface] (sync, @ post-call)');
|
|
954
|
-
endCurrentTask(0);
|
|
955
|
-
_debugLog('[iface="wasi:cli/exit@0.2.3", function="exit"][Instruction::Return]', {
|
|
956
|
-
funcName: 'exit',
|
|
957
|
-
paramCount: 0,
|
|
958
|
-
async: false,
|
|
959
|
-
postReturn: false
|
|
960
|
-
});
|
|
961
|
-
}
|
|
962
|
-
|
|
963
|
-
let exports2;
|
|
964
|
-
let memory0;
|
|
965
|
-
let realloc0;
|
|
966
|
-
let realloc1;
|
|
967
|
-
|
|
968
|
-
function trampoline11(arg0, arg1, arg2) {
|
|
969
|
-
var ptr0 = arg0;
|
|
970
|
-
var len0 = arg1;
|
|
971
|
-
var result0 = utf8Decoder.decode(new Uint8Array(memory0.buffer, ptr0, len0));
|
|
972
|
-
_debugLog('[iface="arborium:host/plugin-provider@0.1.0", function="load-plugin"] [Instruction::CallInterface] (async? sync, @ enter)');
|
|
973
|
-
const _interface_call_currentTaskID = startCurrentTask(0, false, 'load-plugin');
|
|
974
|
-
const ret = loadPlugin(result0);
|
|
975
|
-
_debugLog('[iface="arborium:host/plugin-provider@0.1.0", function="load-plugin"] [Instruction::CallInterface] (sync, @ post-call)');
|
|
976
|
-
endCurrentTask(0);
|
|
977
|
-
var variant1 = ret;
|
|
978
|
-
if (variant1 === null || variant1=== undefined) {
|
|
979
|
-
dataView(memory0).setInt8(arg2 + 0, 0, true);
|
|
980
|
-
} else {
|
|
981
|
-
const e = variant1;
|
|
982
|
-
dataView(memory0).setInt8(arg2 + 0, 1, true);
|
|
983
|
-
dataView(memory0).setInt32(arg2 + 4, toUint32(e), true);
|
|
984
|
-
}
|
|
985
|
-
_debugLog('[iface="arborium:host/plugin-provider@0.1.0", function="load-plugin"][Instruction::Return]', {
|
|
986
|
-
funcName: 'load-plugin',
|
|
987
|
-
paramCount: 0,
|
|
988
|
-
async: false,
|
|
989
|
-
postReturn: false
|
|
990
|
-
});
|
|
991
|
-
}
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
function trampoline12(arg0, arg1, arg2) {
|
|
995
|
-
_debugLog('[iface="arborium:host/plugin-provider@0.1.0", function="plugin-parse"] [Instruction::CallInterface] (async? sync, @ enter)');
|
|
996
|
-
const _interface_call_currentTaskID = startCurrentTask(0, false, 'plugin-parse');
|
|
997
|
-
let ret;
|
|
998
|
-
try {
|
|
999
|
-
ret = { tag: 'ok', val: pluginParse(arg0 >>> 0, arg1 >>> 0)};
|
|
1000
|
-
} catch (e) {
|
|
1001
|
-
ret = { tag: 'err', val: getErrorPayload(e) };
|
|
1002
|
-
}
|
|
1003
|
-
_debugLog('[iface="arborium:host/plugin-provider@0.1.0", function="plugin-parse"] [Instruction::CallInterface] (sync, @ post-call)');
|
|
1004
|
-
endCurrentTask(0);
|
|
1005
|
-
var variant9 = ret;
|
|
1006
|
-
switch (variant9.tag) {
|
|
1007
|
-
case 'ok': {
|
|
1008
|
-
const e = variant9.val;
|
|
1009
|
-
dataView(memory0).setInt8(arg2 + 0, 0, true);
|
|
1010
|
-
var {spans: v0_0, injections: v0_1 } = e;
|
|
1011
|
-
var vec3 = v0_0;
|
|
1012
|
-
var len3 = vec3.length;
|
|
1013
|
-
var result3 = realloc0(0, 0, 4, len3 * 16);
|
|
1014
|
-
for (let i = 0; i < vec3.length; i++) {
|
|
1015
|
-
const e = vec3[i];
|
|
1016
|
-
const base = result3 + i * 16;var {start: v1_0, end: v1_1, capture: v1_2 } = e;
|
|
1017
|
-
dataView(memory0).setInt32(base + 0, toUint32(v1_0), true);
|
|
1018
|
-
dataView(memory0).setInt32(base + 4, toUint32(v1_1), true);
|
|
1019
|
-
var ptr2 = utf8Encode(v1_2, realloc0, memory0);
|
|
1020
|
-
var len2 = utf8EncodedLen;
|
|
1021
|
-
dataView(memory0).setUint32(base + 12, len2, true);
|
|
1022
|
-
dataView(memory0).setUint32(base + 8, ptr2, true);
|
|
1023
|
-
}
|
|
1024
|
-
dataView(memory0).setUint32(arg2 + 8, len3, true);
|
|
1025
|
-
dataView(memory0).setUint32(arg2 + 4, result3, true);
|
|
1026
|
-
var vec6 = v0_1;
|
|
1027
|
-
var len6 = vec6.length;
|
|
1028
|
-
var result6 = realloc0(0, 0, 4, len6 * 20);
|
|
1029
|
-
for (let i = 0; i < vec6.length; i++) {
|
|
1030
|
-
const e = vec6[i];
|
|
1031
|
-
const base = result6 + i * 20;var {start: v4_0, end: v4_1, language: v4_2, includeChildren: v4_3 } = e;
|
|
1032
|
-
dataView(memory0).setInt32(base + 0, toUint32(v4_0), true);
|
|
1033
|
-
dataView(memory0).setInt32(base + 4, toUint32(v4_1), true);
|
|
1034
|
-
var ptr5 = utf8Encode(v4_2, realloc0, memory0);
|
|
1035
|
-
var len5 = utf8EncodedLen;
|
|
1036
|
-
dataView(memory0).setUint32(base + 12, len5, true);
|
|
1037
|
-
dataView(memory0).setUint32(base + 8, ptr5, true);
|
|
1038
|
-
dataView(memory0).setInt8(base + 16, v4_3 ? 1 : 0, true);
|
|
1039
|
-
}
|
|
1040
|
-
dataView(memory0).setUint32(arg2 + 16, len6, true);
|
|
1041
|
-
dataView(memory0).setUint32(arg2 + 12, result6, true);
|
|
1042
|
-
break;
|
|
1043
|
-
}
|
|
1044
|
-
case 'err': {
|
|
1045
|
-
const e = variant9.val;
|
|
1046
|
-
dataView(memory0).setInt8(arg2 + 0, 1, true);
|
|
1047
|
-
var {message: v7_0 } = e;
|
|
1048
|
-
var ptr8 = utf8Encode(v7_0, realloc0, memory0);
|
|
1049
|
-
var len8 = utf8EncodedLen;
|
|
1050
|
-
dataView(memory0).setUint32(arg2 + 8, len8, true);
|
|
1051
|
-
dataView(memory0).setUint32(arg2 + 4, ptr8, true);
|
|
1052
|
-
break;
|
|
1053
|
-
}
|
|
1054
|
-
default: {
|
|
1055
|
-
throw new TypeError('invalid variant specified for result');
|
|
1056
|
-
}
|
|
1057
|
-
}
|
|
1058
|
-
_debugLog('[iface="arborium:host/plugin-provider@0.1.0", function="plugin-parse"][Instruction::Return]', {
|
|
1059
|
-
funcName: 'plugin-parse',
|
|
1060
|
-
paramCount: 0,
|
|
1061
|
-
async: false,
|
|
1062
|
-
postReturn: false
|
|
1063
|
-
});
|
|
1064
|
-
}
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
function trampoline13(arg0, arg1, arg2, arg3) {
|
|
1068
|
-
var ptr0 = arg2;
|
|
1069
|
-
var len0 = arg3;
|
|
1070
|
-
var result0 = utf8Decoder.decode(new Uint8Array(memory0.buffer, ptr0, len0));
|
|
1071
|
-
_debugLog('[iface="arborium:host/plugin-provider@0.1.0", function="plugin-set-text"] [Instruction::CallInterface] (async? sync, @ enter)');
|
|
1072
|
-
const _interface_call_currentTaskID = startCurrentTask(0, false, 'plugin-set-text');
|
|
1073
|
-
pluginSetText(arg0 >>> 0, arg1 >>> 0, result0);
|
|
1074
|
-
_debugLog('[iface="arborium:host/plugin-provider@0.1.0", function="plugin-set-text"] [Instruction::CallInterface] (sync, @ post-call)');
|
|
1075
|
-
endCurrentTask(0);
|
|
1076
|
-
_debugLog('[iface="arborium:host/plugin-provider@0.1.0", function="plugin-set-text"][Instruction::Return]', {
|
|
1077
|
-
funcName: 'plugin-set-text',
|
|
1078
|
-
paramCount: 0,
|
|
1079
|
-
async: false,
|
|
1080
|
-
postReturn: false
|
|
1081
|
-
});
|
|
1082
|
-
}
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
function trampoline14(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12) {
|
|
1086
|
-
var ptr0 = arg2;
|
|
1087
|
-
var len0 = arg3;
|
|
1088
|
-
var result0 = utf8Decoder.decode(new Uint8Array(memory0.buffer, ptr0, len0));
|
|
1089
|
-
_debugLog('[iface="arborium:host/plugin-provider@0.1.0", function="plugin-apply-edit"] [Instruction::CallInterface] (async? sync, @ enter)');
|
|
1090
|
-
const _interface_call_currentTaskID = startCurrentTask(0, false, 'plugin-apply-edit');
|
|
1091
|
-
pluginApplyEdit(arg0 >>> 0, arg1 >>> 0, result0, {
|
|
1092
|
-
startByte: arg4 >>> 0,
|
|
1093
|
-
oldEndByte: arg5 >>> 0,
|
|
1094
|
-
newEndByte: arg6 >>> 0,
|
|
1095
|
-
startRow: arg7 >>> 0,
|
|
1096
|
-
startCol: arg8 >>> 0,
|
|
1097
|
-
oldEndRow: arg9 >>> 0,
|
|
1098
|
-
oldEndCol: arg10 >>> 0,
|
|
1099
|
-
newEndRow: arg11 >>> 0,
|
|
1100
|
-
newEndCol: arg12 >>> 0,
|
|
1101
|
-
});
|
|
1102
|
-
_debugLog('[iface="arborium:host/plugin-provider@0.1.0", function="plugin-apply-edit"] [Instruction::CallInterface] (sync, @ post-call)');
|
|
1103
|
-
endCurrentTask(0);
|
|
1104
|
-
_debugLog('[iface="arborium:host/plugin-provider@0.1.0", function="plugin-apply-edit"][Instruction::Return]', {
|
|
1105
|
-
funcName: 'plugin-apply-edit',
|
|
1106
|
-
paramCount: 0,
|
|
1107
|
-
async: false,
|
|
1108
|
-
postReturn: false
|
|
1109
|
-
});
|
|
1110
|
-
}
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
function trampoline15(arg0, arg1) {
|
|
1114
|
-
_debugLog('[iface="arborium:host/plugin-provider@0.1.0", function="get-injection-languages"] [Instruction::CallInterface] (async? sync, @ enter)');
|
|
1115
|
-
const _interface_call_currentTaskID = startCurrentTask(0, false, 'get-injection-languages');
|
|
1116
|
-
const ret = getInjectionLanguages(arg0 >>> 0);
|
|
1117
|
-
_debugLog('[iface="arborium:host/plugin-provider@0.1.0", function="get-injection-languages"] [Instruction::CallInterface] (sync, @ post-call)');
|
|
1118
|
-
endCurrentTask(0);
|
|
1119
|
-
var vec1 = ret;
|
|
1120
|
-
var len1 = vec1.length;
|
|
1121
|
-
var result1 = realloc0(0, 0, 4, len1 * 8);
|
|
1122
|
-
for (let i = 0; i < vec1.length; i++) {
|
|
1123
|
-
const e = vec1[i];
|
|
1124
|
-
const base = result1 + i * 8;var ptr0 = utf8Encode(e, realloc0, memory0);
|
|
1125
|
-
var len0 = utf8EncodedLen;
|
|
1126
|
-
dataView(memory0).setUint32(base + 4, len0, true);
|
|
1127
|
-
dataView(memory0).setUint32(base + 0, ptr0, true);
|
|
1128
|
-
}
|
|
1129
|
-
dataView(memory0).setUint32(arg1 + 4, len1, true);
|
|
1130
|
-
dataView(memory0).setUint32(arg1 + 0, result1, true);
|
|
1131
|
-
_debugLog('[iface="arborium:host/plugin-provider@0.1.0", function="get-injection-languages"][Instruction::Return]', {
|
|
1132
|
-
funcName: 'get-injection-languages',
|
|
1133
|
-
paramCount: 0,
|
|
1134
|
-
async: false,
|
|
1135
|
-
postReturn: false
|
|
1136
|
-
});
|
|
1137
|
-
}
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
function trampoline16(arg0) {
|
|
1141
|
-
_debugLog('[iface="wasi:cli/environment@0.2.3", function="get-environment"] [Instruction::CallInterface] (async? sync, @ enter)');
|
|
1142
|
-
const _interface_call_currentTaskID = startCurrentTask(0, false, 'get-environment');
|
|
1143
|
-
const ret = getEnvironment();
|
|
1144
|
-
_debugLog('[iface="wasi:cli/environment@0.2.3", function="get-environment"] [Instruction::CallInterface] (sync, @ post-call)');
|
|
1145
|
-
endCurrentTask(0);
|
|
1146
|
-
var vec3 = ret;
|
|
1147
|
-
var len3 = vec3.length;
|
|
1148
|
-
var result3 = realloc1(0, 0, 4, len3 * 16);
|
|
1149
|
-
for (let i = 0; i < vec3.length; i++) {
|
|
1150
|
-
const e = vec3[i];
|
|
1151
|
-
const base = result3 + i * 16;var [tuple0_0, tuple0_1] = e;
|
|
1152
|
-
var ptr1 = utf8Encode(tuple0_0, realloc1, memory0);
|
|
1153
|
-
var len1 = utf8EncodedLen;
|
|
1154
|
-
dataView(memory0).setUint32(base + 4, len1, true);
|
|
1155
|
-
dataView(memory0).setUint32(base + 0, ptr1, true);
|
|
1156
|
-
var ptr2 = utf8Encode(tuple0_1, realloc1, memory0);
|
|
1157
|
-
var len2 = utf8EncodedLen;
|
|
1158
|
-
dataView(memory0).setUint32(base + 12, len2, true);
|
|
1159
|
-
dataView(memory0).setUint32(base + 8, ptr2, true);
|
|
1160
|
-
}
|
|
1161
|
-
dataView(memory0).setUint32(arg0 + 4, len3, true);
|
|
1162
|
-
dataView(memory0).setUint32(arg0 + 0, result3, true);
|
|
1163
|
-
_debugLog('[iface="wasi:cli/environment@0.2.3", function="get-environment"][Instruction::Return]', {
|
|
1164
|
-
funcName: 'get-environment',
|
|
1165
|
-
paramCount: 0,
|
|
1166
|
-
async: false,
|
|
1167
|
-
postReturn: false
|
|
1168
|
-
});
|
|
1169
|
-
}
|
|
1170
|
-
|
|
1171
|
-
const handleTable0 = [T_FLAG, 0];
|
|
1172
|
-
const captureTable0= new Map();
|
|
1173
|
-
let captureCnt0 = 0;
|
|
1174
|
-
handleTables[0] = handleTable0;
|
|
1175
|
-
|
|
1176
|
-
function trampoline17(arg0, arg1) {
|
|
1177
|
-
var handle1 = arg0;
|
|
1178
|
-
var rep2 = handleTable0[(handle1 << 1) + 1] & ~T_FLAG;
|
|
1179
|
-
var rsc0 = captureTable0.get(rep2);
|
|
1180
|
-
if (!rsc0) {
|
|
1181
|
-
rsc0 = Object.create(Error$1.prototype);
|
|
1182
|
-
Object.defineProperty(rsc0, symbolRscHandle, { writable: true, value: handle1});
|
|
1183
|
-
Object.defineProperty(rsc0, symbolRscRep, { writable: true, value: rep2});
|
|
1184
|
-
}
|
|
1185
|
-
curResourceBorrows.push(rsc0);
|
|
1186
|
-
_debugLog('[iface="wasi:filesystem/types@0.2.3", function="filesystem-error-code"] [Instruction::CallInterface] (async? sync, @ enter)');
|
|
1187
|
-
const _interface_call_currentTaskID = startCurrentTask(0, false, 'filesystem-error-code');
|
|
1188
|
-
const ret = filesystemErrorCode(rsc0);
|
|
1189
|
-
_debugLog('[iface="wasi:filesystem/types@0.2.3", function="filesystem-error-code"] [Instruction::CallInterface] (sync, @ post-call)');
|
|
1190
|
-
for (const rsc of curResourceBorrows) {
|
|
1191
|
-
rsc[symbolRscHandle] = undefined;
|
|
1192
|
-
}
|
|
1193
|
-
curResourceBorrows = [];
|
|
1194
|
-
endCurrentTask(0);
|
|
1195
|
-
var variant4 = ret;
|
|
1196
|
-
if (variant4 === null || variant4=== undefined) {
|
|
1197
|
-
dataView(memory0).setInt8(arg1 + 0, 0, true);
|
|
1198
|
-
} else {
|
|
1199
|
-
const e = variant4;
|
|
1200
|
-
dataView(memory0).setInt8(arg1 + 0, 1, true);
|
|
1201
|
-
var val3 = e;
|
|
1202
|
-
let enum3;
|
|
1203
|
-
switch (val3) {
|
|
1204
|
-
case 'access': {
|
|
1205
|
-
enum3 = 0;
|
|
1206
|
-
break;
|
|
1207
|
-
}
|
|
1208
|
-
case 'would-block': {
|
|
1209
|
-
enum3 = 1;
|
|
1210
|
-
break;
|
|
1211
|
-
}
|
|
1212
|
-
case 'already': {
|
|
1213
|
-
enum3 = 2;
|
|
1214
|
-
break;
|
|
1215
|
-
}
|
|
1216
|
-
case 'bad-descriptor': {
|
|
1217
|
-
enum3 = 3;
|
|
1218
|
-
break;
|
|
1219
|
-
}
|
|
1220
|
-
case 'busy': {
|
|
1221
|
-
enum3 = 4;
|
|
1222
|
-
break;
|
|
1223
|
-
}
|
|
1224
|
-
case 'deadlock': {
|
|
1225
|
-
enum3 = 5;
|
|
1226
|
-
break;
|
|
1227
|
-
}
|
|
1228
|
-
case 'quota': {
|
|
1229
|
-
enum3 = 6;
|
|
1230
|
-
break;
|
|
1231
|
-
}
|
|
1232
|
-
case 'exist': {
|
|
1233
|
-
enum3 = 7;
|
|
1234
|
-
break;
|
|
1235
|
-
}
|
|
1236
|
-
case 'file-too-large': {
|
|
1237
|
-
enum3 = 8;
|
|
1238
|
-
break;
|
|
1239
|
-
}
|
|
1240
|
-
case 'illegal-byte-sequence': {
|
|
1241
|
-
enum3 = 9;
|
|
1242
|
-
break;
|
|
1243
|
-
}
|
|
1244
|
-
case 'in-progress': {
|
|
1245
|
-
enum3 = 10;
|
|
1246
|
-
break;
|
|
1247
|
-
}
|
|
1248
|
-
case 'interrupted': {
|
|
1249
|
-
enum3 = 11;
|
|
1250
|
-
break;
|
|
1251
|
-
}
|
|
1252
|
-
case 'invalid': {
|
|
1253
|
-
enum3 = 12;
|
|
1254
|
-
break;
|
|
1255
|
-
}
|
|
1256
|
-
case 'io': {
|
|
1257
|
-
enum3 = 13;
|
|
1258
|
-
break;
|
|
1259
|
-
}
|
|
1260
|
-
case 'is-directory': {
|
|
1261
|
-
enum3 = 14;
|
|
1262
|
-
break;
|
|
1263
|
-
}
|
|
1264
|
-
case 'loop': {
|
|
1265
|
-
enum3 = 15;
|
|
1266
|
-
break;
|
|
1267
|
-
}
|
|
1268
|
-
case 'too-many-links': {
|
|
1269
|
-
enum3 = 16;
|
|
1270
|
-
break;
|
|
1271
|
-
}
|
|
1272
|
-
case 'message-size': {
|
|
1273
|
-
enum3 = 17;
|
|
1274
|
-
break;
|
|
1275
|
-
}
|
|
1276
|
-
case 'name-too-long': {
|
|
1277
|
-
enum3 = 18;
|
|
1278
|
-
break;
|
|
1279
|
-
}
|
|
1280
|
-
case 'no-device': {
|
|
1281
|
-
enum3 = 19;
|
|
1282
|
-
break;
|
|
1283
|
-
}
|
|
1284
|
-
case 'no-entry': {
|
|
1285
|
-
enum3 = 20;
|
|
1286
|
-
break;
|
|
1287
|
-
}
|
|
1288
|
-
case 'no-lock': {
|
|
1289
|
-
enum3 = 21;
|
|
1290
|
-
break;
|
|
1291
|
-
}
|
|
1292
|
-
case 'insufficient-memory': {
|
|
1293
|
-
enum3 = 22;
|
|
1294
|
-
break;
|
|
1295
|
-
}
|
|
1296
|
-
case 'insufficient-space': {
|
|
1297
|
-
enum3 = 23;
|
|
1298
|
-
break;
|
|
1299
|
-
}
|
|
1300
|
-
case 'not-directory': {
|
|
1301
|
-
enum3 = 24;
|
|
1302
|
-
break;
|
|
1303
|
-
}
|
|
1304
|
-
case 'not-empty': {
|
|
1305
|
-
enum3 = 25;
|
|
1306
|
-
break;
|
|
1307
|
-
}
|
|
1308
|
-
case 'not-recoverable': {
|
|
1309
|
-
enum3 = 26;
|
|
1310
|
-
break;
|
|
1311
|
-
}
|
|
1312
|
-
case 'unsupported': {
|
|
1313
|
-
enum3 = 27;
|
|
1314
|
-
break;
|
|
1315
|
-
}
|
|
1316
|
-
case 'no-tty': {
|
|
1317
|
-
enum3 = 28;
|
|
1318
|
-
break;
|
|
1319
|
-
}
|
|
1320
|
-
case 'no-such-device': {
|
|
1321
|
-
enum3 = 29;
|
|
1322
|
-
break;
|
|
1323
|
-
}
|
|
1324
|
-
case 'overflow': {
|
|
1325
|
-
enum3 = 30;
|
|
1326
|
-
break;
|
|
1327
|
-
}
|
|
1328
|
-
case 'not-permitted': {
|
|
1329
|
-
enum3 = 31;
|
|
1330
|
-
break;
|
|
1331
|
-
}
|
|
1332
|
-
case 'pipe': {
|
|
1333
|
-
enum3 = 32;
|
|
1334
|
-
break;
|
|
1335
|
-
}
|
|
1336
|
-
case 'read-only': {
|
|
1337
|
-
enum3 = 33;
|
|
1338
|
-
break;
|
|
1339
|
-
}
|
|
1340
|
-
case 'invalid-seek': {
|
|
1341
|
-
enum3 = 34;
|
|
1342
|
-
break;
|
|
1343
|
-
}
|
|
1344
|
-
case 'text-file-busy': {
|
|
1345
|
-
enum3 = 35;
|
|
1346
|
-
break;
|
|
1347
|
-
}
|
|
1348
|
-
case 'cross-device': {
|
|
1349
|
-
enum3 = 36;
|
|
1350
|
-
break;
|
|
1351
|
-
}
|
|
1352
|
-
default: {
|
|
1353
|
-
if ((e) instanceof Error) {
|
|
1354
|
-
console.error(e);
|
|
1355
|
-
}
|
|
1356
|
-
|
|
1357
|
-
throw new TypeError(`"${val3}" is not one of the cases of error-code`);
|
|
1358
|
-
}
|
|
1359
|
-
}
|
|
1360
|
-
dataView(memory0).setInt8(arg1 + 1, enum3, true);
|
|
1361
|
-
}
|
|
1362
|
-
_debugLog('[iface="wasi:filesystem/types@0.2.3", function="filesystem-error-code"][Instruction::Return]', {
|
|
1363
|
-
funcName: 'filesystem-error-code',
|
|
1364
|
-
paramCount: 0,
|
|
1365
|
-
async: false,
|
|
1366
|
-
postReturn: false
|
|
1367
|
-
});
|
|
1368
|
-
}
|
|
1369
|
-
|
|
1370
|
-
const handleTable3 = [T_FLAG, 0];
|
|
1371
|
-
const captureTable3= new Map();
|
|
1372
|
-
let captureCnt3 = 0;
|
|
1373
|
-
handleTables[3] = handleTable3;
|
|
1374
|
-
|
|
1375
|
-
function trampoline18(arg0, arg1, arg2) {
|
|
1376
|
-
var handle1 = arg0;
|
|
1377
|
-
var rep2 = handleTable3[(handle1 << 1) + 1] & ~T_FLAG;
|
|
1378
|
-
var rsc0 = captureTable3.get(rep2);
|
|
1379
|
-
if (!rsc0) {
|
|
1380
|
-
rsc0 = Object.create(Descriptor.prototype);
|
|
1381
|
-
Object.defineProperty(rsc0, symbolRscHandle, { writable: true, value: handle1});
|
|
1382
|
-
Object.defineProperty(rsc0, symbolRscRep, { writable: true, value: rep2});
|
|
1383
|
-
}
|
|
1384
|
-
curResourceBorrows.push(rsc0);
|
|
1385
|
-
_debugLog('[iface="wasi:filesystem/types@0.2.3", function="[method]descriptor.write-via-stream"] [Instruction::CallInterface] (async? sync, @ enter)');
|
|
1386
|
-
const _interface_call_currentTaskID = startCurrentTask(0, false, '[method]descriptor.write-via-stream');
|
|
1387
|
-
let ret;
|
|
1388
|
-
try {
|
|
1389
|
-
ret = { tag: 'ok', val: rsc0.writeViaStream(BigInt.asUintN(64, arg1))};
|
|
1390
|
-
} catch (e) {
|
|
1391
|
-
ret = { tag: 'err', val: getErrorPayload(e) };
|
|
1392
|
-
}
|
|
1393
|
-
_debugLog('[iface="wasi:filesystem/types@0.2.3", function="[method]descriptor.write-via-stream"] [Instruction::CallInterface] (sync, @ post-call)');
|
|
1394
|
-
for (const rsc of curResourceBorrows) {
|
|
1395
|
-
rsc[symbolRscHandle] = undefined;
|
|
1396
|
-
}
|
|
1397
|
-
curResourceBorrows = [];
|
|
1398
|
-
endCurrentTask(0);
|
|
1399
|
-
var variant5 = ret;
|
|
1400
|
-
switch (variant5.tag) {
|
|
1401
|
-
case 'ok': {
|
|
1402
|
-
const e = variant5.val;
|
|
1403
|
-
dataView(memory0).setInt8(arg2 + 0, 0, true);
|
|
1404
|
-
if (!(e instanceof OutputStream)) {
|
|
1405
|
-
throw new TypeError('Resource error: Not a valid "OutputStream" resource.');
|
|
1406
|
-
}
|
|
1407
|
-
var handle3 = e[symbolRscHandle];
|
|
1408
|
-
if (!handle3) {
|
|
1409
|
-
const rep = e[symbolRscRep] || ++captureCnt1;
|
|
1410
|
-
captureTable1.set(rep, e);
|
|
1411
|
-
handle3 = rscTableCreateOwn(handleTable1, rep);
|
|
1412
|
-
}
|
|
1413
|
-
dataView(memory0).setInt32(arg2 + 4, handle3, true);
|
|
1414
|
-
break;
|
|
1415
|
-
}
|
|
1416
|
-
case 'err': {
|
|
1417
|
-
const e = variant5.val;
|
|
1418
|
-
dataView(memory0).setInt8(arg2 + 0, 1, true);
|
|
1419
|
-
var val4 = e;
|
|
1420
|
-
let enum4;
|
|
1421
|
-
switch (val4) {
|
|
1422
|
-
case 'access': {
|
|
1423
|
-
enum4 = 0;
|
|
1424
|
-
break;
|
|
1425
|
-
}
|
|
1426
|
-
case 'would-block': {
|
|
1427
|
-
enum4 = 1;
|
|
1428
|
-
break;
|
|
1429
|
-
}
|
|
1430
|
-
case 'already': {
|
|
1431
|
-
enum4 = 2;
|
|
1432
|
-
break;
|
|
1433
|
-
}
|
|
1434
|
-
case 'bad-descriptor': {
|
|
1435
|
-
enum4 = 3;
|
|
1436
|
-
break;
|
|
1437
|
-
}
|
|
1438
|
-
case 'busy': {
|
|
1439
|
-
enum4 = 4;
|
|
1440
|
-
break;
|
|
1441
|
-
}
|
|
1442
|
-
case 'deadlock': {
|
|
1443
|
-
enum4 = 5;
|
|
1444
|
-
break;
|
|
1445
|
-
}
|
|
1446
|
-
case 'quota': {
|
|
1447
|
-
enum4 = 6;
|
|
1448
|
-
break;
|
|
1449
|
-
}
|
|
1450
|
-
case 'exist': {
|
|
1451
|
-
enum4 = 7;
|
|
1452
|
-
break;
|
|
1453
|
-
}
|
|
1454
|
-
case 'file-too-large': {
|
|
1455
|
-
enum4 = 8;
|
|
1456
|
-
break;
|
|
1457
|
-
}
|
|
1458
|
-
case 'illegal-byte-sequence': {
|
|
1459
|
-
enum4 = 9;
|
|
1460
|
-
break;
|
|
1461
|
-
}
|
|
1462
|
-
case 'in-progress': {
|
|
1463
|
-
enum4 = 10;
|
|
1464
|
-
break;
|
|
1465
|
-
}
|
|
1466
|
-
case 'interrupted': {
|
|
1467
|
-
enum4 = 11;
|
|
1468
|
-
break;
|
|
1469
|
-
}
|
|
1470
|
-
case 'invalid': {
|
|
1471
|
-
enum4 = 12;
|
|
1472
|
-
break;
|
|
1473
|
-
}
|
|
1474
|
-
case 'io': {
|
|
1475
|
-
enum4 = 13;
|
|
1476
|
-
break;
|
|
1477
|
-
}
|
|
1478
|
-
case 'is-directory': {
|
|
1479
|
-
enum4 = 14;
|
|
1480
|
-
break;
|
|
1481
|
-
}
|
|
1482
|
-
case 'loop': {
|
|
1483
|
-
enum4 = 15;
|
|
1484
|
-
break;
|
|
1485
|
-
}
|
|
1486
|
-
case 'too-many-links': {
|
|
1487
|
-
enum4 = 16;
|
|
1488
|
-
break;
|
|
1489
|
-
}
|
|
1490
|
-
case 'message-size': {
|
|
1491
|
-
enum4 = 17;
|
|
1492
|
-
break;
|
|
1493
|
-
}
|
|
1494
|
-
case 'name-too-long': {
|
|
1495
|
-
enum4 = 18;
|
|
1496
|
-
break;
|
|
1497
|
-
}
|
|
1498
|
-
case 'no-device': {
|
|
1499
|
-
enum4 = 19;
|
|
1500
|
-
break;
|
|
1501
|
-
}
|
|
1502
|
-
case 'no-entry': {
|
|
1503
|
-
enum4 = 20;
|
|
1504
|
-
break;
|
|
1505
|
-
}
|
|
1506
|
-
case 'no-lock': {
|
|
1507
|
-
enum4 = 21;
|
|
1508
|
-
break;
|
|
1509
|
-
}
|
|
1510
|
-
case 'insufficient-memory': {
|
|
1511
|
-
enum4 = 22;
|
|
1512
|
-
break;
|
|
1513
|
-
}
|
|
1514
|
-
case 'insufficient-space': {
|
|
1515
|
-
enum4 = 23;
|
|
1516
|
-
break;
|
|
1517
|
-
}
|
|
1518
|
-
case 'not-directory': {
|
|
1519
|
-
enum4 = 24;
|
|
1520
|
-
break;
|
|
1521
|
-
}
|
|
1522
|
-
case 'not-empty': {
|
|
1523
|
-
enum4 = 25;
|
|
1524
|
-
break;
|
|
1525
|
-
}
|
|
1526
|
-
case 'not-recoverable': {
|
|
1527
|
-
enum4 = 26;
|
|
1528
|
-
break;
|
|
1529
|
-
}
|
|
1530
|
-
case 'unsupported': {
|
|
1531
|
-
enum4 = 27;
|
|
1532
|
-
break;
|
|
1533
|
-
}
|
|
1534
|
-
case 'no-tty': {
|
|
1535
|
-
enum4 = 28;
|
|
1536
|
-
break;
|
|
1537
|
-
}
|
|
1538
|
-
case 'no-such-device': {
|
|
1539
|
-
enum4 = 29;
|
|
1540
|
-
break;
|
|
1541
|
-
}
|
|
1542
|
-
case 'overflow': {
|
|
1543
|
-
enum4 = 30;
|
|
1544
|
-
break;
|
|
1545
|
-
}
|
|
1546
|
-
case 'not-permitted': {
|
|
1547
|
-
enum4 = 31;
|
|
1548
|
-
break;
|
|
1549
|
-
}
|
|
1550
|
-
case 'pipe': {
|
|
1551
|
-
enum4 = 32;
|
|
1552
|
-
break;
|
|
1553
|
-
}
|
|
1554
|
-
case 'read-only': {
|
|
1555
|
-
enum4 = 33;
|
|
1556
|
-
break;
|
|
1557
|
-
}
|
|
1558
|
-
case 'invalid-seek': {
|
|
1559
|
-
enum4 = 34;
|
|
1560
|
-
break;
|
|
1561
|
-
}
|
|
1562
|
-
case 'text-file-busy': {
|
|
1563
|
-
enum4 = 35;
|
|
1564
|
-
break;
|
|
1565
|
-
}
|
|
1566
|
-
case 'cross-device': {
|
|
1567
|
-
enum4 = 36;
|
|
1568
|
-
break;
|
|
1569
|
-
}
|
|
1570
|
-
default: {
|
|
1571
|
-
if ((e) instanceof Error) {
|
|
1572
|
-
console.error(e);
|
|
1573
|
-
}
|
|
1574
|
-
|
|
1575
|
-
throw new TypeError(`"${val4}" is not one of the cases of error-code`);
|
|
1576
|
-
}
|
|
1577
|
-
}
|
|
1578
|
-
dataView(memory0).setInt8(arg2 + 4, enum4, true);
|
|
1579
|
-
break;
|
|
1580
|
-
}
|
|
1581
|
-
default: {
|
|
1582
|
-
throw new TypeError('invalid variant specified for result');
|
|
1583
|
-
}
|
|
1584
|
-
}
|
|
1585
|
-
_debugLog('[iface="wasi:filesystem/types@0.2.3", function="[method]descriptor.write-via-stream"][Instruction::Return]', {
|
|
1586
|
-
funcName: '[method]descriptor.write-via-stream',
|
|
1587
|
-
paramCount: 0,
|
|
1588
|
-
async: false,
|
|
1589
|
-
postReturn: false
|
|
1590
|
-
});
|
|
1591
|
-
}
|
|
1592
|
-
|
|
1593
|
-
|
|
1594
|
-
function trampoline19(arg0, arg1) {
|
|
1595
|
-
var handle1 = arg0;
|
|
1596
|
-
var rep2 = handleTable3[(handle1 << 1) + 1] & ~T_FLAG;
|
|
1597
|
-
var rsc0 = captureTable3.get(rep2);
|
|
1598
|
-
if (!rsc0) {
|
|
1599
|
-
rsc0 = Object.create(Descriptor.prototype);
|
|
1600
|
-
Object.defineProperty(rsc0, symbolRscHandle, { writable: true, value: handle1});
|
|
1601
|
-
Object.defineProperty(rsc0, symbolRscRep, { writable: true, value: rep2});
|
|
1602
|
-
}
|
|
1603
|
-
curResourceBorrows.push(rsc0);
|
|
1604
|
-
_debugLog('[iface="wasi:filesystem/types@0.2.3", function="[method]descriptor.append-via-stream"] [Instruction::CallInterface] (async? sync, @ enter)');
|
|
1605
|
-
const _interface_call_currentTaskID = startCurrentTask(0, false, '[method]descriptor.append-via-stream');
|
|
1606
|
-
let ret;
|
|
1607
|
-
try {
|
|
1608
|
-
ret = { tag: 'ok', val: rsc0.appendViaStream()};
|
|
1609
|
-
} catch (e) {
|
|
1610
|
-
ret = { tag: 'err', val: getErrorPayload(e) };
|
|
1611
|
-
}
|
|
1612
|
-
_debugLog('[iface="wasi:filesystem/types@0.2.3", function="[method]descriptor.append-via-stream"] [Instruction::CallInterface] (sync, @ post-call)');
|
|
1613
|
-
for (const rsc of curResourceBorrows) {
|
|
1614
|
-
rsc[symbolRscHandle] = undefined;
|
|
1615
|
-
}
|
|
1616
|
-
curResourceBorrows = [];
|
|
1617
|
-
endCurrentTask(0);
|
|
1618
|
-
var variant5 = ret;
|
|
1619
|
-
switch (variant5.tag) {
|
|
1620
|
-
case 'ok': {
|
|
1621
|
-
const e = variant5.val;
|
|
1622
|
-
dataView(memory0).setInt8(arg1 + 0, 0, true);
|
|
1623
|
-
if (!(e instanceof OutputStream)) {
|
|
1624
|
-
throw new TypeError('Resource error: Not a valid "OutputStream" resource.');
|
|
1625
|
-
}
|
|
1626
|
-
var handle3 = e[symbolRscHandle];
|
|
1627
|
-
if (!handle3) {
|
|
1628
|
-
const rep = e[symbolRscRep] || ++captureCnt1;
|
|
1629
|
-
captureTable1.set(rep, e);
|
|
1630
|
-
handle3 = rscTableCreateOwn(handleTable1, rep);
|
|
1631
|
-
}
|
|
1632
|
-
dataView(memory0).setInt32(arg1 + 4, handle3, true);
|
|
1633
|
-
break;
|
|
1634
|
-
}
|
|
1635
|
-
case 'err': {
|
|
1636
|
-
const e = variant5.val;
|
|
1637
|
-
dataView(memory0).setInt8(arg1 + 0, 1, true);
|
|
1638
|
-
var val4 = e;
|
|
1639
|
-
let enum4;
|
|
1640
|
-
switch (val4) {
|
|
1641
|
-
case 'access': {
|
|
1642
|
-
enum4 = 0;
|
|
1643
|
-
break;
|
|
1644
|
-
}
|
|
1645
|
-
case 'would-block': {
|
|
1646
|
-
enum4 = 1;
|
|
1647
|
-
break;
|
|
1648
|
-
}
|
|
1649
|
-
case 'already': {
|
|
1650
|
-
enum4 = 2;
|
|
1651
|
-
break;
|
|
1652
|
-
}
|
|
1653
|
-
case 'bad-descriptor': {
|
|
1654
|
-
enum4 = 3;
|
|
1655
|
-
break;
|
|
1656
|
-
}
|
|
1657
|
-
case 'busy': {
|
|
1658
|
-
enum4 = 4;
|
|
1659
|
-
break;
|
|
1660
|
-
}
|
|
1661
|
-
case 'deadlock': {
|
|
1662
|
-
enum4 = 5;
|
|
1663
|
-
break;
|
|
1664
|
-
}
|
|
1665
|
-
case 'quota': {
|
|
1666
|
-
enum4 = 6;
|
|
1667
|
-
break;
|
|
1668
|
-
}
|
|
1669
|
-
case 'exist': {
|
|
1670
|
-
enum4 = 7;
|
|
1671
|
-
break;
|
|
1672
|
-
}
|
|
1673
|
-
case 'file-too-large': {
|
|
1674
|
-
enum4 = 8;
|
|
1675
|
-
break;
|
|
1676
|
-
}
|
|
1677
|
-
case 'illegal-byte-sequence': {
|
|
1678
|
-
enum4 = 9;
|
|
1679
|
-
break;
|
|
1680
|
-
}
|
|
1681
|
-
case 'in-progress': {
|
|
1682
|
-
enum4 = 10;
|
|
1683
|
-
break;
|
|
1684
|
-
}
|
|
1685
|
-
case 'interrupted': {
|
|
1686
|
-
enum4 = 11;
|
|
1687
|
-
break;
|
|
1688
|
-
}
|
|
1689
|
-
case 'invalid': {
|
|
1690
|
-
enum4 = 12;
|
|
1691
|
-
break;
|
|
1692
|
-
}
|
|
1693
|
-
case 'io': {
|
|
1694
|
-
enum4 = 13;
|
|
1695
|
-
break;
|
|
1696
|
-
}
|
|
1697
|
-
case 'is-directory': {
|
|
1698
|
-
enum4 = 14;
|
|
1699
|
-
break;
|
|
1700
|
-
}
|
|
1701
|
-
case 'loop': {
|
|
1702
|
-
enum4 = 15;
|
|
1703
|
-
break;
|
|
1704
|
-
}
|
|
1705
|
-
case 'too-many-links': {
|
|
1706
|
-
enum4 = 16;
|
|
1707
|
-
break;
|
|
1708
|
-
}
|
|
1709
|
-
case 'message-size': {
|
|
1710
|
-
enum4 = 17;
|
|
1711
|
-
break;
|
|
1712
|
-
}
|
|
1713
|
-
case 'name-too-long': {
|
|
1714
|
-
enum4 = 18;
|
|
1715
|
-
break;
|
|
1716
|
-
}
|
|
1717
|
-
case 'no-device': {
|
|
1718
|
-
enum4 = 19;
|
|
1719
|
-
break;
|
|
1720
|
-
}
|
|
1721
|
-
case 'no-entry': {
|
|
1722
|
-
enum4 = 20;
|
|
1723
|
-
break;
|
|
1724
|
-
}
|
|
1725
|
-
case 'no-lock': {
|
|
1726
|
-
enum4 = 21;
|
|
1727
|
-
break;
|
|
1728
|
-
}
|
|
1729
|
-
case 'insufficient-memory': {
|
|
1730
|
-
enum4 = 22;
|
|
1731
|
-
break;
|
|
1732
|
-
}
|
|
1733
|
-
case 'insufficient-space': {
|
|
1734
|
-
enum4 = 23;
|
|
1735
|
-
break;
|
|
1736
|
-
}
|
|
1737
|
-
case 'not-directory': {
|
|
1738
|
-
enum4 = 24;
|
|
1739
|
-
break;
|
|
1740
|
-
}
|
|
1741
|
-
case 'not-empty': {
|
|
1742
|
-
enum4 = 25;
|
|
1743
|
-
break;
|
|
1744
|
-
}
|
|
1745
|
-
case 'not-recoverable': {
|
|
1746
|
-
enum4 = 26;
|
|
1747
|
-
break;
|
|
1748
|
-
}
|
|
1749
|
-
case 'unsupported': {
|
|
1750
|
-
enum4 = 27;
|
|
1751
|
-
break;
|
|
1752
|
-
}
|
|
1753
|
-
case 'no-tty': {
|
|
1754
|
-
enum4 = 28;
|
|
1755
|
-
break;
|
|
1756
|
-
}
|
|
1757
|
-
case 'no-such-device': {
|
|
1758
|
-
enum4 = 29;
|
|
1759
|
-
break;
|
|
1760
|
-
}
|
|
1761
|
-
case 'overflow': {
|
|
1762
|
-
enum4 = 30;
|
|
1763
|
-
break;
|
|
1764
|
-
}
|
|
1765
|
-
case 'not-permitted': {
|
|
1766
|
-
enum4 = 31;
|
|
1767
|
-
break;
|
|
1768
|
-
}
|
|
1769
|
-
case 'pipe': {
|
|
1770
|
-
enum4 = 32;
|
|
1771
|
-
break;
|
|
1772
|
-
}
|
|
1773
|
-
case 'read-only': {
|
|
1774
|
-
enum4 = 33;
|
|
1775
|
-
break;
|
|
1776
|
-
}
|
|
1777
|
-
case 'invalid-seek': {
|
|
1778
|
-
enum4 = 34;
|
|
1779
|
-
break;
|
|
1780
|
-
}
|
|
1781
|
-
case 'text-file-busy': {
|
|
1782
|
-
enum4 = 35;
|
|
1783
|
-
break;
|
|
1784
|
-
}
|
|
1785
|
-
case 'cross-device': {
|
|
1786
|
-
enum4 = 36;
|
|
1787
|
-
break;
|
|
1788
|
-
}
|
|
1789
|
-
default: {
|
|
1790
|
-
if ((e) instanceof Error) {
|
|
1791
|
-
console.error(e);
|
|
1792
|
-
}
|
|
1793
|
-
|
|
1794
|
-
throw new TypeError(`"${val4}" is not one of the cases of error-code`);
|
|
1795
|
-
}
|
|
1796
|
-
}
|
|
1797
|
-
dataView(memory0).setInt8(arg1 + 4, enum4, true);
|
|
1798
|
-
break;
|
|
1799
|
-
}
|
|
1800
|
-
default: {
|
|
1801
|
-
throw new TypeError('invalid variant specified for result');
|
|
1802
|
-
}
|
|
1803
|
-
}
|
|
1804
|
-
_debugLog('[iface="wasi:filesystem/types@0.2.3", function="[method]descriptor.append-via-stream"][Instruction::Return]', {
|
|
1805
|
-
funcName: '[method]descriptor.append-via-stream',
|
|
1806
|
-
paramCount: 0,
|
|
1807
|
-
async: false,
|
|
1808
|
-
postReturn: false
|
|
1809
|
-
});
|
|
1810
|
-
}
|
|
1811
|
-
|
|
1812
|
-
|
|
1813
|
-
function trampoline20(arg0, arg1) {
|
|
1814
|
-
var handle1 = arg0;
|
|
1815
|
-
var rep2 = handleTable3[(handle1 << 1) + 1] & ~T_FLAG;
|
|
1816
|
-
var rsc0 = captureTable3.get(rep2);
|
|
1817
|
-
if (!rsc0) {
|
|
1818
|
-
rsc0 = Object.create(Descriptor.prototype);
|
|
1819
|
-
Object.defineProperty(rsc0, symbolRscHandle, { writable: true, value: handle1});
|
|
1820
|
-
Object.defineProperty(rsc0, symbolRscRep, { writable: true, value: rep2});
|
|
1821
|
-
}
|
|
1822
|
-
curResourceBorrows.push(rsc0);
|
|
1823
|
-
_debugLog('[iface="wasi:filesystem/types@0.2.3", function="[method]descriptor.get-type"] [Instruction::CallInterface] (async? sync, @ enter)');
|
|
1824
|
-
const _interface_call_currentTaskID = startCurrentTask(0, false, '[method]descriptor.get-type');
|
|
1825
|
-
let ret;
|
|
1826
|
-
try {
|
|
1827
|
-
ret = { tag: 'ok', val: rsc0.getType()};
|
|
1828
|
-
} catch (e) {
|
|
1829
|
-
ret = { tag: 'err', val: getErrorPayload(e) };
|
|
1830
|
-
}
|
|
1831
|
-
_debugLog('[iface="wasi:filesystem/types@0.2.3", function="[method]descriptor.get-type"] [Instruction::CallInterface] (sync, @ post-call)');
|
|
1832
|
-
for (const rsc of curResourceBorrows) {
|
|
1833
|
-
rsc[symbolRscHandle] = undefined;
|
|
1834
|
-
}
|
|
1835
|
-
curResourceBorrows = [];
|
|
1836
|
-
endCurrentTask(0);
|
|
1837
|
-
var variant5 = ret;
|
|
1838
|
-
switch (variant5.tag) {
|
|
1839
|
-
case 'ok': {
|
|
1840
|
-
const e = variant5.val;
|
|
1841
|
-
dataView(memory0).setInt8(arg1 + 0, 0, true);
|
|
1842
|
-
var val3 = e;
|
|
1843
|
-
let enum3;
|
|
1844
|
-
switch (val3) {
|
|
1845
|
-
case 'unknown': {
|
|
1846
|
-
enum3 = 0;
|
|
1847
|
-
break;
|
|
1848
|
-
}
|
|
1849
|
-
case 'block-device': {
|
|
1850
|
-
enum3 = 1;
|
|
1851
|
-
break;
|
|
1852
|
-
}
|
|
1853
|
-
case 'character-device': {
|
|
1854
|
-
enum3 = 2;
|
|
1855
|
-
break;
|
|
1856
|
-
}
|
|
1857
|
-
case 'directory': {
|
|
1858
|
-
enum3 = 3;
|
|
1859
|
-
break;
|
|
1860
|
-
}
|
|
1861
|
-
case 'fifo': {
|
|
1862
|
-
enum3 = 4;
|
|
1863
|
-
break;
|
|
1864
|
-
}
|
|
1865
|
-
case 'symbolic-link': {
|
|
1866
|
-
enum3 = 5;
|
|
1867
|
-
break;
|
|
1868
|
-
}
|
|
1869
|
-
case 'regular-file': {
|
|
1870
|
-
enum3 = 6;
|
|
1871
|
-
break;
|
|
1872
|
-
}
|
|
1873
|
-
case 'socket': {
|
|
1874
|
-
enum3 = 7;
|
|
1875
|
-
break;
|
|
1876
|
-
}
|
|
1877
|
-
default: {
|
|
1878
|
-
if ((e) instanceof Error) {
|
|
1879
|
-
console.error(e);
|
|
1880
|
-
}
|
|
1881
|
-
|
|
1882
|
-
throw new TypeError(`"${val3}" is not one of the cases of descriptor-type`);
|
|
1883
|
-
}
|
|
1884
|
-
}
|
|
1885
|
-
dataView(memory0).setInt8(arg1 + 1, enum3, true);
|
|
1886
|
-
break;
|
|
1887
|
-
}
|
|
1888
|
-
case 'err': {
|
|
1889
|
-
const e = variant5.val;
|
|
1890
|
-
dataView(memory0).setInt8(arg1 + 0, 1, true);
|
|
1891
|
-
var val4 = e;
|
|
1892
|
-
let enum4;
|
|
1893
|
-
switch (val4) {
|
|
1894
|
-
case 'access': {
|
|
1895
|
-
enum4 = 0;
|
|
1896
|
-
break;
|
|
1897
|
-
}
|
|
1898
|
-
case 'would-block': {
|
|
1899
|
-
enum4 = 1;
|
|
1900
|
-
break;
|
|
1901
|
-
}
|
|
1902
|
-
case 'already': {
|
|
1903
|
-
enum4 = 2;
|
|
1904
|
-
break;
|
|
1905
|
-
}
|
|
1906
|
-
case 'bad-descriptor': {
|
|
1907
|
-
enum4 = 3;
|
|
1908
|
-
break;
|
|
1909
|
-
}
|
|
1910
|
-
case 'busy': {
|
|
1911
|
-
enum4 = 4;
|
|
1912
|
-
break;
|
|
1913
|
-
}
|
|
1914
|
-
case 'deadlock': {
|
|
1915
|
-
enum4 = 5;
|
|
1916
|
-
break;
|
|
1917
|
-
}
|
|
1918
|
-
case 'quota': {
|
|
1919
|
-
enum4 = 6;
|
|
1920
|
-
break;
|
|
1921
|
-
}
|
|
1922
|
-
case 'exist': {
|
|
1923
|
-
enum4 = 7;
|
|
1924
|
-
break;
|
|
1925
|
-
}
|
|
1926
|
-
case 'file-too-large': {
|
|
1927
|
-
enum4 = 8;
|
|
1928
|
-
break;
|
|
1929
|
-
}
|
|
1930
|
-
case 'illegal-byte-sequence': {
|
|
1931
|
-
enum4 = 9;
|
|
1932
|
-
break;
|
|
1933
|
-
}
|
|
1934
|
-
case 'in-progress': {
|
|
1935
|
-
enum4 = 10;
|
|
1936
|
-
break;
|
|
1937
|
-
}
|
|
1938
|
-
case 'interrupted': {
|
|
1939
|
-
enum4 = 11;
|
|
1940
|
-
break;
|
|
1941
|
-
}
|
|
1942
|
-
case 'invalid': {
|
|
1943
|
-
enum4 = 12;
|
|
1944
|
-
break;
|
|
1945
|
-
}
|
|
1946
|
-
case 'io': {
|
|
1947
|
-
enum4 = 13;
|
|
1948
|
-
break;
|
|
1949
|
-
}
|
|
1950
|
-
case 'is-directory': {
|
|
1951
|
-
enum4 = 14;
|
|
1952
|
-
break;
|
|
1953
|
-
}
|
|
1954
|
-
case 'loop': {
|
|
1955
|
-
enum4 = 15;
|
|
1956
|
-
break;
|
|
1957
|
-
}
|
|
1958
|
-
case 'too-many-links': {
|
|
1959
|
-
enum4 = 16;
|
|
1960
|
-
break;
|
|
1961
|
-
}
|
|
1962
|
-
case 'message-size': {
|
|
1963
|
-
enum4 = 17;
|
|
1964
|
-
break;
|
|
1965
|
-
}
|
|
1966
|
-
case 'name-too-long': {
|
|
1967
|
-
enum4 = 18;
|
|
1968
|
-
break;
|
|
1969
|
-
}
|
|
1970
|
-
case 'no-device': {
|
|
1971
|
-
enum4 = 19;
|
|
1972
|
-
break;
|
|
1973
|
-
}
|
|
1974
|
-
case 'no-entry': {
|
|
1975
|
-
enum4 = 20;
|
|
1976
|
-
break;
|
|
1977
|
-
}
|
|
1978
|
-
case 'no-lock': {
|
|
1979
|
-
enum4 = 21;
|
|
1980
|
-
break;
|
|
1981
|
-
}
|
|
1982
|
-
case 'insufficient-memory': {
|
|
1983
|
-
enum4 = 22;
|
|
1984
|
-
break;
|
|
1985
|
-
}
|
|
1986
|
-
case 'insufficient-space': {
|
|
1987
|
-
enum4 = 23;
|
|
1988
|
-
break;
|
|
1989
|
-
}
|
|
1990
|
-
case 'not-directory': {
|
|
1991
|
-
enum4 = 24;
|
|
1992
|
-
break;
|
|
1993
|
-
}
|
|
1994
|
-
case 'not-empty': {
|
|
1995
|
-
enum4 = 25;
|
|
1996
|
-
break;
|
|
1997
|
-
}
|
|
1998
|
-
case 'not-recoverable': {
|
|
1999
|
-
enum4 = 26;
|
|
2000
|
-
break;
|
|
2001
|
-
}
|
|
2002
|
-
case 'unsupported': {
|
|
2003
|
-
enum4 = 27;
|
|
2004
|
-
break;
|
|
2005
|
-
}
|
|
2006
|
-
case 'no-tty': {
|
|
2007
|
-
enum4 = 28;
|
|
2008
|
-
break;
|
|
2009
|
-
}
|
|
2010
|
-
case 'no-such-device': {
|
|
2011
|
-
enum4 = 29;
|
|
2012
|
-
break;
|
|
2013
|
-
}
|
|
2014
|
-
case 'overflow': {
|
|
2015
|
-
enum4 = 30;
|
|
2016
|
-
break;
|
|
2017
|
-
}
|
|
2018
|
-
case 'not-permitted': {
|
|
2019
|
-
enum4 = 31;
|
|
2020
|
-
break;
|
|
2021
|
-
}
|
|
2022
|
-
case 'pipe': {
|
|
2023
|
-
enum4 = 32;
|
|
2024
|
-
break;
|
|
2025
|
-
}
|
|
2026
|
-
case 'read-only': {
|
|
2027
|
-
enum4 = 33;
|
|
2028
|
-
break;
|
|
2029
|
-
}
|
|
2030
|
-
case 'invalid-seek': {
|
|
2031
|
-
enum4 = 34;
|
|
2032
|
-
break;
|
|
2033
|
-
}
|
|
2034
|
-
case 'text-file-busy': {
|
|
2035
|
-
enum4 = 35;
|
|
2036
|
-
break;
|
|
2037
|
-
}
|
|
2038
|
-
case 'cross-device': {
|
|
2039
|
-
enum4 = 36;
|
|
2040
|
-
break;
|
|
2041
|
-
}
|
|
2042
|
-
default: {
|
|
2043
|
-
if ((e) instanceof Error) {
|
|
2044
|
-
console.error(e);
|
|
2045
|
-
}
|
|
2046
|
-
|
|
2047
|
-
throw new TypeError(`"${val4}" is not one of the cases of error-code`);
|
|
2048
|
-
}
|
|
2049
|
-
}
|
|
2050
|
-
dataView(memory0).setInt8(arg1 + 1, enum4, true);
|
|
2051
|
-
break;
|
|
2052
|
-
}
|
|
2053
|
-
default: {
|
|
2054
|
-
throw new TypeError('invalid variant specified for result');
|
|
2055
|
-
}
|
|
2056
|
-
}
|
|
2057
|
-
_debugLog('[iface="wasi:filesystem/types@0.2.3", function="[method]descriptor.get-type"][Instruction::Return]', {
|
|
2058
|
-
funcName: '[method]descriptor.get-type',
|
|
2059
|
-
paramCount: 0,
|
|
2060
|
-
async: false,
|
|
2061
|
-
postReturn: false
|
|
2062
|
-
});
|
|
2063
|
-
}
|
|
2064
|
-
|
|
2065
|
-
|
|
2066
|
-
function trampoline21(arg0, arg1) {
|
|
2067
|
-
var handle1 = arg0;
|
|
2068
|
-
var rep2 = handleTable3[(handle1 << 1) + 1] & ~T_FLAG;
|
|
2069
|
-
var rsc0 = captureTable3.get(rep2);
|
|
2070
|
-
if (!rsc0) {
|
|
2071
|
-
rsc0 = Object.create(Descriptor.prototype);
|
|
2072
|
-
Object.defineProperty(rsc0, symbolRscHandle, { writable: true, value: handle1});
|
|
2073
|
-
Object.defineProperty(rsc0, symbolRscRep, { writable: true, value: rep2});
|
|
2074
|
-
}
|
|
2075
|
-
curResourceBorrows.push(rsc0);
|
|
2076
|
-
_debugLog('[iface="wasi:filesystem/types@0.2.3", function="[method]descriptor.stat"] [Instruction::CallInterface] (async? sync, @ enter)');
|
|
2077
|
-
const _interface_call_currentTaskID = startCurrentTask(0, false, '[method]descriptor.stat');
|
|
2078
|
-
let ret;
|
|
2079
|
-
try {
|
|
2080
|
-
ret = { tag: 'ok', val: rsc0.stat()};
|
|
2081
|
-
} catch (e) {
|
|
2082
|
-
ret = { tag: 'err', val: getErrorPayload(e) };
|
|
2083
|
-
}
|
|
2084
|
-
_debugLog('[iface="wasi:filesystem/types@0.2.3", function="[method]descriptor.stat"] [Instruction::CallInterface] (sync, @ post-call)');
|
|
2085
|
-
for (const rsc of curResourceBorrows) {
|
|
2086
|
-
rsc[symbolRscHandle] = undefined;
|
|
2087
|
-
}
|
|
2088
|
-
curResourceBorrows = [];
|
|
2089
|
-
endCurrentTask(0);
|
|
2090
|
-
var variant12 = ret;
|
|
2091
|
-
switch (variant12.tag) {
|
|
2092
|
-
case 'ok': {
|
|
2093
|
-
const e = variant12.val;
|
|
2094
|
-
dataView(memory0).setInt8(arg1 + 0, 0, true);
|
|
2095
|
-
var {type: v3_0, linkCount: v3_1, size: v3_2, dataAccessTimestamp: v3_3, dataModificationTimestamp: v3_4, statusChangeTimestamp: v3_5 } = e;
|
|
2096
|
-
var val4 = v3_0;
|
|
2097
|
-
let enum4;
|
|
2098
|
-
switch (val4) {
|
|
2099
|
-
case 'unknown': {
|
|
2100
|
-
enum4 = 0;
|
|
2101
|
-
break;
|
|
2102
|
-
}
|
|
2103
|
-
case 'block-device': {
|
|
2104
|
-
enum4 = 1;
|
|
2105
|
-
break;
|
|
2106
|
-
}
|
|
2107
|
-
case 'character-device': {
|
|
2108
|
-
enum4 = 2;
|
|
2109
|
-
break;
|
|
2110
|
-
}
|
|
2111
|
-
case 'directory': {
|
|
2112
|
-
enum4 = 3;
|
|
2113
|
-
break;
|
|
2114
|
-
}
|
|
2115
|
-
case 'fifo': {
|
|
2116
|
-
enum4 = 4;
|
|
2117
|
-
break;
|
|
2118
|
-
}
|
|
2119
|
-
case 'symbolic-link': {
|
|
2120
|
-
enum4 = 5;
|
|
2121
|
-
break;
|
|
2122
|
-
}
|
|
2123
|
-
case 'regular-file': {
|
|
2124
|
-
enum4 = 6;
|
|
2125
|
-
break;
|
|
2126
|
-
}
|
|
2127
|
-
case 'socket': {
|
|
2128
|
-
enum4 = 7;
|
|
2129
|
-
break;
|
|
2130
|
-
}
|
|
2131
|
-
default: {
|
|
2132
|
-
if ((v3_0) instanceof Error) {
|
|
2133
|
-
console.error(v3_0);
|
|
2134
|
-
}
|
|
2135
|
-
|
|
2136
|
-
throw new TypeError(`"${val4}" is not one of the cases of descriptor-type`);
|
|
2137
|
-
}
|
|
2138
|
-
}
|
|
2139
|
-
dataView(memory0).setInt8(arg1 + 8, enum4, true);
|
|
2140
|
-
dataView(memory0).setBigInt64(arg1 + 16, toUint64(v3_1), true);
|
|
2141
|
-
dataView(memory0).setBigInt64(arg1 + 24, toUint64(v3_2), true);
|
|
2142
|
-
var variant6 = v3_3;
|
|
2143
|
-
if (variant6 === null || variant6=== undefined) {
|
|
2144
|
-
dataView(memory0).setInt8(arg1 + 32, 0, true);
|
|
2145
|
-
} else {
|
|
2146
|
-
const e = variant6;
|
|
2147
|
-
dataView(memory0).setInt8(arg1 + 32, 1, true);
|
|
2148
|
-
var {seconds: v5_0, nanoseconds: v5_1 } = e;
|
|
2149
|
-
dataView(memory0).setBigInt64(arg1 + 40, toUint64(v5_0), true);
|
|
2150
|
-
dataView(memory0).setInt32(arg1 + 48, toUint32(v5_1), true);
|
|
2151
|
-
}
|
|
2152
|
-
var variant8 = v3_4;
|
|
2153
|
-
if (variant8 === null || variant8=== undefined) {
|
|
2154
|
-
dataView(memory0).setInt8(arg1 + 56, 0, true);
|
|
2155
|
-
} else {
|
|
2156
|
-
const e = variant8;
|
|
2157
|
-
dataView(memory0).setInt8(arg1 + 56, 1, true);
|
|
2158
|
-
var {seconds: v7_0, nanoseconds: v7_1 } = e;
|
|
2159
|
-
dataView(memory0).setBigInt64(arg1 + 64, toUint64(v7_0), true);
|
|
2160
|
-
dataView(memory0).setInt32(arg1 + 72, toUint32(v7_1), true);
|
|
2161
|
-
}
|
|
2162
|
-
var variant10 = v3_5;
|
|
2163
|
-
if (variant10 === null || variant10=== undefined) {
|
|
2164
|
-
dataView(memory0).setInt8(arg1 + 80, 0, true);
|
|
435
|
+
function initSync(module) {
|
|
436
|
+
if (wasm !== undefined) return wasm;
|
|
437
|
+
|
|
438
|
+
|
|
439
|
+
if (typeof module !== 'undefined') {
|
|
440
|
+
if (Object.getPrototypeOf(module) === Object.prototype) {
|
|
441
|
+
({module} = module)
|
|
2165
442
|
} else {
|
|
2166
|
-
|
|
2167
|
-
dataView(memory0).setInt8(arg1 + 80, 1, true);
|
|
2168
|
-
var {seconds: v9_0, nanoseconds: v9_1 } = e;
|
|
2169
|
-
dataView(memory0).setBigInt64(arg1 + 88, toUint64(v9_0), true);
|
|
2170
|
-
dataView(memory0).setInt32(arg1 + 96, toUint32(v9_1), true);
|
|
443
|
+
console.warn('using deprecated parameters for `initSync()`; pass a single object instead')
|
|
2171
444
|
}
|
|
2172
|
-
break;
|
|
2173
|
-
}
|
|
2174
|
-
case 'err': {
|
|
2175
|
-
const e = variant12.val;
|
|
2176
|
-
dataView(memory0).setInt8(arg1 + 0, 1, true);
|
|
2177
|
-
var val11 = e;
|
|
2178
|
-
let enum11;
|
|
2179
|
-
switch (val11) {
|
|
2180
|
-
case 'access': {
|
|
2181
|
-
enum11 = 0;
|
|
2182
|
-
break;
|
|
2183
|
-
}
|
|
2184
|
-
case 'would-block': {
|
|
2185
|
-
enum11 = 1;
|
|
2186
|
-
break;
|
|
2187
|
-
}
|
|
2188
|
-
case 'already': {
|
|
2189
|
-
enum11 = 2;
|
|
2190
|
-
break;
|
|
2191
|
-
}
|
|
2192
|
-
case 'bad-descriptor': {
|
|
2193
|
-
enum11 = 3;
|
|
2194
|
-
break;
|
|
2195
|
-
}
|
|
2196
|
-
case 'busy': {
|
|
2197
|
-
enum11 = 4;
|
|
2198
|
-
break;
|
|
2199
|
-
}
|
|
2200
|
-
case 'deadlock': {
|
|
2201
|
-
enum11 = 5;
|
|
2202
|
-
break;
|
|
2203
|
-
}
|
|
2204
|
-
case 'quota': {
|
|
2205
|
-
enum11 = 6;
|
|
2206
|
-
break;
|
|
2207
|
-
}
|
|
2208
|
-
case 'exist': {
|
|
2209
|
-
enum11 = 7;
|
|
2210
|
-
break;
|
|
2211
|
-
}
|
|
2212
|
-
case 'file-too-large': {
|
|
2213
|
-
enum11 = 8;
|
|
2214
|
-
break;
|
|
2215
|
-
}
|
|
2216
|
-
case 'illegal-byte-sequence': {
|
|
2217
|
-
enum11 = 9;
|
|
2218
|
-
break;
|
|
2219
|
-
}
|
|
2220
|
-
case 'in-progress': {
|
|
2221
|
-
enum11 = 10;
|
|
2222
|
-
break;
|
|
2223
|
-
}
|
|
2224
|
-
case 'interrupted': {
|
|
2225
|
-
enum11 = 11;
|
|
2226
|
-
break;
|
|
2227
|
-
}
|
|
2228
|
-
case 'invalid': {
|
|
2229
|
-
enum11 = 12;
|
|
2230
|
-
break;
|
|
2231
|
-
}
|
|
2232
|
-
case 'io': {
|
|
2233
|
-
enum11 = 13;
|
|
2234
|
-
break;
|
|
2235
|
-
}
|
|
2236
|
-
case 'is-directory': {
|
|
2237
|
-
enum11 = 14;
|
|
2238
|
-
break;
|
|
2239
|
-
}
|
|
2240
|
-
case 'loop': {
|
|
2241
|
-
enum11 = 15;
|
|
2242
|
-
break;
|
|
2243
|
-
}
|
|
2244
|
-
case 'too-many-links': {
|
|
2245
|
-
enum11 = 16;
|
|
2246
|
-
break;
|
|
2247
|
-
}
|
|
2248
|
-
case 'message-size': {
|
|
2249
|
-
enum11 = 17;
|
|
2250
|
-
break;
|
|
2251
|
-
}
|
|
2252
|
-
case 'name-too-long': {
|
|
2253
|
-
enum11 = 18;
|
|
2254
|
-
break;
|
|
2255
|
-
}
|
|
2256
|
-
case 'no-device': {
|
|
2257
|
-
enum11 = 19;
|
|
2258
|
-
break;
|
|
2259
|
-
}
|
|
2260
|
-
case 'no-entry': {
|
|
2261
|
-
enum11 = 20;
|
|
2262
|
-
break;
|
|
2263
|
-
}
|
|
2264
|
-
case 'no-lock': {
|
|
2265
|
-
enum11 = 21;
|
|
2266
|
-
break;
|
|
2267
|
-
}
|
|
2268
|
-
case 'insufficient-memory': {
|
|
2269
|
-
enum11 = 22;
|
|
2270
|
-
break;
|
|
2271
|
-
}
|
|
2272
|
-
case 'insufficient-space': {
|
|
2273
|
-
enum11 = 23;
|
|
2274
|
-
break;
|
|
2275
|
-
}
|
|
2276
|
-
case 'not-directory': {
|
|
2277
|
-
enum11 = 24;
|
|
2278
|
-
break;
|
|
2279
|
-
}
|
|
2280
|
-
case 'not-empty': {
|
|
2281
|
-
enum11 = 25;
|
|
2282
|
-
break;
|
|
2283
|
-
}
|
|
2284
|
-
case 'not-recoverable': {
|
|
2285
|
-
enum11 = 26;
|
|
2286
|
-
break;
|
|
2287
|
-
}
|
|
2288
|
-
case 'unsupported': {
|
|
2289
|
-
enum11 = 27;
|
|
2290
|
-
break;
|
|
2291
|
-
}
|
|
2292
|
-
case 'no-tty': {
|
|
2293
|
-
enum11 = 28;
|
|
2294
|
-
break;
|
|
2295
|
-
}
|
|
2296
|
-
case 'no-such-device': {
|
|
2297
|
-
enum11 = 29;
|
|
2298
|
-
break;
|
|
2299
|
-
}
|
|
2300
|
-
case 'overflow': {
|
|
2301
|
-
enum11 = 30;
|
|
2302
|
-
break;
|
|
2303
|
-
}
|
|
2304
|
-
case 'not-permitted': {
|
|
2305
|
-
enum11 = 31;
|
|
2306
|
-
break;
|
|
2307
|
-
}
|
|
2308
|
-
case 'pipe': {
|
|
2309
|
-
enum11 = 32;
|
|
2310
|
-
break;
|
|
2311
|
-
}
|
|
2312
|
-
case 'read-only': {
|
|
2313
|
-
enum11 = 33;
|
|
2314
|
-
break;
|
|
2315
|
-
}
|
|
2316
|
-
case 'invalid-seek': {
|
|
2317
|
-
enum11 = 34;
|
|
2318
|
-
break;
|
|
2319
|
-
}
|
|
2320
|
-
case 'text-file-busy': {
|
|
2321
|
-
enum11 = 35;
|
|
2322
|
-
break;
|
|
2323
|
-
}
|
|
2324
|
-
case 'cross-device': {
|
|
2325
|
-
enum11 = 36;
|
|
2326
|
-
break;
|
|
2327
|
-
}
|
|
2328
|
-
default: {
|
|
2329
|
-
if ((e) instanceof Error) {
|
|
2330
|
-
console.error(e);
|
|
2331
|
-
}
|
|
2332
|
-
|
|
2333
|
-
throw new TypeError(`"${val11}" is not one of the cases of error-code`);
|
|
2334
|
-
}
|
|
2335
|
-
}
|
|
2336
|
-
dataView(memory0).setInt8(arg1 + 8, enum11, true);
|
|
2337
|
-
break;
|
|
2338
|
-
}
|
|
2339
|
-
default: {
|
|
2340
|
-
throw new TypeError('invalid variant specified for result');
|
|
2341
|
-
}
|
|
2342
|
-
}
|
|
2343
|
-
_debugLog('[iface="wasi:filesystem/types@0.2.3", function="[method]descriptor.stat"][Instruction::Return]', {
|
|
2344
|
-
funcName: '[method]descriptor.stat',
|
|
2345
|
-
paramCount: 0,
|
|
2346
|
-
async: false,
|
|
2347
|
-
postReturn: false
|
|
2348
|
-
});
|
|
2349
|
-
}
|
|
2350
|
-
|
|
2351
|
-
|
|
2352
|
-
function trampoline22(arg0, arg1) {
|
|
2353
|
-
var handle1 = arg0;
|
|
2354
|
-
var rep2 = handleTable1[(handle1 << 1) + 1] & ~T_FLAG;
|
|
2355
|
-
var rsc0 = captureTable1.get(rep2);
|
|
2356
|
-
if (!rsc0) {
|
|
2357
|
-
rsc0 = Object.create(OutputStream.prototype);
|
|
2358
|
-
Object.defineProperty(rsc0, symbolRscHandle, { writable: true, value: handle1});
|
|
2359
|
-
Object.defineProperty(rsc0, symbolRscRep, { writable: true, value: rep2});
|
|
2360
|
-
}
|
|
2361
|
-
curResourceBorrows.push(rsc0);
|
|
2362
|
-
_debugLog('[iface="wasi:io/streams@0.2.3", function="[method]output-stream.check-write"] [Instruction::CallInterface] (async? sync, @ enter)');
|
|
2363
|
-
const _interface_call_currentTaskID = startCurrentTask(0, false, '[method]output-stream.check-write');
|
|
2364
|
-
let ret;
|
|
2365
|
-
try {
|
|
2366
|
-
ret = { tag: 'ok', val: rsc0.checkWrite()};
|
|
2367
|
-
} catch (e) {
|
|
2368
|
-
ret = { tag: 'err', val: getErrorPayload(e) };
|
|
2369
|
-
}
|
|
2370
|
-
_debugLog('[iface="wasi:io/streams@0.2.3", function="[method]output-stream.check-write"] [Instruction::CallInterface] (sync, @ post-call)');
|
|
2371
|
-
for (const rsc of curResourceBorrows) {
|
|
2372
|
-
rsc[symbolRscHandle] = undefined;
|
|
2373
|
-
}
|
|
2374
|
-
curResourceBorrows = [];
|
|
2375
|
-
endCurrentTask(0);
|
|
2376
|
-
var variant5 = ret;
|
|
2377
|
-
switch (variant5.tag) {
|
|
2378
|
-
case 'ok': {
|
|
2379
|
-
const e = variant5.val;
|
|
2380
|
-
dataView(memory0).setInt8(arg1 + 0, 0, true);
|
|
2381
|
-
dataView(memory0).setBigInt64(arg1 + 8, toUint64(e), true);
|
|
2382
|
-
break;
|
|
2383
|
-
}
|
|
2384
|
-
case 'err': {
|
|
2385
|
-
const e = variant5.val;
|
|
2386
|
-
dataView(memory0).setInt8(arg1 + 0, 1, true);
|
|
2387
|
-
var variant4 = e;
|
|
2388
|
-
switch (variant4.tag) {
|
|
2389
|
-
case 'last-operation-failed': {
|
|
2390
|
-
const e = variant4.val;
|
|
2391
|
-
dataView(memory0).setInt8(arg1 + 8, 0, true);
|
|
2392
|
-
if (!(e instanceof Error$1)) {
|
|
2393
|
-
throw new TypeError('Resource error: Not a valid "Error" resource.');
|
|
2394
|
-
}
|
|
2395
|
-
var handle3 = e[symbolRscHandle];
|
|
2396
|
-
if (!handle3) {
|
|
2397
|
-
const rep = e[symbolRscRep] || ++captureCnt0;
|
|
2398
|
-
captureTable0.set(rep, e);
|
|
2399
|
-
handle3 = rscTableCreateOwn(handleTable0, rep);
|
|
2400
|
-
}
|
|
2401
|
-
dataView(memory0).setInt32(arg1 + 12, handle3, true);
|
|
2402
|
-
break;
|
|
2403
|
-
}
|
|
2404
|
-
case 'closed': {
|
|
2405
|
-
dataView(memory0).setInt8(arg1 + 8, 1, true);
|
|
2406
|
-
break;
|
|
2407
|
-
}
|
|
2408
|
-
default: {
|
|
2409
|
-
throw new TypeError(`invalid variant tag value \`${JSON.stringify(variant4.tag)}\` (received \`${variant4}\`) specified for \`StreamError\``);
|
|
2410
|
-
}
|
|
2411
|
-
}
|
|
2412
|
-
break;
|
|
2413
|
-
}
|
|
2414
|
-
default: {
|
|
2415
|
-
throw new TypeError('invalid variant specified for result');
|
|
2416
|
-
}
|
|
2417
|
-
}
|
|
2418
|
-
_debugLog('[iface="wasi:io/streams@0.2.3", function="[method]output-stream.check-write"][Instruction::Return]', {
|
|
2419
|
-
funcName: '[method]output-stream.check-write',
|
|
2420
|
-
paramCount: 0,
|
|
2421
|
-
async: false,
|
|
2422
|
-
postReturn: false
|
|
2423
|
-
});
|
|
2424
|
-
}
|
|
2425
|
-
|
|
2426
|
-
|
|
2427
|
-
function trampoline23(arg0, arg1, arg2, arg3) {
|
|
2428
|
-
var handle1 = arg0;
|
|
2429
|
-
var rep2 = handleTable1[(handle1 << 1) + 1] & ~T_FLAG;
|
|
2430
|
-
var rsc0 = captureTable1.get(rep2);
|
|
2431
|
-
if (!rsc0) {
|
|
2432
|
-
rsc0 = Object.create(OutputStream.prototype);
|
|
2433
|
-
Object.defineProperty(rsc0, symbolRscHandle, { writable: true, value: handle1});
|
|
2434
|
-
Object.defineProperty(rsc0, symbolRscRep, { writable: true, value: rep2});
|
|
2435
|
-
}
|
|
2436
|
-
curResourceBorrows.push(rsc0);
|
|
2437
|
-
var ptr3 = arg1;
|
|
2438
|
-
var len3 = arg2;
|
|
2439
|
-
var result3 = new Uint8Array(memory0.buffer.slice(ptr3, ptr3 + len3 * 1));
|
|
2440
|
-
_debugLog('[iface="wasi:io/streams@0.2.3", function="[method]output-stream.write"] [Instruction::CallInterface] (async? sync, @ enter)');
|
|
2441
|
-
const _interface_call_currentTaskID = startCurrentTask(0, false, '[method]output-stream.write');
|
|
2442
|
-
let ret;
|
|
2443
|
-
try {
|
|
2444
|
-
ret = { tag: 'ok', val: rsc0.write(result3)};
|
|
2445
|
-
} catch (e) {
|
|
2446
|
-
ret = { tag: 'err', val: getErrorPayload(e) };
|
|
2447
|
-
}
|
|
2448
|
-
_debugLog('[iface="wasi:io/streams@0.2.3", function="[method]output-stream.write"] [Instruction::CallInterface] (sync, @ post-call)');
|
|
2449
|
-
for (const rsc of curResourceBorrows) {
|
|
2450
|
-
rsc[symbolRscHandle] = undefined;
|
|
2451
|
-
}
|
|
2452
|
-
curResourceBorrows = [];
|
|
2453
|
-
endCurrentTask(0);
|
|
2454
|
-
var variant6 = ret;
|
|
2455
|
-
switch (variant6.tag) {
|
|
2456
|
-
case 'ok': {
|
|
2457
|
-
const e = variant6.val;
|
|
2458
|
-
dataView(memory0).setInt8(arg3 + 0, 0, true);
|
|
2459
|
-
break;
|
|
2460
|
-
}
|
|
2461
|
-
case 'err': {
|
|
2462
|
-
const e = variant6.val;
|
|
2463
|
-
dataView(memory0).setInt8(arg3 + 0, 1, true);
|
|
2464
|
-
var variant5 = e;
|
|
2465
|
-
switch (variant5.tag) {
|
|
2466
|
-
case 'last-operation-failed': {
|
|
2467
|
-
const e = variant5.val;
|
|
2468
|
-
dataView(memory0).setInt8(arg3 + 4, 0, true);
|
|
2469
|
-
if (!(e instanceof Error$1)) {
|
|
2470
|
-
throw new TypeError('Resource error: Not a valid "Error" resource.');
|
|
2471
|
-
}
|
|
2472
|
-
var handle4 = e[symbolRscHandle];
|
|
2473
|
-
if (!handle4) {
|
|
2474
|
-
const rep = e[symbolRscRep] || ++captureCnt0;
|
|
2475
|
-
captureTable0.set(rep, e);
|
|
2476
|
-
handle4 = rscTableCreateOwn(handleTable0, rep);
|
|
2477
|
-
}
|
|
2478
|
-
dataView(memory0).setInt32(arg3 + 8, handle4, true);
|
|
2479
|
-
break;
|
|
2480
|
-
}
|
|
2481
|
-
case 'closed': {
|
|
2482
|
-
dataView(memory0).setInt8(arg3 + 4, 1, true);
|
|
2483
|
-
break;
|
|
2484
|
-
}
|
|
2485
|
-
default: {
|
|
2486
|
-
throw new TypeError(`invalid variant tag value \`${JSON.stringify(variant5.tag)}\` (received \`${variant5}\`) specified for \`StreamError\``);
|
|
2487
|
-
}
|
|
2488
|
-
}
|
|
2489
|
-
break;
|
|
2490
|
-
}
|
|
2491
|
-
default: {
|
|
2492
|
-
throw new TypeError('invalid variant specified for result');
|
|
2493
|
-
}
|
|
2494
|
-
}
|
|
2495
|
-
_debugLog('[iface="wasi:io/streams@0.2.3", function="[method]output-stream.write"][Instruction::Return]', {
|
|
2496
|
-
funcName: '[method]output-stream.write',
|
|
2497
|
-
paramCount: 0,
|
|
2498
|
-
async: false,
|
|
2499
|
-
postReturn: false
|
|
2500
|
-
});
|
|
2501
|
-
}
|
|
2502
|
-
|
|
2503
|
-
|
|
2504
|
-
function trampoline24(arg0, arg1) {
|
|
2505
|
-
var handle1 = arg0;
|
|
2506
|
-
var rep2 = handleTable1[(handle1 << 1) + 1] & ~T_FLAG;
|
|
2507
|
-
var rsc0 = captureTable1.get(rep2);
|
|
2508
|
-
if (!rsc0) {
|
|
2509
|
-
rsc0 = Object.create(OutputStream.prototype);
|
|
2510
|
-
Object.defineProperty(rsc0, symbolRscHandle, { writable: true, value: handle1});
|
|
2511
|
-
Object.defineProperty(rsc0, symbolRscRep, { writable: true, value: rep2});
|
|
2512
445
|
}
|
|
2513
|
-
|
|
2514
|
-
|
|
2515
|
-
|
|
2516
|
-
|
|
2517
|
-
try {
|
|
2518
|
-
ret = { tag: 'ok', val: rsc0.blockingFlush()};
|
|
2519
|
-
} catch (e) {
|
|
2520
|
-
ret = { tag: 'err', val: getErrorPayload(e) };
|
|
2521
|
-
}
|
|
2522
|
-
_debugLog('[iface="wasi:io/streams@0.2.3", function="[method]output-stream.blocking-flush"] [Instruction::CallInterface] (sync, @ post-call)');
|
|
2523
|
-
for (const rsc of curResourceBorrows) {
|
|
2524
|
-
rsc[symbolRscHandle] = undefined;
|
|
2525
|
-
}
|
|
2526
|
-
curResourceBorrows = [];
|
|
2527
|
-
endCurrentTask(0);
|
|
2528
|
-
var variant5 = ret;
|
|
2529
|
-
switch (variant5.tag) {
|
|
2530
|
-
case 'ok': {
|
|
2531
|
-
const e = variant5.val;
|
|
2532
|
-
dataView(memory0).setInt8(arg1 + 0, 0, true);
|
|
2533
|
-
break;
|
|
2534
|
-
}
|
|
2535
|
-
case 'err': {
|
|
2536
|
-
const e = variant5.val;
|
|
2537
|
-
dataView(memory0).setInt8(arg1 + 0, 1, true);
|
|
2538
|
-
var variant4 = e;
|
|
2539
|
-
switch (variant4.tag) {
|
|
2540
|
-
case 'last-operation-failed': {
|
|
2541
|
-
const e = variant4.val;
|
|
2542
|
-
dataView(memory0).setInt8(arg1 + 4, 0, true);
|
|
2543
|
-
if (!(e instanceof Error$1)) {
|
|
2544
|
-
throw new TypeError('Resource error: Not a valid "Error" resource.');
|
|
2545
|
-
}
|
|
2546
|
-
var handle3 = e[symbolRscHandle];
|
|
2547
|
-
if (!handle3) {
|
|
2548
|
-
const rep = e[symbolRscRep] || ++captureCnt0;
|
|
2549
|
-
captureTable0.set(rep, e);
|
|
2550
|
-
handle3 = rscTableCreateOwn(handleTable0, rep);
|
|
2551
|
-
}
|
|
2552
|
-
dataView(memory0).setInt32(arg1 + 8, handle3, true);
|
|
2553
|
-
break;
|
|
2554
|
-
}
|
|
2555
|
-
case 'closed': {
|
|
2556
|
-
dataView(memory0).setInt8(arg1 + 4, 1, true);
|
|
2557
|
-
break;
|
|
2558
|
-
}
|
|
2559
|
-
default: {
|
|
2560
|
-
throw new TypeError(`invalid variant tag value \`${JSON.stringify(variant4.tag)}\` (received \`${variant4}\`) specified for \`StreamError\``);
|
|
2561
|
-
}
|
|
2562
|
-
}
|
|
2563
|
-
break;
|
|
2564
|
-
}
|
|
2565
|
-
default: {
|
|
2566
|
-
throw new TypeError('invalid variant specified for result');
|
|
2567
|
-
}
|
|
2568
|
-
}
|
|
2569
|
-
_debugLog('[iface="wasi:io/streams@0.2.3", function="[method]output-stream.blocking-flush"][Instruction::Return]', {
|
|
2570
|
-
funcName: '[method]output-stream.blocking-flush',
|
|
2571
|
-
paramCount: 0,
|
|
2572
|
-
async: false,
|
|
2573
|
-
postReturn: false
|
|
2574
|
-
});
|
|
2575
|
-
}
|
|
2576
|
-
|
|
2577
|
-
|
|
2578
|
-
function trampoline25(arg0, arg1, arg2, arg3) {
|
|
2579
|
-
var handle1 = arg0;
|
|
2580
|
-
var rep2 = handleTable1[(handle1 << 1) + 1] & ~T_FLAG;
|
|
2581
|
-
var rsc0 = captureTable1.get(rep2);
|
|
2582
|
-
if (!rsc0) {
|
|
2583
|
-
rsc0 = Object.create(OutputStream.prototype);
|
|
2584
|
-
Object.defineProperty(rsc0, symbolRscHandle, { writable: true, value: handle1});
|
|
2585
|
-
Object.defineProperty(rsc0, symbolRscRep, { writable: true, value: rep2});
|
|
2586
|
-
}
|
|
2587
|
-
curResourceBorrows.push(rsc0);
|
|
2588
|
-
var ptr3 = arg1;
|
|
2589
|
-
var len3 = arg2;
|
|
2590
|
-
var result3 = new Uint8Array(memory0.buffer.slice(ptr3, ptr3 + len3 * 1));
|
|
2591
|
-
_debugLog('[iface="wasi:io/streams@0.2.3", function="[method]output-stream.blocking-write-and-flush"] [Instruction::CallInterface] (async? sync, @ enter)');
|
|
2592
|
-
const _interface_call_currentTaskID = startCurrentTask(0, false, '[method]output-stream.blocking-write-and-flush');
|
|
2593
|
-
let ret;
|
|
2594
|
-
try {
|
|
2595
|
-
ret = { tag: 'ok', val: rsc0.blockingWriteAndFlush(result3)};
|
|
2596
|
-
} catch (e) {
|
|
2597
|
-
ret = { tag: 'err', val: getErrorPayload(e) };
|
|
2598
|
-
}
|
|
2599
|
-
_debugLog('[iface="wasi:io/streams@0.2.3", function="[method]output-stream.blocking-write-and-flush"] [Instruction::CallInterface] (sync, @ post-call)');
|
|
2600
|
-
for (const rsc of curResourceBorrows) {
|
|
2601
|
-
rsc[symbolRscHandle] = undefined;
|
|
446
|
+
|
|
447
|
+
const imports = __wbg_get_imports();
|
|
448
|
+
if (!(module instanceof WebAssembly.Module)) {
|
|
449
|
+
module = new WebAssembly.Module(module);
|
|
2602
450
|
}
|
|
2603
|
-
|
|
2604
|
-
|
|
2605
|
-
|
|
2606
|
-
|
|
2607
|
-
|
|
2608
|
-
|
|
2609
|
-
|
|
2610
|
-
|
|
2611
|
-
|
|
2612
|
-
|
|
2613
|
-
|
|
2614
|
-
|
|
2615
|
-
|
|
2616
|
-
switch (variant5.tag) {
|
|
2617
|
-
case 'last-operation-failed': {
|
|
2618
|
-
const e = variant5.val;
|
|
2619
|
-
dataView(memory0).setInt8(arg3 + 4, 0, true);
|
|
2620
|
-
if (!(e instanceof Error$1)) {
|
|
2621
|
-
throw new TypeError('Resource error: Not a valid "Error" resource.');
|
|
2622
|
-
}
|
|
2623
|
-
var handle4 = e[symbolRscHandle];
|
|
2624
|
-
if (!handle4) {
|
|
2625
|
-
const rep = e[symbolRscRep] || ++captureCnt0;
|
|
2626
|
-
captureTable0.set(rep, e);
|
|
2627
|
-
handle4 = rscTableCreateOwn(handleTable0, rep);
|
|
2628
|
-
}
|
|
2629
|
-
dataView(memory0).setInt32(arg3 + 8, handle4, true);
|
|
2630
|
-
break;
|
|
2631
|
-
}
|
|
2632
|
-
case 'closed': {
|
|
2633
|
-
dataView(memory0).setInt8(arg3 + 4, 1, true);
|
|
2634
|
-
break;
|
|
2635
|
-
}
|
|
2636
|
-
default: {
|
|
2637
|
-
throw new TypeError(`invalid variant tag value \`${JSON.stringify(variant5.tag)}\` (received \`${variant5}\`) specified for \`StreamError\``);
|
|
2638
|
-
}
|
|
451
|
+
const instance = new WebAssembly.Instance(module, imports);
|
|
452
|
+
return __wbg_finalize_init(instance, module);
|
|
453
|
+
}
|
|
454
|
+
|
|
455
|
+
async function __wbg_init(module_or_path) {
|
|
456
|
+
if (wasm !== undefined) return wasm;
|
|
457
|
+
|
|
458
|
+
|
|
459
|
+
if (typeof module_or_path !== 'undefined') {
|
|
460
|
+
if (Object.getPrototypeOf(module_or_path) === Object.prototype) {
|
|
461
|
+
({module_or_path} = module_or_path)
|
|
462
|
+
} else {
|
|
463
|
+
console.warn('using deprecated parameters for the initialization function; pass a single object instead')
|
|
2639
464
|
}
|
|
2640
|
-
break;
|
|
2641
|
-
}
|
|
2642
|
-
default: {
|
|
2643
|
-
throw new TypeError('invalid variant specified for result');
|
|
2644
|
-
}
|
|
2645
|
-
}
|
|
2646
|
-
_debugLog('[iface="wasi:io/streams@0.2.3", function="[method]output-stream.blocking-write-and-flush"][Instruction::Return]', {
|
|
2647
|
-
funcName: '[method]output-stream.blocking-write-and-flush',
|
|
2648
|
-
paramCount: 0,
|
|
2649
|
-
async: false,
|
|
2650
|
-
postReturn: false
|
|
2651
|
-
});
|
|
2652
|
-
}
|
|
2653
|
-
|
|
2654
|
-
|
|
2655
|
-
function trampoline26(arg0) {
|
|
2656
|
-
_debugLog('[iface="wasi:filesystem/preopens@0.2.3", function="get-directories"] [Instruction::CallInterface] (async? sync, @ enter)');
|
|
2657
|
-
const _interface_call_currentTaskID = startCurrentTask(0, false, 'get-directories');
|
|
2658
|
-
const ret = getDirectories();
|
|
2659
|
-
_debugLog('[iface="wasi:filesystem/preopens@0.2.3", function="get-directories"] [Instruction::CallInterface] (sync, @ post-call)');
|
|
2660
|
-
endCurrentTask(0);
|
|
2661
|
-
var vec3 = ret;
|
|
2662
|
-
var len3 = vec3.length;
|
|
2663
|
-
var result3 = realloc1(0, 0, 4, len3 * 12);
|
|
2664
|
-
for (let i = 0; i < vec3.length; i++) {
|
|
2665
|
-
const e = vec3[i];
|
|
2666
|
-
const base = result3 + i * 12;var [tuple0_0, tuple0_1] = e;
|
|
2667
|
-
if (!(tuple0_0 instanceof Descriptor)) {
|
|
2668
|
-
throw new TypeError('Resource error: Not a valid "Descriptor" resource.');
|
|
2669
|
-
}
|
|
2670
|
-
var handle1 = tuple0_0[symbolRscHandle];
|
|
2671
|
-
if (!handle1) {
|
|
2672
|
-
const rep = tuple0_0[symbolRscRep] || ++captureCnt3;
|
|
2673
|
-
captureTable3.set(rep, tuple0_0);
|
|
2674
|
-
handle1 = rscTableCreateOwn(handleTable3, rep);
|
|
2675
|
-
}
|
|
2676
|
-
dataView(memory0).setInt32(base + 0, handle1, true);
|
|
2677
|
-
var ptr2 = utf8Encode(tuple0_1, realloc1, memory0);
|
|
2678
|
-
var len2 = utf8EncodedLen;
|
|
2679
|
-
dataView(memory0).setUint32(base + 8, len2, true);
|
|
2680
|
-
dataView(memory0).setUint32(base + 4, ptr2, true);
|
|
2681
|
-
}
|
|
2682
|
-
dataView(memory0).setUint32(arg0 + 4, len3, true);
|
|
2683
|
-
dataView(memory0).setUint32(arg0 + 0, result3, true);
|
|
2684
|
-
_debugLog('[iface="wasi:filesystem/preopens@0.2.3", function="get-directories"][Instruction::Return]', {
|
|
2685
|
-
funcName: 'get-directories',
|
|
2686
|
-
paramCount: 0,
|
|
2687
|
-
async: false,
|
|
2688
|
-
postReturn: false
|
|
2689
|
-
});
|
|
2690
|
-
}
|
|
2691
|
-
|
|
2692
|
-
let exports3;
|
|
2693
|
-
let postReturn0;
|
|
2694
|
-
let postReturn1;
|
|
2695
|
-
function trampoline3(handle) {
|
|
2696
|
-
const handleEntry = rscTableRemove(handleTable3, handle);
|
|
2697
|
-
if (handleEntry.own) {
|
|
2698
|
-
|
|
2699
|
-
const rsc = captureTable3.get(handleEntry.rep);
|
|
2700
|
-
if (rsc) {
|
|
2701
|
-
if (rsc[symbolDispose]) rsc[symbolDispose]();
|
|
2702
|
-
captureTable3.delete(handleEntry.rep);
|
|
2703
|
-
} else if (Descriptor[symbolCabiDispose]) {
|
|
2704
|
-
Descriptor[symbolCabiDispose](handleEntry.rep);
|
|
2705
|
-
}
|
|
2706
|
-
}
|
|
2707
|
-
}
|
|
2708
|
-
function trampoline4(handle) {
|
|
2709
|
-
const handleEntry = rscTableRemove(handleTable1, handle);
|
|
2710
|
-
if (handleEntry.own) {
|
|
2711
|
-
|
|
2712
|
-
const rsc = captureTable1.get(handleEntry.rep);
|
|
2713
|
-
if (rsc) {
|
|
2714
|
-
if (rsc[symbolDispose]) rsc[symbolDispose]();
|
|
2715
|
-
captureTable1.delete(handleEntry.rep);
|
|
2716
|
-
} else if (OutputStream[symbolCabiDispose]) {
|
|
2717
|
-
OutputStream[symbolCabiDispose](handleEntry.rep);
|
|
2718
|
-
}
|
|
2719
|
-
}
|
|
2720
|
-
}
|
|
2721
|
-
function trampoline5(handle) {
|
|
2722
|
-
const handleEntry = rscTableRemove(handleTable0, handle);
|
|
2723
|
-
if (handleEntry.own) {
|
|
2724
|
-
|
|
2725
|
-
const rsc = captureTable0.get(handleEntry.rep);
|
|
2726
|
-
if (rsc) {
|
|
2727
|
-
if (rsc[symbolDispose]) rsc[symbolDispose]();
|
|
2728
|
-
captureTable0.delete(handleEntry.rep);
|
|
2729
|
-
} else if (Error$1[symbolCabiDispose]) {
|
|
2730
|
-
Error$1[symbolCabiDispose](handleEntry.rep);
|
|
2731
|
-
}
|
|
2732
|
-
}
|
|
2733
|
-
}
|
|
2734
|
-
function trampoline6(handle) {
|
|
2735
|
-
const handleEntry = rscTableRemove(handleTable2, handle);
|
|
2736
|
-
if (handleEntry.own) {
|
|
2737
|
-
|
|
2738
|
-
const rsc = captureTable2.get(handleEntry.rep);
|
|
2739
|
-
if (rsc) {
|
|
2740
|
-
if (rsc[symbolDispose]) rsc[symbolDispose]();
|
|
2741
|
-
captureTable2.delete(handleEntry.rep);
|
|
2742
|
-
} else if (InputStream[symbolCabiDispose]) {
|
|
2743
|
-
InputStream[symbolCabiDispose](handleEntry.rep);
|
|
2744
|
-
}
|
|
2745
|
-
}
|
|
2746
|
-
}
|
|
2747
|
-
Promise.all([module0, module1, module2, module3]).catch(() => {});
|
|
2748
|
-
({ exports: exports0 } = yield instantiateCore(yield module2));
|
|
2749
|
-
({ exports: exports1 } = yield instantiateCore(yield module0, {
|
|
2750
|
-
'arborium:host/plugin-provider@0.1.0': {
|
|
2751
|
-
'create-plugin-session': trampoline2,
|
|
2752
|
-
'free-plugin-session': trampoline1,
|
|
2753
|
-
'get-injection-languages': exports0['4'],
|
|
2754
|
-
'load-plugin': exports0['0'],
|
|
2755
|
-
'plugin-apply-edit': exports0['3'],
|
|
2756
|
-
'plugin-cancel': trampoline0,
|
|
2757
|
-
'plugin-parse': exports0['1'],
|
|
2758
|
-
'plugin-set-text': exports0['2'],
|
|
2759
|
-
},
|
|
2760
|
-
wasi_snapshot_preview1: {
|
|
2761
|
-
environ_get: exports0['6'],
|
|
2762
|
-
environ_sizes_get: exports0['7'],
|
|
2763
|
-
fd_write: exports0['5'],
|
|
2764
|
-
proc_exit: exports0['8'],
|
|
2765
|
-
},
|
|
2766
|
-
}));
|
|
2767
|
-
({ exports: exports2 } = yield instantiateCore(yield module1, {
|
|
2768
|
-
__main_module__: {
|
|
2769
|
-
cabi_realloc: exports1.cabi_realloc,
|
|
2770
|
-
},
|
|
2771
|
-
env: {
|
|
2772
|
-
memory: exports1.memory,
|
|
2773
|
-
},
|
|
2774
|
-
'wasi:cli/environment@0.2.3': {
|
|
2775
|
-
'get-environment': exports0['9'],
|
|
2776
|
-
},
|
|
2777
|
-
'wasi:cli/exit@0.2.3': {
|
|
2778
|
-
exit: trampoline10,
|
|
2779
|
-
},
|
|
2780
|
-
'wasi:cli/stderr@0.2.3': {
|
|
2781
|
-
'get-stderr': trampoline7,
|
|
2782
|
-
},
|
|
2783
|
-
'wasi:cli/stdin@0.2.3': {
|
|
2784
|
-
'get-stdin': trampoline8,
|
|
2785
|
-
},
|
|
2786
|
-
'wasi:cli/stdout@0.2.3': {
|
|
2787
|
-
'get-stdout': trampoline9,
|
|
2788
|
-
},
|
|
2789
|
-
'wasi:filesystem/preopens@0.2.2': {
|
|
2790
|
-
'get-directories': exports0['19'],
|
|
2791
|
-
},
|
|
2792
|
-
'wasi:filesystem/types@0.2.3': {
|
|
2793
|
-
'[method]descriptor.append-via-stream': exports0['12'],
|
|
2794
|
-
'[method]descriptor.get-type': exports0['13'],
|
|
2795
|
-
'[method]descriptor.stat': exports0['14'],
|
|
2796
|
-
'[method]descriptor.write-via-stream': exports0['11'],
|
|
2797
|
-
'[resource-drop]descriptor': trampoline3,
|
|
2798
|
-
'filesystem-error-code': exports0['10'],
|
|
2799
|
-
},
|
|
2800
|
-
'wasi:io/error@0.2.3': {
|
|
2801
|
-
'[resource-drop]error': trampoline5,
|
|
2802
|
-
},
|
|
2803
|
-
'wasi:io/streams@0.2.3': {
|
|
2804
|
-
'[method]output-stream.blocking-flush': exports0['17'],
|
|
2805
|
-
'[method]output-stream.blocking-write-and-flush': exports0['18'],
|
|
2806
|
-
'[method]output-stream.check-write': exports0['15'],
|
|
2807
|
-
'[method]output-stream.write': exports0['16'],
|
|
2808
|
-
'[resource-drop]input-stream': trampoline6,
|
|
2809
|
-
'[resource-drop]output-stream': trampoline4,
|
|
2810
|
-
},
|
|
2811
|
-
}));
|
|
2812
|
-
memory0 = exports1.memory;
|
|
2813
|
-
realloc0 = exports1.cabi_realloc;
|
|
2814
|
-
realloc1 = exports2.cabi_import_realloc;
|
|
2815
|
-
({ exports: exports3 } = yield instantiateCore(yield module3, {
|
|
2816
|
-
'': {
|
|
2817
|
-
$imports: exports0.$imports,
|
|
2818
|
-
'0': trampoline11,
|
|
2819
|
-
'1': trampoline12,
|
|
2820
|
-
'10': trampoline17,
|
|
2821
|
-
'11': trampoline18,
|
|
2822
|
-
'12': trampoline19,
|
|
2823
|
-
'13': trampoline20,
|
|
2824
|
-
'14': trampoline21,
|
|
2825
|
-
'15': trampoline22,
|
|
2826
|
-
'16': trampoline23,
|
|
2827
|
-
'17': trampoline24,
|
|
2828
|
-
'18': trampoline25,
|
|
2829
|
-
'19': trampoline26,
|
|
2830
|
-
'2': trampoline13,
|
|
2831
|
-
'3': trampoline14,
|
|
2832
|
-
'4': trampoline15,
|
|
2833
|
-
'5': exports2.fd_write,
|
|
2834
|
-
'6': exports2.environ_get,
|
|
2835
|
-
'7': exports2.environ_sizes_get,
|
|
2836
|
-
'8': exports2.proc_exit,
|
|
2837
|
-
'9': trampoline16,
|
|
2838
|
-
},
|
|
2839
|
-
}));
|
|
2840
|
-
postReturn0 = exports1['cabi_post_arborium:host/host@0.1.0#highlight'];
|
|
2841
|
-
postReturn1 = exports1['cabi_post_arborium:host/host@0.1.0#get-required-languages'];
|
|
2842
|
-
let host010CreateDocument;
|
|
2843
|
-
|
|
2844
|
-
function createDocument(arg0) {
|
|
2845
|
-
var ptr0 = utf8Encode(arg0, realloc0, memory0);
|
|
2846
|
-
var len0 = utf8EncodedLen;
|
|
2847
|
-
_debugLog('[iface="arborium:host/host@0.1.0", function="create-document"][Instruction::CallWasm] enter', {
|
|
2848
|
-
funcName: 'create-document',
|
|
2849
|
-
paramCount: 2,
|
|
2850
|
-
async: false,
|
|
2851
|
-
postReturn: false,
|
|
2852
|
-
});
|
|
2853
|
-
const _wasm_call_currentTaskID = startCurrentTask(0, false, 'host010CreateDocument');
|
|
2854
|
-
const ret = host010CreateDocument(ptr0, len0);
|
|
2855
|
-
endCurrentTask(0);
|
|
2856
|
-
let variant1;
|
|
2857
|
-
switch (dataView(memory0).getUint8(ret + 0, true)) {
|
|
2858
|
-
case 0: {
|
|
2859
|
-
variant1 = undefined;
|
|
2860
|
-
break;
|
|
2861
|
-
}
|
|
2862
|
-
case 1: {
|
|
2863
|
-
variant1 = dataView(memory0).getInt32(ret + 4, true) >>> 0;
|
|
2864
|
-
break;
|
|
2865
|
-
}
|
|
2866
|
-
default: {
|
|
2867
|
-
throw new TypeError('invalid variant discriminant for option');
|
|
2868
|
-
}
|
|
2869
465
|
}
|
|
2870
|
-
|
|
2871
|
-
|
|
2872
|
-
|
|
2873
|
-
async: false,
|
|
2874
|
-
postReturn: false
|
|
2875
|
-
});
|
|
2876
|
-
return variant1;
|
|
2877
|
-
}
|
|
2878
|
-
let host010FreeDocument;
|
|
2879
|
-
|
|
2880
|
-
function freeDocument(arg0) {
|
|
2881
|
-
_debugLog('[iface="arborium:host/host@0.1.0", function="free-document"][Instruction::CallWasm] enter', {
|
|
2882
|
-
funcName: 'free-document',
|
|
2883
|
-
paramCount: 1,
|
|
2884
|
-
async: false,
|
|
2885
|
-
postReturn: false,
|
|
2886
|
-
});
|
|
2887
|
-
const _wasm_call_currentTaskID = startCurrentTask(0, false, 'host010FreeDocument');
|
|
2888
|
-
host010FreeDocument(toUint32(arg0));
|
|
2889
|
-
endCurrentTask(0);
|
|
2890
|
-
_debugLog('[iface="arborium:host/host@0.1.0", function="free-document"][Instruction::Return]', {
|
|
2891
|
-
funcName: 'free-document',
|
|
2892
|
-
paramCount: 0,
|
|
2893
|
-
async: false,
|
|
2894
|
-
postReturn: false
|
|
2895
|
-
});
|
|
2896
|
-
}
|
|
2897
|
-
let host010SetText;
|
|
2898
|
-
|
|
2899
|
-
function setText(arg0, arg1) {
|
|
2900
|
-
var ptr0 = utf8Encode(arg1, realloc0, memory0);
|
|
2901
|
-
var len0 = utf8EncodedLen;
|
|
2902
|
-
_debugLog('[iface="arborium:host/host@0.1.0", function="set-text"][Instruction::CallWasm] enter', {
|
|
2903
|
-
funcName: 'set-text',
|
|
2904
|
-
paramCount: 3,
|
|
2905
|
-
async: false,
|
|
2906
|
-
postReturn: false,
|
|
2907
|
-
});
|
|
2908
|
-
const _wasm_call_currentTaskID = startCurrentTask(0, false, 'host010SetText');
|
|
2909
|
-
host010SetText(toUint32(arg0), ptr0, len0);
|
|
2910
|
-
endCurrentTask(0);
|
|
2911
|
-
_debugLog('[iface="arborium:host/host@0.1.0", function="set-text"][Instruction::Return]', {
|
|
2912
|
-
funcName: 'set-text',
|
|
2913
|
-
paramCount: 0,
|
|
2914
|
-
async: false,
|
|
2915
|
-
postReturn: false
|
|
2916
|
-
});
|
|
2917
|
-
}
|
|
2918
|
-
let host010ApplyEdit;
|
|
2919
|
-
|
|
2920
|
-
function applyEdit(arg0, arg1, arg2) {
|
|
2921
|
-
var ptr0 = utf8Encode(arg1, realloc0, memory0);
|
|
2922
|
-
var len0 = utf8EncodedLen;
|
|
2923
|
-
var {startByte: v1_0, oldEndByte: v1_1, newEndByte: v1_2, startRow: v1_3, startCol: v1_4, oldEndRow: v1_5, oldEndCol: v1_6, newEndRow: v1_7, newEndCol: v1_8 } = arg2;
|
|
2924
|
-
_debugLog('[iface="arborium:host/host@0.1.0", function="apply-edit"][Instruction::CallWasm] enter', {
|
|
2925
|
-
funcName: 'apply-edit',
|
|
2926
|
-
paramCount: 12,
|
|
2927
|
-
async: false,
|
|
2928
|
-
postReturn: false,
|
|
2929
|
-
});
|
|
2930
|
-
const _wasm_call_currentTaskID = startCurrentTask(0, false, 'host010ApplyEdit');
|
|
2931
|
-
host010ApplyEdit(toUint32(arg0), ptr0, len0, toUint32(v1_0), toUint32(v1_1), toUint32(v1_2), toUint32(v1_3), toUint32(v1_4), toUint32(v1_5), toUint32(v1_6), toUint32(v1_7), toUint32(v1_8));
|
|
2932
|
-
endCurrentTask(0);
|
|
2933
|
-
_debugLog('[iface="arborium:host/host@0.1.0", function="apply-edit"][Instruction::Return]', {
|
|
2934
|
-
funcName: 'apply-edit',
|
|
2935
|
-
paramCount: 0,
|
|
2936
|
-
async: false,
|
|
2937
|
-
postReturn: false
|
|
2938
|
-
});
|
|
2939
|
-
}
|
|
2940
|
-
let host010Highlight;
|
|
2941
|
-
|
|
2942
|
-
function highlight(arg0, arg1) {
|
|
2943
|
-
_debugLog('[iface="arborium:host/host@0.1.0", function="highlight"][Instruction::CallWasm] enter', {
|
|
2944
|
-
funcName: 'highlight',
|
|
2945
|
-
paramCount: 2,
|
|
2946
|
-
async: false,
|
|
2947
|
-
postReturn: true,
|
|
2948
|
-
});
|
|
2949
|
-
const _wasm_call_currentTaskID = startCurrentTask(0, false, 'host010Highlight');
|
|
2950
|
-
const ret = host010Highlight(toUint32(arg0), toUint32(arg1));
|
|
2951
|
-
endCurrentTask(0);
|
|
2952
|
-
var len2 = dataView(memory0).getUint32(ret + 4, true);
|
|
2953
|
-
var base2 = dataView(memory0).getUint32(ret + 0, true);
|
|
2954
|
-
var result2 = [];
|
|
2955
|
-
for (let i = 0; i < len2; i++) {
|
|
2956
|
-
const base = base2 + i * 24;
|
|
2957
|
-
var ptr0 = dataView(memory0).getUint32(base + 8, true);
|
|
2958
|
-
var len0 = dataView(memory0).getUint32(base + 12, true);
|
|
2959
|
-
var result0 = utf8Decoder.decode(new Uint8Array(memory0.buffer, ptr0, len0));
|
|
2960
|
-
var ptr1 = dataView(memory0).getUint32(base + 16, true);
|
|
2961
|
-
var len1 = dataView(memory0).getUint32(base + 20, true);
|
|
2962
|
-
var result1 = utf8Decoder.decode(new Uint8Array(memory0.buffer, ptr1, len1));
|
|
2963
|
-
result2.push({
|
|
2964
|
-
start: dataView(memory0).getInt32(base + 0, true) >>> 0,
|
|
2965
|
-
end: dataView(memory0).getInt32(base + 4, true) >>> 0,
|
|
2966
|
-
capture: result0,
|
|
2967
|
-
language: result1,
|
|
2968
|
-
});
|
|
2969
|
-
}
|
|
2970
|
-
_debugLog('[iface="arborium:host/host@0.1.0", function="highlight"][Instruction::Return]', {
|
|
2971
|
-
funcName: 'highlight',
|
|
2972
|
-
paramCount: 1,
|
|
2973
|
-
async: false,
|
|
2974
|
-
postReturn: true
|
|
2975
|
-
});
|
|
2976
|
-
const retCopy = {
|
|
2977
|
-
spans: result2,
|
|
2978
|
-
};
|
|
2979
|
-
|
|
2980
|
-
let cstate = getOrCreateAsyncState(0);
|
|
2981
|
-
cstate.mayLeave = false;
|
|
2982
|
-
postReturn0(ret);
|
|
2983
|
-
cstate.mayLeave = true;
|
|
2984
|
-
return retCopy;
|
|
2985
|
-
|
|
2986
|
-
}
|
|
2987
|
-
let host010Cancel;
|
|
2988
|
-
|
|
2989
|
-
function cancel(arg0) {
|
|
2990
|
-
_debugLog('[iface="arborium:host/host@0.1.0", function="cancel"][Instruction::CallWasm] enter', {
|
|
2991
|
-
funcName: 'cancel',
|
|
2992
|
-
paramCount: 1,
|
|
2993
|
-
async: false,
|
|
2994
|
-
postReturn: false,
|
|
2995
|
-
});
|
|
2996
|
-
const _wasm_call_currentTaskID = startCurrentTask(0, false, 'host010Cancel');
|
|
2997
|
-
host010Cancel(toUint32(arg0));
|
|
2998
|
-
endCurrentTask(0);
|
|
2999
|
-
_debugLog('[iface="arborium:host/host@0.1.0", function="cancel"][Instruction::Return]', {
|
|
3000
|
-
funcName: 'cancel',
|
|
3001
|
-
paramCount: 0,
|
|
3002
|
-
async: false,
|
|
3003
|
-
postReturn: false
|
|
3004
|
-
});
|
|
3005
|
-
}
|
|
3006
|
-
let host010GetRequiredLanguages;
|
|
3007
|
-
|
|
3008
|
-
function getRequiredLanguages(arg0) {
|
|
3009
|
-
_debugLog('[iface="arborium:host/host@0.1.0", function="get-required-languages"][Instruction::CallWasm] enter', {
|
|
3010
|
-
funcName: 'get-required-languages',
|
|
3011
|
-
paramCount: 1,
|
|
3012
|
-
async: false,
|
|
3013
|
-
postReturn: true,
|
|
3014
|
-
});
|
|
3015
|
-
const _wasm_call_currentTaskID = startCurrentTask(0, false, 'host010GetRequiredLanguages');
|
|
3016
|
-
const ret = host010GetRequiredLanguages(toUint32(arg0));
|
|
3017
|
-
endCurrentTask(0);
|
|
3018
|
-
var len1 = dataView(memory0).getUint32(ret + 4, true);
|
|
3019
|
-
var base1 = dataView(memory0).getUint32(ret + 0, true);
|
|
3020
|
-
var result1 = [];
|
|
3021
|
-
for (let i = 0; i < len1; i++) {
|
|
3022
|
-
const base = base1 + i * 8;
|
|
3023
|
-
var ptr0 = dataView(memory0).getUint32(base + 0, true);
|
|
3024
|
-
var len0 = dataView(memory0).getUint32(base + 4, true);
|
|
3025
|
-
var result0 = utf8Decoder.decode(new Uint8Array(memory0.buffer, ptr0, len0));
|
|
3026
|
-
result1.push(result0);
|
|
466
|
+
|
|
467
|
+
if (typeof module_or_path === 'undefined') {
|
|
468
|
+
module_or_path = new URL('arborium_host_bg.wasm', import.meta.url);
|
|
3027
469
|
}
|
|
3028
|
-
|
|
3029
|
-
|
|
3030
|
-
|
|
3031
|
-
|
|
3032
|
-
postReturn: true
|
|
3033
|
-
});
|
|
3034
|
-
const retCopy = result1;
|
|
3035
|
-
|
|
3036
|
-
let cstate = getOrCreateAsyncState(0);
|
|
3037
|
-
cstate.mayLeave = false;
|
|
3038
|
-
postReturn1(ret);
|
|
3039
|
-
cstate.mayLeave = true;
|
|
3040
|
-
return retCopy;
|
|
3041
|
-
|
|
3042
|
-
}
|
|
3043
|
-
host010CreateDocument = exports1['arborium:host/host@0.1.0#create-document'];
|
|
3044
|
-
host010FreeDocument = exports1['arborium:host/host@0.1.0#free-document'];
|
|
3045
|
-
host010SetText = exports1['arborium:host/host@0.1.0#set-text'];
|
|
3046
|
-
host010ApplyEdit = exports1['arborium:host/host@0.1.0#apply-edit'];
|
|
3047
|
-
host010Highlight = exports1['arborium:host/host@0.1.0#highlight'];
|
|
3048
|
-
host010Cancel = exports1['arborium:host/host@0.1.0#cancel'];
|
|
3049
|
-
host010GetRequiredLanguages = exports1['arborium:host/host@0.1.0#get-required-languages'];
|
|
3050
|
-
const host010 = {
|
|
3051
|
-
applyEdit: applyEdit,
|
|
3052
|
-
cancel: cancel,
|
|
3053
|
-
createDocument: createDocument,
|
|
3054
|
-
freeDocument: freeDocument,
|
|
3055
|
-
getRequiredLanguages: getRequiredLanguages,
|
|
3056
|
-
highlight: highlight,
|
|
3057
|
-
setText: setText,
|
|
3058
|
-
|
|
3059
|
-
};
|
|
3060
|
-
|
|
3061
|
-
return { host: host010, 'arborium:host/host@0.1.0': host010, };
|
|
3062
|
-
})();
|
|
3063
|
-
let promise, resolve, reject;
|
|
3064
|
-
function runNext (value) {
|
|
3065
|
-
try {
|
|
3066
|
-
let done;
|
|
3067
|
-
do {
|
|
3068
|
-
({ value, done } = gen.next(value));
|
|
3069
|
-
} while (!(value instanceof Promise) && !done);
|
|
3070
|
-
if (done) {
|
|
3071
|
-
if (resolve) return resolve(value);
|
|
3072
|
-
else return value;
|
|
470
|
+
const imports = __wbg_get_imports();
|
|
471
|
+
|
|
472
|
+
if (typeof module_or_path === 'string' || (typeof Request === 'function' && module_or_path instanceof Request) || (typeof URL === 'function' && module_or_path instanceof URL)) {
|
|
473
|
+
module_or_path = fetch(module_or_path);
|
|
3073
474
|
}
|
|
3074
|
-
|
|
3075
|
-
|
|
3076
|
-
|
|
3077
|
-
|
|
3078
|
-
if (reject) reject(e);
|
|
3079
|
-
else throw e;
|
|
3080
|
-
}
|
|
3081
|
-
}
|
|
3082
|
-
const maybeSyncReturn = runNext(null);
|
|
3083
|
-
return promise || maybeSyncReturn;
|
|
475
|
+
|
|
476
|
+
const { instance, module } = await __wbg_load(await module_or_path, imports);
|
|
477
|
+
|
|
478
|
+
return __wbg_finalize_init(instance, module);
|
|
3084
479
|
}
|
|
480
|
+
|
|
481
|
+
export { initSync };
|
|
482
|
+
export default __wbg_init;
|