Skip to content
Merged
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
13 changes: 13 additions & 0 deletions docs/architecture.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,17 @@ only to CM-3. A schedule-dependent assertion cannot invoke the exception:
if two conforming schedulers can answer differently, the assertion pins a
policy rather than semantics. Wasmtime behavior alone is insufficient.

**Pending upstream stream/future assumption.** Until
[component-model PR #719](https://github.com/WebAssembly/component-model/pull/719)
is adjudicated, this checkout adopts only its drop-delivery rule at head
`35e9769957627c2bee5cd445b998b08b3c652c86`; the submodule remains pinned at
`7c676115e93cd7d54c1732d95c54c6a3de7c5ae0`. A stream event tests for peer
drop when the event is consumed, upgrades the result to `DROPPED`, preserves
the accumulated element count, and retires the end. A future `COMPLETED` stays
`COMPLETED` because its payload transferred; a pending future `CANCELLED`
upgrades to `DROPPED` with zero progress if the peer is gone. Already-delivered
events are not rewritten. The PR's broader paired-end refactor is not adopted.

## 2. Non-goals

- **WASI in the runtime core.** Providers live in the separate
Expand Down Expand Up @@ -321,6 +332,8 @@ Named differences from the reference or other hosts:
This is the sole §1 corpus/reference exception,
[CM-3](../upstream-component-model-repo-findings.md#cm-3-cancel_copy-returns-a-stale-completed-where-wasmtime-reports-cancelled).
See `takeCancelEvent` in `runtime/src/intrinsics/stream_builtins.ts`.
This cancellation-time `COMPLETED`→`CANCELLED` remap is distinct from the
PR #719 consumption-time peer-drop upgrade above; peer drop takes precedence.

## 7. Canonical ABI decisions

Expand Down
5 changes: 5 additions & 0 deletions docs/references.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,11 @@ reference, and WAST corpus used by this checkout. Its principal sources are:

Current upstream sources are at
[WebAssembly/component-model](https://github.com/WebAssembly/component-model).
The narrow provisional semantics adopted from
[PR #719](https://github.com/WebAssembly/component-model/pull/719) are fixed to
head `35e9769957627c2bee5cd445b998b08b3c652c86` and recorded in
[architecture §1](architecture.md#1-goals); they do not move the submodule pin
or adopt that PR's structural refactor.
The [Component Model book](https://component-model.bytecodealliance.org/)
is introductory documentation, not the semantic tie-breaker.
Local discrepancies belong in
Expand Down
4 changes: 2 additions & 2 deletions harness/browser/expectations/chromium.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ export const chromium: LaneExpectation = {
totals: {
commands: 1511,
executed: 1411,
passed: 1285,
passed: 1286,
failed: 0,
xfail: 126,
xfail: 125,
pendingRuntime: 95,
pendingCapability: 0,
unsupportedDirective: 5,
Expand Down
4 changes: 2 additions & 2 deletions harness/browser/expectations/firefox.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ export const firefox: LaneExpectation = {
totals: {
commands: 1511,
executed: 1411,
passed: 1285,
passed: 1286,
failed: 0,
xfail: 126,
xfail: 125,
pendingRuntime: 95,
pendingCapability: 0,
unsupportedDirective: 5,
Expand Down
4 changes: 2 additions & 2 deletions harness/shell/expectations/bun-pinned.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,9 @@ export const bunPinned: ShellLaneExpectation = {
totals: {
commands: 1511,
executed: 1411,
passed: 1285,
passed: 1286,
failed: 0,
xfail: 126,
xfail: 125,
pendingRuntime: 95,
pendingCapability: 0,
unsupportedDirective: 5,
Expand Down
4 changes: 2 additions & 2 deletions harness/shell/expectations/jsc-pinned.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ export const jscPinned: ShellLaneExpectation = {
totals: {
commands: 1511,
executed: 1411,
passed: 1285,
passed: 1286,
failed: 0,
xfail: 126,
xfail: 125,
pendingRuntime: 95,
pendingCapability: 0,
unsupportedDirective: 5,
Expand Down
4 changes: 2 additions & 2 deletions harness/shell/expectations/jsc-trunk.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,9 @@ export const jscTrunk: ShellLaneExpectation = {
totals: {
commands: 1511,
executed: 1411,
passed: 1285,
passed: 1286,
failed: 0,
xfail: 126,
xfail: 125,
pendingRuntime: 95,
pendingCapability: 0,
unsupportedDirective: 5,
Expand Down
4 changes: 2 additions & 2 deletions harness/shell/expectations/node-pinned.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@ export const nodePinned: ShellLaneExpectation = {
totals: {
commands: 1511,
executed: 1411,
passed: 1285,
passed: 1286,
failed: 0,
xfail: 126,
xfail: 125,
pendingRuntime: 95,
pendingCapability: 0,
unsupportedDirective: 5,
Expand Down
4 changes: 2 additions & 2 deletions harness/shell/expectations/sm-nightly.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,9 @@ export const smNightly: ShellLaneExpectation = {
totals: {
commands: 1511,
executed: 1411,
passed: 1285,
passed: 1286,
failed: 0,
xfail: 126,
xfail: 125,
pendingRuntime: 95,
pendingCapability: 0,
unsupportedDirective: 5,
Expand Down
4 changes: 2 additions & 2 deletions harness/shell/expectations/sm-pinned.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@ export const smPinned: ShellLaneExpectation = {
totals: {
commands: 1511,
executed: 1411,
passed: 1285,
passed: 1286,
failed: 0,
xfail: 126,
xfail: 125,
pendingRuntime: 95,
pendingCapability: 0,
unsupportedDirective: 5,
Expand Down
102 changes: 0 additions & 102 deletions harness/src/wasmtime-expectations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,15 +78,6 @@ export const WASMTIME_EXPECTATION_GROUPS: readonly WasmtimeExpectationGroup[] =
status: "failed",
}],
},
{
file: "async/context-in-compositions.json",
rows: [{
lines: [435, 436, 437],
cause:
"Error: expected return, got trap: cannot enter component instance 2 — instance poisoned by: Trap: guest trapped: unreachable",
status: "failed",
}],
},
{
file: "async/context-in-resource-drop.json",
rows: [{
Expand All @@ -103,15 +94,6 @@ export const WASMTIME_EXPECTATION_GROUPS: readonly WasmtimeExpectationGroup[] =
status: "failed",
}],
},
{
file: "async/stream-big-read-and-writes.json",
rows: [{
lines: [43],
cause:
'Error: expected trap "stream read/write count too large", got "cannot enter component instance 0 — instance poisoned by: RangeError: Invalid array length"',
status: "failed",
}],
},
{
file: "async/task-deletion.json",
rows: [{
Expand Down Expand Up @@ -437,90 +419,6 @@ export const WASMTIME_EXPECTATION_GROUPS: readonly WasmtimeExpectationGroup[] =
{
class: "runtime-semantics",
files: [
{
file: "async/context-in-compositions.json",
rows: [{
lines: [155, 434],
cause:
"Error: expected return, got trap: guest trapped: unreachable",
status: "failed",
}],
},
{
file: "async/error-context.json",
rows: [{
lines: [86],
cause: "AssertionError: store out of bounds",
status: "failed",
}],
},
{
file: "async/futures.json",
rows: [{
lines: [54, 64],
cause:
"AssertionError: suspension mode jspi wrapped imports without wrapping any entry (entries=false, imports=true) — a Suspending import reached from a non-promising activation traps unconditionally (jspi pin (c))",
status: "failed",
}],
},
{
file: "async/stackful.json",
rows: [{
lines: [110, 132],
cause:
"AssertionError: suspension mode jspi wrapped imports without wrapping any entry (entries=false, imports=true) — a Suspending import reached from a non-promising activation traps unconditionally (jspi pin (c))",
status: "failed",
}],
},
{
file: "async/stream-big-read-and-writes.json",
rows: [{
lines: [42],
cause: "RangeError: Invalid array length",
status: "failed",
}],
},
{
file: "async/streams.json",
rows: [{
lines: [73, 83],
cause:
"AssertionError: suspension mode jspi wrapped imports without wrapping any entry (entries=false, imports=true) — a Suspending import reached from a non-promising activation traps unconditionally (jspi pin (c))",
status: "failed",
}],
},
{
file: "async/sync-call-context-slots.json",
rows: [{
lines: [76, 152],
cause:
"Error: expected return, got trap: guest trapped: unreachable",
status: "failed",
}],
},
{
file: "async/sync-call-context.json",
rows: [{
lines: [61, 126, 207, 298, 389, 447, 544],
cause:
"Error: expected return, got trap: guest trapped: unreachable",
status: "failed",
}],
},
{
file: "async/task-builtins.json",
rows: [{
lines: [34, 56, 74],
cause:
"AssertionError: suspension mode jspi wrapped imports without wrapping any entry (entries=false, imports=true) — a Suspending import reached from a non-promising activation traps unconditionally (jspi pin (c))",
status: "failed",
}, {
lines: [201, 466, 723],
cause:
"Error: expected return, got trap: guest trapped: unreachable",
status: "failed",
}],
},
{
file: "import.json",
rows: [{
Expand Down
26 changes: 0 additions & 26 deletions harness/src/xfail.ts
Original file line number Diff line number Diff line change
Expand Up @@ -661,32 +661,6 @@ export const XFAIL: XfailEntry[] = [
line: 369,
reason: "same cascade as line 355, see that entry",
},
// --- async/sync-streams.json: test/async/sync-streams.wast expects three
// values polyengine does not produce (STARTING vs STARTED at the
// sync-lowered `set` call, and a COMPLETED<->DROPPED completion-code swap
// on the paired stream.read/write) under CM#705's blocking semantics, so
// the file's single all-in-one assert_return hits a guest `unreachable`.
// Classed `cm705-sync-sched`
// (https://github.com/polymorph-components/polyengine/issues/249).
//
// For the rest of the file polyengine implements wasmtime's model (#43):
// the async-lowered call's initial status is decided only after the callee
// instance's runnable work has been drained to quiescence — by which time
// the producer has exited and the next task reports STARTED. Adjudicated
// 2026-08-10 (issue #43): the test's hard STARTED assertion is
// schedule-dependent — an upstream test defect overfitting wasmtime's
// deferred-entry policy (pristine definitions.py answers STARTING) — and
// polyengine's drain policy satisfies it as written under any seed. ---
{
file: "async/sync-streams.json",
line: 208,
reason:
"expected return, got trap: guest trapped: unreachable — this file's " +
"expected STARTING/STARTED and COMPLETED/DROPPED codes track CM#705's " +
"blocking semantics, which polyengine's sync scheduling does not yet " +
"produce, so the guest's own assertion traps; cm705-sync-sched, " +
"https://github.com/polymorph-components/polyengine/issues/249",
},
// --- async/trap-if-block-and-sync.json: (history: at the prior pin the
// whole file was blocked by the now-exited wasmparser/wast pin-drift
// class — see the EXIT note at the top of this file, $Tester's canonical
Expand Down
9 changes: 8 additions & 1 deletion runtime/src/exec/boundary.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@
Thread,
WaitableSet,
withActivation,
withSynchronousActivation,
} from "../task/mod.ts";
import { currentTask } from "../task/scheduler.ts";
import type {
Expand Down Expand Up @@ -218,8 +219,14 @@
stringEncoding: opts.stringEncoding,
memory: opts.memory,
realloc: opts.realloc === null ? null : (o, os, a, n) => {
const realloc = require(opts.realloc, "realloc")!;

Check warning on line 222 in runtime/src/exec/boundary.ts

View workflow job for this annotation

GitHub Actions / core (ubuntu-24.04)

unable to analyze dynamic import

Check warning on line 222 in runtime/src/exec/boundary.ts

View workflow job for this annotation

GitHub Actions / core (ubuntu-24.04-arm)

unable to analyze dynamic import
const p = callCore(realloc, [o, os, a, n]);
// definitions.py LiftLowerContext.reallocate creates and invokes a fresh
// sync canon_lift (lines 642-658), hence fresh task/thread context. Keep
// post-return on its originating task; only realloc takes this boundary.
const p = withSynchronousActivation(
opts.instance,
() => callCore(realloc, [o, os, a, n]),
);
trapIf(p.length !== 1 || typeof p[0] !== "number", "realloc result");
return (p[0] as number) >>> 0;
},
Expand Down Expand Up @@ -1657,7 +1664,7 @@
task.return_(results);
// Post-return runs after the results were read out of guest memory,
// with may_leave cleared (reference canon_lift).
const postReturn = require(opts.postReturn, `${name} post-return`);

Check warning on line 1667 in runtime/src/exec/boundary.ts

View workflow job for this annotation

GitHub Actions / core (ubuntu-24.04)

unable to analyze dynamic import

Check warning on line 1667 in runtime/src/exec/boundary.ts

View workflow job for this annotation

GitHub Actions / core (ubuntu-24.04-arm)

unable to analyze dynamic import
if (postReturn !== null) {
assert_(inst.mayLeave, "post-return with may_leave already false");
inst.mayLeave = false;
Expand Down Expand Up @@ -1686,7 +1693,7 @@
// Callback ABI waits between invocations without JSPI, but callbacks in
// JSPI mode need the same promising wrapper as the initial core entry.
const callback = enterWasm(
require(opts.callback, `${name} callback`)!,

Check warning on line 1696 in runtime/src/exec/boundary.ts

View workflow job for this annotation

GitHub Actions / core (ubuntu-24.04)

unable to analyze dynamic import

Check warning on line 1696 in runtime/src/exec/boundary.ts

View workflow job for this annotation

GitHub Actions / core (ubuntu-24.04-arm)

unable to analyze dynamic import
input.mode,
);
const [packed] = normalizeCoreValues(
Expand Down
Loading
Loading