vm_version.cpp revision 10
0N/A/*
0N/A * Copyright 1998-2007 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.cpp.incl"
0N/A
0N/Aconst char* Abstract_VM_Version::_s_vm_release = Abstract_VM_Version::vm_release();
0N/Aconst char* Abstract_VM_Version::_s_internal_vm_info_string = Abstract_VM_Version::internal_vm_info_string();
0N/Abool Abstract_VM_Version::_supports_cx8 = false;
0N/Aunsigned int Abstract_VM_Version::_logical_processors_per_package = 1U;
0N/A
0N/A#ifndef HOTSPOT_RELEASE_VERSION
0N/A #error HOTSPOT_RELEASE_VERSION must be defined
0N/A#endif
0N/A#ifndef JRE_RELEASE_VERSION
0N/A #error JRE_RELEASE_VERSION must be defined
0N/A#endif
0N/A#ifndef HOTSPOT_BUILD_TARGET
0N/A #error HOTSPOT_BUILD_TARGET must be defined
0N/A#endif
0N/A
0N/A#ifdef PRODUCT
0N/A #define VM_RELEASE HOTSPOT_RELEASE_VERSION
0N/A#else
0N/A #define VM_RELEASE HOTSPOT_RELEASE_VERSION "-" HOTSPOT_BUILD_TARGET
0N/A#endif
0N/A
0N/A// HOTSPOT_RELEASE_VERSION must follow the release version naming convention
0N/A// <major_ver>.<minor_ver>-b<nn>[-<identifier>][-<debug_target>]
0N/Aint Abstract_VM_Version::_vm_major_version = 0;
0N/Aint Abstract_VM_Version::_vm_minor_version = 0;
0N/Aint Abstract_VM_Version::_vm_build_number = 0;
0N/Abool Abstract_VM_Version::_initialized = false;
10N/Aint Abstract_VM_Version::_parallel_worker_threads = 0;
10N/Abool Abstract_VM_Version::_parallel_worker_threads_initialized = false;
0N/A
0N/Avoid Abstract_VM_Version::initialize() {
0N/A if (_initialized) {
0N/A return;
0N/A }
0N/A char* vm_version = os::strdup(HOTSPOT_RELEASE_VERSION);
0N/A
0N/A // Expecting the next vm_version format:
0N/A // <major_ver>.<minor_ver>-b<nn>[-<identifier>]
0N/A char* vm_major_ver = vm_version;
0N/A assert(isdigit(vm_major_ver[0]),"wrong vm major version number");
0N/A char* vm_minor_ver = strchr(vm_major_ver, '.');
0N/A assert(vm_minor_ver != NULL && isdigit(vm_minor_ver[1]),"wrong vm minor version number");
0N/A vm_minor_ver[0] = '\0'; // terminate vm_major_ver
0N/A vm_minor_ver += 1;
0N/A char* vm_build_num = strchr(vm_minor_ver, '-');
0N/A assert(vm_build_num != NULL && vm_build_num[1] == 'b' && isdigit(vm_build_num[2]),"wrong vm build number");
0N/A vm_build_num[0] = '\0'; // terminate vm_minor_ver
0N/A vm_build_num += 2;
0N/A
0N/A _vm_major_version = atoi(vm_major_ver);
0N/A _vm_minor_version = atoi(vm_minor_ver);
0N/A _vm_build_number = atoi(vm_build_num);
0N/A
0N/A os::free(vm_version);
0N/A _initialized = true;
0N/A}
0N/A
0N/A#if defined(_LP64)
0N/A #define VMLP "64-Bit "
0N/A#else
0N/A #define VMLP ""
0N/A#endif
0N/A
0N/A#ifdef KERNEL
0N/A #define VMTYPE "Kernel"
0N/A#else // KERNEL
0N/A#ifdef TIERED
0N/A #define VMTYPE "Server"
0N/A#else
0N/A #define VMTYPE COMPILER1_PRESENT("Client") \
0N/A COMPILER2_PRESENT("Server")
0N/A#endif // TIERED
0N/A#endif // KERNEL
0N/A
0N/A#ifndef HOTSPOT_VM_DISTRO
0N/A #error HOTSPOT_VM_DISTRO must be defined
0N/A#endif
0N/A#define VMNAME HOTSPOT_VM_DISTRO " " VMLP VMTYPE " VM"
0N/A
0N/Aconst char* Abstract_VM_Version::vm_name() {
0N/A return VMNAME;
0N/A}
0N/A
0N/A
0N/Aconst char* Abstract_VM_Version::vm_vendor() {
0N/A#ifdef VENDOR
0N/A return XSTR(VENDOR);
0N/A#else
0N/A return "Sun Microsystems Inc.";
0N/A#endif
0N/A}
0N/A
0N/A
0N/Aconst char* Abstract_VM_Version::vm_info_string() {
0N/A switch (Arguments::mode()) {
0N/A case Arguments::_int:
0N/A return UseSharedSpaces ? "interpreted mode, sharing" : "interpreted mode";
0N/A case Arguments::_mixed:
0N/A return UseSharedSpaces ? "mixed mode, sharing" : "mixed mode";
0N/A case Arguments::_comp:
0N/A return UseSharedSpaces ? "compiled mode, sharing" : "compiled mode";
0N/A };
0N/A ShouldNotReachHere();
0N/A return "";
0N/A}
0N/A
0N/A// NOTE: do *not* use stringStream. this function is called by
0N/A// fatal error handler. if the crash is in native thread,
0N/A// stringStream cannot get resource allocated and will SEGV.
0N/Aconst char* Abstract_VM_Version::vm_release() {
0N/A return VM_RELEASE;
0N/A}
0N/A
0N/A#define OS LINUX_ONLY("linux") \
0N/A WINDOWS_ONLY("windows") \
0N/A SOLARIS_ONLY("solaris")
0N/A
0N/A#define CPU IA32_ONLY("x86") \
0N/A IA64_ONLY("ia64") \
0N/A AMD64_ONLY("amd64") \
0N/A SPARC_ONLY("sparc")
0N/A
0N/Aconst char *Abstract_VM_Version::vm_platform_string() {
0N/A return OS "-" CPU;
0N/A}
0N/A
0N/Aconst char* Abstract_VM_Version::internal_vm_info_string() {
0N/A #ifndef HOTSPOT_BUILD_USER
0N/A #define HOTSPOT_BUILD_USER unknown
0N/A #endif
0N/A
0N/A #ifndef HOTSPOT_BUILD_COMPILER
0N/A #ifdef _MSC_VER
0N/A #if _MSC_VER == 1100
0N/A #define HOTSPOT_BUILD_COMPILER "MS VC++ 5.0"
0N/A #elif _MSC_VER == 1200
0N/A #define HOTSPOT_BUILD_COMPILER "MS VC++ 6.0"
0N/A #elif _MSC_VER == 1310
0N/A #define HOTSPOT_BUILD_COMPILER "MS VC++ 7.1"
0N/A #elif _MSC_VER == 1400
0N/A #define HOTSPOT_BUILD_COMPILER "MS VC++ 8.0"
0N/A #else
0N/A #define HOTSPOT_BUILD_COMPILER "unknown MS VC++:" XSTR(_MSC_VER)
0N/A #endif
0N/A #elif defined(__SUNPRO_CC)
0N/A #if __SUNPRO_CC == 0x420
0N/A #define HOTSPOT_BUILD_COMPILER "Workshop 4.2"
0N/A #elif __SUNPRO_CC == 0x500
0N/A #define HOTSPOT_BUILD_COMPILER "Workshop 5.0 compat=" XSTR(__SUNPRO_CC_COMPAT)
0N/A #elif __SUNPRO_CC == 0x520
0N/A #define HOTSPOT_BUILD_COMPILER "Workshop 5.2 compat=" XSTR(__SUNPRO_CC_COMPAT)
0N/A #elif __SUNPRO_CC == 0x580
0N/A #define HOTSPOT_BUILD_COMPILER "Workshop 5.8"
0N/A #elif __SUNPRO_CC == 0x590
0N/A #define HOTSPOT_BUILD_COMPILER "Workshop 5.9"
0N/A #else
0N/A #define HOTSPOT_BUILD_COMPILER "unknown Workshop:" XSTR(__SUNPRO_CC)
0N/A #endif
0N/A #elif defined(__GNUC__)
0N/A #define HOTSPOT_BUILD_COMPILER "gcc " __VERSION__
0N/A #else
0N/A #define HOTSPOT_BUILD_COMPILER "unknown compiler"
0N/A #endif
0N/A #endif
0N/A
0N/A
0N/A return VMNAME " (" VM_RELEASE ") for " OS "-" CPU
0N/A " JRE (" JRE_RELEASE_VERSION "), built on " __DATE__ " " __TIME__
0N/A " by " XSTR(HOTSPOT_BUILD_USER) " with " HOTSPOT_BUILD_COMPILER;
0N/A}
0N/A
0N/Aunsigned int Abstract_VM_Version::jvm_version() {
0N/A return ((Abstract_VM_Version::vm_major_version() & 0xFF) << 24) |
0N/A ((Abstract_VM_Version::vm_minor_version() & 0xFF) << 16) |
0N/A (Abstract_VM_Version::vm_build_number() & 0xFF);
0N/A}
0N/A
0N/A
0N/Avoid VM_Version_init() {
0N/A VM_Version::initialize();
0N/A
0N/A#ifndef PRODUCT
0N/A if (PrintMiscellaneous && Verbose) {
0N/A os::print_cpu_info(tty);
0N/A }
0N/A#endif
0N/A}
10N/A
10N/Aunsigned int Abstract_VM_Version::nof_parallel_worker_threads(
10N/A unsigned int num,
10N/A unsigned int den,
10N/A unsigned int switch_pt) {
10N/A if (FLAG_IS_DEFAULT(ParallelGCThreads)) {
10N/A assert(ParallelGCThreads == 0, "Default ParallelGCThreads is not 0");
10N/A // For very large machines, there are diminishing returns
10N/A // for large numbers of worker threads. Instead of
10N/A // hogging the whole system, use a fraction of the workers for every
10N/A // processor after the first 8. For example, on a 72 cpu machine
10N/A // and a chosen fraction of 5/8
10N/A // use 8 + (72 - 8) * (5/8) == 48 worker threads.
10N/A unsigned int ncpus = (unsigned int) os::active_processor_count();
10N/A return (ncpus <= switch_pt) ?
10N/A ncpus :
10N/A (switch_pt + ((ncpus - switch_pt) * num) / den);
10N/A } else {
10N/A return ParallelGCThreads;
10N/A }
10N/A}
10N/A
10N/Aunsigned int Abstract_VM_Version::calc_parallel_worker_threads() {
10N/A return nof_parallel_worker_threads(5, 8, 8);
10N/A}
10N/A
10N/A
10N/A// Does not set the _initialized flag since it is
10N/A// a global flag.
10N/Aunsigned int Abstract_VM_Version::parallel_worker_threads() {
10N/A if (!_parallel_worker_threads_initialized) {
10N/A if (FLAG_IS_DEFAULT(ParallelGCThreads)) {
10N/A _parallel_worker_threads = VM_Version::calc_parallel_worker_threads();
10N/A } else {
10N/A _parallel_worker_threads = ParallelGCThreads;
10N/A }
10N/A _parallel_worker_threads_initialized = true;
10N/A }
10N/A return _parallel_worker_threads;
10N/A}