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
7 changes: 5 additions & 2 deletions tslang/docs/jit-native-dll-debugging-design.md
Original file line number Diff line number Diff line change
Expand Up @@ -149,8 +149,11 @@ quality for TS code, which AOT shares, not something this mode adds.
With the import library the link fails as soon as the program reads data the default library
defines. A `Map` reads `PrimeHelpers.hashCollisionThreshold` by its own name, and only an
`__imp_` reference resolves a DLL's data export. The in-memory JIT binds it from the export
table. `--emit=dll` has the same failure today (a separate bug). So in this mode tslang loads
neither the default library's DLL nor `TypeScriptRuntime.dll`.
table. `--emit=dll` had the same failure, and #630 fixed it by marking that data dllimport.
That fix does not carry over here. The DLL links the JIT cache's objects, which are compiled for
the JIT's static large code model, and x86 codegen emits no `__imp_` reference under that model
even for a dllimport global (`X86Subtarget::classifyGlobalReference`). So in this mode tslang
loads neither the default library's DLL nor `TypeScriptRuntime.dll`.
- **The DLL and its PDB** are `__jit/<file>.<hash>.dll` and `.pdb`, linked under a temporary name,
`/PDB:` the final name with `/PDBALTPATH:%_PDB%`, then renamed. `.lib` and `.exp` are removed.
The DLLs of earlier runs of the same program are removed, and so are temporary files more than an
Expand Down
3 changes: 3 additions & 0 deletions tslang/tslang/jitnative.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -301,6 +301,9 @@ int linkJitUnits(const char *argv0, llvm::ArrayRef<JitUnit> units, CompileOption
// but not for its data: a static field the program reads (a generic's instantiation reading
// PrimeHelpers.hashCollisionThreshold, say) is referenced by its own name, which only an
// `__imp_` reference resolves to an import. The in-memory JIT binds it from the export table.
// Marking the data dllimport, as --emit=dll does, does not help here: these are the JIT's
// objects, compiled for the static large code model, and x86 codegen gives a dllimport global
// no `__imp_` reference under that model (X86Subtarget::classifyGlobalReference).
request.staticDefaultLib = true;
request.quiet = true;
request.extraArgs.push_back("-Wl,/INCREMENTAL:NO");
Expand Down
Loading