0N/A/*
4170N/A * Copyright (c) 1998, 2013, Oracle and/or its affiliates. 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 *
1472N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
1472N/A * or visit www.oracle.com if you need additional information or have any
1472N/A * questions.
0N/A *
0N/A */
0N/A
1879N/A#include "precompiled.hpp"
1879N/A#include "memory/universe.hpp"
1879N/A#include "oops/oop.inline.hpp"
1879N/A#include "runtime/arguments.hpp"
1879N/A#ifdef TARGET_ARCH_x86
1879N/A# include "vm_version_x86.hpp"
1879N/A#endif
1879N/A#ifdef TARGET_ARCH_sparc
1879N/A# include "vm_version_sparc.hpp"
1879N/A#endif
1879N/A#ifdef TARGET_ARCH_zero
1879N/A# include "vm_version_zero.hpp"
1879N/A#endif
2073N/A#ifdef TARGET_ARCH_arm
2073N/A# include "vm_version_arm.hpp"
2073N/A#endif
2073N/A#ifdef TARGET_ARCH_ppc
2073N/A# include "vm_version_ppc.hpp"
2073N/A#endif
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;
4015N/Abool Abstract_VM_Version::_supports_atomic_getset4 = false;
4015N/Abool Abstract_VM_Version::_supports_atomic_getset8 = false;
4015N/Abool Abstract_VM_Version::_supports_atomic_getadd4 = false;
4015N/Abool Abstract_VM_Version::_supports_atomic_getadd8 = false;
0N/Aunsigned int Abstract_VM_Version::_logical_processors_per_package = 1U;
2679N/Aint Abstract_VM_Version::_reserve_for_allocation_prefetch = 0;
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 TIERED
0N/A #define VMTYPE "Server"
1010N/A#else // TIERED
1010N/A#ifdef ZERO
1612N/A#ifdef SHARK
1612N/A #define VMTYPE "Shark"
1612N/A#else // SHARK
1010N/A #define VMTYPE "Zero"
1612N/A#endif // SHARK
1010N/A#else // ZERO
1010N/A #define VMTYPE COMPILER1_PRESENT("Client") \
1010N/A COMPILER2_PRESENT("Server")
1010N/A#endif // ZERO
0N/A#endif // TIERED
0N/A
0N/A#ifndef HOTSPOT_VM_DISTRO
0N/A #error HOTSPOT_VM_DISTRO must be defined
0N/A#endif
2841N/A#define VMNAME HOTSPOT_VM_DISTRO " " VMLP EMBEDDED_ONLY("Embedded ") 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
1720N/A return JDK_Version::is_gte_jdk17x_version() ?
1720N/A "Oracle Corporation" : "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
3177N/A// NOTE: do *not* use stringStream. this function is called by
3177N/A// fatal error handlers. if the crash is in native thread,
3177N/A// stringStream cannot get resource allocated and will SEGV.
3177N/Aconst char* Abstract_VM_Version::jre_release_version() {
3177N/A return JRE_RELEASE_VERSION;
3177N/A}
3177N/A
0N/A#define OS LINUX_ONLY("linux") \
0N/A WINDOWS_ONLY("windows") \
2796N/A SOLARIS_ONLY("solaris") \
2796N/A BSD_ONLY("bsd")
0N/A
1010N/A#ifdef ZERO
1010N/A#define CPU ZERO_LIBARCH
1010N/A#else
0N/A#define CPU IA32_ONLY("x86") \
0N/A IA64_ONLY("ia64") \
0N/A AMD64_ONLY("amd64") \
1601N/A ARM_ONLY("arm") \
1601N/A PPC_ONLY("ppc") \
0N/A SPARC_ONLY("sparc")
1010N/A#endif // ZERO
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
645N/A #define HOTSPOT_BUILD_COMPILER "MS VC++ 7.1 (VS2003)"
0N/A #elif _MSC_VER == 1400
645N/A #define HOTSPOT_BUILD_COMPILER "MS VC++ 8.0 (VS2005)"
645N/A #elif _MSC_VER == 1500
645N/A #define HOTSPOT_BUILD_COMPILER "MS VC++ 9.0 (VS2008)"
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"
1467N/A #elif __SUNPRO_CC == 0x5100
1467N/A #define HOTSPOT_BUILD_COMPILER "Sun Studio 12u1"
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
2073N/A #ifndef FLOAT_ARCH
2073N/A #if defined(__SOFTFP__)
4070N/A #define FLOAT_ARCH_STR "-sflt"
2073N/A #elif defined(E500V2)
4070N/A #define FLOAT_ARCH_STR "-e500v2"
2073N/A #elif defined(ARM)
4070N/A #define FLOAT_ARCH_STR "-vfp"
2073N/A #elif defined(PPC)
4070N/A #define FLOAT_ARCH_STR "-hflt"
2073N/A #else
4070N/A #define FLOAT_ARCH_STR ""
2073N/A #endif
4070N/A #else
4070N/A #define FLOAT_ARCH_STR XSTR(FLOAT_ARCH)
2073N/A #endif
0N/A
4070N/A return VMNAME " (" VM_RELEASE ") for " OS "-" CPU FLOAT_ARCH_STR
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
2080N/Aconst char *Abstract_VM_Version::vm_build_user() {
2080N/A return HOTSPOT_BUILD_USER;
2080N/A}
2080N/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}