Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified generators/guests/bin/prism-generators
Binary file not shown.
4 changes: 2 additions & 2 deletions generators/guests/lock.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"comment": "Written by tools/generators/build.sh. GN-01 fails when generators/guests or its program no longer match.",
"sources": "35aa266943615126e42f16c5b5187f7e92d68dcdd1a0be5d143e59b92fcfb7fc",
"program": "dd425c57a0d5aa7b97471ff2bfb239962d7d018f8de3fda49015f39221350213"
"sources": "b0c2fac7e803f1f7da2f58f118bf5571b79ab6d9fa322ee3f215fdc1782f110b",
"program": "19b568c1186582ca06bf7e745684817b28255d31e603beee2f37ce133690d1ff"
}
36 changes: 32 additions & 4 deletions generators/guests/src/GenGuests.lex.tex
Original file line number Diff line number Diff line change
Expand Up @@ -296,28 +296,56 @@
name: ggCore2P3,
parameters: [],
result: Bytes,
body: 0x61636b6564202620307866666666666666666e2929293b0a7d0a0a2f2f204120667265736820696e7374616e63652070657220726571756573743a20746865206775657374277320616c6c6f6361746f72206e657665722066726565732c20616e64206e6f2073746174652063617272696573206f7665722e0a6578706f7274
body: 0x61636b6564202620307866666666666666666e2929293b0a7d0a0a2f2f204f6e6520696e7374616e63652c206b65707420616e6420707574206261636b20617320697420626567616e206265666f7265206561636820726571756573743a20697473206d656d6f72790a2f2f2061626f76652074686520737461636b20617320
}

definition{
name: ggCore2P4,
parameters: [],
result: Bytes,
body: 0x206173796e632066756e6374696f6e206f70656e47756573742862797465732c2073686132353629207b0a2020636f6e7374206d6f64756c65203d20617761697420636f6d70696c652862797465732c20736861323536293b0a202072657475726e206173796e6320286c696e6529203d3e2072756e28286177616974205765
body: 0x666972737420696e7374616e7469617465642c20616e6420776861742069742067726577206279207a65726f2e20416e20696e7374616e63650a2f2f2061207265717565737420747261707065642069732064726f707065642e20536f206e6f2073746174652063617272696573206f7665722c20616e642061736b696e6720
}

definition{
name: ggCore2P5,
parameters: [],
result: Bytes,
body: 0x62417373656d626c792e696e7374616e7469617465286d6f64756c652c207b7d29292e6578706f7274732c206c696e65293b0a7d0a
body: 0x6f6674656e0a2f2f20646f6573206e6f74206c6561766520616e20696e7374616e636520626568696e6420656163682074696d652e0a6578706f7274206173796e632066756e6374696f6e206f70656e47756573742862797465732c2073686132353629207b0a2020636f6e7374206d6f64756c65203d20617761697420636f
}

definition{
name: ggCore2P6,
parameters: [],
result: Bytes,
body: 0x6d70696c652862797465732c20736861323536293b0a20206c65742078203d206e756c6c2c206669727374203d206e756c6c2c2066726f6d203d20303b0a202072657475726e206173796e6320286c696e6529203d3e207b0a20202020696620287829207b20636f6e7374206d656d6f7279203d206e65772055696e74384172
}

definition{
name: ggCore2P7,
parameters: [],
result: Bytes,
body: 0x72617928782e6d656d6f72792e627566666572293b206d656d6f72792e7365742866697273742c2066726f6d293b206d656d6f72792e66696c6c28302c2066726f6d202b2066697273742e6c656e677468293b207d0a20202020656c7365207b2078203d2028617761697420576562417373656d626c792e696e7374616e7469
}

definition{
name: ggCore2P8,
parameters: [],
result: Bytes,
body: 0x617465286d6f64756c652c207b7d29292e6578706f7274733b2066726f6d203d204e756d62657228782e5f5f737461636b5f686967683f2e76616c7565203f3f2030293b206669727374203d206e65772055696e7438417272617928782e6d656d6f72792e627566666572292e736c6963652866726f6d293b207d0a20202020
}

