Wed, 06 Feb 2019 11:41:51 +0100
8214206: Fix for JDK-8213419 is broken on 32-bit
Reviewed-by: mdoerr, shade
1.1 --- a/src/cpu/sparc/vm/c1_LIRAssembler_sparc.cpp Wed Feb 06 17:32:25 2019 +0100 1.2 +++ b/src/cpu/sparc/vm/c1_LIRAssembler_sparc.cpp Wed Feb 06 11:41:51 2019 +0100 1.3 @@ -579,7 +579,7 @@ 1.4 __ and3(Rscratch, divisor - 1, Rscratch); 1.5 } 1.6 __ add(Rdividend, Rscratch, Rscratch); 1.7 - __ sra(Rscratch, log2_intptr(divisor), Rresult); 1.8 + __ sra(Rscratch, log2_int(divisor), Rresult); 1.9 return; 1.10 } else { 1.11 if (divisor == 2) {
2.1 --- a/src/cpu/sparc/vm/c1_LIRGenerator_sparc.cpp Wed Feb 06 17:32:25 2019 +0100 2.2 +++ b/src/cpu/sparc/vm/c1_LIRGenerator_sparc.cpp Wed Feb 06 11:41:51 2019 +0100 2.3 @@ -294,11 +294,11 @@ 2.4 bool LIRGenerator::strength_reduce_multiply(LIR_Opr left, int c, LIR_Opr result, LIR_Opr tmp) { 2.5 assert(left != result, "should be different registers"); 2.6 if (is_power_of_2(c + 1)) { 2.7 - __ shift_left(left, log2_intptr(c + 1), result); 2.8 + __ shift_left(left, log2_int(c + 1), result); 2.9 __ sub(result, left, result); 2.10 return true; 2.11 } else if (is_power_of_2(c - 1)) { 2.12 - __ shift_left(left, log2_intptr(c - 1), result); 2.13 + __ shift_left(left, log2_int(c - 1), result); 2.14 __ add(result, left, result); 2.15 return true; 2.16 }
3.1 --- a/src/cpu/x86/vm/c1_LIRAssembler_x86.cpp Wed Feb 06 17:32:25 2019 +0100 3.2 +++ b/src/cpu/x86/vm/c1_LIRAssembler_x86.cpp Wed Feb 06 11:41:51 2019 +0100 3.3 @@ -2650,7 +2650,7 @@ 3.4 Register dreg = result->as_register(); 3.5 3.6 if (right->is_constant()) { 3.7 - int divisor = right->as_constant_ptr()->as_jint(); 3.8 + jint divisor = right->as_constant_ptr()->as_jint(); 3.9 assert(divisor > 0 && is_power_of_2(divisor), "must be"); 3.10 if (code == lir_idiv) { 3.11 assert(lreg == rax, "must be rax,"); 3.12 @@ -2662,7 +2662,7 @@ 3.13 __ andl(rdx, divisor - 1); 3.14 __ addl(lreg, rdx); 3.15 } 3.16 - __ sarl(lreg, log2_intptr(divisor)); 3.17 + __ sarl(lreg, log2_jint(divisor)); 3.18 move_regs(lreg, dreg); 3.19 } else if (code == lir_irem) { 3.20 Label done;
4.1 --- a/src/cpu/x86/vm/c1_LIRGenerator_x86.cpp Wed Feb 06 17:32:25 2019 +0100 4.2 +++ b/src/cpu/x86/vm/c1_LIRGenerator_x86.cpp Wed Feb 06 11:41:51 2019 +0100 4.3 @@ -237,12 +237,12 @@ 4.4 if (tmp->is_valid()) { 4.5 if (is_power_of_2(c + 1)) { 4.6 __ move(left, tmp); 4.7 - __ shift_left(left, log2_intptr(c + 1), left); 4.8 + __ shift_left(left, log2_jint(c + 1), left); 4.9 __ sub(left, tmp, result); 4.10 return true; 4.11 } else if (is_power_of_2(c - 1)) { 4.12 __ move(left, tmp); 4.13 - __ shift_left(left, log2_intptr(c - 1), left); 4.14 + __ shift_left(left, log2_jint(c - 1), left); 4.15 __ add(left, tmp, result); 4.16 return true; 4.17 }
5.1 --- a/src/share/vm/opto/divnode.cpp Wed Feb 06 17:32:25 2019 +0100 5.2 +++ b/src/share/vm/opto/divnode.cpp Wed Feb 06 11:41:51 2019 +0100 5.3 @@ -131,7 +131,7 @@ 5.4 } 5.5 5.6 // Add rounding to the shift to handle the sign bit 5.7 - int l = log2_intptr(d-1)+1; 5.8 + int l = log2_jint(d-1)+1; 5.9 if (needs_rounding) { 5.10 // Divide-by-power-of-2 can be made into a shift, but you have to do 5.11 // more math for the rounding. You need to add 0 for positive
6.1 --- a/src/share/vm/opto/mulnode.cpp Wed Feb 06 17:32:25 2019 +0100 6.2 +++ b/src/share/vm/opto/mulnode.cpp Wed Feb 06 11:41:51 2019 +0100 6.3 @@ -198,21 +198,21 @@ 6.4 Node *res = NULL; 6.5 unsigned int bit1 = abs_con & (0-abs_con); // Extract low bit 6.6 if (bit1 == abs_con) { // Found a power of 2? 6.7 - res = new (phase->C) LShiftINode(in(1), phase->intcon(log2_intptr(bit1))); 6.8 + res = new (phase->C) LShiftINode(in(1), phase->intcon(log2_uint(bit1))); 6.9 } else { 6.10 6.11 // Check for constant with 2 bits set 6.12 unsigned int bit2 = abs_con-bit1; 6.13 bit2 = bit2 & (0-bit2); // Extract 2nd bit 6.14 if (bit2 + bit1 == abs_con) { // Found all bits in con? 6.15 - Node *n1 = phase->transform( new (phase->C) LShiftINode(in(1), phase->intcon(log2_intptr(bit1)))); 6.16 - Node *n2 = phase->transform( new (phase->C) LShiftINode(in(1), phase->intcon(log2_intptr(bit2)))); 6.17 + Node *n1 = phase->transform( new (phase->C) LShiftINode(in(1), phase->intcon(log2_uint(bit1)))); 6.18 + Node *n2 = phase->transform( new (phase->C) LShiftINode(in(1), phase->intcon(log2_uint(bit2)))); 6.19 res = new (phase->C) AddINode(n2, n1); 6.20 6.21 } else if (is_power_of_2(abs_con+1)) { 6.22 // Sleezy: power-of-2 -1. Next time be generic. 6.23 unsigned int temp = abs_con + 1; 6.24 - Node *n1 = phase->transform(new (phase->C) LShiftINode(in(1), phase->intcon(log2_intptr(temp)))); 6.25 + Node *n1 = phase->transform(new (phase->C) LShiftINode(in(1), phase->intcon(log2_uint(temp)))); 6.26 res = new (phase->C) SubINode(n1, in(1)); 6.27 } else { 6.28 return MulNode::Ideal(phase, can_reshape); 6.29 @@ -444,7 +444,7 @@ 6.30 // Masking off high bits which are always zero is useless. 6.31 const TypeInt* t1 = phase->type( in(1) )->isa_int(); 6.32 if (t1 != NULL && t1->_lo >= 0) { 6.33 - jint t1_support = right_n_bits(1 + log2_intptr(t1->_hi)); 6.34 + jint t1_support = right_n_bits(1 + log2_jint(t1->_hi)); 6.35 if ((t1_support & con) == t1_support) 6.36 return in1; 6.37 }
7.1 --- a/src/share/vm/runtime/advancedThresholdPolicy.cpp Wed Feb 06 17:32:25 2019 +0100 7.2 +++ b/src/share/vm/runtime/advancedThresholdPolicy.cpp Wed Feb 06 11:41:51 2019 +0100 7.3 @@ -47,8 +47,8 @@ 7.4 int count = CICompilerCount; 7.5 if (CICompilerCountPerCPU) { 7.6 // Simple log n seems to grow too slowly for tiered, try something faster: log n * log log n 7.7 - int log_cpu = log2_intptr(os::active_processor_count()); 7.8 - int loglog_cpu = log2_intptr(MAX2(log_cpu, 1)); 7.9 + int log_cpu = log2_int(os::active_processor_count()); 7.10 + int loglog_cpu = log2_int(MAX2(log_cpu, 1)); 7.11 count = MAX2(log_cpu * loglog_cpu, 1) * 3 / 2; 7.12 } 7.13
8.1 --- a/src/share/vm/runtime/compilationPolicy.cpp Wed Feb 06 17:32:25 2019 +0100 8.2 +++ b/src/share/vm/runtime/compilationPolicy.cpp Wed Feb 06 11:41:51 2019 +0100 8.3 @@ -181,7 +181,7 @@ 8.4 // Example: if CICompilerCountPerCPU is true, then we get 8.5 // max(log2(8)-1,1) = 2 compiler threads on an 8-way machine. 8.6 // May help big-app startup time. 8.7 - _compiler_count = MAX2(log2_intptr(os::active_processor_count())-1,1); 8.8 + _compiler_count = MAX2(log2_int(os::active_processor_count())-1,1); 8.9 FLAG_SET_ERGO(intx, CICompilerCount, _compiler_count); 8.10 } else { 8.11 _compiler_count = CICompilerCount;
9.1 --- a/src/share/vm/runtime/os.cpp Wed Feb 06 17:32:25 2019 +0100 9.2 +++ b/src/share/vm/runtime/os.cpp Wed Feb 06 11:41:51 2019 +0100 9.3 @@ -1284,7 +1284,7 @@ 9.4 } 9.5 9.6 void os::set_memory_serialize_page(address page) { 9.7 - int count = log2_intptr(sizeof(class JavaThread)) - log2_intptr(64); 9.8 + int count = log2_intptr(sizeof(class JavaThread)) - log2_int(64); 9.9 _mem_serialize_page = (volatile int32_t *)page; 9.10 // We initialize the serialization page shift count here 9.11 // We assume a cache line size of 64 bytes
10.1 --- a/src/share/vm/runtime/simpleThresholdPolicy.cpp Wed Feb 06 17:32:25 2019 +0100 10.2 +++ b/src/share/vm/runtime/simpleThresholdPolicy.cpp Wed Feb 06 11:41:51 2019 +0100 10.3 @@ -139,7 +139,7 @@ 10.4 } 10.5 int count = CICompilerCount; 10.6 if (CICompilerCountPerCPU) { 10.7 - count = MAX2(log2_intptr(os::active_processor_count()), 1) * 3 / 2; 10.8 + count = MAX2(log2_int(os::active_processor_count()), 1) * 3 / 2; 10.9 } 10.10 set_c1_count(MAX2(count / 3, 1)); 10.11 set_c2_count(MAX2(count - c1_count(), 1));
11.1 --- a/src/share/vm/utilities/globalDefinitions.hpp Wed Feb 06 17:32:25 2019 +0100 11.2 +++ b/src/share/vm/utilities/globalDefinitions.hpp Wed Feb 06 11:41:51 2019 +0100 11.3 @@ -1149,8 +1149,7 @@ 11.4 } 11.5 11.6 //* largest i such that 2^i <= x 11.7 -// A negative value of 'x' will return '63' 11.8 -inline int log2_long(unsigned long x) { 11.9 +inline int log2_long(julong x) { 11.10 int i = -1; 11.11 julong p = 1; 11.12 while (p != 0 && p <= x) { 11.13 @@ -1166,16 +1165,21 @@ 11.14 return log2_intptr((uintptr_t)x); 11.15 } 11.16 11.17 -inline int log2_intptr(int x) { 11.18 +inline int log2_int(int x) { 11.19 return log2_intptr((uintptr_t)x); 11.20 } 11.21 11.22 -inline int log2_intptr(uint x) { 11.23 +inline int log2_jint(jint x) { 11.24 return log2_intptr((uintptr_t)x); 11.25 } 11.26 11.27 -inline int log2_long(jlong x) { 11.28 - return log2_long((unsigned long)x); 11.29 +inline int log2_uint(uint x) { 11.30 + return log2_intptr((uintptr_t)x); 11.31 +} 11.32 + 11.33 +// A negative value of 'x' will return '63' 11.34 +inline int log2_jlong(jlong x) { 11.35 + return log2_long((julong)x); 11.36 } 11.37 11.38 //* the argument must be exactly a power of 2
12.1 --- a/src/share/vm/utilities/hashtable.cpp Wed Feb 06 17:32:25 2019 +0100 12.2 +++ b/src/share/vm/utilities/hashtable.cpp Wed Feb 06 11:41:51 2019 +0100 12.3 @@ -55,7 +55,7 @@ 12.4 if (_first_free_entry + _entry_size >= _end_block) { 12.5 int block_size = MIN2(512, MAX2((int)_table_size / 2, (int)_number_of_entries)); 12.6 int len = _entry_size * block_size; 12.7 - len = 1 << log2_intptr(len); // round down to power of 2 12.8 + len = 1 << log2_int(len); // round down to power of 2 12.9 assert(len >= _entry_size, ""); 12.10 _first_free_entry = NEW_C_HEAP_ARRAY2(char, len, F, CURRENT_PC); 12.11 _end_block = _first_free_entry + len;