src/cpu/x86/vm/c1_LIRGenerator_x86.cpp

changeset 9843
a6f289d66efe
parent 9614
bb44c0e88235
child 9852
70aa912cebe5
     1.1 --- a/src/cpu/x86/vm/c1_LIRGenerator_x86.cpp	Thu Feb 27 05:40:59 2020 +0000
     1.2 +++ b/src/cpu/x86/vm/c1_LIRGenerator_x86.cpp	Thu Feb 27 05:58:53 2020 +0000
     1.3 @@ -233,8 +233,8 @@
     1.4  }
     1.5  
     1.6  
     1.7 -bool LIRGenerator::strength_reduce_multiply(LIR_Opr left, int c, LIR_Opr result, LIR_Opr tmp) {
     1.8 -  if (tmp->is_valid()) {
     1.9 +bool LIRGenerator::strength_reduce_multiply(LIR_Opr left, jint c, LIR_Opr result, LIR_Opr tmp) {
    1.10 +  if (tmp->is_valid() && c > 0 && c < max_jint) {
    1.11      if (is_power_of_2(c + 1)) {
    1.12        __ move(left, tmp);
    1.13        __ shift_left(left, log2_jint(c + 1), left);
    1.14 @@ -602,8 +602,8 @@
    1.15        bool use_constant = false;
    1.16        bool use_tmp = false;
    1.17        if (right_arg->is_constant()) {
    1.18 -        int iconst = right_arg->get_jint_constant();
    1.19 -        if (iconst > 0) {
    1.20 +        jint iconst = right_arg->get_jint_constant();
    1.21 +        if (iconst > 0 && iconst < max_jint) {
    1.22            if (is_power_of_2(iconst)) {
    1.23              use_constant = true;
    1.24            } else if (is_power_of_2(iconst - 1) || is_power_of_2(iconst + 1)) {

mercurial