comparison src/share/vm/opto/multnode.cpp @ 14422:2b8e28fdf503

Merge
author kvn
date Tue, 05 Nov 2013 17:38:04 -0800
parents 3213ba4d3dff
children de6a9e811145
comparison
equal deleted inserted replaced
14421:3068270ba476 14422:2b8e28fdf503
22 * 22 *
23 */ 23 */
24 24
25 #include "precompiled.hpp" 25 #include "precompiled.hpp"
26 #include "opto/callnode.hpp" 26 #include "opto/callnode.hpp"
27 #include "opto/cfgnode.hpp"
27 #include "opto/matcher.hpp" 28 #include "opto/matcher.hpp"
29 #include "opto/mathexactnode.hpp"
28 #include "opto/multnode.hpp" 30 #include "opto/multnode.hpp"
29 #include "opto/opcodes.hpp" 31 #include "opto/opcodes.hpp"
30 #include "opto/phaseX.hpp" 32 #include "opto/phaseX.hpp"
31 #include "opto/regmask.hpp" 33 #include "opto/regmask.hpp"
32 #include "opto/type.hpp" 34 #include "opto/type.hpp"
44 ProjNode* MultiNode::proj_out(uint which_proj) const { 46 ProjNode* MultiNode::proj_out(uint which_proj) const {
45 assert(Opcode() != Op_If || which_proj == (uint)true || which_proj == (uint)false, "must be 1 or 0"); 47 assert(Opcode() != Op_If || which_proj == (uint)true || which_proj == (uint)false, "must be 1 or 0");
46 assert(Opcode() != Op_If || outcnt() == 2, "bad if #1"); 48 assert(Opcode() != Op_If || outcnt() == 2, "bad if #1");
47 for( DUIterator_Fast imax, i = fast_outs(imax); i < imax; i++ ) { 49 for( DUIterator_Fast imax, i = fast_outs(imax); i < imax; i++ ) {
48 Node *p = fast_out(i); 50 Node *p = fast_out(i);
49 if( !p->is_Proj() ) { 51 if (p->is_Proj()) {
52 ProjNode *proj = p->as_Proj();
53 if (proj->_con == which_proj) {
54 assert(Opcode() != Op_If || proj->Opcode() == (which_proj?Op_IfTrue:Op_IfFalse), "bad if #2");
55 return proj;
56 }
57 } else if (p->is_FlagsProj()) {
58 FlagsProjNode *proj = p->as_FlagsProj();
59 if (proj->_con == which_proj) {
60 return proj;
61 }
62 } else {
50 assert(p == this && this->is_Start(), "else must be proj"); 63 assert(p == this && this->is_Start(), "else must be proj");
51 continue; 64 continue;
52 }
53 ProjNode *proj = p->as_Proj();
54 if( proj->_con == which_proj ) {
55 assert(Opcode() != Op_If || proj->Opcode() == (which_proj?Op_IfTrue:Op_IfFalse), "bad if #2");
56 return proj;
57 } 65 }
58 } 66 }
59 return NULL; 67 return NULL;
60 } 68 }
61 69
141 149
142 //------------------------------ideal_reg-------------------------------------- 150 //------------------------------ideal_reg--------------------------------------
143 uint ProjNode::ideal_reg() const { 151 uint ProjNode::ideal_reg() const {
144 return bottom_type()->ideal_reg(); 152 return bottom_type()->ideal_reg();
145 } 153 }
154
155 //-------------------------------is_uncommon_trap_proj----------------------------
156 // Return true if proj is the form of "proj->[region->..]call_uct"
157 bool ProjNode::is_uncommon_trap_proj(Deoptimization::DeoptReason reason) {
158 int path_limit = 10;
159 Node* out = this;
160 for (int ct = 0; ct < path_limit; ct++) {
161 out = out->unique_ctrl_out();
162 if (out == NULL)
163 return false;
164 if (out->is_CallStaticJava()) {
165 int req = out->as_CallStaticJava()->uncommon_trap_request();
166 if (req != 0) {
167 Deoptimization::DeoptReason trap_reason = Deoptimization::trap_request_reason(req);
168 if (trap_reason == reason || reason == Deoptimization::Reason_none) {
169 return true;
170 }
171 }
172 return false; // don't do further after call
173 }
174 if (out->Opcode() != Op_Region)
175 return false;
176 }
177 return false;
178 }
179
180 //-------------------------------is_uncommon_trap_if_pattern-------------------------
181 // Return true for "if(test)-> proj -> ...
182 // |
183 // V
184 // other_proj->[region->..]call_uct"
185 //
186 // "must_reason_predicate" means the uct reason must be Reason_predicate
187 bool ProjNode::is_uncommon_trap_if_pattern(Deoptimization::DeoptReason reason) {
188 Node *in0 = in(0);
189 if (!in0->is_If()) return false;
190 // Variation of a dead If node.
191 if (in0->outcnt() < 2) return false;
192 IfNode* iff = in0->as_If();
193
194 // we need "If(Conv2B(Opaque1(...)))" pattern for reason_predicate
195 if (reason != Deoptimization::Reason_none) {
196 if (iff->in(1)->Opcode() != Op_Conv2B ||
197 iff->in(1)->in(1)->Opcode() != Op_Opaque1) {
198 return false;
199 }
200 }
201
202 ProjNode* other_proj = iff->proj_out(1-_con)->as_Proj();
203 if (other_proj->is_uncommon_trap_proj(reason)) {
204 assert(reason == Deoptimization::Reason_none ||
205 Compile::current()->is_predicate_opaq(iff->in(1)->in(1)), "should be on the list");
206 return true;
207 }
208 return false;
209 }