24 25 #ifndef SHARE_VM_OPTO_REPLACEDNODES_HPP 26 #define SHARE_VM_OPTO_REPLACEDNODES_HPP 27 28 #include "opto/connode.hpp" 29 30 // During parsing, when a node is "improved", 31 // GraphKit::replace_in_map() is called to update the current map so 32 // that the improved node is used from that point 33 // on. GraphKit::replace_in_map() doesn't operate on the callers maps 34 // and so some optimization opportunities may be lost. The 35 // ReplacedNodes class addresses that problem. 36 // 37 // A ReplacedNodes object is a list of pair of nodes. Every 38 // SafePointNode carries a ReplacedNodes object. Every time 39 // GraphKit::replace_in_map() is called, a new pair of nodes is pushed 40 // on the list of replaced nodes. When control flow paths merge, their 41 // replaced nodes are also merged. When parsing exits a method to 42 // return to a caller, the replaced nodes on the exit path are used to 43 // update the caller's map. 44 class ReplacedNodes VALUE_OBJ_CLASS_SPEC { 45 private: 46 class ReplacedNode VALUE_OBJ_CLASS_SPEC { 47 private: 48 Node* _initial; 49 Node* _improved; 50 public: 51 ReplacedNode() : _initial(NULL), _improved(NULL) {} 52 ReplacedNode(Node* initial, Node* improved) : _initial(initial), _improved(improved) {} 53 Node* initial() const { return _initial; } 54 Node* improved() const { return _improved; } 55 56 bool operator==(const ReplacedNode& other) { 57 return _initial == other._initial && _improved == other._improved; 58 } 59 }; 60 GrowableArray<ReplacedNode>* _replaced_nodes; 61 62 void allocate_if_necessary(); 63 bool has_node(const ReplacedNode& r) const; 64 bool has_target_node(Node* n) const; 65 66 public: | 24 25 #ifndef SHARE_VM_OPTO_REPLACEDNODES_HPP 26 #define SHARE_VM_OPTO_REPLACEDNODES_HPP 27 28 #include "opto/connode.hpp" 29 30 // During parsing, when a node is "improved", 31 // GraphKit::replace_in_map() is called to update the current map so 32 // that the improved node is used from that point 33 // on. GraphKit::replace_in_map() doesn't operate on the callers maps 34 // and so some optimization opportunities may be lost. The 35 // ReplacedNodes class addresses that problem. 36 // 37 // A ReplacedNodes object is a list of pair of nodes. Every 38 // SafePointNode carries a ReplacedNodes object. Every time 39 // GraphKit::replace_in_map() is called, a new pair of nodes is pushed 40 // on the list of replaced nodes. When control flow paths merge, their 41 // replaced nodes are also merged. When parsing exits a method to 42 // return to a caller, the replaced nodes on the exit path are used to 43 // update the caller's map. 44 class ReplacedNodes { 45 private: 46 class ReplacedNode { 47 private: 48 Node* _initial; 49 Node* _improved; 50 public: 51 ReplacedNode() : _initial(NULL), _improved(NULL) {} 52 ReplacedNode(Node* initial, Node* improved) : _initial(initial), _improved(improved) {} 53 Node* initial() const { return _initial; } 54 Node* improved() const { return _improved; } 55 56 bool operator==(const ReplacedNode& other) { 57 return _initial == other._initial && _improved == other._improved; 58 } 59 }; 60 GrowableArray<ReplacedNode>* _replaced_nodes; 61 62 void allocate_if_necessary(); 63 bool has_node(const ReplacedNode& r) const; 64 bool has_target_node(Node* n) const; 65 66 public: |