11ty-plugin-giallo 0.1.0-alpha.0 → 0.1.0-alpha.1
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/.eleventy.js +11 -1
- package/.helix/ignore +4 -0
- package/dist/giallo_js.core3.wasm +0 -0
- package/dist/giallo_js.core4.wasm +0 -0
- package/dist/giallo_js.d.ts +55 -12
- package/dist/giallo_js.js +2362 -2384
- package/package.json +1 -1
package/dist/giallo_js.js
CHANGED
|
@@ -1,654 +1,639 @@
|
|
|
1
|
-
|
|
2
|
-
import { preopens, types } from '@bytecodealliance/preview2-shim/filesystem';
|
|
3
|
-
import { error, streams } from '@bytecodealliance/preview2-shim/io';
|
|
4
|
-
import { insecureSeed as insecureSeed$1 } from '@bytecodealliance/preview2-shim/random';
|
|
5
|
-
const { getEnvironment } = environment;
|
|
6
|
-
const { exit } = exit$1;
|
|
7
|
-
const { getStderr } = stderr;
|
|
8
|
-
const { getStdin } = stdin;
|
|
9
|
-
const { getStdout } = stdout;
|
|
10
|
-
const { getDirectories } = preopens;
|
|
11
|
-
const { Descriptor,
|
|
12
|
-
filesystemErrorCode } = types;
|
|
13
|
-
const { Error: Error$1 } = error;
|
|
14
|
-
const { InputStream,
|
|
15
|
-
OutputStream } = streams;
|
|
16
|
-
const { insecureSeed } = insecureSeed$1;
|
|
17
|
-
|
|
18
|
-
let dv = new DataView(new ArrayBuffer());
|
|
19
|
-
const dataView = mem => dv.buffer === mem.buffer ? dv : dv = new DataView(mem.buffer);
|
|
20
|
-
|
|
21
|
-
const toUint64 = val => BigInt.asUintN(64, BigInt(val));
|
|
22
|
-
|
|
23
|
-
function toUint32(val) {
|
|
24
|
-
return val >>> 0;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
const utf8Decoder = new TextDecoder();
|
|
28
|
-
|
|
29
|
-
const utf8Encoder = new TextEncoder();
|
|
30
|
-
let utf8EncodedLen = 0;
|
|
31
|
-
function utf8Encode(s, realloc, memory) {
|
|
32
|
-
if (typeof s !== 'string') throw new TypeError('expected a string');
|
|
33
|
-
if (s.length === 0) {
|
|
34
|
-
utf8EncodedLen = 0;
|
|
35
|
-
return 1;
|
|
36
|
-
}
|
|
37
|
-
let buf = utf8Encoder.encode(s);
|
|
38
|
-
let ptr = realloc(0, 0, 1, buf.length);
|
|
39
|
-
new Uint8Array(memory.buffer).set(buf, ptr);
|
|
40
|
-
utf8EncodedLen = buf.length;
|
|
41
|
-
return ptr;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
const T_FLAG = 1 << 30;
|
|
45
|
-
|
|
46
|
-
function rscTableCreateOwn (table, rep) {
|
|
47
|
-
const free = table[0] & ~T_FLAG;
|
|
48
|
-
if (free === 0) {
|
|
49
|
-
table.push(0);
|
|
50
|
-
table.push(rep | T_FLAG);
|
|
51
|
-
return (table.length >> 1) - 1;
|
|
52
|
-
}
|
|
53
|
-
table[0] = table[free << 1];
|
|
54
|
-
table[free << 1] = 0;
|
|
55
|
-
table[(free << 1) + 1] = rep | T_FLAG;
|
|
56
|
-
return free;
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
function rscTableRemove (table, handle) {
|
|
60
|
-
const scope = table[handle << 1];
|
|
61
|
-
const val = table[(handle << 1) + 1];
|
|
62
|
-
const own = (val & T_FLAG) !== 0;
|
|
63
|
-
const rep = val & ~T_FLAG;
|
|
64
|
-
if (val === 0 || (scope & T_FLAG) !== 0) throw new TypeError('Invalid handle');
|
|
65
|
-
table[handle << 1] = table[0] | T_FLAG;
|
|
66
|
-
table[0] = handle | T_FLAG;
|
|
67
|
-
return { rep, scope, own };
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
let curResourceBorrows = [];
|
|
71
|
-
|
|
72
|
-
let NEXT_TASK_ID = 0n;
|
|
73
|
-
function startCurrentTask(componentIdx, isAsync, entryFnName) {
|
|
74
|
-
_debugLog('[startCurrentTask()] args', { componentIdx, isAsync });
|
|
75
|
-
if (componentIdx === undefined || componentIdx === null) {
|
|
76
|
-
throw new Error('missing/invalid component instance index while starting task');
|
|
77
|
-
}
|
|
78
|
-
const tasks = ASYNC_TASKS_BY_COMPONENT_IDX.get(componentIdx);
|
|
1
|
+
export function instantiate(getCoreModule, imports, instantiateCore = (module, importObject) => new WebAssembly.Instance(module, importObject)) {
|
|
79
2
|
|
|
80
|
-
|
|
81
|
-
const
|
|
82
|
-
const newTaskMeta = { id: nextId, componentIdx, task: newTask };
|
|
3
|
+
let dv = new DataView(new ArrayBuffer());
|
|
4
|
+
const dataView = mem => dv.buffer === mem.buffer ? dv : dv = new DataView(mem.buffer);
|
|
83
5
|
|
|
84
|
-
|
|
85
|
-
ASYNC_CURRENT_COMPONENT_IDXS.push(componentIdx);
|
|
6
|
+
const toUint64 = val => BigInt.asUintN(64, BigInt(val));
|
|
86
7
|
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
return nextId;
|
|
90
|
-
} else {
|
|
91
|
-
tasks.push(newTaskMeta);
|
|
8
|
+
function toUint32(val) {
|
|
9
|
+
return val >>> 0;
|
|
92
10
|
}
|
|
93
11
|
|
|
94
|
-
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
function endCurrentTask(componentIdx, taskId) {
|
|
98
|
-
_debugLog('[endCurrentTask()] args', { componentIdx });
|
|
99
|
-
componentIdx ??= ASYNC_CURRENT_COMPONENT_IDXS.at(-1);
|
|
100
|
-
taskId ??= ASYNC_CURRENT_TASK_IDS.at(-1);
|
|
101
|
-
if (componentIdx === undefined || componentIdx === null) {
|
|
102
|
-
throw new Error('missing/invalid component instance index while ending current task');
|
|
103
|
-
}
|
|
104
|
-
const tasks = ASYNC_TASKS_BY_COMPONENT_IDX.get(componentIdx);
|
|
105
|
-
if (!tasks || !Array.isArray(tasks)) {
|
|
106
|
-
throw new Error('missing/invalid tasks for component instance while ending task');
|
|
107
|
-
}
|
|
108
|
-
if (tasks.length == 0) {
|
|
109
|
-
throw new Error('no current task(s) for component instance while ending task');
|
|
110
|
-
}
|
|
12
|
+
const utf8Decoder = new TextDecoder();
|
|
111
13
|
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
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;
|
|
116
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;
|
|
117
27
|
}
|
|
118
28
|
|
|
119
|
-
|
|
120
|
-
ASYNC_CURRENT_COMPONENT_IDXS.pop();
|
|
29
|
+
const T_FLAG = 1 << 30;
|
|
121
30
|
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
CANCEL_DELIVERED: 'cancel-delivered',
|
|
134
|
-
RESOLVED: 'resolved',
|
|
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;
|
|
135
42
|
}
|
|
136
43
|
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
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 };
|
|
140
53
|
}
|
|
141
54
|
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
cancelled = false;
|
|
152
|
-
requested = false;
|
|
153
|
-
alwaysTaskReturn = false;
|
|
154
|
-
|
|
155
|
-
returnCalls = 0;
|
|
156
|
-
storage = [0, 0];
|
|
157
|
-
borrowedHandles = {};
|
|
158
|
-
|
|
159
|
-
awaitableResume = null;
|
|
160
|
-
awaitableCancel = null;
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
constructor(opts) {
|
|
164
|
-
if (opts?.id === undefined) { throw new TypeError('missing task ID during task creation'); }
|
|
165
|
-
this.#id = opts.id;
|
|
166
|
-
if (opts?.componentIdx === undefined) {
|
|
167
|
-
throw new TypeError('missing component id during task creation');
|
|
168
|
-
}
|
|
169
|
-
this.#componentIdx = opts.componentIdx;
|
|
170
|
-
this.#state = AsyncTask.State.INITIAL;
|
|
171
|
-
this.#isAsync = opts?.isAsync ?? false;
|
|
172
|
-
this.#entryFnName = opts.entryFnName;
|
|
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);
|
|
173
64
|
|
|
174
|
-
const
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
reject: rejectCompletionPromise,
|
|
178
|
-
} = Promise.withResolvers();
|
|
179
|
-
this.#completionPromise = completionPromise;
|
|
65
|
+
const nextId = ++NEXT_TASK_ID;
|
|
66
|
+
const newTask = new AsyncTask({ id: nextId, componentIdx, isAsync, entryFnName });
|
|
67
|
+
const newTaskMeta = { id: nextId, componentIdx, task: newTask };
|
|
180
68
|
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
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);
|
|
184
77
|
}
|
|
78
|
+
|
|
79
|
+
return nextId;
|
|
185
80
|
}
|
|
186
81
|
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
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();
|
|
210
108
|
}
|
|
109
|
+
const ASYNC_TASKS_BY_COMPONENT_IDX = new Map();
|
|
110
|
+
const ASYNC_CURRENT_TASK_IDS = [];
|
|
111
|
+
const ASYNC_CURRENT_COMPONENT_IDXS = [];
|
|
211
112
|
|
|
212
|
-
|
|
213
|
-
|
|
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
|
+
}
|
|
214
121
|
|
|
215
|
-
|
|
216
|
-
|
|
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 = {};
|
|
217
143
|
|
|
218
|
-
|
|
144
|
+
awaitableResume = null;
|
|
145
|
+
awaitableCancel = null;
|
|
219
146
|
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
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;
|
|
225
158
|
|
|
226
|
-
const
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
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 });
|
|
235
192
|
return false;
|
|
236
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
|
+
}
|
|
237
242
|
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
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();
|
|
241
271
|
}
|
|
242
|
-
|
|
272
|
+
|
|
273
|
+
waitableSet.numWaiting -= 1;
|
|
274
|
+
return event;
|
|
243
275
|
}
|
|
244
276
|
|
|
245
|
-
|
|
277
|
+
waitForEventSync(opts) {
|
|
278
|
+
throw new Error('AsyncTask#yieldSync() not implemented')
|
|
279
|
+
}
|
|
246
280
|
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
281
|
+
async pollForEvent(opts) {
|
|
282
|
+
const { waitableSetRep, isAsync } = opts;
|
|
283
|
+
_debugLog('[AsyncTask#pollForEvent()] args', { taskID: this.#id, waitableSetRep, isAsync });
|
|
284
|
+
|
|
285
|
+
if (this.#isAsync !== isAsync) {
|
|
286
|
+
throw new Error('async pollForEvent called on non-async task');
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
throw new Error('AsyncTask#pollForEvent() not implemented');
|
|
290
|
+
}
|
|
253
291
|
|
|
254
|
-
|
|
255
|
-
throw new Error('
|
|
292
|
+
pollForEventSync(opts) {
|
|
293
|
+
throw new Error('AsyncTask#yieldSync() not implemented')
|
|
256
294
|
}
|
|
257
295
|
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
296
|
+
async blockOn(opts) {
|
|
297
|
+
const { awaitable, isCancellable, forCallback } = opts;
|
|
298
|
+
_debugLog('[AsyncTask#blockOn()] args', { taskID: this.#id, awaitable, isCancellable, forCallback });
|
|
299
|
+
|
|
300
|
+
if (awaitable.resolved() && !ASYNC_DETERMINISM && _coinFlip()) {
|
|
301
|
+
return AsyncTask.BlockResult.NOT_CANCELLED;
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
const cstate = getOrCreateAsyncState(this.#componentIdx);
|
|
305
|
+
if (forCallback) { cstate.exclusiveRelease(); }
|
|
306
|
+
|
|
307
|
+
let cancelled = await this.onBlock(awaitable);
|
|
308
|
+
if (cancelled === AsyncTask.BlockResult.CANCELLED && !isCancellable) {
|
|
309
|
+
const secondCancel = await this.onBlock(awaitable);
|
|
310
|
+
if (secondCancel !== AsyncTask.BlockResult.NOT_CANCELLED) {
|
|
311
|
+
throw new Error('uncancellable task was canceled despite second onBlock()');
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
if (forCallback) {
|
|
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');
|
|
329
|
+
}
|
|
330
|
+
if (isCancellable) {
|
|
331
|
+
this.#state = AsyncTask.State.CANCELLED;
|
|
332
|
+
return AsyncTask.BlockResult.CANCELLED;
|
|
333
|
+
} else {
|
|
334
|
+
this.#state = AsyncTask.State.CANCEL_PENDING;
|
|
335
|
+
return AsyncTask.BlockResult.NOT_CANCELLED;
|
|
336
|
+
}
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
return AsyncTask.BlockResult.NOT_CANCELLED;
|
|
263
340
|
}
|
|
264
341
|
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
342
|
+
async onBlock(awaitable) {
|
|
343
|
+
_debugLog('[AsyncTask#onBlock()] args', { taskID: this.#id, awaitable });
|
|
344
|
+
if (!(awaitable instanceof Awaitable)) {
|
|
345
|
+
throw new Error('invalid awaitable during onBlock');
|
|
346
|
+
}
|
|
347
|
+
|
|
348
|
+
// Build a promise that this task can await on which resolves when it is awoken
|
|
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
|
+
}
|
|
370
|
+
}
|
|
268
371
|
|
|
269
|
-
|
|
270
|
-
|
|
372
|
+
async asyncOnBlock(awaitable) {
|
|
373
|
+
_debugLog('[AsyncTask#asyncOnBlock()] args', { taskID: this.#id, awaitable });
|
|
374
|
+
if (!(awaitable instanceof Awaitable)) {
|
|
375
|
+
throw new Error('invalid awaitable during onBlock');
|
|
376
|
+
}
|
|
377
|
+
// TODO: watch for waitable AND cancellation
|
|
378
|
+
// TODO: if it WAS cancelled:
|
|
379
|
+
// - return true
|
|
380
|
+
// - only once per subtask
|
|
381
|
+
// - do not wait on the scheduler
|
|
382
|
+
// - control flow should go to the subtask (only once)
|
|
383
|
+
// - Once subtask blocks/resolves, reqlinquishControl() will tehn resolve request_cancel_end (without scheduler lock release)
|
|
384
|
+
// - control flow goes back to request_cancel
|
|
385
|
+
//
|
|
386
|
+
// Subtask cancellation should work similarly to an async import call -- runs sync up until
|
|
387
|
+
// the subtask blocks or resolves
|
|
388
|
+
//
|
|
389
|
+
throw new Error('AsyncTask#asyncOnBlock() not yet implemented');
|
|
390
|
+
}
|
|
271
391
|
|
|
272
|
-
|
|
273
|
-
const
|
|
274
|
-
|
|
275
|
-
|
|
392
|
+
async yield(opts) {
|
|
393
|
+
const { isCancellable, forCallback } = opts;
|
|
394
|
+
_debugLog('[AsyncTask#yield()] args', { taskID: this.#id, isCancellable, forCallback });
|
|
395
|
+
|
|
396
|
+
if (isCancellable && this.status === AsyncTask.State.CANCEL_PENDING) {
|
|
397
|
+
this.#state = AsyncTask.State.CANCELLED;
|
|
398
|
+
return {
|
|
399
|
+
code: ASYNC_EVENT_CODE.TASK_CANCELLED,
|
|
400
|
+
payload: [0, 0],
|
|
401
|
+
};
|
|
402
|
+
}
|
|
403
|
+
|
|
404
|
+
// TODO: Awaitables need to *always* trigger the parking mechanism when they're done...?
|
|
405
|
+
// TODO: Component async state should remember which awaitables are done and work to clear tasks waiting
|
|
406
|
+
|
|
407
|
+
const blockResult = await this.blockOn({
|
|
408
|
+
awaitable: new Awaitable(new Promise(resolve => setTimeout(resolve, 0))),
|
|
409
|
+
isCancellable,
|
|
410
|
+
forCallback,
|
|
411
|
+
});
|
|
412
|
+
|
|
413
|
+
if (blockResult === AsyncTask.BlockResult.CANCELLED) {
|
|
276
414
|
if (this.#state !== AsyncTask.State.INITIAL) {
|
|
277
415
|
throw new Error('task should be in initial state found [' + this.#state + ']');
|
|
278
416
|
}
|
|
279
417
|
this.#state = AsyncTask.State.CANCELLED;
|
|
280
418
|
return {
|
|
281
419
|
code: ASYNC_EVENT_CODE.TASK_CANCELLED,
|
|
420
|
+
payload: [0, 0],
|
|
282
421
|
};
|
|
283
422
|
}
|
|
284
423
|
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
return event;
|
|
290
|
-
}
|
|
291
|
-
|
|
292
|
-
waitForEventSync(opts) {
|
|
293
|
-
throw new Error('AsyncTask#yieldSync() not implemented')
|
|
294
|
-
}
|
|
295
|
-
|
|
296
|
-
async pollForEvent(opts) {
|
|
297
|
-
const { waitableSetRep, isAsync } = opts;
|
|
298
|
-
_debugLog('[AsyncTask#pollForEvent()] args', { taskID: this.#id, waitableSetRep, isAsync });
|
|
299
|
-
|
|
300
|
-
if (this.#isAsync !== isAsync) {
|
|
301
|
-
throw new Error('async pollForEvent called on non-async task');
|
|
424
|
+
return {
|
|
425
|
+
code: ASYNC_EVENT_CODE.NONE,
|
|
426
|
+
payload: [0, 0],
|
|
427
|
+
};
|
|
302
428
|
}
|
|
303
429
|
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
pollForEventSync(opts) {
|
|
308
|
-
throw new Error('AsyncTask#yieldSync() not implemented')
|
|
309
|
-
}
|
|
310
|
-
|
|
311
|
-
async blockOn(opts) {
|
|
312
|
-
const { awaitable, isCancellable, forCallback } = opts;
|
|
313
|
-
_debugLog('[AsyncTask#blockOn()] args', { taskID: this.#id, awaitable, isCancellable, forCallback });
|
|
314
|
-
|
|
315
|
-
if (awaitable.resolved() && !ASYNC_DETERMINISM && _coinFlip()) {
|
|
316
|
-
return AsyncTask.BlockResult.NOT_CANCELLED;
|
|
430
|
+
yieldSync(opts) {
|
|
431
|
+
throw new Error('AsyncTask#yieldSync() not implemented')
|
|
317
432
|
}
|
|
318
433
|
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
if (cancelled === AsyncTask.BlockResult.CANCELLED && !isCancellable) {
|
|
324
|
-
const secondCancel = await this.onBlock(awaitable);
|
|
325
|
-
if (secondCancel !== AsyncTask.BlockResult.NOT_CANCELLED) {
|
|
326
|
-
throw new Error('uncancellable task was canceled despite second onBlock()');
|
|
434
|
+
cancel() {
|
|
435
|
+
_debugLog('[AsyncTask#cancel()] args', { });
|
|
436
|
+
if (!this.taskState() !== AsyncTask.State.CANCEL_DELIVERED) {
|
|
437
|
+
throw new Error('invalid task state for cancellation');
|
|
327
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;
|
|
328
443
|
}
|
|
329
444
|
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
const secondCancel = await this.onBlock(acquired);
|
|
335
|
-
if (secondCancel !== AsyncTask.BlockResult.NOT_CANCELLED) {
|
|
336
|
-
throw new Error('uncancellable callback task was canceled despite second onBlock()');
|
|
337
|
-
}
|
|
445
|
+
resolve(results) {
|
|
446
|
+
_debugLog('[AsyncTask#resolve()] args', { results });
|
|
447
|
+
if (this.#state === AsyncTask.State.RESOLVED) {
|
|
448
|
+
throw new Error('task is already resolved');
|
|
338
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;
|
|
339
453
|
}
|
|
340
454
|
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
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');
|
|
344
461
|
}
|
|
345
|
-
if (
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
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');
|
|
351
470
|
}
|
|
471
|
+
state.inSyncExportCall = false;
|
|
472
|
+
|
|
473
|
+
this.startPendingTask();
|
|
352
474
|
}
|
|
353
475
|
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
async onBlock(awaitable) {
|
|
358
|
-
_debugLog('[AsyncTask#onBlock()] args', { taskID: this.#id, awaitable });
|
|
359
|
-
if (!(awaitable instanceof Awaitable)) {
|
|
360
|
-
throw new Error('invalid awaitable during onBlock');
|
|
476
|
+
startPendingTask(args) {
|
|
477
|
+
_debugLog('[AsyncTask#startPendingTask()] args', args);
|
|
478
|
+
throw new Error('AsyncTask#startPendingTask() not implemented');
|
|
361
479
|
}
|
|
362
480
|
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
}
|
|
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
|
+
}
|
|
373
491
|
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
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
|
+
}
|
|
377
497
|
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
return
|
|
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;
|
|
384
504
|
}
|
|
385
505
|
}
|
|
386
506
|
|
|
387
|
-
|
|
388
|
-
_debugLog('[
|
|
389
|
-
if (!(
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
//
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
// - Once subtask blocks/resolves, reqlinquishControl() will tehn resolve request_cancel_end (without scheduler lock release)
|
|
399
|
-
// - control flow goes back to request_cancel
|
|
400
|
-
//
|
|
401
|
-
// Subtask cancellation should work similarly to an async import call -- runs sync up until
|
|
402
|
-
// the subtask blocks or resolves
|
|
403
|
-
//
|
|
404
|
-
throw new Error('AsyncTask#asyncOnBlock() not yet implemented');
|
|
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];
|
|
405
518
|
}
|
|
519
|
+
const ASYNC_STATE = new Map();
|
|
406
520
|
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
if (isCancellable && this.status === AsyncTask.State.CANCEL_PENDING) {
|
|
412
|
-
this.#state = AsyncTask.State.CANCELLED;
|
|
413
|
-
return {
|
|
414
|
-
code: ASYNC_EVENT_CODE.TASK_CANCELLED,
|
|
415
|
-
payload: [0, 0],
|
|
416
|
-
};
|
|
521
|
+
function getOrCreateAsyncState(componentIdx, init) {
|
|
522
|
+
if (!ASYNC_STATE.has(componentIdx)) {
|
|
523
|
+
ASYNC_STATE.set(componentIdx, new ComponentAsyncState());
|
|
417
524
|
}
|
|
525
|
+
return ASYNC_STATE.get(componentIdx);
|
|
526
|
+
}
|
|
527
|
+
|
|
528
|
+
class ComponentAsyncState {
|
|
529
|
+
#callingAsyncImport = false;
|
|
530
|
+
#syncImportWait = Promise.withResolvers();
|
|
531
|
+
#lock = null;
|
|
418
532
|
|
|
419
|
-
|
|
420
|
-
|
|
533
|
+
mayLeave = true;
|
|
534
|
+
waitableSets = new RepTable();
|
|
535
|
+
waitables = new RepTable();
|
|
421
536
|
|
|
422
|
-
|
|
423
|
-
awaitable: new Awaitable(new Promise(resolve => setTimeout(resolve, 0))),
|
|
424
|
-
isCancellable,
|
|
425
|
-
forCallback,
|
|
426
|
-
});
|
|
537
|
+
#parkedTasks = new Map();
|
|
427
538
|
|
|
428
|
-
|
|
429
|
-
if (
|
|
430
|
-
|
|
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();
|
|
431
546
|
}
|
|
432
|
-
this.#state = AsyncTask.State.CANCELLED;
|
|
433
|
-
return {
|
|
434
|
-
code: ASYNC_EVENT_CODE.TASK_CANCELLED,
|
|
435
|
-
payload: [0, 0],
|
|
436
|
-
};
|
|
437
547
|
}
|
|
438
548
|
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
}
|
|
444
|
-
|
|
445
|
-
yieldSync(opts) {
|
|
446
|
-
throw new Error('AsyncTask#yieldSync() not implemented')
|
|
447
|
-
}
|
|
448
|
-
|
|
449
|
-
cancel() {
|
|
450
|
-
_debugLog('[AsyncTask#cancel()] args', { });
|
|
451
|
-
if (!this.taskState() !== AsyncTask.State.CANCEL_DELIVERED) {
|
|
452
|
-
throw new Error('invalid task state for cancellation');
|
|
549
|
+
#notifySyncImportEnd() {
|
|
550
|
+
const existing = this.#syncImportWait;
|
|
551
|
+
this.#syncImportWait = Promise.withResolvers();
|
|
552
|
+
existing.resolve();
|
|
453
553
|
}
|
|
454
|
-
if (this.borrowedHandles.length > 0) { throw new Error('task still has borrow handles'); }
|
|
455
554
|
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
}
|
|
459
|
-
|
|
460
|
-
resolve(results) {
|
|
461
|
-
_debugLog('[AsyncTask#resolve()] args', { results });
|
|
462
|
-
if (this.#state === AsyncTask.State.RESOLVED) {
|
|
463
|
-
throw new Error('task is already resolved');
|
|
555
|
+
async waitForSyncImportCallEnd() {
|
|
556
|
+
await this.#syncImportWait.promise;
|
|
464
557
|
}
|
|
465
|
-
if (this.borrowedHandles.length > 0) { throw new Error('task still has borrow handles'); }
|
|
466
|
-
this.#onResolve(results.length === 1 ? results[0] : results);
|
|
467
|
-
this.#state = AsyncTask.State.RESOLVED;
|
|
468
|
-
}
|
|
469
|
-
|
|
470
|
-
exit() {
|
|
471
|
-
_debugLog('[AsyncTask#exit()] args', { });
|
|
472
558
|
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
throw new
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
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);
|
|
479
572
|
}
|
|
480
573
|
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
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();
|
|
485
591
|
}
|
|
486
|
-
state.inSyncExportCall = false;
|
|
487
592
|
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
startPendingTask(args) {
|
|
492
|
-
_debugLog('[AsyncTask#startPendingTask()] args', args);
|
|
493
|
-
throw new Error('AsyncTask#startPendingTask() not implemented');
|
|
494
|
-
}
|
|
495
|
-
|
|
496
|
-
createSubtask(args) {
|
|
497
|
-
_debugLog('[AsyncTask#createSubtask()] args', args);
|
|
498
|
-
const newSubtask = new AsyncSubtask({
|
|
499
|
-
componentIdx: this.componentIdx(),
|
|
500
|
-
taskID: this.id(),
|
|
501
|
-
memoryIdx: args?.memoryIdx,
|
|
502
|
-
});
|
|
503
|
-
this.#subtasks.push(newSubtask);
|
|
504
|
-
return newSubtask;
|
|
505
|
-
}
|
|
506
|
-
|
|
507
|
-
currentSubtask() {
|
|
508
|
-
_debugLog('[AsyncTask#currentSubtask()]');
|
|
509
|
-
if (this.#subtasks.length === 0) { throw new Error('no current subtask'); }
|
|
510
|
-
return this.#subtasks.at(-1);
|
|
511
|
-
}
|
|
512
|
-
|
|
513
|
-
endCurrentSubtask() {
|
|
514
|
-
_debugLog('[AsyncTask#endCurrentSubtask()]');
|
|
515
|
-
if (this.#subtasks.length === 0) { throw new Error('cannot end current subtask: no current subtask'); }
|
|
516
|
-
const subtask = this.#subtasks.pop();
|
|
517
|
-
subtask.drop();
|
|
518
|
-
return subtask;
|
|
519
|
-
}
|
|
520
|
-
}
|
|
521
|
-
|
|
522
|
-
function unpackCallbackResult(result) {
|
|
523
|
-
_debugLog('[unpackCallbackResult()] args', { result });
|
|
524
|
-
if (!(_typeCheckValidI32(result))) { throw new Error('invalid callback return value [' + result + '], not a valid i32'); }
|
|
525
|
-
const eventCode = result & 0xF;
|
|
526
|
-
if (eventCode < 0 || eventCode > 3) {
|
|
527
|
-
throw new Error('invalid async return value [' + eventCode + '], outside callback code range');
|
|
528
|
-
}
|
|
529
|
-
if (result < 0 || result >= 2**32) { throw new Error('invalid callback result'); }
|
|
530
|
-
// TODO: table max length check?
|
|
531
|
-
const waitableSetIdx = result >> 4;
|
|
532
|
-
return [eventCode, waitableSetIdx];
|
|
533
|
-
}
|
|
534
|
-
const ASYNC_STATE = new Map();
|
|
535
|
-
|
|
536
|
-
function getOrCreateAsyncState(componentIdx, init) {
|
|
537
|
-
if (!ASYNC_STATE.has(componentIdx)) {
|
|
538
|
-
ASYNC_STATE.set(componentIdx, new ComponentAsyncState());
|
|
539
|
-
}
|
|
540
|
-
return ASYNC_STATE.get(componentIdx);
|
|
541
|
-
}
|
|
542
|
-
|
|
543
|
-
class ComponentAsyncState {
|
|
544
|
-
#callingAsyncImport = false;
|
|
545
|
-
#syncImportWait = Promise.withResolvers();
|
|
546
|
-
#lock = null;
|
|
547
|
-
|
|
548
|
-
mayLeave = true;
|
|
549
|
-
waitableSets = new RepTable();
|
|
550
|
-
waitables = new RepTable();
|
|
551
|
-
|
|
552
|
-
#parkedTasks = new Map();
|
|
553
|
-
|
|
554
|
-
callingSyncImport(val) {
|
|
555
|
-
if (val === undefined) { return this.#callingAsyncImport; }
|
|
556
|
-
if (typeof val !== 'boolean') { throw new TypeError('invalid setting for async import'); }
|
|
557
|
-
const prev = this.#callingAsyncImport;
|
|
558
|
-
this.#callingAsyncImport = val;
|
|
559
|
-
if (prev === true && this.#callingAsyncImport === false) {
|
|
560
|
-
this.#notifySyncImportEnd();
|
|
593
|
+
async exclusiveLock() { // TODO: use atomics
|
|
594
|
+
if (this.#lock === null) {
|
|
595
|
+
this.#lock = { ticket: 0n };
|
|
561
596
|
}
|
|
562
|
-
}
|
|
563
|
-
|
|
564
|
-
#notifySyncImportEnd() {
|
|
565
|
-
const existing = this.#syncImportWait;
|
|
566
|
-
this.#syncImportWait = Promise.withResolvers();
|
|
567
|
-
existing.resolve();
|
|
568
|
-
}
|
|
569
|
-
|
|
570
|
-
async waitForSyncImportCallEnd() {
|
|
571
|
-
await this.#syncImportWait.promise;
|
|
572
|
-
}
|
|
573
|
-
|
|
574
|
-
parkTaskOnAwaitable(args) {
|
|
575
|
-
if (!args.awaitable) { throw new TypeError('missing awaitable when trying to park'); }
|
|
576
|
-
if (!args.task) { throw new TypeError('missing task when trying to park'); }
|
|
577
|
-
const { awaitable, task } = args;
|
|
578
597
|
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
taskList = [];
|
|
582
|
-
this.#parkedTasks.set(awaitable.id(), taskList);
|
|
583
|
-
}
|
|
584
|
-
taskList.push(task);
|
|
598
|
+
// Take a ticket for the next valid usage
|
|
599
|
+
const ticket = ++this.#lock.ticket;
|
|
585
600
|
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
if (!awaitable) { throw new TypeError('missing awaitable when waking next task'); }
|
|
591
|
-
const awaitableID = awaitable.id();
|
|
601
|
+
_debugLog('[ComponentAsyncState#exclusiveLock()] locking', {
|
|
602
|
+
currentTicket: ticket - 1n,
|
|
603
|
+
ticket
|
|
604
|
+
});
|
|
592
605
|
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
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; }
|
|
597
611
|
}
|
|
598
612
|
|
|
599
|
-
|
|
600
|
-
|
|
613
|
+
const { promise, resolve } = Promise.withResolvers();
|
|
614
|
+
this.#lock = {
|
|
615
|
+
ticket,
|
|
616
|
+
promise,
|
|
617
|
+
resolve,
|
|
618
|
+
};
|
|
601
619
|
|
|
602
|
-
|
|
603
|
-
throw new Error('task ready due to awaitable is missing resume', { taskID: task.id(), awaitableID });
|
|
604
|
-
}
|
|
605
|
-
task.awaitableResume();
|
|
606
|
-
}
|
|
607
|
-
|
|
608
|
-
async exclusiveLock() { // TODO: use atomics
|
|
609
|
-
if (this.#lock === null) {
|
|
610
|
-
this.#lock = { ticket: 0n };
|
|
620
|
+
return this.#lock.promise;
|
|
611
621
|
}
|
|
612
622
|
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
while (this.#lock.promise) {
|
|
624
|
-
finishedTicket = await this.#lock.promise;
|
|
625
|
-
if (finishedTicket === ticket - 1n) { break; }
|
|
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);
|
|
626
633
|
}
|
|
627
634
|
|
|
628
|
-
|
|
629
|
-
this.#lock = {
|
|
630
|
-
ticket,
|
|
631
|
-
promise,
|
|
632
|
-
resolve,
|
|
633
|
-
};
|
|
634
|
-
|
|
635
|
-
return this.#lock.promise;
|
|
636
|
-
}
|
|
637
|
-
|
|
638
|
-
exclusiveRelease() {
|
|
639
|
-
_debugLog('[ComponentAsyncState#exclusiveRelease()] releasing', {
|
|
640
|
-
currentTicket: this.#lock === null ? 'none' : this.#lock.ticket,
|
|
641
|
-
});
|
|
642
|
-
|
|
643
|
-
if (this.#lock === null) { return; }
|
|
635
|
+
isExclusivelyLocked() { return this.#lock !== null; }
|
|
644
636
|
|
|
645
|
-
const existingLock = this.#lock;
|
|
646
|
-
this.#lock = null;
|
|
647
|
-
existingLock.resolve(existingLock.ticket);
|
|
648
|
-
}
|
|
649
|
-
|
|
650
|
-
isExclusivelyLocked() { return this.#lock !== null; }
|
|
651
|
-
|
|
652
637
|
}
|
|
653
638
|
|
|
654
639
|
function prepareCall(memoryIdx) {
|
|
@@ -712,18 +697,6 @@ const I32_MAX = 2_147_483_647;
|
|
|
712
697
|
const I32_MIN = -2_147_483_648;
|
|
713
698
|
const _typeCheckValidI32 = (n) => typeof n === 'number' && n >= I32_MIN && n <= I32_MAX;
|
|
714
699
|
|
|
715
|
-
const base64Compile = str => WebAssembly.compile(typeof Buffer !== 'undefined' ? Buffer.from(str, 'base64') : Uint8Array.from(atob(str), b => b.charCodeAt(0)));
|
|
716
|
-
|
|
717
|
-
const isNode = typeof process !== 'undefined' && process.versions && process.versions.node;
|
|
718
|
-
let _fs;
|
|
719
|
-
async function fetchCompile (url) {
|
|
720
|
-
if (isNode) {
|
|
721
|
-
_fs = _fs || await import('node:fs/promises');
|
|
722
|
-
return WebAssembly.compile(await _fs.readFile(url));
|
|
723
|
-
}
|
|
724
|
-
return fetch(url).then(WebAssembly.compileStreaming);
|
|
725
|
-
}
|
|
726
|
-
|
|
727
700
|
const symbolCabiDispose = Symbol.for('cabiDispose');
|
|
728
701
|
|
|
729
702
|
const symbolRscHandle = Symbol('handle');
|
|
@@ -801,689 +774,485 @@ class RepTable {
|
|
|
801
774
|
|
|
802
775
|
const hasOwnProperty = Object.prototype.hasOwnProperty;
|
|
803
776
|
|
|
804
|
-
const instantiateCore = WebAssembly.instantiate;
|
|
805
|
-
|
|
806
777
|
|
|
807
|
-
|
|
808
|
-
const
|
|
809
|
-
const
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
778
|
+
const module0 = getCoreModule('giallo_js.core.wasm');
|
|
779
|
+
const module1 = getCoreModule('giallo_js.core2.wasm');
|
|
780
|
+
const module2 = getCoreModule('giallo_js.core3.wasm');
|
|
781
|
+
const module3 = getCoreModule('giallo_js.core4.wasm');
|
|
782
|
+
|
|
783
|
+
const { getEnvironment } = imports['wasi:cli/environment'];
|
|
784
|
+
const { exit } = imports['wasi:cli/exit'];
|
|
785
|
+
const { getStderr } = imports['wasi:cli/stderr'];
|
|
786
|
+
const { getStdin } = imports['wasi:cli/stdin'];
|
|
787
|
+
const { getStdout } = imports['wasi:cli/stdout'];
|
|
788
|
+
const { getDirectories } = imports['wasi:filesystem/preopens'];
|
|
789
|
+
const { Descriptor, filesystemErrorCode } = imports['wasi:filesystem/types'];
|
|
790
|
+
const { Error: Error$1 } = imports['wasi:io/error'];
|
|
791
|
+
const { InputStream, OutputStream } = imports['wasi:io/streams'];
|
|
792
|
+
const { insecureSeed } = imports['wasi:random/insecure-seed'];
|
|
793
|
+
let gen = (function* _initGenerator () {
|
|
794
|
+
let exports0;
|
|
795
|
+
const handleTable1 = [T_FLAG, 0];
|
|
796
|
+
const captureTable1= new Map();
|
|
797
|
+
let captureCnt1 = 0;
|
|
798
|
+
handleTables[1] = handleTable1;
|
|
799
|
+
|
|
800
|
+
function trampoline2() {
|
|
801
|
+
_debugLog('[iface="wasi:cli/stderr@0.2.6", function="get-stderr"] [Instruction::CallInterface] (async? sync, @ enter)');
|
|
802
|
+
const _interface_call_currentTaskID = startCurrentTask(0, false, 'get-stderr');
|
|
803
|
+
const ret = getStderr();
|
|
804
|
+
_debugLog('[iface="wasi:cli/stderr@0.2.6", function="get-stderr"] [Instruction::CallInterface] (sync, @ post-call)');
|
|
805
|
+
endCurrentTask(0);
|
|
806
|
+
if (!(ret instanceof OutputStream)) {
|
|
807
|
+
throw new TypeError('Resource error: Not a valid "OutputStream" resource.');
|
|
808
|
+
}
|
|
809
|
+
var handle0 = ret[symbolRscHandle];
|
|
810
|
+
if (!handle0) {
|
|
811
|
+
const rep = ret[symbolRscRep] || ++captureCnt1;
|
|
812
|
+
captureTable1.set(rep, ret);
|
|
813
|
+
handle0 = rscTableCreateOwn(handleTable1, rep);
|
|
814
|
+
}
|
|
815
|
+
_debugLog('[iface="wasi:cli/stderr@0.2.6", function="get-stderr"][Instruction::Return]', {
|
|
816
|
+
funcName: 'get-stderr',
|
|
817
|
+
paramCount: 1,
|
|
818
|
+
async: false,
|
|
819
|
+
postReturn: false
|
|
820
|
+
});
|
|
821
|
+
return handle0;
|
|
822
|
+
}
|
|
823
|
+
|
|
824
|
+
let exports1;
|
|
825
|
+
const handleTable2 = [T_FLAG, 0];
|
|
826
|
+
const captureTable2= new Map();
|
|
827
|
+
let captureCnt2 = 0;
|
|
828
|
+
handleTables[2] = handleTable2;
|
|
829
|
+
|
|
830
|
+
function trampoline6() {
|
|
831
|
+
_debugLog('[iface="wasi:cli/stdin@0.2.6", function="get-stdin"] [Instruction::CallInterface] (async? sync, @ enter)');
|
|
832
|
+
const _interface_call_currentTaskID = startCurrentTask(0, false, 'get-stdin');
|
|
833
|
+
const ret = getStdin();
|
|
834
|
+
_debugLog('[iface="wasi:cli/stdin@0.2.6", function="get-stdin"] [Instruction::CallInterface] (sync, @ post-call)');
|
|
835
|
+
endCurrentTask(0);
|
|
836
|
+
if (!(ret instanceof InputStream)) {
|
|
837
|
+
throw new TypeError('Resource error: Not a valid "InputStream" resource.');
|
|
838
|
+
}
|
|
839
|
+
var handle0 = ret[symbolRscHandle];
|
|
840
|
+
if (!handle0) {
|
|
841
|
+
const rep = ret[symbolRscRep] || ++captureCnt2;
|
|
842
|
+
captureTable2.set(rep, ret);
|
|
843
|
+
handle0 = rscTableCreateOwn(handleTable2, rep);
|
|
844
|
+
}
|
|
845
|
+
_debugLog('[iface="wasi:cli/stdin@0.2.6", function="get-stdin"][Instruction::Return]', {
|
|
846
|
+
funcName: 'get-stdin',
|
|
847
|
+
paramCount: 1,
|
|
848
|
+
async: false,
|
|
849
|
+
postReturn: false
|
|
850
|
+
});
|
|
851
|
+
return handle0;
|
|
852
|
+
}
|
|
853
|
+
|
|
854
|
+
|
|
855
|
+
function trampoline7() {
|
|
856
|
+
_debugLog('[iface="wasi:cli/stdout@0.2.6", function="get-stdout"] [Instruction::CallInterface] (async? sync, @ enter)');
|
|
857
|
+
const _interface_call_currentTaskID = startCurrentTask(0, false, 'get-stdout');
|
|
858
|
+
const ret = getStdout();
|
|
859
|
+
_debugLog('[iface="wasi:cli/stdout@0.2.6", function="get-stdout"] [Instruction::CallInterface] (sync, @ post-call)');
|
|
860
|
+
endCurrentTask(0);
|
|
861
|
+
if (!(ret instanceof OutputStream)) {
|
|
862
|
+
throw new TypeError('Resource error: Not a valid "OutputStream" resource.');
|
|
863
|
+
}
|
|
864
|
+
var handle0 = ret[symbolRscHandle];
|
|
865
|
+
if (!handle0) {
|
|
866
|
+
const rep = ret[symbolRscRep] || ++captureCnt1;
|
|
867
|
+
captureTable1.set(rep, ret);
|
|
868
|
+
handle0 = rscTableCreateOwn(handleTable1, rep);
|
|
869
|
+
}
|
|
870
|
+
_debugLog('[iface="wasi:cli/stdout@0.2.6", function="get-stdout"][Instruction::Return]', {
|
|
871
|
+
funcName: 'get-stdout',
|
|
872
|
+
paramCount: 1,
|
|
873
|
+
async: false,
|
|
874
|
+
postReturn: false
|
|
875
|
+
});
|
|
876
|
+
return handle0;
|
|
821
877
|
}
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
postReturn: false
|
|
833
|
-
});
|
|
834
|
-
return handle0;
|
|
835
|
-
}
|
|
836
|
-
|
|
837
|
-
let exports1;
|
|
838
|
-
const handleTable2 = [T_FLAG, 0];
|
|
839
|
-
const captureTable2= new Map();
|
|
840
|
-
let captureCnt2 = 0;
|
|
841
|
-
handleTables[2] = handleTable2;
|
|
842
|
-
|
|
843
|
-
function trampoline6() {
|
|
844
|
-
_debugLog('[iface="wasi:cli/stdin@0.2.6", function="get-stdin"] [Instruction::CallInterface] (async? sync, @ enter)');
|
|
845
|
-
const _interface_call_currentTaskID = startCurrentTask(0, false, 'get-stdin');
|
|
846
|
-
const ret = getStdin();
|
|
847
|
-
_debugLog('[iface="wasi:cli/stdin@0.2.6", function="get-stdin"] [Instruction::CallInterface] (sync, @ post-call)');
|
|
848
|
-
endCurrentTask(0);
|
|
849
|
-
if (!(ret instanceof InputStream)) {
|
|
850
|
-
throw new TypeError('Resource error: Not a valid "InputStream" resource.');
|
|
851
|
-
}
|
|
852
|
-
var handle0 = ret[symbolRscHandle];
|
|
853
|
-
if (!handle0) {
|
|
854
|
-
const rep = ret[symbolRscRep] || ++captureCnt2;
|
|
855
|
-
captureTable2.set(rep, ret);
|
|
856
|
-
handle0 = rscTableCreateOwn(handleTable2, rep);
|
|
857
|
-
}
|
|
858
|
-
_debugLog('[iface="wasi:cli/stdin@0.2.6", function="get-stdin"][Instruction::Return]', {
|
|
859
|
-
funcName: 'get-stdin',
|
|
860
|
-
paramCount: 1,
|
|
861
|
-
async: false,
|
|
862
|
-
postReturn: false
|
|
863
|
-
});
|
|
864
|
-
return handle0;
|
|
865
|
-
}
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
function trampoline7() {
|
|
869
|
-
_debugLog('[iface="wasi:cli/stdout@0.2.6", function="get-stdout"] [Instruction::CallInterface] (async? sync, @ enter)');
|
|
870
|
-
const _interface_call_currentTaskID = startCurrentTask(0, false, 'get-stdout');
|
|
871
|
-
const ret = getStdout();
|
|
872
|
-
_debugLog('[iface="wasi:cli/stdout@0.2.6", function="get-stdout"] [Instruction::CallInterface] (sync, @ post-call)');
|
|
873
|
-
endCurrentTask(0);
|
|
874
|
-
if (!(ret instanceof OutputStream)) {
|
|
875
|
-
throw new TypeError('Resource error: Not a valid "OutputStream" resource.');
|
|
876
|
-
}
|
|
877
|
-
var handle0 = ret[symbolRscHandle];
|
|
878
|
-
if (!handle0) {
|
|
879
|
-
const rep = ret[symbolRscRep] || ++captureCnt1;
|
|
880
|
-
captureTable1.set(rep, ret);
|
|
881
|
-
handle0 = rscTableCreateOwn(handleTable1, rep);
|
|
882
|
-
}
|
|
883
|
-
_debugLog('[iface="wasi:cli/stdout@0.2.6", function="get-stdout"][Instruction::Return]', {
|
|
884
|
-
funcName: 'get-stdout',
|
|
885
|
-
paramCount: 1,
|
|
886
|
-
async: false,
|
|
887
|
-
postReturn: false
|
|
888
|
-
});
|
|
889
|
-
return handle0;
|
|
890
|
-
}
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
function trampoline8(arg0) {
|
|
894
|
-
let variant0;
|
|
895
|
-
switch (arg0) {
|
|
896
|
-
case 0: {
|
|
897
|
-
variant0= {
|
|
898
|
-
tag: 'ok',
|
|
899
|
-
val: undefined
|
|
900
|
-
};
|
|
901
|
-
break;
|
|
902
|
-
}
|
|
903
|
-
case 1: {
|
|
904
|
-
variant0= {
|
|
905
|
-
tag: 'err',
|
|
906
|
-
val: undefined
|
|
907
|
-
};
|
|
908
|
-
break;
|
|
909
|
-
}
|
|
910
|
-
default: {
|
|
911
|
-
throw new TypeError('invalid variant discriminant for expected');
|
|
912
|
-
}
|
|
913
|
-
}
|
|
914
|
-
_debugLog('[iface="wasi:cli/exit@0.2.6", function="exit"] [Instruction::CallInterface] (async? sync, @ enter)');
|
|
915
|
-
const _interface_call_currentTaskID = startCurrentTask(0, false, 'exit');
|
|
916
|
-
exit(variant0);
|
|
917
|
-
_debugLog('[iface="wasi:cli/exit@0.2.6", function="exit"] [Instruction::CallInterface] (sync, @ post-call)');
|
|
918
|
-
endCurrentTask(0);
|
|
919
|
-
_debugLog('[iface="wasi:cli/exit@0.2.6", function="exit"][Instruction::Return]', {
|
|
920
|
-
funcName: 'exit',
|
|
921
|
-
paramCount: 0,
|
|
922
|
-
async: false,
|
|
923
|
-
postReturn: false
|
|
924
|
-
});
|
|
925
|
-
}
|
|
926
|
-
|
|
927
|
-
let exports2;
|
|
928
|
-
let memory0;
|
|
929
|
-
let realloc0;
|
|
930
|
-
let realloc1;
|
|
931
|
-
const handleTable0 = [T_FLAG, 0];
|
|
932
|
-
const captureTable0= new Map();
|
|
933
|
-
let captureCnt0 = 0;
|
|
934
|
-
handleTables[0] = handleTable0;
|
|
935
|
-
|
|
936
|
-
function trampoline9(arg0, arg1) {
|
|
937
|
-
var handle1 = arg0;
|
|
938
|
-
var rep2 = handleTable0[(handle1 << 1) + 1] & ~T_FLAG;
|
|
939
|
-
var rsc0 = captureTable0.get(rep2);
|
|
940
|
-
if (!rsc0) {
|
|
941
|
-
rsc0 = Object.create(Error$1.prototype);
|
|
942
|
-
Object.defineProperty(rsc0, symbolRscHandle, { writable: true, value: handle1});
|
|
943
|
-
Object.defineProperty(rsc0, symbolRscRep, { writable: true, value: rep2});
|
|
944
|
-
}
|
|
945
|
-
curResourceBorrows.push(rsc0);
|
|
946
|
-
_debugLog('[iface="wasi:io/error@0.2.6", function="[method]error.to-debug-string"] [Instruction::CallInterface] (async? sync, @ enter)');
|
|
947
|
-
const _interface_call_currentTaskID = startCurrentTask(0, false, '[method]error.to-debug-string');
|
|
948
|
-
const ret = rsc0.toDebugString();
|
|
949
|
-
_debugLog('[iface="wasi:io/error@0.2.6", function="[method]error.to-debug-string"] [Instruction::CallInterface] (sync, @ post-call)');
|
|
950
|
-
for (const rsc of curResourceBorrows) {
|
|
951
|
-
rsc[symbolRscHandle] = undefined;
|
|
952
|
-
}
|
|
953
|
-
curResourceBorrows = [];
|
|
954
|
-
endCurrentTask(0);
|
|
955
|
-
var ptr3 = utf8Encode(ret, realloc0, memory0);
|
|
956
|
-
var len3 = utf8EncodedLen;
|
|
957
|
-
dataView(memory0).setUint32(arg1 + 4, len3, true);
|
|
958
|
-
dataView(memory0).setUint32(arg1 + 0, ptr3, true);
|
|
959
|
-
_debugLog('[iface="wasi:io/error@0.2.6", function="[method]error.to-debug-string"][Instruction::Return]', {
|
|
960
|
-
funcName: '[method]error.to-debug-string',
|
|
961
|
-
paramCount: 0,
|
|
962
|
-
async: false,
|
|
963
|
-
postReturn: false
|
|
964
|
-
});
|
|
965
|
-
}
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
function trampoline10(arg0, arg1, arg2, arg3) {
|
|
969
|
-
var handle1 = arg0;
|
|
970
|
-
var rep2 = handleTable1[(handle1 << 1) + 1] & ~T_FLAG;
|
|
971
|
-
var rsc0 = captureTable1.get(rep2);
|
|
972
|
-
if (!rsc0) {
|
|
973
|
-
rsc0 = Object.create(OutputStream.prototype);
|
|
974
|
-
Object.defineProperty(rsc0, symbolRscHandle, { writable: true, value: handle1});
|
|
975
|
-
Object.defineProperty(rsc0, symbolRscRep, { writable: true, value: rep2});
|
|
976
|
-
}
|
|
977
|
-
curResourceBorrows.push(rsc0);
|
|
978
|
-
var ptr3 = arg1;
|
|
979
|
-
var len3 = arg2;
|
|
980
|
-
var result3 = new Uint8Array(memory0.buffer.slice(ptr3, ptr3 + len3 * 1));
|
|
981
|
-
_debugLog('[iface="wasi:io/streams@0.2.6", function="[method]output-stream.blocking-write-and-flush"] [Instruction::CallInterface] (async? sync, @ enter)');
|
|
982
|
-
const _interface_call_currentTaskID = startCurrentTask(0, false, '[method]output-stream.blocking-write-and-flush');
|
|
983
|
-
let ret;
|
|
984
|
-
try {
|
|
985
|
-
ret = { tag: 'ok', val: rsc0.blockingWriteAndFlush(result3)};
|
|
986
|
-
} catch (e) {
|
|
987
|
-
ret = { tag: 'err', val: getErrorPayload(e) };
|
|
988
|
-
}
|
|
989
|
-
_debugLog('[iface="wasi:io/streams@0.2.6", function="[method]output-stream.blocking-write-and-flush"] [Instruction::CallInterface] (sync, @ post-call)');
|
|
990
|
-
for (const rsc of curResourceBorrows) {
|
|
991
|
-
rsc[symbolRscHandle] = undefined;
|
|
992
|
-
}
|
|
993
|
-
curResourceBorrows = [];
|
|
994
|
-
endCurrentTask(0);
|
|
995
|
-
var variant6 = ret;
|
|
996
|
-
switch (variant6.tag) {
|
|
997
|
-
case 'ok': {
|
|
998
|
-
const e = variant6.val;
|
|
999
|
-
dataView(memory0).setInt8(arg3 + 0, 0, true);
|
|
1000
|
-
break;
|
|
1001
|
-
}
|
|
1002
|
-
case 'err': {
|
|
1003
|
-
const e = variant6.val;
|
|
1004
|
-
dataView(memory0).setInt8(arg3 + 0, 1, true);
|
|
1005
|
-
var variant5 = e;
|
|
1006
|
-
switch (variant5.tag) {
|
|
1007
|
-
case 'last-operation-failed': {
|
|
1008
|
-
const e = variant5.val;
|
|
1009
|
-
dataView(memory0).setInt8(arg3 + 4, 0, true);
|
|
1010
|
-
if (!(e instanceof Error$1)) {
|
|
1011
|
-
throw new TypeError('Resource error: Not a valid "Error" resource.');
|
|
1012
|
-
}
|
|
1013
|
-
var handle4 = e[symbolRscHandle];
|
|
1014
|
-
if (!handle4) {
|
|
1015
|
-
const rep = e[symbolRscRep] || ++captureCnt0;
|
|
1016
|
-
captureTable0.set(rep, e);
|
|
1017
|
-
handle4 = rscTableCreateOwn(handleTable0, rep);
|
|
1018
|
-
}
|
|
1019
|
-
dataView(memory0).setInt32(arg3 + 8, handle4, true);
|
|
1020
|
-
break;
|
|
1021
|
-
}
|
|
1022
|
-
case 'closed': {
|
|
1023
|
-
dataView(memory0).setInt8(arg3 + 4, 1, true);
|
|
1024
|
-
break;
|
|
1025
|
-
}
|
|
1026
|
-
default: {
|
|
1027
|
-
throw new TypeError(`invalid variant tag value \`${JSON.stringify(variant5.tag)}\` (received \`${variant5}\`) specified for \`StreamError\``);
|
|
1028
|
-
}
|
|
1029
|
-
}
|
|
1030
|
-
break;
|
|
1031
|
-
}
|
|
1032
|
-
default: {
|
|
1033
|
-
throw new TypeError('invalid variant specified for result');
|
|
1034
|
-
}
|
|
1035
|
-
}
|
|
1036
|
-
_debugLog('[iface="wasi:io/streams@0.2.6", function="[method]output-stream.blocking-write-and-flush"][Instruction::Return]', {
|
|
1037
|
-
funcName: '[method]output-stream.blocking-write-and-flush',
|
|
1038
|
-
paramCount: 0,
|
|
1039
|
-
async: false,
|
|
1040
|
-
postReturn: false
|
|
1041
|
-
});
|
|
1042
|
-
}
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
function trampoline11(arg0) {
|
|
1046
|
-
_debugLog('[iface="wasi:random/insecure-seed@0.2.6", function="insecure-seed"] [Instruction::CallInterface] (async? sync, @ enter)');
|
|
1047
|
-
const _interface_call_currentTaskID = startCurrentTask(0, false, 'insecure-seed');
|
|
1048
|
-
const ret = insecureSeed();
|
|
1049
|
-
_debugLog('[iface="wasi:random/insecure-seed@0.2.6", function="insecure-seed"] [Instruction::CallInterface] (sync, @ post-call)');
|
|
1050
|
-
endCurrentTask(0);
|
|
1051
|
-
var [tuple0_0, tuple0_1] = ret;
|
|
1052
|
-
dataView(memory0).setBigInt64(arg0 + 0, toUint64(tuple0_0), true);
|
|
1053
|
-
dataView(memory0).setBigInt64(arg0 + 8, toUint64(tuple0_1), true);
|
|
1054
|
-
_debugLog('[iface="wasi:random/insecure-seed@0.2.6", function="insecure-seed"][Instruction::Return]', {
|
|
1055
|
-
funcName: 'insecure-seed',
|
|
1056
|
-
paramCount: 0,
|
|
1057
|
-
async: false,
|
|
1058
|
-
postReturn: false
|
|
1059
|
-
});
|
|
1060
|
-
}
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
function trampoline12(arg0) {
|
|
1064
|
-
_debugLog('[iface="wasi:cli/environment@0.2.6", function="get-environment"] [Instruction::CallInterface] (async? sync, @ enter)');
|
|
1065
|
-
const _interface_call_currentTaskID = startCurrentTask(0, false, 'get-environment');
|
|
1066
|
-
const ret = getEnvironment();
|
|
1067
|
-
_debugLog('[iface="wasi:cli/environment@0.2.6", function="get-environment"] [Instruction::CallInterface] (sync, @ post-call)');
|
|
1068
|
-
endCurrentTask(0);
|
|
1069
|
-
var vec3 = ret;
|
|
1070
|
-
var len3 = vec3.length;
|
|
1071
|
-
var result3 = realloc1(0, 0, 4, len3 * 16);
|
|
1072
|
-
for (let i = 0; i < vec3.length; i++) {
|
|
1073
|
-
const e = vec3[i];
|
|
1074
|
-
const base = result3 + i * 16;var [tuple0_0, tuple0_1] = e;
|
|
1075
|
-
var ptr1 = utf8Encode(tuple0_0, realloc1, memory0);
|
|
1076
|
-
var len1 = utf8EncodedLen;
|
|
1077
|
-
dataView(memory0).setUint32(base + 4, len1, true);
|
|
1078
|
-
dataView(memory0).setUint32(base + 0, ptr1, true);
|
|
1079
|
-
var ptr2 = utf8Encode(tuple0_1, realloc1, memory0);
|
|
1080
|
-
var len2 = utf8EncodedLen;
|
|
1081
|
-
dataView(memory0).setUint32(base + 12, len2, true);
|
|
1082
|
-
dataView(memory0).setUint32(base + 8, ptr2, true);
|
|
1083
|
-
}
|
|
1084
|
-
dataView(memory0).setUint32(arg0 + 4, len3, true);
|
|
1085
|
-
dataView(memory0).setUint32(arg0 + 0, result3, true);
|
|
1086
|
-
_debugLog('[iface="wasi:cli/environment@0.2.6", function="get-environment"][Instruction::Return]', {
|
|
1087
|
-
funcName: 'get-environment',
|
|
1088
|
-
paramCount: 0,
|
|
1089
|
-
async: false,
|
|
1090
|
-
postReturn: false
|
|
1091
|
-
});
|
|
1092
|
-
}
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
function trampoline13(arg0, arg1) {
|
|
1096
|
-
var handle1 = arg0;
|
|
1097
|
-
var rep2 = handleTable0[(handle1 << 1) + 1] & ~T_FLAG;
|
|
1098
|
-
var rsc0 = captureTable0.get(rep2);
|
|
1099
|
-
if (!rsc0) {
|
|
1100
|
-
rsc0 = Object.create(Error$1.prototype);
|
|
1101
|
-
Object.defineProperty(rsc0, symbolRscHandle, { writable: true, value: handle1});
|
|
1102
|
-
Object.defineProperty(rsc0, symbolRscRep, { writable: true, value: rep2});
|
|
1103
|
-
}
|
|
1104
|
-
curResourceBorrows.push(rsc0);
|
|
1105
|
-
_debugLog('[iface="wasi:filesystem/types@0.2.6", function="filesystem-error-code"] [Instruction::CallInterface] (async? sync, @ enter)');
|
|
1106
|
-
const _interface_call_currentTaskID = startCurrentTask(0, false, 'filesystem-error-code');
|
|
1107
|
-
const ret = filesystemErrorCode(rsc0);
|
|
1108
|
-
_debugLog('[iface="wasi:filesystem/types@0.2.6", function="filesystem-error-code"] [Instruction::CallInterface] (sync, @ post-call)');
|
|
1109
|
-
for (const rsc of curResourceBorrows) {
|
|
1110
|
-
rsc[symbolRscHandle] = undefined;
|
|
1111
|
-
}
|
|
1112
|
-
curResourceBorrows = [];
|
|
1113
|
-
endCurrentTask(0);
|
|
1114
|
-
var variant4 = ret;
|
|
1115
|
-
if (variant4 === null || variant4=== undefined) {
|
|
1116
|
-
dataView(memory0).setInt8(arg1 + 0, 0, true);
|
|
1117
|
-
} else {
|
|
1118
|
-
const e = variant4;
|
|
1119
|
-
dataView(memory0).setInt8(arg1 + 0, 1, true);
|
|
1120
|
-
var val3 = e;
|
|
1121
|
-
let enum3;
|
|
1122
|
-
switch (val3) {
|
|
1123
|
-
case 'access': {
|
|
1124
|
-
enum3 = 0;
|
|
1125
|
-
break;
|
|
1126
|
-
}
|
|
1127
|
-
case 'would-block': {
|
|
1128
|
-
enum3 = 1;
|
|
1129
|
-
break;
|
|
1130
|
-
}
|
|
1131
|
-
case 'already': {
|
|
1132
|
-
enum3 = 2;
|
|
1133
|
-
break;
|
|
1134
|
-
}
|
|
1135
|
-
case 'bad-descriptor': {
|
|
1136
|
-
enum3 = 3;
|
|
1137
|
-
break;
|
|
1138
|
-
}
|
|
1139
|
-
case 'busy': {
|
|
1140
|
-
enum3 = 4;
|
|
1141
|
-
break;
|
|
1142
|
-
}
|
|
1143
|
-
case 'deadlock': {
|
|
1144
|
-
enum3 = 5;
|
|
1145
|
-
break;
|
|
1146
|
-
}
|
|
1147
|
-
case 'quota': {
|
|
1148
|
-
enum3 = 6;
|
|
1149
|
-
break;
|
|
1150
|
-
}
|
|
1151
|
-
case 'exist': {
|
|
1152
|
-
enum3 = 7;
|
|
1153
|
-
break;
|
|
1154
|
-
}
|
|
1155
|
-
case 'file-too-large': {
|
|
1156
|
-
enum3 = 8;
|
|
1157
|
-
break;
|
|
1158
|
-
}
|
|
1159
|
-
case 'illegal-byte-sequence': {
|
|
1160
|
-
enum3 = 9;
|
|
1161
|
-
break;
|
|
1162
|
-
}
|
|
1163
|
-
case 'in-progress': {
|
|
1164
|
-
enum3 = 10;
|
|
1165
|
-
break;
|
|
1166
|
-
}
|
|
1167
|
-
case 'interrupted': {
|
|
1168
|
-
enum3 = 11;
|
|
1169
|
-
break;
|
|
1170
|
-
}
|
|
1171
|
-
case 'invalid': {
|
|
1172
|
-
enum3 = 12;
|
|
1173
|
-
break;
|
|
1174
|
-
}
|
|
1175
|
-
case 'io': {
|
|
1176
|
-
enum3 = 13;
|
|
1177
|
-
break;
|
|
1178
|
-
}
|
|
1179
|
-
case 'is-directory': {
|
|
1180
|
-
enum3 = 14;
|
|
1181
|
-
break;
|
|
1182
|
-
}
|
|
1183
|
-
case 'loop': {
|
|
1184
|
-
enum3 = 15;
|
|
1185
|
-
break;
|
|
1186
|
-
}
|
|
1187
|
-
case 'too-many-links': {
|
|
1188
|
-
enum3 = 16;
|
|
1189
|
-
break;
|
|
1190
|
-
}
|
|
1191
|
-
case 'message-size': {
|
|
1192
|
-
enum3 = 17;
|
|
1193
|
-
break;
|
|
1194
|
-
}
|
|
1195
|
-
case 'name-too-long': {
|
|
1196
|
-
enum3 = 18;
|
|
1197
|
-
break;
|
|
1198
|
-
}
|
|
1199
|
-
case 'no-device': {
|
|
1200
|
-
enum3 = 19;
|
|
1201
|
-
break;
|
|
1202
|
-
}
|
|
1203
|
-
case 'no-entry': {
|
|
1204
|
-
enum3 = 20;
|
|
1205
|
-
break;
|
|
1206
|
-
}
|
|
1207
|
-
case 'no-lock': {
|
|
1208
|
-
enum3 = 21;
|
|
1209
|
-
break;
|
|
1210
|
-
}
|
|
1211
|
-
case 'insufficient-memory': {
|
|
1212
|
-
enum3 = 22;
|
|
1213
|
-
break;
|
|
1214
|
-
}
|
|
1215
|
-
case 'insufficient-space': {
|
|
1216
|
-
enum3 = 23;
|
|
1217
|
-
break;
|
|
1218
|
-
}
|
|
1219
|
-
case 'not-directory': {
|
|
1220
|
-
enum3 = 24;
|
|
1221
|
-
break;
|
|
1222
|
-
}
|
|
1223
|
-
case 'not-empty': {
|
|
1224
|
-
enum3 = 25;
|
|
1225
|
-
break;
|
|
1226
|
-
}
|
|
1227
|
-
case 'not-recoverable': {
|
|
1228
|
-
enum3 = 26;
|
|
1229
|
-
break;
|
|
1230
|
-
}
|
|
1231
|
-
case 'unsupported': {
|
|
1232
|
-
enum3 = 27;
|
|
1233
|
-
break;
|
|
1234
|
-
}
|
|
1235
|
-
case 'no-tty': {
|
|
1236
|
-
enum3 = 28;
|
|
1237
|
-
break;
|
|
1238
|
-
}
|
|
1239
|
-
case 'no-such-device': {
|
|
1240
|
-
enum3 = 29;
|
|
1241
|
-
break;
|
|
1242
|
-
}
|
|
1243
|
-
case 'overflow': {
|
|
1244
|
-
enum3 = 30;
|
|
1245
|
-
break;
|
|
1246
|
-
}
|
|
1247
|
-
case 'not-permitted': {
|
|
1248
|
-
enum3 = 31;
|
|
1249
|
-
break;
|
|
1250
|
-
}
|
|
1251
|
-
case 'pipe': {
|
|
1252
|
-
enum3 = 32;
|
|
1253
|
-
break;
|
|
1254
|
-
}
|
|
1255
|
-
case 'read-only': {
|
|
1256
|
-
enum3 = 33;
|
|
878
|
+
|
|
879
|
+
|
|
880
|
+
function trampoline8(arg0) {
|
|
881
|
+
let variant0;
|
|
882
|
+
switch (arg0) {
|
|
883
|
+
case 0: {
|
|
884
|
+
variant0= {
|
|
885
|
+
tag: 'ok',
|
|
886
|
+
val: undefined
|
|
887
|
+
};
|
|
1257
888
|
break;
|
|
1258
889
|
}
|
|
1259
|
-
case
|
|
1260
|
-
|
|
890
|
+
case 1: {
|
|
891
|
+
variant0= {
|
|
892
|
+
tag: 'err',
|
|
893
|
+
val: undefined
|
|
894
|
+
};
|
|
1261
895
|
break;
|
|
1262
896
|
}
|
|
1263
|
-
|
|
1264
|
-
|
|
897
|
+
default: {
|
|
898
|
+
throw new TypeError('invalid variant discriminant for expected');
|
|
899
|
+
}
|
|
900
|
+
}
|
|
901
|
+
_debugLog('[iface="wasi:cli/exit@0.2.6", function="exit"] [Instruction::CallInterface] (async? sync, @ enter)');
|
|
902
|
+
const _interface_call_currentTaskID = startCurrentTask(0, false, 'exit');
|
|
903
|
+
exit(variant0);
|
|
904
|
+
_debugLog('[iface="wasi:cli/exit@0.2.6", function="exit"] [Instruction::CallInterface] (sync, @ post-call)');
|
|
905
|
+
endCurrentTask(0);
|
|
906
|
+
_debugLog('[iface="wasi:cli/exit@0.2.6", function="exit"][Instruction::Return]', {
|
|
907
|
+
funcName: 'exit',
|
|
908
|
+
paramCount: 0,
|
|
909
|
+
async: false,
|
|
910
|
+
postReturn: false
|
|
911
|
+
});
|
|
912
|
+
}
|
|
913
|
+
|
|
914
|
+
let exports2;
|
|
915
|
+
let memory0;
|
|
916
|
+
let realloc0;
|
|
917
|
+
let realloc1;
|
|
918
|
+
const handleTable0 = [T_FLAG, 0];
|
|
919
|
+
const captureTable0= new Map();
|
|
920
|
+
let captureCnt0 = 0;
|
|
921
|
+
handleTables[0] = handleTable0;
|
|
922
|
+
|
|
923
|
+
function trampoline9(arg0, arg1) {
|
|
924
|
+
var handle1 = arg0;
|
|
925
|
+
var rep2 = handleTable0[(handle1 << 1) + 1] & ~T_FLAG;
|
|
926
|
+
var rsc0 = captureTable0.get(rep2);
|
|
927
|
+
if (!rsc0) {
|
|
928
|
+
rsc0 = Object.create(Error$1.prototype);
|
|
929
|
+
Object.defineProperty(rsc0, symbolRscHandle, { writable: true, value: handle1});
|
|
930
|
+
Object.defineProperty(rsc0, symbolRscRep, { writable: true, value: rep2});
|
|
931
|
+
}
|
|
932
|
+
curResourceBorrows.push(rsc0);
|
|
933
|
+
_debugLog('[iface="wasi:io/error@0.2.6", function="[method]error.to-debug-string"] [Instruction::CallInterface] (async? sync, @ enter)');
|
|
934
|
+
const _interface_call_currentTaskID = startCurrentTask(0, false, '[method]error.to-debug-string');
|
|
935
|
+
const ret = rsc0.toDebugString();
|
|
936
|
+
_debugLog('[iface="wasi:io/error@0.2.6", function="[method]error.to-debug-string"] [Instruction::CallInterface] (sync, @ post-call)');
|
|
937
|
+
for (const rsc of curResourceBorrows) {
|
|
938
|
+
rsc[symbolRscHandle] = undefined;
|
|
939
|
+
}
|
|
940
|
+
curResourceBorrows = [];
|
|
941
|
+
endCurrentTask(0);
|
|
942
|
+
var ptr3 = utf8Encode(ret, realloc0, memory0);
|
|
943
|
+
var len3 = utf8EncodedLen;
|
|
944
|
+
dataView(memory0).setUint32(arg1 + 4, len3, true);
|
|
945
|
+
dataView(memory0).setUint32(arg1 + 0, ptr3, true);
|
|
946
|
+
_debugLog('[iface="wasi:io/error@0.2.6", function="[method]error.to-debug-string"][Instruction::Return]', {
|
|
947
|
+
funcName: '[method]error.to-debug-string',
|
|
948
|
+
paramCount: 0,
|
|
949
|
+
async: false,
|
|
950
|
+
postReturn: false
|
|
951
|
+
});
|
|
952
|
+
}
|
|
953
|
+
|
|
954
|
+
|
|
955
|
+
function trampoline10(arg0, arg1, arg2, arg3) {
|
|
956
|
+
var handle1 = arg0;
|
|
957
|
+
var rep2 = handleTable1[(handle1 << 1) + 1] & ~T_FLAG;
|
|
958
|
+
var rsc0 = captureTable1.get(rep2);
|
|
959
|
+
if (!rsc0) {
|
|
960
|
+
rsc0 = Object.create(OutputStream.prototype);
|
|
961
|
+
Object.defineProperty(rsc0, symbolRscHandle, { writable: true, value: handle1});
|
|
962
|
+
Object.defineProperty(rsc0, symbolRscRep, { writable: true, value: rep2});
|
|
963
|
+
}
|
|
964
|
+
curResourceBorrows.push(rsc0);
|
|
965
|
+
var ptr3 = arg1;
|
|
966
|
+
var len3 = arg2;
|
|
967
|
+
var result3 = new Uint8Array(memory0.buffer.slice(ptr3, ptr3 + len3 * 1));
|
|
968
|
+
_debugLog('[iface="wasi:io/streams@0.2.6", function="[method]output-stream.blocking-write-and-flush"] [Instruction::CallInterface] (async? sync, @ enter)');
|
|
969
|
+
const _interface_call_currentTaskID = startCurrentTask(0, false, '[method]output-stream.blocking-write-and-flush');
|
|
970
|
+
let ret;
|
|
971
|
+
try {
|
|
972
|
+
ret = { tag: 'ok', val: rsc0.blockingWriteAndFlush(result3)};
|
|
973
|
+
} catch (e) {
|
|
974
|
+
ret = { tag: 'err', val: getErrorPayload(e) };
|
|
975
|
+
}
|
|
976
|
+
_debugLog('[iface="wasi:io/streams@0.2.6", function="[method]output-stream.blocking-write-and-flush"] [Instruction::CallInterface] (sync, @ post-call)');
|
|
977
|
+
for (const rsc of curResourceBorrows) {
|
|
978
|
+
rsc[symbolRscHandle] = undefined;
|
|
979
|
+
}
|
|
980
|
+
curResourceBorrows = [];
|
|
981
|
+
endCurrentTask(0);
|
|
982
|
+
var variant6 = ret;
|
|
983
|
+
switch (variant6.tag) {
|
|
984
|
+
case 'ok': {
|
|
985
|
+
const e = variant6.val;
|
|
986
|
+
dataView(memory0).setInt8(arg3 + 0, 0, true);
|
|
1265
987
|
break;
|
|
1266
988
|
}
|
|
1267
|
-
case '
|
|
1268
|
-
|
|
989
|
+
case 'err': {
|
|
990
|
+
const e = variant6.val;
|
|
991
|
+
dataView(memory0).setInt8(arg3 + 0, 1, true);
|
|
992
|
+
var variant5 = e;
|
|
993
|
+
switch (variant5.tag) {
|
|
994
|
+
case 'last-operation-failed': {
|
|
995
|
+
const e = variant5.val;
|
|
996
|
+
dataView(memory0).setInt8(arg3 + 4, 0, true);
|
|
997
|
+
if (!(e instanceof Error$1)) {
|
|
998
|
+
throw new TypeError('Resource error: Not a valid "Error" resource.');
|
|
999
|
+
}
|
|
1000
|
+
var handle4 = e[symbolRscHandle];
|
|
1001
|
+
if (!handle4) {
|
|
1002
|
+
const rep = e[symbolRscRep] || ++captureCnt0;
|
|
1003
|
+
captureTable0.set(rep, e);
|
|
1004
|
+
handle4 = rscTableCreateOwn(handleTable0, rep);
|
|
1005
|
+
}
|
|
1006
|
+
dataView(memory0).setInt32(arg3 + 8, handle4, true);
|
|
1007
|
+
break;
|
|
1008
|
+
}
|
|
1009
|
+
case 'closed': {
|
|
1010
|
+
dataView(memory0).setInt8(arg3 + 4, 1, true);
|
|
1011
|
+
break;
|
|
1012
|
+
}
|
|
1013
|
+
default: {
|
|
1014
|
+
throw new TypeError(`invalid variant tag value \`${JSON.stringify(variant5.tag)}\` (received \`${variant5}\`) specified for \`StreamError\``);
|
|
1015
|
+
}
|
|
1016
|
+
}
|
|
1269
1017
|
break;
|
|
1270
1018
|
}
|
|
1271
1019
|
default: {
|
|
1272
|
-
|
|
1273
|
-
console.error(e);
|
|
1274
|
-
}
|
|
1275
|
-
|
|
1276
|
-
throw new TypeError(`"${val3}" is not one of the cases of error-code`);
|
|
1020
|
+
throw new TypeError('invalid variant specified for result');
|
|
1277
1021
|
}
|
|
1278
1022
|
}
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
postReturn: false
|
|
1286
|
-
});
|
|
1287
|
-
}
|
|
1288
|
-
|
|
1289
|
-
const handleTable4 = [T_FLAG, 0];
|
|
1290
|
-
const captureTable4= new Map();
|
|
1291
|
-
let captureCnt4 = 0;
|
|
1292
|
-
handleTables[4] = handleTable4;
|
|
1293
|
-
|
|
1294
|
-
function trampoline14(arg0, arg1, arg2) {
|
|
1295
|
-
var handle1 = arg0;
|
|
1296
|
-
var rep2 = handleTable4[(handle1 << 1) + 1] & ~T_FLAG;
|
|
1297
|
-
var rsc0 = captureTable4.get(rep2);
|
|
1298
|
-
if (!rsc0) {
|
|
1299
|
-
rsc0 = Object.create(Descriptor.prototype);
|
|
1300
|
-
Object.defineProperty(rsc0, symbolRscHandle, { writable: true, value: handle1});
|
|
1301
|
-
Object.defineProperty(rsc0, symbolRscRep, { writable: true, value: rep2});
|
|
1023
|
+
_debugLog('[iface="wasi:io/streams@0.2.6", function="[method]output-stream.blocking-write-and-flush"][Instruction::Return]', {
|
|
1024
|
+
funcName: '[method]output-stream.blocking-write-and-flush',
|
|
1025
|
+
paramCount: 0,
|
|
1026
|
+
async: false,
|
|
1027
|
+
postReturn: false
|
|
1028
|
+
});
|
|
1302
1029
|
}
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
ret =
|
|
1309
|
-
|
|
1310
|
-
|
|
1030
|
+
|
|
1031
|
+
|
|
1032
|
+
function trampoline11(arg0) {
|
|
1033
|
+
_debugLog('[iface="wasi:random/insecure-seed@0.2.6", function="insecure-seed"] [Instruction::CallInterface] (async? sync, @ enter)');
|
|
1034
|
+
const _interface_call_currentTaskID = startCurrentTask(0, false, 'insecure-seed');
|
|
1035
|
+
const ret = insecureSeed();
|
|
1036
|
+
_debugLog('[iface="wasi:random/insecure-seed@0.2.6", function="insecure-seed"] [Instruction::CallInterface] (sync, @ post-call)');
|
|
1037
|
+
endCurrentTask(0);
|
|
1038
|
+
var [tuple0_0, tuple0_1] = ret;
|
|
1039
|
+
dataView(memory0).setBigInt64(arg0 + 0, toUint64(tuple0_0), true);
|
|
1040
|
+
dataView(memory0).setBigInt64(arg0 + 8, toUint64(tuple0_1), true);
|
|
1041
|
+
_debugLog('[iface="wasi:random/insecure-seed@0.2.6", function="insecure-seed"][Instruction::Return]', {
|
|
1042
|
+
funcName: 'insecure-seed',
|
|
1043
|
+
paramCount: 0,
|
|
1044
|
+
async: false,
|
|
1045
|
+
postReturn: false
|
|
1046
|
+
});
|
|
1311
1047
|
}
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
|
|
1048
|
+
|
|
1049
|
+
|
|
1050
|
+
function trampoline12(arg0) {
|
|
1051
|
+
_debugLog('[iface="wasi:cli/environment@0.2.6", function="get-environment"] [Instruction::CallInterface] (async? sync, @ enter)');
|
|
1052
|
+
const _interface_call_currentTaskID = startCurrentTask(0, false, 'get-environment');
|
|
1053
|
+
const ret = getEnvironment();
|
|
1054
|
+
_debugLog('[iface="wasi:cli/environment@0.2.6", function="get-environment"] [Instruction::CallInterface] (sync, @ post-call)');
|
|
1055
|
+
endCurrentTask(0);
|
|
1056
|
+
var vec3 = ret;
|
|
1057
|
+
var len3 = vec3.length;
|
|
1058
|
+
var result3 = realloc1(0, 0, 4, len3 * 16);
|
|
1059
|
+
for (let i = 0; i < vec3.length; i++) {
|
|
1060
|
+
const e = vec3[i];
|
|
1061
|
+
const base = result3 + i * 16;var [tuple0_0, tuple0_1] = e;
|
|
1062
|
+
var ptr1 = utf8Encode(tuple0_0, realloc1, memory0);
|
|
1063
|
+
var len1 = utf8EncodedLen;
|
|
1064
|
+
dataView(memory0).setUint32(base + 4, len1, true);
|
|
1065
|
+
dataView(memory0).setUint32(base + 0, ptr1, true);
|
|
1066
|
+
var ptr2 = utf8Encode(tuple0_1, realloc1, memory0);
|
|
1067
|
+
var len2 = utf8EncodedLen;
|
|
1068
|
+
dataView(memory0).setUint32(base + 12, len2, true);
|
|
1069
|
+
dataView(memory0).setUint32(base + 8, ptr2, true);
|
|
1070
|
+
}
|
|
1071
|
+
dataView(memory0).setUint32(arg0 + 4, len3, true);
|
|
1072
|
+
dataView(memory0).setUint32(arg0 + 0, result3, true);
|
|
1073
|
+
_debugLog('[iface="wasi:cli/environment@0.2.6", function="get-environment"][Instruction::Return]', {
|
|
1074
|
+
funcName: 'get-environment',
|
|
1075
|
+
paramCount: 0,
|
|
1076
|
+
async: false,
|
|
1077
|
+
postReturn: false
|
|
1078
|
+
});
|
|
1315
1079
|
}
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
}
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
}
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1080
|
+
|
|
1081
|
+
|
|
1082
|
+
function trampoline13(arg0, arg1) {
|
|
1083
|
+
var handle1 = arg0;
|
|
1084
|
+
var rep2 = handleTable0[(handle1 << 1) + 1] & ~T_FLAG;
|
|
1085
|
+
var rsc0 = captureTable0.get(rep2);
|
|
1086
|
+
if (!rsc0) {
|
|
1087
|
+
rsc0 = Object.create(Error$1.prototype);
|
|
1088
|
+
Object.defineProperty(rsc0, symbolRscHandle, { writable: true, value: handle1});
|
|
1089
|
+
Object.defineProperty(rsc0, symbolRscRep, { writable: true, value: rep2});
|
|
1090
|
+
}
|
|
1091
|
+
curResourceBorrows.push(rsc0);
|
|
1092
|
+
_debugLog('[iface="wasi:filesystem/types@0.2.6", function="filesystem-error-code"] [Instruction::CallInterface] (async? sync, @ enter)');
|
|
1093
|
+
const _interface_call_currentTaskID = startCurrentTask(0, false, 'filesystem-error-code');
|
|
1094
|
+
const ret = filesystemErrorCode(rsc0);
|
|
1095
|
+
_debugLog('[iface="wasi:filesystem/types@0.2.6", function="filesystem-error-code"] [Instruction::CallInterface] (sync, @ post-call)');
|
|
1096
|
+
for (const rsc of curResourceBorrows) {
|
|
1097
|
+
rsc[symbolRscHandle] = undefined;
|
|
1098
|
+
}
|
|
1099
|
+
curResourceBorrows = [];
|
|
1100
|
+
endCurrentTask(0);
|
|
1101
|
+
var variant4 = ret;
|
|
1102
|
+
if (variant4 === null || variant4=== undefined) {
|
|
1103
|
+
dataView(memory0).setInt8(arg1 + 0, 0, true);
|
|
1104
|
+
} else {
|
|
1105
|
+
const e = variant4;
|
|
1106
|
+
dataView(memory0).setInt8(arg1 + 0, 1, true);
|
|
1107
|
+
var val3 = e;
|
|
1108
|
+
let enum3;
|
|
1109
|
+
switch (val3) {
|
|
1341
1110
|
case 'access': {
|
|
1342
|
-
|
|
1111
|
+
enum3 = 0;
|
|
1343
1112
|
break;
|
|
1344
1113
|
}
|
|
1345
1114
|
case 'would-block': {
|
|
1346
|
-
|
|
1115
|
+
enum3 = 1;
|
|
1347
1116
|
break;
|
|
1348
1117
|
}
|
|
1349
1118
|
case 'already': {
|
|
1350
|
-
|
|
1119
|
+
enum3 = 2;
|
|
1351
1120
|
break;
|
|
1352
1121
|
}
|
|
1353
1122
|
case 'bad-descriptor': {
|
|
1354
|
-
|
|
1123
|
+
enum3 = 3;
|
|
1355
1124
|
break;
|
|
1356
1125
|
}
|
|
1357
1126
|
case 'busy': {
|
|
1358
|
-
|
|
1127
|
+
enum3 = 4;
|
|
1359
1128
|
break;
|
|
1360
1129
|
}
|
|
1361
1130
|
case 'deadlock': {
|
|
1362
|
-
|
|
1131
|
+
enum3 = 5;
|
|
1363
1132
|
break;
|
|
1364
1133
|
}
|
|
1365
1134
|
case 'quota': {
|
|
1366
|
-
|
|
1135
|
+
enum3 = 6;
|
|
1367
1136
|
break;
|
|
1368
1137
|
}
|
|
1369
1138
|
case 'exist': {
|
|
1370
|
-
|
|
1139
|
+
enum3 = 7;
|
|
1371
1140
|
break;
|
|
1372
1141
|
}
|
|
1373
1142
|
case 'file-too-large': {
|
|
1374
|
-
|
|
1143
|
+
enum3 = 8;
|
|
1375
1144
|
break;
|
|
1376
1145
|
}
|
|
1377
1146
|
case 'illegal-byte-sequence': {
|
|
1378
|
-
|
|
1147
|
+
enum3 = 9;
|
|
1379
1148
|
break;
|
|
1380
1149
|
}
|
|
1381
1150
|
case 'in-progress': {
|
|
1382
|
-
|
|
1151
|
+
enum3 = 10;
|
|
1383
1152
|
break;
|
|
1384
1153
|
}
|
|
1385
1154
|
case 'interrupted': {
|
|
1386
|
-
|
|
1155
|
+
enum3 = 11;
|
|
1387
1156
|
break;
|
|
1388
1157
|
}
|
|
1389
1158
|
case 'invalid': {
|
|
1390
|
-
|
|
1159
|
+
enum3 = 12;
|
|
1391
1160
|
break;
|
|
1392
1161
|
}
|
|
1393
1162
|
case 'io': {
|
|
1394
|
-
|
|
1163
|
+
enum3 = 13;
|
|
1395
1164
|
break;
|
|
1396
1165
|
}
|
|
1397
1166
|
case 'is-directory': {
|
|
1398
|
-
|
|
1167
|
+
enum3 = 14;
|
|
1399
1168
|
break;
|
|
1400
1169
|
}
|
|
1401
1170
|
case 'loop': {
|
|
1402
|
-
|
|
1171
|
+
enum3 = 15;
|
|
1403
1172
|
break;
|
|
1404
1173
|
}
|
|
1405
1174
|
case 'too-many-links': {
|
|
1406
|
-
|
|
1175
|
+
enum3 = 16;
|
|
1407
1176
|
break;
|
|
1408
1177
|
}
|
|
1409
1178
|
case 'message-size': {
|
|
1410
|
-
|
|
1179
|
+
enum3 = 17;
|
|
1411
1180
|
break;
|
|
1412
1181
|
}
|
|
1413
1182
|
case 'name-too-long': {
|
|
1414
|
-
|
|
1183
|
+
enum3 = 18;
|
|
1415
1184
|
break;
|
|
1416
1185
|
}
|
|
1417
1186
|
case 'no-device': {
|
|
1418
|
-
|
|
1187
|
+
enum3 = 19;
|
|
1419
1188
|
break;
|
|
1420
1189
|
}
|
|
1421
1190
|
case 'no-entry': {
|
|
1422
|
-
|
|
1191
|
+
enum3 = 20;
|
|
1423
1192
|
break;
|
|
1424
1193
|
}
|
|
1425
1194
|
case 'no-lock': {
|
|
1426
|
-
|
|
1195
|
+
enum3 = 21;
|
|
1427
1196
|
break;
|
|
1428
1197
|
}
|
|
1429
1198
|
case 'insufficient-memory': {
|
|
1430
|
-
|
|
1199
|
+
enum3 = 22;
|
|
1431
1200
|
break;
|
|
1432
1201
|
}
|
|
1433
1202
|
case 'insufficient-space': {
|
|
1434
|
-
|
|
1203
|
+
enum3 = 23;
|
|
1435
1204
|
break;
|
|
1436
1205
|
}
|
|
1437
1206
|
case 'not-directory': {
|
|
1438
|
-
|
|
1207
|
+
enum3 = 24;
|
|
1439
1208
|
break;
|
|
1440
1209
|
}
|
|
1441
1210
|
case 'not-empty': {
|
|
1442
|
-
|
|
1211
|
+
enum3 = 25;
|
|
1443
1212
|
break;
|
|
1444
1213
|
}
|
|
1445
1214
|
case 'not-recoverable': {
|
|
1446
|
-
|
|
1215
|
+
enum3 = 26;
|
|
1447
1216
|
break;
|
|
1448
1217
|
}
|
|
1449
1218
|
case 'unsupported': {
|
|
1450
|
-
|
|
1219
|
+
enum3 = 27;
|
|
1451
1220
|
break;
|
|
1452
1221
|
}
|
|
1453
1222
|
case 'no-tty': {
|
|
1454
|
-
|
|
1223
|
+
enum3 = 28;
|
|
1455
1224
|
break;
|
|
1456
1225
|
}
|
|
1457
1226
|
case 'no-such-device': {
|
|
1458
|
-
|
|
1227
|
+
enum3 = 29;
|
|
1459
1228
|
break;
|
|
1460
1229
|
}
|
|
1461
1230
|
case 'overflow': {
|
|
1462
|
-
|
|
1231
|
+
enum3 = 30;
|
|
1463
1232
|
break;
|
|
1464
1233
|
}
|
|
1465
1234
|
case 'not-permitted': {
|
|
1466
|
-
|
|
1235
|
+
enum3 = 31;
|
|
1467
1236
|
break;
|
|
1468
1237
|
}
|
|
1469
1238
|
case 'pipe': {
|
|
1470
|
-
|
|
1239
|
+
enum3 = 32;
|
|
1471
1240
|
break;
|
|
1472
1241
|
}
|
|
1473
1242
|
case 'read-only': {
|
|
1474
|
-
|
|
1243
|
+
enum3 = 33;
|
|
1475
1244
|
break;
|
|
1476
1245
|
}
|
|
1477
1246
|
case 'invalid-seek': {
|
|
1478
|
-
|
|
1247
|
+
enum3 = 34;
|
|
1479
1248
|
break;
|
|
1480
1249
|
}
|
|
1481
1250
|
case 'text-file-busy': {
|
|
1482
|
-
|
|
1251
|
+
enum3 = 35;
|
|
1483
1252
|
break;
|
|
1484
1253
|
}
|
|
1485
1254
|
case 'cross-device': {
|
|
1486
|
-
|
|
1255
|
+
enum3 = 36;
|
|
1487
1256
|
break;
|
|
1488
1257
|
}
|
|
1489
1258
|
default: {
|
|
@@ -1491,1317 +1260,1526 @@ function trampoline14(arg0, arg1, arg2) {
|
|
|
1491
1260
|
console.error(e);
|
|
1492
1261
|
}
|
|
1493
1262
|
|
|
1494
|
-
throw new TypeError(`"${
|
|
1263
|
+
throw new TypeError(`"${val3}" is not one of the cases of error-code`);
|
|
1495
1264
|
}
|
|
1496
1265
|
}
|
|
1497
|
-
dataView(memory0).setInt8(
|
|
1498
|
-
break;
|
|
1499
|
-
}
|
|
1500
|
-
default: {
|
|
1501
|
-
throw new TypeError('invalid variant specified for result');
|
|
1266
|
+
dataView(memory0).setInt8(arg1 + 1, enum3, true);
|
|
1502
1267
|
}
|
|
1268
|
+
_debugLog('[iface="wasi:filesystem/types@0.2.6", function="filesystem-error-code"][Instruction::Return]', {
|
|
1269
|
+
funcName: 'filesystem-error-code',
|
|
1270
|
+
paramCount: 0,
|
|
1271
|
+
async: false,
|
|
1272
|
+
postReturn: false
|
|
1273
|
+
});
|
|
1503
1274
|
}
|
|
1504
|
-
|
|
1505
|
-
|
|
1506
|
-
|
|
1507
|
-
|
|
1508
|
-
|
|
1509
|
-
|
|
1510
|
-
|
|
1511
|
-
|
|
1512
|
-
|
|
1513
|
-
|
|
1514
|
-
|
|
1515
|
-
|
|
1516
|
-
|
|
1517
|
-
|
|
1518
|
-
|
|
1519
|
-
|
|
1520
|
-
|
|
1521
|
-
|
|
1522
|
-
|
|
1523
|
-
|
|
1524
|
-
|
|
1525
|
-
|
|
1526
|
-
|
|
1527
|
-
|
|
1528
|
-
|
|
1529
|
-
|
|
1530
|
-
|
|
1531
|
-
|
|
1532
|
-
|
|
1533
|
-
|
|
1534
|
-
|
|
1535
|
-
|
|
1536
|
-
|
|
1537
|
-
|
|
1538
|
-
|
|
1539
|
-
|
|
1540
|
-
|
|
1541
|
-
|
|
1542
|
-
|
|
1543
|
-
|
|
1275
|
+
|
|
1276
|
+
const handleTable4 = [T_FLAG, 0];
|
|
1277
|
+
const captureTable4= new Map();
|
|
1278
|
+
let captureCnt4 = 0;
|
|
1279
|
+
handleTables[4] = handleTable4;
|
|
1280
|
+
|
|
1281
|
+
function trampoline14(arg0, arg1, arg2) {
|
|
1282
|
+
var handle1 = arg0;
|
|
1283
|
+
var rep2 = handleTable4[(handle1 << 1) + 1] & ~T_FLAG;
|
|
1284
|
+
var rsc0 = captureTable4.get(rep2);
|
|
1285
|
+
if (!rsc0) {
|
|
1286
|
+
rsc0 = Object.create(Descriptor.prototype);
|
|
1287
|
+
Object.defineProperty(rsc0, symbolRscHandle, { writable: true, value: handle1});
|
|
1288
|
+
Object.defineProperty(rsc0, symbolRscRep, { writable: true, value: rep2});
|
|
1289
|
+
}
|
|
1290
|
+
curResourceBorrows.push(rsc0);
|
|
1291
|
+
_debugLog('[iface="wasi:filesystem/types@0.2.6", function="[method]descriptor.write-via-stream"] [Instruction::CallInterface] (async? sync, @ enter)');
|
|
1292
|
+
const _interface_call_currentTaskID = startCurrentTask(0, false, '[method]descriptor.write-via-stream');
|
|
1293
|
+
let ret;
|
|
1294
|
+
try {
|
|
1295
|
+
ret = { tag: 'ok', val: rsc0.writeViaStream(BigInt.asUintN(64, arg1))};
|
|
1296
|
+
} catch (e) {
|
|
1297
|
+
ret = { tag: 'err', val: getErrorPayload(e) };
|
|
1298
|
+
}
|
|
1299
|
+
_debugLog('[iface="wasi:filesystem/types@0.2.6", function="[method]descriptor.write-via-stream"] [Instruction::CallInterface] (sync, @ post-call)');
|
|
1300
|
+
for (const rsc of curResourceBorrows) {
|
|
1301
|
+
rsc[symbolRscHandle] = undefined;
|
|
1302
|
+
}
|
|
1303
|
+
curResourceBorrows = [];
|
|
1304
|
+
endCurrentTask(0);
|
|
1305
|
+
var variant5 = ret;
|
|
1306
|
+
switch (variant5.tag) {
|
|
1307
|
+
case 'ok': {
|
|
1308
|
+
const e = variant5.val;
|
|
1309
|
+
dataView(memory0).setInt8(arg2 + 0, 0, true);
|
|
1310
|
+
if (!(e instanceof OutputStream)) {
|
|
1311
|
+
throw new TypeError('Resource error: Not a valid "OutputStream" resource.');
|
|
1312
|
+
}
|
|
1313
|
+
var handle3 = e[symbolRscHandle];
|
|
1314
|
+
if (!handle3) {
|
|
1315
|
+
const rep = e[symbolRscRep] || ++captureCnt1;
|
|
1316
|
+
captureTable1.set(rep, e);
|
|
1317
|
+
handle3 = rscTableCreateOwn(handleTable1, rep);
|
|
1318
|
+
}
|
|
1319
|
+
dataView(memory0).setInt32(arg2 + 4, handle3, true);
|
|
1320
|
+
break;
|
|
1321
|
+
}
|
|
1322
|
+
case 'err': {
|
|
1323
|
+
const e = variant5.val;
|
|
1324
|
+
dataView(memory0).setInt8(arg2 + 0, 1, true);
|
|
1325
|
+
var val4 = e;
|
|
1326
|
+
let enum4;
|
|
1327
|
+
switch (val4) {
|
|
1328
|
+
case 'access': {
|
|
1329
|
+
enum4 = 0;
|
|
1330
|
+
break;
|
|
1331
|
+
}
|
|
1332
|
+
case 'would-block': {
|
|
1333
|
+
enum4 = 1;
|
|
1334
|
+
break;
|
|
1335
|
+
}
|
|
1336
|
+
case 'already': {
|
|
1337
|
+
enum4 = 2;
|
|
1338
|
+
break;
|
|
1339
|
+
}
|
|
1340
|
+
case 'bad-descriptor': {
|
|
1341
|
+
enum4 = 3;
|
|
1342
|
+
break;
|
|
1343
|
+
}
|
|
1344
|
+
case 'busy': {
|
|
1345
|
+
enum4 = 4;
|
|
1346
|
+
break;
|
|
1347
|
+
}
|
|
1348
|
+
case 'deadlock': {
|
|
1349
|
+
enum4 = 5;
|
|
1350
|
+
break;
|
|
1351
|
+
}
|
|
1352
|
+
case 'quota': {
|
|
1353
|
+
enum4 = 6;
|
|
1354
|
+
break;
|
|
1355
|
+
}
|
|
1356
|
+
case 'exist': {
|
|
1357
|
+
enum4 = 7;
|
|
1358
|
+
break;
|
|
1359
|
+
}
|
|
1360
|
+
case 'file-too-large': {
|
|
1361
|
+
enum4 = 8;
|
|
1362
|
+
break;
|
|
1363
|
+
}
|
|
1364
|
+
case 'illegal-byte-sequence': {
|
|
1365
|
+
enum4 = 9;
|
|
1366
|
+
break;
|
|
1367
|
+
}
|
|
1368
|
+
case 'in-progress': {
|
|
1369
|
+
enum4 = 10;
|
|
1370
|
+
break;
|
|
1371
|
+
}
|
|
1372
|
+
case 'interrupted': {
|
|
1373
|
+
enum4 = 11;
|
|
1374
|
+
break;
|
|
1375
|
+
}
|
|
1376
|
+
case 'invalid': {
|
|
1377
|
+
enum4 = 12;
|
|
1378
|
+
break;
|
|
1379
|
+
}
|
|
1380
|
+
case 'io': {
|
|
1381
|
+
enum4 = 13;
|
|
1382
|
+
break;
|
|
1383
|
+
}
|
|
1384
|
+
case 'is-directory': {
|
|
1385
|
+
enum4 = 14;
|
|
1386
|
+
break;
|
|
1387
|
+
}
|
|
1388
|
+
case 'loop': {
|
|
1389
|
+
enum4 = 15;
|
|
1390
|
+
break;
|
|
1391
|
+
}
|
|
1392
|
+
case 'too-many-links': {
|
|
1393
|
+
enum4 = 16;
|
|
1394
|
+
break;
|
|
1395
|
+
}
|
|
1396
|
+
case 'message-size': {
|
|
1397
|
+
enum4 = 17;
|
|
1398
|
+
break;
|
|
1399
|
+
}
|
|
1400
|
+
case 'name-too-long': {
|
|
1401
|
+
enum4 = 18;
|
|
1402
|
+
break;
|
|
1403
|
+
}
|
|
1404
|
+
case 'no-device': {
|
|
1405
|
+
enum4 = 19;
|
|
1406
|
+
break;
|
|
1407
|
+
}
|
|
1408
|
+
case 'no-entry': {
|
|
1409
|
+
enum4 = 20;
|
|
1410
|
+
break;
|
|
1411
|
+
}
|
|
1412
|
+
case 'no-lock': {
|
|
1413
|
+
enum4 = 21;
|
|
1414
|
+
break;
|
|
1415
|
+
}
|
|
1416
|
+
case 'insufficient-memory': {
|
|
1417
|
+
enum4 = 22;
|
|
1418
|
+
break;
|
|
1419
|
+
}
|
|
1420
|
+
case 'insufficient-space': {
|
|
1421
|
+
enum4 = 23;
|
|
1422
|
+
break;
|
|
1423
|
+
}
|
|
1424
|
+
case 'not-directory': {
|
|
1425
|
+
enum4 = 24;
|
|
1426
|
+
break;
|
|
1427
|
+
}
|
|
1428
|
+
case 'not-empty': {
|
|
1429
|
+
enum4 = 25;
|
|
1430
|
+
break;
|
|
1431
|
+
}
|
|
1432
|
+
case 'not-recoverable': {
|
|
1433
|
+
enum4 = 26;
|
|
1434
|
+
break;
|
|
1435
|
+
}
|
|
1436
|
+
case 'unsupported': {
|
|
1437
|
+
enum4 = 27;
|
|
1438
|
+
break;
|
|
1439
|
+
}
|
|
1440
|
+
case 'no-tty': {
|
|
1441
|
+
enum4 = 28;
|
|
1442
|
+
break;
|
|
1443
|
+
}
|
|
1444
|
+
case 'no-such-device': {
|
|
1445
|
+
enum4 = 29;
|
|
1446
|
+
break;
|
|
1447
|
+
}
|
|
1448
|
+
case 'overflow': {
|
|
1449
|
+
enum4 = 30;
|
|
1450
|
+
break;
|
|
1451
|
+
}
|
|
1452
|
+
case 'not-permitted': {
|
|
1453
|
+
enum4 = 31;
|
|
1454
|
+
break;
|
|
1455
|
+
}
|
|
1456
|
+
case 'pipe': {
|
|
1457
|
+
enum4 = 32;
|
|
1458
|
+
break;
|
|
1459
|
+
}
|
|
1460
|
+
case 'read-only': {
|
|
1461
|
+
enum4 = 33;
|
|
1462
|
+
break;
|
|
1463
|
+
}
|
|
1464
|
+
case 'invalid-seek': {
|
|
1465
|
+
enum4 = 34;
|
|
1466
|
+
break;
|
|
1467
|
+
}
|
|
1468
|
+
case 'text-file-busy': {
|
|
1469
|
+
enum4 = 35;
|
|
1470
|
+
break;
|
|
1471
|
+
}
|
|
1472
|
+
case 'cross-device': {
|
|
1473
|
+
enum4 = 36;
|
|
1474
|
+
break;
|
|
1475
|
+
}
|
|
1476
|
+
default: {
|
|
1477
|
+
if ((e) instanceof Error) {
|
|
1478
|
+
console.error(e);
|
|
1479
|
+
}
|
|
1480
|
+
|
|
1481
|
+
throw new TypeError(`"${val4}" is not one of the cases of error-code`);
|
|
1482
|
+
}
|
|
1483
|
+
}
|
|
1484
|
+
dataView(memory0).setInt8(arg2 + 4, enum4, true);
|
|
1485
|
+
break;
|
|
1544
1486
|
}
|
|
1545
|
-
|
|
1546
|
-
|
|
1547
|
-
const rep = e[symbolRscRep] || ++captureCnt1;
|
|
1548
|
-
captureTable1.set(rep, e);
|
|
1549
|
-
handle3 = rscTableCreateOwn(handleTable1, rep);
|
|
1487
|
+
default: {
|
|
1488
|
+
throw new TypeError('invalid variant specified for result');
|
|
1550
1489
|
}
|
|
1551
|
-
dataView(memory0).setInt32(arg1 + 4, handle3, true);
|
|
1552
|
-
break;
|
|
1553
1490
|
}
|
|
1554
|
-
|
|
1555
|
-
|
|
1556
|
-
|
|
1557
|
-
|
|
1558
|
-
|
|
1559
|
-
|
|
1560
|
-
case 'access': {
|
|
1561
|
-
enum4 = 0;
|
|
1562
|
-
break;
|
|
1563
|
-
}
|
|
1564
|
-
case 'would-block': {
|
|
1565
|
-
enum4 = 1;
|
|
1566
|
-
break;
|
|
1567
|
-
}
|
|
1568
|
-
case 'already': {
|
|
1569
|
-
enum4 = 2;
|
|
1570
|
-
break;
|
|
1571
|
-
}
|
|
1572
|
-
case 'bad-descriptor': {
|
|
1573
|
-
enum4 = 3;
|
|
1574
|
-
break;
|
|
1575
|
-
}
|
|
1576
|
-
case 'busy': {
|
|
1577
|
-
enum4 = 4;
|
|
1578
|
-
break;
|
|
1579
|
-
}
|
|
1580
|
-
case 'deadlock': {
|
|
1581
|
-
enum4 = 5;
|
|
1582
|
-
break;
|
|
1583
|
-
}
|
|
1584
|
-
case 'quota': {
|
|
1585
|
-
enum4 = 6;
|
|
1586
|
-
break;
|
|
1587
|
-
}
|
|
1588
|
-
case 'exist': {
|
|
1589
|
-
enum4 = 7;
|
|
1590
|
-
break;
|
|
1591
|
-
}
|
|
1592
|
-
case 'file-too-large': {
|
|
1593
|
-
enum4 = 8;
|
|
1594
|
-
break;
|
|
1595
|
-
}
|
|
1596
|
-
case 'illegal-byte-sequence': {
|
|
1597
|
-
enum4 = 9;
|
|
1598
|
-
break;
|
|
1599
|
-
}
|
|
1600
|
-
case 'in-progress': {
|
|
1601
|
-
enum4 = 10;
|
|
1602
|
-
break;
|
|
1603
|
-
}
|
|
1604
|
-
case 'interrupted': {
|
|
1605
|
-
enum4 = 11;
|
|
1606
|
-
break;
|
|
1607
|
-
}
|
|
1608
|
-
case 'invalid': {
|
|
1609
|
-
enum4 = 12;
|
|
1610
|
-
break;
|
|
1611
|
-
}
|
|
1612
|
-
case 'io': {
|
|
1613
|
-
enum4 = 13;
|
|
1614
|
-
break;
|
|
1615
|
-
}
|
|
1616
|
-
case 'is-directory': {
|
|
1617
|
-
enum4 = 14;
|
|
1618
|
-
break;
|
|
1619
|
-
}
|
|
1620
|
-
case 'loop': {
|
|
1621
|
-
enum4 = 15;
|
|
1622
|
-
break;
|
|
1623
|
-
}
|
|
1624
|
-
case 'too-many-links': {
|
|
1625
|
-
enum4 = 16;
|
|
1626
|
-
break;
|
|
1627
|
-
}
|
|
1628
|
-
case 'message-size': {
|
|
1629
|
-
enum4 = 17;
|
|
1630
|
-
break;
|
|
1631
|
-
}
|
|
1632
|
-
case 'name-too-long': {
|
|
1633
|
-
enum4 = 18;
|
|
1634
|
-
break;
|
|
1635
|
-
}
|
|
1636
|
-
case 'no-device': {
|
|
1637
|
-
enum4 = 19;
|
|
1638
|
-
break;
|
|
1639
|
-
}
|
|
1640
|
-
case 'no-entry': {
|
|
1641
|
-
enum4 = 20;
|
|
1642
|
-
break;
|
|
1643
|
-
}
|
|
1644
|
-
case 'no-lock': {
|
|
1645
|
-
enum4 = 21;
|
|
1646
|
-
break;
|
|
1647
|
-
}
|
|
1648
|
-
case 'insufficient-memory': {
|
|
1649
|
-
enum4 = 22;
|
|
1650
|
-
break;
|
|
1651
|
-
}
|
|
1652
|
-
case 'insufficient-space': {
|
|
1653
|
-
enum4 = 23;
|
|
1654
|
-
break;
|
|
1655
|
-
}
|
|
1656
|
-
case 'not-directory': {
|
|
1657
|
-
enum4 = 24;
|
|
1658
|
-
break;
|
|
1659
|
-
}
|
|
1660
|
-
case 'not-empty': {
|
|
1661
|
-
enum4 = 25;
|
|
1662
|
-
break;
|
|
1663
|
-
}
|
|
1664
|
-
case 'not-recoverable': {
|
|
1665
|
-
enum4 = 26;
|
|
1666
|
-
break;
|
|
1667
|
-
}
|
|
1668
|
-
case 'unsupported': {
|
|
1669
|
-
enum4 = 27;
|
|
1670
|
-
break;
|
|
1671
|
-
}
|
|
1672
|
-
case 'no-tty': {
|
|
1673
|
-
enum4 = 28;
|
|
1674
|
-
break;
|
|
1675
|
-
}
|
|
1676
|
-
case 'no-such-device': {
|
|
1677
|
-
enum4 = 29;
|
|
1678
|
-
break;
|
|
1679
|
-
}
|
|
1680
|
-
case 'overflow': {
|
|
1681
|
-
enum4 = 30;
|
|
1682
|
-
break;
|
|
1683
|
-
}
|
|
1684
|
-
case 'not-permitted': {
|
|
1685
|
-
enum4 = 31;
|
|
1686
|
-
break;
|
|
1687
|
-
}
|
|
1688
|
-
case 'pipe': {
|
|
1689
|
-
enum4 = 32;
|
|
1690
|
-
break;
|
|
1691
|
-
}
|
|
1692
|
-
case 'read-only': {
|
|
1693
|
-
enum4 = 33;
|
|
1694
|
-
break;
|
|
1695
|
-
}
|
|
1696
|
-
case 'invalid-seek': {
|
|
1697
|
-
enum4 = 34;
|
|
1698
|
-
break;
|
|
1699
|
-
}
|
|
1700
|
-
case 'text-file-busy': {
|
|
1701
|
-
enum4 = 35;
|
|
1702
|
-
break;
|
|
1703
|
-
}
|
|
1704
|
-
case 'cross-device': {
|
|
1705
|
-
enum4 = 36;
|
|
1706
|
-
break;
|
|
1707
|
-
}
|
|
1708
|
-
default: {
|
|
1709
|
-
if ((e) instanceof Error) {
|
|
1710
|
-
console.error(e);
|
|
1711
|
-
}
|
|
1712
|
-
|
|
1713
|
-
throw new TypeError(`"${val4}" is not one of the cases of error-code`);
|
|
1714
|
-
}
|
|
1715
|
-
}
|
|
1716
|
-
dataView(memory0).setInt8(arg1 + 4, enum4, true);
|
|
1717
|
-
break;
|
|
1718
|
-
}
|
|
1719
|
-
default: {
|
|
1720
|
-
throw new TypeError('invalid variant specified for result');
|
|
1721
|
-
}
|
|
1722
|
-
}
|
|
1723
|
-
_debugLog('[iface="wasi:filesystem/types@0.2.6", function="[method]descriptor.append-via-stream"][Instruction::Return]', {
|
|
1724
|
-
funcName: '[method]descriptor.append-via-stream',
|
|
1725
|
-
paramCount: 0,
|
|
1726
|
-
async: false,
|
|
1727
|
-
postReturn: false
|
|
1728
|
-
});
|
|
1729
|
-
}
|
|
1730
|
-
|
|
1731
|
-
|
|
1732
|
-
function trampoline16(arg0, arg1) {
|
|
1733
|
-
var handle1 = arg0;
|
|
1734
|
-
var rep2 = handleTable4[(handle1 << 1) + 1] & ~T_FLAG;
|
|
1735
|
-
var rsc0 = captureTable4.get(rep2);
|
|
1736
|
-
if (!rsc0) {
|
|
1737
|
-
rsc0 = Object.create(Descriptor.prototype);
|
|
1738
|
-
Object.defineProperty(rsc0, symbolRscHandle, { writable: true, value: handle1});
|
|
1739
|
-
Object.defineProperty(rsc0, symbolRscRep, { writable: true, value: rep2});
|
|
1740
|
-
}
|
|
1741
|
-
curResourceBorrows.push(rsc0);
|
|
1742
|
-
_debugLog('[iface="wasi:filesystem/types@0.2.6", function="[method]descriptor.get-type"] [Instruction::CallInterface] (async? sync, @ enter)');
|
|
1743
|
-
const _interface_call_currentTaskID = startCurrentTask(0, false, '[method]descriptor.get-type');
|
|
1744
|
-
let ret;
|
|
1745
|
-
try {
|
|
1746
|
-
ret = { tag: 'ok', val: rsc0.getType()};
|
|
1747
|
-
} catch (e) {
|
|
1748
|
-
ret = { tag: 'err', val: getErrorPayload(e) };
|
|
1749
|
-
}
|
|
1750
|
-
_debugLog('[iface="wasi:filesystem/types@0.2.6", function="[method]descriptor.get-type"] [Instruction::CallInterface] (sync, @ post-call)');
|
|
1751
|
-
for (const rsc of curResourceBorrows) {
|
|
1752
|
-
rsc[symbolRscHandle] = undefined;
|
|
1491
|
+
_debugLog('[iface="wasi:filesystem/types@0.2.6", function="[method]descriptor.write-via-stream"][Instruction::Return]', {
|
|
1492
|
+
funcName: '[method]descriptor.write-via-stream',
|
|
1493
|
+
paramCount: 0,
|
|
1494
|
+
async: false,
|
|
1495
|
+
postReturn: false
|
|
1496
|
+
});
|
|
1753
1497
|
}
|
|
1754
|
-
|
|
1755
|
-
|
|
1756
|
-
|
|
1757
|
-
|
|
1758
|
-
|
|
1759
|
-
|
|
1760
|
-
|
|
1761
|
-
|
|
1762
|
-
|
|
1763
|
-
|
|
1764
|
-
case 'unknown': {
|
|
1765
|
-
enum3 = 0;
|
|
1766
|
-
break;
|
|
1767
|
-
}
|
|
1768
|
-
case 'block-device': {
|
|
1769
|
-
enum3 = 1;
|
|
1770
|
-
break;
|
|
1771
|
-
}
|
|
1772
|
-
case 'character-device': {
|
|
1773
|
-
enum3 = 2;
|
|
1774
|
-
break;
|
|
1775
|
-
}
|
|
1776
|
-
case 'directory': {
|
|
1777
|
-
enum3 = 3;
|
|
1778
|
-
break;
|
|
1779
|
-
}
|
|
1780
|
-
case 'fifo': {
|
|
1781
|
-
enum3 = 4;
|
|
1782
|
-
break;
|
|
1783
|
-
}
|
|
1784
|
-
case 'symbolic-link': {
|
|
1785
|
-
enum3 = 5;
|
|
1786
|
-
break;
|
|
1787
|
-
}
|
|
1788
|
-
case 'regular-file': {
|
|
1789
|
-
enum3 = 6;
|
|
1790
|
-
break;
|
|
1791
|
-
}
|
|
1792
|
-
case 'socket': {
|
|
1793
|
-
enum3 = 7;
|
|
1794
|
-
break;
|
|
1795
|
-
}
|
|
1796
|
-
default: {
|
|
1797
|
-
if ((e) instanceof Error) {
|
|
1798
|
-
console.error(e);
|
|
1799
|
-
}
|
|
1800
|
-
|
|
1801
|
-
throw new TypeError(`"${val3}" is not one of the cases of descriptor-type`);
|
|
1802
|
-
}
|
|
1803
|
-
}
|
|
1804
|
-
dataView(memory0).setInt8(arg1 + 1, enum3, true);
|
|
1805
|
-
break;
|
|
1498
|
+
|
|
1499
|
+
|
|
1500
|
+
function trampoline15(arg0, arg1) {
|
|
1501
|
+
var handle1 = arg0;
|
|
1502
|
+
var rep2 = handleTable4[(handle1 << 1) + 1] & ~T_FLAG;
|
|
1503
|
+
var rsc0 = captureTable4.get(rep2);
|
|
1504
|
+
if (!rsc0) {
|
|
1505
|
+
rsc0 = Object.create(Descriptor.prototype);
|
|
1506
|
+
Object.defineProperty(rsc0, symbolRscHandle, { writable: true, value: handle1});
|
|
1507
|
+
Object.defineProperty(rsc0, symbolRscRep, { writable: true, value: rep2});
|
|
1806
1508
|
}
|
|
1807
|
-
|
|
1808
|
-
|
|
1809
|
-
|
|
1810
|
-
|
|
1811
|
-
|
|
1812
|
-
|
|
1813
|
-
|
|
1814
|
-
|
|
1815
|
-
|
|
1816
|
-
|
|
1817
|
-
|
|
1818
|
-
|
|
1819
|
-
|
|
1820
|
-
|
|
1821
|
-
|
|
1822
|
-
|
|
1823
|
-
|
|
1824
|
-
|
|
1825
|
-
|
|
1826
|
-
|
|
1827
|
-
|
|
1828
|
-
|
|
1829
|
-
|
|
1830
|
-
|
|
1831
|
-
|
|
1832
|
-
|
|
1833
|
-
|
|
1834
|
-
|
|
1835
|
-
|
|
1836
|
-
|
|
1837
|
-
|
|
1838
|
-
|
|
1839
|
-
|
|
1840
|
-
|
|
1841
|
-
|
|
1842
|
-
|
|
1843
|
-
|
|
1844
|
-
|
|
1845
|
-
|
|
1846
|
-
|
|
1847
|
-
|
|
1848
|
-
|
|
1849
|
-
|
|
1850
|
-
|
|
1851
|
-
|
|
1852
|
-
|
|
1853
|
-
|
|
1854
|
-
|
|
1855
|
-
|
|
1856
|
-
|
|
1857
|
-
|
|
1858
|
-
|
|
1859
|
-
|
|
1860
|
-
|
|
1861
|
-
|
|
1862
|
-
|
|
1863
|
-
|
|
1864
|
-
|
|
1865
|
-
|
|
1866
|
-
|
|
1867
|
-
|
|
1868
|
-
|
|
1869
|
-
|
|
1870
|
-
|
|
1871
|
-
|
|
1872
|
-
|
|
1873
|
-
|
|
1874
|
-
|
|
1875
|
-
|
|
1876
|
-
|
|
1877
|
-
|
|
1878
|
-
|
|
1879
|
-
|
|
1880
|
-
|
|
1881
|
-
|
|
1882
|
-
|
|
1883
|
-
|
|
1884
|
-
|
|
1885
|
-
|
|
1886
|
-
|
|
1887
|
-
|
|
1888
|
-
|
|
1889
|
-
|
|
1890
|
-
|
|
1891
|
-
|
|
1892
|
-
|
|
1893
|
-
|
|
1894
|
-
|
|
1895
|
-
|
|
1896
|
-
|
|
1897
|
-
|
|
1898
|
-
|
|
1899
|
-
|
|
1900
|
-
|
|
1901
|
-
|
|
1902
|
-
|
|
1903
|
-
|
|
1904
|
-
|
|
1905
|
-
|
|
1906
|
-
|
|
1907
|
-
|
|
1908
|
-
|
|
1909
|
-
|
|
1910
|
-
|
|
1911
|
-
|
|
1912
|
-
|
|
1913
|
-
|
|
1914
|
-
|
|
1915
|
-
|
|
1916
|
-
|
|
1917
|
-
|
|
1918
|
-
|
|
1919
|
-
|
|
1920
|
-
|
|
1921
|
-
|
|
1922
|
-
|
|
1923
|
-
|
|
1924
|
-
|
|
1925
|
-
|
|
1926
|
-
|
|
1927
|
-
|
|
1928
|
-
|
|
1929
|
-
|
|
1930
|
-
|
|
1931
|
-
|
|
1932
|
-
|
|
1933
|
-
|
|
1934
|
-
|
|
1935
|
-
|
|
1936
|
-
|
|
1937
|
-
|
|
1938
|
-
|
|
1939
|
-
|
|
1940
|
-
|
|
1941
|
-
|
|
1942
|
-
|
|
1943
|
-
|
|
1944
|
-
|
|
1945
|
-
|
|
1946
|
-
|
|
1947
|
-
|
|
1948
|
-
|
|
1949
|
-
|
|
1950
|
-
|
|
1951
|
-
|
|
1952
|
-
|
|
1953
|
-
|
|
1954
|
-
|
|
1955
|
-
|
|
1956
|
-
|
|
1957
|
-
|
|
1958
|
-
|
|
1959
|
-
|
|
1960
|
-
|
|
1961
|
-
|
|
1962
|
-
|
|
1963
|
-
|
|
1509
|
+
curResourceBorrows.push(rsc0);
|
|
1510
|
+
_debugLog('[iface="wasi:filesystem/types@0.2.6", function="[method]descriptor.append-via-stream"] [Instruction::CallInterface] (async? sync, @ enter)');
|
|
1511
|
+
const _interface_call_currentTaskID = startCurrentTask(0, false, '[method]descriptor.append-via-stream');
|
|
1512
|
+
let ret;
|
|
1513
|
+
try {
|
|
1514
|
+
ret = { tag: 'ok', val: rsc0.appendViaStream()};
|
|
1515
|
+
} catch (e) {
|
|
1516
|
+
ret = { tag: 'err', val: getErrorPayload(e) };
|
|
1517
|
+
}
|
|
1518
|
+
_debugLog('[iface="wasi:filesystem/types@0.2.6", function="[method]descriptor.append-via-stream"] [Instruction::CallInterface] (sync, @ post-call)');
|
|
1519
|
+
for (const rsc of curResourceBorrows) {
|
|
1520
|
+
rsc[symbolRscHandle] = undefined;
|
|
1521
|
+
}
|
|
1522
|
+
curResourceBorrows = [];
|
|
1523
|
+
endCurrentTask(0);
|
|
1524
|
+
var variant5 = ret;
|
|
1525
|
+
switch (variant5.tag) {
|
|
1526
|
+
case 'ok': {
|
|
1527
|
+
const e = variant5.val;
|
|
1528
|
+
dataView(memory0).setInt8(arg1 + 0, 0, true);
|
|
1529
|
+
if (!(e instanceof OutputStream)) {
|
|
1530
|
+
throw new TypeError('Resource error: Not a valid "OutputStream" resource.');
|
|
1531
|
+
}
|
|
1532
|
+
var handle3 = e[symbolRscHandle];
|
|
1533
|
+
if (!handle3) {
|
|
1534
|
+
const rep = e[symbolRscRep] || ++captureCnt1;
|
|
1535
|
+
captureTable1.set(rep, e);
|
|
1536
|
+
handle3 = rscTableCreateOwn(handleTable1, rep);
|
|
1537
|
+
}
|
|
1538
|
+
dataView(memory0).setInt32(arg1 + 4, handle3, true);
|
|
1539
|
+
break;
|
|
1540
|
+
}
|
|
1541
|
+
case 'err': {
|
|
1542
|
+
const e = variant5.val;
|
|
1543
|
+
dataView(memory0).setInt8(arg1 + 0, 1, true);
|
|
1544
|
+
var val4 = e;
|
|
1545
|
+
let enum4;
|
|
1546
|
+
switch (val4) {
|
|
1547
|
+
case 'access': {
|
|
1548
|
+
enum4 = 0;
|
|
1549
|
+
break;
|
|
1550
|
+
}
|
|
1551
|
+
case 'would-block': {
|
|
1552
|
+
enum4 = 1;
|
|
1553
|
+
break;
|
|
1554
|
+
}
|
|
1555
|
+
case 'already': {
|
|
1556
|
+
enum4 = 2;
|
|
1557
|
+
break;
|
|
1558
|
+
}
|
|
1559
|
+
case 'bad-descriptor': {
|
|
1560
|
+
enum4 = 3;
|
|
1561
|
+
break;
|
|
1562
|
+
}
|
|
1563
|
+
case 'busy': {
|
|
1564
|
+
enum4 = 4;
|
|
1565
|
+
break;
|
|
1566
|
+
}
|
|
1567
|
+
case 'deadlock': {
|
|
1568
|
+
enum4 = 5;
|
|
1569
|
+
break;
|
|
1570
|
+
}
|
|
1571
|
+
case 'quota': {
|
|
1572
|
+
enum4 = 6;
|
|
1573
|
+
break;
|
|
1574
|
+
}
|
|
1575
|
+
case 'exist': {
|
|
1576
|
+
enum4 = 7;
|
|
1577
|
+
break;
|
|
1578
|
+
}
|
|
1579
|
+
case 'file-too-large': {
|
|
1580
|
+
enum4 = 8;
|
|
1581
|
+
break;
|
|
1582
|
+
}
|
|
1583
|
+
case 'illegal-byte-sequence': {
|
|
1584
|
+
enum4 = 9;
|
|
1585
|
+
break;
|
|
1586
|
+
}
|
|
1587
|
+
case 'in-progress': {
|
|
1588
|
+
enum4 = 10;
|
|
1589
|
+
break;
|
|
1590
|
+
}
|
|
1591
|
+
case 'interrupted': {
|
|
1592
|
+
enum4 = 11;
|
|
1593
|
+
break;
|
|
1594
|
+
}
|
|
1595
|
+
case 'invalid': {
|
|
1596
|
+
enum4 = 12;
|
|
1597
|
+
break;
|
|
1598
|
+
}
|
|
1599
|
+
case 'io': {
|
|
1600
|
+
enum4 = 13;
|
|
1601
|
+
break;
|
|
1602
|
+
}
|
|
1603
|
+
case 'is-directory': {
|
|
1604
|
+
enum4 = 14;
|
|
1605
|
+
break;
|
|
1606
|
+
}
|
|
1607
|
+
case 'loop': {
|
|
1608
|
+
enum4 = 15;
|
|
1609
|
+
break;
|
|
1610
|
+
}
|
|
1611
|
+
case 'too-many-links': {
|
|
1612
|
+
enum4 = 16;
|
|
1613
|
+
break;
|
|
1614
|
+
}
|
|
1615
|
+
case 'message-size': {
|
|
1616
|
+
enum4 = 17;
|
|
1617
|
+
break;
|
|
1618
|
+
}
|
|
1619
|
+
case 'name-too-long': {
|
|
1620
|
+
enum4 = 18;
|
|
1621
|
+
break;
|
|
1622
|
+
}
|
|
1623
|
+
case 'no-device': {
|
|
1624
|
+
enum4 = 19;
|
|
1625
|
+
break;
|
|
1626
|
+
}
|
|
1627
|
+
case 'no-entry': {
|
|
1628
|
+
enum4 = 20;
|
|
1629
|
+
break;
|
|
1630
|
+
}
|
|
1631
|
+
case 'no-lock': {
|
|
1632
|
+
enum4 = 21;
|
|
1633
|
+
break;
|
|
1634
|
+
}
|
|
1635
|
+
case 'insufficient-memory': {
|
|
1636
|
+
enum4 = 22;
|
|
1637
|
+
break;
|
|
1638
|
+
}
|
|
1639
|
+
case 'insufficient-space': {
|
|
1640
|
+
enum4 = 23;
|
|
1641
|
+
break;
|
|
1642
|
+
}
|
|
1643
|
+
case 'not-directory': {
|
|
1644
|
+
enum4 = 24;
|
|
1645
|
+
break;
|
|
1646
|
+
}
|
|
1647
|
+
case 'not-empty': {
|
|
1648
|
+
enum4 = 25;
|
|
1649
|
+
break;
|
|
1650
|
+
}
|
|
1651
|
+
case 'not-recoverable': {
|
|
1652
|
+
enum4 = 26;
|
|
1653
|
+
break;
|
|
1654
|
+
}
|
|
1655
|
+
case 'unsupported': {
|
|
1656
|
+
enum4 = 27;
|
|
1657
|
+
break;
|
|
1658
|
+
}
|
|
1659
|
+
case 'no-tty': {
|
|
1660
|
+
enum4 = 28;
|
|
1661
|
+
break;
|
|
1662
|
+
}
|
|
1663
|
+
case 'no-such-device': {
|
|
1664
|
+
enum4 = 29;
|
|
1665
|
+
break;
|
|
1666
|
+
}
|
|
1667
|
+
case 'overflow': {
|
|
1668
|
+
enum4 = 30;
|
|
1669
|
+
break;
|
|
1670
|
+
}
|
|
1671
|
+
case 'not-permitted': {
|
|
1672
|
+
enum4 = 31;
|
|
1673
|
+
break;
|
|
1674
|
+
}
|
|
1675
|
+
case 'pipe': {
|
|
1676
|
+
enum4 = 32;
|
|
1677
|
+
break;
|
|
1678
|
+
}
|
|
1679
|
+
case 'read-only': {
|
|
1680
|
+
enum4 = 33;
|
|
1681
|
+
break;
|
|
1682
|
+
}
|
|
1683
|
+
case 'invalid-seek': {
|
|
1684
|
+
enum4 = 34;
|
|
1685
|
+
break;
|
|
1686
|
+
}
|
|
1687
|
+
case 'text-file-busy': {
|
|
1688
|
+
enum4 = 35;
|
|
1689
|
+
break;
|
|
1690
|
+
}
|
|
1691
|
+
case 'cross-device': {
|
|
1692
|
+
enum4 = 36;
|
|
1693
|
+
break;
|
|
1694
|
+
}
|
|
1695
|
+
default: {
|
|
1696
|
+
if ((e) instanceof Error) {
|
|
1697
|
+
console.error(e);
|
|
1698
|
+
}
|
|
1699
|
+
|
|
1700
|
+
throw new TypeError(`"${val4}" is not one of the cases of error-code`);
|
|
1964
1701
|
}
|
|
1965
|
-
|
|
1966
|
-
throw new TypeError(`"${val4}" is not one of the cases of error-code`);
|
|
1967
1702
|
}
|
|
1703
|
+
dataView(memory0).setInt8(arg1 + 4, enum4, true);
|
|
1704
|
+
break;
|
|
1705
|
+
}
|
|
1706
|
+
default: {
|
|
1707
|
+
throw new TypeError('invalid variant specified for result');
|
|
1968
1708
|
}
|
|
1969
|
-
dataView(memory0).setInt8(arg1 + 1, enum4, true);
|
|
1970
|
-
break;
|
|
1971
|
-
}
|
|
1972
|
-
default: {
|
|
1973
|
-
throw new TypeError('invalid variant specified for result');
|
|
1974
1709
|
}
|
|
1710
|
+
_debugLog('[iface="wasi:filesystem/types@0.2.6", function="[method]descriptor.append-via-stream"][Instruction::Return]', {
|
|
1711
|
+
funcName: '[method]descriptor.append-via-stream',
|
|
1712
|
+
paramCount: 0,
|
|
1713
|
+
async: false,
|
|
1714
|
+
postReturn: false
|
|
1715
|
+
});
|
|
1975
1716
|
}
|
|
1976
|
-
|
|
1977
|
-
|
|
1978
|
-
|
|
1979
|
-
|
|
1980
|
-
|
|
1981
|
-
|
|
1982
|
-
|
|
1983
|
-
|
|
1984
|
-
|
|
1985
|
-
|
|
1986
|
-
|
|
1987
|
-
|
|
1988
|
-
|
|
1989
|
-
|
|
1990
|
-
|
|
1991
|
-
|
|
1992
|
-
|
|
1993
|
-
|
|
1994
|
-
|
|
1995
|
-
|
|
1996
|
-
|
|
1997
|
-
|
|
1998
|
-
|
|
1999
|
-
|
|
2000
|
-
|
|
2001
|
-
|
|
2002
|
-
|
|
2003
|
-
|
|
2004
|
-
|
|
2005
|
-
|
|
2006
|
-
|
|
2007
|
-
|
|
2008
|
-
|
|
2009
|
-
|
|
2010
|
-
|
|
2011
|
-
|
|
2012
|
-
|
|
2013
|
-
|
|
2014
|
-
|
|
2015
|
-
|
|
2016
|
-
|
|
2017
|
-
|
|
2018
|
-
|
|
2019
|
-
|
|
2020
|
-
|
|
2021
|
-
|
|
2022
|
-
|
|
2023
|
-
|
|
2024
|
-
|
|
2025
|
-
|
|
2026
|
-
|
|
2027
|
-
|
|
2028
|
-
|
|
2029
|
-
|
|
2030
|
-
|
|
2031
|
-
|
|
2032
|
-
|
|
2033
|
-
|
|
2034
|
-
|
|
2035
|
-
|
|
2036
|
-
|
|
2037
|
-
|
|
2038
|
-
|
|
2039
|
-
|
|
2040
|
-
|
|
2041
|
-
|
|
2042
|
-
|
|
2043
|
-
|
|
2044
|
-
|
|
2045
|
-
|
|
2046
|
-
|
|
2047
|
-
|
|
2048
|
-
break;
|
|
2049
|
-
}
|
|
2050
|
-
default: {
|
|
2051
|
-
if ((v3_0) instanceof Error) {
|
|
2052
|
-
console.error(v3_0);
|
|
1717
|
+
|
|
1718
|
+
|
|
1719
|
+
function trampoline16(arg0, arg1) {
|
|
1720
|
+
var handle1 = arg0;
|
|
1721
|
+
var rep2 = handleTable4[(handle1 << 1) + 1] & ~T_FLAG;
|
|
1722
|
+
var rsc0 = captureTable4.get(rep2);
|
|
1723
|
+
if (!rsc0) {
|
|
1724
|
+
rsc0 = Object.create(Descriptor.prototype);
|
|
1725
|
+
Object.defineProperty(rsc0, symbolRscHandle, { writable: true, value: handle1});
|
|
1726
|
+
Object.defineProperty(rsc0, symbolRscRep, { writable: true, value: rep2});
|
|
1727
|
+
}
|
|
1728
|
+
curResourceBorrows.push(rsc0);
|
|
1729
|
+
_debugLog('[iface="wasi:filesystem/types@0.2.6", function="[method]descriptor.get-type"] [Instruction::CallInterface] (async? sync, @ enter)');
|
|
1730
|
+
const _interface_call_currentTaskID = startCurrentTask(0, false, '[method]descriptor.get-type');
|
|
1731
|
+
let ret;
|
|
1732
|
+
try {
|
|
1733
|
+
ret = { tag: 'ok', val: rsc0.getType()};
|
|
1734
|
+
} catch (e) {
|
|
1735
|
+
ret = { tag: 'err', val: getErrorPayload(e) };
|
|
1736
|
+
}
|
|
1737
|
+
_debugLog('[iface="wasi:filesystem/types@0.2.6", function="[method]descriptor.get-type"] [Instruction::CallInterface] (sync, @ post-call)');
|
|
1738
|
+
for (const rsc of curResourceBorrows) {
|
|
1739
|
+
rsc[symbolRscHandle] = undefined;
|
|
1740
|
+
}
|
|
1741
|
+
curResourceBorrows = [];
|
|
1742
|
+
endCurrentTask(0);
|
|
1743
|
+
var variant5 = ret;
|
|
1744
|
+
switch (variant5.tag) {
|
|
1745
|
+
case 'ok': {
|
|
1746
|
+
const e = variant5.val;
|
|
1747
|
+
dataView(memory0).setInt8(arg1 + 0, 0, true);
|
|
1748
|
+
var val3 = e;
|
|
1749
|
+
let enum3;
|
|
1750
|
+
switch (val3) {
|
|
1751
|
+
case 'unknown': {
|
|
1752
|
+
enum3 = 0;
|
|
1753
|
+
break;
|
|
1754
|
+
}
|
|
1755
|
+
case 'block-device': {
|
|
1756
|
+
enum3 = 1;
|
|
1757
|
+
break;
|
|
1758
|
+
}
|
|
1759
|
+
case 'character-device': {
|
|
1760
|
+
enum3 = 2;
|
|
1761
|
+
break;
|
|
1762
|
+
}
|
|
1763
|
+
case 'directory': {
|
|
1764
|
+
enum3 = 3;
|
|
1765
|
+
break;
|
|
1766
|
+
}
|
|
1767
|
+
case 'fifo': {
|
|
1768
|
+
enum3 = 4;
|
|
1769
|
+
break;
|
|
1770
|
+
}
|
|
1771
|
+
case 'symbolic-link': {
|
|
1772
|
+
enum3 = 5;
|
|
1773
|
+
break;
|
|
1774
|
+
}
|
|
1775
|
+
case 'regular-file': {
|
|
1776
|
+
enum3 = 6;
|
|
1777
|
+
break;
|
|
1778
|
+
}
|
|
1779
|
+
case 'socket': {
|
|
1780
|
+
enum3 = 7;
|
|
1781
|
+
break;
|
|
1782
|
+
}
|
|
1783
|
+
default: {
|
|
1784
|
+
if ((e) instanceof Error) {
|
|
1785
|
+
console.error(e);
|
|
1786
|
+
}
|
|
1787
|
+
|
|
1788
|
+
throw new TypeError(`"${val3}" is not one of the cases of descriptor-type`);
|
|
2053
1789
|
}
|
|
2054
|
-
|
|
2055
|
-
throw new TypeError(`"${val4}" is not one of the cases of descriptor-type`);
|
|
2056
|
-
}
|
|
2057
|
-
}
|
|
2058
|
-
dataView(memory0).setInt8(arg1 + 8, enum4, true);
|
|
2059
|
-
dataView(memory0).setBigInt64(arg1 + 16, toUint64(v3_1), true);
|
|
2060
|
-
dataView(memory0).setBigInt64(arg1 + 24, toUint64(v3_2), true);
|
|
2061
|
-
var variant6 = v3_3;
|
|
2062
|
-
if (variant6 === null || variant6=== undefined) {
|
|
2063
|
-
dataView(memory0).setInt8(arg1 + 32, 0, true);
|
|
2064
|
-
} else {
|
|
2065
|
-
const e = variant6;
|
|
2066
|
-
dataView(memory0).setInt8(arg1 + 32, 1, true);
|
|
2067
|
-
var {seconds: v5_0, nanoseconds: v5_1 } = e;
|
|
2068
|
-
dataView(memory0).setBigInt64(arg1 + 40, toUint64(v5_0), true);
|
|
2069
|
-
dataView(memory0).setInt32(arg1 + 48, toUint32(v5_1), true);
|
|
2070
|
-
}
|
|
2071
|
-
var variant8 = v3_4;
|
|
2072
|
-
if (variant8 === null || variant8=== undefined) {
|
|
2073
|
-
dataView(memory0).setInt8(arg1 + 56, 0, true);
|
|
2074
|
-
} else {
|
|
2075
|
-
const e = variant8;
|
|
2076
|
-
dataView(memory0).setInt8(arg1 + 56, 1, true);
|
|
2077
|
-
var {seconds: v7_0, nanoseconds: v7_1 } = e;
|
|
2078
|
-
dataView(memory0).setBigInt64(arg1 + 64, toUint64(v7_0), true);
|
|
2079
|
-
dataView(memory0).setInt32(arg1 + 72, toUint32(v7_1), true);
|
|
2080
|
-
}
|
|
2081
|
-
var variant10 = v3_5;
|
|
2082
|
-
if (variant10 === null || variant10=== undefined) {
|
|
2083
|
-
dataView(memory0).setInt8(arg1 + 80, 0, true);
|
|
2084
|
-
} else {
|
|
2085
|
-
const e = variant10;
|
|
2086
|
-
dataView(memory0).setInt8(arg1 + 80, 1, true);
|
|
2087
|
-
var {seconds: v9_0, nanoseconds: v9_1 } = e;
|
|
2088
|
-
dataView(memory0).setBigInt64(arg1 + 88, toUint64(v9_0), true);
|
|
2089
|
-
dataView(memory0).setInt32(arg1 + 96, toUint32(v9_1), true);
|
|
2090
|
-
}
|
|
2091
|
-
break;
|
|
2092
|
-
}
|
|
2093
|
-
case 'err': {
|
|
2094
|
-
const e = variant12.val;
|
|
2095
|
-
dataView(memory0).setInt8(arg1 + 0, 1, true);
|
|
2096
|
-
var val11 = e;
|
|
2097
|
-
let enum11;
|
|
2098
|
-
switch (val11) {
|
|
2099
|
-
case 'access': {
|
|
2100
|
-
enum11 = 0;
|
|
2101
|
-
break;
|
|
2102
|
-
}
|
|
2103
|
-
case 'would-block': {
|
|
2104
|
-
enum11 = 1;
|
|
2105
|
-
break;
|
|
2106
|
-
}
|
|
2107
|
-
case 'already': {
|
|
2108
|
-
enum11 = 2;
|
|
2109
|
-
break;
|
|
2110
|
-
}
|
|
2111
|
-
case 'bad-descriptor': {
|
|
2112
|
-
enum11 = 3;
|
|
2113
|
-
break;
|
|
2114
|
-
}
|
|
2115
|
-
case 'busy': {
|
|
2116
|
-
enum11 = 4;
|
|
2117
|
-
break;
|
|
2118
|
-
}
|
|
2119
|
-
case 'deadlock': {
|
|
2120
|
-
enum11 = 5;
|
|
2121
|
-
break;
|
|
2122
|
-
}
|
|
2123
|
-
case 'quota': {
|
|
2124
|
-
enum11 = 6;
|
|
2125
|
-
break;
|
|
2126
|
-
}
|
|
2127
|
-
case 'exist': {
|
|
2128
|
-
enum11 = 7;
|
|
2129
|
-
break;
|
|
2130
|
-
}
|
|
2131
|
-
case 'file-too-large': {
|
|
2132
|
-
enum11 = 8;
|
|
2133
|
-
break;
|
|
2134
|
-
}
|
|
2135
|
-
case 'illegal-byte-sequence': {
|
|
2136
|
-
enum11 = 9;
|
|
2137
|
-
break;
|
|
2138
|
-
}
|
|
2139
|
-
case 'in-progress': {
|
|
2140
|
-
enum11 = 10;
|
|
2141
|
-
break;
|
|
2142
|
-
}
|
|
2143
|
-
case 'interrupted': {
|
|
2144
|
-
enum11 = 11;
|
|
2145
|
-
break;
|
|
2146
|
-
}
|
|
2147
|
-
case 'invalid': {
|
|
2148
|
-
enum11 = 12;
|
|
2149
|
-
break;
|
|
2150
|
-
}
|
|
2151
|
-
case 'io': {
|
|
2152
|
-
enum11 = 13;
|
|
2153
|
-
break;
|
|
2154
|
-
}
|
|
2155
|
-
case 'is-directory': {
|
|
2156
|
-
enum11 = 14;
|
|
2157
|
-
break;
|
|
2158
|
-
}
|
|
2159
|
-
case 'loop': {
|
|
2160
|
-
enum11 = 15;
|
|
2161
|
-
break;
|
|
2162
|
-
}
|
|
2163
|
-
case 'too-many-links': {
|
|
2164
|
-
enum11 = 16;
|
|
2165
|
-
break;
|
|
2166
|
-
}
|
|
2167
|
-
case 'message-size': {
|
|
2168
|
-
enum11 = 17;
|
|
2169
|
-
break;
|
|
2170
|
-
}
|
|
2171
|
-
case 'name-too-long': {
|
|
2172
|
-
enum11 = 18;
|
|
2173
|
-
break;
|
|
2174
|
-
}
|
|
2175
|
-
case 'no-device': {
|
|
2176
|
-
enum11 = 19;
|
|
2177
|
-
break;
|
|
2178
|
-
}
|
|
2179
|
-
case 'no-entry': {
|
|
2180
|
-
enum11 = 20;
|
|
2181
|
-
break;
|
|
2182
|
-
}
|
|
2183
|
-
case 'no-lock': {
|
|
2184
|
-
enum11 = 21;
|
|
2185
|
-
break;
|
|
2186
|
-
}
|
|
2187
|
-
case 'insufficient-memory': {
|
|
2188
|
-
enum11 = 22;
|
|
2189
|
-
break;
|
|
2190
|
-
}
|
|
2191
|
-
case 'insufficient-space': {
|
|
2192
|
-
enum11 = 23;
|
|
2193
|
-
break;
|
|
2194
|
-
}
|
|
2195
|
-
case 'not-directory': {
|
|
2196
|
-
enum11 = 24;
|
|
2197
|
-
break;
|
|
2198
|
-
}
|
|
2199
|
-
case 'not-empty': {
|
|
2200
|
-
enum11 = 25;
|
|
2201
|
-
break;
|
|
2202
|
-
}
|
|
2203
|
-
case 'not-recoverable': {
|
|
2204
|
-
enum11 = 26;
|
|
2205
|
-
break;
|
|
2206
|
-
}
|
|
2207
|
-
case 'unsupported': {
|
|
2208
|
-
enum11 = 27;
|
|
2209
|
-
break;
|
|
2210
|
-
}
|
|
2211
|
-
case 'no-tty': {
|
|
2212
|
-
enum11 = 28;
|
|
2213
|
-
break;
|
|
2214
|
-
}
|
|
2215
|
-
case 'no-such-device': {
|
|
2216
|
-
enum11 = 29;
|
|
2217
|
-
break;
|
|
2218
|
-
}
|
|
2219
|
-
case 'overflow': {
|
|
2220
|
-
enum11 = 30;
|
|
2221
|
-
break;
|
|
2222
|
-
}
|
|
2223
|
-
case 'not-permitted': {
|
|
2224
|
-
enum11 = 31;
|
|
2225
|
-
break;
|
|
2226
|
-
}
|
|
2227
|
-
case 'pipe': {
|
|
2228
|
-
enum11 = 32;
|
|
2229
|
-
break;
|
|
2230
|
-
}
|
|
2231
|
-
case 'read-only': {
|
|
2232
|
-
enum11 = 33;
|
|
2233
|
-
break;
|
|
2234
|
-
}
|
|
2235
|
-
case 'invalid-seek': {
|
|
2236
|
-
enum11 = 34;
|
|
2237
|
-
break;
|
|
2238
|
-
}
|
|
2239
|
-
case 'text-file-busy': {
|
|
2240
|
-
enum11 = 35;
|
|
2241
|
-
break;
|
|
2242
|
-
}
|
|
2243
|
-
case 'cross-device': {
|
|
2244
|
-
enum11 = 36;
|
|
2245
|
-
break;
|
|
2246
1790
|
}
|
|
2247
|
-
|
|
2248
|
-
|
|
2249
|
-
|
|
1791
|
+
dataView(memory0).setInt8(arg1 + 1, enum3, true);
|
|
1792
|
+
break;
|
|
1793
|
+
}
|
|
1794
|
+
case 'err': {
|
|
1795
|
+
const e = variant5.val;
|
|
1796
|
+
dataView(memory0).setInt8(arg1 + 0, 1, true);
|
|
1797
|
+
var val4 = e;
|
|
1798
|
+
let enum4;
|
|
1799
|
+
switch (val4) {
|
|
1800
|
+
case 'access': {
|
|
1801
|
+
enum4 = 0;
|
|
1802
|
+
break;
|
|
1803
|
+
}
|
|
1804
|
+
case 'would-block': {
|
|
1805
|
+
enum4 = 1;
|
|
1806
|
+
break;
|
|
1807
|
+
}
|
|
1808
|
+
case 'already': {
|
|
1809
|
+
enum4 = 2;
|
|
1810
|
+
break;
|
|
1811
|
+
}
|
|
1812
|
+
case 'bad-descriptor': {
|
|
1813
|
+
enum4 = 3;
|
|
1814
|
+
break;
|
|
1815
|
+
}
|
|
1816
|
+
case 'busy': {
|
|
1817
|
+
enum4 = 4;
|
|
1818
|
+
break;
|
|
1819
|
+
}
|
|
1820
|
+
case 'deadlock': {
|
|
1821
|
+
enum4 = 5;
|
|
1822
|
+
break;
|
|
1823
|
+
}
|
|
1824
|
+
case 'quota': {
|
|
1825
|
+
enum4 = 6;
|
|
1826
|
+
break;
|
|
1827
|
+
}
|
|
1828
|
+
case 'exist': {
|
|
1829
|
+
enum4 = 7;
|
|
1830
|
+
break;
|
|
1831
|
+
}
|
|
1832
|
+
case 'file-too-large': {
|
|
1833
|
+
enum4 = 8;
|
|
1834
|
+
break;
|
|
1835
|
+
}
|
|
1836
|
+
case 'illegal-byte-sequence': {
|
|
1837
|
+
enum4 = 9;
|
|
1838
|
+
break;
|
|
1839
|
+
}
|
|
1840
|
+
case 'in-progress': {
|
|
1841
|
+
enum4 = 10;
|
|
1842
|
+
break;
|
|
1843
|
+
}
|
|
1844
|
+
case 'interrupted': {
|
|
1845
|
+
enum4 = 11;
|
|
1846
|
+
break;
|
|
1847
|
+
}
|
|
1848
|
+
case 'invalid': {
|
|
1849
|
+
enum4 = 12;
|
|
1850
|
+
break;
|
|
1851
|
+
}
|
|
1852
|
+
case 'io': {
|
|
1853
|
+
enum4 = 13;
|
|
1854
|
+
break;
|
|
1855
|
+
}
|
|
1856
|
+
case 'is-directory': {
|
|
1857
|
+
enum4 = 14;
|
|
1858
|
+
break;
|
|
1859
|
+
}
|
|
1860
|
+
case 'loop': {
|
|
1861
|
+
enum4 = 15;
|
|
1862
|
+
break;
|
|
1863
|
+
}
|
|
1864
|
+
case 'too-many-links': {
|
|
1865
|
+
enum4 = 16;
|
|
1866
|
+
break;
|
|
1867
|
+
}
|
|
1868
|
+
case 'message-size': {
|
|
1869
|
+
enum4 = 17;
|
|
1870
|
+
break;
|
|
1871
|
+
}
|
|
1872
|
+
case 'name-too-long': {
|
|
1873
|
+
enum4 = 18;
|
|
1874
|
+
break;
|
|
1875
|
+
}
|
|
1876
|
+
case 'no-device': {
|
|
1877
|
+
enum4 = 19;
|
|
1878
|
+
break;
|
|
1879
|
+
}
|
|
1880
|
+
case 'no-entry': {
|
|
1881
|
+
enum4 = 20;
|
|
1882
|
+
break;
|
|
1883
|
+
}
|
|
1884
|
+
case 'no-lock': {
|
|
1885
|
+
enum4 = 21;
|
|
1886
|
+
break;
|
|
1887
|
+
}
|
|
1888
|
+
case 'insufficient-memory': {
|
|
1889
|
+
enum4 = 22;
|
|
1890
|
+
break;
|
|
1891
|
+
}
|
|
1892
|
+
case 'insufficient-space': {
|
|
1893
|
+
enum4 = 23;
|
|
1894
|
+
break;
|
|
1895
|
+
}
|
|
1896
|
+
case 'not-directory': {
|
|
1897
|
+
enum4 = 24;
|
|
1898
|
+
break;
|
|
1899
|
+
}
|
|
1900
|
+
case 'not-empty': {
|
|
1901
|
+
enum4 = 25;
|
|
1902
|
+
break;
|
|
1903
|
+
}
|
|
1904
|
+
case 'not-recoverable': {
|
|
1905
|
+
enum4 = 26;
|
|
1906
|
+
break;
|
|
1907
|
+
}
|
|
1908
|
+
case 'unsupported': {
|
|
1909
|
+
enum4 = 27;
|
|
1910
|
+
break;
|
|
1911
|
+
}
|
|
1912
|
+
case 'no-tty': {
|
|
1913
|
+
enum4 = 28;
|
|
1914
|
+
break;
|
|
1915
|
+
}
|
|
1916
|
+
case 'no-such-device': {
|
|
1917
|
+
enum4 = 29;
|
|
1918
|
+
break;
|
|
1919
|
+
}
|
|
1920
|
+
case 'overflow': {
|
|
1921
|
+
enum4 = 30;
|
|
1922
|
+
break;
|
|
1923
|
+
}
|
|
1924
|
+
case 'not-permitted': {
|
|
1925
|
+
enum4 = 31;
|
|
1926
|
+
break;
|
|
1927
|
+
}
|
|
1928
|
+
case 'pipe': {
|
|
1929
|
+
enum4 = 32;
|
|
1930
|
+
break;
|
|
1931
|
+
}
|
|
1932
|
+
case 'read-only': {
|
|
1933
|
+
enum4 = 33;
|
|
1934
|
+
break;
|
|
1935
|
+
}
|
|
1936
|
+
case 'invalid-seek': {
|
|
1937
|
+
enum4 = 34;
|
|
1938
|
+
break;
|
|
1939
|
+
}
|
|
1940
|
+
case 'text-file-busy': {
|
|
1941
|
+
enum4 = 35;
|
|
1942
|
+
break;
|
|
1943
|
+
}
|
|
1944
|
+
case 'cross-device': {
|
|
1945
|
+
enum4 = 36;
|
|
1946
|
+
break;
|
|
1947
|
+
}
|
|
1948
|
+
default: {
|
|
1949
|
+
if ((e) instanceof Error) {
|
|
1950
|
+
console.error(e);
|
|
1951
|
+
}
|
|
1952
|
+
|
|
1953
|
+
throw new TypeError(`"${val4}" is not one of the cases of error-code`);
|
|
2250
1954
|
}
|
|
2251
|
-
|
|
2252
|
-
throw new TypeError(`"${val11}" is not one of the cases of error-code`);
|
|
2253
1955
|
}
|
|
1956
|
+
dataView(memory0).setInt8(arg1 + 1, enum4, true);
|
|
1957
|
+
break;
|
|
1958
|
+
}
|
|
1959
|
+
default: {
|
|
1960
|
+
throw new TypeError('invalid variant specified for result');
|
|
2254
1961
|
}
|
|
2255
|
-
dataView(memory0).setInt8(arg1 + 8, enum11, true);
|
|
2256
|
-
break;
|
|
2257
|
-
}
|
|
2258
|
-
default: {
|
|
2259
|
-
throw new TypeError('invalid variant specified for result');
|
|
2260
1962
|
}
|
|
1963
|
+
_debugLog('[iface="wasi:filesystem/types@0.2.6", function="[method]descriptor.get-type"][Instruction::Return]', {
|
|
1964
|
+
funcName: '[method]descriptor.get-type',
|
|
1965
|
+
paramCount: 0,
|
|
1966
|
+
async: false,
|
|
1967
|
+
postReturn: false
|
|
1968
|
+
});
|
|
2261
1969
|
}
|
|
2262
|
-
|
|
2263
|
-
|
|
2264
|
-
|
|
2265
|
-
|
|
2266
|
-
|
|
2267
|
-
|
|
2268
|
-
|
|
2269
|
-
|
|
2270
|
-
|
|
2271
|
-
|
|
2272
|
-
var handle1 = arg0;
|
|
2273
|
-
var rep2 = handleTable1[(handle1 << 1) + 1] & ~T_FLAG;
|
|
2274
|
-
var rsc0 = captureTable1.get(rep2);
|
|
2275
|
-
if (!rsc0) {
|
|
2276
|
-
rsc0 = Object.create(OutputStream.prototype);
|
|
2277
|
-
Object.defineProperty(rsc0, symbolRscHandle, { writable: true, value: handle1});
|
|
2278
|
-
Object.defineProperty(rsc0, symbolRscRep, { writable: true, value: rep2});
|
|
2279
|
-
}
|
|
2280
|
-
curResourceBorrows.push(rsc0);
|
|
2281
|
-
_debugLog('[iface="wasi:io/streams@0.2.6", function="[method]output-stream.check-write"] [Instruction::CallInterface] (async? sync, @ enter)');
|
|
2282
|
-
const _interface_call_currentTaskID = startCurrentTask(0, false, '[method]output-stream.check-write');
|
|
2283
|
-
let ret;
|
|
2284
|
-
try {
|
|
2285
|
-
ret = { tag: 'ok', val: rsc0.checkWrite()};
|
|
2286
|
-
} catch (e) {
|
|
2287
|
-
ret = { tag: 'err', val: getErrorPayload(e) };
|
|
2288
|
-
}
|
|
2289
|
-
_debugLog('[iface="wasi:io/streams@0.2.6", function="[method]output-stream.check-write"] [Instruction::CallInterface] (sync, @ post-call)');
|
|
2290
|
-
for (const rsc of curResourceBorrows) {
|
|
2291
|
-
rsc[symbolRscHandle] = undefined;
|
|
2292
|
-
}
|
|
2293
|
-
curResourceBorrows = [];
|
|
2294
|
-
endCurrentTask(0);
|
|
2295
|
-
var variant5 = ret;
|
|
2296
|
-
switch (variant5.tag) {
|
|
2297
|
-
case 'ok': {
|
|
2298
|
-
const e = variant5.val;
|
|
2299
|
-
dataView(memory0).setInt8(arg1 + 0, 0, true);
|
|
2300
|
-
dataView(memory0).setBigInt64(arg1 + 8, toUint64(e), true);
|
|
2301
|
-
break;
|
|
1970
|
+
|
|
1971
|
+
|
|
1972
|
+
function trampoline17(arg0, arg1) {
|
|
1973
|
+
var handle1 = arg0;
|
|
1974
|
+
var rep2 = handleTable4[(handle1 << 1) + 1] & ~T_FLAG;
|
|
1975
|
+
var rsc0 = captureTable4.get(rep2);
|
|
1976
|
+
if (!rsc0) {
|
|
1977
|
+
rsc0 = Object.create(Descriptor.prototype);
|
|
1978
|
+
Object.defineProperty(rsc0, symbolRscHandle, { writable: true, value: handle1});
|
|
1979
|
+
Object.defineProperty(rsc0, symbolRscRep, { writable: true, value: rep2});
|
|
2302
1980
|
}
|
|
2303
|
-
|
|
2304
|
-
|
|
2305
|
-
|
|
2306
|
-
|
|
2307
|
-
|
|
2308
|
-
|
|
2309
|
-
|
|
2310
|
-
|
|
2311
|
-
|
|
2312
|
-
|
|
2313
|
-
|
|
2314
|
-
|
|
2315
|
-
|
|
2316
|
-
|
|
2317
|
-
|
|
2318
|
-
|
|
2319
|
-
|
|
2320
|
-
|
|
2321
|
-
|
|
1981
|
+
curResourceBorrows.push(rsc0);
|
|
1982
|
+
_debugLog('[iface="wasi:filesystem/types@0.2.6", function="[method]descriptor.stat"] [Instruction::CallInterface] (async? sync, @ enter)');
|
|
1983
|
+
const _interface_call_currentTaskID = startCurrentTask(0, false, '[method]descriptor.stat');
|
|
1984
|
+
let ret;
|
|
1985
|
+
try {
|
|
1986
|
+
ret = { tag: 'ok', val: rsc0.stat()};
|
|
1987
|
+
} catch (e) {
|
|
1988
|
+
ret = { tag: 'err', val: getErrorPayload(e) };
|
|
1989
|
+
}
|
|
1990
|
+
_debugLog('[iface="wasi:filesystem/types@0.2.6", function="[method]descriptor.stat"] [Instruction::CallInterface] (sync, @ post-call)');
|
|
1991
|
+
for (const rsc of curResourceBorrows) {
|
|
1992
|
+
rsc[symbolRscHandle] = undefined;
|
|
1993
|
+
}
|
|
1994
|
+
curResourceBorrows = [];
|
|
1995
|
+
endCurrentTask(0);
|
|
1996
|
+
var variant12 = ret;
|
|
1997
|
+
switch (variant12.tag) {
|
|
1998
|
+
case 'ok': {
|
|
1999
|
+
const e = variant12.val;
|
|
2000
|
+
dataView(memory0).setInt8(arg1 + 0, 0, true);
|
|
2001
|
+
var {type: v3_0, linkCount: v3_1, size: v3_2, dataAccessTimestamp: v3_3, dataModificationTimestamp: v3_4, statusChangeTimestamp: v3_5 } = e;
|
|
2002
|
+
var val4 = v3_0;
|
|
2003
|
+
let enum4;
|
|
2004
|
+
switch (val4) {
|
|
2005
|
+
case 'unknown': {
|
|
2006
|
+
enum4 = 0;
|
|
2007
|
+
break;
|
|
2008
|
+
}
|
|
2009
|
+
case 'block-device': {
|
|
2010
|
+
enum4 = 1;
|
|
2011
|
+
break;
|
|
2012
|
+
}
|
|
2013
|
+
case 'character-device': {
|
|
2014
|
+
enum4 = 2;
|
|
2015
|
+
break;
|
|
2016
|
+
}
|
|
2017
|
+
case 'directory': {
|
|
2018
|
+
enum4 = 3;
|
|
2019
|
+
break;
|
|
2020
|
+
}
|
|
2021
|
+
case 'fifo': {
|
|
2022
|
+
enum4 = 4;
|
|
2023
|
+
break;
|
|
2024
|
+
}
|
|
2025
|
+
case 'symbolic-link': {
|
|
2026
|
+
enum4 = 5;
|
|
2027
|
+
break;
|
|
2028
|
+
}
|
|
2029
|
+
case 'regular-file': {
|
|
2030
|
+
enum4 = 6;
|
|
2031
|
+
break;
|
|
2032
|
+
}
|
|
2033
|
+
case 'socket': {
|
|
2034
|
+
enum4 = 7;
|
|
2035
|
+
break;
|
|
2036
|
+
}
|
|
2037
|
+
default: {
|
|
2038
|
+
if ((v3_0) instanceof Error) {
|
|
2039
|
+
console.error(v3_0);
|
|
2040
|
+
}
|
|
2041
|
+
|
|
2042
|
+
throw new TypeError(`"${val4}" is not one of the cases of descriptor-type`);
|
|
2043
|
+
}
|
|
2322
2044
|
}
|
|
2323
|
-
|
|
2324
|
-
|
|
2325
|
-
|
|
2045
|
+
dataView(memory0).setInt8(arg1 + 8, enum4, true);
|
|
2046
|
+
dataView(memory0).setBigInt64(arg1 + 16, toUint64(v3_1), true);
|
|
2047
|
+
dataView(memory0).setBigInt64(arg1 + 24, toUint64(v3_2), true);
|
|
2048
|
+
var variant6 = v3_3;
|
|
2049
|
+
if (variant6 === null || variant6=== undefined) {
|
|
2050
|
+
dataView(memory0).setInt8(arg1 + 32, 0, true);
|
|
2051
|
+
} else {
|
|
2052
|
+
const e = variant6;
|
|
2053
|
+
dataView(memory0).setInt8(arg1 + 32, 1, true);
|
|
2054
|
+
var {seconds: v5_0, nanoseconds: v5_1 } = e;
|
|
2055
|
+
dataView(memory0).setBigInt64(arg1 + 40, toUint64(v5_0), true);
|
|
2056
|
+
dataView(memory0).setInt32(arg1 + 48, toUint32(v5_1), true);
|
|
2057
|
+
}
|
|
2058
|
+
var variant8 = v3_4;
|
|
2059
|
+
if (variant8 === null || variant8=== undefined) {
|
|
2060
|
+
dataView(memory0).setInt8(arg1 + 56, 0, true);
|
|
2061
|
+
} else {
|
|
2062
|
+
const e = variant8;
|
|
2063
|
+
dataView(memory0).setInt8(arg1 + 56, 1, true);
|
|
2064
|
+
var {seconds: v7_0, nanoseconds: v7_1 } = e;
|
|
2065
|
+
dataView(memory0).setBigInt64(arg1 + 64, toUint64(v7_0), true);
|
|
2066
|
+
dataView(memory0).setInt32(arg1 + 72, toUint32(v7_1), true);
|
|
2067
|
+
}
|
|
2068
|
+
var variant10 = v3_5;
|
|
2069
|
+
if (variant10 === null || variant10=== undefined) {
|
|
2070
|
+
dataView(memory0).setInt8(arg1 + 80, 0, true);
|
|
2071
|
+
} else {
|
|
2072
|
+
const e = variant10;
|
|
2073
|
+
dataView(memory0).setInt8(arg1 + 80, 1, true);
|
|
2074
|
+
var {seconds: v9_0, nanoseconds: v9_1 } = e;
|
|
2075
|
+
dataView(memory0).setBigInt64(arg1 + 88, toUint64(v9_0), true);
|
|
2076
|
+
dataView(memory0).setInt32(arg1 + 96, toUint32(v9_1), true);
|
|
2326
2077
|
}
|
|
2327
|
-
|
|
2328
|
-
|
|
2078
|
+
break;
|
|
2079
|
+
}
|
|
2080
|
+
case 'err': {
|
|
2081
|
+
const e = variant12.val;
|
|
2082
|
+
dataView(memory0).setInt8(arg1 + 0, 1, true);
|
|
2083
|
+
var val11 = e;
|
|
2084
|
+
let enum11;
|
|
2085
|
+
switch (val11) {
|
|
2086
|
+
case 'access': {
|
|
2087
|
+
enum11 = 0;
|
|
2088
|
+
break;
|
|
2089
|
+
}
|
|
2090
|
+
case 'would-block': {
|
|
2091
|
+
enum11 = 1;
|
|
2092
|
+
break;
|
|
2093
|
+
}
|
|
2094
|
+
case 'already': {
|
|
2095
|
+
enum11 = 2;
|
|
2096
|
+
break;
|
|
2097
|
+
}
|
|
2098
|
+
case 'bad-descriptor': {
|
|
2099
|
+
enum11 = 3;
|
|
2100
|
+
break;
|
|
2101
|
+
}
|
|
2102
|
+
case 'busy': {
|
|
2103
|
+
enum11 = 4;
|
|
2104
|
+
break;
|
|
2105
|
+
}
|
|
2106
|
+
case 'deadlock': {
|
|
2107
|
+
enum11 = 5;
|
|
2108
|
+
break;
|
|
2109
|
+
}
|
|
2110
|
+
case 'quota': {
|
|
2111
|
+
enum11 = 6;
|
|
2112
|
+
break;
|
|
2113
|
+
}
|
|
2114
|
+
case 'exist': {
|
|
2115
|
+
enum11 = 7;
|
|
2116
|
+
break;
|
|
2117
|
+
}
|
|
2118
|
+
case 'file-too-large': {
|
|
2119
|
+
enum11 = 8;
|
|
2120
|
+
break;
|
|
2121
|
+
}
|
|
2122
|
+
case 'illegal-byte-sequence': {
|
|
2123
|
+
enum11 = 9;
|
|
2124
|
+
break;
|
|
2125
|
+
}
|
|
2126
|
+
case 'in-progress': {
|
|
2127
|
+
enum11 = 10;
|
|
2128
|
+
break;
|
|
2129
|
+
}
|
|
2130
|
+
case 'interrupted': {
|
|
2131
|
+
enum11 = 11;
|
|
2132
|
+
break;
|
|
2133
|
+
}
|
|
2134
|
+
case 'invalid': {
|
|
2135
|
+
enum11 = 12;
|
|
2136
|
+
break;
|
|
2137
|
+
}
|
|
2138
|
+
case 'io': {
|
|
2139
|
+
enum11 = 13;
|
|
2140
|
+
break;
|
|
2141
|
+
}
|
|
2142
|
+
case 'is-directory': {
|
|
2143
|
+
enum11 = 14;
|
|
2144
|
+
break;
|
|
2145
|
+
}
|
|
2146
|
+
case 'loop': {
|
|
2147
|
+
enum11 = 15;
|
|
2148
|
+
break;
|
|
2149
|
+
}
|
|
2150
|
+
case 'too-many-links': {
|
|
2151
|
+
enum11 = 16;
|
|
2152
|
+
break;
|
|
2153
|
+
}
|
|
2154
|
+
case 'message-size': {
|
|
2155
|
+
enum11 = 17;
|
|
2156
|
+
break;
|
|
2157
|
+
}
|
|
2158
|
+
case 'name-too-long': {
|
|
2159
|
+
enum11 = 18;
|
|
2160
|
+
break;
|
|
2161
|
+
}
|
|
2162
|
+
case 'no-device': {
|
|
2163
|
+
enum11 = 19;
|
|
2164
|
+
break;
|
|
2165
|
+
}
|
|
2166
|
+
case 'no-entry': {
|
|
2167
|
+
enum11 = 20;
|
|
2168
|
+
break;
|
|
2169
|
+
}
|
|
2170
|
+
case 'no-lock': {
|
|
2171
|
+
enum11 = 21;
|
|
2172
|
+
break;
|
|
2173
|
+
}
|
|
2174
|
+
case 'insufficient-memory': {
|
|
2175
|
+
enum11 = 22;
|
|
2176
|
+
break;
|
|
2177
|
+
}
|
|
2178
|
+
case 'insufficient-space': {
|
|
2179
|
+
enum11 = 23;
|
|
2180
|
+
break;
|
|
2181
|
+
}
|
|
2182
|
+
case 'not-directory': {
|
|
2183
|
+
enum11 = 24;
|
|
2184
|
+
break;
|
|
2185
|
+
}
|
|
2186
|
+
case 'not-empty': {
|
|
2187
|
+
enum11 = 25;
|
|
2188
|
+
break;
|
|
2189
|
+
}
|
|
2190
|
+
case 'not-recoverable': {
|
|
2191
|
+
enum11 = 26;
|
|
2192
|
+
break;
|
|
2193
|
+
}
|
|
2194
|
+
case 'unsupported': {
|
|
2195
|
+
enum11 = 27;
|
|
2196
|
+
break;
|
|
2197
|
+
}
|
|
2198
|
+
case 'no-tty': {
|
|
2199
|
+
enum11 = 28;
|
|
2200
|
+
break;
|
|
2201
|
+
}
|
|
2202
|
+
case 'no-such-device': {
|
|
2203
|
+
enum11 = 29;
|
|
2204
|
+
break;
|
|
2205
|
+
}
|
|
2206
|
+
case 'overflow': {
|
|
2207
|
+
enum11 = 30;
|
|
2208
|
+
break;
|
|
2209
|
+
}
|
|
2210
|
+
case 'not-permitted': {
|
|
2211
|
+
enum11 = 31;
|
|
2212
|
+
break;
|
|
2213
|
+
}
|
|
2214
|
+
case 'pipe': {
|
|
2215
|
+
enum11 = 32;
|
|
2216
|
+
break;
|
|
2217
|
+
}
|
|
2218
|
+
case 'read-only': {
|
|
2219
|
+
enum11 = 33;
|
|
2220
|
+
break;
|
|
2221
|
+
}
|
|
2222
|
+
case 'invalid-seek': {
|
|
2223
|
+
enum11 = 34;
|
|
2224
|
+
break;
|
|
2225
|
+
}
|
|
2226
|
+
case 'text-file-busy': {
|
|
2227
|
+
enum11 = 35;
|
|
2228
|
+
break;
|
|
2229
|
+
}
|
|
2230
|
+
case 'cross-device': {
|
|
2231
|
+
enum11 = 36;
|
|
2232
|
+
break;
|
|
2233
|
+
}
|
|
2234
|
+
default: {
|
|
2235
|
+
if ((e) instanceof Error) {
|
|
2236
|
+
console.error(e);
|
|
2237
|
+
}
|
|
2238
|
+
|
|
2239
|
+
throw new TypeError(`"${val11}" is not one of the cases of error-code`);
|
|
2240
|
+
}
|
|
2329
2241
|
}
|
|
2242
|
+
dataView(memory0).setInt8(arg1 + 8, enum11, true);
|
|
2243
|
+
break;
|
|
2244
|
+
}
|
|
2245
|
+
default: {
|
|
2246
|
+
throw new TypeError('invalid variant specified for result');
|
|
2330
2247
|
}
|
|
2331
|
-
break;
|
|
2332
|
-
}
|
|
2333
|
-
default: {
|
|
2334
|
-
throw new TypeError('invalid variant specified for result');
|
|
2335
2248
|
}
|
|
2249
|
+
_debugLog('[iface="wasi:filesystem/types@0.2.6", function="[method]descriptor.stat"][Instruction::Return]', {
|
|
2250
|
+
funcName: '[method]descriptor.stat',
|
|
2251
|
+
paramCount: 0,
|
|
2252
|
+
async: false,
|
|
2253
|
+
postReturn: false
|
|
2254
|
+
});
|
|
2336
2255
|
}
|
|
2337
|
-
|
|
2338
|
-
|
|
2339
|
-
|
|
2340
|
-
|
|
2341
|
-
|
|
2342
|
-
|
|
2343
|
-
|
|
2344
|
-
|
|
2345
|
-
|
|
2346
|
-
|
|
2347
|
-
|
|
2348
|
-
|
|
2349
|
-
|
|
2350
|
-
|
|
2351
|
-
|
|
2352
|
-
|
|
2353
|
-
|
|
2354
|
-
|
|
2355
|
-
|
|
2356
|
-
|
|
2357
|
-
|
|
2358
|
-
|
|
2359
|
-
|
|
2360
|
-
|
|
2361
|
-
|
|
2362
|
-
|
|
2363
|
-
|
|
2364
|
-
|
|
2365
|
-
|
|
2366
|
-
|
|
2367
|
-
|
|
2368
|
-
|
|
2369
|
-
|
|
2370
|
-
|
|
2371
|
-
|
|
2372
|
-
|
|
2373
|
-
|
|
2374
|
-
|
|
2375
|
-
|
|
2376
|
-
|
|
2377
|
-
|
|
2378
|
-
|
|
2379
|
-
|
|
2380
|
-
|
|
2381
|
-
|
|
2382
|
-
|
|
2383
|
-
|
|
2384
|
-
|
|
2385
|
-
|
|
2386
|
-
|
|
2387
|
-
|
|
2388
|
-
|
|
2389
|
-
|
|
2390
|
-
}
|
|
2391
|
-
|
|
2392
|
-
|
|
2393
|
-
|
|
2394
|
-
|
|
2395
|
-
|
|
2396
|
-
|
|
2397
|
-
|
|
2398
|
-
break;
|
|
2399
|
-
}
|
|
2400
|
-
case 'closed': {
|
|
2401
|
-
dataView(memory0).setInt8(arg3 + 4, 1, true);
|
|
2402
|
-
break;
|
|
2403
|
-
}
|
|
2404
|
-
default: {
|
|
2405
|
-
throw new TypeError(`invalid variant tag value \`${JSON.stringify(variant5.tag)}\` (received \`${variant5}\`) specified for \`StreamError\``);
|
|
2256
|
+
|
|
2257
|
+
|
|
2258
|
+
function trampoline18(arg0, arg1) {
|
|
2259
|
+
var handle1 = arg0;
|
|
2260
|
+
var rep2 = handleTable1[(handle1 << 1) + 1] & ~T_FLAG;
|
|
2261
|
+
var rsc0 = captureTable1.get(rep2);
|
|
2262
|
+
if (!rsc0) {
|
|
2263
|
+
rsc0 = Object.create(OutputStream.prototype);
|
|
2264
|
+
Object.defineProperty(rsc0, symbolRscHandle, { writable: true, value: handle1});
|
|
2265
|
+
Object.defineProperty(rsc0, symbolRscRep, { writable: true, value: rep2});
|
|
2266
|
+
}
|
|
2267
|
+
curResourceBorrows.push(rsc0);
|
|
2268
|
+
_debugLog('[iface="wasi:io/streams@0.2.6", function="[method]output-stream.check-write"] [Instruction::CallInterface] (async? sync, @ enter)');
|
|
2269
|
+
const _interface_call_currentTaskID = startCurrentTask(0, false, '[method]output-stream.check-write');
|
|
2270
|
+
let ret;
|
|
2271
|
+
try {
|
|
2272
|
+
ret = { tag: 'ok', val: rsc0.checkWrite()};
|
|
2273
|
+
} catch (e) {
|
|
2274
|
+
ret = { tag: 'err', val: getErrorPayload(e) };
|
|
2275
|
+
}
|
|
2276
|
+
_debugLog('[iface="wasi:io/streams@0.2.6", function="[method]output-stream.check-write"] [Instruction::CallInterface] (sync, @ post-call)');
|
|
2277
|
+
for (const rsc of curResourceBorrows) {
|
|
2278
|
+
rsc[symbolRscHandle] = undefined;
|
|
2279
|
+
}
|
|
2280
|
+
curResourceBorrows = [];
|
|
2281
|
+
endCurrentTask(0);
|
|
2282
|
+
var variant5 = ret;
|
|
2283
|
+
switch (variant5.tag) {
|
|
2284
|
+
case 'ok': {
|
|
2285
|
+
const e = variant5.val;
|
|
2286
|
+
dataView(memory0).setInt8(arg1 + 0, 0, true);
|
|
2287
|
+
dataView(memory0).setBigInt64(arg1 + 8, toUint64(e), true);
|
|
2288
|
+
break;
|
|
2289
|
+
}
|
|
2290
|
+
case 'err': {
|
|
2291
|
+
const e = variant5.val;
|
|
2292
|
+
dataView(memory0).setInt8(arg1 + 0, 1, true);
|
|
2293
|
+
var variant4 = e;
|
|
2294
|
+
switch (variant4.tag) {
|
|
2295
|
+
case 'last-operation-failed': {
|
|
2296
|
+
const e = variant4.val;
|
|
2297
|
+
dataView(memory0).setInt8(arg1 + 8, 0, true);
|
|
2298
|
+
if (!(e instanceof Error$1)) {
|
|
2299
|
+
throw new TypeError('Resource error: Not a valid "Error" resource.');
|
|
2300
|
+
}
|
|
2301
|
+
var handle3 = e[symbolRscHandle];
|
|
2302
|
+
if (!handle3) {
|
|
2303
|
+
const rep = e[symbolRscRep] || ++captureCnt0;
|
|
2304
|
+
captureTable0.set(rep, e);
|
|
2305
|
+
handle3 = rscTableCreateOwn(handleTable0, rep);
|
|
2306
|
+
}
|
|
2307
|
+
dataView(memory0).setInt32(arg1 + 12, handle3, true);
|
|
2308
|
+
break;
|
|
2309
|
+
}
|
|
2310
|
+
case 'closed': {
|
|
2311
|
+
dataView(memory0).setInt8(arg1 + 8, 1, true);
|
|
2312
|
+
break;
|
|
2313
|
+
}
|
|
2314
|
+
default: {
|
|
2315
|
+
throw new TypeError(`invalid variant tag value \`${JSON.stringify(variant4.tag)}\` (received \`${variant4}\`) specified for \`StreamError\``);
|
|
2316
|
+
}
|
|
2406
2317
|
}
|
|
2318
|
+
break;
|
|
2319
|
+
}
|
|
2320
|
+
default: {
|
|
2321
|
+
throw new TypeError('invalid variant specified for result');
|
|
2407
2322
|
}
|
|
2408
|
-
break;
|
|
2409
|
-
}
|
|
2410
|
-
default: {
|
|
2411
|
-
throw new TypeError('invalid variant specified for result');
|
|
2412
2323
|
}
|
|
2324
|
+
_debugLog('[iface="wasi:io/streams@0.2.6", function="[method]output-stream.check-write"][Instruction::Return]', {
|
|
2325
|
+
funcName: '[method]output-stream.check-write',
|
|
2326
|
+
paramCount: 0,
|
|
2327
|
+
async: false,
|
|
2328
|
+
postReturn: false
|
|
2329
|
+
});
|
|
2413
2330
|
}
|
|
2414
|
-
|
|
2415
|
-
|
|
2416
|
-
|
|
2417
|
-
|
|
2418
|
-
|
|
2419
|
-
|
|
2420
|
-
|
|
2421
|
-
|
|
2422
|
-
|
|
2423
|
-
|
|
2424
|
-
var handle1 = arg0;
|
|
2425
|
-
var rep2 = handleTable1[(handle1 << 1) + 1] & ~T_FLAG;
|
|
2426
|
-
var rsc0 = captureTable1.get(rep2);
|
|
2427
|
-
if (!rsc0) {
|
|
2428
|
-
rsc0 = Object.create(OutputStream.prototype);
|
|
2429
|
-
Object.defineProperty(rsc0, symbolRscHandle, { writable: true, value: handle1});
|
|
2430
|
-
Object.defineProperty(rsc0, symbolRscRep, { writable: true, value: rep2});
|
|
2431
|
-
}
|
|
2432
|
-
curResourceBorrows.push(rsc0);
|
|
2433
|
-
_debugLog('[iface="wasi:io/streams@0.2.6", function="[method]output-stream.blocking-flush"] [Instruction::CallInterface] (async? sync, @ enter)');
|
|
2434
|
-
const _interface_call_currentTaskID = startCurrentTask(0, false, '[method]output-stream.blocking-flush');
|
|
2435
|
-
let ret;
|
|
2436
|
-
try {
|
|
2437
|
-
ret = { tag: 'ok', val: rsc0.blockingFlush()};
|
|
2438
|
-
} catch (e) {
|
|
2439
|
-
ret = { tag: 'err', val: getErrorPayload(e) };
|
|
2440
|
-
}
|
|
2441
|
-
_debugLog('[iface="wasi:io/streams@0.2.6", function="[method]output-stream.blocking-flush"] [Instruction::CallInterface] (sync, @ post-call)');
|
|
2442
|
-
for (const rsc of curResourceBorrows) {
|
|
2443
|
-
rsc[symbolRscHandle] = undefined;
|
|
2444
|
-
}
|
|
2445
|
-
curResourceBorrows = [];
|
|
2446
|
-
endCurrentTask(0);
|
|
2447
|
-
var variant5 = ret;
|
|
2448
|
-
switch (variant5.tag) {
|
|
2449
|
-
case 'ok': {
|
|
2450
|
-
const e = variant5.val;
|
|
2451
|
-
dataView(memory0).setInt8(arg1 + 0, 0, true);
|
|
2452
|
-
break;
|
|
2331
|
+
|
|
2332
|
+
|
|
2333
|
+
function trampoline19(arg0, arg1, arg2, arg3) {
|
|
2334
|
+
var handle1 = arg0;
|
|
2335
|
+
var rep2 = handleTable1[(handle1 << 1) + 1] & ~T_FLAG;
|
|
2336
|
+
var rsc0 = captureTable1.get(rep2);
|
|
2337
|
+
if (!rsc0) {
|
|
2338
|
+
rsc0 = Object.create(OutputStream.prototype);
|
|
2339
|
+
Object.defineProperty(rsc0, symbolRscHandle, { writable: true, value: handle1});
|
|
2340
|
+
Object.defineProperty(rsc0, symbolRscRep, { writable: true, value: rep2});
|
|
2453
2341
|
}
|
|
2454
|
-
|
|
2455
|
-
|
|
2456
|
-
|
|
2457
|
-
|
|
2458
|
-
|
|
2459
|
-
|
|
2460
|
-
|
|
2461
|
-
|
|
2462
|
-
|
|
2463
|
-
|
|
2464
|
-
|
|
2465
|
-
|
|
2466
|
-
|
|
2467
|
-
|
|
2468
|
-
|
|
2469
|
-
|
|
2470
|
-
|
|
2471
|
-
|
|
2472
|
-
|
|
2473
|
-
|
|
2474
|
-
|
|
2475
|
-
|
|
2476
|
-
|
|
2477
|
-
|
|
2478
|
-
|
|
2479
|
-
|
|
2342
|
+
curResourceBorrows.push(rsc0);
|
|
2343
|
+
var ptr3 = arg1;
|
|
2344
|
+
var len3 = arg2;
|
|
2345
|
+
var result3 = new Uint8Array(memory0.buffer.slice(ptr3, ptr3 + len3 * 1));
|
|
2346
|
+
_debugLog('[iface="wasi:io/streams@0.2.6", function="[method]output-stream.write"] [Instruction::CallInterface] (async? sync, @ enter)');
|
|
2347
|
+
const _interface_call_currentTaskID = startCurrentTask(0, false, '[method]output-stream.write');
|
|
2348
|
+
let ret;
|
|
2349
|
+
try {
|
|
2350
|
+
ret = { tag: 'ok', val: rsc0.write(result3)};
|
|
2351
|
+
} catch (e) {
|
|
2352
|
+
ret = { tag: 'err', val: getErrorPayload(e) };
|
|
2353
|
+
}
|
|
2354
|
+
_debugLog('[iface="wasi:io/streams@0.2.6", function="[method]output-stream.write"] [Instruction::CallInterface] (sync, @ post-call)');
|
|
2355
|
+
for (const rsc of curResourceBorrows) {
|
|
2356
|
+
rsc[symbolRscHandle] = undefined;
|
|
2357
|
+
}
|
|
2358
|
+
curResourceBorrows = [];
|
|
2359
|
+
endCurrentTask(0);
|
|
2360
|
+
var variant6 = ret;
|
|
2361
|
+
switch (variant6.tag) {
|
|
2362
|
+
case 'ok': {
|
|
2363
|
+
const e = variant6.val;
|
|
2364
|
+
dataView(memory0).setInt8(arg3 + 0, 0, true);
|
|
2365
|
+
break;
|
|
2366
|
+
}
|
|
2367
|
+
case 'err': {
|
|
2368
|
+
const e = variant6.val;
|
|
2369
|
+
dataView(memory0).setInt8(arg3 + 0, 1, true);
|
|
2370
|
+
var variant5 = e;
|
|
2371
|
+
switch (variant5.tag) {
|
|
2372
|
+
case 'last-operation-failed': {
|
|
2373
|
+
const e = variant5.val;
|
|
2374
|
+
dataView(memory0).setInt8(arg3 + 4, 0, true);
|
|
2375
|
+
if (!(e instanceof Error$1)) {
|
|
2376
|
+
throw new TypeError('Resource error: Not a valid "Error" resource.');
|
|
2377
|
+
}
|
|
2378
|
+
var handle4 = e[symbolRscHandle];
|
|
2379
|
+
if (!handle4) {
|
|
2380
|
+
const rep = e[symbolRscRep] || ++captureCnt0;
|
|
2381
|
+
captureTable0.set(rep, e);
|
|
2382
|
+
handle4 = rscTableCreateOwn(handleTable0, rep);
|
|
2383
|
+
}
|
|
2384
|
+
dataView(memory0).setInt32(arg3 + 8, handle4, true);
|
|
2385
|
+
break;
|
|
2386
|
+
}
|
|
2387
|
+
case 'closed': {
|
|
2388
|
+
dataView(memory0).setInt8(arg3 + 4, 1, true);
|
|
2389
|
+
break;
|
|
2390
|
+
}
|
|
2391
|
+
default: {
|
|
2392
|
+
throw new TypeError(`invalid variant tag value \`${JSON.stringify(variant5.tag)}\` (received \`${variant5}\`) specified for \`StreamError\``);
|
|
2393
|
+
}
|
|
2480
2394
|
}
|
|
2395
|
+
break;
|
|
2396
|
+
}
|
|
2397
|
+
default: {
|
|
2398
|
+
throw new TypeError('invalid variant specified for result');
|
|
2481
2399
|
}
|
|
2482
|
-
break;
|
|
2483
|
-
}
|
|
2484
|
-
default: {
|
|
2485
|
-
throw new TypeError('invalid variant specified for result');
|
|
2486
2400
|
}
|
|
2401
|
+
_debugLog('[iface="wasi:io/streams@0.2.6", function="[method]output-stream.write"][Instruction::Return]', {
|
|
2402
|
+
funcName: '[method]output-stream.write',
|
|
2403
|
+
paramCount: 0,
|
|
2404
|
+
async: false,
|
|
2405
|
+
postReturn: false
|
|
2406
|
+
});
|
|
2487
2407
|
}
|
|
2488
|
-
|
|
2489
|
-
|
|
2490
|
-
|
|
2491
|
-
|
|
2492
|
-
|
|
2493
|
-
|
|
2494
|
-
|
|
2495
|
-
|
|
2496
|
-
|
|
2497
|
-
|
|
2498
|
-
_debugLog('[iface="wasi:filesystem/preopens@0.2.6", function="get-directories"] [Instruction::CallInterface] (async? sync, @ enter)');
|
|
2499
|
-
const _interface_call_currentTaskID = startCurrentTask(0, false, 'get-directories');
|
|
2500
|
-
const ret = getDirectories();
|
|
2501
|
-
_debugLog('[iface="wasi:filesystem/preopens@0.2.6", function="get-directories"] [Instruction::CallInterface] (sync, @ post-call)');
|
|
2502
|
-
endCurrentTask(0);
|
|
2503
|
-
var vec3 = ret;
|
|
2504
|
-
var len3 = vec3.length;
|
|
2505
|
-
var result3 = realloc1(0, 0, 4, len3 * 12);
|
|
2506
|
-
for (let i = 0; i < vec3.length; i++) {
|
|
2507
|
-
const e = vec3[i];
|
|
2508
|
-
const base = result3 + i * 12;var [tuple0_0, tuple0_1] = e;
|
|
2509
|
-
if (!(tuple0_0 instanceof Descriptor)) {
|
|
2510
|
-
throw new TypeError('Resource error: Not a valid "Descriptor" resource.');
|
|
2511
|
-
}
|
|
2512
|
-
var handle1 = tuple0_0[symbolRscHandle];
|
|
2513
|
-
if (!handle1) {
|
|
2514
|
-
const rep = tuple0_0[symbolRscRep] || ++captureCnt4;
|
|
2515
|
-
captureTable4.set(rep, tuple0_0);
|
|
2516
|
-
handle1 = rscTableCreateOwn(handleTable4, rep);
|
|
2517
|
-
}
|
|
2518
|
-
dataView(memory0).setInt32(base + 0, handle1, true);
|
|
2519
|
-
var ptr2 = utf8Encode(tuple0_1, realloc1, memory0);
|
|
2520
|
-
var len2 = utf8EncodedLen;
|
|
2521
|
-
dataView(memory0).setUint32(base + 8, len2, true);
|
|
2522
|
-
dataView(memory0).setUint32(base + 4, ptr2, true);
|
|
2523
|
-
}
|
|
2524
|
-
dataView(memory0).setUint32(arg0 + 4, len3, true);
|
|
2525
|
-
dataView(memory0).setUint32(arg0 + 0, result3, true);
|
|
2526
|
-
_debugLog('[iface="wasi:filesystem/preopens@0.2.6", function="get-directories"][Instruction::Return]', {
|
|
2527
|
-
funcName: 'get-directories',
|
|
2528
|
-
paramCount: 0,
|
|
2529
|
-
async: false,
|
|
2530
|
-
postReturn: false
|
|
2531
|
-
});
|
|
2532
|
-
}
|
|
2533
|
-
|
|
2534
|
-
let exports3;
|
|
2535
|
-
let postReturn0;
|
|
2536
|
-
function trampoline0(handle) {
|
|
2537
|
-
const handleEntry = rscTableRemove(handleTable0, handle);
|
|
2538
|
-
if (handleEntry.own) {
|
|
2539
|
-
|
|
2540
|
-
const rsc = captureTable0.get(handleEntry.rep);
|
|
2541
|
-
if (rsc) {
|
|
2542
|
-
if (rsc[symbolDispose]) rsc[symbolDispose]();
|
|
2543
|
-
captureTable0.delete(handleEntry.rep);
|
|
2544
|
-
} else if (Error$1[symbolCabiDispose]) {
|
|
2545
|
-
Error$1[symbolCabiDispose](handleEntry.rep);
|
|
2408
|
+
|
|
2409
|
+
|
|
2410
|
+
function trampoline20(arg0, arg1) {
|
|
2411
|
+
var handle1 = arg0;
|
|
2412
|
+
var rep2 = handleTable1[(handle1 << 1) + 1] & ~T_FLAG;
|
|
2413
|
+
var rsc0 = captureTable1.get(rep2);
|
|
2414
|
+
if (!rsc0) {
|
|
2415
|
+
rsc0 = Object.create(OutputStream.prototype);
|
|
2416
|
+
Object.defineProperty(rsc0, symbolRscHandle, { writable: true, value: handle1});
|
|
2417
|
+
Object.defineProperty(rsc0, symbolRscRep, { writable: true, value: rep2});
|
|
2546
2418
|
}
|
|
2547
|
-
|
|
2548
|
-
|
|
2549
|
-
|
|
2550
|
-
|
|
2551
|
-
|
|
2552
|
-
|
|
2553
|
-
|
|
2554
|
-
|
|
2555
|
-
|
|
2556
|
-
|
|
2557
|
-
|
|
2558
|
-
|
|
2419
|
+
curResourceBorrows.push(rsc0);
|
|
2420
|
+
_debugLog('[iface="wasi:io/streams@0.2.6", function="[method]output-stream.blocking-flush"] [Instruction::CallInterface] (async? sync, @ enter)');
|
|
2421
|
+
const _interface_call_currentTaskID = startCurrentTask(0, false, '[method]output-stream.blocking-flush');
|
|
2422
|
+
let ret;
|
|
2423
|
+
try {
|
|
2424
|
+
ret = { tag: 'ok', val: rsc0.blockingFlush()};
|
|
2425
|
+
} catch (e) {
|
|
2426
|
+
ret = { tag: 'err', val: getErrorPayload(e) };
|
|
2427
|
+
}
|
|
2428
|
+
_debugLog('[iface="wasi:io/streams@0.2.6", function="[method]output-stream.blocking-flush"] [Instruction::CallInterface] (sync, @ post-call)');
|
|
2429
|
+
for (const rsc of curResourceBorrows) {
|
|
2430
|
+
rsc[symbolRscHandle] = undefined;
|
|
2431
|
+
}
|
|
2432
|
+
curResourceBorrows = [];
|
|
2433
|
+
endCurrentTask(0);
|
|
2434
|
+
var variant5 = ret;
|
|
2435
|
+
switch (variant5.tag) {
|
|
2436
|
+
case 'ok': {
|
|
2437
|
+
const e = variant5.val;
|
|
2438
|
+
dataView(memory0).setInt8(arg1 + 0, 0, true);
|
|
2439
|
+
break;
|
|
2440
|
+
}
|
|
2441
|
+
case 'err': {
|
|
2442
|
+
const e = variant5.val;
|
|
2443
|
+
dataView(memory0).setInt8(arg1 + 0, 1, true);
|
|
2444
|
+
var variant4 = e;
|
|
2445
|
+
switch (variant4.tag) {
|
|
2446
|
+
case 'last-operation-failed': {
|
|
2447
|
+
const e = variant4.val;
|
|
2448
|
+
dataView(memory0).setInt8(arg1 + 4, 0, true);
|
|
2449
|
+
if (!(e instanceof Error$1)) {
|
|
2450
|
+
throw new TypeError('Resource error: Not a valid "Error" resource.');
|
|
2451
|
+
}
|
|
2452
|
+
var handle3 = e[symbolRscHandle];
|
|
2453
|
+
if (!handle3) {
|
|
2454
|
+
const rep = e[symbolRscRep] || ++captureCnt0;
|
|
2455
|
+
captureTable0.set(rep, e);
|
|
2456
|
+
handle3 = rscTableCreateOwn(handleTable0, rep);
|
|
2457
|
+
}
|
|
2458
|
+
dataView(memory0).setInt32(arg1 + 8, handle3, true);
|
|
2459
|
+
break;
|
|
2460
|
+
}
|
|
2461
|
+
case 'closed': {
|
|
2462
|
+
dataView(memory0).setInt8(arg1 + 4, 1, true);
|
|
2463
|
+
break;
|
|
2464
|
+
}
|
|
2465
|
+
default: {
|
|
2466
|
+
throw new TypeError(`invalid variant tag value \`${JSON.stringify(variant4.tag)}\` (received \`${variant4}\`) specified for \`StreamError\``);
|
|
2467
|
+
}
|
|
2468
|
+
}
|
|
2469
|
+
break;
|
|
2470
|
+
}
|
|
2471
|
+
default: {
|
|
2472
|
+
throw new TypeError('invalid variant specified for result');
|
|
2473
|
+
}
|
|
2559
2474
|
}
|
|
2475
|
+
_debugLog('[iface="wasi:io/streams@0.2.6", function="[method]output-stream.blocking-flush"][Instruction::Return]', {
|
|
2476
|
+
funcName: '[method]output-stream.blocking-flush',
|
|
2477
|
+
paramCount: 0,
|
|
2478
|
+
async: false,
|
|
2479
|
+
postReturn: false
|
|
2480
|
+
});
|
|
2560
2481
|
}
|
|
2561
|
-
|
|
2562
|
-
|
|
2563
|
-
|
|
2564
|
-
|
|
2565
|
-
|
|
2566
|
-
|
|
2567
|
-
|
|
2568
|
-
|
|
2569
|
-
|
|
2482
|
+
|
|
2483
|
+
|
|
2484
|
+
function trampoline21(arg0) {
|
|
2485
|
+
_debugLog('[iface="wasi:filesystem/preopens@0.2.6", function="get-directories"] [Instruction::CallInterface] (async? sync, @ enter)');
|
|
2486
|
+
const _interface_call_currentTaskID = startCurrentTask(0, false, 'get-directories');
|
|
2487
|
+
const ret = getDirectories();
|
|
2488
|
+
_debugLog('[iface="wasi:filesystem/preopens@0.2.6", function="get-directories"] [Instruction::CallInterface] (sync, @ post-call)');
|
|
2489
|
+
endCurrentTask(0);
|
|
2490
|
+
var vec3 = ret;
|
|
2491
|
+
var len3 = vec3.length;
|
|
2492
|
+
var result3 = realloc1(0, 0, 4, len3 * 12);
|
|
2493
|
+
for (let i = 0; i < vec3.length; i++) {
|
|
2494
|
+
const e = vec3[i];
|
|
2495
|
+
const base = result3 + i * 12;var [tuple0_0, tuple0_1] = e;
|
|
2496
|
+
if (!(tuple0_0 instanceof Descriptor)) {
|
|
2497
|
+
throw new TypeError('Resource error: Not a valid "Descriptor" resource.');
|
|
2498
|
+
}
|
|
2499
|
+
var handle1 = tuple0_0[symbolRscHandle];
|
|
2500
|
+
if (!handle1) {
|
|
2501
|
+
const rep = tuple0_0[symbolRscRep] || ++captureCnt4;
|
|
2502
|
+
captureTable4.set(rep, tuple0_0);
|
|
2503
|
+
handle1 = rscTableCreateOwn(handleTable4, rep);
|
|
2504
|
+
}
|
|
2505
|
+
dataView(memory0).setInt32(base + 0, handle1, true);
|
|
2506
|
+
var ptr2 = utf8Encode(tuple0_1, realloc1, memory0);
|
|
2507
|
+
var len2 = utf8EncodedLen;
|
|
2508
|
+
dataView(memory0).setUint32(base + 8, len2, true);
|
|
2509
|
+
dataView(memory0).setUint32(base + 4, ptr2, true);
|
|
2510
|
+
}
|
|
2511
|
+
dataView(memory0).setUint32(arg0 + 4, len3, true);
|
|
2512
|
+
dataView(memory0).setUint32(arg0 + 0, result3, true);
|
|
2513
|
+
_debugLog('[iface="wasi:filesystem/preopens@0.2.6", function="get-directories"][Instruction::Return]', {
|
|
2514
|
+
funcName: 'get-directories',
|
|
2515
|
+
paramCount: 0,
|
|
2516
|
+
async: false,
|
|
2517
|
+
postReturn: false
|
|
2518
|
+
});
|
|
2570
2519
|
}
|
|
2571
|
-
|
|
2572
|
-
|
|
2573
|
-
|
|
2574
|
-
|
|
2575
|
-
|
|
2576
|
-
|
|
2577
|
-
|
|
2578
|
-
|
|
2579
|
-
|
|
2580
|
-
|
|
2581
|
-
|
|
2520
|
+
|
|
2521
|
+
let exports3;
|
|
2522
|
+
let postReturn0;
|
|
2523
|
+
function trampoline0(handle) {
|
|
2524
|
+
const handleEntry = rscTableRemove(handleTable0, handle);
|
|
2525
|
+
if (handleEntry.own) {
|
|
2526
|
+
|
|
2527
|
+
const rsc = captureTable0.get(handleEntry.rep);
|
|
2528
|
+
if (rsc) {
|
|
2529
|
+
if (rsc[symbolDispose]) rsc[symbolDispose]();
|
|
2530
|
+
captureTable0.delete(handleEntry.rep);
|
|
2531
|
+
} else if (Error$1[symbolCabiDispose]) {
|
|
2532
|
+
Error$1[symbolCabiDispose](handleEntry.rep);
|
|
2533
|
+
}
|
|
2582
2534
|
}
|
|
2583
2535
|
}
|
|
2584
|
-
|
|
2585
|
-
|
|
2586
|
-
|
|
2587
|
-
|
|
2588
|
-
|
|
2589
|
-
|
|
2590
|
-
|
|
2591
|
-
|
|
2592
|
-
|
|
2593
|
-
|
|
2594
|
-
|
|
2536
|
+
function trampoline1(handle) {
|
|
2537
|
+
const handleEntry = rscTableRemove(handleTable1, handle);
|
|
2538
|
+
if (handleEntry.own) {
|
|
2539
|
+
|
|
2540
|
+
const rsc = captureTable1.get(handleEntry.rep);
|
|
2541
|
+
if (rsc) {
|
|
2542
|
+
if (rsc[symbolDispose]) rsc[symbolDispose]();
|
|
2543
|
+
captureTable1.delete(handleEntry.rep);
|
|
2544
|
+
} else if (OutputStream[symbolCabiDispose]) {
|
|
2545
|
+
OutputStream[symbolCabiDispose](handleEntry.rep);
|
|
2546
|
+
}
|
|
2595
2547
|
}
|
|
2596
2548
|
}
|
|
2597
|
-
|
|
2598
|
-
|
|
2599
|
-
|
|
2600
|
-
|
|
2601
|
-
|
|
2602
|
-
|
|
2603
|
-
|
|
2604
|
-
|
|
2605
|
-
var ptr2 = utf8Encode(arg2, realloc0, memory0);
|
|
2606
|
-
var len2 = utf8EncodedLen;
|
|
2607
|
-
var ptr3 = utf8Encode(arg3, realloc0, memory0);
|
|
2608
|
-
var len3 = utf8EncodedLen;
|
|
2609
|
-
_debugLog('[iface="docs:giallo-js/syntax-highlighter@0.0.1", function="render-highlighted"][Instruction::CallWasm] enter', {
|
|
2610
|
-
funcName: 'render-highlighted',
|
|
2611
|
-
paramCount: 8,
|
|
2612
|
-
async: false,
|
|
2613
|
-
postReturn: true,
|
|
2614
|
-
});
|
|
2615
|
-
const _wasm_call_currentTaskID = startCurrentTask(0, false, 'syntaxHighlighter001RenderHighlighted');
|
|
2616
|
-
const ret = syntaxHighlighter001RenderHighlighted(ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3);
|
|
2617
|
-
endCurrentTask(0);
|
|
2618
|
-
let variant6;
|
|
2619
|
-
switch (dataView(memory0).getUint8(ret + 0, true)) {
|
|
2620
|
-
case 0: {
|
|
2621
|
-
var ptr4 = dataView(memory0).getUint32(ret + 4, true);
|
|
2622
|
-
var len4 = dataView(memory0).getUint32(ret + 8, true);
|
|
2623
|
-
var result4 = utf8Decoder.decode(new Uint8Array(memory0.buffer, ptr4, len4));
|
|
2624
|
-
variant6= {
|
|
2625
|
-
tag: 'ok',
|
|
2626
|
-
val: result4
|
|
2627
|
-
};
|
|
2628
|
-
break;
|
|
2629
|
-
}
|
|
2630
|
-
case 1: {
|
|
2631
|
-
var ptr5 = dataView(memory0).getUint32(ret + 4, true);
|
|
2632
|
-
var len5 = dataView(memory0).getUint32(ret + 8, true);
|
|
2633
|
-
var result5 = utf8Decoder.decode(new Uint8Array(memory0.buffer, ptr5, len5));
|
|
2634
|
-
variant6= {
|
|
2635
|
-
tag: 'err',
|
|
2636
|
-
val: result5
|
|
2637
|
-
};
|
|
2638
|
-
break;
|
|
2639
|
-
}
|
|
2640
|
-
default: {
|
|
2641
|
-
throw new TypeError('invalid variant discriminant for expected');
|
|
2549
|
+
const handleTable3 = [T_FLAG, 0];
|
|
2550
|
+
const captureTable3= new Map();
|
|
2551
|
+
let captureCnt3 = 0;
|
|
2552
|
+
handleTables[3] = handleTable3;
|
|
2553
|
+
function trampoline3(handle) {
|
|
2554
|
+
const handleEntry = rscTableRemove(handleTable3, handle);
|
|
2555
|
+
if (handleEntry.own) {
|
|
2556
|
+
throw new TypeError('unreachable trampoline for resource [ResourceIndex(3)]')
|
|
2642
2557
|
}
|
|
2643
2558
|
}
|
|
2644
|
-
|
|
2645
|
-
|
|
2646
|
-
|
|
2647
|
-
|
|
2648
|
-
|
|
2649
|
-
|
|
2650
|
-
|
|
2651
|
-
|
|
2652
|
-
|
|
2653
|
-
|
|
2654
|
-
|
|
2655
|
-
|
|
2656
|
-
|
|
2657
|
-
|
|
2658
|
-
|
|
2659
|
-
if (typeof retCopy === 'object' && retCopy.tag === 'err') {
|
|
2660
|
-
throw new ComponentError(retCopy.val);
|
|
2559
|
+
function trampoline4(handle) {
|
|
2560
|
+
const handleEntry = rscTableRemove(handleTable4, handle);
|
|
2561
|
+
if (handleEntry.own) {
|
|
2562
|
+
|
|
2563
|
+
const rsc = captureTable4.get(handleEntry.rep);
|
|
2564
|
+
if (rsc) {
|
|
2565
|
+
if (rsc[symbolDispose]) rsc[symbolDispose]();
|
|
2566
|
+
captureTable4.delete(handleEntry.rep);
|
|
2567
|
+
} else if (Descriptor[symbolCabiDispose]) {
|
|
2568
|
+
Descriptor[symbolCabiDispose](handleEntry.rep);
|
|
2569
|
+
}
|
|
2570
|
+
}
|
|
2661
2571
|
}
|
|
2662
|
-
|
|
2663
|
-
|
|
2664
|
-
|
|
2665
|
-
|
|
2666
|
-
const
|
|
2667
|
-
|
|
2668
|
-
|
|
2669
|
-
|
|
2670
|
-
|
|
2671
|
-
|
|
2672
|
-
|
|
2673
|
-
|
|
2674
|
-
|
|
2675
|
-
|
|
2676
|
-
|
|
2677
|
-
|
|
2678
|
-
|
|
2679
|
-
|
|
2680
|
-
|
|
2681
|
-
'
|
|
2682
|
-
|
|
2683
|
-
|
|
2684
|
-
|
|
2685
|
-
'
|
|
2686
|
-
|
|
2687
|
-
|
|
2688
|
-
|
|
2689
|
-
|
|
2690
|
-
|
|
2691
|
-
|
|
2692
|
-
|
|
2693
|
-
|
|
2694
|
-
|
|
2695
|
-
|
|
2696
|
-
|
|
2697
|
-
|
|
2698
|
-
|
|
2699
|
-
|
|
2700
|
-
|
|
2701
|
-
|
|
2702
|
-
|
|
2703
|
-
|
|
2704
|
-
|
|
2705
|
-
|
|
2706
|
-
|
|
2707
|
-
|
|
2708
|
-
|
|
2709
|
-
|
|
2710
|
-
|
|
2711
|
-
|
|
2712
|
-
|
|
2713
|
-
|
|
2714
|
-
|
|
2715
|
-
|
|
2716
|
-
|
|
2717
|
-
|
|
2718
|
-
|
|
2719
|
-
|
|
2720
|
-
|
|
2721
|
-
|
|
2722
|
-
|
|
2723
|
-
|
|
2724
|
-
|
|
2725
|
-
|
|
2726
|
-
|
|
2727
|
-
|
|
2728
|
-
|
|
2729
|
-
|
|
2730
|
-
|
|
2731
|
-
|
|
2732
|
-
|
|
2733
|
-
'
|
|
2734
|
-
|
|
2735
|
-
|
|
2736
|
-
|
|
2737
|
-
|
|
2738
|
-
|
|
2739
|
-
|
|
2740
|
-
|
|
2741
|
-
|
|
2742
|
-
|
|
2743
|
-
|
|
2744
|
-
|
|
2745
|
-
|
|
2746
|
-
|
|
2747
|
-
|
|
2748
|
-
|
|
2749
|
-
|
|
2750
|
-
|
|
2751
|
-
|
|
2752
|
-
|
|
2753
|
-
|
|
2754
|
-
|
|
2755
|
-
|
|
2756
|
-
|
|
2757
|
-
|
|
2758
|
-
|
|
2759
|
-
|
|
2760
|
-
|
|
2761
|
-
|
|
2762
|
-
|
|
2763
|
-
|
|
2764
|
-
|
|
2765
|
-
|
|
2766
|
-
|
|
2767
|
-
|
|
2768
|
-
|
|
2769
|
-
|
|
2770
|
-
|
|
2771
|
-
|
|
2772
|
-
|
|
2773
|
-
|
|
2774
|
-
|
|
2775
|
-
|
|
2776
|
-
|
|
2777
|
-
})
|
|
2778
|
-
|
|
2779
|
-
|
|
2780
|
-
|
|
2781
|
-
|
|
2782
|
-
|
|
2783
|
-
|
|
2784
|
-
|
|
2785
|
-
|
|
2786
|
-
|
|
2787
|
-
|
|
2572
|
+
function trampoline5(handle) {
|
|
2573
|
+
const handleEntry = rscTableRemove(handleTable2, handle);
|
|
2574
|
+
if (handleEntry.own) {
|
|
2575
|
+
|
|
2576
|
+
const rsc = captureTable2.get(handleEntry.rep);
|
|
2577
|
+
if (rsc) {
|
|
2578
|
+
if (rsc[symbolDispose]) rsc[symbolDispose]();
|
|
2579
|
+
captureTable2.delete(handleEntry.rep);
|
|
2580
|
+
} else if (InputStream[symbolCabiDispose]) {
|
|
2581
|
+
InputStream[symbolCabiDispose](handleEntry.rep);
|
|
2582
|
+
}
|
|
2583
|
+
}
|
|
2584
|
+
}
|
|
2585
|
+
({ exports: exports0 } = instantiateCore(module2));
|
|
2586
|
+
({ exports: exports1 } = instantiateCore(module0, {
|
|
2587
|
+
'wasi:cli/stderr@0.2.4': {
|
|
2588
|
+
'get-stderr': trampoline2,
|
|
2589
|
+
},
|
|
2590
|
+
'wasi:io/error@0.2.4': {
|
|
2591
|
+
'[method]error.to-debug-string': exports0['0'],
|
|
2592
|
+
'[resource-drop]error': trampoline0,
|
|
2593
|
+
},
|
|
2594
|
+
'wasi:io/streams@0.2.4': {
|
|
2595
|
+
'[method]output-stream.blocking-write-and-flush': exports0['1'],
|
|
2596
|
+
'[resource-drop]output-stream': trampoline1,
|
|
2597
|
+
},
|
|
2598
|
+
'wasi:random/insecure-seed@0.2.4': {
|
|
2599
|
+
'insecure-seed': exports0['2'],
|
|
2600
|
+
},
|
|
2601
|
+
wasi_snapshot_preview1: {
|
|
2602
|
+
environ_get: exports0['3'],
|
|
2603
|
+
environ_sizes_get: exports0['4'],
|
|
2604
|
+
fd_close: exports0['5'],
|
|
2605
|
+
fd_prestat_dir_name: exports0['7'],
|
|
2606
|
+
fd_prestat_get: exports0['6'],
|
|
2607
|
+
fd_seek: exports0['8'],
|
|
2608
|
+
fd_write: exports0['9'],
|
|
2609
|
+
proc_exit: exports0['10'],
|
|
2610
|
+
},
|
|
2611
|
+
}));
|
|
2612
|
+
({ exports: exports2 } = instantiateCore(module1, {
|
|
2613
|
+
__main_module__: {
|
|
2614
|
+
cabi_realloc: exports1.cabi_realloc,
|
|
2615
|
+
},
|
|
2616
|
+
env: {
|
|
2617
|
+
memory: exports1.memory,
|
|
2618
|
+
},
|
|
2619
|
+
'wasi:cli/environment@0.2.6': {
|
|
2620
|
+
'get-environment': exports0['11'],
|
|
2621
|
+
},
|
|
2622
|
+
'wasi:cli/exit@0.2.6': {
|
|
2623
|
+
exit: trampoline8,
|
|
2624
|
+
},
|
|
2625
|
+
'wasi:cli/stderr@0.2.6': {
|
|
2626
|
+
'get-stderr': trampoline2,
|
|
2627
|
+
},
|
|
2628
|
+
'wasi:cli/stdin@0.2.6': {
|
|
2629
|
+
'get-stdin': trampoline6,
|
|
2630
|
+
},
|
|
2631
|
+
'wasi:cli/stdout@0.2.6': {
|
|
2632
|
+
'get-stdout': trampoline7,
|
|
2633
|
+
},
|
|
2634
|
+
'wasi:filesystem/preopens@0.2.6': {
|
|
2635
|
+
'get-directories': exports0['21'],
|
|
2636
|
+
},
|
|
2637
|
+
'wasi:filesystem/types@0.2.6': {
|
|
2638
|
+
'[method]descriptor.append-via-stream': exports0['14'],
|
|
2639
|
+
'[method]descriptor.get-type': exports0['15'],
|
|
2640
|
+
'[method]descriptor.stat': exports0['16'],
|
|
2641
|
+
'[method]descriptor.write-via-stream': exports0['13'],
|
|
2642
|
+
'[resource-drop]descriptor': trampoline4,
|
|
2643
|
+
'[resource-drop]directory-entry-stream': trampoline3,
|
|
2644
|
+
'filesystem-error-code': exports0['12'],
|
|
2645
|
+
},
|
|
2646
|
+
'wasi:io/error@0.2.6': {
|
|
2647
|
+
'[resource-drop]error': trampoline0,
|
|
2648
|
+
},
|
|
2649
|
+
'wasi:io/streams@0.2.6': {
|
|
2650
|
+
'[method]output-stream.blocking-flush': exports0['19'],
|
|
2651
|
+
'[method]output-stream.blocking-write-and-flush': exports0['20'],
|
|
2652
|
+
'[method]output-stream.check-write': exports0['17'],
|
|
2653
|
+
'[method]output-stream.write': exports0['18'],
|
|
2654
|
+
'[resource-drop]input-stream': trampoline5,
|
|
2655
|
+
'[resource-drop]output-stream': trampoline1,
|
|
2656
|
+
},
|
|
2657
|
+
}));
|
|
2658
|
+
memory0 = exports1.memory;
|
|
2659
|
+
realloc0 = exports1.cabi_realloc;
|
|
2660
|
+
realloc1 = exports2.cabi_import_realloc;
|
|
2661
|
+
({ exports: exports3 } = instantiateCore(module3, {
|
|
2662
|
+
'': {
|
|
2663
|
+
$imports: exports0.$imports,
|
|
2664
|
+
'0': trampoline9,
|
|
2665
|
+
'1': trampoline10,
|
|
2666
|
+
'10': exports2.proc_exit,
|
|
2667
|
+
'11': trampoline12,
|
|
2668
|
+
'12': trampoline13,
|
|
2669
|
+
'13': trampoline14,
|
|
2670
|
+
'14': trampoline15,
|
|
2671
|
+
'15': trampoline16,
|
|
2672
|
+
'16': trampoline17,
|
|
2673
|
+
'17': trampoline18,
|
|
2674
|
+
'18': trampoline19,
|
|
2675
|
+
'19': trampoline20,
|
|
2676
|
+
'2': trampoline11,
|
|
2677
|
+
'20': trampoline10,
|
|
2678
|
+
'21': trampoline21,
|
|
2679
|
+
'3': exports2.environ_get,
|
|
2680
|
+
'4': exports2.environ_sizes_get,
|
|
2681
|
+
'5': exports2.fd_close,
|
|
2682
|
+
'6': exports2.fd_prestat_get,
|
|
2683
|
+
'7': exports2.fd_prestat_dir_name,
|
|
2684
|
+
'8': exports2.fd_seek,
|
|
2685
|
+
'9': exports2.fd_write,
|
|
2686
|
+
},
|
|
2687
|
+
}));
|
|
2688
|
+
postReturn0 = exports1['cabi_post_docs:giallo-js/syntax-highlighter@0.0.1#render-highlighted'];
|
|
2689
|
+
let syntaxHighlighter001RenderHighlighted;
|
|
2690
|
+
|
|
2691
|
+
function renderHighlighted(arg0, arg1, arg2, arg3) {
|
|
2692
|
+
var ptr0 = utf8Encode(arg0, realloc0, memory0);
|
|
2693
|
+
var len0 = utf8EncodedLen;
|
|
2694
|
+
var ptr1 = utf8Encode(arg1, realloc0, memory0);
|
|
2695
|
+
var len1 = utf8EncodedLen;
|
|
2696
|
+
var ptr2 = utf8Encode(arg2, realloc0, memory0);
|
|
2697
|
+
var len2 = utf8EncodedLen;
|
|
2698
|
+
var ptr3 = utf8Encode(arg3, realloc0, memory0);
|
|
2699
|
+
var len3 = utf8EncodedLen;
|
|
2700
|
+
_debugLog('[iface="docs:giallo-js/syntax-highlighter@0.0.1", function="render-highlighted"][Instruction::CallWasm] enter', {
|
|
2701
|
+
funcName: 'render-highlighted',
|
|
2702
|
+
paramCount: 8,
|
|
2703
|
+
async: false,
|
|
2704
|
+
postReturn: true,
|
|
2705
|
+
});
|
|
2706
|
+
const _wasm_call_currentTaskID = startCurrentTask(0, false, 'syntaxHighlighter001RenderHighlighted');
|
|
2707
|
+
const ret = syntaxHighlighter001RenderHighlighted(ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3);
|
|
2708
|
+
endCurrentTask(0);
|
|
2709
|
+
let variant6;
|
|
2710
|
+
switch (dataView(memory0).getUint8(ret + 0, true)) {
|
|
2711
|
+
case 0: {
|
|
2712
|
+
var ptr4 = dataView(memory0).getUint32(ret + 4, true);
|
|
2713
|
+
var len4 = dataView(memory0).getUint32(ret + 8, true);
|
|
2714
|
+
var result4 = utf8Decoder.decode(new Uint8Array(memory0.buffer, ptr4, len4));
|
|
2715
|
+
variant6= {
|
|
2716
|
+
tag: 'ok',
|
|
2717
|
+
val: result4
|
|
2718
|
+
};
|
|
2719
|
+
break;
|
|
2720
|
+
}
|
|
2721
|
+
case 1: {
|
|
2722
|
+
var ptr5 = dataView(memory0).getUint32(ret + 4, true);
|
|
2723
|
+
var len5 = dataView(memory0).getUint32(ret + 8, true);
|
|
2724
|
+
var result5 = utf8Decoder.decode(new Uint8Array(memory0.buffer, ptr5, len5));
|
|
2725
|
+
variant6= {
|
|
2726
|
+
tag: 'err',
|
|
2727
|
+
val: result5
|
|
2728
|
+
};
|
|
2729
|
+
break;
|
|
2730
|
+
}
|
|
2731
|
+
default: {
|
|
2732
|
+
throw new TypeError('invalid variant discriminant for expected');
|
|
2788
2733
|
}
|
|
2789
|
-
if (!promise) promise = new Promise((_resolve, _reject) => (resolve = _resolve, reject = _reject));
|
|
2790
|
-
value.then(runNext, reject);
|
|
2791
2734
|
}
|
|
2792
|
-
|
|
2793
|
-
|
|
2794
|
-
|
|
2735
|
+
_debugLog('[iface="docs:giallo-js/syntax-highlighter@0.0.1", function="render-highlighted"][Instruction::Return]', {
|
|
2736
|
+
funcName: 'render-highlighted',
|
|
2737
|
+
paramCount: 1,
|
|
2738
|
+
async: false,
|
|
2739
|
+
postReturn: true
|
|
2740
|
+
});
|
|
2741
|
+
const retCopy = variant6;
|
|
2742
|
+
|
|
2743
|
+
let cstate = getOrCreateAsyncState(0);
|
|
2744
|
+
cstate.mayLeave = false;
|
|
2745
|
+
postReturn0(ret);
|
|
2746
|
+
cstate.mayLeave = true;
|
|
2747
|
+
|
|
2748
|
+
|
|
2749
|
+
|
|
2750
|
+
if (typeof retCopy === 'object' && retCopy.tag === 'err') {
|
|
2751
|
+
throw new ComponentError(retCopy.val);
|
|
2795
2752
|
}
|
|
2753
|
+
return retCopy.val;
|
|
2754
|
+
|
|
2796
2755
|
}
|
|
2797
|
-
|
|
2798
|
-
|
|
2799
|
-
|
|
2800
|
-
|
|
2801
|
-
|
|
2802
|
-
const syntaxHighlighter001 = {
|
|
2803
|
-
renderHighlighted: renderHighlighted,
|
|
2756
|
+
syntaxHighlighter001RenderHighlighted = exports1['docs:giallo-js/syntax-highlighter@0.0.1#render-highlighted'];
|
|
2757
|
+
const syntaxHighlighter001 = {
|
|
2758
|
+
renderHighlighted: renderHighlighted,
|
|
2759
|
+
|
|
2760
|
+
};
|
|
2804
2761
|
|
|
2805
|
-
};
|
|
2806
|
-
|
|
2807
|
-
|
|
2762
|
+
return { syntaxHighlighter: syntaxHighlighter001, 'docs:giallo-js/syntax-highlighter@0.0.1': syntaxHighlighter001, };
|
|
2763
|
+
})();
|
|
2764
|
+
let promise, resolve, reject;
|
|
2765
|
+
function runNext (value) {
|
|
2766
|
+
try {
|
|
2767
|
+
let done;
|
|
2768
|
+
do {
|
|
2769
|
+
({ value, done } = gen.next(value));
|
|
2770
|
+
} while (!(value instanceof Promise) && !done);
|
|
2771
|
+
if (done) {
|
|
2772
|
+
if (resolve) return resolve(value);
|
|
2773
|
+
else return value;
|
|
2774
|
+
}
|
|
2775
|
+
if (!promise) promise = new Promise((_resolve, _reject) => (resolve = _resolve, reject = _reject));
|
|
2776
|
+
value.then(nextVal => done ? resolve() : runNext(nextVal), reject);
|
|
2777
|
+
}
|
|
2778
|
+
catch (e) {
|
|
2779
|
+
if (reject) reject(e);
|
|
2780
|
+
else throw e;
|
|
2781
|
+
}
|
|
2782
|
+
}
|
|
2783
|
+
const maybeSyncReturn = runNext(null);
|
|
2784
|
+
return promise || maybeSyncReturn;
|
|
2785
|
+
}
|