diff -r 0b92dcc259de make/hotspot/lib/CompileJvm.gmk --- a/make/hotspot/lib/CompileJvm.gmk Fri Nov 15 14:30:51 2019 +0100 +++ b/make/hotspot/lib/CompileJvm.gmk Mon Apr 12 16:20:08 2021 +0200 @@ -57,7 +57,7 @@ JVM_EXCLUDE_FILES += args.cc JVM_EXCLUDES += adlc -# Needed by vm_version.cpp +# Needed by abstract_vm_version.cpp ifeq ($(OPENJDK_TARGET_CPU), x86_64) OPENJDK_TARGET_CPU_VM_VERSION := amd64 else ifeq ($(OPENJDK_TARGET_CPU), sparcv9) diff -r 0b92dcc259de src/hotspot/cpu/sparc/vm_version_sparc.cpp --- a/src/hotspot/cpu/sparc/vm_version_sparc.cpp Fri Nov 15 14:30:51 2019 +0100 +++ b/src/hotspot/cpu/sparc/vm_version_sparc.cpp Mon Apr 12 16:20:08 2021 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2019, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff -r 0b92dcc259de src/hotspot/cpu/x86/sharedRuntime_x86_32.cpp --- a/src/hotspot/cpu/x86/sharedRuntime_x86_32.cpp Fri Nov 15 14:30:51 2019 +0100 +++ b/src/hotspot/cpu/x86/sharedRuntime_x86_32.cpp Mon Apr 12 16:20:08 2021 +0200 @@ -47,7 +47,6 @@ #ifdef COMPILER2 #include "opto/runtime.hpp" #endif -#include "vm_version_x86.hpp" #if INCLUDE_SHENANDOAHGC #include "gc/shenandoah/shenandoahBarrierSet.hpp" #include "gc/shenandoah/shenandoahBarrierSetAssembler.hpp" diff -r 0b92dcc259de src/hotspot/cpu/x86/sharedRuntime_x86_64.cpp --- a/src/hotspot/cpu/x86/sharedRuntime_x86_64.cpp Fri Nov 15 14:30:51 2019 +0100 +++ b/src/hotspot/cpu/x86/sharedRuntime_x86_64.cpp Mon Apr 12 16:20:08 2021 +0200 @@ -40,10 +40,10 @@ #include "runtime/safepointMechanism.hpp" #include "runtime/sharedRuntime.hpp" #include "runtime/vframeArray.hpp" +#include "runtime/vm_version.hpp" #include "utilities/align.hpp" #include "utilities/formatBuffer.hpp" #include "utilities/macros.hpp" -#include "vm_version_x86.hpp" #include "vmreg_x86.inline.hpp" #ifdef COMPILER1 #include "c1/c1_Runtime1.hpp" diff -r 0b92dcc259de src/hotspot/cpu/x86/vm_version_x86.hpp --- a/src/hotspot/cpu/x86/vm_version_x86.hpp Fri Nov 15 14:30:51 2019 +0100 +++ b/src/hotspot/cpu/x86/vm_version_x86.hpp Mon Apr 12 16:20:08 2021 +0200 @@ -25,8 +25,8 @@ #ifndef CPU_X86_VM_VM_VERSION_X86_HPP #define CPU_X86_VM_VM_VERSION_X86_HPP +#include "runtime/abstract_vm_version.hpp" #include "runtime/globals_extension.hpp" -#include "runtime/vm_version.hpp" class VM_Version : public Abstract_VM_Version { friend class VMStructs; diff -r 0b92dcc259de src/hotspot/os/bsd/os_perf_bsd.cpp --- a/src/hotspot/os/bsd/os_perf_bsd.cpp Fri Nov 15 14:30:51 2019 +0100 +++ b/src/hotspot/os/bsd/os_perf_bsd.cpp Mon Apr 12 16:20:08 2021 +0200 @@ -27,7 +27,7 @@ #include "runtime/os.hpp" #include "runtime/os_perf.hpp" #include "utilities/globalDefinitions.hpp" -#include "vm_version_ext_x86.hpp" +#include CPU_HEADER(vm_version_ext) #ifdef __APPLE__ #import diff -r 0b92dcc259de src/hotspot/share/runtime/abstract_vm_version.cpp --- a/src/hotspot/share/runtime/abstract_vm_version.cpp Fri Nov 15 14:30:51 2019 +0100 +++ b/src/hotspot/share/runtime/abstract_vm_version.cpp Mon Apr 12 16:20:08 2021 +0200 @@ -82,6 +82,8 @@ int Abstract_VM_Version::_vm_security_version = VERSION_UPDATE; int Abstract_VM_Version::_vm_patch_version = VERSION_PATCH; int Abstract_VM_Version::_vm_build_number = VERSION_BUILD; +unsigned int Abstract_VM_Version::_parallel_worker_threads = 0; +bool Abstract_VM_Version::_parallel_worker_threads_initialized = false; #if defined(_LP64) #define VMLP "64-Bit " @@ -314,3 +316,55 @@ fclose(fp); return true; } + +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"); + unsigned int threads; + // 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::initial_active_processor_count(); + threads = (ncpus <= switch_pt) ? + ncpus : + (switch_pt + ((ncpus - switch_pt) * num) / den); +#ifndef _LP64 + // On 32-bit binaries the virtual address space available to the JVM + // is usually limited to 2-3 GB (depends on the platform). + // Do not use up address space with too many threads (stacks and per-thread + // data). Note that x86 apps running on Win64 have 2 stacks per thread. + // GC may more generally scale down threads by max heap size (etc), but the + // consequences of over-provisioning threads are higher on 32-bit JVMS, + // so add hard limit here: + threads = MIN2(threads, (2*switch_pt)); +#endif + return threads; + } 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; +} diff -r 0b92dcc259de src/hotspot/share/runtime/abstract_vm_version.hpp --- a/src/hotspot/share/runtime/abstract_vm_version.hpp Fri Nov 15 14:30:51 2019 +0100 +++ b/src/hotspot/share/runtime/abstract_vm_version.hpp Mon Apr 12 16:20:08 2021 +0200 @@ -34,6 +34,7 @@ KVM, VMWare, HyperV, + HyperVRole, PowerVM, // on AIX or Linux ppc64(le) PowerFullPartitionMode, // on Linux ppc64(le) PowerKVM @@ -69,9 +70,15 @@ static int _vm_patch_version; static int _vm_build_number; static unsigned int _data_cache_line_flush_size; + static unsigned int _parallel_worker_threads; + static bool _parallel_worker_threads_initialized; static VirtualizationType _detected_virtualization; + static unsigned int nof_parallel_worker_threads(unsigned int num, + unsigned int dem, + unsigned int switch_pt); + public: // Called as part of the runtime services initialization which is // called from the management module initialization (via init_globals()) @@ -118,13 +125,8 @@ static const char* jdk_debug_level(); static const char* printable_jdk_debug_level(); - static uint64_t features() { - return _features; - } - - static const char* features_string() { - return _features_string; - } + static uint64_t features() { return _features; } + static const char* features_string() { return _features_string; } static VirtualizationType get_detected_virtualization() { return _detected_virtualization; @@ -178,9 +180,14 @@ // that the O/S may support more sizes, but at most this many are used. static uint page_size_count() { return 2; } - // Denominator for computing default ParallelGCThreads for machines with - // a large number of cores. - static uint parallel_worker_threads_denominator() { return 8; } + // Returns the number of parallel threads to be used for VM + // work. If that number has not been calculated, do so and + // save it. Returns ParallelGCThreads if it is set on the + // command line. + static unsigned int parallel_worker_threads(); + // Calculates and returns the number of parallel threads. May + // be VM version specific. + static unsigned int calc_parallel_worker_threads(); // Does this CPU support spin wait instruction? static bool supports_on_spin_wait() { return false; } diff -r 0b92dcc259de src/hotspot/share/runtime/vm_version.cpp --- a/src/hotspot/share/runtime/vm_version.cpp Fri Nov 15 14:30:51 2019 +0100 +++ b/src/hotspot/share/runtime/vm_version.cpp Mon Apr 12 16:20:08 2021 +0200 @@ -25,294 +25,9 @@ #include "precompiled.hpp" #include "logging/log.hpp" #include "logging/logStream.hpp" -#include "memory/universe.hpp" -#include "oops/oop.inline.hpp" -#include "runtime/arguments.hpp" +#include "memory/resourceArea.hpp" #include "runtime/vm_version.hpp" -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(); - -uint64_t Abstract_VM_Version::_features = 0; -const char* Abstract_VM_Version::_features_string = ""; - -bool Abstract_VM_Version::_supports_cx8 = false; -bool Abstract_VM_Version::_supports_atomic_getset4 = false; -bool Abstract_VM_Version::_supports_atomic_getset8 = false; -bool Abstract_VM_Version::_supports_atomic_getadd4 = false; -bool Abstract_VM_Version::_supports_atomic_getadd8 = false; -unsigned int Abstract_VM_Version::_logical_processors_per_package = 1U; -unsigned int Abstract_VM_Version::_L1_data_cache_line_size = 0; - -VirtualizationType Abstract_VM_Version::_detected_virtualization = NoDetectedVirtualization; - -#ifndef HOTSPOT_VERSION_STRING - #error HOTSPOT_VERSION_STRING must be defined -#endif - -#ifndef VERSION_FEATURE - #error VERSION_FEATURE must be defined -#endif -#ifndef VERSION_INTERIM - #error VERSION_INTERIM must be defined -#endif -#ifndef VERSION_UPDATE - #error VERSION_UPDATE must be defined -#endif -#ifndef VERSION_PATCH - #error VERSION_PATCH must be defined -#endif -#ifndef VERSION_BUILD - #error VERSION_BUILD must be defined -#endif - -#ifndef VERSION_STRING - #error VERSION_STRING must be defined -#endif - -#ifndef DEBUG_LEVEL - #error DEBUG_LEVEL must be defined -#endif - -#define VM_RELEASE HOTSPOT_VERSION_STRING - -// HOTSPOT_VERSION_STRING equals the JDK VERSION_STRING (unless overridden -// in a standalone build). -int Abstract_VM_Version::_vm_major_version = VERSION_FEATURE; -int Abstract_VM_Version::_vm_minor_version = VERSION_INTERIM; -int Abstract_VM_Version::_vm_security_version = VERSION_UPDATE; -int Abstract_VM_Version::_vm_patch_version = VERSION_PATCH; -int Abstract_VM_Version::_vm_build_number = VERSION_BUILD; -unsigned int Abstract_VM_Version::_parallel_worker_threads = 0; -bool Abstract_VM_Version::_parallel_worker_threads_initialized = false; - -#if defined(_LP64) - #define VMLP "64-Bit " -#else - #define VMLP "" -#endif - -#ifndef VMTYPE - #ifdef TIERED - #define VMTYPE "Server" - #else // TIERED - #ifdef ZERO - #define VMTYPE "Zero" - #else // ZERO - #define VMTYPE COMPILER1_PRESENT("Client") \ - COMPILER2_PRESENT("Server") - #endif // ZERO - #endif // TIERED -#endif - -#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 VENDOR; -#else - return "Oracle Corporation"; -#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: - if (UseSharedSpaces) { - if (UseAOT) { - return "mixed mode, aot, sharing"; -#ifdef TIERED - } else if(is_client_compilation_mode_vm()) { - return "mixed mode, emulated-client, sharing"; -#endif - } else { - return "mixed mode, sharing"; - } - } else { - if (UseAOT) { - return "mixed mode, aot"; -#ifdef TIERED - } else if(is_client_compilation_mode_vm()) { - return "mixed mode, emulated-client"; -#endif - } else { - return "mixed mode"; - } - } - case Arguments::_comp: -#ifdef TIERED - if (is_client_compilation_mode_vm()) { - return UseSharedSpaces ? "compiled mode, emulated-client, sharing" : "compiled mode, emulated-client"; - } -#endif - 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; -} - -// NOTE: do *not* use stringStream. this function is called by -// fatal error handlers. if the crash is in native thread, -// stringStream cannot get resource allocated and will SEGV. -const char* Abstract_VM_Version::jre_release_version() { - return VERSION_STRING; -} - -#define OS LINUX_ONLY("linux") \ - WINDOWS_ONLY("windows") \ - SOLARIS_ONLY("solaris") \ - AIX_ONLY("aix") \ - BSD_ONLY("bsd") - -#ifndef CPU -#ifdef ZERO -#define CPU ZERO_LIBARCH -#elif defined(PPC64) -#if defined(VM_LITTLE_ENDIAN) -#define CPU "ppc64le" -#else -#define CPU "ppc64" -#endif // PPC64 -#else -#define CPU AARCH64_ONLY("aarch64") \ - AMD64_ONLY("amd64") \ - IA32_ONLY("x86") \ - IA64_ONLY("ia64") \ - S390_ONLY("s390") \ - SPARC_ONLY("sparc") -#endif // !ZERO -#endif // !CPU - -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 == 1600 - #define HOTSPOT_BUILD_COMPILER "MS VC++ 10.0 (VS2010)" - #elif _MSC_VER == 1700 - #define HOTSPOT_BUILD_COMPILER "MS VC++ 11.0 (VS2012)" - #elif _MSC_VER == 1800 - #define HOTSPOT_BUILD_COMPILER "MS VC++ 12.0 (VS2013)" - #elif _MSC_VER == 1900 - #define HOTSPOT_BUILD_COMPILER "MS VC++ 14.0 (VS2015)" - #elif _MSC_VER == 1911 - #define HOTSPOT_BUILD_COMPILER "MS VC++ 15.3 (VS2017)" - #elif _MSC_VER == 1912 - #define HOTSPOT_BUILD_COMPILER "MS VC++ 15.5 (VS2017)" - #elif _MSC_VER == 1913 - #define HOTSPOT_BUILD_COMPILER "MS VC++ 15.6 (VS2017)" - #elif _MSC_VER == 1914 - #define HOTSPOT_BUILD_COMPILER "MS VC++ 15.7 (VS2017)" - #elif _MSC_VER == 1915 - #define HOTSPOT_BUILD_COMPILER "MS VC++ 15.8 (VS2017)" - #elif _MSC_VER == 1916 - #define HOTSPOT_BUILD_COMPILER "MS VC++ 15.9 (VS2017)" - #elif _MSC_VER == 1920 - #define HOTSPOT_BUILD_COMPILER "MS VC++ 16.0 (VS2019)" - #elif _MSC_VER == 1921 - #define HOTSPOT_BUILD_COMPILER "MS VC++ 16.1 (VS2019)" - #elif _MSC_VER == 1922 - #define HOTSPOT_BUILD_COMPILER "MS VC++ 16.2 (VS2019)" - #elif _MSC_VER == 1923 - #define HOTSPOT_BUILD_COMPILER "MS VC++ 16.3 (VS2019)" - #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" - #elif __SUNPRO_CC == 0x5100 - #define HOTSPOT_BUILD_COMPILER "Sun Studio 12u1" - #elif __SUNPRO_CC == 0x5120 - #define HOTSPOT_BUILD_COMPILER "Sun Studio 12u3" - #elif __SUNPRO_CC == 0x5130 - #define HOTSPOT_BUILD_COMPILER "Sun Studio 12u4" - #else - #define HOTSPOT_BUILD_COMPILER "unknown Workshop:" XSTR(__SUNPRO_CC) - #endif - #elif defined(__GNUC__) - #define HOTSPOT_BUILD_COMPILER "gcc " __VERSION__ - #elif defined(__IBMCPP__) - #define HOTSPOT_BUILD_COMPILER "xlC " XSTR(__IBMCPP__) - - #else - #define HOTSPOT_BUILD_COMPILER "unknown compiler" - #endif - #endif - - #ifndef FLOAT_ARCH - #if defined(__SOFTFP__) - #define FLOAT_ARCH_STR "-sflt" - #else - #define FLOAT_ARCH_STR "" - #endif - #else - #define FLOAT_ARCH_STR XSTR(FLOAT_ARCH) - #endif - - #define INTERNAL_VERSION_SUFFIX VM_RELEASE ")" \ - " for " OS "-" CPU FLOAT_ARCH_STR \ - " JRE (" VERSION_STRING "), built on " __DATE__ " " __TIME__ \ - " by " XSTR(HOTSPOT_BUILD_USER) " with " HOTSPOT_BUILD_COMPILER - - return strcmp(DEBUG_LEVEL, "release") == 0 - ? VMNAME " (" INTERNAL_VERSION_SUFFIX - : VMNAME " (" DEBUG_LEVEL " " INTERNAL_VERSION_SUFFIX; -} - -const char *Abstract_VM_Version::vm_build_user() { - return HOTSPOT_BUILD_USER; -} - -const char *Abstract_VM_Version::jdk_debug_level() { - return DEBUG_LEVEL; -} - -const char *Abstract_VM_Version::printable_jdk_debug_level() { - // Debug level is not printed for "release" builds - return strcmp(DEBUG_LEVEL, "release") == 0 ? "" : DEBUG_LEVEL " "; -} - -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_security_version() & 0xFF) << 8) | - (Abstract_VM_Version::vm_build_number() & 0xFF); -} - void VM_Version_init() { VM_Version::initialize(); @@ -323,55 +38,3 @@ os::print_cpu_info(&ls, buf, sizeof(buf)); } } - -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"); - unsigned int threads; - // 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::initial_active_processor_count(); - threads = (ncpus <= switch_pt) ? - ncpus : - (switch_pt + ((ncpus - switch_pt) * num) / den); -#ifndef _LP64 - // On 32-bit binaries the virtual address space available to the JVM - // is usually limited to 2-3 GB (depends on the platform). - // Do not use up address space with too many threads (stacks and per-thread - // data). Note that x86 apps running on Win64 have 2 stacks per thread. - // GC may more generally scale down threads by max heap size (etc), but the - // consequences of over-provisioning threads are higher on 32-bit JVMS, - // so add hard limit here: - threads = MIN2(threads, (2*switch_pt)); -#endif - return threads; - } 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; -} diff -r 0b92dcc259de src/hotspot/share/runtime/vm_version.hpp --- a/src/hotspot/share/runtime/vm_version.hpp Fri Nov 15 14:30:51 2019 +0100 +++ b/src/hotspot/share/runtime/vm_version.hpp Mon Apr 12 16:20:08 2021 +0200 @@ -22,170 +22,10 @@ * */ -#ifndef SHARE_VM_RUNTIME_VM_VERSION_HPP -#define SHARE_VM_RUNTIME_VM_VERSION_HPP - -#include "memory/allocation.hpp" -#include "utilities/ostream.hpp" -#include "utilities/macros.hpp" - -typedef enum { - NoDetectedVirtualization, - XenHVM, - KVM, - VMWare, - HyperV, - HyperVRole, - PowerVM, // on AIX or Linux ppc64(le) - PowerFullPartitionMode, // on Linux ppc64(le) - PowerKVM -} VirtualizationType; - -// VM_Version provides information about the VM. - -class Abstract_VM_Version: AllStatic { - friend class VMStructs; - friend class JVMCIVMStructs; - - protected: - static const char* _s_vm_release; - static const char* _s_internal_vm_info_string; - - // CPU feature flags. - static uint64_t _features; - static const char* _features_string; - - // These are set by machine-dependent initializations - static bool _supports_cx8; - static bool _supports_atomic_getset4; - static bool _supports_atomic_getset8; - static bool _supports_atomic_getadd4; - static bool _supports_atomic_getadd8; - static unsigned int _logical_processors_per_package; - static unsigned int _L1_data_cache_line_size; - static int _vm_major_version; - static int _vm_minor_version; - static int _vm_security_version; - static int _vm_patch_version; - static int _vm_build_number; - - static VirtualizationType _detected_virtualization; - - static unsigned int _parallel_worker_threads; - static bool _parallel_worker_threads_initialized; - - static unsigned int nof_parallel_worker_threads(unsigned int num, - unsigned int dem, - unsigned int switch_pt); - public: - // Called as part of the runtime services initialization which is - // called from the management module initialization (via init_globals()) - // after argument parsing and attaching of the main thread has - // occurred. Examines a variety of the hardware capabilities of - // the platform to determine which features can be used to execute the - // program. - static void initialize(); - - // This allows for early initialization of VM_Version information - // that may be needed later in the initialization sequence but before - // full VM_Version initialization is possible. It can not depend on any - // other part of the VM being initialized when called. Platforms that - // need to specialize this define VM_Version::early_initialize(). - static void early_initialize() { } - - // Called to initialize VM variables needing initialization - // after command line parsing. Platforms that need to specialize - // this should define VM_Version::init_before_ergo(). - static void init_before_ergo() {} +#ifndef SHARE_RUNTIME_VM_VERSION_HPP +#define SHARE_RUNTIME_VM_VERSION_HPP - // Name - static const char* vm_name(); - // Vendor - static const char* vm_vendor(); - // VM version information string printed by launcher (java -version) - static const char* vm_info_string(); - static const char* vm_release(); - static const char* vm_platform_string(); - static const char* vm_build_user(); - - static int vm_major_version() { return _vm_major_version; } - static int vm_minor_version() { return _vm_minor_version; } - static int vm_security_version() { return _vm_security_version; } - static int vm_patch_version() { return _vm_patch_version; } - static int vm_build_number() { return _vm_build_number; } - - // Gets the jvm_version_info.jvm_version defined in jvm.h - static unsigned int jvm_version(); - - // Internal version providing additional build information - static const char* internal_vm_info_string(); - static const char* jre_release_version(); - static const char* jdk_debug_level(); - static const char* printable_jdk_debug_level(); - - static uint64_t features() { - return _features; - } - - static const char* features_string() { - return _features_string; - } - - static VirtualizationType get_detected_virtualization() { - return _detected_virtualization; - } - - // platforms that need to specialize this - // define VM_Version::print_platform_virtualization_info() - static void print_platform_virtualization_info(outputStream*) { } - - // does HW support an 8-byte compare-exchange operation? - static bool supports_cx8() { -#ifdef SUPPORTS_NATIVE_CX8 - return true; -#else - return _supports_cx8; -#endif - } - // does HW support atomic get-and-set or atomic get-and-add? Used - // to guide intrinsification decisions for Unsafe atomic ops - static bool supports_atomic_getset4() {return _supports_atomic_getset4;} - static bool supports_atomic_getset8() {return _supports_atomic_getset8;} - static bool supports_atomic_getadd4() {return _supports_atomic_getadd4;} - static bool supports_atomic_getadd8() {return _supports_atomic_getadd8;} - - static unsigned int logical_processors_per_package() { - return _logical_processors_per_package; - } - - static unsigned int L1_data_cache_line_size() { - return _L1_data_cache_line_size; - } - - // ARCH specific policy for the BiasedLocking - static bool use_biased_locking() { return true; } - - // Number of page sizes efficiently supported by the hardware. Most chips now - // support two sizes, thus this default implementation. Processor-specific - // subclasses should define new versions to hide this one as needed. Note - // that the O/S may support more sizes, but at most this many are used. - static uint page_size_count() { return 2; } - - // Returns the number of parallel threads to be used for VM - // work. If that number has not been calculated, do so and - // save it. Returns ParallelGCThreads if it is set on the - // command line. - static unsigned int parallel_worker_threads(); - // Calculates and returns the number of parallel threads. May - // be VM version specific. - static unsigned int calc_parallel_worker_threads(); - - // Does this CPU support spin wait instruction? - static bool supports_on_spin_wait() { return false; } - - static bool print_matching_lines_from_file(const char* filename, outputStream* st, const char* keywords_to_match[]); -}; - +#include "utilities/macros.hpp" // for CPU_HEADER() macro. #include CPU_HEADER(vm_version) -#endif // SHARE_VM_RUNTIME_VM_VERSION_HPP +#endif // SHARE_RUNTIME_VM_VERSION_HPP