7006505: Use kstat info to identify SPARC processor

Read Solaris kstat data to get more precise CPU information

Reviewed-by: iveresov, never, twisti, dholmes
This commit is contained in:
Vladimir Kozlov 2010-12-16 14:15:12 -08:00
parent b80ad03e3f
commit 9fd396ce55
8 changed files with 136 additions and 51 deletions

View file

@ -38,12 +38,6 @@
int VM_Version::_features = VM_Version::unknown_m;
const char* VM_Version::_features_str = "";
bool VM_Version::is_niagara1_plus() {
// This is a placeholder until the real test is determined.
return is_niagara1() &&
(os::processor_count() > maximum_niagara1_processor_count());
}
void VM_Version::initialize() {
_features = determine_features();
PrefetchCopyIntervalInBytes = prefetch_copy_interval_in_bytes();
@ -69,11 +63,21 @@ void VM_Version::initialize() {
_supports_cx8 = has_v9();
if (is_niagara1()) {
if (is_niagara()) {
// Indirect branch is the same cost as direct
if (FLAG_IS_DEFAULT(UseInlineCaches)) {
FLAG_SET_DEFAULT(UseInlineCaches, false);
}
// Align loops on a single instruction boundary.
if (FLAG_IS_DEFAULT(OptoLoopAlignment)) {
FLAG_SET_DEFAULT(OptoLoopAlignment, 4);
}
// When using CMS, we cannot use memset() in BOT updates because
// the sun4v/CMT version in libc_psr uses BIS which exposes
// "phantom zeros" to concurrent readers. See 6948537.
if (FLAG_IS_DEFAULT(UseMemSetInBOT) && UseConcMarkSweepGC) {
FLAG_SET_DEFAULT(UseMemSetInBOT, false);
}
#ifdef _LP64
// 32-bit oops don't make sense for the 64-bit VM on sparc
// since the 32-bit VM has the same registers and smaller objects.
@ -89,7 +93,7 @@ void VM_Version::initialize() {
if (FLAG_IS_DEFAULT(InteriorEntryAlignment)) {
FLAG_SET_DEFAULT(InteriorEntryAlignment, 4);
}
if (is_niagara1_plus()) {
if (is_niagara_plus()) {
if (has_blk_init() && AllocatePrefetchStyle > 0 &&
FLAG_IS_DEFAULT(AllocatePrefetchStyle)) {
// Use BIS instruction for allocation prefetch.
@ -105,15 +109,6 @@ void VM_Version::initialize() {
}
}
#endif
if (FLAG_IS_DEFAULT(OptoLoopAlignment)) {
FLAG_SET_DEFAULT(OptoLoopAlignment, 4);
}
// When using CMS, we cannot use memset() in BOT updates because
// the sun4v/CMT version in libc_psr uses BIS which exposes
// "phantom zeros" to concurrent readers. See 6948537.
if (FLAG_IS_DEFAULT(UseMemSetInBOT) && UseConcMarkSweepGC) {
FLAG_SET_DEFAULT(UseMemSetInBOT, false);
}
}
// Use hardware population count instruction if available.
@ -129,17 +124,18 @@ void VM_Version::initialize() {
#endif
char buf[512];
jio_snprintf(buf, sizeof(buf), "%s%s%s%s%s%s%s%s%s%s%s%s%s%s",
jio_snprintf(buf, sizeof(buf), "%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s",
(has_v8() ? ", has_v8" : ""),
(has_v9() ? ", has_v9" : ""),
(has_hardware_popc() ? ", popc" : ""),
(has_vis1() ? ", has_vis1" : ""),
(has_vis2() ? ", has_vis2" : ""),
(has_vis3() ? ", has_vis3" : ""),
(has_blk_init() ? ", has_blk_init" : ""),
(is_ultra3() ? ", is_ultra3" : ""),
(is_sun4v() ? ", is_sun4v" : ""),
(is_niagara1() ? ", is_niagara1" : ""),
(is_niagara1_plus() ? ", is_niagara1_plus" : ""),
(is_niagara() ? ", is_niagara" : ""),
(is_niagara_plus() ? ", is_niagara_plus" : ""),
(is_sparc64() ? ", is_sparc64" : ""),
(!has_hardware_mul32() ? ", no-mul32" : ""),
(!has_hardware_div32() ? ", no-div32" : ""),
@ -190,17 +186,18 @@ int VM_Version::determine_features() {
warning("Cannot recognize SPARC version. Default to V9");
}
if (UseNiagaraInstrs) {
if (is_niagara1(features)) {
assert(is_T_family(features) == is_niagara(features), "Niagara should be T series");
if (UseNiagaraInstrs) { // Force code generation for Niagara
if (is_T_family(features)) {
// Happy to accomodate...
} else {
NOT_PRODUCT(if (PrintMiscellaneous && Verbose) tty->print_cr("Version is Forced-Niagara");)
features = niagara1_m;
features |= T_family_m;
}
} else {
if (is_niagara1(features) && !FLAG_IS_DEFAULT(UseNiagaraInstrs)) {
if (is_T_family(features) && !FLAG_IS_DEFAULT(UseNiagaraInstrs)) {
NOT_PRODUCT(if (PrintMiscellaneous && Verbose) tty->print_cr("Version is Forced-Not-Niagara");)
features &= ~niagara1_unique_m;
features &= ~(T_family_m | T1_model_m);
} else {
// Happy to accomodate...
}
@ -222,7 +219,7 @@ void VM_Version::revert() {
unsigned int VM_Version::calc_parallel_worker_threads() {
unsigned int result;
if (is_niagara1_plus()) {
if (is_niagara_plus()) {
result = nof_parallel_worker_threads(5, 16, 8);
} else {
result = nof_parallel_worker_threads(5, 8, 8);