changeset 22729:bf7441345362

added HotSpotStackIntrospection and made CompilerToVM.getNextStackFrame package-private
author Doug Simon <doug.simon@oracle.com>
date Tue, 29 Sep 2015 22:03:41 +0200
parents 4995b94aaed6
children 7566297ba145
files graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/target/Backend.java graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotBackend.java graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotGraalRuntime.java graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotGraalRuntimeProvider.java graal/com.oracle.graal.truffle.hotspot/src/com/oracle/graal/truffle/hotspot/HotSpotTruffleRuntime.java graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/GraalTruffleRuntime.java mx.graal/suite.py
diffstat 7 files changed, 19 insertions(+), 44 deletions(-) [+]
line wrap: on
line diff
--- a/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/target/Backend.java	Tue Sep 29 21:37:35 2015 +0200
+++ b/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/target/Backend.java	Tue Sep 29 22:03:41 2015 +0200
@@ -27,7 +27,6 @@
 import jdk.internal.jvmci.code.CompilationResult;
 import jdk.internal.jvmci.code.RegisterConfig;
 import jdk.internal.jvmci.code.TargetDescription;
-import jdk.internal.jvmci.code.stack.StackIntrospection;
 import jdk.internal.jvmci.common.JVMCIError;
 import jdk.internal.jvmci.meta.ConstantReflectionProvider;
 import jdk.internal.jvmci.meta.MetaAccessProvider;
@@ -132,8 +131,6 @@
     public abstract CompilationResultBuilder newCompilationResultBuilder(LIRGenerationResult lirGenResult, FrameMap frameMap, CompilationResult compilationResult,
                     CompilationResultBuilderFactory factory);
 
-    public abstract StackIntrospection getStackIntrospection();
-
     /**
      * Emits the code for a given graph.
      *
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotBackend.java	Tue Sep 29 21:37:35 2015 +0200
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotBackend.java	Tue Sep 29 22:03:41 2015 +0200
@@ -34,7 +34,6 @@
 import jdk.internal.jvmci.code.RegisterSaveLayout;
 import jdk.internal.jvmci.code.StackSlot;
 import jdk.internal.jvmci.code.ValueUtil;
-import jdk.internal.jvmci.code.stack.StackIntrospection;
 import jdk.internal.jvmci.hotspot.HotSpotJVMCIRuntime;
 import jdk.internal.jvmci.hotspot.HotSpotVMConfig;
 import jdk.internal.jvmci.meta.Value;
@@ -248,11 +247,6 @@
     }
 
     @Override
-    public StackIntrospection getStackIntrospection() {
-        return runtime;
-    }
-
-    @Override
     public HotSpotProviders getProviders() {
         return (HotSpotProviders) super.getProviders();
     }
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotGraalRuntime.java	Tue Sep 29 21:37:35 2015 +0200
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotGraalRuntime.java	Tue Sep 29 22:03:41 2015 +0200
@@ -22,7 +22,6 @@
  */
 package com.oracle.graal.hotspot;
 
-import static com.oracle.graal.compiler.common.GraalOptions.HotSpotPrintInlining;
 import static com.oracle.graal.debug.GraalDebugConfig.DebugValueSummary;
 import static com.oracle.graal.debug.GraalDebugConfig.Dump;
 import static com.oracle.graal.debug.GraalDebugConfig.Log;
@@ -38,22 +37,19 @@
 import java.util.Map;
 
 import jdk.internal.jvmci.code.Architecture;
-import jdk.internal.jvmci.code.stack.InspectedFrameVisitor;
 import jdk.internal.jvmci.code.stack.StackIntrospection;
 import jdk.internal.jvmci.common.JVMCIError;
-import jdk.internal.jvmci.hotspot.CompilerToVM;
 import jdk.internal.jvmci.hotspot.HotSpotJVMCIRuntime;
 import jdk.internal.jvmci.hotspot.HotSpotProxified;
-import jdk.internal.jvmci.hotspot.HotSpotStackFrameReference;
 import jdk.internal.jvmci.hotspot.HotSpotVMConfig;
 import jdk.internal.jvmci.inittimer.InitTimer;
 import jdk.internal.jvmci.meta.JavaKind;
