Skip to content
This repository has been archived by the owner. It is now read-only.

8266854: LibraryCallKit::inline_preconditions_checkIndex modifies control flow even if the intrinsic bailed out #114

Closed
wants to merge 2 commits into from
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
@@ -1032,17 +1032,17 @@ bool LibraryCallKit::inline_preconditions_checkIndex(BasicType bt) {
Deoptimization::Action_make_not_entrant);
}

if (stopped()) {
Copy link
Member

@jatin-bhateja jatin-bhateja Jun 22, 2021

Choose a reason for hiding this comment

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

Hi @sviswa7, comments over both the short-circuiting exits will help in better code readability.

Copy link
Contributor Author

@sviswa7 sviswa7 Jun 23, 2021

Choose a reason for hiding this comment

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

@jatin-bhateja Added comments, please take a look.

return true;
}

// length is now known postive, add a cast node to make this explicit
jlong upper_bound = _gvn.type(length)->is_integer(bt)->hi_as_long();
Node* casted_length = ConstraintCastNode::make(control(), length, TypeInteger::make(0, upper_bound, Type::WidenMax, bt), bt);
casted_length = _gvn.transform(casted_length);
replace_in_map(length, casted_length);
length = casted_length;

if (stopped()) {
return false;
}

// Use an unsigned comparison for the range check itself
Node* rc_cmp = _gvn.transform(CmpNode::make(index, length, bt, true));
BoolTest::mask btest = BoolTest::lt;
@@ -1061,7 +1061,7 @@ bool LibraryCallKit::inline_preconditions_checkIndex(BasicType bt) {
}

if (stopped()) {
return false;
return true;
}

// index is now known to be >= 0 and < length, cast it