Mercurial > hg > graal-compiler
comparison graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/MethodCallTargetNode.java @ 18250:34cb95edfc97
MethodCallTargetNode: get profile from TypeProfileProxy if available.
author | Josef Eisl <josef.eisl@jku.at> |
---|---|
date | Tue, 04 Nov 2014 13:22:58 +0100 |
parents | 691e2b53dc63 |
children | 4a41f32ed552 |
comparison
equal
deleted
inserted
replaced
18249:e41787b05c98 | 18250:34cb95edfc97 |
---|---|
154 ResolvedJavaType single = receiverType.getSingleImplementor(); | 154 ResolvedJavaType single = receiverType.getSingleImplementor(); |
155 if (single != null && !single.equals(receiverType)) { | 155 if (single != null && !single.equals(receiverType)) { |
156 ResolvedJavaMethod newResolvedMethod = single.resolveMethod(targetMethod(), invoke().getContextType(), true); | 156 ResolvedJavaMethod newResolvedMethod = single.resolveMethod(targetMethod(), invoke().getContextType(), true); |
157 // TODO (je): we can not yet deal with default methods | 157 // TODO (je): we can not yet deal with default methods |
158 if (newResolvedMethod != null && !newResolvedMethod.isDefault()) { | 158 if (newResolvedMethod != null && !newResolvedMethod.isDefault()) { |
159 ProfilingInfo profilingInfo = invoke().getContextMethod().getProfilingInfo(); | 159 LogicNode condition = graph().unique(InstanceOfNode.create(single, receiver, getProfile())); |
160 JavaTypeProfile profile = profilingInfo.getTypeProfile(invoke().bci()); | |
161 LogicNode condition = graph().unique(InstanceOfNode.create(single, receiver, profile)); | |
162 assert graph().getGuardsStage().ordinal() < StructuredGraph.GuardsStage.FIXED_DEOPTS.ordinal() : "Graph already fixed!"; | 160 assert graph().getGuardsStage().ordinal() < StructuredGraph.GuardsStage.FIXED_DEOPTS.ordinal() : "Graph already fixed!"; |
163 GuardNode guard = graph().unique( | 161 GuardNode guard = graph().unique( |
164 GuardNode.create(condition, BeginNode.prevBegin(invoke().asNode()), DeoptimizationReason.OptimizedTypeCheckViolated, DeoptimizationAction.InvalidateRecompile, | 162 GuardNode.create(condition, BeginNode.prevBegin(invoke().asNode()), DeoptimizationReason.OptimizedTypeCheckViolated, DeoptimizationAction.InvalidateRecompile, |
165 false, JavaConstant.NULL_OBJECT)); | 163 false, JavaConstant.NULL_OBJECT)); |
166 PiNode piNode = graph().unique(PiNode.create(receiver, StampFactory.declared(single), guard)); | 164 PiNode piNode = graph().unique(PiNode.create(receiver, StampFactory.declared(single), guard)); |
171 } | 169 } |
172 } | 170 } |
173 } | 171 } |
174 } | 172 } |
175 | 173 |
174 private JavaTypeProfile getProfile() { | |
175 assert !isStatic(); | |
176 if (receiver() instanceof TypeProfileProxyNode) { | |
177 // get profile from TypeProfileProxy | |
178 return ((TypeProfileProxyNode) receiver()).getProfile(); | |
179 } | |
180 // get profile from invoke() | |
181 ProfilingInfo profilingInfo = invoke().getContextMethod().getProfilingInfo(); | |
182 return profilingInfo.getTypeProfile(invoke().bci()); | |
183 } | |
184 | |
176 @Override | 185 @Override |
177 public Stamp returnStamp() { | 186 public Stamp returnStamp() { |
178 Kind returnKind = targetMethod().getSignature().getReturnKind(); | 187 Kind returnKind = targetMethod().getSignature().getReturnKind(); |
179 if (returnKind == Kind.Object && returnType instanceof ResolvedJavaType) { | 188 if (returnKind == Kind.Object && returnType instanceof ResolvedJavaType) { |
180 return StampFactory.declared((ResolvedJavaType) returnType); | 189 return StampFactory.declared((ResolvedJavaType) returnType); |