Skip to content
Merged
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
16 changes: 13 additions & 3 deletions tslang/tslang/transform.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -156,11 +156,21 @@ int runMLIRPasses(mlir::MLIRContext &context, llvm::SourceMgr &sourceMgr, mlir::
}

// What this module promises importers about its parameters, whether or not it promotes
// anything itself. Nothing imports a JIT-run program.
if (!compileOptions.isJit && !noBorrowFactsExport)
// anything itself. Nothing imports a JIT-run program, nor the modules the JIT cache
// compiles beside it (isJit off, jitCache on): their objects are only loaded into the
// JIT, never linked, and the program run there does not read facts from them
// (StackPromotionPass). Named after the module's own file, the main buffer, not
// inputFilename, so a symbol is never another module's.
if (!compileOptions.isJit && !compileOptions.jitCache && !noBorrowFactsExport)
{
llvm::StringRef moduleFile = inputFilename;
if (sourceMgr.getNumBuffers() > 0 && inputFilename != "-")
{
moduleFile = sourceMgr.getMemoryBuffer(sourceMgr.getMainFileID())->getBufferIdentifier();
}

pm.addPass(mlir::typescript::createBorrowFactsExportPass(
SHARED_LIB_BORROW_FACTS + typescript::moduleSymbolSuffix(inputFilename)));
SHARED_LIB_BORROW_FACTS + typescript::moduleSymbolSuffix(moduleFile)));
}

// Under every model, after own's inference: what it decides about a stack object's retains
Expand Down
Loading