OpenJDK 64-Bit Server VM (19.0.2+7-jvmci-22.3-b12) for windows-amd64 JRE (19.0.2+7-jvmci-22.3-b12), built on 2022-12-28T13:55:33Z by "" with MS VC++ 17.1 (VS2022)
Have you verified this issue still happens when using the latest snapshot?
Yes (GraalVM CE 23.0.0-dev-20230331_1201)
Describe the issue
In Java, I'm trying to embed LLVM bitcode generated from simplest C++ code. The eval() function throws exception as below.
The command I use to generate LLVM from C++ (results in creation of hello1.bc file):
/c/PROGRAMY/graalvm-ce-java19-22.3.1/lib/llvm/bin/clang++ -c -emit-llvm hello1.cpp
Then I compile and run the Java code:
javac HelloPolyglot.java
java HelloPolyglot
The Java output:
LLVM bytecode length: 2264
Exception in thread "main" org.graalvm.polyglot.PolyglotException: java.lang.UnsupportedOperationException: null not supported as key!
at org.graalvm.sdk/org.graalvm.collections.EconomicMapImpl.checkKeyNonNull(EconomicMapImpl.java:640)
at org.graalvm.sdk/org.graalvm.collections.EconomicMapImpl.get(EconomicMapImpl.java:242)
at com.oracle.truffle.llvm.runtime.LLVMLanguage.getCachedLibrary(LLVMLanguage.java:762)
at com.oracle.truffle.llvm.runtime.LLVMLanguage.parse(LLVMLanguage.java:726)
at org.graalvm.truffle/com.oracle.truffle.api.TruffleLanguage$ParsingRequest.parse(TruffleLanguage.java:1000)
at org.graalvm.truffle/com.oracle.truffle.api.TruffleLanguage.parse(TruffleLanguage.java:1357)
at org.graalvm.truffle/com.oracle.truffle.api.LanguageAccessor$LanguageImpl.parse(LanguageAccessor.java:298)
at org.graalvm.truffle/com.oracle.truffle.polyglot.PolyglotSourceCache.parseImpl(PolyglotSourceCache.java:94)
at org.graalvm.truffle/com.oracle.truffle.polyglot.PolyglotSourceCache$WeakCache.lookup(PolyglotSourceCache.java:222)
at org.graalvm.truffle/com.oracle.truffle.polyglot.PolyglotSourceCache.parseCached(PolyglotSourceCache.java:80)
at org.graalvm.truffle/com.oracle.truffle.polyglot.PolyglotLanguageContext.parseCached(PolyglotLanguageContext.java:372)
at org.graalvm.truffle/com.oracle.truffle.polyglot.PolyglotContextImpl.eval(PolyglotContextImpl.java:1480)
at org.graalvm.truffle/com.oracle.truffle.polyglot.PolyglotContextDispatch.eval(PolyglotContextDispatch.java:63)
at org.graalvm.sdk/org.graalvm.polyglot.Context.eval(Context.java:402)
at HelloPolyglot.main(HelloPolyglot.java:32)
Suppressed: Attached Guest Language Frames (0)
Internal GraalVM error, please report at https://github.com/oracle/graal/issues/.
Expected behavior
I expected the C++ code to be executed within Java application, without throwing the exception.
Describe GraalVM and your environment :
java -Xinternalversion
:Have you verified this issue still happens when using the latest snapshot? Yes (GraalVM CE 23.0.0-dev-20230331_1201)
Describe the issue In Java, I'm trying to embed LLVM bitcode generated from simplest C++ code. The
eval()
function throws exception as below.Steps to reproduce the issue
hello1.cpp
HelloPolyglot.java
The command I use to generate LLVM from C++ (results in creation of
hello1.bc
file):/c/PROGRAMY/graalvm-ce-java19-22.3.1/lib/llvm/bin/clang++ -c -emit-llvm hello1.cpp
Then I compile and run the Java code: javac HelloPolyglot.java java HelloPolyglot
The Java output:
Expected behavior I expected the C++ code to be executed within Java application, without throwing the exception.