0
|
1 /*
|
|
2 * Copyright 1997-2007 Sun Microsystems, Inc. All Rights Reserved.
|
|
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
|
4 *
|
|
5 * This code is free software; you can redistribute it and/or modify it
|
|
6 * under the terms of the GNU General Public License version 2 only, as
|
|
7 * published by the Free Software Foundation.
|
|
8 *
|
|
9 * This code is distributed in the hope that it will be useful, but WITHOUT
|
|
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
12 * version 2 for more details (a copy is included in the LICENSE file that
|
|
13 * accompanied this code).
|
|
14 *
|
|
15 * You should have received a copy of the GNU General Public License version
|
|
16 * 2 along with this work; if not, write to the Free Software Foundation,
|
|
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
18 *
|
|
19 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
|
|
20 * CA 95054 USA or visit www.sun.com if you need additional information or
|
|
21 * have any questions.
|
|
22 *
|
|
23 */
|
|
24
|
|
25 # include "incls/_precompiled.incl"
|
|
26 # include "incls/_vm_version_sparc.cpp.incl"
|
|
27
|
|
28 int VM_Version::_features = VM_Version::unknown_m;
|
|
29 const char* VM_Version::_features_str = "";
|
|
30
|
|
31 void VM_Version::initialize() {
|
|
32 _features = determine_features();
|
|
33 PrefetchCopyIntervalInBytes = prefetch_copy_interval_in_bytes();
|
|
34 PrefetchScanIntervalInBytes = prefetch_scan_interval_in_bytes();
|
|
35 PrefetchFieldsAhead = prefetch_fields_ahead();
|
|
36
|
|
37 // Allocation prefetch settings
|
|
38 intx cache_line_size = L1_data_cache_line_size();
|
|
39 if( cache_line_size > AllocatePrefetchStepSize )
|
|
40 AllocatePrefetchStepSize = cache_line_size;
|
|
41 if( FLAG_IS_DEFAULT(AllocatePrefetchLines) )
|
|
42 AllocatePrefetchLines = 3; // Optimistic value
|
|
43 assert( AllocatePrefetchLines > 0, "invalid value");
|
|
44 if( AllocatePrefetchLines < 1 ) // set valid value in product VM
|
|
45 AllocatePrefetchLines = 1; // Conservative value
|
|
46
|
|
47 AllocatePrefetchDistance = allocate_prefetch_distance();
|
|
48 AllocatePrefetchStyle = allocate_prefetch_style();
|
|
49
|
|
50 assert(AllocatePrefetchDistance % AllocatePrefetchStepSize == 0, "invalid value");
|
|
51
|
|
52 UseSSE = 0; // Only on x86 and x64
|
|
53
|
|
54 _supports_cx8 = has_v9();
|
|
55
|
|
56 if (is_niagara1()) {
|
|
57 // Indirect branch is the same cost as direct
|
|
58 if (FLAG_IS_DEFAULT(UseInlineCaches)) {
|
|
59 UseInlineCaches = false;
|
|
60 }
|
|
61 #ifdef COMPILER2
|
|
62 // Indirect branch is the same cost as direct
|
|
63 if (FLAG_IS_DEFAULT(UseJumpTables)) {
|
|
64 UseJumpTables = true;
|
|
65 }
|
|
66 // Single-issue, so entry and loop tops are
|
|
67 // aligned on a single instruction boundary
|
|
68 if (FLAG_IS_DEFAULT(InteriorEntryAlignment)) {
|
|
69 InteriorEntryAlignment = 4;
|
|
70 }
|
|
71 if (FLAG_IS_DEFAULT(OptoLoopAlignment)) {
|
|
72 OptoLoopAlignment = 4;
|
|
73 }
|
|
74 #endif
|
|
75 }
|
|
76
|
|
77 char buf[512];
|
|
78 jio_snprintf(buf, sizeof(buf), "%s%s%s%s%s%s%s%s%s",
|
|
79 (has_v8() ? ", has_v8" : ""),
|
|
80 (has_v9() ? ", has_v9" : ""),
|
|
81 (has_vis1() ? ", has_vis1" : ""),
|
|
82 (has_vis2() ? ", has_vis2" : ""),
|
|
83 (is_ultra3() ? ", is_ultra3" : ""),
|
|
84 (is_sun4v() ? ", is_sun4v" : ""),
|
|
85 (is_niagara1() ? ", is_niagara1" : ""),
|
|
86 (!has_hardware_int_muldiv() ? ", no-muldiv" : ""),
|
|
87 (!has_hardware_fsmuld() ? ", no-fsmuld" : ""));
|
|
88
|
|
89 // buf is started with ", " or is empty
|
|
90 _features_str = strdup(strlen(buf) > 2 ? buf + 2 : buf);
|
|
91
|
|
92 #ifndef PRODUCT
|
|
93 if (PrintMiscellaneous && Verbose) {
|
|
94 tty->print("Allocation: ");
|
|
95 if (AllocatePrefetchStyle <= 0) {
|
|
96 tty->print_cr("no prefetching");
|
|
97 } else {
|
|
98 if (AllocatePrefetchLines > 1) {
|
|
99 tty->print_cr("PREFETCH %d, %d lines of size %d bytes", AllocatePrefetchDistance, AllocatePrefetchLines, AllocatePrefetchStepSize);
|
|
100 } else {
|
|
101 tty->print_cr("PREFETCH %d, one line", AllocatePrefetchDistance);
|
|
102 }
|
|
103 }
|
|
104 if (PrefetchCopyIntervalInBytes > 0) {
|
|
105 tty->print_cr("PrefetchCopyIntervalInBytes %d", PrefetchCopyIntervalInBytes);
|
|
106 }
|
|
107 if (PrefetchScanIntervalInBytes > 0) {
|
|
108 tty->print_cr("PrefetchScanIntervalInBytes %d", PrefetchScanIntervalInBytes);
|
|
109 }
|
|
110 if (PrefetchFieldsAhead > 0) {
|
|
111 tty->print_cr("PrefetchFieldsAhead %d", PrefetchFieldsAhead);
|
|
112 }
|
|
113 }
|
|
114 #endif // PRODUCT
|
|
115 }
|
|
116
|
|
117 void VM_Version::print_features() {
|
|
118 tty->print_cr("Version:%s", cpu_features());
|
|
119 }
|
|
120
|
|
121 int VM_Version::determine_features() {
|
|
122 if (UseV8InstrsOnly) {
|
|
123 NOT_PRODUCT(if (PrintMiscellaneous && Verbose) tty->print_cr("Version is Forced-V8");)
|
|
124 return generic_v8_m;
|
|
125 }
|
|
126
|
|
127 int features = platform_features(unknown_m); // platform_features() is os_arch specific
|
|
128
|
|
129 if (features == unknown_m) {
|
|
130 features = generic_v9_m;
|
|
131 warning("Cannot recognize SPARC version. Default to V9");
|
|
132 }
|
|
133
|
|
134 if (UseNiagaraInstrs) {
|
|
135 if (is_niagara1(features)) {
|
|
136 // Happy to accomodate...
|
|
137 } else {
|
|
138 NOT_PRODUCT(if (PrintMiscellaneous && Verbose) tty->print_cr("Version is Forced-Niagara");)
|
|
139 features = niagara1_m;
|
|
140 }
|
|
141 } else {
|
|
142 if (is_niagara1(features) && !FLAG_IS_DEFAULT(UseNiagaraInstrs)) {
|
|
143 NOT_PRODUCT(if (PrintMiscellaneous && Verbose) tty->print_cr("Version is Forced-Not-Niagara");)
|
|
144 features &= ~niagara1_unique_m;
|
|
145 } else {
|
|
146 // Happy to accomodate...
|
|
147 }
|
|
148 }
|
|
149
|
|
150 return features;
|
|
151 }
|
|
152
|
|
153 static int saved_features = 0;
|
|
154
|
|
155 void VM_Version::allow_all() {
|
|
156 saved_features = _features;
|
|
157 _features = all_features_m;
|
|
158 }
|
|
159
|
|
160 void VM_Version::revert() {
|
|
161 _features = saved_features;
|
|
162 }
|