vm_version_sparc.cpp revision 675
0N/A/*
641N/A * Copyright 1997-2009 Sun Microsystems, Inc. All Rights Reserved.
0N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
0N/A *
0N/A * This code is free software; you can redistribute it and/or modify it
0N/A * under the terms of the GNU General Public License version 2 only, as
0N/A * published by the Free Software Foundation.
0N/A *
0N/A * This code is distributed in the hope that it will be useful, but WITHOUT
0N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
0N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
0N/A * version 2 for more details (a copy is included in the LICENSE file that
0N/A * accompanied this code).
0N/A *
0N/A * You should have received a copy of the GNU General Public License version
0N/A * 2 along with this work; if not, write to the Free Software Foundation,
0N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
0N/A *
0N/A * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
0N/A * CA 95054 USA or visit www.sun.com if you need additional information or
0N/A * have any questions.
0N/A *
0N/A */
0N/A
0N/A# include "incls/_precompiled.incl"
0N/A# include "incls/_vm_version_sparc.cpp.incl"
0N/A
0N/Aint VM_Version::_features = VM_Version::unknown_m;
0N/Aconst char* VM_Version::_features_str = "";
0N/A
10N/Abool VM_Version::is_niagara1_plus() {
10N/A // This is a placeholder until the real test is determined.
10N/A return is_niagara1() &&
10N/A (os::processor_count() > maximum_niagara1_processor_count());
10N/A}
10N/A
0N/Avoid VM_Version::initialize() {
0N/A _features = determine_features();
0N/A PrefetchCopyIntervalInBytes = prefetch_copy_interval_in_bytes();
0N/A PrefetchScanIntervalInBytes = prefetch_scan_interval_in_bytes();
0N/A PrefetchFieldsAhead = prefetch_fields_ahead();
0N/A
0N/A // Allocation prefetch settings
0N/A intx cache_line_size = L1_data_cache_line_size();
0N/A if( cache_line_size > AllocatePrefetchStepSize )
0N/A AllocatePrefetchStepSize = cache_line_size;
0N/A if( FLAG_IS_DEFAULT(AllocatePrefetchLines) )
0N/A AllocatePrefetchLines = 3; // Optimistic value
0N/A assert( AllocatePrefetchLines > 0, "invalid value");
0N/A if( AllocatePrefetchLines < 1 ) // set valid value in product VM
0N/A AllocatePrefetchLines = 1; // Conservative value
0N/A
0N/A AllocatePrefetchDistance = allocate_prefetch_distance();
0N/A AllocatePrefetchStyle = allocate_prefetch_style();
0N/A
0N/A assert(AllocatePrefetchDistance % AllocatePrefetchStepSize == 0, "invalid value");
0N/A
0N/A UseSSE = 0; // Only on x86 and x64
0N/A
0N/A _supports_cx8 = has_v9();
0N/A
0N/A if (is_niagara1()) {
0N/A // Indirect branch is the same cost as direct
0N/A if (FLAG_IS_DEFAULT(UseInlineCaches)) {
675N/A FLAG_SET_DEFAULT(UseInlineCaches, false);
0N/A }
113N/A#ifdef _LP64
113N/A // Single issue niagara1 is slower for CompressedOops
113N/A // but niagaras after that it's fine.
113N/A if (!is_niagara1_plus()) {
113N/A if (FLAG_IS_DEFAULT(UseCompressedOops)) {
113N/A FLAG_SET_ERGO(bool, UseCompressedOops, false);
113N/A }
113N/A }
642N/A // 32-bit oops don't make sense for the 64-bit VM on sparc
642N/A // since the 32-bit VM has the same registers and smaller objects.
642N/A Universe::set_narrow_oop_shift(LogMinObjAlignmentInBytes);
113N/A#endif // _LP64
0N/A#ifdef COMPILER2
0N/A // Indirect branch is the same cost as direct
0N/A if (FLAG_IS_DEFAULT(UseJumpTables)) {
675N/A FLAG_SET_DEFAULT(UseJumpTables, true);
0N/A }
0N/A // Single-issue, so entry and loop tops are
0N/A // aligned on a single instruction boundary
0N/A if (FLAG_IS_DEFAULT(InteriorEntryAlignment)) {
675N/A FLAG_SET_DEFAULT(InteriorEntryAlignment, 4);
0N/A }
0N/A if (FLAG_IS_DEFAULT(OptoLoopAlignment)) {
675N/A FLAG_SET_DEFAULT(OptoLoopAlignment, 4);
675N/A }
675N/A if (is_niagara1_plus() && FLAG_IS_DEFAULT(AllocatePrefetchDistance)) {
675N/A // Use smaller prefetch distance on N2
675N/A FLAG_SET_DEFAULT(AllocatePrefetchDistance, 256);
0N/A }
0N/A#endif
0N/A }
0N/A
643N/A // Use hardware population count instruction if available.
643N/A if (has_hardware_popc()) {
643N/A if (FLAG_IS_DEFAULT(UsePopCountInstruction)) {
675N/A FLAG_SET_DEFAULT(UsePopCountInstruction, true);
643N/A }
643N/A }
643N/A
0N/A char buf[512];
643N/A jio_snprintf(buf, sizeof(buf), "%s%s%s%s%s%s%s%s%s%s%s%s",
0N/A (has_v8() ? ", has_v8" : ""),
0N/A (has_v9() ? ", has_v9" : ""),
643N/A (has_hardware_popc() ? ", popc" : ""),
0N/A (has_vis1() ? ", has_vis1" : ""),
0N/A (has_vis2() ? ", has_vis2" : ""),
0N/A (is_ultra3() ? ", is_ultra3" : ""),
0N/A (is_sun4v() ? ", is_sun4v" : ""),
0N/A (is_niagara1() ? ", is_niagara1" : ""),
641N/A (is_niagara1_plus() ? ", is_niagara1_plus" : ""),
641N/A (!has_hardware_mul32() ? ", no-mul32" : ""),
641N/A (!has_hardware_div32() ? ", no-div32" : ""),
0N/A (!has_hardware_fsmuld() ? ", no-fsmuld" : ""));
0N/A
0N/A // buf is started with ", " or is empty
0N/A _features_str = strdup(strlen(buf) > 2 ? buf + 2 : buf);
0N/A
0N/A#ifndef PRODUCT
0N/A if (PrintMiscellaneous && Verbose) {
0N/A tty->print("Allocation: ");
0N/A if (AllocatePrefetchStyle <= 0) {
0N/A tty->print_cr("no prefetching");
0N/A } else {
0N/A if (AllocatePrefetchLines > 1) {
0N/A tty->print_cr("PREFETCH %d, %d lines of size %d bytes", AllocatePrefetchDistance, AllocatePrefetchLines, AllocatePrefetchStepSize);
0N/A } else {
0N/A tty->print_cr("PREFETCH %d, one line", AllocatePrefetchDistance);
0N/A }
0N/A }
0N/A if (PrefetchCopyIntervalInBytes > 0) {
0N/A tty->print_cr("PrefetchCopyIntervalInBytes %d", PrefetchCopyIntervalInBytes);
0N/A }
0N/A if (PrefetchScanIntervalInBytes > 0) {
0N/A tty->print_cr("PrefetchScanIntervalInBytes %d", PrefetchScanIntervalInBytes);
0N/A }
0N/A if (PrefetchFieldsAhead > 0) {
0N/A tty->print_cr("PrefetchFieldsAhead %d", PrefetchFieldsAhead);
0N/A }
0N/A }
0N/A#endif // PRODUCT
0N/A}
0N/A
0N/Avoid VM_Version::print_features() {
0N/A tty->print_cr("Version:%s", cpu_features());
0N/A}
0N/A
0N/Aint VM_Version::determine_features() {
0N/A if (UseV8InstrsOnly) {
0N/A NOT_PRODUCT(if (PrintMiscellaneous && Verbose) tty->print_cr("Version is Forced-V8");)
0N/A return generic_v8_m;
0N/A }
0N/A
0N/A int features = platform_features(unknown_m); // platform_features() is os_arch specific
0N/A
0N/A if (features == unknown_m) {
0N/A features = generic_v9_m;
0N/A warning("Cannot recognize SPARC version. Default to V9");
0N/A }
0N/A
0N/A if (UseNiagaraInstrs) {
0N/A if (is_niagara1(features)) {
0N/A // Happy to accomodate...
0N/A } else {
0N/A NOT_PRODUCT(if (PrintMiscellaneous && Verbose) tty->print_cr("Version is Forced-Niagara");)
0N/A features = niagara1_m;
0N/A }
0N/A } else {
0N/A if (is_niagara1(features) && !FLAG_IS_DEFAULT(UseNiagaraInstrs)) {
0N/A NOT_PRODUCT(if (PrintMiscellaneous && Verbose) tty->print_cr("Version is Forced-Not-Niagara");)
0N/A features &= ~niagara1_unique_m;
0N/A } else {
0N/A // Happy to accomodate...
0N/A }
0N/A }
0N/A
0N/A return features;
0N/A}
0N/A
0N/Astatic int saved_features = 0;
0N/A
0N/Avoid VM_Version::allow_all() {
0N/A saved_features = _features;
0N/A _features = all_features_m;
0N/A}
0N/A
0N/Avoid VM_Version::revert() {
0N/A _features = saved_features;
0N/A}
10N/A
10N/Aunsigned int VM_Version::calc_parallel_worker_threads() {
10N/A unsigned int result;
10N/A if (is_niagara1_plus()) {
10N/A result = nof_parallel_worker_threads(5, 16, 8);
10N/A } else {
10N/A result = nof_parallel_worker_threads(5, 8, 8);
10N/A }
10N/A return result;
10N/A}