changeset 18254:01e268964aa4

Merge.
author Doug Simon <doug.simon@oracle.com>
date Wed, 05 Nov 2014 12:26:35 +0100
parents edb88f5425e6 (current diff) 34cb95edfc97 (diff)
children 415c79fefdb3
files
diffstat 2 files changed, 15 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/MethodCallTargetNode.java	Wed Nov 05 12:23:57 2014 +0100
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/MethodCallTargetNode.java	Wed Nov 05 12:26:35 2014 +0100
@@ -156,9 +156,7 @@
                     ResolvedJavaMethod newResolvedMethod = single.resolveMethod(targetMethod(), invoke().getContextType(), true);
                     // TODO (je): we can not yet deal with default methods
                     if (newResolvedMethod != null && !newResolvedMethod.isDefault()) {
-                        ProfilingInfo profilingInfo = invoke().getContextMethod().getProfilingInfo();
-                        JavaTypeProfile profile = profilingInfo.getTypeProfile(invoke().bci());
-                        LogicNode condition = graph().unique(InstanceOfNode.create(single, receiver, profile));
+                        LogicNode condition = graph().unique(InstanceOfNode.create(single, receiver, getProfile()));
                         assert graph().getGuardsStage().ordinal() < StructuredGraph.GuardsStage.FIXED_DEOPTS.ordinal() : "Graph already fixed!";
                         GuardNode guard = graph().unique(
                                         GuardNode.create(condition, BeginNode.prevBegin(invoke().asNode()), DeoptimizationReason.OptimizedTypeCheckViolated, DeoptimizationAction.InvalidateRecompile,
@@ -173,6 +171,17 @@
         }
     }
 
+    private JavaTypeProfile getProfile() {
+        assert !isStatic();
+        if (receiver() instanceof TypeProfileProxyNode) {
+            // get profile from TypeProfileProxy
+            return ((TypeProfileProxyNode) receiver()).getProfile();
+        }
+        // get profile from invoke()
+        ProfilingInfo profilingInfo = invoke().getContextMethod().getProfilingInfo();
+        return profilingInfo.getTypeProfile(invoke().bci());
+    }
+
     @Override
     public Stamp returnStamp() {
         Kind returnKind = targetMethod().getSignature().getReturnKind();
--- a/graal/com.oracle.graal.replacements.test/src/com/oracle/graal/replacements/test/StandardMethodSubstitutionsTest.java	Wed Nov 05 12:23:57 2014 +0100
+++ b/graal/com.oracle.graal.replacements.test/src/com/oracle/graal/replacements/test/StandardMethodSubstitutionsTest.java	Wed Nov 05 12:26:35 2014 +0100
@@ -74,10 +74,10 @@
             assertInGraph(graph, intrinsicClass);
         }
 
-        // Force compilation
-        InstalledCode code = getCode(testJavaMethod);
-        assert optional || code != null;
         for (Object l : args) {
+            // Force compilation
+            InstalledCode code = getCode(testJavaMethod);
+            assert optional || code != null;
             // Verify that the original method and the substitution produce the same value
             Object expected = invokeSafe(realJavaMethod, null, l);
             assertDeepEquals(expected, invokeSafe(testJavaMethod, null, l));