94 AllocatePrefetchLines = 0; 95 // Can't be zero. Will SIGFPE during constraints checking. 96 FLAG_SET_DEFAULT(AllocatePrefetchStepSize, cache_line_size); 97 } 98 99 } else { 100 FLAG_SET_DEFAULT(AllocatePrefetchStyle, 0); 101 AllocatePrefetchDistance = 0; 102 AllocatePrefetchLines = 0; 103 // Can't be zero. Will SIGFPE during constraints checking. 104 FLAG_SET_DEFAULT(AllocatePrefetchStepSize, cache_line_size); 105 } 106 107 // TODO: 108 // On z/Architecture, cache line size is significantly large (256 bytes). Do we really need 109 // to keep contended members that far apart? Performance tests are required. 110 if (FLAG_IS_DEFAULT(ContendedPaddingWidth) && (cache_line_size > ContendedPaddingWidth)) { 111 ContendedPaddingWidth = cache_line_size; 112 } 113 114 // On z/Architecture, the CRC32 intrinsics had to be implemented "by hand". 115 // They cannot be based on the CHECKSUM instruction which has been there 116 // since the very beginning (of z/Architecture). It computes "some kind of" a checksum 117 // which has nothing to do with the CRC32 algorithm. 118 if (FLAG_IS_DEFAULT(UseCRC32Intrinsics)) { 119 FLAG_SET_DEFAULT(UseCRC32Intrinsics, true); 120 } 121 122 // On z/Architecture, we take UseAES as the general switch to enable/disable the AES intrinsics. 123 // The specific, and yet to be defined, switches UseAESxxxIntrinsics will then be set 124 // depending on the actual machine capabilities. 125 // Explicitly setting them via CmdLine option takes precedence, of course. 126 // TODO: UseAESIntrinsics must be made keylength specific. 127 // As of March 2015 and Java8, only AES128 is supported by the Java Cryptographic Extensions. 128 // Therefore, UseAESIntrinsics is of minimal use at the moment. 129 if (FLAG_IS_DEFAULT(UseAES) && has_Crypto_AES()) { 130 FLAG_SET_DEFAULT(UseAES, true); 131 } 132 if (UseAES && !has_Crypto_AES()) { 133 warning("AES instructions are not available on this CPU"); 134 FLAG_SET_DEFAULT(UseAES, false); 135 } 136 if (UseAES) { 137 if (FLAG_IS_DEFAULT(UseAESIntrinsics)) { 138 FLAG_SET_DEFAULT(UseAESIntrinsics, true); 139 } 140 } 176 } 177 } else if (UseSHA1Intrinsics) { 178 warning("Intrinsics for SHA-1 crypto hash functions not available on this CPU."); 179 FLAG_SET_DEFAULT(UseSHA1Intrinsics, false); 180 } 181 if (UseSHA && has_Crypto_SHA256()) { 182 if (FLAG_IS_DEFAULT(UseSHA256Intrinsics)) { 183 FLAG_SET_DEFAULT(UseSHA256Intrinsics, true); 184 } 185 } else if (UseSHA256Intrinsics) { 186 warning("Intrinsics for SHA-224 and SHA-256 crypto hash functions not available on this CPU."); 187 FLAG_SET_DEFAULT(UseSHA256Intrinsics, false); 188 } 189 if (UseSHA && has_Crypto_SHA512()) { 190 if (FLAG_IS_DEFAULT(UseSHA512Intrinsics)) { 191 FLAG_SET_DEFAULT(UseSHA512Intrinsics, true); 192 } 193 } else if (UseSHA512Intrinsics) { 194 warning("Intrinsics for SHA-384 and SHA-512 crypto hash functions not available on this CPU."); 195 FLAG_SET_DEFAULT(UseSHA512Intrinsics, false); 196 } 197 198 if (UseAdler32Intrinsics) { 199 warning("Adler32Intrinsics not available on this CPU."); 200 FLAG_SET_DEFAULT(UseAdler32Intrinsics, false); 201 } 202 203 if (FLAG_IS_DEFAULT(UseMultiplyToLenIntrinsic)) { 204 FLAG_SET_DEFAULT(UseMultiplyToLenIntrinsic, true); 205 } 206 if (FLAG_IS_DEFAULT(UseMontgomeryMultiplyIntrinsic)) { 207 FLAG_SET_DEFAULT(UseMontgomeryMultiplyIntrinsic, true); 208 } 209 if (FLAG_IS_DEFAULT(UseMontgomerySquareIntrinsic)) { 210 FLAG_SET_DEFAULT(UseMontgomerySquareIntrinsic, true); 211 } 212 if (FLAG_IS_DEFAULT(UsePopCountInstruction)) { 213 FLAG_SET_DEFAULT(UsePopCountInstruction, true); 214 } 215 216 // z/Architecture supports 8-byte compare-exchange operations 217 // (see Atomic::cmpxchg and StubGenerator::generate_atomic_cmpxchg_ptr) 218 // and 'atomic long memory ops' (see Unsafe_GetLongVolatile). 219 _supports_cx8 = true; 220 | 94 AllocatePrefetchLines = 0; 95 // Can't be zero. Will SIGFPE during constraints checking. 96 FLAG_SET_DEFAULT(AllocatePrefetchStepSize, cache_line_size); 97 } 98 99 } else { 100 FLAG_SET_DEFAULT(AllocatePrefetchStyle, 0); 101 AllocatePrefetchDistance = 0; 102 AllocatePrefetchLines = 0; 103 // Can't be zero. Will SIGFPE during constraints checking. 104 FLAG_SET_DEFAULT(AllocatePrefetchStepSize, cache_line_size); 105 } 106 107 // TODO: 108 // On z/Architecture, cache line size is significantly large (256 bytes). Do we really need 109 // to keep contended members that far apart? Performance tests are required. 110 if (FLAG_IS_DEFAULT(ContendedPaddingWidth) && (cache_line_size > ContendedPaddingWidth)) { 111 ContendedPaddingWidth = cache_line_size; 112 } 113 114 // On z/Architecture, the CRC32/CRC32C intrinsics are implemented "by hand". 115 // TODO: Provide implementation based on the vector instructions available from z13. 116 // Note: The CHECKSUM instruction, which has been there since the very beginning 117 // (of z/Architecture), computes "some kind of" a checksum. 118 // It has nothing to do with the CRC32 algorithm. 119 if (FLAG_IS_DEFAULT(UseCRC32Intrinsics)) { 120 FLAG_SET_DEFAULT(UseCRC32Intrinsics, true); 121 } 122 if (FLAG_IS_DEFAULT(UseCRC32CIntrinsics)) { 123 FLAG_SET_DEFAULT(UseCRC32CIntrinsics, true); 124 } 125 126 // TODO: Provide implementation. 127 if (UseAdler32Intrinsics) { 128 warning("Adler32Intrinsics not available on this CPU."); 129 FLAG_SET_DEFAULT(UseAdler32Intrinsics, false); 130 } 131 132 // On z/Architecture, we take UseAES as the general switch to enable/disable the AES intrinsics. 133 // The specific, and yet to be defined, switches UseAESxxxIntrinsics will then be set 134 // depending on the actual machine capabilities. 135 // Explicitly setting them via CmdLine option takes precedence, of course. 136 // TODO: UseAESIntrinsics must be made keylength specific. 137 // As of March 2015 and Java8, only AES128 is supported by the Java Cryptographic Extensions. 138 // Therefore, UseAESIntrinsics is of minimal use at the moment. 139 if (FLAG_IS_DEFAULT(UseAES) && has_Crypto_AES()) { 140 FLAG_SET_DEFAULT(UseAES, true); 141 } 142 if (UseAES && !has_Crypto_AES()) { 143 warning("AES instructions are not available on this CPU"); 144 FLAG_SET_DEFAULT(UseAES, false); 145 } 146 if (UseAES) { 147 if (FLAG_IS_DEFAULT(UseAESIntrinsics)) { 148 FLAG_SET_DEFAULT(UseAESIntrinsics, true); 149 } 150 } 186 } 187 } else if (UseSHA1Intrinsics) { 188 warning("Intrinsics for SHA-1 crypto hash functions not available on this CPU."); 189 FLAG_SET_DEFAULT(UseSHA1Intrinsics, false); 190 } 191 if (UseSHA && has_Crypto_SHA256()) { 192 if (FLAG_IS_DEFAULT(UseSHA256Intrinsics)) { 193 FLAG_SET_DEFAULT(UseSHA256Intrinsics, true); 194 } 195 } else if (UseSHA256Intrinsics) { 196 warning("Intrinsics for SHA-224 and SHA-256 crypto hash functions not available on this CPU."); 197 FLAG_SET_DEFAULT(UseSHA256Intrinsics, false); 198 } 199 if (UseSHA && has_Crypto_SHA512()) { 200 if (FLAG_IS_DEFAULT(UseSHA512Intrinsics)) { 201 FLAG_SET_DEFAULT(UseSHA512Intrinsics, true); 202 } 203 } else if (UseSHA512Intrinsics) { 204 warning("Intrinsics for SHA-384 and SHA-512 crypto hash functions not available on this CPU."); 205 FLAG_SET_DEFAULT(UseSHA512Intrinsics, false); 206 } 207 208 if (FLAG_IS_DEFAULT(UseMultiplyToLenIntrinsic)) { 209 FLAG_SET_DEFAULT(UseMultiplyToLenIntrinsic, true); 210 } 211 if (FLAG_IS_DEFAULT(UseMontgomeryMultiplyIntrinsic)) { 212 FLAG_SET_DEFAULT(UseMontgomeryMultiplyIntrinsic, true); 213 } 214 if (FLAG_IS_DEFAULT(UseMontgomerySquareIntrinsic)) { 215 FLAG_SET_DEFAULT(UseMontgomerySquareIntrinsic, true); 216 } 217 if (FLAG_IS_DEFAULT(UsePopCountInstruction)) { 218 FLAG_SET_DEFAULT(UsePopCountInstruction, true); 219 } 220 221 // z/Architecture supports 8-byte compare-exchange operations 222 // (see Atomic::cmpxchg and StubGenerator::generate_atomic_cmpxchg_ptr) 223 // and 'atomic long memory ops' (see Unsafe_GetLongVolatile). 224 _supports_cx8 = true; 225 |