< prev index next >

src/hotspot/cpu/x86/vm_version_x86.cpp

Print this page
rev 52433 : 8213538: VM crashes when MaxVectorSize is set to 0, 1 or 2
Summary: Require MaxVectorSize minimum 4 on 64 bit
Reviewed-by:


 967       FLAG_SET_DEFAULT(PrintPreciseRTMLockingStatistics, false);
 968     }
 969   }
 970 #else
 971   if (UseRTMLocking) {
 972     // Only C2 does RTM locking optimization.
 973     // Can't continue because UseRTMLocking affects UseBiasedLocking flag
 974     // setting during arguments processing. See use_biased_locking().
 975     vm_exit_during_initialization("RTM locking optimization is not supported in this VM");
 976   }
 977 #endif
 978 
 979 #ifdef COMPILER2
 980   if (UseFPUForSpilling) {
 981     if (UseSSE < 2) {
 982       // Only supported with SSE2+
 983       FLAG_SET_DEFAULT(UseFPUForSpilling, false);
 984     }
 985   }
 986 #endif

 987 #if COMPILER2_OR_JVMCI
 988   if (MaxVectorSize > 0) {
 989     if (!is_power_of_2(MaxVectorSize)) {
 990       warning("MaxVectorSize must be a power of 2");
 991       FLAG_SET_DEFAULT(MaxVectorSize, 64);
 992     }
 993     if (UseSSE < 2) {
 994       // Vectors (in XMM) are only supported with SSE2+
 995       if (MaxVectorSize > 0) {
 996         if (!FLAG_IS_DEFAULT(MaxVectorSize))
 997           warning("MaxVectorSize must be 0");
 998         FLAG_SET_DEFAULT(MaxVectorSize, 0);
 999       }
1000     }
1001     else if (UseAVX == 0 || !os_supports_avx_vectors()) {
1002       // 32 bytes vectors (in YMM) are only supported with AVX+
1003       if (MaxVectorSize > 16) {
1004         if (!FLAG_IS_DEFAULT(MaxVectorSize))
1005           warning("MaxVectorSize must be <= 16");
1006         FLAG_SET_DEFAULT(MaxVectorSize, 16);
1007       }
1008     }
1009     else if (UseAVX == 1 || UseAVX == 2) {
1010       // 64 bytes vectors (in ZMM) are only supported with AVX 3
1011       if (MaxVectorSize > 32) {
1012         if (!FLAG_IS_DEFAULT(MaxVectorSize))
1013           warning("MaxVectorSize must be <= 32");
1014         FLAG_SET_DEFAULT(MaxVectorSize, 32);
1015       }














1016     }
1017     else if (UseAVX > 2 ) {
1018       if (MaxVectorSize > 64) {
1019         if (!FLAG_IS_DEFAULT(MaxVectorSize))
1020           warning("MaxVectorSize must be <= 64");
1021         FLAG_SET_DEFAULT(MaxVectorSize, 64);
1022       }



1023     }

1024 #if defined(COMPILER2) && defined(ASSERT)

1025     if (supports_avx() && PrintMiscellaneous && Verbose && TraceNewVectors) {
1026       tty->print_cr("State of YMM registers after signal handle:");
1027       int nreg = 2 LP64_ONLY(+2);
1028       const char* ymm_name[4] = {"0", "7", "8", "15"};
1029       for (int i = 0; i < nreg; i++) {
1030         tty->print("YMM%s:", ymm_name[i]);
1031         for (int j = 7; j >=0; j--) {
1032           tty->print(" %x", _cpuid_info.ymm_save[i*8 + j]);
1033         }
1034         tty->cr();
1035       }
1036     }
1037 #endif // COMPILER2 && ASSERT
1038   }
1039 #endif // COMPILER2_OR_JVMCI
1040 
1041 #ifdef COMPILER2
1042 #ifdef _LP64
1043   if (FLAG_IS_DEFAULT(UseMultiplyToLenIntrinsic)) {
1044     UseMultiplyToLenIntrinsic = true;




 967       FLAG_SET_DEFAULT(PrintPreciseRTMLockingStatistics, false);
 968     }
 969   }
 970 #else
 971   if (UseRTMLocking) {
 972     // Only C2 does RTM locking optimization.
 973     // Can't continue because UseRTMLocking affects UseBiasedLocking flag
 974     // setting during arguments processing. See use_biased_locking().
 975     vm_exit_during_initialization("RTM locking optimization is not supported in this VM");
 976   }
 977 #endif
 978 
 979 #ifdef COMPILER2
 980   if (UseFPUForSpilling) {
 981     if (UseSSE < 2) {
 982       // Only supported with SSE2+
 983       FLAG_SET_DEFAULT(UseFPUForSpilling, false);
 984     }
 985   }
 986 #endif
 987 
 988 #if COMPILER2_OR_JVMCI
 989   int mvs_max = 0;




 990   if (UseSSE < 2) {
 991     // Vectors (in XMM) are only supported with SSE2+
 992     // SSE is always 2 on x64.
 993     mvs_max = 0;
 994   } else if (UseAVX == 0 || !os_supports_avx_vectors()) {
 995     // 16 byte vectors (in XMM) are supported with SSE2+
 996     mvs_max = 16;
 997   } else if (UseAVX == 1 || UseAVX == 2) {

 998     // 32 bytes vectors (in YMM) are only supported with AVX+
 999     mvs_max = 32;
1000   } else if (UseAVX > 2 ) {





1001     // 64 bytes vectors (in ZMM) are only supported with AVX 3
1002     mvs_max = 64;



1003   }
1004 
1005   int mvs_min = 0;
1006 #ifdef _LP64
1007   mvs_min = 4; // We require MaxVectorSize to be at least 4 on 64bit
1008 #endif
1009 
1010   if (!FLAG_IS_DEFAULT(MaxVectorSize)) {
1011     if (MaxVectorSize < mvs_min) {
1012       warning("MaxVectorSize must be at least %i on this platform", mvs_min);
1013       FLAG_SET_DEFAULT(MaxVectorSize, mvs_min);
1014     }
1015     if (MaxVectorSize > mvs_max) {
1016       warning("MaxVectorSize must be at most %i on this platform", mvs_max);
1017       FLAG_SET_DEFAULT(MaxVectorSize, mvs_max);
1018     }
1019     if (!is_power_of_2(MaxVectorSize)) {
1020       warning("MaxVectorSize must be a power of 2, setting to default: %i", mvs_max);
1021       FLAG_SET_DEFAULT(MaxVectorSize, mvs_max);


1022     }
1023   } else {
1024     // If default, use highest supported configuration
1025     FLAG_SET_DEFAULT(MaxVectorSize, mvs_max);
1026   }
1027 
1028 #if defined(COMPILER2) && defined(ASSERT)
1029   if (MaxVectorSize > 0) {
1030     if (supports_avx() && PrintMiscellaneous && Verbose && TraceNewVectors) {
1031       tty->print_cr("State of YMM registers after signal handle:");
1032       int nreg = 2 LP64_ONLY(+2);
1033       const char* ymm_name[4] = {"0", "7", "8", "15"};
1034       for (int i = 0; i < nreg; i++) {
1035         tty->print("YMM%s:", ymm_name[i]);
1036         for (int j = 7; j >=0; j--) {
1037           tty->print(" %x", _cpuid_info.ymm_save[i*8 + j]);
1038         }
1039         tty->cr();
1040       }
1041     }
1042 #endif // COMPILER2 && ASSERT
1043   }
1044 #endif // COMPILER2_OR_JVMCI
1045 
1046 #ifdef COMPILER2
1047 #ifdef _LP64
1048   if (FLAG_IS_DEFAULT(UseMultiplyToLenIntrinsic)) {
1049     UseMultiplyToLenIntrinsic = true;


< prev index next >