changeset 13209:b96cc3b87e87

Merge
author Andreas Woess <andreas.woess@jku.at>
date Mon, 02 Dec 2013 13:46:05 +0100
parents bef512e42262 (current diff) 66d793d06465 (diff)
children 862a5d60a58a d862cb983214 78c808233ff1
files graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/PartialEvaluator.java
diffstat 5 files changed, 64 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/OptimizedCallTarget.java	Mon Dec 02 12:45:18 2013 +0100
+++ b/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/OptimizedCallTarget.java	Mon Dec 02 13:46:05 2013 +0100
@@ -79,8 +79,9 @@
         if (installedCode != null && installedCode.isValid()) {
             TruffleRuntime runtime = Truffle.getRuntime();
             if (runtime instanceof GraalTruffleRuntime) {
-                OUT.printf("[truffle] reinstall OptimizedCallTarget.call code with frame prolog shortcut.");
-                OUT.println();
+                if (TraceTruffleCompilation.getValue()) {
+                    OUT.println("[truffle] reinstall OptimizedCallTarget.call code with frame prolog shortcut.");
+                }
                 GraalTruffleRuntime.installOptimizedCallTargetCallMethod();
             }
         }
--- a/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/PartialEvaluator.java	Mon Dec 02 12:45:18 2013 +0100
+++ b/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/PartialEvaluator.java	Mon Dec 02 13:46:05 2013 +0100
@@ -22,7 +22,6 @@
  */
 package com.oracle.graal.truffle;
 
-import static com.oracle.graal.compiler.GraalDebugConfig.*;
 import static com.oracle.graal.phases.GraalOptions.*;
 import static com.oracle.graal.truffle.TruffleCompilerOptions.*;
 
@@ -88,12 +87,11 @@
         }
     }
 
-    public StructuredGraph createGraph(final OptimizedCallTarget node, final Assumptions assumptions) {
-        if (Dump.getValue() != null && Dump.getValue().contains("Truffle")) {
-            RootNode root = node.getRootNode();
-            if (root != null) {
-                new GraphPrintVisitor().beginGroup("TruffleGraph").beginGraph(node.toString()).visit(root).printToNetwork();
-            }
+    public StructuredGraph createGraph(final OptimizedCallTarget callTarget, final Assumptions assumptions) {
+        try (Scope s = Debug.scope("TruffleTree")) {
+            Debug.dump(callTarget, "truffle tree");
+        } catch (Throwable e) {
+            throw Debug.handle(e);
         }
 
         if (TraceTruffleCompilationDetails.getValue()) {
@@ -110,7 +108,7 @@
 
             // Replace thisNode with constant.
             LocalNode thisNode = graph.getLocal(0);
-            thisNode.replaceAndDelete(ConstantNode.forObject(node, providers.getMetaAccess(), graph));
+            thisNode.replaceAndDelete(ConstantNode.forObject(callTarget, providers.getMetaAccess(), graph));
 
             // Canonicalize / constant propagate.
             PhaseContext baseContext = new PhaseContext(providers, assumptions);
--- a/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/TruffleCompilerImpl.java	Mon Dec 02 12:45:18 2013 +0100
+++ b/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/TruffleCompilerImpl.java	Mon Dec 02 13:46:05 2013 +0100
@@ -85,7 +85,13 @@
         // Create compilation queue.
         CompilerThreadFactory factory = new CompilerThreadFactory("TruffleCompilerThread", new DebugConfigAccess() {
             public GraalDebugConfig getDebugConfig() {
-                return Debug.isEnabled() ? DebugEnvironment.initialize(TTY.out().out()) : null;
+                if (Debug.isEnabled()) {
+                    GraalDebugConfig debugConfig = DebugEnvironment.initialize(TTY.out().out());
+                    debugConfig.dumpHandlers().add(new TruffleTreeDumpHandler());
+                    return debugConfig;
+                } else {
+                    return null;
+                }
             }
         });
         compileQueue = new ThreadPoolExecutor(1, 1, 0L, TimeUnit.MILLISECONDS, new LinkedBlockingQueue<Runnable>(), factory);
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/TruffleTreeDumpHandler.java	Mon Dec 02 13:46:05 2013 +0100
@@ -0,0 +1,44 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package com.oracle.graal.truffle;
+
+import com.oracle.graal.debug.*;
+import com.oracle.truffle.api.impl.*;
+import com.oracle.truffle.api.nodes.*;
+
+public class TruffleTreeDumpHandler implements DebugDumpHandler {
+
+    @Override
+    public void dump(Object object, final String message) {
+        if (object instanceof DefaultCallTarget) {
+            DefaultCallTarget callTarget = (DefaultCallTarget) object;
+            if (callTarget.getRootNode() != null) {
+                new GraphPrintVisitor().beginGroup(callTarget.toString()).beginGraph(message).visit(callTarget.getRootNode()).printToNetwork();
+            }
+        }
+    }
+
+    public void close() {
+        // nothing to do
+    }
+}
--- a/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/nodes/frame/NewFrameNode.java	Mon Dec 02 12:45:18 2013 +0100
+++ b/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/nodes/frame/NewFrameNode.java	Mon Dec 02 13:46:05 2013 +0100
@@ -136,6 +136,10 @@
 
     @Override
     public void virtualize(VirtualizerTool tool) {
+        if (!descriptor.isConstant()) {
+            return;
+        }
+
         int frameSize = getFrameSize();
 
         ResolvedJavaType frameType = stamp().javaType(tool.getMetaAccessProvider());