Field inheritance for value classes is causing several issues to C2.
For instance:
public class AbstractCircularity {
static abstract value class AbstractBadField {
ConcreteBadField f = new ConcreteBadField();
}
static value class ConcreteBadField extends AbstractBadField {
int i = 0;
}
public static void main(String[] args) {
var c = new ConcreteBadField();
}
}
Run with -Xcomp -XX:-TieredCompilation, this program causes an assertion failure in CI:
# Internal Error (valhalla/open/src/hotspot/share/ci/ciInlineKlass.cpp:33), pid=648122, tid=648136
# assert(super() == nullptr || !super()->has_nonstatic_fields()) failed: an inline type must not inherit fields from its superclass
#
# JRE version: Java(TM) SE Runtime Environment (23.0) (fastdebug build 23-lworld5ea-2024-05-08-1319037.fred...)
# Java VM: Java HotSpot(TM) 64-Bit Server VM (fastdebug 23-lworld5ea-2024-05-08-1319037.fred..., compiled mode, compressed oops, compressed class ptrs, g1 gc, linux-amd64)
# Problematic frame:
# V [libjvm.so+0x90a087] ciInlineKlass::compute_nonstatic_fields()+0x207
This issue might be common to C1 and C2 as they share the CI implementation.
Trying to remove this assert causes C2 to crash on the following assert:
# Internal Error (valhalla/open/src/hotspot/share/opto/parse3.cpp:238), pid=703047, tid=703061
# assert(obj->as_InlineType()->is_larval()) failed: must be larval
#
# JRE version: Java(TM) SE Runtime Environment (23.0) (fastdebug build 23-lworld5ea-2024-05-08-1319037.fred...)
# Java VM: Java HotSpot(TM) 64-Bit Server VM (fastdebug 23-lworld5ea-2024-05-08-1319037.fred..., compiled mode, compressed oops, compressed class ptrs, g1 gc, linux-amd64)
# Problematic frame:
# V [libjvm.so+0x15d00d2] Parse::do_put_xxx(Node*, ciField*, bool)+0xb12
Note that this particular test program is triggering an infinite recursion between the constructors of the two value classes, leading to a SOE, but the VM should not crash.
For instance:
public class AbstractCircularity {
static abstract value class AbstractBadField {
ConcreteBadField f = new ConcreteBadField();
}
static value class ConcreteBadField extends AbstractBadField {
int i = 0;
}
public static void main(String[] args) {
var c = new ConcreteBadField();
}
}
Run with -Xcomp -XX:-TieredCompilation, this program causes an assertion failure in CI:
# Internal Error (valhalla/open/src/hotspot/share/ci/ciInlineKlass.cpp:33), pid=648122, tid=648136
# assert(super() == nullptr || !super()->has_nonstatic_fields()) failed: an inline type must not inherit fields from its superclass
#
# JRE version: Java(TM) SE Runtime Environment (23.0) (fastdebug build 23-lworld5ea-2024-05-08-1319037.fred...)
# Java VM: Java HotSpot(TM) 64-Bit Server VM (fastdebug 23-lworld5ea-2024-05-08-1319037.fred..., compiled mode, compressed oops, compressed class ptrs, g1 gc, linux-amd64)
# Problematic frame:
# V [libjvm.so+0x90a087] ciInlineKlass::compute_nonstatic_fields()+0x207
This issue might be common to C1 and C2 as they share the CI implementation.
Trying to remove this assert causes C2 to crash on the following assert:
# Internal Error (valhalla/open/src/hotspot/share/opto/parse3.cpp:238), pid=703047, tid=703061
# assert(obj->as_InlineType()->is_larval()) failed: must be larval
#
# JRE version: Java(TM) SE Runtime Environment (23.0) (fastdebug build 23-lworld5ea-2024-05-08-1319037.fred...)
# Java VM: Java HotSpot(TM) 64-Bit Server VM (fastdebug 23-lworld5ea-2024-05-08-1319037.fred..., compiled mode, compressed oops, compressed class ptrs, g1 gc, linux-amd64)
# Problematic frame:
# V [libjvm.so+0x15d00d2] Parse::do_put_xxx(Node*, ciField*, bool)+0xb12
Note that this particular test program is triggering an infinite recursion between the constructors of the two value classes, leading to a SOE, but the VM should not crash.
- relates to
-
JDK-8325632 [lworld] C2 compilation fails with "matching stack sizes"
-
- Open
-
-
JDK-8326598 [lworld] JVM must support field inheritance for value classes
-
- Resolved
-
- links to
-
Commit(lworld) openjdk/valhalla/f63f1940
-
Review(lworld) openjdk/valhalla/1236