Repository navigation
wasm32 and wasm64: default library borrow facts, -mm=gc refused, a JS host and test runs - #811
Merged
Merged
Conversation
…, a JS host and test runs - ObjDumper: a wasm data symbol is an offset into its data segment, but it was read at that offset into the whole DATA section (segment headers first), so an own program linked with a wasm default library got none of its borrow facts and failed to compile. - -mm=gc (the default) for a wasm executable or library is an error that says so: the collector has no wasm build. It used to fail on a default library folder that is never built. - docs/how/wasm/test: host.mjs implements what a wasm program imports from `env` (the C library, the default library's wrappers: printf, strtod, malloc, regex, time, stdio, process/fs under Node), for Node (run.mjs) and the browser (index.html). run_tests.mjs compiles and runs the tester's single-file tests (--no-default-lib, as test-runner) and the default library's tests (linked with the wasm default library) for wasm32 and wasm64 under none, rc and own. Skipped, each with its reason: try/catch (does not catch on wasm yet), async, threads, and wasm_skips.txt, which lists the wasm compiler gaps still open. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…slots call it through an adapter A method overriding one with other parameters (get(scale?) for an abstract get(), foo() for foo(x, y, ...z)) was stored in the base method's slot as it was. Native code tolerates the mismatch, but wasm's call_indirect checks the signature and traps. Now, as in C++, the override gets a slot of its own type, and each inherited slot holds a thunk of that slot's type: it passes undefined for a missing optional parameter, an empty array for a missing rest parameter, and drops extra arguments. 00function_overloads and callWithSpread now run on wasm32 and wasm64. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
ASDAlexander77
added a commit
that referenced
this pull request
Nov 12, 2026
…'s tests PR #829's run booted the emulator and passed everything but two tester tests, 00class_override_arity and 00optional_union_truthiness, under every model: both came after v0.0-pre-alpha124 with the compiler fixes they check (#811, #815). When the job takes a published release's package, it now takes that release's tslang/test/tester/tests and CMakeLists.txt too; the runner and its skips stay the commit's own. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
ASDAlexander77
added a commit
that referenced
this pull request
Nov 12, 2026
…829) * Android emulator tests: make the AVD where the emulator looks for it Release run 43251862764's emulator exited at once: "Unknown AVD name [tslang_api29_x86_64] ... no file tslang_api29_x86_64.ini in $HOME/.android/avd". The runner's avdmanager had made it elsewhere. The run job sets ANDROID_USER_HOME and ANDROID_AVD_HOME for both, and the install step checks that `emulator -list-avds` names the AVD. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Android emulator tests: a published package runs with its own release's tests PR #829's run booted the emulator and passed everything but two tester tests, 00class_override_arity and 00optional_union_truthiness, under every model: both came after v0.0-pre-alpha124 with the compiler fixes they check (#811, #815). When the job takes a published release's package, it now takes that release's tslang/test/tester/tests and CMakeLists.txt too; the runner and its skips stay the commit's own. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
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.
wasm32 and wasm64 programs, linked with the default library and tested under Node. Goes with ASDAlexander77/TypeScriptCompilerDefaultLib#92, which builds the wasm default library.
Compiler
ObjDumper.cpp): a wasm data symbol is an offset into its data segment, but it was read at that offset into the whole DATA section, whose contents start with the segment headers. An-mm=ownprogram linked with the wasm default library therefore got none of the library's borrow facts and failed to compile.MLIRGenStore.h,MLIRGenClasses.cpp): an override such asget(scale?)of an abstractget(), orfoo()offoo(x, y, ...z), was stored in the base method's vtable slot unchanged. Native code tolerates that; wasm'scall_indirectchecks the signature and traps. Now, as in C++, the override gets a slot of its own type. Each inherited slot holds a thunk of the slot's type, which passesundefinedfor a missing optional parameter and an empty array for a missing rest parameter, and drops extra arguments. New test:00class_override_arity.-mm=gcrefused for wasm: gc is tslang's default, so a wasm executable or library now has to name another memory model. The error says so: the collector has no wasm build. Before, the link failed on a default-library folder that is never built.Host and test runs (
docs/how/wasm/test)host.mjs: the imports a wasm program takes fromenv, which on other targets come from the C library and the default library's wrappers:size_tas BigInt on wasm64run.mjsruns one program under Node;index.htmlruns a folder of programs in a browser with the same host.run_tests.mjsruns two suites for wasm32 and wasm64 under none, rc and own, in release (--opt) or debug (--debug):tester: the tester's single-file ctest tests, built--no-default-libas test-runner builds them. A test passes ondone.and exit code 0.defaultlib: the default library's tests, linked with the wasm default library. A test passes onALL DONE, an empty stderr and exit code 0.Results (Node 26, release and debug)
Skipped, and still open
Each skip is listed with its reason:
wasm_skips.txtlists the open wasm compiler gaps:00object_func2: a method stored in an object's field is called as a function withthisplus the object, but it takes onlythis.call_indirectchecks the signature, so the call traps.addr + 0x80000000is folded into ani32.const, and wasm-ld fails with "LEB is outside Varint32 range".next.path.ts: aReadonly<Path>field read throughMaybe<...>comes back wrong, and the loop never ends.Also seen:
00owned_iterationfailed once in a full wasm64 debug run. It then passed three times on its own.🤖 Generated with Claude Code