Skip to content
Permalink
Browse files
8261037: [lworld] Assert during C2 compilation due to inconsistent JV…
…MState at safepoint
  • Loading branch information
TobiHartmann committed Feb 5, 2021
1 parent 33dc4fb commit ce486c327f9d5fb69cbf02fa9e0da1075bcad0d0
Showing 3 changed files with 32 additions and 5 deletions.
@@ -196,8 +196,6 @@ int InlineTypeBaseNode::make_scalar_in_safepoint(PhaseIterGVN* igvn, Unique_Node
ciInlineKlass* vk = inline_klass();
uint nfields = vk->nof_nonstatic_fields();
JVMState* jvms = sfpt->jvms();
int start = jvms->debug_start();
int end = jvms->debug_end();
// Replace safepoint edge by SafePointScalarObjectNode and add field values
assert(jvms != NULL, "missing JVMS");
uint first_ind = (sfpt->req() - jvms->scloff());
@@ -221,7 +219,7 @@ int InlineTypeBaseNode::make_scalar_in_safepoint(PhaseIterGVN* igvn, Unique_Node
jvms->set_endoff(sfpt->req());
sobj = igvn->transform(sobj)->as_SafePointScalarObject();
igvn->rehash_node_delayed(sfpt);
return sfpt->replace_edges_in_range(this, sobj, start, end);
return sfpt->replace_edges_in_range(this, sobj, jvms->debug_start(), jvms->debug_end());
}

void InlineTypeBaseNode::make_scalar_in_safepoints(PhaseIterGVN* igvn, bool allow_oop) {
@@ -217,7 +217,6 @@ public abstract class InlineTypeTest {
protected static final String COUNTEDLOOP = START + "CountedLoop\\b" + MID + "" + END;
protected static final String COUNTEDLOOP_MAIN = START + "CountedLoop\\b" + MID + "main" + END;
protected static final String TRAP = START + "CallStaticJava" + MID + "uncommon_trap.*(unstable_if|predicate)" + END;
protected static final String RETURN = START + "Return" + MID + "returns" + END;
protected static final String LINKTOSTATIC = START + "CallStaticJava" + MID + "linkToStatic" + END;
protected static final String NPE = START + "CallStaticJava" + MID + "null_check" + END;
protected static final String CALL = START + "CallStaticJava" + MID + END;
@@ -23,7 +23,7 @@

/**
* @test
* @bug 8260034 8260225 8260283
* @bug 8260034 8260225 8260283 8261037
* @summary Generated inline type tests.
* @run main/othervm -Xbatch compiler.valhalla.inlinetypes.TestGenerated
*/
@@ -39,6 +39,12 @@ inline class MyValue1 {
int[] array = new int[1];
}

inline class MyValue2 {
int[] a = new int[1];
int[] b = new int[6];
int[] c = new int[5];
}

public class TestGenerated {
EmptyValue f1 = new EmptyValue();
EmptyValue f2 = new EmptyValue();
@@ -89,6 +95,29 @@ void test6() {
}
}

MyValue2 f5;

void test7(boolean b) {
MyValue2[] array1 = {new MyValue2(), new MyValue2(), new MyValue2(),
new MyValue2(), new MyValue2(), new MyValue2()};
MyValue2 h = new MyValue2();
MyValue2 n = new MyValue2();
int[] array2 = new int[1];

for (int i = 0; i < 10; ++i) {
for (int j = 0; j < 10; ++j) {
array1[0] = array1[0];
if (i == 1) {
h = h;
array2[0] *= 42;
}
}
}
if (b) {
f5 = n;
}
}

public static void main(String[] args) {
TestGenerated t = new TestGenerated();
EmptyValue[] array1 = { new EmptyValue() };
@@ -102,6 +131,7 @@ public static void main(String[] args) {
t.test4(array3);
t.test5(array3);
t.test6();
t.test7(false);
}
}
}

0 comments on commit ce486c3

Please sign in to comment.