New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
spring-loaded doesn't work with JVMCI #184
Conversation
I've created this PR a year ago and there hasn't been a single reply! That is partially explainable as I was asking people to download a special JDK - however the situation is different today. As @chrisseaton wrote in his Understanding How Graal Works - the Graal compiler is part of standard JDK9. I hope that might increase your motivation to accept my fix. |
To reproduce: get JDK9, my version is: $ /usr/lib/jvm/java-9-oracle/bin/java --version
java 9.0.1
Java(TM) SE Runtime Environment (build 9.0.1+11)
Java HotSpot(TM) 64-Bit Server VM (build 9.0.1+11, mixed mode) and run any long running computation with $ /usr/lib/jvm/java-9-oracle/bin/java -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI -XX:+UseJVMCICompiler -Dgraal.PrintCompilation=true -javaagent:/springloaded-1.2.6/springloaded.jar -Xverify:none -jar java/algorithm/target/sieve-algorithm-1.0-SNAPSHOT.jar
Computed 97 primes in 1 ms. Last one is 509
Computed 194 primes in 1 ms. Last one is 1181
Computed 388 primes in 2 ms. Last one is 2677
Computed 776 primes in 2 ms. Last one is 5897
Computed 1552 primes in 3 ms. Last one is 13033
Computed 3104 primes in 4 ms. Last one is 28541
Computed 6208 primes in 7 ms. Last one is 61687
Computed 12416 primes in 14 ms. Last one is 133033
Computed 24832 primes in 36 ms. Last one is 284831
Nov 24, 2017 5:13:51 PM org.springsource.loaded.agent.SpringLoadedPreProcessor preProcess
SEVERE: Unexpected problem transforming call sites
java.lang.IllegalArgumentException
at sl.org.objectweb.asm.ClassReader.<init>(Unknown Source)
at sl.org.objectweb.asm.ClassReader.<init>(Unknown Source)
at org.springsource.loaded.MethodInvokerRewriter.rewrite(MethodInvokerRewriter.java:345)
at org.springsource.loaded.MethodInvokerRewriter.rewrite(MethodInvokerRewriter.java:99)
at org.springsource.loaded.TypeRegistry.methodCallRewriteUseCacheIfAvailable(TypeRegistry.java:1002)
at org.springsource.loaded.agent.SpringLoadedPreProcessor.preProcess(SpringLoadedPreProcessor.java:361)
at org.springsource.loaded.agent.ClassPreProcessorAgentAdapter.transform(ClassPreProcessorAgentAdapter.java:107)
at java.instrument/java.lang.instrument.ClassFileTransformer.transform(ClassFileTransformer.java:246)
at java.instrument/sun.instrument.TransformerManager.transform(TransformerManager.java:188)
at java.instrument/sun.instrument.InstrumentationImpl.transform(InstrumentationImpl.java:550)
at java.base/java.lang.ClassLoader.defineClass2(Native Method) with my patch, I can successfully execute the same command and even see that the Graal compiler does its compilations: $ /usr/lib/jvm/java-9-oracle/bin/java -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI -XX:+UseJVMCICompiler -Dgraal.PrintCompilation=true -javaagent:/spring-loaded/springloaded/build/libs/springloaded-1.2.9.BUILD-SNAPSHOT.jar -Xverify:none -jar java/algorithm/target/sieve-algorithm-1.0-SNAPSHOT.jar
134 JVMCI Ljava/lang/StringLatin1; hashCode ([B)I (OSR@10) ...
135 JVMCI Ljava/lang/String; coder ()B ...
Computed 49664 primes in 104 ms. Last one is 607417
135 JVMCI | 334ms 15B 63B 10171kB
468 JVMCI Lorg/apidesign/demo/sieve/eratosthenes/Filter; acceptAndAdd (I)Z ...
134 JVMCI | 345ms 42B 314B 9823kB
419 JVMCI Ljdk/internal/jimage/ImageStringsReader; unmaskedHashCode (Ljava/lang/String;I)I Does it make sense to integrate my bugfix now? |
Just before I do, have you signed the CLA? https://cla.pivotal.io/sign/pivotal/icla |
…cation class path like JVMCI classloader & co.
dcfb84d
to
55d7f26
Compare
Hello Andy, I've just signed the CLA with my apidesign.org address. I hope my PR is now in acceptable state to be merged. |
Thanks for confirming, and contributing! |
Java Virtual Machine Compiler Interface is coming to JDK. It has already been integrated into JDK9 and there are backports to JDK8 as well (download from OTN). However the spring-loaded project doesn't work with the JVMCI builds. Download the JVMCI JDK and try:
This pull request fixes the problem by not creating a TypeRegistry for classloaders that don't see the application class path like JVMCI classloader & co.