0
|
1 /*
|
|
2 * Copyright 1998-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.cpp.incl"
|
|
27
|
|
28 const char* Abstract_VM_Version::_s_vm_release = Abstract_VM_Version::vm_release();
|
|
29 const char* Abstract_VM_Version::_s_internal_vm_info_string = Abstract_VM_Version::internal_vm_info_string();
|
|
30 bool Abstract_VM_Version::_supports_cx8 = false;
|
|
31 unsigned int Abstract_VM_Version::_logical_processors_per_package = 1U;
|
|
32
|
|
33 #ifndef HOTSPOT_RELEASE_VERSION
|
|
34 #error HOTSPOT_RELEASE_VERSION must be defined
|
|
35 #endif
|
|
36 #ifndef JRE_RELEASE_VERSION
|
|
37 #error JRE_RELEASE_VERSION must be defined
|
|
38 #endif
|
|
39 #ifndef HOTSPOT_BUILD_TARGET
|
|
40 #error HOTSPOT_BUILD_TARGET must be defined
|
|
41 #endif
|
|
42
|
|
43 #ifdef PRODUCT
|
|
44 #define VM_RELEASE HOTSPOT_RELEASE_VERSION
|
|
45 #else
|
|
46 #define VM_RELEASE HOTSPOT_RELEASE_VERSION "-" HOTSPOT_BUILD_TARGET
|
|
47 #endif
|
|
48
|
|
49 // HOTSPOT_RELEASE_VERSION must follow the release version naming convention
|
|
50 // <major_ver>.<minor_ver>-b<nn>[-<identifier>][-<debug_target>]
|
|
51 int Abstract_VM_Version::_vm_major_version = 0;
|
|
52 int Abstract_VM_Version::_vm_minor_version = 0;
|
|
53 int Abstract_VM_Version::_vm_build_number = 0;
|
|
54 bool Abstract_VM_Version::_initialized = false;
|
|
55
|
|
56 void Abstract_VM_Version::initialize() {
|
|
57 if (_initialized) {
|
|
58 return;
|
|
59 }
|
|
60 char* vm_version = os::strdup(HOTSPOT_RELEASE_VERSION);
|
|
61
|
|
62 // Expecting the next vm_version format:
|
|
63 // <major_ver>.<minor_ver>-b<nn>[-<identifier>]
|
|
64 char* vm_major_ver = vm_version;
|
|
65 assert(isdigit(vm_major_ver[0]),"wrong vm major version number");
|
|
66 char* vm_minor_ver = strchr(vm_major_ver, '.');
|
|
67 assert(vm_minor_ver != NULL && isdigit(vm_minor_ver[1]),"wrong vm minor version number");
|
|
68 vm_minor_ver[0] = '\0'; // terminate vm_major_ver
|
|
69 vm_minor_ver += 1;
|
|
70 char* vm_build_num = strchr(vm_minor_ver, '-');
|
|
71 assert(vm_build_num != NULL && vm_build_num[1] == 'b' && isdigit(vm_build_num[2]),"wrong vm build number");
|
|
72 vm_build_num[0] = '\0'; // terminate vm_minor_ver
|
|
73 vm_build_num += 2;
|
|
74
|
|
75 _vm_major_version = atoi(vm_major_ver);
|
|
76 _vm_minor_version = atoi(vm_minor_ver);
|
|
77 _vm_build_number = atoi(vm_build_num);
|
|
78
|
|
79 os::free(vm_version);
|
|
80 _initialized = true;
|
|
81 }
|
|
82
|
|
83 #if defined(_LP64)
|
|
84 #define VMLP "64-Bit "
|
|
85 #else
|
|
86 #define VMLP ""
|
|
87 #endif
|
|
88
|
|
89 #ifdef KERNEL
|
|
90 #define VMTYPE "Kernel"
|
|
91 #else // KERNEL
|
|
92 #ifdef TIERED
|
|
93 #define VMTYPE "Server"
|
|
94 #else
|
|
95 #define VMTYPE COMPILER1_PRESENT("Client") \
|
|
96 COMPILER2_PRESENT("Server")
|
|
97 #endif // TIERED
|
|
98 #endif // KERNEL
|
|
99
|
|
100 #ifndef HOTSPOT_VM_DISTRO
|
|
101 #error HOTSPOT_VM_DISTRO must be defined
|
|
102 #endif
|
|
103 #define VMNAME HOTSPOT_VM_DISTRO " " VMLP VMTYPE " VM"
|
|
104
|
|
105 const char* Abstract_VM_Version::vm_name() {
|
|
106 return VMNAME;
|
|
107 }
|
|
108
|
|
109
|
|
110 const char* Abstract_VM_Version::vm_vendor() {
|
|
111 #ifdef VENDOR
|
|
112 return XSTR(VENDOR);
|
|
113 #else
|
|
114 return "Sun Microsystems Inc.";
|
|
115 #endif
|
|
116 }
|
|
117
|
|
118
|
|
119 const char* Abstract_VM_Version::vm_info_string() {
|
|
120 switch (Arguments::mode()) {
|
|
121 case Arguments::_int:
|
|
122 return UseSharedSpaces ? "interpreted mode, sharing" : "interpreted mode";
|
|
123 case Arguments::_mixed:
|
|
124 return UseSharedSpaces ? "mixed mode, sharing" : "mixed mode";
|
|
125 case Arguments::_comp:
|
|
126 return UseSharedSpaces ? "compiled mode, sharing" : "compiled mode";
|
|
127 };
|
|
128 ShouldNotReachHere();
|
|
129 return "";
|
|
130 }
|
|
131
|
|
132 // NOTE: do *not* use stringStream. this function is called by
|
|
133 // fatal error handler. if the crash is in native thread,
|
|
134 // stringStream cannot get resource allocated and will SEGV.
|
|
135 const char* Abstract_VM_Version::vm_release() {
|
|
136 return VM_RELEASE;
|
|
137 }
|
|
138
|
|
139 #define OS LINUX_ONLY("linux") \
|
|
140 WINDOWS_ONLY("windows") \
|
|
141 SOLARIS_ONLY("solaris")
|
|
142
|
|
143 #define CPU IA32_ONLY("x86") \
|
|
144 IA64_ONLY("ia64") \
|
|
145 AMD64_ONLY("amd64") \
|
|
146 SPARC_ONLY("sparc")
|
|
147
|
|
148 const char *Abstract_VM_Version::vm_platform_string() {
|
|
149 return OS "-" CPU;
|
|
150 }
|
|
151
|
|
152 const char* Abstract_VM_Version::internal_vm_info_string() {
|
|
153 #ifndef HOTSPOT_BUILD_USER
|
|
154 #define HOTSPOT_BUILD_USER unknown
|
|
155 #endif
|
|
156
|
|
157 #ifndef HOTSPOT_BUILD_COMPILER
|
|
158 #ifdef _MSC_VER
|
|
159 #if _MSC_VER == 1100
|
|
160 #define HOTSPOT_BUILD_COMPILER "MS VC++ 5.0"
|
|
161 #elif _MSC_VER == 1200
|
|
162 #define HOTSPOT_BUILD_COMPILER "MS VC++ 6.0"
|
|
163 #elif _MSC_VER == 1310
|
|
164 #define HOTSPOT_BUILD_COMPILER "MS VC++ 7.1"
|
|
165 #elif _MSC_VER == 1400
|
|
166 #define HOTSPOT_BUILD_COMPILER "MS VC++ 8.0"
|
|
167 #else
|
|
168 #define HOTSPOT_BUILD_COMPILER "unknown MS VC++:" XSTR(_MSC_VER)
|
|
169 #endif
|
|
170 #elif defined(__SUNPRO_CC)
|
|
171 #if __SUNPRO_CC == 0x420
|
|
172 #define HOTSPOT_BUILD_COMPILER "Workshop 4.2"
|
|
173 #elif __SUNPRO_CC == 0x500
|
|
174 #define HOTSPOT_BUILD_COMPILER "Workshop 5.0 compat=" XSTR(__SUNPRO_CC_COMPAT)
|
|
175 #elif __SUNPRO_CC == 0x520
|
|
176 #define HOTSPOT_BUILD_COMPILER "Workshop 5.2 compat=" XSTR(__SUNPRO_CC_COMPAT)
|
|
177 #elif __SUNPRO_CC == 0x580
|
|
178 #define HOTSPOT_BUILD_COMPILER "Workshop 5.8"
|
|
179 #elif __SUNPRO_CC == 0x590
|
|
180 #define HOTSPOT_BUILD_COMPILER "Workshop 5.9"
|
|
181 #else
|
|
182 #define HOTSPOT_BUILD_COMPILER "unknown Workshop:" XSTR(__SUNPRO_CC)
|
|
183 #endif
|
|
184 #elif defined(__GNUC__)
|
|
185 #define HOTSPOT_BUILD_COMPILER "gcc " __VERSION__
|
|
186 #else
|
|
187 #define HOTSPOT_BUILD_COMPILER "unknown compiler"
|
|
188 #endif
|
|
189 #endif
|
|
190
|
|
191
|
|
192 return VMNAME " (" VM_RELEASE ") for " OS "-" CPU
|
|
193 " JRE (" JRE_RELEASE_VERSION "), built on " __DATE__ " " __TIME__
|
|
194 " by " XSTR(HOTSPOT_BUILD_USER) " with " HOTSPOT_BUILD_COMPILER;
|
|
195 }
|
|
196
|
|
197 unsigned int Abstract_VM_Version::jvm_version() {
|
|
198 return ((Abstract_VM_Version::vm_major_version() & 0xFF) << 24) |
|
|
199 ((Abstract_VM_Version::vm_minor_version() & 0xFF) << 16) |
|
|
200 (Abstract_VM_Version::vm_build_number() & 0xFF);
|
|
201 }
|
|
202
|
|
203
|
|
204 void VM_Version_init() {
|
|
205 VM_Version::initialize();
|
|
206
|
|
207 #ifndef PRODUCT
|
|
208 if (PrintMiscellaneous && Verbose) {
|
|
209 os::print_cpu_info(tty);
|
|
210 }
|
|
211 #endif
|
|
212 }
|