comparison src/cpu/x86/vm/vm_version_x86.hpp @ 17780:606acabe7b5c

8031320: Use Intel RTM instructions for locks Summary: Use RTM for inflated locks and stack locks. Reviewed-by: iveresov, twisti, roland, dcubed
author kvn
date Thu, 20 Mar 2014 17:49:27 -0700
parents 98af1e198e73
children 0118c8c7b80f
comparison
equal deleted inserted replaced
17778:a48e16541e6b 17780:606acabe7b5c
205 : 1, 205 : 1,
206 avx2 : 1, 206 avx2 : 1,
207 : 2, 207 : 2,
208 bmi2 : 1, 208 bmi2 : 1,
209 erms : 1, 209 erms : 1,
210 : 22; 210 : 1,
211 rtm : 1,
212 : 20;
211 } bits; 213 } bits;
212 }; 214 };
213 215
214 union XemXcr0Eax { 216 union XemXcr0Eax {
215 uint32_t value; 217 uint32_t value;
255 CPU_AVX2 = (1 << 18), 257 CPU_AVX2 = (1 << 18),
256 CPU_AES = (1 << 19), 258 CPU_AES = (1 << 19),
257 CPU_ERMS = (1 << 20), // enhanced 'rep movsb/stosb' instructions 259 CPU_ERMS = (1 << 20), // enhanced 'rep movsb/stosb' instructions
258 CPU_CLMUL = (1 << 21), // carryless multiply for CRC 260 CPU_CLMUL = (1 << 21), // carryless multiply for CRC
259 CPU_BMI1 = (1 << 22), 261 CPU_BMI1 = (1 << 22),
260 CPU_BMI2 = (1 << 23) 262 CPU_BMI2 = (1 << 23),
263 CPU_RTM = (1 << 24) // Restricted Transactional Memory instructions
261 } cpuFeatureFlags; 264 } cpuFeatureFlags;
262 265
263 enum { 266 enum {
264 // AMD 267 // AMD
265 CPU_FAMILY_AMD_11H = 0x11, 268 CPU_FAMILY_AMD_11H = 0x11,
442 result |= CPU_AES; 445 result |= CPU_AES;
443 if (_cpuid_info.sef_cpuid7_ebx.bits.erms != 0) 446 if (_cpuid_info.sef_cpuid7_ebx.bits.erms != 0)
444 result |= CPU_ERMS; 447 result |= CPU_ERMS;
445 if (_cpuid_info.std_cpuid1_ecx.bits.clmul != 0) 448 if (_cpuid_info.std_cpuid1_ecx.bits.clmul != 0)
446 result |= CPU_CLMUL; 449 result |= CPU_CLMUL;
450 if (_cpuid_info.sef_cpuid7_ebx.bits.rtm != 0)
451 result |= CPU_RTM;
447 452
448 // AMD features. 453 // AMD features.
449 if (is_amd()) { 454 if (is_amd()) {
450 if ((_cpuid_info.ext_cpuid1_edx.bits.tdnow != 0) || 455 if ((_cpuid_info.ext_cpuid1_edx.bits.tdnow != 0) ||
451 (_cpuid_info.ext_cpuid1_ecx.bits.prefetchw != 0)) 456 (_cpuid_info.ext_cpuid1_ecx.bits.prefetchw != 0))
511 static void set_avx_cpuFeatures() { _cpuFeatures = (CPU_SSE | CPU_SSE2 | CPU_AVX); } 516 static void set_avx_cpuFeatures() { _cpuFeatures = (CPU_SSE | CPU_SSE2 | CPU_AVX); }
512 517
513 518
514 // Initialization 519 // Initialization
515 static void initialize(); 520 static void initialize();
521
522 // Override Abstract_VM_Version implementation
523 static bool use_biased_locking();
516 524
517 // Asserts 525 // Asserts
518 static void assert_is_initialized() { 526 static void assert_is_initialized() {
519 assert(_cpuid_info.std_cpuid1_eax.bits.family != 0, "VM_Version not initialized"); 527 assert(_cpuid_info.std_cpuid1_eax.bits.family != 0, "VM_Version not initialized");
520 } 528 }
604 static bool supports_avx2() { return (_cpuFeatures & CPU_AVX2) != 0; } 612 static bool supports_avx2() { return (_cpuFeatures & CPU_AVX2) != 0; }
605 static bool supports_tsc() { return (_cpuFeatures & CPU_TSC) != 0; } 613 static bool supports_tsc() { return (_cpuFeatures & CPU_TSC) != 0; }
606 static bool supports_aes() { return (_cpuFeatures & CPU_AES) != 0; } 614 static bool supports_aes() { return (_cpuFeatures & CPU_AES) != 0; }
607 static bool supports_erms() { return (_cpuFeatures & CPU_ERMS) != 0; } 615 static bool supports_erms() { return (_cpuFeatures & CPU_ERMS) != 0; }
608 static bool supports_clmul() { return (_cpuFeatures & CPU_CLMUL) != 0; } 616 static bool supports_clmul() { return (_cpuFeatures & CPU_CLMUL) != 0; }
617 static bool supports_rtm() { return (_cpuFeatures & CPU_RTM) != 0; }
609 static bool supports_bmi1() { return (_cpuFeatures & CPU_BMI1) != 0; } 618 static bool supports_bmi1() { return (_cpuFeatures & CPU_BMI1) != 0; }
610 static bool supports_bmi2() { return (_cpuFeatures & CPU_BMI2) != 0; } 619 static bool supports_bmi2() { return (_cpuFeatures & CPU_BMI2) != 0; }
611 // Intel features 620 // Intel features
612 static bool is_intel_family_core() { return is_intel() && 621 static bool is_intel_family_core() { return is_intel() &&
613 extended_cpu_family() == CPU_FAMILY_INTEL_CORE; } 622 extended_cpu_family() == CPU_FAMILY_INTEL_CORE; }