@@ -251,8 +251,6 @@ Node* Parse::array_store_check(Node*& adr, const Type*& elemtype) {
251
251
int element_klass_offset = in_bytes (ArrayKlass::element_klass_offset ());
252
252
Node* p2 = basic_plus_adr (array_klass, array_klass, element_klass_offset);
253
253
Node* a_e_klass = _gvn.transform (LoadKlassNode::make (_gvn, immutable_memory (), p2, tak));
254
- // Disable, fix: 8350632
255
- // assert(array_klass->is_Con() == a_e_klass->is_Con() || StressReflectiveCode, "a constant array type must come with a constant element type");
256
254
257
255
// If we statically know that this is an inline type array, use precise element klass for checkcast
258
256
const TypeAryPtr* arytype = _gvn.type (ary)->is_aryptr ();
@@ -263,6 +261,14 @@ Node* Parse::array_store_check(Node*& adr, const Type*& elemtype) {
263
261
a_e_klass = makecon (TypeKlassPtr::make (elemtype->inline_klass ()));
264
262
}
265
263
#ifdef ASSERT
264
+ if (!StressReflectiveCode && array_klass->is_Con () != a_e_klass->is_Con ()) {
265
+ // When the element type is exact, the array type also needs to be exact. There is one exception, though:
266
+ // Nullable arrays are not exact because the null-free array is a subtype while the element type being a
267
+ // concrete value class (i.e. final) is always exact.
268
+ assert (!array_klass->is_Con () && a_e_klass->is_Con () && elem_ptr->is_inlinetypeptr () && !null_free,
269
+ " a constant element type either matches a constant array type or a non-constant nullable value class array" );
270
+ }
271
+
266
272
// If the element type is exact, the array can be null-free (i.e. the element type is NotNull) if:
267
273
// - The elements are inline types
268
274
// - The array is from an autobox cache.
0 commit comments