@gmitch215/folio 1.0.1 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +98 -460
- package/dist/boot.d.ts +1 -0
- package/dist/boot.js +1 -0
- package/dist/browser/index.d.ts +73 -0
- package/dist/browser/index.js +277 -0
- package/dist/browser.d.ts +1 -68
- package/dist/browser.js +1 -274
- package/dist/continuation.d.ts +1 -0
- package/dist/continuation.js +1 -0
- package/dist/{compiler.d.ts → execution/compiler.d.ts} +1 -1
- package/dist/{compiler.js → execution/compiler.js} +5 -12
- package/dist/{coordinator.d.ts → execution/coordinator.d.ts} +1 -1
- package/dist/{coordinator.js → execution/coordinator.js} +55 -8
- package/dist/{extract.d.ts → execution/extract.d.ts} +22 -13
- package/dist/{extract.js → execution/extract.js} +137 -10
- package/dist/execution/fold.d.ts +44 -0
- package/dist/execution/fold.js +105 -0
- package/dist/{guards.d.ts → execution/guards.d.ts} +2 -1
- package/dist/execution/runs.d.ts +44 -0
- package/dist/execution/runs.js +182 -0
- package/dist/{transaction.d.ts → execution/transaction.d.ts} +10 -0
- package/dist/execution/types.d.ts +221 -0
- package/dist/folds/affine-state.d.ts +142 -0
- package/dist/folds/affine-state.js +737 -0
- package/dist/folds/affine.d.ts +148 -0
- package/dist/folds/affine.js +562 -0
- package/dist/folds/boundaries.d.ts +48 -0
- package/dist/folds/boundaries.js +119 -0
- package/dist/folds/certified.d.ts +55 -0
- package/dist/folds/certified.js +178 -0
- package/dist/folds/certify.d.ts +87 -0
- package/dist/folds/certify.js +2611 -0
- package/dist/footprints/memo.d.ts +74 -0
- package/dist/footprints/memo.js +256 -0
- package/dist/footprints/ranges.d.ts +78 -0
- package/dist/footprints/ranges.js +263 -0
- package/dist/footprints/read-scan.d.ts +18 -0
- package/dist/footprints/read-scan.js +94 -0
- package/dist/footprints/read-windows.d.ts +77 -0
- package/dist/footprints/read-windows.js +245 -0
- package/dist/index.d.ts +16 -4
- package/dist/index.js +14 -2
- package/dist/iteration/admission.d.ts +149 -0
- package/dist/iteration/admission.js +201 -0
- package/dist/iteration/index.d.ts +239 -0
- package/dist/iteration/index.js +1210 -0
- package/dist/iteration/inline.d.ts +182 -0
- package/dist/{inline.js → iteration/inline.js} +277 -21
- package/dist/{iteration-owner.d.ts → iteration/owner.d.ts} +16 -3
- package/dist/{iteration-owner.js → iteration/owner.js} +6 -5
- package/dist/iteration/worker.js +216 -0
- package/dist/{managed.d.ts → managed/index.d.ts} +75 -3
- package/dist/managed/index.js +817 -0
- package/dist/managed/outbox.d.ts +128 -0
- package/dist/managed/outbox.js +156 -0
- package/dist/managed/pool.d.ts +221 -0
- package/dist/managed/pool.js +310 -0
- package/dist/managed/tasks.d.ts +154 -0
- package/dist/managed/tasks.js +183 -0
- package/dist/{bake.d.ts → memory/bake.d.ts} +12 -6
- package/dist/{bake.js → memory/bake.js} +9 -7
- package/dist/memory/continuation.d.ts +141 -0
- package/dist/memory/continuation.js +495 -0
- package/dist/memory/elastic-peer.d.ts +20 -0
- package/dist/memory/elastic-peer.js +39 -0
- package/dist/memory/elastic-sql.d.ts +11 -0
- package/dist/memory/elastic-sql.js +35 -0
- package/dist/memory/elastic.d.ts +130 -0
- package/dist/memory/elastic.js +475 -0
- package/dist/memory/growth-governor.d.ts +16 -0
- package/dist/memory/growth-governor.js +42 -0
- package/dist/memory/imports.d.ts +10 -0
- package/dist/memory/imports.js +89 -0
- package/dist/{iteration-layout.d.ts → memory/iteration-layout.d.ts} +61 -1
- package/dist/{iteration-layout.js → memory/iteration-layout.js} +54 -3
- package/dist/memory/lease.d.ts +45 -0
- package/dist/memory/lease.js +274 -0
- package/dist/{pages.d.ts → memory/pages.d.ts} +3 -3
- package/dist/memory.d.ts +5 -10
- package/dist/memory.js +5 -89
- package/dist/{context.d.ts → node/context.d.ts} +17 -3
- package/dist/{context.js → node/context.js} +60 -14
- package/dist/{host.d.ts → node/host.d.ts} +1 -1
- package/dist/{host.js → node/host.js} +2 -2
- package/dist/{node.d.ts → node/index.d.ts} +46 -49
- package/dist/{node.js → node/index.js} +101 -26
- package/dist/{tasks.d.ts → node/tasks.d.ts} +16 -17
- package/dist/{tasks.js → node/tasks.js} +12 -11
- package/dist/node/worker.d.ts +1 -0
- package/dist/{worker.js → node/worker.js} +2 -2
- package/dist/ownership/index.d.ts +161 -0
- package/dist/ownership/index.js +6565 -0
- package/dist/ownership/redirect.d.ts +30 -0
- package/dist/ownership/redirect.js +179 -0
- package/dist/ownership/slices.d.ts +44 -0
- package/dist/ownership/slices.js +72 -0
- package/dist/{frames.d.ts → remote/frames.d.ts} +6 -2
- package/dist/remote/frames.js +306 -0
- package/dist/{remote.d.ts → remote/index.d.ts} +7 -2
- package/dist/{remote.js → remote/index.js} +7 -2
- package/dist/routing/index.d.ts +203 -0
- package/dist/routing/index.js +671 -0
- package/dist/routing/worker.d.ts +1 -0
- package/dist/routing/worker.js +4 -0
- package/dist/slices/index.d.ts +126 -0
- package/dist/slices/index.js +441 -0
- package/dist/slices/worker.d.ts +1 -0
- package/dist/slices/worker.js +38 -0
- package/dist/workers.d.ts +5 -0
- package/dist/workers.js +5 -0
- package/package.json +32 -46
- package/dist/frames.js +0 -159
- package/dist/inline.d.ts +0 -68
- package/dist/iteration-admission.d.ts +0 -76
- package/dist/iteration-admission.js +0 -72
- package/dist/iteration-worker.js +0 -150
- package/dist/iteration.d.ts +0 -163
- package/dist/iteration.js +0 -435
- package/dist/managed.js +0 -421
- /package/dist/{browser-worker.d.ts → browser/worker.d.ts} +0 -0
- /package/dist/{browser-worker.js → browser/worker.js} +0 -0
- /package/dist/{guards.js → execution/guards.js} +0 -0
- /package/dist/{import-order.d.ts → execution/import-order.d.ts} +0 -0
- /package/dist/{import-order.js → execution/import-order.js} +0 -0
- /package/dist/{transaction.js → execution/transaction.js} +0 -0
- /package/dist/{iteration-worker.d.ts → execution/types.js} +0 -0
- /package/dist/{worker.d.ts → iteration/worker.d.ts} +0 -0
- /package/dist/{pages.js → memory/pages.js} +0 -0
- /package/dist/{values.d.ts → remote/values.d.ts} +0 -0
- /package/dist/{values.js → remote/values.js} +0 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import binaryen from 'binaryen';
|
|
2
|
-
import { restoreImportOrder } from "
|
|
2
|
+
import { restoreImportOrder } from "../execution/import-order.js";
|
|
3
3
|
const PAGE_LIMIT = 65536;
|
|
4
4
|
function uleb(value) {
|
|
5
5
|
const out = [];
|
|
@@ -13,7 +13,7 @@ function uleb(value) {
|
|
|
13
13
|
return out;
|
|
14
14
|
}
|
|
15
15
|
/** Reads the one imported memory's limits from the import section. */
|
|
16
|
-
function importedMemory(bytes) {
|
|
16
|
+
export function importedMemory(bytes) {
|
|
17
17
|
let at = 8;
|
|
18
18
|
const uint = () => {
|
|
19
19
|
let value = 0, shift = 0, byte;
|
|
@@ -92,7 +92,7 @@ function importedMemory(bytes) {
|
|
|
92
92
|
return [];
|
|
93
93
|
}
|
|
94
94
|
/** Rewrites the memory import limits to shared with the largest maximum. */
|
|
95
|
-
function shareMemory(bytes, memory) {
|
|
95
|
+
export function shareMemory(bytes, memory) {
|
|
96
96
|
const { limits, header, body } = memory;
|
|
97
97
|
const content = [
|
|
98
98
|
...bytes.subarray(body[0], limits[0]),
|
|
@@ -110,6 +110,7 @@ function shareMemory(bytes, memory) {
|
|
|
110
110
|
]);
|
|
111
111
|
}
|
|
112
112
|
const refusal = (reason, detail) => ({ reason, detail });
|
|
113
|
+
const messageOf = (error) => (error instanceof Error ? error.message : String(error));
|
|
113
114
|
/**
|
|
114
115
|
* Builds the owner module of an iteration route: the memory import is shared, and the one loop
|
|
115
116
|
* of the owner function becomes `if (iterate(entry locals...)) { final values } else { the loop }`.
|
|
@@ -196,7 +197,7 @@ export function iterationOwner(original, route, stack) {
|
|
|
196
197
|
bytes = restoreImportOrder(m.emitBinary(), imports);
|
|
197
198
|
}
|
|
198
199
|
catch (error) {
|
|
199
|
-
return refusal('import-order', `import order cannot be kept: ${
|
|
200
|
+
return refusal('import-order', `import order cannot be kept: ${messageOf(error)}`);
|
|
200
201
|
}
|
|
201
202
|
new WebAssembly.Module(Uint8Array.from(bytes));
|
|
202
203
|
return {
|
|
@@ -215,7 +216,7 @@ export function iterationOwner(original, route, stack) {
|
|
|
215
216
|
};
|
|
216
217
|
}
|
|
217
218
|
catch (error) {
|
|
218
|
-
return refusal('no-arena', `iteration owner unavailable: ${
|
|
219
|
+
return refusal('no-arena', `iteration owner unavailable: ${messageOf(error)}`);
|
|
219
220
|
}
|
|
220
221
|
finally {
|
|
221
222
|
module?.dispose();
|
|
@@ -0,0 +1,216 @@
|
|
|
1
|
+
import { parentPort, workerData } from 'node:worker_threads';
|
|
2
|
+
import { markReadSummary, scanReads } from "../footprints/read-scan.js";
|
|
3
|
+
import { markReadWindow, readWindowsAt } from "../footprints/read-windows.js";
|
|
4
|
+
import { iterationArguments, iterationEntryBytes, iterationShadowCopies, iterationWindowCopy } from "../memory/iteration-layout.js";
|
|
5
|
+
const { module, memory, arena, globals, iterate, locals, frameSize, port, signal, control, ownership } = workerData;
|
|
6
|
+
const L = arena;
|
|
7
|
+
const ENTRY = iterationEntryBytes;
|
|
8
|
+
const plain = new WebAssembly.Instance(module, { env: { memory } }).exports;
|
|
9
|
+
// the other lowerings, instantiated when the pool sends them, by key
|
|
10
|
+
const variants = new Map();
|
|
11
|
+
let u8 = new Uint8Array(memory.buffer);
|
|
12
|
+
let u32 = new Uint32Array(memory.buffer);
|
|
13
|
+
const counter = new Int32Array(control);
|
|
14
|
+
const done = new Int32Array(signal);
|
|
15
|
+
const now = () => performance.now();
|
|
16
|
+
const stats = { run: 0, scan: 0, words: 0, set: 0, mark: 0 };
|
|
17
|
+
// status 0 ran, 1 trapped, 2 undo log exhausted, 3 stopped by the owner's stall word
|
|
18
|
+
function runOne(job, s) {
|
|
19
|
+
const index = job.first + s;
|
|
20
|
+
const top = L.slots + (s + 1) * L.slotBytes;
|
|
21
|
+
const frame = top - frameSize;
|
|
22
|
+
const win = job.window ? iterationWindowCopy(top, frameSize, job.window) : undefined;
|
|
23
|
+
const exportsOf = job.variant ? variants.get(job.variant) : plain;
|
|
24
|
+
// the tracked region is the frame, or the window copy and the frame below which it sits
|
|
25
|
+
const region = win ? win.region : frameSize;
|
|
26
|
+
const regionLow = win ? win.copy : frame;
|
|
27
|
+
if (frameSize)
|
|
28
|
+
u8.copyWithin(frame, job.frameBase, job.frameBase + frameSize);
|
|
29
|
+
if (win)
|
|
30
|
+
u8.copyWithin(win.copy, job.window.low, job.window.end);
|
|
31
|
+
// a certified window is private and untracked: the slot starts from the owner's bytes
|
|
32
|
+
const own = ownership ? iterationShadowCopies(top, frameSize, ownership.windows) : undefined;
|
|
33
|
+
if (own)
|
|
34
|
+
ownership.windows.forEach((w, i) => {
|
|
35
|
+
u8.copyWithin(own.copies[i].copy, w.low, w.end);
|
|
36
|
+
exportsOf[w.delta].value = own.copies[i].delta;
|
|
37
|
+
});
|
|
38
|
+
const shadow = L.frameShadow + s * L.frameSlotBytes;
|
|
39
|
+
if (region) {
|
|
40
|
+
u8.fill(0, shadow, shadow + L.frameSlotBytes);
|
|
41
|
+
exportsOf[globals.frameLow].value = regionLow;
|
|
42
|
+
exportsOf[globals.frameSize].value = region;
|
|
43
|
+
exportsOf[globals.frameShadow].value = shadow;
|
|
44
|
+
}
|
|
45
|
+
if (win) {
|
|
46
|
+
exportsOf[globals.windowLow].value = job.window.low;
|
|
47
|
+
exportsOf[globals.windowEnd].value = job.window.end;
|
|
48
|
+
exportsOf[globals.windowDelta].value = win.delta;
|
|
49
|
+
}
|
|
50
|
+
const rbase = L.rmaps + s * L.rsize;
|
|
51
|
+
const sbase = L.ssize ? L.smaps + s * L.ssize : 0;
|
|
52
|
+
const wbase = L.wmaps + s * L.wsize;
|
|
53
|
+
const lbase = job.logs.base + s * job.logs.bytes;
|
|
54
|
+
const limit = lbase + job.logs.capacity * ENTRY;
|
|
55
|
+
exportsOf[globals.readBitmap].value = rbase;
|
|
56
|
+
if (L.ssize)
|
|
57
|
+
exportsOf[globals.readSummary].value = sbase;
|
|
58
|
+
exportsOf[globals.writeBitmap].value = wbase;
|
|
59
|
+
exportsOf[globals.logPointer].value = lbase;
|
|
60
|
+
exportsOf[globals.logLimit].value = limit;
|
|
61
|
+
exportsOf[globals.stampAddress].value = L.stamp;
|
|
62
|
+
const stack = exportsOf[globals.stackPointer];
|
|
63
|
+
if (stack)
|
|
64
|
+
stack.value = own ? own.low : win ? win.copy : frameSize ? frame : top;
|
|
65
|
+
const slotted = exportsOf[globals.slotLow] !== undefined;
|
|
66
|
+
if (slotted) {
|
|
67
|
+
exportsOf[globals.exemptLow].value = top - L.slotBytes;
|
|
68
|
+
exportsOf[globals.exemptEnd].value = win ? win.copy : frame;
|
|
69
|
+
exportsOf[globals.slotLow].value = top - L.slotBytes;
|
|
70
|
+
exportsOf[globals.slotEnd].value = top;
|
|
71
|
+
exportsOf[globals.arenaLow].value = L.slots;
|
|
72
|
+
exportsOf[globals.arenaEnd].value = L.stamp;
|
|
73
|
+
exportsOf[globals.violation].value = 0;
|
|
74
|
+
}
|
|
75
|
+
const tm = now();
|
|
76
|
+
if (exportsOf[globals.readWindow0Low]) {
|
|
77
|
+
// the guard of a window with no bytes is false, so a stale window never carries over
|
|
78
|
+
const found = job.readWindows ? readWindowsAt(job.readWindows, index, job.memoryBytes) : [];
|
|
79
|
+
for (const [i, names] of [
|
|
80
|
+
[globals.readWindow0Low, globals.readWindow0Span],
|
|
81
|
+
[globals.readWindow1Low, globals.readWindow1Span]
|
|
82
|
+
].entries()) {
|
|
83
|
+
const w = found[i];
|
|
84
|
+
if (exportsOf[names[0]] === undefined)
|
|
85
|
+
continue;
|
|
86
|
+
exportsOf[names[0]].value = w ? w.low : 0;
|
|
87
|
+
exportsOf[names[1]].value = w ? w.bytes - 7 : 0;
|
|
88
|
+
if (w) {
|
|
89
|
+
markReadWindow(u8, rbase, w.low, w.bytes);
|
|
90
|
+
if (L.ssize)
|
|
91
|
+
markReadSummary(u8, sbase, L.ssize - 1, w.low, w.bytes);
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
const args = iterationArguments(locals, job.entry, index, frame);
|
|
96
|
+
const counted = exportsOf[globals.readHits] !== undefined;
|
|
97
|
+
if (counted) {
|
|
98
|
+
exportsOf[globals.readHits].value = 0;
|
|
99
|
+
exportsOf[globals.readMisses].value = 0;
|
|
100
|
+
exportsOf[globals.readExempt].value = 0;
|
|
101
|
+
}
|
|
102
|
+
const t1 = now();
|
|
103
|
+
stats.mark += t1 - tm;
|
|
104
|
+
let status = 0;
|
|
105
|
+
let touched = -1;
|
|
106
|
+
try {
|
|
107
|
+
exportsOf[iterate](...args);
|
|
108
|
+
}
|
|
109
|
+
catch (error) {
|
|
110
|
+
const reached = slotted ? exportsOf[globals.violation].value >>> 0 : 0;
|
|
111
|
+
if (reached) {
|
|
112
|
+
touched = Math.floor((Math.max(reached, L.slots) - L.slots) / L.slotBytes);
|
|
113
|
+
touched = Math.min(touched, L.batch);
|
|
114
|
+
}
|
|
115
|
+
const left = limit - (exportsOf[globals.logPointer].value >>> 0);
|
|
116
|
+
const unreachable = error instanceof WebAssembly.RuntimeError && /unreachable/.test(error.message);
|
|
117
|
+
status =
|
|
118
|
+
!reached && unreachable && Atomics.load(u32, (L.stamp + 4) / 4) !== 0
|
|
119
|
+
? 3
|
|
120
|
+
: !reached && unreachable && left < ENTRY
|
|
121
|
+
? 2
|
|
122
|
+
: 1;
|
|
123
|
+
}
|
|
124
|
+
const t2 = now();
|
|
125
|
+
stats.run += t2 - t1;
|
|
126
|
+
const runMs = t2 - t1;
|
|
127
|
+
const entries = ((exportsOf[globals.logPointer].value >>> 0) - lbase) / ENTRY;
|
|
128
|
+
const written = new Int32Array(entries);
|
|
129
|
+
for (let e = 0; e < entries; e++)
|
|
130
|
+
written[e] = u32[(lbase + e * ENTRY) / 4] >>> 5;
|
|
131
|
+
written.sort();
|
|
132
|
+
const rwords = new Uint32Array(memory.buffer, rbase, L.rsize / 4);
|
|
133
|
+
const summary = L.ssize ? new Uint8Array(memory.buffer, sbase, L.ssize) : undefined;
|
|
134
|
+
const reads = scanReads(rwords, summary, stats);
|
|
135
|
+
let frameWritten = new Uint32Array(0);
|
|
136
|
+
let frameExposed = new Uint32Array(0);
|
|
137
|
+
if (region) {
|
|
138
|
+
const granules = Math.ceil(region / 32);
|
|
139
|
+
const words = (at) => u32.slice(at / 4, at / 4 + granules);
|
|
140
|
+
const copy = (at) => {
|
|
141
|
+
const found = words(at);
|
|
142
|
+
return found.some(Boolean) ? found : new Uint32Array(0);
|
|
143
|
+
};
|
|
144
|
+
frameWritten = copy(shadow);
|
|
145
|
+
frameExposed = copy(shadow + 4 * granules + 4);
|
|
146
|
+
}
|
|
147
|
+
if (status)
|
|
148
|
+
u8.fill(0, wbase, wbase + L.wsize);
|
|
149
|
+
else
|
|
150
|
+
for (let e = 0; e < entries; e++)
|
|
151
|
+
u8[wbase + (written[e] >>> 3)] = 0;
|
|
152
|
+
stats.scan += now() - t2;
|
|
153
|
+
return {
|
|
154
|
+
index,
|
|
155
|
+
status,
|
|
156
|
+
entries,
|
|
157
|
+
runMs,
|
|
158
|
+
written,
|
|
159
|
+
reads,
|
|
160
|
+
frameWritten,
|
|
161
|
+
frameExposed,
|
|
162
|
+
touched,
|
|
163
|
+
counts: counted
|
|
164
|
+
? {
|
|
165
|
+
hits: exportsOf[globals.readHits].value >>> 0,
|
|
166
|
+
misses: exportsOf[globals.readMisses].value >>> 0,
|
|
167
|
+
exempt: exportsOf[globals.readExempt].value >>> 0
|
|
168
|
+
}
|
|
169
|
+
: undefined
|
|
170
|
+
};
|
|
171
|
+
}
|
|
172
|
+
port.on('message', (job) => {
|
|
173
|
+
if (job.install) {
|
|
174
|
+
variants.set(job.key, new WebAssembly.Instance(job.install, { env: { memory } }).exports);
|
|
175
|
+
return;
|
|
176
|
+
}
|
|
177
|
+
// the pool may have grown the memory for a larger log; the old views end at the old length
|
|
178
|
+
if (job.memoryBytes > u8.length) {
|
|
179
|
+
u8 = new Uint8Array(memory.buffer);
|
|
180
|
+
u32 = new Uint32Array(memory.buffer);
|
|
181
|
+
}
|
|
182
|
+
stats.run = 0;
|
|
183
|
+
stats.scan = 0;
|
|
184
|
+
stats.words = 0;
|
|
185
|
+
stats.set = 0;
|
|
186
|
+
stats.mark = 0;
|
|
187
|
+
let reply;
|
|
188
|
+
try {
|
|
189
|
+
const results = [];
|
|
190
|
+
for (;;) {
|
|
191
|
+
const k = Atomics.add(counter, 0, 1);
|
|
192
|
+
if (k >= job.count)
|
|
193
|
+
break;
|
|
194
|
+
const outcome = runOne(job, job.reverse ? job.count - 1 - k : k);
|
|
195
|
+
results.push(outcome);
|
|
196
|
+
// every later iteration is rolled back and replayed anyway, so leave them unstarted
|
|
197
|
+
if (outcome.status && !job.reverse)
|
|
198
|
+
Atomics.store(counter, 0, 1 << 30);
|
|
199
|
+
}
|
|
200
|
+
reply = {
|
|
201
|
+
done: results,
|
|
202
|
+
runMs: stats.run,
|
|
203
|
+
scanMs: stats.scan,
|
|
204
|
+
scanWords: stats.words,
|
|
205
|
+
scanSet: stats.set,
|
|
206
|
+
markMs: stats.mark
|
|
207
|
+
};
|
|
208
|
+
}
|
|
209
|
+
catch (error) {
|
|
210
|
+
reply = { error: String(error?.stack ?? error) };
|
|
211
|
+
}
|
|
212
|
+
port.postMessage(reply);
|
|
213
|
+
Atomics.add(done, 0, 1);
|
|
214
|
+
Atomics.notify(done, 0);
|
|
215
|
+
});
|
|
216
|
+
parentPort.postMessage({ ready: true });
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { ControlPlan } from '
|
|
2
|
-
import type {
|
|
3
|
-
import type {
|
|
1
|
+
import type { ControlPlan } from '../execution/extract.ts';
|
|
2
|
+
import type { ExecutionReport } from '../execution/types.ts';
|
|
3
|
+
import type { MemoryImport } from '../memory/imports.ts';
|
|
4
4
|
/** Precompiled modules for the managed backend. Nothing is compiled at request time. */
|
|
5
5
|
export interface ManagedArtifact {
|
|
6
6
|
/** The source program; serial and fallback execution use it unchanged. */
|
|
@@ -9,6 +9,8 @@ export interface ManagedArtifact {
|
|
|
9
9
|
coordinator?: WebAssembly.Module;
|
|
10
10
|
/** The tracked region module each lane runs. */
|
|
11
11
|
transactional?: WebAssembly.Module;
|
|
12
|
+
/** The same regions with inline tracking, from `inlineLane` at build time; used by a lane with `inline` set. */
|
|
13
|
+
inline?: WebAssembly.Module;
|
|
12
14
|
/** The control plan from `prepare`, minus the module bytes carried above. */
|
|
13
15
|
control?: Omit<ControlPlan, 'coordinator' | 'workerOriginal' | 'transactional'>;
|
|
14
16
|
/** Imported memory limits of the source module, from `memoryImports`. */
|
|
@@ -36,6 +38,36 @@ export interface ManagedReport extends Omit<ExecutionReport, 'memoryMode'> {
|
|
|
36
38
|
};
|
|
37
39
|
/** Batches that ran natively at the owner after a transport failure or malformed reply. */
|
|
38
40
|
transportFallbacks: number;
|
|
41
|
+
/** Ranges mode only: payload bytes sent in ranges frames. */
|
|
42
|
+
rangeBytes?: number;
|
|
43
|
+
/** Ranges mode only: ranges frames sent, summed over `batches` lane dispatches; `max` is the most one dispatch needed. */
|
|
44
|
+
rounds?: {
|
|
45
|
+
batches: number;
|
|
46
|
+
total: number;
|
|
47
|
+
max: number;
|
|
48
|
+
};
|
|
49
|
+
/** Ranges mode only: ranges frames whose results had escapes and were used only to learn. */
|
|
50
|
+
escapeRounds?: number;
|
|
51
|
+
/** Ranges mode only: dispatches that ended in a full snapshot or in native execution at the owner. */
|
|
52
|
+
rangeFallbacks?: {
|
|
53
|
+
snapshot: number;
|
|
54
|
+
serial: number;
|
|
55
|
+
};
|
|
56
|
+
/** Ranges mode only: calls whose footprint was already cached when their dispatch began. */
|
|
57
|
+
footprintHits?: number;
|
|
58
|
+
/** Run encoding only: response frames that came back in runs, and in addresses from a lane that predates runs. */
|
|
59
|
+
runReplies?: {
|
|
60
|
+
runs: number;
|
|
61
|
+
addresses: number;
|
|
62
|
+
};
|
|
63
|
+
/** Memo mode only: calls answered from a recorded result instead of a lane. */
|
|
64
|
+
memoHits?: number;
|
|
65
|
+
/** Memo mode only: lane time the hits avoided, estimated from the recorded execution time. */
|
|
66
|
+
memoSavedMs?: number;
|
|
67
|
+
/** Memo mode only: bytes hashed by lookups during the run. */
|
|
68
|
+
memoHashedBytes?: number;
|
|
69
|
+
/** Memo mode only: results recorded during the run. */
|
|
70
|
+
memoRecords?: number;
|
|
39
71
|
}
|
|
40
72
|
/**
|
|
41
73
|
* The lane runtime: runs tracked regions from a binary frame against a private copy of the
|
|
@@ -48,6 +80,19 @@ export declare class FolioLane {
|
|
|
48
80
|
maximum: number;
|
|
49
81
|
maximumMemoryBytes?: number;
|
|
50
82
|
maximumFrameBytes?: number;
|
|
83
|
+
/** Start and length of each active data segment of `module`; omitted means unknown. */
|
|
84
|
+
dataSegments?: readonly (readonly [start: number, length: number])[];
|
|
85
|
+
/**
|
|
86
|
+
* Runs the inline-tracked module instead of `module`: the marks and the undo log live in the
|
|
87
|
+
* lane's own memory above the program memory, a call's writes are read back from the log
|
|
88
|
+
* and rolled back, and its reads are reported at 64-byte granules. `logEntries` bounds the
|
|
89
|
+
* 32-byte write granules one call may log (default 8192, which is 262,144 bytes); a call
|
|
90
|
+
* that passes it is exhausted. Off unless set.
|
|
91
|
+
*/
|
|
92
|
+
inline?: {
|
|
93
|
+
module: WebAssembly.Module;
|
|
94
|
+
logEntries?: number;
|
|
95
|
+
};
|
|
51
96
|
});
|
|
52
97
|
/** Validates the frame, runs its calls in order and returns the encoded results. */
|
|
53
98
|
execute(frame: Uint8Array): Uint8Array;
|
|
@@ -77,6 +122,33 @@ export declare class ManagedFolio {
|
|
|
77
122
|
promising?: readonly string[];
|
|
78
123
|
/** `dense` (default) sends the whole snapshot; `auto` elides zero pages, which lanes from 1.0.0 reject. */
|
|
79
124
|
snapshotEncoding?: 'auto' | 'dense';
|
|
125
|
+
/**
|
|
126
|
+
* Ships learned byte ranges instead of a snapshot. Off unless set, and the lanes must come
|
|
127
|
+
* from a release that reads ranges frames. A batch whose lane reads unshipped bytes is
|
|
128
|
+
* retried with a wider footprint, at most `maxRounds` frames (default 3), then falls back
|
|
129
|
+
* to a full snapshot, or to native execution at the owner when none fits the limits.
|
|
130
|
+
*/
|
|
131
|
+
ranges?: {
|
|
132
|
+
maxRounds?: number;
|
|
133
|
+
cacheEntries?: number;
|
|
134
|
+
};
|
|
135
|
+
/**
|
|
136
|
+
* Asks lanes to answer in runs: sorted `[start, length]` read and write runs with the
|
|
137
|
+
* written bytes once, which the owner validates and commits as intervals instead of one
|
|
138
|
+
* address at a time. Off unless set. A lane that predates runs ignores the request and
|
|
139
|
+
* answers in addresses, which the owner still decodes and validates exactly; the report's
|
|
140
|
+
* `runReplies` counts both. A lane that answers in a version the owner does not know is
|
|
141
|
+
* refused.
|
|
142
|
+
*/
|
|
143
|
+
runs?: boolean;
|
|
144
|
+
/**
|
|
145
|
+
* Reuses recorded results of regions whose read bytes are unchanged; see `RegionMemo`.
|
|
146
|
+
* Off unless set. Hits go through the same ordered validation as lane results.
|
|
147
|
+
*/
|
|
148
|
+
memo?: {
|
|
149
|
+
bytes?: number;
|
|
150
|
+
entries?: number;
|
|
151
|
+
};
|
|
80
152
|
});
|
|
81
153
|
/** The canonical memory, which must fit the owner runtime. Throws when there is no unique one. */
|
|
82
154
|
get memory(): WebAssembly.Memory;
|