changeset 7389:d7c1266a26c7

Merge.
author Christian Haeubl <haeubl@ssw.jku.at>
date Mon, 07 Jan 2013 08:39:06 +0100
parents 599ea4fcdb6d (diff) f9f40467383e (current diff)
children fab5b68be2d6
files graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/DirectReadNode.java graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/DirectStoreNode.java graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/snippets/UnsafeSnippets.java graal/com.oracle.graal.lir.amd64/src/com/oracle/graal/lir/amd64/AMD64BitScanOp.java graal/com.oracle.graal.snippets/src/com/oracle/graal/snippets/SnippetVerificationPhase.java graal/com.oracle.graal.snippets/src/com/oracle/graal/snippets/Word.java graal/com.oracle.graal.snippets/src/com/oracle/graal/snippets/WordTypeRewriterPhase.java
diffstat 6 files changed, 90 insertions(+), 40 deletions(-) [+]
line wrap: on
line diff
--- a/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/inlining/InliningTest.java	Fri Jan 04 15:08:18 2013 -0800
+++ b/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/inlining/InliningTest.java	Mon Jan 07 08:39:06 2013 +0100
@@ -93,6 +93,8 @@
         assertInlined(getGraph("invokeSingleImplementorInterfaceSnippet"));
 //        assertInlined(getGraph("invokeConcreteInterfaceMethodSnippet"));
 
+        assertNotInlined(getGraph("invokeOverriddenPublicMethodSnippet"));
+        assertNotInlined(getGraph("invokeOverriddenProtectedMethodSnippet"));
         assertNotInlined(getGraph("invokeOverriddenInterfaceMethodSnippet"));
     }
 
@@ -120,6 +122,14 @@
     public static int invokeOverriddenInterfaceMethodSnippet(MultipleImplementorsInterface testInterface) {
         return testInterface.publicOverriddenMethod();
     }
