Skip to content

Commit

Permalink
Resolved review notes.
Browse files Browse the repository at this point in the history
(cherry picked from commit 6574e67)
  • Loading branch information
Miloslav Metelka authored and ansalond committed Aug 30, 2018
1 parent a5e9d73 commit e791c2e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -378,7 +378,9 @@ private static CallTarget parseBinary(String libName, LLVM_IR.Binary ir) {
long start = System.nanoTime();
RContext context = RContext.getInstance();
long nanos = 1000 * 1000 * 1000;
Source source = Source.newBuilder("", ir.base64, ir.name).mimeType("application/x-llvm-ir-bitcode-base64").build();
String mimeType = "application/x-llvm-ir-bitcode-base64";
String language = Source.findLanguage(mimeType);
Source source = Source.newBuilder(language, ir.base64, ir.name).mimeType(mimeType).build();
CallTarget result = context.getEnv().parse(source);
if (System.getenv("LLVM_PARSE_TIME") != null) {
long end = System.nanoTime();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -211,12 +211,13 @@ protected CallTarget parseFile(String path, String languageIdArg) {

File file = new File(path);
try {
Env env = RContext.getInstance().getEnv();
TruffleFile tFile = env.getTruffleFile(file.getAbsolutePath());
String languageId = languageIdArg;
if (languageId == null) { // null languageId not allowed in newBuilder()
languageId = RRuntime.R_LANGUAGE_ID;
if (languageId == null) {
languageId = Source.findLanguage(tFile);
}
Env env = RContext.getInstance().getEnv();
SourceBuilder sourceBuilder = Source.newBuilder(languageId, env.getTruffleFile(file.getAbsolutePath())).name(file.getName());
SourceBuilder sourceBuilder = Source.newBuilder(languageId, tFile).name(file.getName());
Source sourceObject = sourceBuilder.build();
return env.parse(sourceObject);
} catch (IOException e) {
Expand Down

0 comments on commit e791c2e

Please sign in to comment.