From e791c2ea6acfab8281f54ca6a2619b9754528896 Mon Sep 17 00:00:00 2001 From: Miloslav Metelka Date: Thu, 30 Aug 2018 14:38:21 +0200 Subject: [PATCH] Resolved review notes. (cherry picked from commit 6574e67c97779e480991189b52f6e7ecf877500a) --- .../oracle/truffle/r/ffi/impl/llvm/TruffleLLVM_DLL.java | 4 +++- .../truffle/r/nodes/builtin/fastr/FastRInterop.java | 9 +++++---- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/com.oracle.truffle.r.ffi.impl/src/com/oracle/truffle/r/ffi/impl/llvm/TruffleLLVM_DLL.java b/com.oracle.truffle.r.ffi.impl/src/com/oracle/truffle/r/ffi/impl/llvm/TruffleLLVM_DLL.java index 6e89339203..41532e714c 100644 --- a/com.oracle.truffle.r.ffi.impl/src/com/oracle/truffle/r/ffi/impl/llvm/TruffleLLVM_DLL.java +++ b/com.oracle.truffle.r.ffi.impl/src/com/oracle/truffle/r/ffi/impl/llvm/TruffleLLVM_DLL.java @@ -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(); diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/fastr/FastRInterop.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/fastr/FastRInterop.java index a90f0c0b80..3f3b8b2bca 100644 --- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/fastr/FastRInterop.java +++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/fastr/FastRInterop.java @@ -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) {