Sat, 07 Nov 2020 10:30:02 +0800
Added tag mips-jdk8u275-b01 for changeset d3b4d62f391f
1 /*
2 * Copyright (c) 1998, 2016, Oracle and/or its affiliates. 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
23 */
25 /*
26 * This file has been modified by Loongson Technology in 2015. These
27 * modifications are Copyright (c) 2015 Loongson Technology, and are made
28 * available on the same license terms set forth above.
29 */
31 #include "precompiled.hpp"
32 #include "memory/universe.hpp"
33 #include "oops/oop.inline.hpp"
34 #include "runtime/arguments.hpp"
35 #ifdef TARGET_ARCH_x86
36 # include "vm_version_x86.hpp"
37 #endif
38 #ifdef TARGET_ARCH_sparc
39 # include "vm_version_sparc.hpp"
40 #endif
41 #ifdef TARGET_ARCH_zero
42 # include "vm_version_zero.hpp"
43 #endif
44 #ifdef TARGET_ARCH_arm
45 # include "vm_version_arm.hpp"
46 #endif
47 #ifdef TARGET_ARCH_ppc
48 # include "vm_version_ppc.hpp"
49 #endif
50 #ifdef TARGET_ARCH_mips
51 # include "vm_version_mips.hpp"
52 #endif
54 const char* Abstract_VM_Version::_s_vm_release = Abstract_VM_Version::vm_release();
55 const char* Abstract_VM_Version::_s_internal_vm_info_string = Abstract_VM_Version::internal_vm_info_string();
56 bool Abstract_VM_Version::_supports_cx8 = false;
57 bool Abstract_VM_Version::_supports_atomic_getset4 = false;
58 bool Abstract_VM_Version::_supports_atomic_getset8 = false;
59 bool Abstract_VM_Version::_supports_atomic_getadd4 = false;
60 bool Abstract_VM_Version::_supports_atomic_getadd8 = false;
61 unsigned int Abstract_VM_Version::_logical_processors_per_package = 1U;
62 unsigned int Abstract_VM_Version::_L1_data_cache_line_size = 0;
63 int Abstract_VM_Version::_reserve_for_allocation_prefetch = 0;
65 #ifndef HOTSPOT_RELEASE_VERSION
66 #error HOTSPOT_RELEASE_VERSION must be defined
67 #endif
68 #ifndef JRE_RELEASE_VERSION
69 #error JRE_RELEASE_VERSION must be defined
70 #endif
71 #ifndef HOTSPOT_BUILD_TARGET
72 #error HOTSPOT_BUILD_TARGET must be defined
73 #endif
75 #ifdef PRODUCT
76 #define VM_RELEASE HOTSPOT_RELEASE_VERSION
77 #else
78 #define VM_RELEASE HOTSPOT_RELEASE_VERSION "-" HOTSPOT_BUILD_TARGET
79 #endif
81 // HOTSPOT_RELEASE_VERSION must follow the release version naming convention
82 // <major_ver>.<minor_ver>-b<nn>[-<identifier>][-<debug_target>]
83 int Abstract_VM_Version::_vm_major_version = 0;
84 int Abstract_VM_Version::_vm_minor_version = 0;
85 int Abstract_VM_Version::_vm_build_number = 0;
86 bool Abstract_VM_Version::_initialized = false;
87 int Abstract_VM_Version::_parallel_worker_threads = 0;
88 bool Abstract_VM_Version::_parallel_worker_threads_initialized = false;
90 void Abstract_VM_Version::initialize() {
91 if (_initialized) {
92 return;
93 }
94 char* vm_version = os::strdup(HOTSPOT_RELEASE_VERSION);
96 // Expecting the next vm_version format:
97 // <major_ver>.<minor_ver>-b<nn>[-<identifier>]
98 char* vm_major_ver = vm_version;
99 assert(isdigit(vm_major_ver[0]),"wrong vm major version number");
100 char* vm_minor_ver = strchr(vm_major_ver, '.');
101 assert(vm_minor_ver != NULL && isdigit(vm_minor_ver[1]),"wrong vm minor version number");
102 vm_minor_ver[0] = '\0'; // terminate vm_major_ver
103 vm_minor_ver += 1;
104 char* vm_build_num = strchr(vm_minor_ver, '-');
105 assert(vm_build_num != NULL && vm_build_num[1] == 'b' && isdigit(vm_build_num[2]),"wrong vm build number");
106 vm_build_num[0] = '\0'; // terminate vm_minor_ver
107 vm_build_num += 2;
109 _vm_major_version = atoi(vm_major_ver);
110 _vm_minor_version = atoi(vm_minor_ver);
111 _vm_build_number = atoi(vm_build_num);
113 os::free(vm_version);
114 _initialized = true;
115 }
117 #if defined(_LP64)
118 #define VMLP "64-Bit "
119 #else
120 #define VMLP ""
121 #endif
123 #ifndef VMTYPE
124 #ifdef TIERED
125 #define VMTYPE "Server"
126 #else // TIERED
127 #ifdef ZERO
128 #ifdef SHARK
129 #define VMTYPE "Shark"
130 #else // SHARK
131 #define VMTYPE "Zero"
132 #endif // SHARK
133 #else // ZERO
134 #define VMTYPE COMPILER1_PRESENT("Client") \
135 COMPILER2_PRESENT("Server")
136 #endif // ZERO
137 #endif // TIERED
138 #endif
140 #ifndef HOTSPOT_VM_DISTRO
141 #error HOTSPOT_VM_DISTRO must be defined
142 #endif
143 #define VMNAME HOTSPOT_VM_DISTRO " " VMLP EMBEDDED_ONLY("Embedded ") VMTYPE " VM"
145 const char* Abstract_VM_Version::vm_name() {
146 return VMNAME;
147 }
150 const char* Abstract_VM_Version::vm_vendor() {
151 #ifdef VENDOR
152 return VENDOR;
153 #else
154 return JDK_Version::is_gte_jdk17x_version() ?
155 "Oracle Corporation" : "Sun Microsystems Inc.";
156 #endif
157 }
160 const char* Abstract_VM_Version::vm_info_string() {
161 switch (Arguments::mode()) {
162 case Arguments::_int:
163 return UseSharedSpaces ? "interpreted mode, sharing" : "interpreted mode";
164 case Arguments::_mixed:
165 return UseSharedSpaces ? "mixed mode, sharing" : "mixed mode";
166 case Arguments::_comp:
167 return UseSharedSpaces ? "compiled mode, sharing" : "compiled mode";
168 };
169 ShouldNotReachHere();
170 return "";
171 }
173 // NOTE: do *not* use stringStream. this function is called by
174 // fatal error handler. if the crash is in native thread,
175 // stringStream cannot get resource allocated and will SEGV.
176 const char* Abstract_VM_Version::vm_release() {
177 return VM_RELEASE;
178 }
180 // NOTE: do *not* use stringStream. this function is called by
181 // fatal error handlers. if the crash is in native thread,
182 // stringStream cannot get resource allocated and will SEGV.
183 const char* Abstract_VM_Version::jre_release_version() {
184 return JRE_RELEASE_VERSION;
185 }
187 #define OS LINUX_ONLY("linux") \
188 WINDOWS_ONLY("windows") \
189 SOLARIS_ONLY("solaris") \
190 AIX_ONLY("aix") \
191 BSD_ONLY("bsd")
193 #ifndef CPU
194 #ifdef ZERO
195 #define CPU ZERO_LIBARCH
196 #elif defined(PPC64)
197 #if defined(VM_LITTLE_ENDIAN)
198 #define CPU "ppc64le"
199 #else
200 #define CPU "ppc64"
201 #endif
202 #elif defined(MIPS64)
203 #if defined(VM_LITTLE_ENDIAN)
204 #define CPU "mips64el"
205 #else
206 #define CPU "mips64"
207 #endif
208 #else
209 #define CPU IA32_ONLY("x86") \
210 IA64_ONLY("ia64") \
211 AMD64_ONLY("amd64") \
212 SPARC_ONLY("sparc")
213 #endif // ZERO
214 #endif
216 const char *Abstract_VM_Version::vm_platform_string() {
217 return OS "-" CPU;
218 }
220 const char* Abstract_VM_Version::internal_vm_info_string() {
221 #ifndef HOTSPOT_BUILD_USER
222 #define HOTSPOT_BUILD_USER unknown
223 #endif
225 #ifndef HOTSPOT_BUILD_COMPILER
226 #ifdef _MSC_VER
227 #if _MSC_VER == 1100
228 #define HOTSPOT_BUILD_COMPILER "MS VC++ 5.0"
229 #elif _MSC_VER == 1200
230 #define HOTSPOT_BUILD_COMPILER "MS VC++ 6.0"
231 #elif _MSC_VER == 1310
232 #define HOTSPOT_BUILD_COMPILER "MS VC++ 7.1 (VS2003)"
233 #elif _MSC_VER == 1400
234 #define HOTSPOT_BUILD_COMPILER "MS VC++ 8.0 (VS2005)"
235 #elif _MSC_VER == 1500
236 #define HOTSPOT_BUILD_COMPILER "MS VC++ 9.0 (VS2008)"
237 #elif _MSC_VER == 1600
238 #define HOTSPOT_BUILD_COMPILER "MS VC++ 10.0 (VS2010)"
239 #elif _MSC_VER == 1700
240 #define HOTSPOT_BUILD_COMPILER "MS VC++ 11.0 (VS2012)"
241 #elif _MSC_VER == 1800
242 #define HOTSPOT_BUILD_COMPILER "MS VC++ 12.0 (VS2013)"
243 #elif _MSC_VER == 1900
244 #define HOTSPOT_BUILD_COMPILER "MS VC++ 14.0 (VS2015)"
245 #elif _MSC_VER == 1911
246 #define HOTSPOT_BUILD_COMPILER "MS VC++ 15.3 (VS2017)"
247 #elif _MSC_VER == 1912
248 #define HOTSPOT_BUILD_COMPILER "MS VC++ 15.5 (VS2017)"
249 #elif _MSC_VER == 1913
250 #define HOTSPOT_BUILD_COMPILER "MS VC++ 15.6 (VS2017)"
251 #elif _MSC_VER == 1914
252 #define HOTSPOT_BUILD_COMPILER "MS VC++ 15.7 (VS2017)"
253 #elif _MSC_VER == 1915
254 #define HOTSPOT_BUILD_COMPILER "MS VC++ 15.8 (VS2017)"
255 #elif _MSC_VER == 1916
256 #define HOTSPOT_BUILD_COMPILER "MS VC++ 15.9 (VS2017)"
257 #elif _MSC_VER == 1920
258 #define HOTSPOT_BUILD_COMPILER "MS VC++ 16.0 (VS2019)"
259 #elif _MSC_VER == 1921
260 #define HOTSPOT_BUILD_COMPILER "MS VC++ 16.1 (VS2019)"
261 #elif _MSC_VER == 1922
262 #define HOTSPOT_BUILD_COMPILER "MS VC++ 16.2 (VS2019)"
263 #elif _MSC_VER == 1923
264 #define HOTSPOT_BUILD_COMPILER "MS VC++ 16.3 (VS2019)"
265 #else
266 #define HOTSPOT_BUILD_COMPILER "unknown MS VC++:" XSTR(_MSC_VER)
267 #endif
268 #elif defined(__SUNPRO_CC)
269 #if __SUNPRO_CC == 0x420
270 #define HOTSPOT_BUILD_COMPILER "Workshop 4.2"
271 #elif __SUNPRO_CC == 0x500
272 #define HOTSPOT_BUILD_COMPILER "Workshop 5.0 compat=" XSTR(__SUNPRO_CC_COMPAT)
273 #elif __SUNPRO_CC == 0x520
274 #define HOTSPOT_BUILD_COMPILER "Workshop 5.2 compat=" XSTR(__SUNPRO_CC_COMPAT)
275 #elif __SUNPRO_CC == 0x580
276 #define HOTSPOT_BUILD_COMPILER "Workshop 5.8"
277 #elif __SUNPRO_CC == 0x590
278 #define HOTSPOT_BUILD_COMPILER "Workshop 5.9"
279 #elif __SUNPRO_CC == 0x5100
280 #define HOTSPOT_BUILD_COMPILER "Sun Studio 12u1"
281 #elif __SUNPRO_CC == 0x5120
282 #define HOTSPOT_BUILD_COMPILER "Sun Studio 12u3"
283 #else
284 #define HOTSPOT_BUILD_COMPILER "unknown Workshop:" XSTR(__SUNPRO_CC)
285 #endif
286 #elif defined(__GNUC__)
287 #define HOTSPOT_BUILD_COMPILER "gcc " __VERSION__
288 #elif defined(__IBMCPP__)
289 #define HOTSPOT_BUILD_COMPILER "xlC " XSTR(__IBMCPP__)
291 #else
292 #define HOTSPOT_BUILD_COMPILER "unknown compiler"
293 #endif
294 #endif
296 #ifndef FLOAT_ARCH
297 #if defined(__SOFTFP__)
298 #define FLOAT_ARCH_STR "-sflt"
299 #else
300 #define FLOAT_ARCH_STR ""
301 #endif
302 #else
303 #define FLOAT_ARCH_STR XSTR(FLOAT_ARCH)
304 #endif
306 return VMNAME " (" VM_RELEASE ") for " OS "-" CPU FLOAT_ARCH_STR
307 " JRE (" JRE_RELEASE_VERSION "), built on " __DATE__ " " __TIME__
308 " by " XSTR(HOTSPOT_BUILD_USER) " with " HOTSPOT_BUILD_COMPILER;
309 }
311 const char *Abstract_VM_Version::vm_build_user() {
312 return HOTSPOT_BUILD_USER;
313 }
315 unsigned int Abstract_VM_Version::jvm_version() {
316 return ((Abstract_VM_Version::vm_major_version() & 0xFF) << 24) |
317 ((Abstract_VM_Version::vm_minor_version() & 0xFFFF) << 8) |
318 (Abstract_VM_Version::vm_build_number() & 0xFF);
319 }
322 void VM_Version_init() {
323 VM_Version::initialize();
325 #ifndef PRODUCT
326 if (PrintMiscellaneous && Verbose) {
327 os::print_cpu_info(tty);
328 }
329 #endif
330 }
332 unsigned int Abstract_VM_Version::nof_parallel_worker_threads(
333 unsigned int num,
334 unsigned int den,
335 unsigned int switch_pt) {
336 if (FLAG_IS_DEFAULT(ParallelGCThreads)) {
337 assert(ParallelGCThreads == 0, "Default ParallelGCThreads is not 0");
338 // For very large machines, there are diminishing returns
339 // for large numbers of worker threads. Instead of
340 // hogging the whole system, use a fraction of the workers for every
341 // processor after the first 8. For example, on a 72 cpu machine
342 // and a chosen fraction of 5/8
343 // use 8 + (72 - 8) * (5/8) == 48 worker threads.
344 unsigned int ncpus = (unsigned int) os::initial_active_processor_count();
345 return (ncpus <= switch_pt) ?
346 ncpus :
347 (switch_pt + ((ncpus - switch_pt) * num) / den);
348 } else {
349 return ParallelGCThreads;
350 }
351 }
353 unsigned int Abstract_VM_Version::calc_parallel_worker_threads() {
354 return nof_parallel_worker_threads(5, 8, 8);
355 }
358 // Does not set the _initialized flag since it is
359 // a global flag.
360 unsigned int Abstract_VM_Version::parallel_worker_threads() {
361 if (!_parallel_worker_threads_initialized) {
362 if (FLAG_IS_DEFAULT(ParallelGCThreads)) {
363 _parallel_worker_threads = VM_Version::calc_parallel_worker_threads();
364 } else {
365 _parallel_worker_threads = ParallelGCThreads;
366 }
367 _parallel_worker_threads_initialized = true;
368 }
369 return _parallel_worker_threads;
370 }