Skip to content

Commit 772addf

Browse files
author
Vladimir Ivanov
committedDec 22, 2020
8258790: C2: Crash on empty macro node list
Reviewed-by: kvn, chagedorn
1 parent 8da7c58 commit 772addf

File tree

1 file changed

+4
-10
lines changed

1 file changed

+4
-10
lines changed
 

‎src/hotspot/share/opto/macro.cpp

+4-10
Original file line numberDiff line numberDiff line change
@@ -2563,11 +2563,8 @@ void PhaseMacroExpand::eliminate_macro_nodes() {
25632563
bool progress = true;
25642564
while (progress) {
25652565
progress = false;
2566-
for (int i = C->macro_count(); i > 0; i--) {
2567-
if (i > C->macro_count()) {
2568-
i = C->macro_count(); // more than 1 element can be eliminated at once
2569-
}
2570-
Node* n = C->macro_node(i-1);
2566+
for (int i = C->macro_count(); i > 0; i = MIN2(i - 1, C->macro_count())) { // more than 1 element can be eliminated at once
2567+
Node* n = C->macro_node(i - 1);
25712568
bool success = false;
25722569
DEBUG_ONLY(int old_macro_count = C->macro_count();)
25732570
if (n->is_AbstractLock()) {
@@ -2582,11 +2579,8 @@ void PhaseMacroExpand::eliminate_macro_nodes() {
25822579
progress = true;
25832580
while (progress) {
25842581
progress = false;
2585-
for (int i = C->macro_count(); i > 0; i--) {
2586-
if (i > C->macro_count()) {
2587-
i = C->macro_count(); // more than 1 element can be eliminated at once
2588-
}
2589-
Node* n = C->macro_node(i-1);
2582+
for (int i = C->macro_count(); i > 0; i = MIN2(i - 1, C->macro_count())) { // more than 1 element can be eliminated at once
2583+
Node* n = C->macro_node(i - 1);
25902584
bool success = false;
25912585
DEBUG_ONLY(int old_macro_count = C->macro_count();)
25922586
switch (n->class_id()) {

0 commit comments

Comments
 (0)
Please sign in to comment.