提交 17531575 编写于 作者: R roland

8174164: SafePointNode::_replaced_nodes breaks with irreducible loops

Reviewed-by: kvn
上级 929d2d38
...@@ -449,8 +449,8 @@ public: ...@@ -449,8 +449,8 @@ public:
void delete_replaced_nodes() { void delete_replaced_nodes() {
_replaced_nodes.reset(); _replaced_nodes.reset();
} }
void apply_replaced_nodes() { void apply_replaced_nodes(uint idx) {
_replaced_nodes.apply(this); _replaced_nodes.apply(this, idx);
} }
void merge_replaced_nodes_with(SafePointNode* sfpt) { void merge_replaced_nodes_with(SafePointNode* sfpt) {
_replaced_nodes.merge_with(sfpt->_replaced_nodes); _replaced_nodes.merge_with(sfpt->_replaced_nodes);
......
...@@ -1048,7 +1048,7 @@ void Parse::do_exits() { ...@@ -1048,7 +1048,7 @@ void Parse::do_exits() {
kit.make_dtrace_method_exit(method()); kit.make_dtrace_method_exit(method());
} }
if (_replaced_nodes_for_exceptions) { if (_replaced_nodes_for_exceptions) {
kit.map()->apply_replaced_nodes(); kit.map()->apply_replaced_nodes(_new_idx);
} }
// Done with exception-path processing. // Done with exception-path processing.
ex_map = kit.make_exception_state(ex_oop); ex_map = kit.make_exception_state(ex_oop);
...@@ -1069,7 +1069,7 @@ void Parse::do_exits() { ...@@ -1069,7 +1069,7 @@ void Parse::do_exits() {
_exits.add_exception_state(ex_map); _exits.add_exception_state(ex_map);
} }
} }
_exits.map()->apply_replaced_nodes(); _exits.map()->apply_replaced_nodes(_new_idx);
} }
//-----------------------------create_entry_map------------------------------- //-----------------------------create_entry_map-------------------------------
......
...@@ -91,14 +91,18 @@ void ReplacedNodes::reset() { ...@@ -91,14 +91,18 @@ void ReplacedNodes::reset() {
} }
// Perfom node replacement (used when returning to caller) // Perfom node replacement (used when returning to caller)
void ReplacedNodes::apply(Node* n) { void ReplacedNodes::apply(Node* n, uint idx) {
if (is_empty()) { if (is_empty()) {
return; return;
} }
for (int i = 0; i < _replaced_nodes->length(); i++) { for (int i = 0; i < _replaced_nodes->length(); i++) {
ReplacedNode replaced = _replaced_nodes->at(i); ReplacedNode replaced = _replaced_nodes->at(i);
// Only apply if improved node was created in a callee to avoid
// issues with irreducible loops in the caller
if (replaced.improved()->_idx >= idx) {
n->replace_edge(replaced.initial(), replaced.improved()); n->replace_edge(replaced.initial(), replaced.improved());
} }
}
} }
static void enqueue_use(Node* n, Node* use, Unique_Node_List& work) { static void enqueue_use(Node* n, Node* use, Unique_Node_List& work) {
......
...@@ -71,7 +71,7 @@ class ReplacedNodes VALUE_OBJ_CLASS_SPEC { ...@@ -71,7 +71,7 @@ class ReplacedNodes VALUE_OBJ_CLASS_SPEC {
void record(Node* initial, Node* improved); void record(Node* initial, Node* improved);
void transfer_from(const ReplacedNodes& other, uint idx); void transfer_from(const ReplacedNodes& other, uint idx);
void reset(); void reset();
void apply(Node* n); void apply(Node* n, uint idx);
void merge_with(const ReplacedNodes& other); void merge_with(const ReplacedNodes& other);
bool is_empty() const; bool is_empty() const;
void dump(outputStream *st) const; void dump(outputStream *st) const;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册