+    @SuppressWarnings("all")
+    public static int invokeOverriddenPublicMethodSnippet(SuperClass superClass) {
+        return superClass.publicOverriddenMethod();
+    }
+    @SuppressWarnings("all")
+    public static int invokeOverriddenProtectedMethodSnippet(SuperClass superClass) {
+        return superClass.protectedOverriddenMethod();
+    }
 
     private StructuredGraph getGraph(final String snippet) {
         return Debug.scope("InliningTest", new DebugDumpScope(snippet), new Callable<StructuredGraph>() {
--- a/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/InliningPhase.java	Fri Jan 04 15:08:18 2013 -0800
+++ b/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/InliningPhase.java	Mon Jan 07 08:39:06 2013 +0100
@@ -248,6 +248,10 @@
     private static class BytecodeSizeBasedWeightComputationPolicy implements WeightComputationPolicy {
         @Override
         public double computeWeight(ResolvedJavaMethod caller, ResolvedJavaMethod method, Invoke invoke, boolean preferredInvoke) {
+            if (GraalOptions.AlwaysInlineIntrinsics && InliningUtil.canIntrinsify(method)) {
+                return 0;
+            }
+
             double codeSize = method.getCodeSize();
             if (preferredInvoke) {
                 codeSize = codeSize / GraalOptions.BoostInliningForEscapeAnalysis;
@@ -259,6 +263,10 @@
     private static class ComplexityBasedWeightComputationPolicy implements WeightComputationPolicy {
         @Override
         public double computeWeight(ResolvedJavaMethod caller, ResolvedJavaMethod method, Invoke invoke, boolean preferredInvoke) {
+            if (GraalOptions.AlwaysInlineIntrinsics && InliningUtil.canIntrinsify(method)) {
+                return 0;
+            }
+
             double complexity = method.getCompilationComplexity();
             if (preferredInvoke) {
                 complexity = complexity / GraalOptions.BoostInliningForEscapeAnalysis;
@@ -270,6 +278,10 @@
     private static class CompiledCodeSizeWeightComputationPolicy implements WeightComputationPolicy {
         @Override
         public double computeWeight(ResolvedJavaMethod caller, ResolvedJavaMethod method, Invoke invoke, boolean preferredInvoke) {
+            if (GraalOptions.AlwaysInlineIntrinsics && InliningUtil.canIntrinsify(method)) {
+                return 0;
+            }
+
             int compiledCodeSize = method.getCompiledCodeSize();
             return compiledCodeSize > 0 ? compiledCodeSize : method.getCodeSize() * 10;
         }
--- a/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/InliningUtil.java	Fri Jan 04 15:08:18 2013 -0800
+++ b/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/InliningUtil.java	Mon Jan 07 08:39:06 2013 +0100
@@ -200,11 +200,11 @@
             return computeInliningLevel(invoke);
         }
 
-        protected static StructuredGraph getGraph(final Invoke invoke, final ResolvedJavaMethod concrete, final InliningCallback callback) {
+        protected static StructuredGraph getGraph(final ResolvedJavaMethod concrete, final InliningCallback callback) {
             return Debug.scope("GetInliningGraph", concrete, new Callable<StructuredGraph>() {
                 @Override
                 public StructuredGraph call() throws Exception {
-                    StructuredGraph result = getIntrinsicGraph(invoke, concrete);
+                    StructuredGraph result = getIntrinsicGraph(concrete);
                     if (result == null) {
                         assert !Modifier.isNative(concrete.getModifiers());
                         result = callback.buildGraph(concrete);
@@ -229,14 +229,14 @@
 
         @Override
         public void inline(StructuredGraph compilerGraph, GraalCodeCacheProvider runtime, InliningCallback callback, Assumptions assumptions) {
-            StructuredGraph graph = getGraph(invoke, concrete, callback);
+            StructuredGraph graph = getGraph(concrete, callback);
             assumptions.recordMethodContents(concrete);
             InliningUtil.inline(invoke, graph, true);
         }
 
         @Override
         public int compiledCodeSize() {
-            return concrete.getCompiledCodeSize();
+            return InliningUtil.compiledCodeSize(concrete);
         }
 
         @Override
@@ -261,7 +261,7 @@
 
         @Override
         public int compiledCodeSize() {
-            return concrete.getCompiledCodeSize();
+            return InliningUtil.compiledCodeSize(concrete);
         }
 
         @Override
@@ -283,7 +283,7 @@
             graph.addBeforeFixed(invoke.node(), guard);
             graph.addBeforeFixed(invoke.node(), anchor);
 
-            StructuredGraph calleeGraph = getGraph(invoke, concrete, callback);
+            StructuredGraph calleeGraph = getGraph(concrete, callback);
             assumptions.recordMethodContents(concrete);
             InliningUtil.inline(invoke, calleeGraph, false);
         }
@@ -320,7 +320,7 @@
         public int compiledCodeSize() {
             int result = 0;
             for (ResolvedJavaMethod m: concretes) {
-                result += m.getCompiledCodeSize();
+                result += InliningUtil.compiledCodeSize(m);
             }
             return result;
         }
@@ -410,7 +410,7 @@
             StructuredGraph[] calleeGraphs = new StructuredGraph[numberOfMethods];
             for (int i = 0; i < numberOfMethods; i++) {
                 ResolvedJavaMethod concrete = concretes.get(i);
-                calleeGraphs[i] = getGraph(invoke, concrete, callback);
+                calleeGraphs[i] = getGraph(concrete, callback);
                 assumptions.recordMethodContents(concrete);
             }
 
@@ -512,7 +512,7 @@
             calleeEntryNode.setNext(invoke.node());
 
             ResolvedJavaMethod concrete = concretes.get(0);
-            StructuredGraph calleeGraph = getGraph(invoke, concrete, callback);
+            StructuredGraph calleeGraph = getGraph(concrete, callback);
             assumptions.recordMethodContents(concrete);
             InliningUtil.inline(invoke, calleeGraph, false);
         }
@@ -799,7 +799,7 @@
             ProfiledType ptype = types[i];
             ResolvedJavaType type = ptype.getType();
             assert !type.isInterface() && (type.isArray() || !Modifier.isAbstract(type.getModifiers())) : type;
-            if (holder.isAssignableFrom(type)) {
+            if (!GraalOptions.OptFilterProfiledTypes || holder.isAssignableFrom(type)) {
                 result.add(ptype);
             }
         }
@@ -836,7 +836,7 @@
     private static boolean checkTargetConditions(Invoke invoke, ResolvedJavaMethod method, OptimisticOptimizations optimisticOpts) {
         if (method == null) {
             return logNotInlinedMethodAndReturnFalse(invoke, method, "the method is not resolved");
-        } else if (Modifier.isNative(method.getModifiers()) && (!GraalOptions.Intrinsify || !InliningUtil.canIntrinsify(invoke, method))) {
+        } else if (Modifier.isNative(method.getModifiers()) && (!GraalOptions.Intrinsify || !InliningUtil.canIntrinsify(method))) {
             return logNotInlinedMethodAndReturnFalse(invoke, method, "it is a non-intrinsic native method");
         } else if (Modifier.isAbstract(method.getModifiers())) {
             return logNotInlinedMethodAndReturnFalse(invoke, method, "it is an abstract method");
@@ -1030,12 +1030,19 @@
         }
     }
 
-    public static boolean canIntrinsify(Invoke invoke, ResolvedJavaMethod target) {
-        return getIntrinsicGraph(invoke, target) != null;
+    public static boolean canIntrinsify(ResolvedJavaMethod target) {
+        return getIntrinsicGraph(target) != null;
+    }
+
+    public static StructuredGraph getIntrinsicGraph(ResolvedJavaMethod target) {
+        return (StructuredGraph) target.getCompilerStorage().get(Graph.class);
     }
 
-    public static StructuredGraph getIntrinsicGraph(Invoke invoke, ResolvedJavaMethod target) {
-        assert invoke.node().isAlive();
-        return (StructuredGraph) target.getCompilerStorage().get(Graph.class);
+    private static int compiledCodeSize(ResolvedJavaMethod target) {
+        if (GraalOptions.AlwaysInlineIntrinsics && canIntrinsify(target)) {
+            return 0;
+        } else {
+            return target.getCompiledCodeSize();
+        }
     }
 }
--- a/graal/com.oracle.graal.phases/src/com/oracle/graal/phases/GraalOptions.java	Fri Jan 04 15:08:18 2013 -0800
+++ b/graal/com.oracle.graal.phases/src/com/oracle/graal/phases/GraalOptions.java	Mon Jan 07 08:39:06 2013 +0100
@@ -39,6 +39,7 @@
 
     // inlining settings
     public static boolean Inline                             = true;
+    public static boolean AlwaysInlineIntrinsics             = ____;
     public static boolean Intrinsify                         = true;
            static boolean InlineMonomorphicCalls             = true;
            static boolean InlinePolymorphicCalls             = true;
@@ -198,6 +199,7 @@
     public static boolean OptFloatingReads                   = true;
     public static boolean OptTailDuplication                 = true;
     public static boolean OptEliminatePartiallyRedundantGuards = true;
+    public static boolean OptFilterProfiledTypes             = true;
 
     // Intrinsification settings
     public static boolean IntrinsifyArrayCopy                = true;
--- a/src/cpu/x86/vm/graalRuntime_x86.cpp	Fri Jan 04 15:08:18 2013 -0800
+++ b/src/cpu/x86/vm/graalRuntime_x86.cpp	Mon Jan 07 08:39:06 2013 +0100
@@ -188,25 +188,46 @@
 
 int GraalStubAssembler::call_RT(Register oop_result1, Register metadata_result, address entry, Register arg1, Register arg2, Register arg3, Register arg4) {
 #ifdef _LP64
-  // if there is any conflict use the stack
-  if (arg1 == c_rarg2 || arg1 == c_rarg3 || arg1 == c_rarg4 ||
-      arg2 == c_rarg1 || arg2 == c_rarg3 || arg2 == c_rarg4 ||
-      arg3 == c_rarg1 || arg3 == c_rarg2 || arg3 == c_rarg4 ||
-      arg4 == c_rarg1 || arg4 == c_rarg2 || arg4 == c_rarg3) {
-    push(arg4);
-    push(arg3);
-    push(arg2);
-    push(arg1);
-    pop(c_rarg1);
-    pop(c_rarg2);
-    pop(c_rarg3);
-    pop(c_rarg4);
-  } else {
-    mov(c_rarg1, arg1);
-    mov(c_rarg2, arg2);
-    mov(c_rarg3, arg3);
-    mov(c_rarg4, arg4);
-  }
+  #ifdef _WIN64
+    // on windows we only have the registers c_rarg0 to c_rarg3 for transferring parameters -> remaining parameters are on the stack
+    if (arg1 == c_rarg2 || arg1 == c_rarg3 || 
+        arg2 == c_rarg1 || arg2 == c_rarg3 || 
+        arg3 == c_rarg1 || arg3 == c_rarg2 || 
+        arg4 == c_rarg1 || arg4 == c_rarg2) {
+      push(arg4);
+      push(arg3);
+      push(arg2);
+      push(arg1);
+      pop(c_rarg1);
+      pop(c_rarg2);
+      pop(c_rarg3);
+    } else {
+      mov(c_rarg1, arg1);
+      mov(c_rarg2, arg2);
+      mov(c_rarg3, arg3);
+      push(arg4);
+    }
+  #else
+    // if there is any conflict use the stack
+    if (arg1 == c_rarg2 || arg1 == c_rarg3 || arg1 == c_rarg4 ||
+        arg2 == c_rarg1 || arg2 == c_rarg3 || arg2 == c_rarg4 ||
+        arg3 == c_rarg1 || arg3 == c_rarg2 || arg3 == c_rarg4 ||
+        arg4 == c_rarg1 || arg4 == c_rarg2 || arg4 == c_rarg3) {
+      push(arg4);
+      push(arg3);
+      push(arg2);
+      push(arg1);
+      pop(c_rarg1);
+      pop(c_rarg2);
+      pop(c_rarg3);
+      pop(c_rarg4);
+    } else {
+      mov(c_rarg1, arg1);
+      mov(c_rarg2, arg2);
+      mov(c_rarg3, arg3);
+      mov(c_rarg4, arg4);
+    }
+  #endif
 #else
   push(arg4);
   push(arg3);
--- a/src/share/vm/graal/graalRuntime.cpp	Fri Jan 04 15:08:18 2013 -0800
+++ b/src/share/vm/graal/graalRuntime.cpp	Mon Jan 07 08:39:06 2013 +0100
@@ -588,11 +588,9 @@
 JRT_ENTRY(jboolean, GraalRuntime::graal_thread_is_interrupted(JavaThread* thread, oop receiver, jboolean clear_interrupted))
   // Ensure that the C++ Thread and OSThread structures aren't freed before we operate
   Handle receiverHandle(thread, receiver);
-  JRT_BLOCK
-    MutexLockerEx ml(thread->threadObj() == receiver ? NULL : Threads_lock);
-    JavaThread* receiverThread = java_lang_Thread::thread(receiverHandle());
-    return (jint) Thread::is_interrupted(receiverThread, clear_interrupted != 0);
-  JRT_BLOCK_END
+  MutexLockerEx ml(thread->threadObj() == receiver ? NULL : Threads_lock);
+  JavaThread* receiverThread = java_lang_Thread::thread(receiverHandle());
+  return (jint) Thread::is_interrupted(receiverThread, clear_interrupted != 0);
 JRT_END
 
 // JVM_InitializeGraalRuntime