annotate graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/DeoptimizeNode.java @ 21400:33d3be2548d6

removed cache for intermediate graphs in ReplacementsImpl since graph building inlining is now used
author Doug Simon <doug.simon@oracle.com>
date Fri, 15 May 2015 13:45:06 +0200
parents 3e41eb69def4
children b1530a6cce8c
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1 /*
18187
9619ba4daf4c Rename Constant to JavaConstant.
Roland Schatz <roland.schatz@oracle.com>
parents: 17450
diff changeset
2 * Copyright (c) 2009, 2014, Oracle and/or its affiliates. All rights reserved.
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
4 *
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
5 * This code is free software; you can redistribute it and/or modify it
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
6 * under the terms of the GNU General Public License version 2 only, as
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
7 * published by the Free Software Foundation.
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
8 *
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
9 * This code is distributed in the hope that it will be useful, but WITHOUT
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
12 * version 2 for more details (a copy is included in the LICENSE file that
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
13 * accompanied this code).
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
14 *
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
15 * You should have received a copy of the GNU General Public License version
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
16 * 2 along with this work; if not, write to the Free Software Foundation,
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
18 *
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
20 * or visit www.oracle.com if you need additional information or have any
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
21 * questions.
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
22 */
5060
4ed4295ce15f Update import statements.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5059
diff changeset
23 package com.oracle.graal.nodes;
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
24
5507
dc71b06d09f8 Moving classes from cri.ri to api.meta.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5506
diff changeset
25 import com.oracle.graal.api.meta.*;
19647
3e41eb69def4 Give a debugId to DeoptimizeNodes that do not come from Guard lowering
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents: 19526
diff changeset
26 import com.oracle.graal.debug.*;
19396
7e2c87dae93e Create static final NodeClass field named TYPE in Node subclasses.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 18998
diff changeset
27 import com.oracle.graal.graph.*;
16841
cbd42807a31f moved NodeInfo and friends into separate com.oracle.graal.nodeinfo project so that annotation processor can be applied to the base Node class
Doug Simon <doug.simon@oracle.com>
parents: 16251
diff changeset
28 import com.oracle.graal.nodeinfo.*;
5060
4ed4295ce15f Update import statements.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5059
diff changeset
29 import com.oracle.graal.nodes.spi.*;
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
30
11947
47cd2df21903 Fix DeoptimizeNode @NodeInfo.
Andreas Woess <andreas.woess@jku.at>
parents: 11839
diff changeset
31 @NodeInfo(shortName = "Deopt", nameTemplate = "Deopt {p#reason/s}")
18998
ec0733b5a90a Allow final modifier on node subclasses and start adding the modifier to leaf classes.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 18845
diff changeset
32 public final class DeoptimizeNode extends AbstractDeoptimizeNode implements Lowerable, LIRLowerable {
19647
3e41eb69def4 Give a debugId to DeoptimizeNodes that do not come from Guard lowering
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents: 19526
diff changeset
33 public static final int DEFAULT_DEBUG_ID = 0;
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
34
19526
8fc336a04d77 Create TYPE fields for LIRInstruction and CompositeValue. Renaming NodeClass#get to NodeClass#create.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 19403
diff changeset
35 public static final NodeClass<DeoptimizeNode> TYPE = NodeClass.create(DeoptimizeNode.class);
17328
c9bb0da795d4 Backed out of changeset 17322:655f3e6b467b
Doug Simon <doug.simon@oracle.com>
parents: 17327
diff changeset
36 protected final DeoptimizationAction action;
c9bb0da795d4 Backed out of changeset 17322:655f3e6b467b
Doug Simon <doug.simon@oracle.com>
parents: 17327
diff changeset
37 protected final DeoptimizationReason reason;
c9bb0da795d4 Backed out of changeset 17322:655f3e6b467b
Doug Simon <doug.simon@oracle.com>
parents: 17327
diff changeset
38 protected final int debugId;
18187
9619ba4daf4c Rename Constant to JavaConstant.
Roland Schatz <roland.schatz@oracle.com>
parents: 17450
diff changeset
39 protected final JavaConstant speculation;
5105
95b8a32a7cc3 preparations to avoid endless recompilations because of not updated profiling information
Christian Haeubl <christian.haeubl@oracle.com>
parents: 5061
diff changeset
40
18845
f57d86eb036f removed Node factory methods
Doug Simon <doug.simon@oracle.com>
parents: 18490
diff changeset
41 public DeoptimizeNode(DeoptimizationAction action, DeoptimizationReason reason) {
19647
3e41eb69def4 Give a debugId to DeoptimizeNodes that do not come from Guard lowering
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents: 19526
diff changeset
42 this(action, reason, DEFAULT_DEBUG_ID, JavaConstant.NULL_POINTER, null);
12699
38b84d5a66fd Start passing down a 'speculation id' to deoptimizations.
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 12484
diff changeset
43 }
38b84d5a66fd Start passing down a 'speculation id' to deoptimizations.
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 12484
diff changeset
44
18845
f57d86eb036f removed Node factory methods
Doug Simon <doug.simon@oracle.com>
parents: 18490
diff changeset
45 public DeoptimizeNode(DeoptimizationAction action, DeoptimizationReason reason, int debugId, JavaConstant speculation, FrameState stateBefore) {
19396
7e2c87dae93e Create static final NodeClass field named TYPE in Node subclasses.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 18998
diff changeset
46 super(TYPE, stateBefore);
12484
2d8a8980eda8 Canonicalize DynamicDeoptimize nodes back to Deoptimize when used with a constant reason&action
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 11959
diff changeset
47 assert action != null;
2d8a8980eda8 Canonicalize DynamicDeoptimize nodes back to Deoptimize when used with a constant reason&action
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 11959
diff changeset
48 assert reason != null;
13641
5a9afbf72714 Add a speculation oop for uncommon trap deoptimization. Save it in the SpeculationLog during deoptimization.
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 13125
diff changeset
49 assert speculation.getKind() == Kind.Object;
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
50 this.action = action;
5109
6766253384bf more preparations for disabling runtime feedback selectively based on deoptimization history
Christian Haeubl <christian.haeubl@oracle.com>
parents: 5105
diff changeset
51 this.reason = reason;
13641
5a9afbf72714 Add a speculation oop for uncommon trap deoptimization. Save it in the SpeculationLog during deoptimization.
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 13125
diff changeset
52 this.debugId = debugId;
5a9afbf72714 Add a speculation oop for uncommon trap deoptimization. Save it in the SpeculationLog during deoptimization.
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 13125
diff changeset
53 this.speculation = speculation;
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
54 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
55
5547
b6617d13ea44 Dropping Ci* prefixes. Some additional renamings in the api.code interface.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5541
diff changeset
56 public DeoptimizationAction action() {
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
57 return action;
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
58 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
59
5541
b4c406861c33 More renamings to drop Ri* prefix completely. Deleted graph.BitMap class and replaced with java.util.BitSet.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5510
diff changeset
60 public DeoptimizationReason reason() {
5109
6766253384bf more preparations for disabling runtime feedback selectively based on deoptimization history
Christian Haeubl <christian.haeubl@oracle.com>
parents: 5105
diff changeset
61 return reason;
6766253384bf more preparations for disabling runtime feedback selectively based on deoptimization history
Christian Haeubl <christian.haeubl@oracle.com>
parents: 5105
diff changeset
62 }
6766253384bf more preparations for disabling runtime feedback selectively based on deoptimization history
Christian Haeubl <christian.haeubl@oracle.com>
parents: 5105
diff changeset
63
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
64 @Override
13125
c65150049959 Allow DeoptimizeNode and UnwindNode to be lowered
Christian Wimmer <christian.wimmer@oracle.com>
parents: 12757
diff changeset
65 public void lower(LoweringTool tool) {
c65150049959 Allow DeoptimizeNode and UnwindNode to be lowered
Christian Wimmer <christian.wimmer@oracle.com>
parents: 12757
diff changeset
66 tool.getLowerer().lower(this, tool);
c65150049959 Allow DeoptimizeNode and UnwindNode to be lowered
Christian Wimmer <christian.wimmer@oracle.com>
parents: 12757
diff changeset
67 }
c65150049959 Allow DeoptimizeNode and UnwindNode to be lowered
Christian Wimmer <christian.wimmer@oracle.com>
parents: 12757
diff changeset
68
19647
3e41eb69def4 Give a debugId to DeoptimizeNodes that do not come from Guard lowering
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents: 19526
diff changeset
69 @SuppressWarnings("deprecation")
3e41eb69def4 Give a debugId to DeoptimizeNodes that do not come from Guard lowering
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents: 19526
diff changeset
70 public int getDebugId() {
3e41eb69def4 Give a debugId to DeoptimizeNodes that do not come from Guard lowering
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents: 19526
diff changeset
71 int deoptDebugId = debugId;
3e41eb69def4 Give a debugId to DeoptimizeNodes that do not come from Guard lowering
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents: 19526
diff changeset
72 if (deoptDebugId == DEFAULT_DEBUG_ID && (Debug.isDumpEnabledForMethod() || Debug.isLogEnabledForMethod())) {
3e41eb69def4 Give a debugId to DeoptimizeNodes that do not come from Guard lowering
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents: 19526
diff changeset
73 deoptDebugId = this.getId();
3e41eb69def4 Give a debugId to DeoptimizeNodes that do not come from Guard lowering
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents: 19526
diff changeset
74 }
3e41eb69def4 Give a debugId to DeoptimizeNodes that do not come from Guard lowering
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents: 19526
diff changeset
75 return deoptDebugId;
3e41eb69def4 Give a debugId to DeoptimizeNodes that do not come from Guard lowering
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents: 19526
diff changeset
76 }
3e41eb69def4 Give a debugId to DeoptimizeNodes that do not come from Guard lowering
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents: 19526
diff changeset
77
13125
c65150049959 Allow DeoptimizeNode and UnwindNode to be lowered
Christian Wimmer <christian.wimmer@oracle.com>
parents: 12757
diff changeset
78 @Override
14950
d5a1206e1923 NodeLIRBuilderTool: fix typo in interface name.
Josef Eisl <josef.eisl@jku.at>
parents: 14888
diff changeset
79 public void generate(NodeLIRBuilderTool gen) {
19647
3e41eb69def4 Give a debugId to DeoptimizeNodes that do not come from Guard lowering
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents: 19526
diff changeset
80 gen.getLIRGeneratorTool().emitDeoptimize(gen.getLIRGeneratorTool().getMetaAccess().encodeDeoptActionAndReason(action, reason, getDebugId()), speculation, gen.state(this));
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
81 }
4547
a3cdfa2be94e Allow to intrinsify an invoke with a deoptimize node. Make debug output more relaxed wrt to null in FrameMap.method
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3733
diff changeset
82
11839
0e2cceed1caf Temporarily move encodeDeoptActionAndReason to MetaAccessProvider
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 11836
diff changeset
83 @Override
11959
23ccaa863eda made CodeCacheProvider independent of MetaAccessProvider (GRAAL-511)
Doug Simon <doug.simon@oracle.com>
parents: 11947
diff changeset
84 public ValueNode getActionAndReason(MetaAccessProvider metaAccess) {
19647
3e41eb69def4 Give a debugId to DeoptimizeNodes that do not come from Guard lowering
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents: 19526
diff changeset
85 return ConstantNode.forConstant(metaAccess.encodeDeoptActionAndReason(action, reason, getDebugId()), metaAccess, graph());
13641
5a9afbf72714 Add a speculation oop for uncommon trap deoptimization. Save it in the SpeculationLog during deoptimization.
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 13125
diff changeset
86 }
5a9afbf72714 Add a speculation oop for uncommon trap deoptimization. Save it in the SpeculationLog during deoptimization.
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 13125
diff changeset
87
5a9afbf72714 Add a speculation oop for uncommon trap deoptimization. Save it in the SpeculationLog during deoptimization.
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 13125
diff changeset
88 @Override
5a9afbf72714 Add a speculation oop for uncommon trap deoptimization. Save it in the SpeculationLog during deoptimization.
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 13125
diff changeset
89 public ValueNode getSpeculation(MetaAccessProvider metaAccess) {
5a9afbf72714 Add a speculation oop for uncommon trap deoptimization. Save it in the SpeculationLog during deoptimization.
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 13125
diff changeset
90 return ConstantNode.forConstant(speculation, metaAccess, graph());
11839
0e2cceed1caf Temporarily move encodeDeoptActionAndReason to MetaAccessProvider
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 11836
diff changeset
91 }
0e2cceed1caf Temporarily move encodeDeoptActionAndReason to MetaAccessProvider
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 11836
diff changeset
92
18187
9619ba4daf4c Rename Constant to JavaConstant.
Roland Schatz <roland.schatz@oracle.com>
parents: 17450
diff changeset
93 public JavaConstant getSpeculation() {
13668
a5206a3b92f2 UseTrappingNullChecksPhase: do not use trapping null check for a reason which is not null check or has an attached speculation
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 13641
diff changeset
94 return speculation;
a5206a3b92f2 UseTrappingNullChecksPhase: do not use trapping null check for a reason which is not null check or has an attached speculation
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 13641
diff changeset
95 }
a5206a3b92f2 UseTrappingNullChecksPhase: do not use trapping null check for a reason which is not null check or has an attached speculation
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 13641
diff changeset
96
4547
a3cdfa2be94e Allow to intrinsify an invoke with a deoptimize node. Make debug output more relaxed wrt to null in FrameMap.method
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3733
diff changeset
97 @NodeIntrinsic
7556
630ea5001e33 Modified formatter settings to not insert line break after annotation on parameters.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 7530
diff changeset
98 public static native void deopt(@ConstantNodeParameter DeoptimizationAction action, @ConstantNodeParameter DeoptimizationReason reason);
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
99 }