Skip to content

Commit dd0b958

Browse files
committed
8350632: [lworld] Parse::array_store_check() assert introduced by 8348411 fails
Reviewed-by: thartmann
1 parent 0f7cdf3 commit dd0b958

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

src/hotspot/share/opto/parseHelper.cpp

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -251,8 +251,6 @@ Node* Parse::array_store_check(Node*& adr, const Type*& elemtype) {
251251
int element_klass_offset = in_bytes(ArrayKlass::element_klass_offset());
252252
Node* p2 = basic_plus_adr(array_klass, array_klass, element_klass_offset);
253253
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");
256254

257255
// If we statically know that this is an inline type array, use precise element klass for checkcast
258256
const TypeAryPtr* arytype = _gvn.type(ary)->is_aryptr();
@@ -263,6 +261,14 @@ Node* Parse::array_store_check(Node*& adr, const Type*& elemtype) {
263261
a_e_klass = makecon(TypeKlassPtr::make(elemtype->inline_klass()));
264262
}
265263
#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+
266272
// If the element type is exact, the array can be null-free (i.e. the element type is NotNull) if:
267273
// - The elements are inline types
268274
// - The array is from an autobox cache.

0 commit comments

Comments
 (0)