< prev index next >

src/hotspot/cpu/s390/vm_version_s390.cpp

Print this page




 236 
 237   // z/Architecture supports 8-byte compare-exchange operations
 238   // (see Atomic::cmpxchg)
 239   // and 'atomic long memory ops' (see Unsafe_GetLongVolatile).
 240   _supports_cx8 = true;
 241 
 242   _supports_atomic_getadd4 = VM_Version::has_LoadAndALUAtomicV1();
 243   _supports_atomic_getadd8 = VM_Version::has_LoadAndALUAtomicV1();
 244 
 245   // z/Architecture supports unaligned memory accesses.
 246   // Performance penalty is negligible. An additional tick or so
 247   // is lost if the accessed data spans a cache line boundary.
 248   // Unaligned accesses are not atomic, of course.
 249   if (FLAG_IS_DEFAULT(UseUnalignedAccesses)) {
 250     FLAG_SET_DEFAULT(UseUnalignedAccesses, true);
 251   }
 252 }
 253 
 254 
 255 void VM_Version::set_features_string() {
 256 







 257   unsigned int ambiguity = 0;
 258   _model_string = z_name[0];
 259   if (is_z13()) {
 260     _features_string = "System z G7-z13  (LDISP_fast, ExtImm, PCrel Load/Store, CmpB, Cond Load/Store, Interlocked Update, TxM, VectorInstr)";
 261     _model_string = z_name[7];
 262     ambiguity++;
 263   }
 264   if (is_ec12()) {
 265     _features_string = "System z G6-EC12 (LDISP_fast, ExtImm, PCrel Load/Store, CmpB, Cond Load/Store, Interlocked Update, TxM)";
 266     _model_string = z_name[6];
 267     ambiguity++;
 268   }
 269   if (is_z196()) {
 270     _features_string = "System z G5-z196 (LDISP_fast, ExtImm, PCrel Load/Store, CmpB, Cond Load/Store, Interlocked Update)";
 271     _model_string = z_name[5];
 272     ambiguity++;
 273   }
 274   if (is_z10()) {
 275     _features_string = "System z G4-z10  (LDISP_fast, ExtImm, PCrel Load/Store, CmpB)";
 276     _model_string = z_name[4];
 277     ambiguity++;
 278   }
 279   if (is_z9()) {
 280     _features_string = "System z G3-z9   (LDISP_fast, ExtImm), out-of-support as of 2016-04-01";
 281     _model_string = z_name[3];
 282     ambiguity++;
 283   }
 284   if (is_z990()) {
 285     _features_string = "System z G2-z990 (LDISP_fast), out-of-support as of 2014-07-01";
 286     _model_string = z_name[2];
 287     ambiguity++;
 288   }
 289   if (is_z900()) {
 290     _features_string = "System z G1-z900 (LDISP), out-of-support as of 2014-07-01";
 291     _model_string = z_name[1];
 292     ambiguity++;
 293   }
 294 
 295   if (ambiguity == 0) {
 296     _features_string = "z/Architecture (unknown generation)";
 297   } else if (ambiguity > 1) {
 298     tty->print_cr("*** WARNING *** Ambiguous z/Architecture detection, ambiguity = %d", ambiguity);
 299     tty->print_cr("                oldest detected generation is %s", _features_string);
 300     _features_string = "z/Architecture (ambiguous detection)";
 301   }
 302 
 303   if (has_Crypto_AES()) {
 304     char buf[256];
 305     assert(strlen(_features_string) + 4 + 3*4 + 1 < sizeof(buf), "increase buffer size");
 306     jio_snprintf(buf, sizeof(buf), "%s aes%s%s%s", // String 'aes' must be surrounded by spaces so that jtreg tests recognize it.
 307                  _features_string,
 308                  has_Crypto_AES128() ? " 128" : "",
 309                  has_Crypto_AES192() ? " 192" : "",
 310                  has_Crypto_AES256() ? " 256" : "");
 311     _features_string = os::strdup(buf);
 312   }
 313 
 314   if (has_Crypto_SHA()) {
 315     char buf[256];
 316     assert(strlen(_features_string) + 4 + 2 + 2*4 + 6 + 1 < sizeof(buf), "increase buffer size");
 317     // String 'sha1' etc must be surrounded by spaces so that jtreg tests recognize it.
 318     jio_snprintf(buf, sizeof(buf), "%s %s%s%s%s",
 319                  _features_string,
 320                  has_Crypto_SHA1()   ? " sha1"   : "",
 321                  has_Crypto_SHA256() ? " sha256" : "",
 322                  has_Crypto_SHA512() ? " sha512" : "",
 323                  has_Crypto_GHASH()  ? " ghash"  : "");
 324     if (has_Crypto_AES()) { os::free((void *)_features_string); }
 325     _features_string = os::strdup(buf);
 326   }
 327 }
 328 
 329 // featureBuffer - bit array indicating availability of various features
 330 // featureNum    - bit index of feature to be tested
 331 //                 Featurenum < 0 requests test for any nonzero bit in featureBuffer.
 332 // bufLen        - length of featureBuffer in bits
 333 bool VM_Version::test_feature_bit(unsigned long* featureBuffer, int featureNum, unsigned int bufLen) {
 334   assert(bufLen > 0,             "buffer len must be positive");
 335   assert((bufLen & 0x0007) == 0, "unaligned buffer len");
 336   assert(((intptr_t)featureBuffer&0x0007) == 0, "unaligned feature buffer");
 337   if (featureNum < 0) {
 338     // Any bit set at all?
 339     bool anyBit = false;
 340     for (size_t i = 0; i < bufLen/(8*sizeof(long)); i++) {
 341       anyBit = anyBit || (featureBuffer[i] != 0);
 342     }
 343     return anyBit;




 236 
 237   // z/Architecture supports 8-byte compare-exchange operations
 238   // (see Atomic::cmpxchg)
 239   // and 'atomic long memory ops' (see Unsafe_GetLongVolatile).
 240   _supports_cx8 = true;
 241 
 242   _supports_atomic_getadd4 = VM_Version::has_LoadAndALUAtomicV1();
 243   _supports_atomic_getadd8 = VM_Version::has_LoadAndALUAtomicV1();
 244 
 245   // z/Architecture supports unaligned memory accesses.
 246   // Performance penalty is negligible. An additional tick or so
 247   // is lost if the accessed data spans a cache line boundary.
 248   // Unaligned accesses are not atomic, of course.
 249   if (FLAG_IS_DEFAULT(UseUnalignedAccesses)) {
 250     FLAG_SET_DEFAULT(UseUnalignedAccesses, true);
 251   }
 252 }
 253 
 254 
 255 void VM_Version::set_features_string() {
 256   // A note on the _features_string format:
 257   //   There are jtreg tests checking the _features_string for various properties.
 258   //   For some strange reason, these tests require the string to contain
 259   //   only _lowercase_ characters. Keep that in mind when being surprised
 260   //   about the unusual notation of features - and when adding new ones.
 261   //   Features may have one comma at the end.
 262   //   Furthermore, use one, and only one, separator space between features.
 263   //   Multiple spaces are considered separate tokens, messing up everything.
 264   unsigned int ambiguity = 0;
 265   _model_string = z_name[0];
 266   if (is_z13()) {
 267     _features_string = "system-z, g7-z13, ldisp_fast, extimm, pcrel_load/store, cmpb, cond_load/store, interlocked_update, txm, vectorinstr";
 268     _model_string = z_name[7];
 269     ambiguity++;
 270   }
 271   if (is_ec12()) {
 272     _features_string = "system-z, g6-ec12, ldisp_fast, extimm, pcrel_load/store, cmpb, cond_load/store, interlocked_update, txm";
 273     _model_string = z_name[6];
 274     ambiguity++;
 275   }
 276   if (is_z196()) {
 277     _features_string = "system-z, g5-z196, ldisp_fast, extimm, pcrel_load/store, cmpb, cond_load/store, interlocked_update";
 278     _model_string = z_name[5];
 279     ambiguity++;
 280   }
 281   if (is_z10()) {
 282     _features_string = "system-z, g4-z10, ldisp_fast, extimm, pcrel_load/store, cmpb";
 283     _model_string = z_name[4];
 284     ambiguity++;
 285   }
 286   if (is_z9()) {
 287     _features_string = "system-z, g3-z9, ldisp_fast, extimm, out-of-support as of 2016-04-01";
 288     _model_string = z_name[3];
 289     ambiguity++;
 290   }
 291   if (is_z990()) {
 292     _features_string = "system-z, g2-z990, ldisp_fast, out-of-support as of 2014-07-01";
 293     _model_string = z_name[2];
 294     ambiguity++;
 295   }
 296   if (is_z900()) {
 297     _features_string = "system-z, g1-z900, ldisp, out-of-support as of 2014-07-01";
 298     _model_string = z_name[1];
 299     ambiguity++;
 300   }
 301 
 302   if (ambiguity == 0) {
 303     _features_string = "z/Architecture (unknown generation)";
 304   } else if (ambiguity > 1) {
 305     tty->print_cr("*** WARNING *** Ambiguous z/Architecture detection, ambiguity = %d", ambiguity);
 306     tty->print_cr("                oldest detected generation is %s", _features_string);
 307     _features_string = "z/Architecture (ambiguous detection)";
 308   }
 309 
 310   if (has_Crypto_AES()) {
 311     char buf[256];
 312     assert(strlen(_features_string) + 3*8 < sizeof(buf), "increase buffer size");
 313     jio_snprintf(buf, sizeof(buf), "%s%s%s%s",
 314                  _features_string,
 315                  has_Crypto_AES128() ? ", aes128" : "",
 316                  has_Crypto_AES192() ? ", aes192" : "",
 317                  has_Crypto_AES256() ? ", aes256" : "");
 318     _features_string = os::strdup(buf);
 319   }
 320 
 321   if (has_Crypto_SHA()) {
 322     char buf[256];
 323     assert(strlen(_features_string) + 6 + 2*8 + 7 < sizeof(buf), "increase buffer size");
 324     jio_snprintf(buf, sizeof(buf), "%s%s%s%s%s",

 325                  _features_string,
 326                  has_Crypto_SHA1()   ? ", sha1"   : "",
 327                  has_Crypto_SHA256() ? ", sha256" : "",
 328                  has_Crypto_SHA512() ? ", sha512" : "",
 329                  has_Crypto_GHASH()  ? ", ghash"  : "");
 330     if (has_Crypto_AES()) { os::free((void *)_features_string); }
 331     _features_string = os::strdup(buf);
 332   }
 333 }
 334 
 335 // featureBuffer - bit array indicating availability of various features
 336 // featureNum    - bit index of feature to be tested
 337 //                 Featurenum < 0 requests test for any nonzero bit in featureBuffer.
 338 // bufLen        - length of featureBuffer in bits
 339 bool VM_Version::test_feature_bit(unsigned long* featureBuffer, int featureNum, unsigned int bufLen) {
 340   assert(bufLen > 0,             "buffer len must be positive");
 341   assert((bufLen & 0x0007) == 0, "unaligned buffer len");
 342   assert(((intptr_t)featureBuffer&0x0007) == 0, "unaligned feature buffer");
 343   if (featureNum < 0) {
 344     // Any bit set at all?
 345     bool anyBit = false;
 346     for (size_t i = 0; i < bufLen/(8*sizeof(long)); i++) {
 347       anyBit = anyBit || (featureBuffer[i] != 0);
 348     }
 349     return anyBit;


< prev index next >