changeset 11407:821ed0a436f2

Merge.
author Doug Simon <doug.simon@oracle.com>
date Fri, 23 Aug 2013 17:18:47 +0200
parents 1688781c0238 (diff) 2d228d304247 (current diff)
children e25ad41a95e7
files mx/commands.py
diffstat 8 files changed, 86 insertions(+), 14 deletions(-) [+]
line wrap: on
line diff
--- a/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/GraalCompilerTest.java	Fri Aug 23 16:35:46 2013 +0200
+++ b/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/GraalCompilerTest.java	Fri Aug 23 17:18:47 2013 +0200
@@ -354,11 +354,11 @@
         if (runtime == null) {
             return;
         }
-        test(method, expect, receiver, args);
+        testAgainstExpected(method, expect, receiver, args);
     }
 
-    protected void test(Method method, Result expect, Object receiver, Object... args) {
-        test(method, expect, Collections.<DeoptimizationReason> emptySet(), receiver, args);
+    protected void testAgainstExpected(Method method, Result expect, Object receiver, Object... args) {
+        testAgainstExpected(method, expect, Collections.<DeoptimizationReason> emptySet(), receiver, args);
     }
 
     protected Result executeActualCheckDeopt(Method method, Set<DeoptimizationReason> shouldNotDeopt, Object receiver, Object... args) {
@@ -390,7 +390,7 @@
         }
     }
 
-    protected void test(Method method, Result expect, Set<DeoptimizationReason> shouldNotDeopt, Object receiver, Object... args) {
+    protected void testAgainstExpected(Method method, Result expect, Set<DeoptimizationReason> shouldNotDeopt, Object receiver, Object... args) {
         Result actual = executeActualCheckDeopt(method, shouldNotDeopt, receiver, args);
         assertEquals(expect, actual);
     }
--- a/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/JTTTest.java	Fri Aug 23 16:35:46 2013 +0200
+++ b/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/JTTTest.java	Fri Aug 23 17:18:47 2013 +0200
@@ -103,10 +103,10 @@
 
         Result expect = executeExpected(method, receiver, args);
 
-        test(method, expect, shouldNotDeopt, receiver, args);
+        testAgainstExpected(method, expect, shouldNotDeopt, receiver, args);
         if (args.length > 0) {
             this.argsToBind = args;
-            test(method, expect, shouldNotDeopt, receiver, args);
+            testAgainstExpected(method, expect, shouldNotDeopt, receiver, args);
             this.argsToBind = null;
         }
     }
--- a/graal/com.oracle.graal.lir.amd64/src/com/oracle/graal/lir/amd64/AMD64AddressValue.java	Fri Aug 23 16:35:46 2013 +0200
+++ b/graal/com.oracle.graal.lir.amd64/src/com/oracle/graal/lir/amd64/AMD64AddressValue.java	Fri Aug 23 17:18:47 2013 +0200
@@ -32,7 +32,7 @@
 import com.oracle.graal.lir.*;
 import com.oracle.graal.lir.LIRInstruction.OperandFlag;
 
