Mercurial > hg > truffle
comparison graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/InstanceOfSnippets.java @ 11959:23ccaa863eda
made CodeCacheProvider independent of MetaAccessProvider (GRAAL-511)
author | Doug Simon <doug.simon@oracle.com> |
---|---|
date | Thu, 10 Oct 2013 16:14:55 +0200 |
parents | 0e2cceed1caf |
children | 0fc653a9e019 |
comparison
equal
deleted
inserted
replaced
11958:a0f5be106e67 | 11959:23ccaa863eda |
---|---|
198 private final SnippetInfo instanceofExact = snippet(InstanceOfSnippets.class, "instanceofExact"); | 198 private final SnippetInfo instanceofExact = snippet(InstanceOfSnippets.class, "instanceofExact"); |
199 private final SnippetInfo instanceofPrimary = snippet(InstanceOfSnippets.class, "instanceofPrimary"); | 199 private final SnippetInfo instanceofPrimary = snippet(InstanceOfSnippets.class, "instanceofPrimary"); |
200 private final SnippetInfo instanceofSecondary = snippet(InstanceOfSnippets.class, "instanceofSecondary"); | 200 private final SnippetInfo instanceofSecondary = snippet(InstanceOfSnippets.class, "instanceofSecondary"); |
201 private final SnippetInfo instanceofDynamic = snippet(InstanceOfSnippets.class, "instanceofDynamic"); | 201 private final SnippetInfo instanceofDynamic = snippet(InstanceOfSnippets.class, "instanceofDynamic"); |
202 | 202 |
203 public Templates(CodeCacheProvider runtime, Replacements replacements, TargetDescription target) { | 203 public Templates(MetaAccessProvider metaAccess, GraalCodeCacheProvider codeCache, Replacements replacements, TargetDescription target) { |
204 super(runtime, replacements, target); | 204 super(metaAccess, codeCache, replacements, target); |
205 } | 205 } |
206 | 206 |
207 @Override | 207 @Override |
208 protected Arguments makeArguments(InstanceOfUsageReplacer replacer, LoweringTool tool) { | 208 protected Arguments makeArguments(InstanceOfUsageReplacer replacer, LoweringTool tool) { |
209 if (replacer.instanceOf instanceof InstanceOfNode) { | 209 if (replacer.instanceOf instanceof InstanceOfNode) { |
210 InstanceOfNode instanceOf = (InstanceOfNode) replacer.instanceOf; | 210 InstanceOfNode instanceOf = (InstanceOfNode) replacer.instanceOf; |
211 ValueNode object = instanceOf.object(); | 211 ValueNode object = instanceOf.object(); |
212 TypeCheckHints hintInfo = new TypeCheckHints(instanceOf.type(), instanceOf.profile(), tool.assumptions(), InstanceOfMinHintHitProbability.getValue(), InstanceOfMaxHints.getValue()); | 212 TypeCheckHints hintInfo = new TypeCheckHints(instanceOf.type(), instanceOf.profile(), tool.assumptions(), InstanceOfMinHintHitProbability.getValue(), InstanceOfMaxHints.getValue()); |
213 final HotSpotResolvedObjectType type = (HotSpotResolvedObjectType) instanceOf.type(); | 213 final HotSpotResolvedObjectType type = (HotSpotResolvedObjectType) instanceOf.type(); |
214 ConstantNode hub = ConstantNode.forConstant(type.klass(), runtime, instanceOf.graph()); | 214 ConstantNode hub = ConstantNode.forConstant(type.klass(), metaAccess, instanceOf.graph()); |
215 | 215 |
216 Arguments args; | 216 Arguments args; |
217 | 217 |
218 StructuredGraph graph = hub.graph(); | 218 StructuredGraph graph = hub.graph(); |
219 if (hintInfo.hintHitProbability >= hintHitProbabilityThresholdForDeoptimizingSnippet()) { | 219 if (hintInfo.hintHitProbability >= hintHitProbabilityThresholdForDeoptimizingSnippet()) { |
220 Hints hints = createHints(hintInfo, runtime, false, graph); | 220 Hints hints = createHints(hintInfo, metaAccess, false, graph); |
221 args = new Arguments(instanceofWithProfile, graph.getGuardsStage()); | 221 args = new Arguments(instanceofWithProfile, graph.getGuardsStage()); |
222 args.add("object", object); | 222 args.add("object", object); |
223 args.addVarargs("hints", Word.class, StampFactory.forKind(wordKind()), hints.hubs); | 223 args.addVarargs("hints", Word.class, StampFactory.forKind(wordKind()), hints.hubs); |
224 args.addVarargs("hintIsPositive", boolean.class, StampFactory.forKind(Kind.Boolean), hints.isPositive); | 224 args.addVarargs("hintIsPositive", boolean.class, StampFactory.forKind(Kind.Boolean), hints.isPositive); |
225 } else if (hintInfo.exact != null) { | 225 } else if (hintInfo.exact != null) { |
226 args = new Arguments(instanceofExact, graph.getGuardsStage()); | 226 args = new Arguments(instanceofExact, graph.getGuardsStage()); |
227 args.add("object", object); | 227 args.add("object", object); |
228 args.add("exactHub", ConstantNode.forConstant(((HotSpotResolvedObjectType) hintInfo.exact).klass(), runtime, graph)); | 228 args.add("exactHub", ConstantNode.forConstant(((HotSpotResolvedObjectType) hintInfo.exact).klass(), metaAccess, graph)); |
229 } else if (type.isPrimaryType()) { | 229 } else if (type.isPrimaryType()) { |
230 args = new Arguments(instanceofPrimary, graph.getGuardsStage()); | 230 args = new Arguments(instanceofPrimary, graph.getGuardsStage()); |
231 args.add("hub", hub); | 231 args.add("hub", hub); |
232 args.add("object", object); | 232 args.add("object", object); |
233 args.addConst("superCheckOffset", type.superCheckOffset()); | 233 args.addConst("superCheckOffset", type.superCheckOffset()); |
234 } else { | 234 } else { |
235 Hints hints = createHints(hintInfo, runtime, false, graph); | 235 Hints hints = createHints(hintInfo, metaAccess, false, graph); |
236 args = new Arguments(instanceofSecondary, graph.getGuardsStage()); | 236 args = new Arguments(instanceofSecondary, graph.getGuardsStage()); |
237 args.add("hub", hub); | 237 args.add("hub", hub); |
238 args.add("object", object); | 238 args.add("object", object); |
239 args.addVarargs("hints", Word.class, StampFactory.forKind(getWordKind()), hints.hubs); | 239 args.addVarargs("hints", Word.class, StampFactory.forKind(getWordKind()), hints.hubs); |
240 args.addVarargs("hintIsPositive", boolean.class, StampFactory.forKind(Kind.Boolean), hints.isPositive); | 240 args.addVarargs("hintIsPositive", boolean.class, StampFactory.forKind(Kind.Boolean), hints.isPositive); |