-import jdk.internal.jvmci.meta.ResolvedJavaMethod;
 import jdk.internal.jvmci.runtime.JVMCIBackend;
 
 import com.oracle.graal.api.collections.CollectionsProvider;
 import com.oracle.graal.api.replacements.SnippetReflectionProvider;
 import com.oracle.graal.api.runtime.GraalRuntime;
+import com.oracle.graal.compiler.common.GraalOptions;
 import com.oracle.graal.compiler.target.Backend;
 import com.oracle.graal.debug.Debug;
 import com.oracle.graal.debug.DebugEnvironment;
@@ -97,8 +93,8 @@
         CompileTheWorldOptions.overrideWithNativeOptions(config);
 
         // Only set HotSpotPrintInlining if it still has its default value (false).
-        if (HotSpotPrintInlining.getValue() == false) {
-            HotSpotPrintInlining.setValue(config.printInlining);
+        if (GraalOptions.HotSpotPrintInlining.getValue() == false) {
+            GraalOptions.HotSpotPrintInlining.setValue(config.printInlining);
         }
 
         CompilerConfiguration compilerConfiguration = compilerFactory.createCompilerConfiguration();
@@ -222,20 +218,6 @@
         return Collections.unmodifiableMap(backends);
     }
 
-    @Override
-    public <T> T iterateFrames(ResolvedJavaMethod[] initialMethods, ResolvedJavaMethod[] matchingMethods, int initialSkip, InspectedFrameVisitor<T> visitor) {
-        CompilerToVM compilerToVM = runtime().getCompilerToVM();
-        HotSpotStackFrameReference current = compilerToVM.getNextStackFrame(null, initialMethods, initialSkip);
-        while (current != null) {
-            T result = visitor.visitFrame(current);
-            if (result != null) {
-                return result;
-            }
-            current = compilerToVM.getNextStackFrame(current, matchingMethods, 0);
-        }
-        return null;
-    }
-
     private long runtimeStartTime;
 
     /**
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotGraalRuntimeProvider.java	Tue Sep 29 21:37:35 2015 +0200
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotGraalRuntimeProvider.java	Tue Sep 29 22:03:41 2015 +0200
@@ -23,7 +23,6 @@
 package com.oracle.graal.hotspot;
 
 import jdk.internal.jvmci.code.TargetDescription;
-import jdk.internal.jvmci.code.stack.StackIntrospection;
 
 import com.oracle.graal.api.runtime.GraalRuntime;
 import com.oracle.graal.hotspot.meta.HotSpotProviders;
@@ -34,7 +33,7 @@
 /**
  * Configuration information for the HotSpot Graal runtime.
  */
