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
41 changes: 25 additions & 16 deletions tslang/tslang/jit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ extern cl::opt<std::string> inputFilename;
extern cl::opt<std::string> TargetTriple;

std::string getDefaultLibPath();
std::string getTslangLibPath();
std::string mergeWithDefaultLibPath(std::string, std::string);
std::string makeAbsolutePath(std::string);

Expand Down Expand Up @@ -137,27 +138,35 @@ int runJit(int argc, char **argv, mlir::ModuleOp module, CompileOptions &compile
std::string pathTypeScriptLib("../lib/" LIB_NAME "TypeScriptRuntime." LIB_EXT);
if (!disableGC.getValue())
{
auto absPath = makeAbsolutePath(pathTypeScriptLib);
if (absPath.empty())
{
pathTypeScriptLib = LIB_NAME "TypeScriptRuntime." LIB_EXT;
auto absPath2 = makeAbsolutePath(pathTypeScriptLib);
if (absPath2.empty())
{
/*
llvm::WithColor::error(llvm::errs(), "tslang") << "JIT initialization failed. Missing GC library. Did you forget to provide it via "
"'--shared-libs=" LIB_NAME "TypeScriptRuntime." LIB_EXT "'? or you can switch it off by using '-nogc'\n";
return -1;
*/
}
auto absPath3 = makeAbsolutePath(mergeWithDefaultLibPath(getTslangLibPath(), LIB_NAME "TypeScriptRuntime." LIB_EXT));
if (absPath3.empty())
{
auto absPath = makeAbsolutePath(pathTypeScriptLib);
if (absPath.empty())
{
pathTypeScriptLib = LIB_NAME "TypeScriptRuntime." LIB_EXT;
auto absPath2 = makeAbsolutePath(pathTypeScriptLib);
if (absPath2.empty())
{
/*
llvm::WithColor::error(llvm::errs(), "tslang") << "JIT initialization failed. Missing GC library. Did you forget to provide it via "
"'--shared-libs=" LIB_NAME "TypeScriptRuntime." LIB_EXT "'? or you can switch it off by using '-nogc'\n";
return -1;
*/
}
else
{
clSharedLibs.push_back(absPath2);
}
}
else
{
clSharedLibs.push_back(absPath2);
clSharedLibs.push_back(absPath);
}
}
}
else
{
clSharedLibs.push_back(absPath);
clSharedLibs.push_back(absPath3);
}
}

Expand Down
Loading