< prev index next >
src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/CompilationTask.java
Print this page
@@ -54,10 +54,11 @@
import jdk.vm.ci.hotspot.HotSpotCompilationRequestResult;
import jdk.vm.ci.hotspot.HotSpotInstalledCode;
import jdk.vm.ci.hotspot.HotSpotJVMCIRuntime;
import jdk.vm.ci.hotspot.HotSpotNmethod;
import jdk.vm.ci.hotspot.HotSpotResolvedJavaMethod;
+import jdk.vm.ci.meta.ResolvedJavaMethod;
import jdk.vm.ci.runtime.JVMCICompiler;
public class CompilationTask {
private final HotSpotJVMCIRuntime jvmciRuntime;
@@ -167,11 +168,17 @@
// Installation is included in compilation time and memory usage reported by printer
printer.finish(result);
}
stats.finish(method, installedCode);
if (result != null) {
- return HotSpotCompilationRequestResult.success(result.getBytecodeSize() - method.getCodeSize());
+ // For compilation of substitutions the method in the compilation request might be
+ // different than the actual method parsed. The root of the compilation will always
+ // be the first method in the methods list, so use that instead.
+ ResolvedJavaMethod rootMethod = result.getMethods()[0];
+ int inlinedBytecodes = result.getBytecodeSize() - rootMethod.getCodeSize();
+ assert inlinedBytecodes >= 0 : rootMethod + " " + method;
+ return HotSpotCompilationRequestResult.success(inlinedBytecodes);
}
return null;
}
}
< prev index next >