JDK-8371505 : [lworld] Suspicious FlatArrayKlass creations
  • Type: Bug
  • Component: hotspot
  • Sub-Component: compiler
  • Affected Version: repo-valhalla
  • Priority: P3
  • Status: Open
  • Resolution: Unresolved
  • Submitted: 2025-11-08
  • Updated: 2025-11-10
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
Other
repo-valhallaUnresolved
Related Reports
Relates :  
Description
I am just throwing out issues right now, it is very possible that a fix can address multiple of these at once.

If I add these to lworld, running compiler tests will crash the VM:

diff --git a/src/hotspot/share/oops/flatArrayKlass.cpp b/src/hotspot/share/oops/flatArrayKlass.cpp
index dc91a0156c2..47c6d19923e 100644
--- a/src/hotspot/share/oops/flatArrayKlass.cpp
+++ b/src/hotspot/share/oops/flatArrayKlass.cpp
@@ -34,6 +34,7 @@
 #include "memory/oopFactory.hpp"
 #include "memory/resourceArea.hpp"
 #include "memory/universe.hpp"
+#include "oops/arrayKlass.hpp"
 #include "oops/arrayKlass.inline.hpp"
 #include "oops/arrayOop.hpp"
 #include "oops/flatArrayKlass.hpp"
@@ -102,6 +103,16 @@ FlatArrayKlass* FlatArrayKlass::allocate_klass(Klass* eklass, ArrayProperties pr

   InlineKlass* element_klass = InlineKlass::cast(eklass);
   assert(element_klass->must_be_atomic() || (!AlwaysAtomicAccesses), "Atomic by-default");
+  if (ArrayKlass::is_null_restricted(props)) {
+    if (ArrayKlass::is_non_atomic(props)) {
+      assert(element_klass->has_non_atomic_layout(), "no layout");
+    } else {
+      assert(element_klass->has_atomic_layout(), "no layout");
+    }
+  } else {
+    assert(!ArrayKlass::is_non_atomic(props), "nullable arrays must be atomic");
+    assert(element_klass->has_nullable_atomic_layout(), "no layout");
+  }

   // Eagerly allocate the direct array supertype.
   Klass* super_klass = nullptr;