Mercurial > hg > truffle
diff graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/InliningUtil.java @ 7660:0b646334c5f7
keep track of leafGraphIds only at the StructuredGraph level (see GRAAL-60)
author | Lukas Stadler <lukas.stadler@jku.at> |
---|---|
date | Fri, 01 Feb 2013 17:32:59 +0100 |
parents | 223f645acb9b |
children | 301cbb131b5d 96a596d751ab |
line wrap: on
line diff
--- a/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/InliningUtil.java Fri Feb 01 15:18:22 2013 +0100 +++ b/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/InliningUtil.java Fri Feb 01 17:32:59 2013 +0100 @@ -49,9 +49,9 @@ private static final String inliningDecisionsScopeString = "InliningDecisions"; /** - * Meters the size (in bytecodes) of all methods processed during compilation (i.e., top level and all - * inlined methods), irrespective of how many bytecodes in each method are actually parsed - * (which may be none for methods whose IR is retrieved from a cache). + * Meters the size (in bytecodes) of all methods processed during compilation (i.e., top level + * and all inlined methods), irrespective of how many bytecodes in each method are actually + * parsed (which may be none for methods whose IR is retrieved from a cache). */ public static final DebugMetric InlinedBytecodes = Debug.metric("InlinedBytecodes"); @@ -227,8 +227,8 @@ protected static void inline(Invoke invoke, ResolvedJavaMethod concrete, InliningCallback callback, Assumptions assumptions, boolean receiverNullCheck) { Class<? extends FixedWithNextNode> macroNodeClass = getMacroNodeClass(concrete); + StructuredGraph graph = (StructuredGraph) invoke.graph(); if (macroNodeClass != null) { - StructuredGraph graph = (StructuredGraph) invoke.graph(); FixedWithNextNode macroNode; try { macroNode = macroNodeClass.getConstructor(Invoke.class).newInstance(invoke); @@ -253,6 +253,10 @@ InlinedBytecodes.add(concrete.getCodeSize()); assumptions.recordMethodContents(concrete); InliningUtil.inline(invoke, calleeGraph, receiverNullCheck); + + graph.getLeafGraphIds().add(calleeGraph.graphId()); + // we might at some point cache already-inlined graphs, so add recursively: + graph.getLeafGraphIds().addAll(calleeGraph.getLeafGraphIds()); } } @@ -326,7 +330,7 @@ ConstantNode typeHub = ConstantNode.forConstant(type.getEncoding(Representation.ObjectHub), runtime, graph); LoadHubNode receiverHub = graph.add(new LoadHubNode(receiver, typeHub.kind())); CompareNode typeCheck = CompareNode.createCompareNode(Condition.EQ, receiverHub, typeHub); - FixedGuardNode guard = graph.add(new FixedGuardNode(typeCheck, DeoptimizationReason.TypeCheckedInliningViolated, DeoptimizationAction.InvalidateReprofile, invoke.leafGraphId())); + FixedGuardNode guard = graph.add(new FixedGuardNode(typeCheck, DeoptimizationReason.TypeCheckedInliningViolated, DeoptimizationAction.InvalidateReprofile)); ValueAnchorNode anchor = graph.add(new ValueAnchorNode()); assert invoke.predecessor() != null; @@ -444,7 +448,7 @@ if (shouldFallbackToInvoke()) { unknownTypeSux = createInvocationBlock(graph, invoke, returnMerge, returnValuePhi, exceptionMerge, exceptionObjectPhi, notRecordedTypeProbability, false); } else { - unknownTypeSux = graph.add(new DeoptimizeNode(DeoptimizationAction.InvalidateReprofile, DeoptimizationReason.TypeCheckedInliningViolated, invoke.leafGraphId())); + unknownTypeSux = graph.add(new DeoptimizeNode(DeoptimizationAction.InvalidateReprofile, DeoptimizationReason.TypeCheckedInliningViolated)); } successors[successors.length - 1] = BeginNode.begin(unknownTypeSux); @@ -549,7 +553,7 @@ LoadHubNode receiverHub = graph.add(new LoadHubNode(invoke.methodCallTarget().receiver(), hubKind)); graph.addBeforeFixed(invoke.node(), receiverHub); - BeginNode unknownTypeSux = BeginNode.begin(graph.add(new DeoptimizeNode(DeoptimizationAction.InvalidateReprofile, DeoptimizationReason.TypeCheckedInliningViolated, invoke.leafGraphId()))); + BeginNode unknownTypeSux = BeginNode.begin(graph.add(new DeoptimizeNode(DeoptimizationAction.InvalidateReprofile, DeoptimizationReason.TypeCheckedInliningViolated))); BeginNode[] successors = new BeginNode[]{calleeEntryNode, unknownTypeSux}; FixedNode dispatchOnType = createDispatchOnType(graph, receiverHub, successors); @@ -966,10 +970,8 @@ } } } - replacements.put(entryPointNode, BeginNode.prevBegin(invoke.node())); // ensure proper - // anchoring of things - // that were anchored - // to the StartNode + // ensure proper anchoring of things that were anchored to the StartNode + replacements.put(entryPointNode, BeginNode.prevBegin(invoke.node())); assert invoke.node().successors().first() != null : invoke; assert invoke.node().predecessor() != null; @@ -1001,7 +1003,7 @@ } else { if (unwindNode != null) { UnwindNode unwindDuplicate = (UnwindNode) duplicates.get(unwindNode); - DeoptimizeNode deoptimizeNode = new DeoptimizeNode(DeoptimizationAction.InvalidateRecompile, DeoptimizationReason.NotCompiledExceptionHandler, invoke.leafGraphId()); + DeoptimizeNode deoptimizeNode = new DeoptimizeNode(DeoptimizationAction.InvalidateRecompile, DeoptimizationReason.NotCompiledExceptionHandler); unwindDuplicate.replaceAndDelete(graph.add(deoptimizeNode)); // move the deopt upwards if there is a monitor exit that tries to use the // "after exception" frame state @@ -1091,8 +1093,8 @@ NodeInputList<ValueNode> parameters = callTarget.arguments(); ValueNode firstParam = parameters.size() <= 0 ? null : parameters.get(0); if (!callTarget.isStatic() && firstParam.kind() == Kind.Object && !firstParam.objectStamp().nonNull()) { - graph.addBeforeFixed(invoke.node(), graph.add(new FixedGuardNode(graph.unique(new IsNullNode(firstParam)), DeoptimizationReason.NullCheckException, - DeoptimizationAction.InvalidateReprofile, true, invoke.leafGraphId()))); + graph.addBeforeFixed(invoke.node(), + graph.add(new FixedGuardNode(graph.unique(new IsNullNode(firstParam)), DeoptimizationReason.NullCheckException, DeoptimizationAction.InvalidateReprofile, true))); } }