Repository navigation
-mm=own under the JIT: read the default library's facts from the DLL it loads - #695
Merged
Merged
Conversation
…it loads
readOwnFacts read the default library's own facts (`__tsownfacts_`) only for an exe, from its static
library. Under the JIT it read none, so every call into the library could destroy anything: a field
lent to `String.indexOf`, a module-level `Date` given to `getTime`, and Map/Set's internals were
errors there, though the same programs compiled to an exe. Now the JIT reads them from the DLL it
loads, from its file, as readBorrowFacts already does for its borrow facts (the text is the same as
the static library's of the same build).
The files the own facts were read from are a JIT cache entry's dependencies too
(importedOwnFactsFiles, beside importedBorrowFactsFiles); --own-facts objects were not either.
Test: test-{jit,compile}-own-defaultlib-facts (own-defaultlib-facts.cmake, with the real default
library; skipped when none is built). DefaultLib suite under the JIT, own: the same 97 tests pass as
for an exe.
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.
Under
-mm=own, the JIT never read the default library's ownership facts.readOwnFacts(tslang/tslang/borrowfacts.cpp) read the__tsownfacts_text only for an exe, from the static library:if (!compileOptions.noDefaultLib && emitAction != Action::RunJIT)So under
--emit=jitevery call into the library could destroy anything: lending a field toString.indexOf, a module-levelDategiven togetTime, and Map/Set's internals were errors there, though the same programs compiled to an exe.Fix
readBorrowFactsalready does for the borrow facts. The DLL's facts text is the same as the static library's of the same build (checked: 212 identical lines).importedOwnFactsFiles, besideimportedBorrowFactsFiles).--own-factsobjects were not tracked either.2026-10-25-own-facts-from-objects-design.md) says so.Tests
test-jit-own-defaultlib-facts/test-compile-own-defaultlib-facts(own-defaultlib-facts.cmake): a field lent to library methods, with the real default library; skipped when none is built, as the default-library collector tests are. With the JIT exclusion put back, the JIT test fails.date_getTime,regexp_test,string_splitand the Map/Set tests failed only under the JIT).🤖 Generated with Claude Code