Skip to content
Permalink
Browse files
8277508: need to check has_predicated_vectors before calling scalable…
…_predicate_reg_slots

Reviewed-by: njian, thartmann, ngasson
  • Loading branch information
Yadong Wang authored and Fei Yang committed Nov 26, 2021
1 parent 3383c0d commit 00a6238daed4a4aaa6001275ce620646cdabfeb5
Showing with 13 additions and 11 deletions.
  1. +13 −11 src/hotspot/share/opto/matcher.cpp
@@ -634,18 +634,20 @@ void Matcher::init_first_stack_mask() {
if (Matcher::supports_scalable_vector()) {
int k = 1;
OptoReg::Name in = OptoReg::add(_in_arg_limit, -1);
// Exclude last input arg stack slots to avoid spilling vector register there,
// otherwise RegVectMask spills could stomp over stack slots in caller frame.
for (; (in >= init_in) && (k < scalable_predicate_reg_slots()); k++) {
scalable_stack_mask.Remove(in);
in = OptoReg::add(in, -1);
}
if (Matcher::has_predicated_vectors()) {
// Exclude last input arg stack slots to avoid spilling vector register there,
// otherwise RegVectMask spills could stomp over stack slots in caller frame.
for (; (in >= init_in) && (k < scalable_predicate_reg_slots()); k++) {
scalable_stack_mask.Remove(in);
in = OptoReg::add(in, -1);
}

// For RegVectMask
scalable_stack_mask.clear_to_sets(scalable_predicate_reg_slots());
assert(scalable_stack_mask.is_AllStack(), "should be infinite stack");
*idealreg2spillmask[Op_RegVectMask] = *idealreg2regmask[Op_RegVectMask];
idealreg2spillmask[Op_RegVectMask]->OR(scalable_stack_mask);
// For RegVectMask
scalable_stack_mask.clear_to_sets(scalable_predicate_reg_slots());
assert(scalable_stack_mask.is_AllStack(), "should be infinite stack");
*idealreg2spillmask[Op_RegVectMask] = *idealreg2regmask[Op_RegVectMask];
idealreg2spillmask[Op_RegVectMask]->OR(scalable_stack_mask);
}

// Exclude last input arg stack slots to avoid spilling vector register there,
// otherwise vector spills could stomp over stack slots in caller frame.

1 comment on commit 00a6238

@openjdk-notifier
Copy link

@openjdk-notifier openjdk-notifier bot commented on 00a6238 Nov 26, 2021

Choose a reason for hiding this comment

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

Please sign in to comment.