-public interface HotSpotGraalRuntimeProvider extends GraalRuntime, RuntimeProvider, StackIntrospection {
+public interface HotSpotGraalRuntimeProvider extends GraalRuntime, RuntimeProvider {
 
     default TargetDescription getTarget() {
         return getHostBackend().getTarget();
--- a/graal/com.oracle.graal.truffle.hotspot/src/com/oracle/graal/truffle/hotspot/HotSpotTruffleRuntime.java	Tue Sep 29 21:37:35 2015 +0200
+++ b/graal/com.oracle.graal.truffle.hotspot/src/com/oracle/graal/truffle/hotspot/HotSpotTruffleRuntime.java	Tue Sep 29 22:03:41 2015 +0200
@@ -53,8 +53,10 @@
 import jdk.internal.jvmci.code.CallingConvention.Type;
 import jdk.internal.jvmci.code.CodeCacheProvider;
 import jdk.internal.jvmci.code.CompilationResult;
+import jdk.internal.jvmci.code.stack.StackIntrospection;
 import jdk.internal.jvmci.common.JVMCIError;
 import jdk.internal.jvmci.hotspot.HotSpotCodeCacheProvider;
+import jdk.internal.jvmci.hotspot.HotSpotJVMCIRuntime;
 import jdk.internal.jvmci.hotspot.HotSpotResolvedJavaMethod;
 import jdk.internal.jvmci.hotspot.HotSpotSpeculationLog;
 import jdk.internal.jvmci.hotspot.HotSpotVMConfig;
@@ -119,6 +121,7 @@
 
     private Map<OptimizedCallTarget, Future<?>> compilations = newIdentityMap();
     private final ExecutorService compileQueue;
+    private StackIntrospection stackIntrospection;
 
     private final Map<RootCallTarget, Void> callTargets = Collections.synchronizedMap(new WeakHashMap<RootCallTarget, Void>());
 
@@ -160,6 +163,14 @@
     }
 
     @Override
+    protected StackIntrospection getStackIntrospection() {
+        if (stackIntrospection == null) {
+            stackIntrospection = HotSpotJVMCIRuntime.runtime().getHostJVMCIBackend().getStackIntrospection();
+        }
+        return stackIntrospection;
+    }
+
+    @Override
     public TruffleCompiler getTruffleCompiler() {
         if (truffleCompiler == null) {
             truffleCompiler = DefaultTruffleCompiler.create();
--- a/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/GraalTruffleRuntime.java	Tue Sep 29 21:37:35 2015 +0200
+++ b/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/GraalTruffleRuntime.java	Tue Sep 29 22:03:41 2015 +0200
@@ -39,7 +39,6 @@
 import jdk.internal.jvmci.meta.ResolvedJavaMethod;
 import jdk.internal.jvmci.service.Services;
 
-import com.oracle.graal.api.runtime.Graal;
 import com.oracle.graal.debug.Debug;
 import com.oracle.graal.debug.Debug.Scope;
 import com.oracle.graal.debug.TTY;
@@ -76,7 +75,6 @@
     private ArrayList<String> includes;
     private ArrayList<String> excludes;
 
-    private StackIntrospection stackIntrospection;
     protected ResolvedJavaMethod[] callNodeMethod;
     protected ResolvedJavaMethod[] callTargetMethod;
     protected ResolvedJavaMethod[] anyFrameMethod;
@@ -202,7 +200,7 @@
     @TruffleBoundary
     @Override
     public <T> T iterateFrames(FrameInstanceVisitor<T> visitor) {
-        initStackIntrospection();
+        StackIntrospection stackIntrospection = getStackIntrospection();
 
         InspectedFrameVisitor<T> inspectedFrameVisitor = new InspectedFrameVisitor<T>() {
             private boolean skipNext = false;
@@ -227,11 +225,7 @@
         return stackIntrospection.iterateFrames(anyFrameMethod, anyFrameMethod, 1, inspectedFrameVisitor);
     }
 
-    private void initStackIntrospection() {
-        if (stackIntrospection == null) {
-            stackIntrospection = Graal.getRequiredCapability(StackIntrospection.class);
-        }
-    }
+    protected abstract StackIntrospection getStackIntrospection();
 
     @Override
     public FrameInstance getCallerFrame() {
@@ -241,9 +235,7 @@
     @TruffleBoundary
     @Override
     public FrameInstance getCurrentFrame() {
-        initStackIntrospection();
-
-        return stackIntrospection.iterateFrames(callTargetMethod, callTargetMethod, 0, frame -> new GraalFrameInstance.CallTargetFrame(frame, true));
+        return getStackIntrospection().iterateFrames(callTargetMethod, callTargetMethod, 0, frame -> new GraalFrameInstance.CallTargetFrame(frame, true));
     }
 
     public <T> T getCapability(Class<T> capability) {
--- a/mx.graal/suite.py	Tue Sep 29 21:37:35 2015 +0200
+++ b/mx.graal/suite.py	Tue Sep 29 22:03:41 2015 +0200
@@ -6,7 +6,7 @@
     "suites": [
             {
                "name" : "jvmci",
-               "version" : "02d95720c45505372fa95555f91c6acfef3e44dc",
+               "version" : "353eb2b44df8edce742c16fc28abc68aefb04e8b",
                "urls" : [
                     {"url" : "http://lafo.ssw.uni-linz.ac.at/hg/graal-jvmci-8", "kind" : "hg"},
                     {"url" : "https://curio.ssw.jku.at/nexus/content/repositories/snapshots", "kind" : "binary"},