1.1 --- a/src/share/vm/opto/multnode.cpp Fri Oct 18 12:15:32 2013 -0700 1.2 +++ b/src/share/vm/opto/multnode.cpp Sat Oct 19 12:16:43 2013 +0200 1.3 @@ -24,6 +24,7 @@ 1.4 1.5 #include "precompiled.hpp" 1.6 #include "opto/callnode.hpp" 1.7 +#include "opto/cfgnode.hpp" 1.8 #include "opto/matcher.hpp" 1.9 #include "opto/mathexactnode.hpp" 1.10 #include "opto/multnode.hpp" 1.11 @@ -150,3 +151,59 @@ 1.12 uint ProjNode::ideal_reg() const { 1.13 return bottom_type()->ideal_reg(); 1.14 } 1.15 + 1.16 +//-------------------------------is_uncommon_trap_proj---------------------------- 1.17 +// Return true if proj is the form of "proj->[region->..]call_uct" 1.18 +bool ProjNode::is_uncommon_trap_proj(Deoptimization::DeoptReason reason) { 1.19 + int path_limit = 10; 1.20 + Node* out = this; 1.21 + for (int ct = 0; ct < path_limit; ct++) { 1.22 + out = out->unique_ctrl_out(); 1.23 + if (out == NULL) 1.24 + return false; 1.25 + if (out->is_CallStaticJava()) { 1.26 + int req = out->as_CallStaticJava()->uncommon_trap_request(); 1.27 + if (req != 0) { 1.28 + Deoptimization::DeoptReason trap_reason = Deoptimization::trap_request_reason(req); 1.29 + if (trap_reason == reason || reason == Deoptimization::Reason_none) { 1.30 + return true; 1.31 + } 1.32 + } 1.33 + return false; // don't do further after call 1.34 + } 1.35 + if (out->Opcode() != Op_Region) 1.36 + return false; 1.37 + } 1.38 + return false; 1.39 +} 1.40 + 1.41 +//-------------------------------is_uncommon_trap_if_pattern------------------------- 1.42 +// Return true for "if(test)-> proj -> ... 1.43 +// | 1.44 +// V 1.45 +// other_proj->[region->..]call_uct" 1.46 +// 1.47 +// "must_reason_predicate" means the uct reason must be Reason_predicate 1.48 +bool ProjNode::is_uncommon_trap_if_pattern(Deoptimization::DeoptReason reason) { 1.49 + Node *in0 = in(0); 1.50 + if (!in0->is_If()) return false; 1.51 + // Variation of a dead If node. 1.52 + if (in0->outcnt() < 2) return false; 1.53 + IfNode* iff = in0->as_If(); 1.54 + 1.55 + // we need "If(Conv2B(Opaque1(...)))" pattern for reason_predicate 1.56 + if (reason != Deoptimization::Reason_none) { 1.57 + if (iff->in(1)->Opcode() != Op_Conv2B || 1.58 + iff->in(1)->in(1)->Opcode() != Op_Opaque1) { 1.59 + return false; 1.60 + } 1.61 + } 1.62 + 1.63 + ProjNode* other_proj = iff->proj_out(1-_con)->as_Proj(); 1.64 + if (other_proj->is_uncommon_trap_proj(reason)) { 1.65 + assert(reason == Deoptimization::Reason_none || 1.66 + Compile::current()->is_predicate_opaq(iff->in(1)->in(1)), "should be on the list"); 1.67 + return true; 1.68 + } 1.69 + return false; 1.70 +}