Repository navigation
Real-usable wave 1: runtime correctness, node-like CLI, TypeScript, test262 gate, latest deps - #2
Merged
Merged
Conversation
…kd/d211ub0h) [l1-mn1fy0fr-20261018041900]
…after main Every emitted module imports env.__promise/__then/__now, but the shim only provided print/__convert/__method, so instantiation failed with a LinkError for every program. Port the host promise engine from run/promise.rs (promise blocks in guest memory, FIFO microtask queue, reactions, re-entry through __invoke1/__async_step, exception-global handling), back __now with Date.now(), drain after main unless __exc_pending is set, and render Promise and Date values like format_value.
…xqm) [l1-mn1fy0fr-20261018041900]
Frontmatter parsing, eligibility filtering, program assembly with the assert adapter rewrite, outcome classification, baseline diffing, test discovery and report aggregation, each with unit tests.
- jsc FILE / -e SRC run and print only console output - -p/--print SRC prints the completion value (node -p) - jsc build FILE -o OUT writes the module (-o - for stdout) - compile errors exit 2, uncaught/runtime failures exit 1 - remove --emit; convert integration suites to the new interface
…tests (bkd/lu7vym8f) [l1-mn1fy0fr-20261018041900]
Member reads, writes, compound assignments and user method calls on a null/undefined receiver now throw a branded TypeError with V8's message text via an out-of-line __nullish_throw helper; the hot path is a single NaN-box tag compare, skipped for statically non-nullish receivers. An indirect call in a function-less program throws the not-a-function TypeError instead of emitting an invalid call_indirect.
0/0 produces the sign-bit-set NaN 0xFFF8.. on x86, which emit_is_number treated as a boxed non-number, so a computed NaN compared by identity: `a === a` was true and `a !== a` false. The negation itself was already exact. Classify a jsval as a number iff its bits, as a signed i64, are at or below the largest tag-0 NaN; every boxed immediate and heap pointer lies strictly above that bound. Add tests/equality.rs with the computed-NaN regressions and a negation matrix for !== / != over mixed operand types.
…) [l1-mn1fy0fr-20261018041900]
…t19) [l1-mn1fy0fr-20261018041900]
__alloc now grows linear memory when the bump would pass memory.size, by max(needed, current) pages with an exact-size fallback; the fast path is one i64 compare. Memory is capped at 512 MiB (module maximum). A failed guest or host grow stores a sticky -1 sentinel in __heap_ptr and traps; host imports trap on it too, and the runner reports it as 'Uncaught RangeError: out of memory' without a wasm backtrace. Host allocators share the guest growth policy via heap_reserve.
…yhy7a) [l1-mn1fy0fr-20261018041900]
Run each assembled test under jsc in a std-only worker pool with a per-test timeout, stderr captured to a file. The CLI prints the per-directory report, writes per-test results, and supports --check / --update-baseline / --history against the committed baseline and history files.
…hecked - Drop the compile-time rejection of every generic method call in programs without functions and of null-literal receivers; such calls now reach the runtime nullish / not-a-function guards (no funcref table => the branded not-a-function TypeError instead of an invalid call_indirect). - Support member update expressions (o.p++, --o[k], ...) as an IndexOpSet with an OpSetKind: the current value is converted with ToNumber, postfix yields the old numeric value, and a nullish base throws the read TypeError. - Guard .length and builtin method receivers (array/string methods, array HOFs, push/pop, Map/Set and Date methods, getTime) with a NullishCheck node so a null/undefined receiver throws "Cannot read properties of ...".
…kgf92) [l1-mn1fy0fr-20261018041900]
… [l1-mn1fy0fr-20261018041900]
…rror, NaN equality) [l1-mn1fy0fr-20261018041900]
…1fy0fr-20261018041900]
…mn1fy0fr-20261018041900]
Drop the compile-time arity check on direct calls to declared functions. The uniform ABI already pads missing arguments with undefined (so defaults apply) and the arity scan widens K to cover every call site, so surplus arguments are evaluated for side effects and ignored or gathered by a rest parameter. Remove the now-unused FnSig arity fields and the test asserting the rejection.
…ejj0) [l1-mn1fy0fr-20261018041900]
parse() now takes a Dialect. Dialect::Ts parses with swc's TypeScript syntax and runs resolver + strip so codegen only sees plain ES. The CLI picks Ts for .ts/.mts/.cts files, rejects .tsx, and keeps -e/-p and all other files as JavaScript.
….0.104, wasm-bindgen 0.2.129 Also refresh Cargo.lock with cargo update so every transitive dependency is at its latest semver-compatible version.
…hnj) [l1-mn1fy0fr-20261018041900]
…dgen + cargo update (bkd/dryfefmz) [l1-mn1fy0fr-20261018041900]
…(bkd/77qhc74u) [l1-mn1fy0fr-20261018041900]
…(bkd/3vjuq108) [l1-mn1fy0fr-20261018041900]
…ript strip [l1-mn1fy0fr-20261018041900]
…8pv79) [l1-mn1fy0fr-20261018041900]
…-mn1fy0fr-20261018041900]
…l1-mn1fy0fr-20261018041900]
…cies and CI actions to latest [l1-mn1fy0fr-20261018041900]
…tores
Fixed-shape objects silently dropped writes to keys they do not own, and
the array arm of computed stores had no bounds or key check, so an
out-of-range or non-index key wrote past (or onto) the element area.
__obj_set now returns a hit flag; a miss calls the new out-of-line
__prop_throw helper which raises a branded TypeError
("Cannot add property 'k': dynamic properties are not supported yet")
and unwinds through the existing propagate path. Array stores accept
only integer indices in [0, length); an index at/past the length raises
"Cannot grow array by index assignment yet", any other key (or any
other heap receiver) raises the add-property error. Nothing is written
on a miss.
Absent-property writes and array index growth now throw, so tests that passed only because such writes were silently dropped regress (41), and three function tests expecting a TypeError on .caller/.arguments writes now pass. README/DESIGN restate the fixed-shape limitation as current behaviour and carry the new 5195/22992 result.
…s and array OOB writes (bkd/zuppd6lq) [l1-mn1fy0fr-20261018041900]
…nd array growth by index [l1-mn1fy0fr-20261018041900]
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Moves jsc from a teaching compiler toward a real-usable JavaScript/TypeScript to WebAssembly compiler, with test262 as the conformance metric.
Runtime correctness
Uncaught RangeError: out of memoryinstead of a wasm trap backtrace.null/undefinedthrow a catchableTypeError.includes/Map/Setuse SameValueZero correctly.undefined.for (let/const ...)loops create a fresh binding per iteration for captured variables.TypeErrorinstead of silently doing nothing (dynamic properties come with the object-model rework).Frontend
.ts,.mts,.ctsfiles compile via the swc TypeScript strip pass;.tsxis rejected;-e/-pstay JavaScript.CLI and browser package
jsc FILEandjsc -e SRCprint console output only,jsc -p SRCprints the completion value,jsc build FILE -o OUTemits wasm. Exit codes: 2 compile error, 1 uncaught exception, 0 success.--emitis removed.__promise,__then,__nowwere missing, so every module failed to instantiate).scripts/ensure-wasm.shrebuilds a stale artifact.Conformance
crates/jsc-test262runner: pinned test262 checkout, jsc-compatible harness shims, feature/flag filtering (strict mode only), per-directory report,baseline.txtregression gate,history.tsv, and atest262CI job.Dependencies and toolchain
cargo deny checkpasses.Docs
Known limitations (next)
pushcopies the array (quadratic cost);pushon captured arrays is rejected.1 + null,"abc".foo, uservalueOf/toStringin ToPrimitive, and TSenum/namespaceare not handled yet.Verification
On the final tree:
cargo fmt --all --check,cargo clippy --all-targets --workspace,cargo nextest run --workspace(817 passed),cargo test --doc --workspace,typos,cargo shear,cargo deny checkbun run lint,@cdlab/jscand@cdlab/jsc-webtypecheck and build,@cdlab/jsctests (18 passed) against a freshly built wasm packagecargo run --release -p jsc-test262 -- --check: 5195 / 22992 eligible, 0 regressions