changeset 2858:a97605b0489b

Renamed Compare=>Materialize and introduced new C1XOption Inline.
author Thomas Wuerthinger <thomas@wuerthinger.net>
date Tue, 07 Jun 2011 16:11:26 +0200
parents c6af2af32b3d
children a4fbfbc3c858
files graal/GraalCompiler/src/com/sun/c1x/C1XOptions.java graal/GraalCompiler/src/com/sun/c1x/graph/GraphBuilder.java graal/GraalCompiler/src/com/sun/c1x/graph/IR.java graal/GraalCompiler/src/com/sun/c1x/ir/Compare.java graal/GraalCompiler/src/com/sun/c1x/ir/Materialize.java graal/GraalCompiler/src/com/sun/c1x/ir/ValueVisitor.java graal/GraalCompiler/src/com/sun/c1x/target/amd64/AMD64LIRGenerator.java
diffstat 7 files changed, 106 insertions(+), 103 deletions(-) [+]
line wrap: on
line diff
--- a/graal/GraalCompiler/src/com/sun/c1x/C1XOptions.java	Tue Jun 07 15:59:08 2011 +0200
+++ b/graal/GraalCompiler/src/com/sun/c1x/C1XOptions.java	Tue Jun 07 16:11:26 2011 +0200
@@ -39,6 +39,7 @@
     // Checkstyle: resume
 
     // inlining settings
+    public static boolean Inline                             = true;
     public static int     MaximumInstructionCount            = 37000;
     public static float   MaximumInlineRatio                 = 0.90f;
     public static int     MaximumInlineSize                  = 35;
