< prev index next >

src/hotspot/share/opto/rootnode.cpp

Print this page

13  * accompanied this code).
14  *
15  * You should have received a copy of the GNU General Public License version
16  * 2 along with this work; if not, write to the Free Software Foundation,
17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18  *
19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20  * or visit www.oracle.com if you need additional information or have any
21  * questions.
22  *
23  */
24 
25 #include "memory/allocation.inline.hpp"
26 #include "opto/callnode.hpp"
27 #include "opto/cfgnode.hpp"
28 #include "opto/phaseX.hpp"
29 #include "opto/regmask.hpp"
30 #include "opto/rootnode.hpp"
31 #include "opto/subnode.hpp"
32 #include "opto/type.hpp"

33 
34 //------------------------------Ideal------------------------------------------
35 // Remove dead inputs
36 Node *RootNode::Ideal(PhaseGVN *phase, bool can_reshape) {
37   bool modified = false;
38   for( uint i = 1; i < req(); i++ ) { // For all inputs
39     // Check for and remove dead inputs
40     if( phase->type(in(i)) == Type::TOP ) {
41       del_req(i--);             // Delete TOP inputs
42       modified = true;
43     }
44   }
45 
46   // I used to do tail-splitting in the Ideal graph here, but it does not
47   // work.  The tail-splitting forces values live into the Return to be
48   // ready at a point which dominates the split returns.  This forces Stores
49   // to be hoisted high.  The "proper" fix would be to split Stores down
50   // each path, but this makes the split unprofitable.  If we want to do this
51   // optimization, it needs to be done after allocation so we can count all
52   // the instructions needing to be cloned in the cost metric.
53 
54   // There used to be a spoof here for caffeine marks which completely
55   // eliminated very simple self-recursion recursions, but it's not worth it.
56   // Deep inlining of self-calls gets nearly all of the same benefits.
57   // If we want to get the rest of the win later, we should pattern match
58   // simple recursive call trees to closed-form solutions.
59 
60   return modified ? this : nullptr;
61 }
62 
63 //=============================================================================
64 HaltNode::HaltNode(Node* ctrl, Node* frameptr, const char* halt_reason, bool reachable)
65                         : Node(TypeFunc::Parms), _halt_reason(halt_reason), _reachable(reachable) {
66   init_class_id(Class_Halt);
67   Node* top = Compile::current()->top();
68   init_req(TypeFunc::Control,  ctrl        );
69   init_req(TypeFunc::I_O,      top);
70   init_req(TypeFunc::Memory,   top);
71   init_req(TypeFunc::FramePtr, frameptr    );
72   init_req(TypeFunc::ReturnAdr,top);

73 }
74 
75 const Type *HaltNode::bottom_type() const { return Type::BOTTOM; }
76 uint HaltNode::size_of() const { return sizeof(*this); }
77 
78 //------------------------------Ideal------------------------------------------
79 Node *HaltNode::Ideal(PhaseGVN *phase, bool can_reshape) {
80   return remove_dead_region(phase, can_reshape) ? this : nullptr;
81 }
82 
83 //------------------------------Value------------------------------------------
84 const Type* HaltNode::Value(PhaseGVN* phase) const {
85   return ( phase->type(in(TypeFunc::Control)) == Type::TOP)
86     ? Type::TOP
87     : Type::BOTTOM;
88 }
89 
90 const RegMask &HaltNode::out_RegMask() const {
91   return RegMask::Empty;
92 }

13  * accompanied this code).
14  *
15  * You should have received a copy of the GNU General Public License version
16  * 2 along with this work; if not, write to the Free Software Foundation,
17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18  *
19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20  * or visit www.oracle.com if you need additional information or have any
21  * questions.
22  *
23  */
24 
25 #include "memory/allocation.inline.hpp"
26 #include "opto/callnode.hpp"
27 #include "opto/cfgnode.hpp"
28 #include "opto/phaseX.hpp"
29 #include "opto/regmask.hpp"
30 #include "opto/rootnode.hpp"
31 #include "opto/subnode.hpp"
32 #include "opto/type.hpp"
33 #include "code/SCCache.hpp"
34 
35 //------------------------------Ideal------------------------------------------
36 // Remove dead inputs
37 Node *RootNode::Ideal(PhaseGVN *phase, bool can_reshape) {
38   bool modified = false;
39   for( uint i = 1; i < req(); i++ ) { // For all inputs
40     // Check for and remove dead inputs
41     if( phase->type(in(i)) == Type::TOP ) {
42       del_req(i--);             // Delete TOP inputs
43       modified = true;
44     }
45   }
46 
47   // I used to do tail-splitting in the Ideal graph here, but it does not
48   // work.  The tail-splitting forces values live into the Return to be
49   // ready at a point which dominates the split returns.  This forces Stores
50   // to be hoisted high.  The "proper" fix would be to split Stores down
51   // each path, but this makes the split unprofitable.  If we want to do this
52   // optimization, it needs to be done after allocation so we can count all
53   // the instructions needing to be cloned in the cost metric.
54 
55   // There used to be a spoof here for caffeine marks which completely
56   // eliminated very simple self-recursion recursions, but it's not worth it.
57   // Deep inlining of self-calls gets nearly all of the same benefits.
58   // If we want to get the rest of the win later, we should pattern match
59   // simple recursive call trees to closed-form solutions.
60 
61   return modified ? this : nullptr;
62 }
63 
64 //=============================================================================
65 HaltNode::HaltNode(Node* ctrl, Node* frameptr, const char* halt_reason, bool reachable)
66                         : Node(TypeFunc::Parms), _halt_reason(halt_reason), _reachable(reachable) {
67   init_class_id(Class_Halt);
68   Node* top = Compile::current()->top();
69   init_req(TypeFunc::Control,  ctrl        );
70   init_req(TypeFunc::I_O,      top);
71   init_req(TypeFunc::Memory,   top);
72   init_req(TypeFunc::FramePtr, frameptr    );
73   init_req(TypeFunc::ReturnAdr,top);
74   SCCache::add_C_string(halt_reason);
75 }
76 
77 const Type *HaltNode::bottom_type() const { return Type::BOTTOM; }
78 uint HaltNode::size_of() const { return sizeof(*this); }
79 
80 //------------------------------Ideal------------------------------------------
81 Node *HaltNode::Ideal(PhaseGVN *phase, bool can_reshape) {
82   return remove_dead_region(phase, can_reshape) ? this : nullptr;
83 }
84 
85 //------------------------------Value------------------------------------------
86 const Type* HaltNode::Value(PhaseGVN* phase) const {
87   return ( phase->type(in(TypeFunc::Control)) == Type::TOP)
88     ? Type::TOP
89     : Type::BOTTOM;
90 }
91 
92 const RegMask &HaltNode::out_RegMask() const {
93   return RegMask::Empty;
94 }
< prev index next >