Mercurial > hg > graal-compiler
comparison graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/MethodCallTargetNode.java @ 19250:8ab925a6f724
made Assumptions be part of a StructuredGraph
author | Doug Simon <doug.simon@oracle.com> |
---|---|
date | Wed, 11 Feb 2015 10:13:08 +0100 |
parents | 0b05bd821399 |
children | a0a760b0fb5f |
comparison
equal
deleted
inserted
replaced
19249:ec8402f4e00a | 19250:8ab925a6f724 |
---|---|
92 } else { | 92 } else { |
93 return super.toString(verbosity); | 93 return super.toString(verbosity); |
94 } | 94 } |
95 } | 95 } |
96 | 96 |
97 public static ResolvedJavaMethod findSpecialCallTarget(InvokeKind invokeKind, ValueNode receiver, ResolvedJavaMethod targetMethod, Assumptions assumptions, ResolvedJavaType contextType) { | 97 public static ResolvedJavaMethod findSpecialCallTarget(InvokeKind invokeKind, ValueNode receiver, ResolvedJavaMethod targetMethod, ResolvedJavaType contextType) { |
98 if (targetMethod.getName().equals("getProperties") && receiver.graph().method().getDeclaringClass().getName().equals("Ljava/lang/Character;")) { | |
99 System.console(); | |
100 } | |
101 | |
98 if (invokeKind.isDirect()) { | 102 if (invokeKind.isDirect()) { |
99 return null; | 103 return null; |
100 } | 104 } |
101 | 105 |
102 // check for trivial cases (e.g. final methods, nonvirtual methods) | 106 // check for trivial cases (e.g. final methods, nonvirtual methods) |
117 */ | 121 */ |
118 ResolvedJavaMethod resolvedMethod = type.resolveConcreteMethod(targetMethod, contextType); | 122 ResolvedJavaMethod resolvedMethod = type.resolveConcreteMethod(targetMethod, contextType); |
119 if (resolvedMethod != null && (resolvedMethod.canBeStaticallyBound() || StampTool.isExactType(receiver) || type.isArray())) { | 123 if (resolvedMethod != null && (resolvedMethod.canBeStaticallyBound() || StampTool.isExactType(receiver) || type.isArray())) { |
120 return resolvedMethod; | 124 return resolvedMethod; |
121 } | 125 } |
122 if (assumptions != null && assumptions.useOptimisticAssumptions()) { | 126 Assumptions assumptions = receiver.graph().getAssumptions(); |
127 if (assumptions.useOptimisticAssumptions()) { | |
123 ResolvedJavaType uniqueConcreteType = type.findUniqueConcreteSubtype(); | 128 ResolvedJavaType uniqueConcreteType = type.findUniqueConcreteSubtype(); |
124 if (uniqueConcreteType != null) { | 129 if (uniqueConcreteType != null) { |
125 ResolvedJavaMethod methodFromUniqueType = uniqueConcreteType.resolveConcreteMethod(targetMethod, contextType); | 130 ResolvedJavaMethod methodFromUniqueType = uniqueConcreteType.resolveConcreteMethod(targetMethod, contextType); |
126 if (methodFromUniqueType != null) { | 131 if (methodFromUniqueType != null) { |
127 assumptions.recordConcreteSubtype(type, uniqueConcreteType); | 132 assumptions.recordConcreteSubtype(type, uniqueConcreteType); |
142 | 147 |
143 @Override | 148 @Override |
144 public void simplify(SimplifierTool tool) { | 149 public void simplify(SimplifierTool tool) { |
145 // attempt to devirtualize the call | 150 // attempt to devirtualize the call |
146 ResolvedJavaType contextType = (invoke().stateAfter() == null && invoke().stateDuring() == null) ? null : invoke().getContextType(); | 151 ResolvedJavaType contextType = (invoke().stateAfter() == null && invoke().stateDuring() == null) ? null : invoke().getContextType(); |
147 ResolvedJavaMethod specialCallTarget = findSpecialCallTarget(invokeKind, receiver(), targetMethod, tool.assumptions(), contextType); | 152 ResolvedJavaMethod specialCallTarget = findSpecialCallTarget(invokeKind, receiver(), targetMethod, contextType); |
148 if (specialCallTarget != null) { | 153 if (specialCallTarget != null) { |
149 this.setTargetMethod(specialCallTarget); | 154 this.setTargetMethod(specialCallTarget); |
150 setInvokeKind(InvokeKind.Special); | 155 setInvokeKind(InvokeKind.Special); |
151 return; | 156 return; |
152 } | 157 } |