src/share/vm/runtime/vm_version.cpp

Tue, 18 May 2010 11:02:18 -0700

author
jcoomes
date
Tue, 18 May 2010 11:02:18 -0700
changeset 1902
fb1a39993f69
parent 1445
354d3184f6b2
child 1907
c18cbe5936b8
permissions
-rw-r--r--

6951319: enable solaris builds using Sun Studio 12 update 1
Reviewed-by: kamg, ysr, dholmes, johnc

duke@435 1 /*
xdono@1279 2 * Copyright 1998-2009 Sun Microsystems, Inc. All Rights Reserved.
duke@435 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
duke@435 4 *
duke@435 5 * This code is free software; you can redistribute it and/or modify it
duke@435 6 * under the terms of the GNU General Public License version 2 only, as
duke@435 7 * published by the Free Software Foundation.
duke@435 8 *
duke@435 9 * This code is distributed in the hope that it will be useful, but WITHOUT
duke@435 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
duke@435 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
duke@435 12 * version 2 for more details (a copy is included in the LICENSE file that
duke@435 13 * accompanied this code).
duke@435 14 *
duke@435 15 * You should have received a copy of the GNU General Public License version
duke@435 16 * 2 along with this work; if not, write to the Free Software Foundation,
duke@435 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
duke@435 18 *
duke@435 19 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
duke@435 20 * CA 95054 USA or visit www.sun.com if you need additional information or
duke@435 21 * have any questions.
duke@435 22 *
duke@435 23 */
duke@435 24
duke@435 25 # include "incls/_precompiled.incl"
duke@435 26 # include "incls/_vm_version.cpp.incl"
duke@435 27
duke@435 28 const char* Abstract_VM_Version::_s_vm_release = Abstract_VM_Version::vm_release();
duke@435 29 const char* Abstract_VM_Version::_s_internal_vm_info_string = Abstract_VM_Version::internal_vm_info_string();
duke@435 30 bool Abstract_VM_Version::_supports_cx8 = false;
duke@435 31 unsigned int Abstract_VM_Version::_logical_processors_per_package = 1U;
duke@435 32
duke@435 33 #ifndef HOTSPOT_RELEASE_VERSION
duke@435 34 #error HOTSPOT_RELEASE_VERSION must be defined
duke@435 35 #endif
duke@435 36 #ifndef JRE_RELEASE_VERSION
duke@435 37 #error JRE_RELEASE_VERSION must be defined
duke@435 38 #endif
duke@435 39 #ifndef HOTSPOT_BUILD_TARGET
duke@435 40 #error HOTSPOT_BUILD_TARGET must be defined
duke@435 41 #endif
duke@435 42
duke@435 43 #ifdef PRODUCT
duke@435 44 #define VM_RELEASE HOTSPOT_RELEASE_VERSION
duke@435 45 #else
duke@435 46 #define VM_RELEASE HOTSPOT_RELEASE_VERSION "-" HOTSPOT_BUILD_TARGET
duke@435 47 #endif
duke@435 48
duke@435 49 // HOTSPOT_RELEASE_VERSION must follow the release version naming convention
duke@435 50 // <major_ver>.<minor_ver>-b<nn>[-<identifier>][-<debug_target>]
duke@435 51 int Abstract_VM_Version::_vm_major_version = 0;
duke@435 52 int Abstract_VM_Version::_vm_minor_version = 0;
duke@435 53 int Abstract_VM_Version::_vm_build_number = 0;
duke@435 54 bool Abstract_VM_Version::_initialized = false;
jmasa@445 55 int Abstract_VM_Version::_parallel_worker_threads = 0;
jmasa@445 56 bool Abstract_VM_Version::_parallel_worker_threads_initialized = false;
duke@435 57
duke@435 58 void Abstract_VM_Version::initialize() {
duke@435 59 if (_initialized) {
duke@435 60 return;
duke@435 61 }
duke@435 62 char* vm_version = os::strdup(HOTSPOT_RELEASE_VERSION);
duke@435 63
duke@435 64 // Expecting the next vm_version format:
duke@435 65 // <major_ver>.<minor_ver>-b<nn>[-<identifier>]
duke@435 66 char* vm_major_ver = vm_version;
duke@435 67 assert(isdigit(vm_major_ver[0]),"wrong vm major version number");
duke@435 68 char* vm_minor_ver = strchr(vm_major_ver, '.');
duke@435 69 assert(vm_minor_ver != NULL && isdigit(vm_minor_ver[1]),"wrong vm minor version number");
duke@435 70 vm_minor_ver[0] = '\0'; // terminate vm_major_ver
duke@435 71 vm_minor_ver += 1;
duke@435 72 char* vm_build_num = strchr(vm_minor_ver, '-');
duke@435 73 assert(vm_build_num != NULL && vm_build_num[1] == 'b' && isdigit(vm_build_num[2]),"wrong vm build number");
duke@435 74 vm_build_num[0] = '\0'; // terminate vm_minor_ver
duke@435 75 vm_build_num += 2;
duke@435 76
duke@435 77 _vm_major_version = atoi(vm_major_ver);
duke@435 78 _vm_minor_version = atoi(vm_minor_ver);
duke@435 79 _vm_build_number = atoi(vm_build_num);
duke@435 80
duke@435 81 os::free(vm_version);
duke@435 82 _initialized = true;
duke@435 83 }
duke@435 84
duke@435 85 #if defined(_LP64)
duke@435 86 #define VMLP "64-Bit "
duke@435 87 #else
duke@435 88 #define VMLP ""
duke@435 89 #endif
duke@435 90
duke@435 91 #ifdef KERNEL
duke@435 92 #define VMTYPE "Kernel"
duke@435 93 #else // KERNEL
duke@435 94 #ifdef TIERED
duke@435 95 #define VMTYPE "Server"
never@1445 96 #else // TIERED
never@1445 97 #ifdef ZERO
never@1445 98 #define VMTYPE "Zero"
never@1445 99 #else // ZERO
never@1445 100 #define VMTYPE COMPILER1_PRESENT("Client") \
never@1445 101 COMPILER2_PRESENT("Server")
never@1445 102 #endif // ZERO
duke@435 103 #endif // TIERED
duke@435 104 #endif // KERNEL
duke@435 105
duke@435 106 #ifndef HOTSPOT_VM_DISTRO
duke@435 107 #error HOTSPOT_VM_DISTRO must be defined
duke@435 108 #endif
duke@435 109 #define VMNAME HOTSPOT_VM_DISTRO " " VMLP VMTYPE " VM"
duke@435 110
duke@435 111 const char* Abstract_VM_Version::vm_name() {
duke@435 112 return VMNAME;
duke@435 113 }
duke@435 114
duke@435 115
duke@435 116 const char* Abstract_VM_Version::vm_vendor() {
duke@435 117 #ifdef VENDOR
duke@435 118 return XSTR(VENDOR);
duke@435 119 #else
duke@435 120 return "Sun Microsystems Inc.";
duke@435 121 #endif
duke@435 122 }
duke@435 123
duke@435 124
duke@435 125 const char* Abstract_VM_Version::vm_info_string() {
duke@435 126 switch (Arguments::mode()) {
duke@435 127 case Arguments::_int:
duke@435 128 return UseSharedSpaces ? "interpreted mode, sharing" : "interpreted mode";
duke@435 129 case Arguments::_mixed:
duke@435 130 return UseSharedSpaces ? "mixed mode, sharing" : "mixed mode";
duke@435 131 case Arguments::_comp:
duke@435 132 return UseSharedSpaces ? "compiled mode, sharing" : "compiled mode";
duke@435 133 };
duke@435 134 ShouldNotReachHere();
duke@435 135 return "";
duke@435 136 }
duke@435 137
duke@435 138 // NOTE: do *not* use stringStream. this function is called by
duke@435 139 // fatal error handler. if the crash is in native thread,
duke@435 140 // stringStream cannot get resource allocated and will SEGV.
duke@435 141 const char* Abstract_VM_Version::vm_release() {
duke@435 142 return VM_RELEASE;
duke@435 143 }
duke@435 144
duke@435 145 #define OS LINUX_ONLY("linux") \
duke@435 146 WINDOWS_ONLY("windows") \
duke@435 147 SOLARIS_ONLY("solaris")
duke@435 148
never@1445 149 #ifdef ZERO
never@1445 150 #define CPU ZERO_LIBARCH
never@1445 151 #else
duke@435 152 #define CPU IA32_ONLY("x86") \
duke@435 153 IA64_ONLY("ia64") \
duke@435 154 AMD64_ONLY("amd64") \
duke@435 155 SPARC_ONLY("sparc")
never@1445 156 #endif // ZERO
duke@435 157
duke@435 158 const char *Abstract_VM_Version::vm_platform_string() {
duke@435 159 return OS "-" CPU;
duke@435 160 }
duke@435 161
duke@435 162 const char* Abstract_VM_Version::internal_vm_info_string() {
duke@435 163 #ifndef HOTSPOT_BUILD_USER
duke@435 164 #define HOTSPOT_BUILD_USER unknown
duke@435 165 #endif
duke@435 166
duke@435 167 #ifndef HOTSPOT_BUILD_COMPILER
duke@435 168 #ifdef _MSC_VER
duke@435 169 #if _MSC_VER == 1100
duke@435 170 #define HOTSPOT_BUILD_COMPILER "MS VC++ 5.0"
duke@435 171 #elif _MSC_VER == 1200
duke@435 172 #define HOTSPOT_BUILD_COMPILER "MS VC++ 6.0"
duke@435 173 #elif _MSC_VER == 1310
kvn@1080 174 #define HOTSPOT_BUILD_COMPILER "MS VC++ 7.1 (VS2003)"
duke@435 175 #elif _MSC_VER == 1400
kvn@1080 176 #define HOTSPOT_BUILD_COMPILER "MS VC++ 8.0 (VS2005)"
kvn@1080 177 #elif _MSC_VER == 1500
kvn@1080 178 #define HOTSPOT_BUILD_COMPILER "MS VC++ 9.0 (VS2008)"
duke@435 179 #else
duke@435 180 #define HOTSPOT_BUILD_COMPILER "unknown MS VC++:" XSTR(_MSC_VER)
duke@435 181 #endif
duke@435 182 #elif defined(__SUNPRO_CC)
duke@435 183 #if __SUNPRO_CC == 0x420
duke@435 184 #define HOTSPOT_BUILD_COMPILER "Workshop 4.2"
duke@435 185 #elif __SUNPRO_CC == 0x500
duke@435 186 #define HOTSPOT_BUILD_COMPILER "Workshop 5.0 compat=" XSTR(__SUNPRO_CC_COMPAT)
duke@435 187 #elif __SUNPRO_CC == 0x520
duke@435 188 #define HOTSPOT_BUILD_COMPILER "Workshop 5.2 compat=" XSTR(__SUNPRO_CC_COMPAT)
duke@435 189 #elif __SUNPRO_CC == 0x580
duke@435 190 #define HOTSPOT_BUILD_COMPILER "Workshop 5.8"
duke@435 191 #elif __SUNPRO_CC == 0x590
duke@435 192 #define HOTSPOT_BUILD_COMPILER "Workshop 5.9"
jcoomes@1902 193 #elif __SUNPRO_CC == 0x5100
jcoomes@1902 194 #define HOTSPOT_BUILD_COMPILER "Sun Studio 12u1"
duke@435 195 #else
duke@435 196 #define HOTSPOT_BUILD_COMPILER "unknown Workshop:" XSTR(__SUNPRO_CC)
duke@435 197 #endif
duke@435 198 #elif defined(__GNUC__)
duke@435 199 #define HOTSPOT_BUILD_COMPILER "gcc " __VERSION__
duke@435 200 #else
duke@435 201 #define HOTSPOT_BUILD_COMPILER "unknown compiler"
duke@435 202 #endif
duke@435 203 #endif
duke@435 204
duke@435 205
duke@435 206 return VMNAME " (" VM_RELEASE ") for " OS "-" CPU
duke@435 207 " JRE (" JRE_RELEASE_VERSION "), built on " __DATE__ " " __TIME__
duke@435 208 " by " XSTR(HOTSPOT_BUILD_USER) " with " HOTSPOT_BUILD_COMPILER;
duke@435 209 }
duke@435 210
duke@435 211 unsigned int Abstract_VM_Version::jvm_version() {
duke@435 212 return ((Abstract_VM_Version::vm_major_version() & 0xFF) << 24) |
duke@435 213 ((Abstract_VM_Version::vm_minor_version() & 0xFF) << 16) |
duke@435 214 (Abstract_VM_Version::vm_build_number() & 0xFF);
duke@435 215 }
duke@435 216
duke@435 217
duke@435 218 void VM_Version_init() {
duke@435 219 VM_Version::initialize();
duke@435 220
duke@435 221 #ifndef PRODUCT
duke@435 222 if (PrintMiscellaneous && Verbose) {
duke@435 223 os::print_cpu_info(tty);
duke@435 224 }
duke@435 225 #endif
duke@435 226 }
jmasa@445 227
jmasa@445 228 unsigned int Abstract_VM_Version::nof_parallel_worker_threads(
jmasa@445 229 unsigned int num,
jmasa@445 230 unsigned int den,
jmasa@445 231 unsigned int switch_pt) {
jmasa@445 232 if (FLAG_IS_DEFAULT(ParallelGCThreads)) {
jmasa@445 233 assert(ParallelGCThreads == 0, "Default ParallelGCThreads is not 0");
jmasa@445 234 // For very large machines, there are diminishing returns
jmasa@445 235 // for large numbers of worker threads. Instead of
jmasa@445 236 // hogging the whole system, use a fraction of the workers for every
jmasa@445 237 // processor after the first 8. For example, on a 72 cpu machine
jmasa@445 238 // and a chosen fraction of 5/8
jmasa@445 239 // use 8 + (72 - 8) * (5/8) == 48 worker threads.
jmasa@445 240 unsigned int ncpus = (unsigned int) os::active_processor_count();
jmasa@445 241 return (ncpus <= switch_pt) ?
jmasa@445 242 ncpus :
jmasa@445 243 (switch_pt + ((ncpus - switch_pt) * num) / den);
jmasa@445 244 } else {
jmasa@445 245 return ParallelGCThreads;
jmasa@445 246 }
jmasa@445 247 }
jmasa@445 248
jmasa@445 249 unsigned int Abstract_VM_Version::calc_parallel_worker_threads() {
jmasa@445 250 return nof_parallel_worker_threads(5, 8, 8);
jmasa@445 251 }
jmasa@445 252
jmasa@445 253
jmasa@445 254 // Does not set the _initialized flag since it is
jmasa@445 255 // a global flag.
jmasa@445 256 unsigned int Abstract_VM_Version::parallel_worker_threads() {
jmasa@445 257 if (!_parallel_worker_threads_initialized) {
jmasa@445 258 if (FLAG_IS_DEFAULT(ParallelGCThreads)) {
jmasa@445 259 _parallel_worker_threads = VM_Version::calc_parallel_worker_threads();
jmasa@445 260 } else {
jmasa@445 261 _parallel_worker_threads = ParallelGCThreads;
jmasa@445 262 }
jmasa@445 263 _parallel_worker_threads_initialized = true;
jmasa@445 264 }
jmasa@445 265 return _parallel_worker_threads;
jmasa@445 266 }

mercurial