changeset 22185:dab8fbc8ba43

Expose graph builder configuration and some other details of Truffle compiler
author Christian Wimmer <christian.wimmer@oracle.com>
date Wed, 08 Jul 2015 10:12:37 -0700
parents 652d8bc53ef9
children b18b92bcf0a2
files 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 graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/PartialEvaluator.java graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/TruffleCompiler.java
diffstat 4 files changed, 33 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/graal/com.oracle.graal.truffle.hotspot/src/com/oracle/graal/truffle/hotspot/HotSpotTruffleRuntime.java	Wed Jul 08 10:11:49 2015 -0700
+++ b/graal/com.oracle.graal.truffle.hotspot/src/com/oracle/graal/truffle/hotspot/HotSpotTruffleRuntime.java	Wed Jul 08 10:12:37 2015 -0700
@@ -121,6 +121,14 @@
     }
 
     @Override
+    public TruffleCompiler getTruffleCompiler() {
+        if (truffleCompiler == null) {
+            truffleCompiler = DefaultTruffleCompiler.create();
+        }
+        return truffleCompiler;
+    }
+
+    @Override
     public RootCallTarget createCallTarget(RootNode rootNode) {
         return createCallTargetImpl(null, rootNode);
     }
@@ -213,9 +221,9 @@
 
     @Override
     public void compile(OptimizedCallTarget optimizedCallTarget, boolean mayBeAsynchronous) {
-        if (truffleCompiler == null) {
-            truffleCompiler = DefaultTruffleCompiler.create();
-        }
+        /* Ensure compiler is created. */
+        getTruffleCompiler();
+
         Runnable r = new Runnable() {
             @Override
             public void run() {
--- a/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/GraalTruffleRuntime.java	Wed Jul 08 10:11:49 2015 -0700
+++ b/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/GraalTruffleRuntime.java	Wed Jul 08 10:12:37 2015 -0700
@@ -66,6 +66,8 @@
         Runtime.getRuntime().addShutdownHook(new Thread(this::shutdown));
     }
 
+    public abstract TruffleCompiler getTruffleCompiler();
+
     private static <T extends PrioritizedServiceProvider> T loadPrioritizedServiceProvider(Class<T> clazz) {
         Iterable<T> providers = Services.load(clazz);
         T bestFactory = null;
--- a/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/PartialEvaluator.java	Wed Jul 08 10:11:49 2015 -0700
+++ b/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/PartialEvaluator.java	Wed Jul 08 10:12:37 2015 -0700
@@ -97,6 +97,22 @@
         }
     }
 
+    public Providers getProviders() {
+        return providers;
+    }
+
+    public SnippetReflectionProvider getSnippetReflection() {
+        return snippetReflection;
+    }
+
+    public ResolvedJavaMethod[] getCompilationRootMethods() {
+        return new ResolvedJavaMethod[]{callRootMethod, callInlinedMethod};
+    }
+
+    public ResolvedJavaMethod[] getNeverInlineMethods() {
+        return new ResolvedJavaMethod[]{callSiteProxyMethod, callDirectMethod};
+    }
+
     public StructuredGraph createGraph(final OptimizedCallTarget callTarget, AllowAssumptions allowAssumptions) {
         try (Scope c = Debug.scope("TruffleTree")) {
             Debug.dump(callTarget, "truffle tree");
--- a/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/TruffleCompiler.java	Wed Jul 08 10:11:49 2015 -0700
+++ b/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/TruffleCompiler.java	Wed Jul 08 10:12:37 2015 -0700
@@ -99,6 +99,10 @@
         }
     }
 
+    public GraphBuilderConfiguration getGraphBuilderConfiguration() {
+        return config;
+    }
+
     protected abstract PartialEvaluator createPartialEvaluator();
 
     public static ResolvedJavaType[] getSkippedExceptionTypes(MetaAccessProvider metaAccess) {