Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions src/hotspot/share/opto/parseHelper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -164,8 +164,10 @@ void Parse::array_store_check() {
// cast array_klass to EXACT array and uncommon-trap if the cast fails.
// Make constant out of the inexact array klass, but use it only if the cast
// succeeds.
if (MonomorphicArrayCheck && !too_many_traps(Deoptimization::Reason_array_check) && !tak->klass_is_exact()
&& tak->isa_aryklassptr()) {
if (MonomorphicArrayCheck &&
!too_many_traps(Deoptimization::Reason_array_check) &&
!tak->klass_is_exact() &&
tak->isa_aryklassptr()) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like an implicit nullptr check. Not allowed by code style ;)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you quickly explain this change from tak != TypeInstKlassPtr::OBJECT so I don't need to investigate myself, please?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like an implicit nullptr check. Not allowed by code style ;)

But the verb here is isa and we use these as a bool a lot, though :/

Can you quickly explain this change from tak != TypeInstKlassPtr::OBJECT so I don't need to investigate myself, please?

The bottom type of an array can be either Object or an array of some kind, so tak != TypeInstKlassPtr::OBJECT is the same as tak->isa_aryklassptr().

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah great, thanks for the explanation!

// Regarding the fourth condition in the if-statement from above:
//
// If the compiler has determined that the type of array 'ary' (represented
Expand Down Expand Up @@ -220,7 +222,7 @@ void Parse::array_store_check() {
int element_klass_offset = in_bytes(ObjArrayKlass::element_klass_offset());
Node* p2 = basic_plus_adr(array_klass, array_klass, element_klass_offset);
Node* a_e_klass = _gvn.transform(LoadKlassNode::make(_gvn, immutable_memory(), p2, tak));
assert(StressReflectiveCode || array_klass->is_Con() == a_e_klass->is_Con(), "a constant array type must come with a constant element type");
assert(array_klass->is_Con() == a_e_klass->is_Con() || StressReflectiveCode, "a constant array type must come with a constant element type");

// Check (the hard way) and throw if not a subklass.
// Result is ignored, we just need the CFG effects.
Expand Down