-public class AMD64AddressValue extends CompositeValue {
+public final class AMD64AddressValue extends CompositeValue {
 
     private static final long serialVersionUID = -4444600052487578694L;
 
--- a/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/CompositeValueClass.java	Fri Aug 23 16:35:46 2013 +0200
+++ b/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/CompositeValueClass.java	Fri Aug 23 17:18:47 2013 +0200
@@ -26,10 +26,18 @@
 import java.util.*;
 
 import com.oracle.graal.graph.*;
+import com.oracle.graal.lir.CompositeValue.Component;
 import com.oracle.graal.lir.LIRInstruction.OperandFlag;
 import com.oracle.graal.lir.LIRInstruction.OperandMode;
 import com.oracle.graal.lir.LIRInstruction.ValueProcedure;
 
+/**
+ * Lazily associated metadata for every {@link CompositeValue} type. The metadata includes:
+ * <ul>
+ * <li>The offsets of fields annotated with {@link Component} as well as methods for iterating over
+ * such fields.</li>
+ * </ul>
+ */
 public class CompositeValueClass extends LIRIntrospection {
 
     public static final CompositeValueClass get(Class<? extends CompositeValue> c) {
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/CompositeValueClassSubstitutions.java	Fri Aug 23 17:18:47 2013 +0200
@@ -0,0 +1,63 @@
+/*
+ * Copyright (c) 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.oracle.graal.replacements;
+
+import static com.oracle.graal.phases.GraalOptions.*;
+
+import com.oracle.graal.api.meta.*;
+import com.oracle.graal.api.replacements.*;
+import com.oracle.graal.lir.*;
+import com.oracle.graal.nodes.*;
+import com.oracle.graal.nodes.spi.*;
+import com.oracle.graal.replacements.nodes.*;
+
+/**
+ * Substitutions for improving the performance of {@link CompositeValueClass#getClass()}.
+ */
+@ClassSubstitution(CompositeValueClass.class)
+public class CompositeValueClassSubstitutions {
+
+    /**
+     * A macro node for calls to {@link CompositeValueClass#get(Class)}. It can use the compiler's
+     * knowledge about node classes to replace itself with a constant value for a constant
+     * {@link Class} parameter.
+     */
+    public static class CompositeValueClassGetNode extends PureFunctionMacroNode {
+
+        public CompositeValueClassGetNode(Invoke invoke) {
+            super(invoke);
+        }
+
+        @SuppressWarnings("unchecked")
+        @Override
+        protected Constant evaluate(Constant param, MetaAccessProvider metaAccess) {
+            if (param.isNull() || AOTCompilation.getValue()) {
+                return null;
+            }
+            return Constant.forObject(CompositeValueClass.get((Class<? extends CompositeValue>) param.asObject()));
+        }
+    }
+
+    @MacroSubstitution(isStatic = true, forced = true, macro = CompositeValueClassGetNode.class)
+    private static native CompositeValueClass get(Class<?> c);
+}
--- a/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/GraalMethodSubstitutions.java	Fri Aug 23 16:35:46 2013 +0200
+++ b/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/GraalMethodSubstitutions.java	Fri Aug 23 17:18:47 2013 +0200
@@ -45,10 +45,11 @@
             replacements.registerSubstitutions(MathSubstitutionsX86.class);
             replacements.registerSubstitutions(DoubleSubstitutions.class);
             replacements.registerSubstitutions(FloatSubstitutions.class);
-            replacements.registerSubstitutions(NodeClassSubstitutions.class);
             replacements.registerSubstitutions(LongSubstitutions.class);
             replacements.registerSubstitutions(IntegerSubstitutions.class);
             replacements.registerSubstitutions(UnsignedMathSubstitutions.class);
+            replacements.registerSubstitutions(NodeClassSubstitutions.class);
+            replacements.registerSubstitutions(CompositeValueClassSubstitutions.class);
         }
     }
 }
--- a/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/ReplacementsImpl.java	Fri Aug 23 16:35:46 2013 +0200
+++ b/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/ReplacementsImpl.java	Fri Aug 23 17:18:47 2013 +0200
@@ -61,7 +61,7 @@
     // These data structures are all fully initialized during single-threaded
     // compiler startup and so do not need to be concurrent.
     private final Map<ResolvedJavaMethod, ResolvedJavaMethod> registeredMethodSubstitutions;
-    private final Map<ResolvedJavaMethod, Class<? extends FixedWithNextNode>> registerMacroSubstitutions;
+    private final Map<ResolvedJavaMethod, Class<? extends FixedWithNextNode>> registeredMacroSubstitutions;
     private final Set<ResolvedJavaMethod> forcedSubstitutions;
     private final Map<Class<? extends SnippetTemplateCache>, SnippetTemplateCache> snippetTemplateCache;
 
@@ -71,7 +71,7 @@
         this.assumptions = assumptions;
         this.graphs = new ConcurrentHashMap<>();
         this.registeredMethodSubstitutions = new HashMap<>();
-        this.registerMacroSubstitutions = new HashMap<>();
+        this.registeredMacroSubstitutions = new HashMap<>();
         this.forcedSubstitutions = new HashSet<>();
         this.snippetTemplateCache = new HashMap<>();
     }
@@ -103,7 +103,7 @@
     }
 
     public Class<? extends FixedWithNextNode> getMacroSubstitution(ResolvedJavaMethod method) {
-        return registerMacroSubstitutions.get(method);
+        return registeredMacroSubstitutions.get(method);
     }
 
     public Assumptions getAssumptions() {
@@ -192,7 +192,7 @@
         } else {
             originalJavaMethod = runtime.lookupJavaConstructor((Constructor) originalMethod);
         }
-        registerMacroSubstitutions.put(originalJavaMethod, macro);
+        registeredMacroSubstitutions.put(originalJavaMethod, macro);
         return originalJavaMethod;
     }
 
@@ -502,7 +502,7 @@
     public Collection<ResolvedJavaMethod> getAllReplacements() {
         HashSet<ResolvedJavaMethod> result = new HashSet<>();
         result.addAll(registeredMethodSubstitutions.keySet());
-        result.addAll(registerMacroSubstitutions.keySet());
+        result.addAll(registeredMacroSubstitutions.keySet());
         return result;
     }
 
--- a/mx/commands.py	Fri Aug 23 16:35:46 2013 +0200
+++ b/mx/commands.py	Fri Aug 23 17:18:47 2013 +0200
@@ -761,7 +761,7 @@
     vmArgs, tests = _extract_VM_args(args)
     for t in tests:
         if t.startswith('-'):
-            mx.abort('VM option ' + t + ' must precede first test name')
+            mx.abort('VM option ' + t + ' must precede ' + tests[0])
 
     def containsAny(c, substrings):
         for s in substrings: