Repository navigation
JIT: load the GC runtime before the default library - #632
Merged
Merged
Conversation
On Linux the default library leaves GC_* undefined and takes them from the process (TypeScriptRuntime links Boehm in), so it has to be loaded after the runtime or dlopen fails on GC_malloc. prepareJitProcess added the default library first; a runtime passed with --shared-libs was ahead of it anyway, which hid the bug from every test. The JIT collector test gains a Linux run that leaves the runtime for tslang to find (--tslang-lib-path). 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.
On Linux,
--emit=jitwith the default library failed onGC_mallocunlesslibTypeScriptRuntime.sowas passed with--shared-libs.The default library
.soleavesGC_*undefined and takes them from the process.libTypeScriptRuntime.solinks Boehm in statically and provides them. That is by design, and nolibgc.sois needed: a second copy of the collector would bring back the two-collector bug. ButprepareJitProcessadded the default library to the load list before the runtime, so it was loaded first and dlopen could not resolveGC_malloc. A runtime passed with--shared-libssits at the front of the list, which is why the tests never hit this.jit.cpp: the default library goes into the list after the runtime. The duplicate-runtime check and the runtime search order are unchanged. Windows is unaffected: the default library importsgc.dlldirectly.defaultlib-collector.cmake: the JIT mode gains a Linux-only run without--shared-libs, so tslang finds the runtime itself through--tslang-lib-path. The Linux release job runs this test withTSLANG_REQUIRE_DEFAULT_LIB=1.Tested: Windows Release, all 2133
test-jit*tests pass, includingtest-jit-gc-defaultlib-collectorwith the real default library. The Linux run is checked by the Linux release workflow; it was not run locally.🤖 Generated with Claude Code