definition{
name: ggCore2P9,
parameters: [],
result: Bytes,
body: 0x747279207b2072657475726e2072756e28782c206c696e65293b207d20636174636820286572726f7229207b2078203d206e756c6c3b207468726f77206572726f723b207d0a20207d3b0a7d0a
}

definition{
name: ggCore2,
parameters: [],
result: Bytes,
body: (ggApp (ggApp (ggCore2P0) (ggApp (ggCore2P1) (ggCore2P2))) (ggApp (ggCore2P3) (ggApp (ggCore2P4) (ggCore2P5))))
body: (ggApp (ggCore2P0) (ggApp (ggCore2P1) (ggApp (ggCore2P2) (ggApp (ggCore2P3) (ggApp (ggCore2P4) (ggApp (ggCore2P5) (ggApp (ggCore2P6) (ggApp (ggCore2P7) (ggApp (ggCore2P8) (ggCore2P9))))))))))
}

definition{
Expand Down
12 changes: 10 additions & 2 deletions site/annotation/guest.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,16 @@ function run(x, line) {
return decoder.decode(new Uint8Array(x.memory.buffer, Number(packed >> 32n), Number(packed & 0xffffffffn)));
}

// A fresh instance per request: the guest's allocator never frees, and no state carries over.
// One instance, kept and put back as it began before each request: its memory
// above the stack as first instantiated, and what it grew by zero. An instance
// a request trapped is dropped. So no state carries over, and asking often
// does not leave an instance behind each time.
export async function openGuest(bytes, sha256) {
const module = await compile(bytes, sha256);
return async (line) => run((await WebAssembly.instantiate(module, {})).exports, line);
let x = null, first = null, from = 0;
return async (line) => {
if (x) { const memory = new Uint8Array(x.memory.buffer); memory.set(first, from); memory.fill(0, from + first.length); }
else { x = (await WebAssembly.instantiate(module, {})).exports; from = Number(x.__stack_high?.value ?? 0); first = new Uint8Array(x.memory.buffer).slice(from); }
try { return run(x, line); } catch (error) { x = null; throw error; }
};
}
10 changes: 8 additions & 2 deletions site/card.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -333,8 +333,14 @@ export default async function start({ app, reason, $ }) {
return;
}

// The root guest: "<facet> <rest>" in, the facet's answer out.
const line = async (text) => decoder.decode(await app.dispatch(encoder.encode(text))).trim();
// The root guest: "<facet> <rest>" in, the facet's answer out. The guest takes
// no imports and each request runs alone, so the same line has the same
// answer: it is asked once and remembered. The runtime starts an instance for
// every request, and the browser can refuse one more before it has let the
// earlier ones go; a line refused so is asked again a moment later.
const ask = async (text, tries = 4) => { try { return decoder.decode(await app.dispatch(encoder.encode(text))).trim(); } catch (error) { if (tries < 2 || !/out of memory/i.test(String(error?.message ?? error))) throw error; await new Promise((again) => setTimeout(again, 250)); return ask(text, tries - 1); } };
const asked = new Map();
const line = (text) => asked.get(text) ?? (asked.size > 4096 && asked.clear(), asked.set(text, ask(text).catch((error) => { asked.delete(text); throw error; })).get(text));

// The vault: kept in this browser, every keep and read decided by the app.
let vault = null;
Expand Down
12 changes: 10 additions & 2 deletions site/dest/guest.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,16 @@ function run(x, line) {
return decoder.decode(new Uint8Array(x.memory.buffer, Number(packed >> 32n), Number(packed & 0xffffffffn)));
}

// A fresh instance per request: the guest's allocator never frees, and no state carries over.
// One instance, kept and put back as it began before each request: its memory
// above the stack as first instantiated, and what it grew by zero. An instance
// a request trapped is dropped. So no state carries over, and asking often
// does not leave an instance behind each time.
export async function openGuest(bytes, sha256) {
const module = await compile(bytes, sha256);
return async (line) => run((await WebAssembly.instantiate(module, {})).exports, line);
let x = null, first = null, from = 0;
return async (line) => {
if (x) { const memory = new Uint8Array(x.memory.buffer); memory.set(first, from); memory.fill(0, from + first.length); }
else { x = (await WebAssembly.instantiate(module, {})).exports; from = Number(x.__stack_high?.value ?? 0); first = new Uint8Array(x.memory.buffer).slice(from); }
try { return run(x, line); } catch (error) { x = null; throw error; }
};
}
12 changes: 10 additions & 2 deletions site/emma/guest.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,16 @@ function run(x, line) {
return decoder.decode(new Uint8Array(x.memory.buffer, Number(packed >> 32n), Number(packed & 0xffffffffn)));
}

// A fresh instance per request: the guest's allocator never frees, and no state carries over.
// One instance, kept and put back as it began before each request: its memory
// above the stack as first instantiated, and what it grew by zero. An instance
// a request trapped is dropped. So no state carries over, and asking often
// does not leave an instance behind each time.
export async function openGuest(bytes, sha256) {
const module = await compile(bytes, sha256);
return async (line) => run((await WebAssembly.instantiate(module, {})).exports, line);
let x = null, first = null, from = 0;
return async (line) => {
if (x) { const memory = new Uint8Array(x.memory.buffer); memory.set(first, from); memory.fill(0, from + first.length); }
else { x = (await WebAssembly.instantiate(module, {})).exports; from = Number(x.__stack_high?.value ?? 0); first = new Uint8Array(x.memory.buffer).slice(from); }
try { return run(x, line); } catch (error) { x = null; throw error; }
};
}
12 changes: 10 additions & 2 deletions site/google/guest.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,16 @@ function run(x, line) {
return decoder.decode(new Uint8Array(x.memory.buffer, Number(packed >> 32n), Number(packed & 0xffffffffn)));
}

// A fresh instance per request: the guest's allocator never frees, and no state carries over.
// One instance, kept and put back as it began before each request: its memory
// above the stack as first instantiated, and what it grew by zero. An instance
// a request trapped is dropped. So no state carries over, and asking often
// does not leave an instance behind each time.
export async function openGuest(bytes, sha256) {
const module = await compile(bytes, sha256);
return async (line) => run((await WebAssembly.instantiate(module, {})).exports, line);
let x = null, first = null, from = 0;
return async (line) => {
if (x) { const memory = new Uint8Array(x.memory.buffer); memory.set(first, from); memory.fill(0, from + first.length); }
else { x = (await WebAssembly.instantiate(module, {})).exports; from = Number(x.__stack_high?.value ?? 0); first = new Uint8Array(x.memory.buffer).slice(from); }
try { return run(x, line); } catch (error) { x = null; throw error; }
};
}
12 changes: 10 additions & 2 deletions site/holon/guest.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,16 @@ function run(x, line) {
return decoder.decode(new Uint8Array(x.memory.buffer, Number(packed >> 32n), Number(packed & 0xffffffffn)));
}

// A fresh instance per request: the guest's allocator never frees, and no state carries over.
// One instance, kept and put back as it began before each request: its memory
// above the stack as first instantiated, and what it grew by zero. An instance
// a request trapped is dropped. So no state carries over, and asking often
// does not leave an instance behind each time.
export async function openGuest(bytes, sha256) {
const module = await compile(bytes, sha256);
return async (line) => run((await WebAssembly.instantiate(module, {})).exports, line);
let x = null, first = null, from = 0;
return async (line) => {
if (x) { const memory = new Uint8Array(x.memory.buffer); memory.set(first, from); memory.fill(0, from + first.length); }
else { x = (await WebAssembly.instantiate(module, {})).exports; from = Number(x.__stack_high?.value ?? 0); first = new Uint8Array(x.memory.buffer).slice(from); }
try { return run(x, line); } catch (error) { x = null; throw error; }
};
}
12 changes: 10 additions & 2 deletions site/kappa/guest.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,16 @@ function run(x, line) {
return decoder.decode(new Uint8Array(x.memory.buffer, Number(packed >> 32n), Number(packed & 0xffffffffn)));
}

// A fresh instance per request: the guest's allocator never frees, and no state carries over.
// One instance, kept and put back as it began before each request: its memory
// above the stack as first instantiated, and what it grew by zero. An instance
// a request trapped is dropped. So no state carries over, and asking often
// does not leave an instance behind each time.
export async function openGuest(bytes, sha256) {
const module = await compile(bytes, sha256);
return async (line) => run((await WebAssembly.instantiate(module, {})).exports, line);
let x = null, first = null, from = 0;
return async (line) => {
if (x) { const memory = new Uint8Array(x.memory.buffer); memory.set(first, from); memory.fill(0, from + first.length); }
else { x = (await WebAssembly.instantiate(module, {})).exports; from = Number(x.__stack_high?.value ?? 0); first = new Uint8Array(x.memory.buffer).slice(from); }
try { return run(x, line); } catch (error) { x = null; throw error; }
};
}
12 changes: 10 additions & 2 deletions site/message/guest.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,18 @@ function run(x, line) {
return decoder.decode(new Uint8Array(x.memory.buffer, Number(packed >> 32n), Number(packed & 0xffffffffn)));
}

// A fresh instance per request: the guest's allocator never frees, and no state carries over.
// One instance, kept and put back as it began before each request: its memory
// above the stack as first instantiated, and what it grew by zero. An instance
// a request trapped is dropped. So no state carries over, and asking often
// does not leave an instance behind each time.
export async function openGuest(bytes, sha256) {
const module = await compile(bytes, sha256);
return async (line) => run((await WebAssembly.instantiate(module, {})).exports, line);
let x = null, first = null, from = 0;
return async (line) => {
if (x) { const memory = new Uint8Array(x.memory.buffer); memory.set(first, from); memory.fill(0, from + first.length); }
else { x = (await WebAssembly.instantiate(module, {})).exports; from = Number(x.__stack_high?.value ?? 0); first = new Uint8Array(x.memory.buffer).slice(from); }
try { return run(x, line); } catch (error) { x = null; throw error; }
};
}

// The same, answered synchronously once the one asynchronous step (check and
Expand Down
12 changes: 10 additions & 2 deletions site/prov/guest.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,16 @@ function run(x, line) {
return decoder.decode(new Uint8Array(x.memory.buffer, Number(packed >> 32n), Number(packed & 0xffffffffn)));
}

// A fresh instance per request: the guest's allocator never frees, and no state carries over.
// One instance, kept and put back as it began before each request: its memory
// above the stack as first instantiated, and what it grew by zero. An instance
// a request trapped is dropped. So no state carries over, and asking often
// does not leave an instance behind each time.
export async function openGuest(bytes, sha256) {
const module = await compile(bytes, sha256);
return async (line) => run((await WebAssembly.instantiate(module, {})).exports, line);
let x = null, first = null, from = 0;
return async (line) => {
if (x) { const memory = new Uint8Array(x.memory.buffer); memory.set(first, from); memory.fill(0, from + first.length); }
else { x = (await WebAssembly.instantiate(module, {})).exports; from = Number(x.__stack_high?.value ?? 0); first = new Uint8Array(x.memory.buffer).slice(from); }
try { return run(x, line); } catch (error) { x = null; throw error; }
};
}
12 changes: 10 additions & 2 deletions site/read/guest.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,18 @@ function run(x, line) {
return decoder.decode(new Uint8Array(x.memory.buffer, Number(packed >> 32n), Number(packed & 0xffffffffn)));
}

// A fresh instance per request: the guest's allocator never frees, and no state carries over.
// One instance, kept and put back as it began before each request: its memory
// above the stack as first instantiated, and what it grew by zero. An instance
// a request trapped is dropped. So no state carries over, and asking often
// does not leave an instance behind each time.
export async function openGuest(bytes, sha256) {
const module = await compile(bytes, sha256);
return async (line) => run((await WebAssembly.instantiate(module, {})).exports, line);
let x = null, first = null, from = 0;
return async (line) => {
if (x) { const memory = new Uint8Array(x.memory.buffer); memory.set(first, from); memory.fill(0, from + first.length); }
else { x = (await WebAssembly.instantiate(module, {})).exports; from = Number(x.__stack_high?.value ?? 0); first = new Uint8Array(x.memory.buffer).slice(from); }
try { return run(x, line); } catch (error) { x = null; throw error; }
};
}

// The same, answered synchronously once the one asynchronous step (check and
Expand Down
12 changes: 10 additions & 2 deletions site/resonance/guest.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,16 @@ function run(x, line) {
return decoder.decode(new Uint8Array(x.memory.buffer, Number(packed >> 32n), Number(packed & 0xffffffffn)));
}

// A fresh instance per request: the guest's allocator never frees, and no state carries over.
// One instance, kept and put back as it began before each request: its memory
// above the stack as first instantiated, and what it grew by zero. An instance
// a request trapped is dropped. So no state carries over, and asking often
// does not leave an instance behind each time.
export async function openGuest(bytes, sha256) {
const module = await compile(bytes, sha256);
return async (line) => run((await WebAssembly.instantiate(module, {})).exports, line);
let x = null, first = null, from = 0;
return async (line) => {
if (x) { const memory = new Uint8Array(x.memory.buffer); memory.set(first, from); memory.fill(0, from + first.length); }
else { x = (await WebAssembly.instantiate(module, {})).exports; from = Number(x.__stack_high?.value ?? 0); first = new Uint8Array(x.memory.buffer).slice(from); }
try { return run(x, line); } catch (error) { x = null; throw error; }
};
}
12 changes: 10 additions & 2 deletions site/scxml/guest.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,16 @@ function run(x, line) {
return decoder.decode(new Uint8Array(x.memory.buffer, Number(packed >> 32n), Number(packed & 0xffffffffn)));
}

// A fresh instance per request: the guest's allocator never frees, and no state carries over.
// One instance, kept and put back as it began before each request: its memory
// above the stack as first instantiated, and what it grew by zero. An instance
// a request trapped is dropped. So no state carries over, and asking often
// does not leave an instance behind each time.
export async function openGuest(bytes, sha256) {
const module = await compile(bytes, sha256);
return async (line) => run((await WebAssembly.instantiate(module, {})).exports, line);
let x = null, first = null, from = 0;
return async (line) => {
if (x) { const memory = new Uint8Array(x.memory.buffer); memory.set(first, from); memory.fill(0, from + first.length); }
else { x = (await WebAssembly.instantiate(module, {})).exports; from = Number(x.__stack_high?.value ?? 0); first = new Uint8Array(x.memory.buffer).slice(from); }
try { return run(x, line); } catch (error) { x = null; throw error; }
};
}
12 changes: 10 additions & 2 deletions site/senses/guest.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,16 @@ function run(x, line) {
return decoder.decode(new Uint8Array(x.memory.buffer, Number(packed >> 32n), Number(packed & 0xffffffffn)));
}

// A fresh instance per request: the guest's allocator never frees, and no state carries over.
// One instance, kept and put back as it began before each request: its memory
// above the stack as first instantiated, and what it grew by zero. An instance
// a request trapped is dropped. So no state carries over, and asking often
// does not leave an instance behind each time.
export async function openGuest(bytes, sha256) {
const module = await compile(bytes, sha256);
return async (line) => run((await WebAssembly.instantiate(module, {})).exports, line);
let x = null, first = null, from = 0;
return async (line) => {
if (x) { const memory = new Uint8Array(x.memory.buffer); memory.set(first, from); memory.fill(0, from + first.length); }
else { x = (await WebAssembly.instantiate(module, {})).exports; from = Number(x.__stack_high?.value ?? 0); first = new Uint8Array(x.memory.buffer).slice(from); }
try { return run(x, line); } catch (error) { x = null; throw error; }
};
}
Loading
Loading