--- a/graal/GraalCompiler/src/com/sun/c1x/graph/GraphBuilder.java	Tue Jun 07 15:59:08 2011 +0200
+++ b/graal/GraalCompiler/src/com/sun/c1x/graph/GraphBuilder.java	Tue Jun 07 16:11:26 2011 +0200
@@ -577,7 +577,7 @@
     private void genCompareOp(CiKind kind, int opcode, CiKind resultKind) {
         Value y = frameState.pop(kind);
         Value x = frameState.pop(kind);
-        Value value = append(new Compare(opcode, resultKind, x, y, graph));
+        Value value = append(new Materialize(opcode, resultKind, x, y, graph));
         if (!resultKind.isVoid()) {
             frameState.ipush(value);
         }
--- a/graal/GraalCompiler/src/com/sun/c1x/graph/IR.java	Tue Jun 07 15:59:08 2011 +0200
+++ b/graal/GraalCompiler/src/com/sun/c1x/graph/IR.java	Tue Jun 07 16:11:26 2011 +0200
@@ -168,46 +168,48 @@
 
         verifyAndPrint("After graph building");
 
-        List<Invoke> trivialInline = new ArrayList<Invoke>();
-        List<Invoke> deoptInline = new ArrayList<Invoke>();
-        List<RiMethod> deoptMethods = new ArrayList<RiMethod>();
-        for (Node node : compilation.graph.getNodes()) {
-            if (node instanceof Invoke) {
-                Invoke invoke = (Invoke) node;
-                RiMethod target = invoke.target;
-                if (target.isResolved() && !Modifier.isNative(target.accessFlags())) {
-                    if (target.canBeStaticallyBound()) {
-                        trivialInline.add(invoke);
-                    } else {
-                        RiMethod concrete = invoke.target.holder().uniqueConcreteMethod(invoke.target);
-                        if (concrete != null) {
-                            deoptInline.add(invoke);
-                            deoptMethods.add(concrete);
+            if (C1XOptions.Inline) {
+            List<Invoke> trivialInline = new ArrayList<Invoke>();
+            List<Invoke> deoptInline = new ArrayList<Invoke>();
+            List<RiMethod> deoptMethods = new ArrayList<RiMethod>();
+            for (Node node : compilation.graph.getNodes()) {
+                if (node instanceof Invoke) {
+                    Invoke invoke = (Invoke) node;
+                    RiMethod target = invoke.target;
+                    if (target.isResolved() && !Modifier.isNative(target.accessFlags())) {
+                        if (target.canBeStaticallyBound()) {
+                            trivialInline.add(invoke);
+                        } else {
+                            RiMethod concrete = invoke.target.holder().uniqueConcreteMethod(invoke.target);
+                            if (concrete != null) {
+                                deoptInline.add(invoke);
+                                deoptMethods.add(concrete);
+                            }
                         }
                     }
                 }
             }
-        }
 
-        int allowedInlinings = 50;
-        for (Invoke invoke : trivialInline) {
-            if (inlineMethod(invoke, invoke.target)) {
-                if (--allowedInlinings <= 0) {
-                    break;
+            int allowedInlinings = 50;
+            for (Invoke invoke : trivialInline) {
+                if (inlineMethod(invoke, invoke.target)) {
+                    if (--allowedInlinings <= 0) {
+                        break;
+                    }
                 }
             }
-        }
 
-        for (int i = 0; i < deoptInline.size(); i++) {
-            Invoke invoke = deoptInline.get(i);
-            RiMethod method = deoptMethods.get(i);
-            if (inlineMethod(invoke, method)) {
-                if (C1XOptions.TraceInlining) {
-                    System.out.println("registering concrete method assumption...");
-                }
-                compilation.assumptions.recordConcreteMethod(invoke.target, method);
-                if (--allowedInlinings <= 0) {
-                    break;
+            for (int i = 0; i < deoptInline.size(); i++) {
+                Invoke invoke = deoptInline.get(i);
+                RiMethod method = deoptMethods.get(i);
+                if (inlineMethod(invoke, method)) {
+                    if (C1XOptions.TraceInlining) {
+                        System.out.println("registering concrete method assumption...");
+                    }
+                    compilation.assumptions.recordConcreteMethod(invoke.target, method);
+                    if (--allowedInlinings <= 0) {
+                        break;
+                    }
                 }
             }
         }
--- a/graal/GraalCompiler/src/com/sun/c1x/ir/Compare.java	Tue Jun 07 15:59:08 2011 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,68 +0,0 @@
-/*
- * Copyright (c) 2009, 2011, 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.sun.c1x.ir;
-
-import com.oracle.graal.graph.*;
-import com.sun.c1x.debug.*;
-import com.sun.cri.bytecode.*;
-import com.sun.cri.ci.*;
-
-/**
- * The {@code CompareOp} instruction represents comparisons such as equals, not equal, etc.
- */
-public final class Compare extends Binary {
-
-    private static final int INPUT_COUNT = 0;
-    private static final int SUCCESSOR_COUNT = 0;
-
-    /**
-     * Creates a new compare operation.
-     * @param opcode the bytecode opcode
-     * @param kind the result kind
-     * @param x the first input
-     * @param y the second input
-     */
-    public Compare(int opcode, CiKind kind, Value x, Value y, Graph graph) {
-        super(kind, opcode, x, y, INPUT_COUNT, SUCCESSOR_COUNT, graph);
-    }
-
-    @Override
-    public void accept(ValueVisitor v) {
-        v.visitCompare(this);
-    }
-
-    @Override
-    public void print(LogStream out) {
-        out.print(x()).
-            print(' ').
-            print(Bytecodes.operator(opcode)).
-            print(' ').
-            print(y());
-    }
-
-    @Override
-    public Node copy(Graph into) {
-        Compare x = new Compare(opcode, kind, null, null, into);
-        return x;
-    }
-}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/GraalCompiler/src/com/sun/c1x/ir/Materialize.java	Tue Jun 07 16:11:26 2011 +0200
@@ -0,0 +1,68 @@
+/*
+ * Copyright (c) 2009, 2011, 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.sun.c1x.ir;
+
+import com.oracle.graal.graph.*;
+import com.sun.c1x.debug.*;
+import com.sun.cri.bytecode.*;
+import com.sun.cri.ci.*;
+
+/**
+ * The {@code CompareOp} instruction represents comparisons such as equals, not equal, etc.
+ */
+public final class Materialize extends Binary {
+
+    private static final int INPUT_COUNT = 0;
+    private static final int SUCCESSOR_COUNT = 0;
+
+    /**
+     * Creates a new compare operation.
+     * @param opcode the bytecode opcode
+     * @param kind the result kind
+     * @param x the first input
+     * @param y the second input
+     */
+    public Materialize(int opcode, CiKind kind, Value x, Value y, Graph graph) {
+        super(kind, opcode, x, y, INPUT_COUNT, SUCCESSOR_COUNT, graph);
+    }
+
+    @Override
+    public void accept(ValueVisitor v) {
+        v.visitMaterialize(this);
+    }
+
+    @Override
+    public void print(LogStream out) {
+        out.print(x()).
+            print(' ').
+            print(Bytecodes.operator(opcode)).
+            print(' ').
+            print(y());
+    }
+
+    @Override
+    public Node copy(Graph into) {
+        Materialize x = new Materialize(opcode, kind, null, null, into);
+        return x;
+    }
+}
--- a/graal/GraalCompiler/src/com/sun/c1x/ir/ValueVisitor.java	Tue Jun 07 15:59:08 2011 +0200
+++ b/graal/GraalCompiler/src/com/sun/c1x/ir/ValueVisitor.java	Tue Jun 07 16:11:26 2011 +0200
@@ -35,7 +35,7 @@
     public abstract void visitArrayLength(ArrayLength i);
     public abstract void visitMerge(Merge i);
     public abstract void visitCheckCast(CheckCast i);
-    public abstract void visitCompare(Compare i);
+    public abstract void visitMaterialize(Materialize i);
     public abstract void visitConstant(Constant i);
     public abstract void visitConvert(Convert i);
     public abstract void visitExceptionObject(ExceptionObject i);
--- a/graal/GraalCompiler/src/com/sun/c1x/target/amd64/AMD64LIRGenerator.java	Tue Jun 07 15:59:08 2011 +0200
+++ b/graal/GraalCompiler/src/com/sun/c1x/target/amd64/AMD64LIRGenerator.java	Tue Jun 07 16:11:26 2011 +0200
@@ -417,7 +417,7 @@
     }
 
     @Override
-    public void visitCompare(Compare x) {
+    public void visitMaterialize(Materialize x) {
         LIRItem left = new LIRItem(x.x(), this);
         LIRItem right = new LIRItem(x.y(), this);
         if (!x.kind.isVoid() && x.x().kind.isLong()) {