hotspot/src/cpu/sparc/vm/vm_version_sparc.cpp
changeset 7704 cc9d3ed42704
parent 7397 5b173b4ca846
child 10027 20cd71f29262
equal deleted inserted replaced
7703:f02889c8dc88 7704:cc9d3ed42704
    35 # include "os_solaris.inline.hpp"
    35 # include "os_solaris.inline.hpp"
    36 #endif
    36 #endif
    37 
    37 
    38 int VM_Version::_features = VM_Version::unknown_m;
    38 int VM_Version::_features = VM_Version::unknown_m;
    39 const char* VM_Version::_features_str = "";
    39 const char* VM_Version::_features_str = "";
    40 
       
    41 bool VM_Version::is_niagara1_plus() {
       
    42   // This is a placeholder until the real test is determined.
       
    43   return is_niagara1() &&
       
    44     (os::processor_count() > maximum_niagara1_processor_count());
       
    45 }
       
    46 
    40 
    47 void VM_Version::initialize() {
    41 void VM_Version::initialize() {
    48   _features = determine_features();
    42   _features = determine_features();
    49   PrefetchCopyIntervalInBytes = prefetch_copy_interval_in_bytes();
    43   PrefetchCopyIntervalInBytes = prefetch_copy_interval_in_bytes();
    50   PrefetchScanIntervalInBytes = prefetch_scan_interval_in_bytes();
    44   PrefetchScanIntervalInBytes = prefetch_scan_interval_in_bytes();
    67 
    61 
    68   UseSSE = 0; // Only on x86 and x64
    62   UseSSE = 0; // Only on x86 and x64
    69 
    63 
    70   _supports_cx8               = has_v9();
    64   _supports_cx8               = has_v9();
    71 
    65 
    72   if (is_niagara1()) {
    66   if (is_niagara()) {
    73     // Indirect branch is the same cost as direct
    67     // Indirect branch is the same cost as direct
    74     if (FLAG_IS_DEFAULT(UseInlineCaches)) {
    68     if (FLAG_IS_DEFAULT(UseInlineCaches)) {
    75       FLAG_SET_DEFAULT(UseInlineCaches, false);
    69       FLAG_SET_DEFAULT(UseInlineCaches, false);
       
    70     }
       
    71     // Align loops on a single instruction boundary.
       
    72     if (FLAG_IS_DEFAULT(OptoLoopAlignment)) {
       
    73       FLAG_SET_DEFAULT(OptoLoopAlignment, 4);
       
    74     }
       
    75     // When using CMS, we cannot use memset() in BOT updates because
       
    76     // the sun4v/CMT version in libc_psr uses BIS which exposes
       
    77     // "phantom zeros" to concurrent readers. See 6948537.
       
    78     if (FLAG_IS_DEFAULT(UseMemSetInBOT) && UseConcMarkSweepGC) {
       
    79       FLAG_SET_DEFAULT(UseMemSetInBOT, false);
    76     }
    80     }
    77 #ifdef _LP64
    81 #ifdef _LP64
    78     // 32-bit oops don't make sense for the 64-bit VM on sparc
    82     // 32-bit oops don't make sense for the 64-bit VM on sparc
    79     // since the 32-bit VM has the same registers and smaller objects.
    83     // since the 32-bit VM has the same registers and smaller objects.
    80     Universe::set_narrow_oop_shift(LogMinObjAlignmentInBytes);
    84     Universe::set_narrow_oop_shift(LogMinObjAlignmentInBytes);
    87     // Single-issue, so entry and loop tops are
    91     // Single-issue, so entry and loop tops are
    88     // aligned on a single instruction boundary
    92     // aligned on a single instruction boundary
    89     if (FLAG_IS_DEFAULT(InteriorEntryAlignment)) {
    93     if (FLAG_IS_DEFAULT(InteriorEntryAlignment)) {
    90       FLAG_SET_DEFAULT(InteriorEntryAlignment, 4);
    94       FLAG_SET_DEFAULT(InteriorEntryAlignment, 4);
    91     }
    95     }
    92     if (is_niagara1_plus()) {
    96     if (is_niagara_plus()) {
    93       if (has_blk_init() && AllocatePrefetchStyle > 0 &&
    97       if (has_blk_init() && AllocatePrefetchStyle > 0 &&
    94           FLAG_IS_DEFAULT(AllocatePrefetchStyle)) {
    98           FLAG_IS_DEFAULT(AllocatePrefetchStyle)) {
    95         // Use BIS instruction for allocation prefetch.
    99         // Use BIS instruction for allocation prefetch.
    96         FLAG_SET_DEFAULT(AllocatePrefetchStyle, 3);
   100         FLAG_SET_DEFAULT(AllocatePrefetchStyle, 3);
    97         if (FLAG_IS_DEFAULT(AllocatePrefetchDistance)) {
   101         if (FLAG_IS_DEFAULT(AllocatePrefetchDistance)) {
   103         // Use different prefetch distance without BIS
   107         // Use different prefetch distance without BIS
   104         FLAG_SET_DEFAULT(AllocatePrefetchDistance, 256);
   108         FLAG_SET_DEFAULT(AllocatePrefetchDistance, 256);
   105       }
   109       }
   106     }
   110     }
   107 #endif
   111 #endif
   108     if (FLAG_IS_DEFAULT(OptoLoopAlignment)) {
       
   109       FLAG_SET_DEFAULT(OptoLoopAlignment, 4);
       
   110     }
       
   111     // When using CMS, we cannot use memset() in BOT updates because
       
   112     // the sun4v/CMT version in libc_psr uses BIS which exposes
       
   113     // "phantom zeros" to concurrent readers. See 6948537.
       
   114     if (FLAG_IS_DEFAULT(UseMemSetInBOT) && UseConcMarkSweepGC) {
       
   115       FLAG_SET_DEFAULT(UseMemSetInBOT, false);
       
   116     }
       
   117   }
   112   }
   118 
   113 
   119   // Use hardware population count instruction if available.
   114   // Use hardware population count instruction if available.
   120   if (has_hardware_popc()) {
   115   if (has_hardware_popc()) {
   121     if (FLAG_IS_DEFAULT(UsePopCountInstruction)) {
   116     if (FLAG_IS_DEFAULT(UsePopCountInstruction)) {
   127   // Currently not supported anywhere.
   122   // Currently not supported anywhere.
   128   FLAG_SET_DEFAULT(UseFPUForSpilling, false);
   123   FLAG_SET_DEFAULT(UseFPUForSpilling, false);
   129 #endif
   124 #endif
   130 
   125 
   131   char buf[512];
   126   char buf[512];
   132   jio_snprintf(buf, sizeof(buf), "%s%s%s%s%s%s%s%s%s%s%s%s%s%s",
   127   jio_snprintf(buf, sizeof(buf), "%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s",
   133                (has_v8() ? ", has_v8" : ""),
   128                (has_v8() ? ", has_v8" : ""),
   134                (has_v9() ? ", has_v9" : ""),
   129                (has_v9() ? ", has_v9" : ""),
   135                (has_hardware_popc() ? ", popc" : ""),
   130                (has_hardware_popc() ? ", popc" : ""),
   136                (has_vis1() ? ", has_vis1" : ""),
   131                (has_vis1() ? ", has_vis1" : ""),
   137                (has_vis2() ? ", has_vis2" : ""),
   132                (has_vis2() ? ", has_vis2" : ""),
       
   133                (has_vis3() ? ", has_vis3" : ""),
   138                (has_blk_init() ? ", has_blk_init" : ""),
   134                (has_blk_init() ? ", has_blk_init" : ""),
   139                (is_ultra3() ? ", is_ultra3" : ""),
   135                (is_ultra3() ? ", is_ultra3" : ""),
   140                (is_sun4v() ? ", is_sun4v" : ""),
   136                (is_sun4v() ? ", is_sun4v" : ""),
   141                (is_niagara1() ? ", is_niagara1" : ""),
   137                (is_niagara() ? ", is_niagara" : ""),
   142                (is_niagara1_plus() ? ", is_niagara1_plus" : ""),
   138                (is_niagara_plus() ? ", is_niagara_plus" : ""),
   143                (is_sparc64() ? ", is_sparc64" : ""),
   139                (is_sparc64() ? ", is_sparc64" : ""),
   144                (!has_hardware_mul32() ? ", no-mul32" : ""),
   140                (!has_hardware_mul32() ? ", no-mul32" : ""),
   145                (!has_hardware_div32() ? ", no-div32" : ""),
   141                (!has_hardware_div32() ? ", no-div32" : ""),
   146                (!has_hardware_fsmuld() ? ", no-fsmuld" : ""));
   142                (!has_hardware_fsmuld() ? ", no-fsmuld" : ""));
   147 
   143 
   188   if (features == unknown_m) {
   184   if (features == unknown_m) {
   189     features = generic_v9_m;
   185     features = generic_v9_m;
   190     warning("Cannot recognize SPARC version. Default to V9");
   186     warning("Cannot recognize SPARC version. Default to V9");
   191   }
   187   }
   192 
   188 
   193   if (UseNiagaraInstrs) {
   189   assert(is_T_family(features) == is_niagara(features), "Niagara should be T series");
   194     if (is_niagara1(features)) {
   190   if (UseNiagaraInstrs) { // Force code generation for Niagara
       
   191     if (is_T_family(features)) {
   195       // Happy to accomodate...
   192       // Happy to accomodate...
   196     } else {
   193     } else {
   197       NOT_PRODUCT(if (PrintMiscellaneous && Verbose) tty->print_cr("Version is Forced-Niagara");)
   194       NOT_PRODUCT(if (PrintMiscellaneous && Verbose) tty->print_cr("Version is Forced-Niagara");)
   198       features = niagara1_m;
   195       features |= T_family_m;
   199     }
   196     }
   200   } else {
   197   } else {
   201     if (is_niagara1(features) && !FLAG_IS_DEFAULT(UseNiagaraInstrs)) {
   198     if (is_T_family(features) && !FLAG_IS_DEFAULT(UseNiagaraInstrs)) {
   202       NOT_PRODUCT(if (PrintMiscellaneous && Verbose) tty->print_cr("Version is Forced-Not-Niagara");)
   199       NOT_PRODUCT(if (PrintMiscellaneous && Verbose) tty->print_cr("Version is Forced-Not-Niagara");)
   203       features &= ~niagara1_unique_m;
   200       features &= ~(T_family_m | T1_model_m);
   204     } else {
   201     } else {
   205       // Happy to accomodate...
   202       // Happy to accomodate...
   206     }
   203     }
   207   }
   204   }
   208 
   205 
   220   _features = saved_features;
   217   _features = saved_features;
   221 }
   218 }
   222 
   219 
   223 unsigned int VM_Version::calc_parallel_worker_threads() {
   220 unsigned int VM_Version::calc_parallel_worker_threads() {
   224   unsigned int result;
   221   unsigned int result;
   225   if (is_niagara1_plus()) {
   222   if (is_niagara_plus()) {
   226     result = nof_parallel_worker_threads(5, 16, 8);
   223     result = nof_parallel_worker_threads(5, 16, 8);
   227   } else {
   224   } else {
   228     result = nof_parallel_worker_threads(5, 8, 8);
   225     result = nof_parallel_worker_threads(5, 8, 8);
   229   }
   226   }
   230   return result;
   227   return result;