2007-12-01 00:00:00 +00:00
|
|
|
/*
|
2010-08-11 05:51:21 -07:00
|
|
|
* Copyright (c) 1998, 2010, Oracle and/or its affiliates. All rights reserved.
|
2007-12-01 00:00:00 +00:00
|
|
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
|
|
|
*
|
|
|
|
* This code is free software; you can redistribute it and/or modify it
|
|
|
|
* under the terms of the GNU General Public License version 2 only, as
|
|
|
|
* published by the Free Software Foundation.
|
|
|
|
*
|
|
|
|
* This code is distributed in the hope that it will be useful, but WITHOUT
|
|
|
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
|
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
|
|
* version 2 for more details (a copy is included in the LICENSE file that
|
|
|
|
* accompanied this code).
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License version
|
|
|
|
* 2 along with this work; if not, write to the Free Software Foundation,
|
|
|
|
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
|
|
*
|
2010-05-27 19:08:38 -07:00
|
|
|
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
|
|
|
* or visit www.oracle.com if you need additional information or have any
|
|
|
|
* questions.
|
2007-12-01 00:00:00 +00:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2010-11-23 13:22:55 -08:00
|
|
|
#include "precompiled.hpp"
|
|
|
|
#include "memory/universe.hpp"
|
|
|
|
#include "oops/oop.inline.hpp"
|
|
|
|
#include "runtime/arguments.hpp"
|
|
|
|
#ifdef TARGET_ARCH_x86
|
|
|
|
# include "vm_version_x86.hpp"
|
|
|
|
#endif
|
|
|
|
#ifdef TARGET_ARCH_sparc
|
|
|
|
# include "vm_version_sparc.hpp"
|
|
|
|
#endif
|
|
|
|
#ifdef TARGET_ARCH_zero
|
|
|
|
# include "vm_version_zero.hpp"
|
|
|
|
#endif
|
2011-02-02 11:35:26 -05:00
|
|
|
#ifdef TARGET_ARCH_arm
|
|
|
|
# include "vm_version_arm.hpp"
|
|
|
|
#endif
|
|
|
|
#ifdef TARGET_ARCH_ppc
|
|
|
|
# include "vm_version_ppc.hpp"
|
|
|
|
#endif
|
2007-12-01 00:00:00 +00:00
|
|
|
|
|
|
|
const char* Abstract_VM_Version::_s_vm_release = Abstract_VM_Version::vm_release();
|
|
|
|
const char* Abstract_VM_Version::_s_internal_vm_info_string = Abstract_VM_Version::internal_vm_info_string();
|
|
|
|
bool Abstract_VM_Version::_supports_cx8 = false;
|
|
|
|
unsigned int Abstract_VM_Version::_logical_processors_per_package = 1U;
|
|
|
|
|
|
|
|
#ifndef HOTSPOT_RELEASE_VERSION
|
|
|
|
#error HOTSPOT_RELEASE_VERSION must be defined
|
|
|
|
#endif
|
|
|
|
#ifndef JRE_RELEASE_VERSION
|
|
|
|
#error JRE_RELEASE_VERSION must be defined
|
|
|
|
#endif
|
|
|
|
#ifndef HOTSPOT_BUILD_TARGET
|
|
|
|
#error HOTSPOT_BUILD_TARGET must be defined
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef PRODUCT
|
|
|
|
#define VM_RELEASE HOTSPOT_RELEASE_VERSION
|
|
|
|
#else
|
|
|
|
#define VM_RELEASE HOTSPOT_RELEASE_VERSION "-" HOTSPOT_BUILD_TARGET
|
|
|
|
#endif
|
|
|
|
|
|
|
|
// HOTSPOT_RELEASE_VERSION must follow the release version naming convention
|
|
|
|
// <major_ver>.<minor_ver>-b<nn>[-<identifier>][-<debug_target>]
|
|
|
|
int Abstract_VM_Version::_vm_major_version = 0;
|
|
|
|
int Abstract_VM_Version::_vm_minor_version = 0;
|
|
|
|
int Abstract_VM_Version::_vm_build_number = 0;
|
|
|
|
bool Abstract_VM_Version::_initialized = false;
|
2008-02-22 17:17:14 -08:00
|
|
|
int Abstract_VM_Version::_parallel_worker_threads = 0;
|
|
|
|
bool Abstract_VM_Version::_parallel_worker_threads_initialized = false;
|
2007-12-01 00:00:00 +00:00
|
|
|
|
|
|
|
void Abstract_VM_Version::initialize() {
|
|
|
|
if (_initialized) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
char* vm_version = os::strdup(HOTSPOT_RELEASE_VERSION);
|
|
|
|
|
|
|
|
// Expecting the next vm_version format:
|
|
|
|
// <major_ver>.<minor_ver>-b<nn>[-<identifier>]
|
|
|
|
char* vm_major_ver = vm_version;
|
|
|
|
assert(isdigit(vm_major_ver[0]),"wrong vm major version number");
|
|
|
|
char* vm_minor_ver = strchr(vm_major_ver, '.');
|
|
|
|
assert(vm_minor_ver != NULL && isdigit(vm_minor_ver[1]),"wrong vm minor version number");
|
|
|
|
vm_minor_ver[0] = '\0'; // terminate vm_major_ver
|
|
|
|
vm_minor_ver += 1;
|
|
|
|
char* vm_build_num = strchr(vm_minor_ver, '-');
|
|
|
|
assert(vm_build_num != NULL && vm_build_num[1] == 'b' && isdigit(vm_build_num[2]),"wrong vm build number");
|
|
|
|
vm_build_num[0] = '\0'; // terminate vm_minor_ver
|
|
|
|
vm_build_num += 2;
|
|
|
|
|
|
|
|
_vm_major_version = atoi(vm_major_ver);
|
|
|
|
_vm_minor_version = atoi(vm_minor_ver);
|
|
|
|
_vm_build_number = atoi(vm_build_num);
|
|
|
|
|
|
|
|
os::free(vm_version);
|
|
|
|
_initialized = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
#if defined(_LP64)
|
|
|
|
#define VMLP "64-Bit "
|
|
|
|
#else
|
|
|
|
#define VMLP ""
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef KERNEL
|
|
|
|
#define VMTYPE "Kernel"
|
|
|
|
#else // KERNEL
|
|
|
|
#ifdef TIERED
|
|
|
|
#define VMTYPE "Server"
|
2009-10-13 12:04:21 -07:00
|
|
|
#else // TIERED
|
|
|
|
#ifdef ZERO
|
2010-08-11 05:51:21 -07:00
|
|
|
#ifdef SHARK
|
|
|
|
#define VMTYPE "Shark"
|
|
|
|
#else // SHARK
|
2009-10-13 12:04:21 -07:00
|
|
|
#define VMTYPE "Zero"
|
2010-08-11 05:51:21 -07:00
|
|
|
#endif // SHARK
|
2009-10-13 12:04:21 -07:00
|
|
|
#else // ZERO
|
|
|
|
#define VMTYPE COMPILER1_PRESENT("Client") \
|
|
|
|
COMPILER2_PRESENT("Server")
|
|
|
|
#endif // ZERO
|
2007-12-01 00:00:00 +00:00
|
|
|
#endif // TIERED
|
|
|
|
#endif // KERNEL
|
|
|
|
|
|
|
|
#ifndef HOTSPOT_VM_DISTRO
|
|
|
|
#error HOTSPOT_VM_DISTRO must be defined
|
|
|
|
#endif
|
|
|
|
#define VMNAME HOTSPOT_VM_DISTRO " " VMLP VMTYPE " VM"
|
|
|
|
|
|
|
|
const char* Abstract_VM_Version::vm_name() {
|
|
|
|
return VMNAME;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
const char* Abstract_VM_Version::vm_vendor() {
|
|
|
|
#ifdef VENDOR
|
|
|
|
return XSTR(VENDOR);
|
|
|
|
#else
|
2010-09-17 09:45:32 -04:00
|
|
|
return JDK_Version::is_gte_jdk17x_version() ?
|
|
|
|
"Oracle Corporation" : "Sun Microsystems Inc.";
|
2007-12-01 00:00:00 +00:00
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
const char* Abstract_VM_Version::vm_info_string() {
|
|
|
|
switch (Arguments::mode()) {
|
|
|
|
case Arguments::_int:
|
|
|
|
return UseSharedSpaces ? "interpreted mode, sharing" : "interpreted mode";
|
|
|
|
case Arguments::_mixed:
|
|
|
|
return UseSharedSpaces ? "mixed mode, sharing" : "mixed mode";
|
|
|
|
case Arguments::_comp:
|
|
|
|
return UseSharedSpaces ? "compiled mode, sharing" : "compiled mode";
|
|
|
|
};
|
|
|
|
ShouldNotReachHere();
|
|
|
|
return "";
|
|
|
|
}
|
|
|
|
|
|
|
|
// NOTE: do *not* use stringStream. this function is called by
|
|
|
|
// fatal error handler. if the crash is in native thread,
|
|
|
|
// stringStream cannot get resource allocated and will SEGV.
|
|
|
|
const char* Abstract_VM_Version::vm_release() {
|
|
|
|
return VM_RELEASE;
|
|
|
|
}
|
|
|
|
|
|
|
|
#define OS LINUX_ONLY("linux") \
|
|
|
|
WINDOWS_ONLY("windows") \
|
|
|
|
SOLARIS_ONLY("solaris")
|
|
|
|
|
2009-10-13 12:04:21 -07:00
|
|
|
#ifdef ZERO
|
|
|
|
#define CPU ZERO_LIBARCH
|
|
|
|
#else
|
2007-12-01 00:00:00 +00:00
|
|
|
#define CPU IA32_ONLY("x86") \
|
|
|
|
IA64_ONLY("ia64") \
|
|
|
|
AMD64_ONLY("amd64") \
|
2010-08-03 08:13:38 -04:00
|
|
|
ARM_ONLY("arm") \
|
|
|
|
PPC_ONLY("ppc") \
|
2007-12-01 00:00:00 +00:00
|
|
|
SPARC_ONLY("sparc")
|
2009-10-13 12:04:21 -07:00
|
|
|
#endif // ZERO
|
2007-12-01 00:00:00 +00:00
|
|
|
|
|
|
|
const char *Abstract_VM_Version::vm_platform_string() {
|
|
|
|
return OS "-" CPU;
|
|
|
|
}
|
|
|
|
|
|
|
|
const char* Abstract_VM_Version::internal_vm_info_string() {
|
|
|
|
#ifndef HOTSPOT_BUILD_USER
|
|
|
|
#define HOTSPOT_BUILD_USER unknown
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef HOTSPOT_BUILD_COMPILER
|
|
|
|
#ifdef _MSC_VER
|
|
|
|
#if _MSC_VER == 1100
|
|
|
|
#define HOTSPOT_BUILD_COMPILER "MS VC++ 5.0"
|
|
|
|
#elif _MSC_VER == 1200
|
|
|
|
#define HOTSPOT_BUILD_COMPILER "MS VC++ 6.0"
|
|
|
|
#elif _MSC_VER == 1310
|
2009-03-16 15:06:33 -07:00
|
|
|
#define HOTSPOT_BUILD_COMPILER "MS VC++ 7.1 (VS2003)"
|
2007-12-01 00:00:00 +00:00
|
|
|
#elif _MSC_VER == 1400
|
2009-03-16 15:06:33 -07:00
|
|
|
#define HOTSPOT_BUILD_COMPILER "MS VC++ 8.0 (VS2005)"
|
|
|
|
#elif _MSC_VER == 1500
|
|
|
|
#define HOTSPOT_BUILD_COMPILER "MS VC++ 9.0 (VS2008)"
|
2007-12-01 00:00:00 +00:00
|
|
|
#else
|
|
|
|
#define HOTSPOT_BUILD_COMPILER "unknown MS VC++:" XSTR(_MSC_VER)
|
|
|
|
#endif
|
|
|
|
#elif defined(__SUNPRO_CC)
|
|
|
|
#if __SUNPRO_CC == 0x420
|
|
|
|
#define HOTSPOT_BUILD_COMPILER "Workshop 4.2"
|
|
|
|
#elif __SUNPRO_CC == 0x500
|
|
|
|
#define HOTSPOT_BUILD_COMPILER "Workshop 5.0 compat=" XSTR(__SUNPRO_CC_COMPAT)
|
|
|
|
#elif __SUNPRO_CC == 0x520
|
|
|
|
#define HOTSPOT_BUILD_COMPILER "Workshop 5.2 compat=" XSTR(__SUNPRO_CC_COMPAT)
|
|
|
|
#elif __SUNPRO_CC == 0x580
|
|
|
|
#define HOTSPOT_BUILD_COMPILER "Workshop 5.8"
|
|
|
|
#elif __SUNPRO_CC == 0x590
|
|
|
|
#define HOTSPOT_BUILD_COMPILER "Workshop 5.9"
|
2010-05-18 11:02:18 -07:00
|
|
|
#elif __SUNPRO_CC == 0x5100
|
|
|
|
#define HOTSPOT_BUILD_COMPILER "Sun Studio 12u1"
|
2007-12-01 00:00:00 +00:00
|
|
|
#else
|
|
|
|
#define HOTSPOT_BUILD_COMPILER "unknown Workshop:" XSTR(__SUNPRO_CC)
|
|
|
|
#endif
|
|
|
|
#elif defined(__GNUC__)
|
|
|
|
#define HOTSPOT_BUILD_COMPILER "gcc " __VERSION__
|
|
|
|
#else
|
|
|
|
#define HOTSPOT_BUILD_COMPILER "unknown compiler"
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
2011-02-02 11:35:26 -05:00
|
|
|
#ifndef FLOAT_ARCH
|
|
|
|
#if defined(__SOFTFP__)
|
|
|
|
#define FLOAT_ARCH "-sflt"
|
|
|
|
#elif defined(E500V2)
|
|
|
|
#define FLOAT_ARCH "-e500v2"
|
|
|
|
#elif defined(ARM)
|
|
|
|
#define FLOAT_ARCH "-vfp"
|
|
|
|
#elif defined(PPC)
|
|
|
|
#define FLOAT_ARCH "-hflt"
|
|
|
|
#else
|
|
|
|
#define FLOAT_ARCH ""
|
|
|
|
#endif
|
|
|
|
#endif
|
2007-12-01 00:00:00 +00:00
|
|
|
|
2011-02-02 11:35:26 -05:00
|
|
|
return VMNAME " (" VM_RELEASE ") for " OS "-" CPU FLOAT_ARCH
|
2007-12-01 00:00:00 +00:00
|
|
|
" JRE (" JRE_RELEASE_VERSION "), built on " __DATE__ " " __TIME__
|
|
|
|
" by " XSTR(HOTSPOT_BUILD_USER) " with " HOTSPOT_BUILD_COMPILER;
|
|
|
|
}
|
|
|
|
|
|
|
|
unsigned int Abstract_VM_Version::jvm_version() {
|
|
|
|
return ((Abstract_VM_Version::vm_major_version() & 0xFF) << 24) |
|
|
|
|
((Abstract_VM_Version::vm_minor_version() & 0xFF) << 16) |
|
|
|
|
(Abstract_VM_Version::vm_build_number() & 0xFF);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void VM_Version_init() {
|
|
|
|
VM_Version::initialize();
|
|
|
|
|
|
|
|
#ifndef PRODUCT
|
|
|
|
if (PrintMiscellaneous && Verbose) {
|
|
|
|
os::print_cpu_info(tty);
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
}
|
2008-02-22 17:17:14 -08:00
|
|
|
|
|
|
|
unsigned int Abstract_VM_Version::nof_parallel_worker_threads(
|
|
|
|
unsigned int num,
|
|
|
|
unsigned int den,
|
|
|
|
unsigned int switch_pt) {
|
|
|
|
if (FLAG_IS_DEFAULT(ParallelGCThreads)) {
|
|
|
|
assert(ParallelGCThreads == 0, "Default ParallelGCThreads is not 0");
|
|
|
|
// For very large machines, there are diminishing returns
|
|
|
|
// for large numbers of worker threads. Instead of
|
|
|
|
// hogging the whole system, use a fraction of the workers for every
|
|
|
|
// processor after the first 8. For example, on a 72 cpu machine
|
|
|
|
// and a chosen fraction of 5/8
|
|
|
|
// use 8 + (72 - 8) * (5/8) == 48 worker threads.
|
|
|
|
unsigned int ncpus = (unsigned int) os::active_processor_count();
|
|
|
|
return (ncpus <= switch_pt) ?
|
|
|
|
ncpus :
|
|
|
|
(switch_pt + ((ncpus - switch_pt) * num) / den);
|
|
|
|
} else {
|
|
|
|
return ParallelGCThreads;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
unsigned int Abstract_VM_Version::calc_parallel_worker_threads() {
|
|
|
|
return nof_parallel_worker_threads(5, 8, 8);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Does not set the _initialized flag since it is
|
|
|
|
// a global flag.
|
|
|
|
unsigned int Abstract_VM_Version::parallel_worker_threads() {
|
|
|
|
if (!_parallel_worker_threads_initialized) {
|
|
|
|
if (FLAG_IS_DEFAULT(ParallelGCThreads)) {
|
|
|
|
_parallel_worker_threads = VM_Version::calc_parallel_worker_threads();
|
|
|
|
} else {
|
|
|
|
_parallel_worker_threads = ParallelGCThreads;
|
|
|
|
}
|
|
|
|
_parallel_worker_threads_initialized = true;
|
|
|
|
}
|
|
|
|
return _parallel_worker_threads;
|
|
|
|
}
|