25 #include "precompiled.hpp" 26 #include "asm/assembler.hpp" 27 #include "asm/assembler.inline.hpp" 28 #include "ci/ciEnv.hpp" 29 #include "gc/shared/cardTableBarrierSet.hpp" 30 #include "gc/shared/collectedHeap.inline.hpp" 31 #include "interpreter/interpreter.hpp" 32 #include "interpreter/interpreterRuntime.hpp" 33 #include "interpreter/templateInterpreterGenerator.hpp" 34 #include "memory/resourceArea.hpp" 35 #include "prims/jvm_misc.hpp" 36 #include "prims/methodHandles.hpp" 37 #include "runtime/biasedLocking.hpp" 38 #include "runtime/interfaceSupport.inline.hpp" 39 #include "runtime/objectMonitor.hpp" 40 #include "runtime/os.hpp" 41 #include "runtime/sharedRuntime.hpp" 42 #include "runtime/stubRoutines.hpp" 43 #include "utilities/hashtable.hpp" 44 #include "utilities/macros.hpp" 45 #if INCLUDE_ALL_GCS 46 #include "gc/g1/g1BarrierSet.hpp" 47 #include "gc/g1/heapRegion.hpp" 48 #endif // INCLUDE_ALL_GCS 49 50 // Returns whether given imm has equal bit fields <0:size-1> and <size:2*size-1>. 51 inline bool Assembler::LogicalImmediate::has_equal_subpatterns(uintx imm, int size) { 52 uintx mask = right_n_bits(size); 53 uintx subpattern1 = mask_bits(imm, mask); 54 uintx subpattern2 = mask_bits(imm >> size, mask); 55 return subpattern1 == subpattern2; 56 } 57 58 // Returns least size that is a power of two from 2 to 64 with the proviso that given 59 // imm is composed of repeating patterns of this size. 60 inline int Assembler::LogicalImmediate::least_pattern_size(uintx imm) { 61 int size = BitsPerWord; 62 while (size > 2 && has_equal_subpatterns(imm, size >> 1)) { 63 size >>= 1; 64 } 65 return size; 66 } 67 68 // Returns count of set bits in given imm. Based on variable-precision SWAR algorithm. | 25 #include "precompiled.hpp" 26 #include "asm/assembler.hpp" 27 #include "asm/assembler.inline.hpp" 28 #include "ci/ciEnv.hpp" 29 #include "gc/shared/cardTableBarrierSet.hpp" 30 #include "gc/shared/collectedHeap.inline.hpp" 31 #include "interpreter/interpreter.hpp" 32 #include "interpreter/interpreterRuntime.hpp" 33 #include "interpreter/templateInterpreterGenerator.hpp" 34 #include "memory/resourceArea.hpp" 35 #include "prims/jvm_misc.hpp" 36 #include "prims/methodHandles.hpp" 37 #include "runtime/biasedLocking.hpp" 38 #include "runtime/interfaceSupport.inline.hpp" 39 #include "runtime/objectMonitor.hpp" 40 #include "runtime/os.hpp" 41 #include "runtime/sharedRuntime.hpp" 42 #include "runtime/stubRoutines.hpp" 43 #include "utilities/hashtable.hpp" 44 #include "utilities/macros.hpp" 45 46 // Returns whether given imm has equal bit fields <0:size-1> and <size:2*size-1>. 47 inline bool Assembler::LogicalImmediate::has_equal_subpatterns(uintx imm, int size) { 48 uintx mask = right_n_bits(size); 49 uintx subpattern1 = mask_bits(imm, mask); 50 uintx subpattern2 = mask_bits(imm >> size, mask); 51 return subpattern1 == subpattern2; 52 } 53 54 // Returns least size that is a power of two from 2 to 64 with the proviso that given 55 // imm is composed of repeating patterns of this size. 56 inline int Assembler::LogicalImmediate::least_pattern_size(uintx imm) { 57 int size = BitsPerWord; 58 while (size > 2 && has_equal_subpatterns(imm, size >> 1)) { 59 size >>= 1; 60 } 61 return size; 62 } 63 64 // Returns count of set bits in given imm. Based on variable-precision SWAR algorithm. |