src/share/vm/runtime/vm_version.cpp

Thu, 24 Nov 2016 11:27:57 +0100

author
tschatzl
date
Thu, 24 Nov 2016 11:27:57 +0100
changeset 9982
72053ed6f8d4
parent 9946
103d1261f1f4
child 10015
eb7ce841ccec
permissions
-rw-r--r--

8057003: Large reference arrays cause extremely long synchronization times
Summary: Slice large object arrays into parts so that the synchronization of marking threads with an STW pause request does not take long.
Reviewed-by: ehelin, pliden
Contributed-by: maoliang.ml@alibaba-inc.com

duke@435 1 /*
tschatzl@8662 2 * Copyright (c) 1998, 2016, Oracle and/or its affiliates. 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 *
trims@1907 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
trims@1907 20 * or visit www.oracle.com if you need additional information or have any
trims@1907 21 * questions.
duke@435 22 *
duke@435 23 */
duke@435 24
stefank@2314 25 #include "precompiled.hpp"
stefank@2314 26 #include "memory/universe.hpp"
stefank@2314 27 #include "oops/oop.inline.hpp"
stefank@2314 28 #include "runtime/arguments.hpp"
stefank@2314 29 #ifdef TARGET_ARCH_x86
stefank@2314 30 # include "vm_version_x86.hpp"
stefank@2314 31 #endif
stefank@2314 32 #ifdef TARGET_ARCH_sparc
stefank@2314 33 # include "vm_version_sparc.hpp"
stefank@2314 34 #endif
stefank@2314 35 #ifdef TARGET_ARCH_zero
stefank@2314 36 # include "vm_version_zero.hpp"
stefank@2314 37 #endif
bobv@2508 38 #ifdef TARGET_ARCH_arm
bobv@2508 39 # include "vm_version_arm.hpp"
bobv@2508 40 #endif
bobv@2508 41 #ifdef TARGET_ARCH_ppc
bobv@2508 42 # include "vm_version_ppc.hpp"
bobv@2508 43 #endif
duke@435 44
duke@435 45 const char* Abstract_VM_Version::_s_vm_release = Abstract_VM_Version::vm_release();
duke@435 46 const char* Abstract_VM_Version::_s_internal_vm_info_string = Abstract_VM_Version::internal_vm_info_string();
duke@435 47 bool Abstract_VM_Version::_supports_cx8 = false;
roland@4106 48 bool Abstract_VM_Version::_supports_atomic_getset4 = false;
roland@4106 49 bool Abstract_VM_Version::_supports_atomic_getset8 = false;
roland@4106 50 bool Abstract_VM_Version::_supports_atomic_getadd4 = false;
roland@4106 51 bool Abstract_VM_Version::_supports_atomic_getadd8 = false;
duke@435 52 unsigned int Abstract_VM_Version::_logical_processors_per_package = 1U;
kevinw@8729 53 unsigned int Abstract_VM_Version::_L1_data_cache_line_size = 0;
kvn@3052 54 int Abstract_VM_Version::_reserve_for_allocation_prefetch = 0;
duke@435 55
duke@435 56 #ifndef HOTSPOT_RELEASE_VERSION
duke@435 57 #error HOTSPOT_RELEASE_VERSION must be defined
duke@435 58 #endif
duke@435 59 #ifndef JRE_RELEASE_VERSION
duke@435 60 #error JRE_RELEASE_VERSION must be defined
duke@435 61 #endif
duke@435 62 #ifndef HOTSPOT_BUILD_TARGET
duke@435 63 #error HOTSPOT_BUILD_TARGET must be defined
duke@435 64 #endif
duke@435 65
duke@435 66 #ifdef PRODUCT
duke@435 67 #define VM_RELEASE HOTSPOT_RELEASE_VERSION
duke@435 68 #else
duke@435 69 #define VM_RELEASE HOTSPOT_RELEASE_VERSION "-" HOTSPOT_BUILD_TARGET
duke@435 70 #endif
duke@435 71
duke@435 72 // HOTSPOT_RELEASE_VERSION must follow the release version naming convention
duke@435 73 // <major_ver>.<minor_ver>-b<nn>[-<identifier>][-<debug_target>]
duke@435 74 int Abstract_VM_Version::_vm_major_version = 0;
duke@435 75 int Abstract_VM_Version::_vm_minor_version = 0;
duke@435 76 int Abstract_VM_Version::_vm_build_number = 0;
duke@435 77 bool Abstract_VM_Version::_initialized = false;
jmasa@445 78 int Abstract_VM_Version::_parallel_worker_threads = 0;
jmasa@445 79 bool Abstract_VM_Version::_parallel_worker_threads_initialized = false;
duke@435 80
duke@435 81 void Abstract_VM_Version::initialize() {
duke@435 82 if (_initialized) {
duke@435 83 return;
duke@435 84 }
duke@435 85 char* vm_version = os::strdup(HOTSPOT_RELEASE_VERSION);
duke@435 86
duke@435 87 // Expecting the next vm_version format:
duke@435 88 // <major_ver>.<minor_ver>-b<nn>[-<identifier>]
duke@435 89 char* vm_major_ver = vm_version;
duke@435 90 assert(isdigit(vm_major_ver[0]),"wrong vm major version number");
duke@435 91 char* vm_minor_ver = strchr(vm_major_ver, '.');
duke@435 92 assert(vm_minor_ver != NULL && isdigit(vm_minor_ver[1]),"wrong vm minor version number");
duke@435 93 vm_minor_ver[0] = '\0'; // terminate vm_major_ver
duke@435 94 vm_minor_ver += 1;
duke@435 95 char* vm_build_num = strchr(vm_minor_ver, '-');
duke@435 96 assert(vm_build_num != NULL && vm_build_num[1] == 'b' && isdigit(vm_build_num[2]),"wrong vm build number");
duke@435 97 vm_build_num[0] = '\0'; // terminate vm_minor_ver
duke@435 98 vm_build_num += 2;
duke@435 99
duke@435 100 _vm_major_version = atoi(vm_major_ver);
duke@435 101 _vm_minor_version = atoi(vm_minor_ver);
duke@435 102 _vm_build_number = atoi(vm_build_num);
duke@435 103
duke@435 104 os::free(vm_version);
duke@435 105 _initialized = true;
duke@435 106 }
duke@435 107
duke@435 108 #if defined(_LP64)
duke@435 109 #define VMLP "64-Bit "
duke@435 110 #else
duke@435 111 #define VMLP ""
duke@435 112 #endif
duke@435 113
jprovino@4165 114 #ifndef VMTYPE
jprovino@4165 115 #ifdef TIERED
jprovino@4165 116 #define VMTYPE "Server"
jprovino@4165 117 #else // TIERED
jprovino@4165 118 #ifdef ZERO
jprovino@4165 119 #ifdef SHARK
jprovino@4165 120 #define VMTYPE "Shark"
jprovino@4165 121 #else // SHARK
jprovino@4165 122 #define VMTYPE "Zero"
jprovino@4165 123 #endif // SHARK
jprovino@4165 124 #else // ZERO
jprovino@4165 125 #define VMTYPE COMPILER1_PRESENT("Client") \
jprovino@4165 126 COMPILER2_PRESENT("Server")
jprovino@4165 127 #endif // ZERO
jprovino@4165 128 #endif // TIERED
jprovino@4165 129 #endif
duke@435 130
duke@435 131 #ifndef HOTSPOT_VM_DISTRO
duke@435 132 #error HOTSPOT_VM_DISTRO must be defined
duke@435 133 #endif
dholmes@3201 134 #define VMNAME HOTSPOT_VM_DISTRO " " VMLP EMBEDDED_ONLY("Embedded ") VMTYPE " VM"
duke@435 135
duke@435 136 const char* Abstract_VM_Version::vm_name() {
duke@435 137 return VMNAME;
duke@435 138 }
duke@435 139
duke@435 140
duke@435 141 const char* Abstract_VM_Version::vm_vendor() {
duke@435 142 #ifdef VENDOR
erikj@9635 143 return VENDOR;
duke@435 144 #else
zgu@2155 145 return JDK_Version::is_gte_jdk17x_version() ?
zgu@2155 146 "Oracle Corporation" : "Sun Microsystems Inc.";
duke@435 147 #endif
duke@435 148 }
duke@435 149
duke@435 150
duke@435 151 const char* Abstract_VM_Version::vm_info_string() {
duke@435 152 switch (Arguments::mode()) {
duke@435 153 case Arguments::_int:
duke@435 154 return UseSharedSpaces ? "interpreted mode, sharing" : "interpreted mode";
duke@435 155 case Arguments::_mixed:
duke@435 156 return UseSharedSpaces ? "mixed mode, sharing" : "mixed mode";
duke@435 157 case Arguments::_comp:
duke@435 158 return UseSharedSpaces ? "compiled mode, sharing" : "compiled mode";
duke@435 159 };
duke@435 160 ShouldNotReachHere();
duke@435 161 return "";
duke@435 162 }
duke@435 163
duke@435 164 // NOTE: do *not* use stringStream. this function is called by
duke@435 165 // fatal error handler. if the crash is in native thread,
duke@435 166 // stringStream cannot get resource allocated and will SEGV.
duke@435 167 const char* Abstract_VM_Version::vm_release() {
duke@435 168 return VM_RELEASE;
duke@435 169 }
duke@435 170
ohrstrom@3517 171 // NOTE: do *not* use stringStream. this function is called by
ohrstrom@3517 172 // fatal error handlers. if the crash is in native thread,
ohrstrom@3517 173 // stringStream cannot get resource allocated and will SEGV.
ohrstrom@3517 174 const char* Abstract_VM_Version::jre_release_version() {
ohrstrom@3517 175 return JRE_RELEASE_VERSION;
ohrstrom@3517 176 }
ohrstrom@3517 177
duke@435 178 #define OS LINUX_ONLY("linux") \
duke@435 179 WINDOWS_ONLY("windows") \
never@3156 180 SOLARIS_ONLY("solaris") \
goetz@6461 181 AIX_ONLY("aix") \
never@3156 182 BSD_ONLY("bsd")
duke@435 183
dlong@7598 184 #ifndef CPU
never@1445 185 #ifdef ZERO
never@1445 186 #define CPU ZERO_LIBARCH
sgehwolf@9493 187 #elif defined(PPC64)
sgehwolf@9493 188 #if defined(VM_LITTLE_ENDIAN)
sgehwolf@9493 189 #define CPU "ppc64le"
sgehwolf@9493 190 #else
sgehwolf@9493 191 #define CPU "ppc64"
sgehwolf@9493 192 #endif
never@1445 193 #else
duke@435 194 #define CPU IA32_ONLY("x86") \
duke@435 195 IA64_ONLY("ia64") \
duke@435 196 AMD64_ONLY("amd64") \
duke@435 197 SPARC_ONLY("sparc")
never@1445 198 #endif // ZERO
dlong@7598 199 #endif
duke@435 200
duke@435 201 const char *Abstract_VM_Version::vm_platform_string() {
duke@435 202 return OS "-" CPU;
duke@435 203 }
duke@435 204
duke@435 205 const char* Abstract_VM_Version::internal_vm_info_string() {
duke@435 206 #ifndef HOTSPOT_BUILD_USER
duke@435 207 #define HOTSPOT_BUILD_USER unknown
duke@435 208 #endif
duke@435 209
duke@435 210 #ifndef HOTSPOT_BUILD_COMPILER
duke@435 211 #ifdef _MSC_VER
duke@435 212 #if _MSC_VER == 1100
duke@435 213 #define HOTSPOT_BUILD_COMPILER "MS VC++ 5.0"
duke@435 214 #elif _MSC_VER == 1200
duke@435 215 #define HOTSPOT_BUILD_COMPILER "MS VC++ 6.0"
duke@435 216 #elif _MSC_VER == 1310
kvn@1080 217 #define HOTSPOT_BUILD_COMPILER "MS VC++ 7.1 (VS2003)"
duke@435 218 #elif _MSC_VER == 1400
kvn@1080 219 #define HOTSPOT_BUILD_COMPILER "MS VC++ 8.0 (VS2005)"
kvn@1080 220 #elif _MSC_VER == 1500
kvn@1080 221 #define HOTSPOT_BUILD_COMPILER "MS VC++ 9.0 (VS2008)"
kmo@4757 222 #elif _MSC_VER == 1600
kmo@4757 223 #define HOTSPOT_BUILD_COMPILER "MS VC++ 10.0 (VS2010)"
kmo@4757 224 #elif _MSC_VER == 1700
kmo@4757 225 #define HOTSPOT_BUILD_COMPILER "MS VC++ 11.0 (VS2012)"
kevinw@9320 226 #elif _MSC_VER == 1800
kevinw@9320 227 #define HOTSPOT_BUILD_COMPILER "MS VC++ 12.0 (VS2013)"
kevinw@9320 228 #elif _MSC_VER == 1900
kevinw@9320 229 #define HOTSPOT_BUILD_COMPILER "MS VC++ 14.0 (VS2015)"
mchinnathamb@9945 230 #elif _MSC_VER == 1911
mchinnathamb@9945 231 #define HOTSPOT_BUILD_COMPILER "MS VC++ 15.3 (VS2017)"
kevinw@9320 232 #elif _MSC_VER == 1912
kevinw@9320 233 #define HOTSPOT_BUILD_COMPILER "MS VC++ 15.5 (VS2017)"
kevinw@9488 234 #elif _MSC_VER == 1913
kevinw@9488 235 #define HOTSPOT_BUILD_COMPILER "MS VC++ 15.6 (VS2017)"
mchinnathamb@9945 236 #elif _MSC_VER == 1914
mchinnathamb@9945 237 #define HOTSPOT_BUILD_COMPILER "MS VC++ 15.7 (VS2017)"
mchinnathamb@9945 238 #elif _MSC_VER == 1915
mchinnathamb@9945 239 #define HOTSPOT_BUILD_COMPILER "MS VC++ 15.8 (VS2017)"
mbaesken@9946 240 #elif _MSC_VER == 1916
mbaesken@9946 241 #define HOTSPOT_BUILD_COMPILER "MS VC++ 15.9 (VS2017)"
mbaesken@9946 242 #elif _MSC_VER == 1920
mbaesken@9946 243 #define HOTSPOT_BUILD_COMPILER "MS VC++ 16.0 (VS2019)"
mbaesken@9946 244 #elif _MSC_VER == 1921
mbaesken@9946 245 #define HOTSPOT_BUILD_COMPILER "MS VC++ 16.1 (VS2019)"
mbaesken@9946 246 #elif _MSC_VER == 1922
mbaesken@9946 247 #define HOTSPOT_BUILD_COMPILER "MS VC++ 16.2 (VS2019)"
mbaesken@9946 248 #elif _MSC_VER == 1923
mbaesken@9946 249 #define HOTSPOT_BUILD_COMPILER "MS VC++ 16.3 (VS2019)"
duke@435 250 #else
duke@435 251 #define HOTSPOT_BUILD_COMPILER "unknown MS VC++:" XSTR(_MSC_VER)
duke@435 252 #endif
duke@435 253 #elif defined(__SUNPRO_CC)
duke@435 254 #if __SUNPRO_CC == 0x420
duke@435 255 #define HOTSPOT_BUILD_COMPILER "Workshop 4.2"
duke@435 256 #elif __SUNPRO_CC == 0x500
duke@435 257 #define HOTSPOT_BUILD_COMPILER "Workshop 5.0 compat=" XSTR(__SUNPRO_CC_COMPAT)
duke@435 258 #elif __SUNPRO_CC == 0x520
duke@435 259 #define HOTSPOT_BUILD_COMPILER "Workshop 5.2 compat=" XSTR(__SUNPRO_CC_COMPAT)
duke@435 260 #elif __SUNPRO_CC == 0x580
duke@435 261 #define HOTSPOT_BUILD_COMPILER "Workshop 5.8"
duke@435 262 #elif __SUNPRO_CC == 0x590
duke@435 263 #define HOTSPOT_BUILD_COMPILER "Workshop 5.9"
jcoomes@1902 264 #elif __SUNPRO_CC == 0x5100
jcoomes@1902 265 #define HOTSPOT_BUILD_COMPILER "Sun Studio 12u1"
dcubed@5537 266 #elif __SUNPRO_CC == 0x5120
dcubed@5537 267 #define HOTSPOT_BUILD_COMPILER "Sun Studio 12u3"
duke@435 268 #else
duke@435 269 #define HOTSPOT_BUILD_COMPILER "unknown Workshop:" XSTR(__SUNPRO_CC)
duke@435 270 #endif
duke@435 271 #elif defined(__GNUC__)
duke@435 272 #define HOTSPOT_BUILD_COMPILER "gcc " __VERSION__
goetz@6461 273 #elif defined(__IBMCPP__)
goetz@6461 274 #define HOTSPOT_BUILD_COMPILER "xlC " XSTR(__IBMCPP__)
goetz@6461 275
duke@435 276 #else
duke@435 277 #define HOTSPOT_BUILD_COMPILER "unknown compiler"
duke@435 278 #endif
duke@435 279 #endif
duke@435 280
bobv@2508 281 #ifndef FLOAT_ARCH
bobv@2508 282 #if defined(__SOFTFP__)
dholmes@4288 283 #define FLOAT_ARCH_STR "-sflt"
bobv@2508 284 #else
dholmes@4288 285 #define FLOAT_ARCH_STR ""
bobv@2508 286 #endif
dholmes@4288 287 #else
dholmes@4288 288 #define FLOAT_ARCH_STR XSTR(FLOAT_ARCH)
bobv@2508 289 #endif
duke@435 290
dholmes@4288 291 return VMNAME " (" VM_RELEASE ") for " OS "-" CPU FLOAT_ARCH_STR
duke@435 292 " JRE (" JRE_RELEASE_VERSION "), built on " __DATE__ " " __TIME__
duke@435 293 " by " XSTR(HOTSPOT_BUILD_USER) " with " HOTSPOT_BUILD_COMPILER;
duke@435 294 }
duke@435 295
kamg@2515 296 const char *Abstract_VM_Version::vm_build_user() {
kamg@2515 297 return HOTSPOT_BUILD_USER;
kamg@2515 298 }
kamg@2515 299
duke@435 300 unsigned int Abstract_VM_Version::jvm_version() {
duke@435 301 return ((Abstract_VM_Version::vm_major_version() & 0xFF) << 24) |
sgehwolf@9915 302 ((Abstract_VM_Version::vm_minor_version() & 0xFFFF) << 8) |
duke@435 303 (Abstract_VM_Version::vm_build_number() & 0xFF);
duke@435 304 }
duke@435 305
duke@435 306
duke@435 307 void VM_Version_init() {
duke@435 308 VM_Version::initialize();
duke@435 309
duke@435 310 #ifndef PRODUCT
duke@435 311 if (PrintMiscellaneous && Verbose) {
duke@435 312 os::print_cpu_info(tty);
duke@435 313 }
duke@435 314 #endif
duke@435 315 }
jmasa@445 316
jmasa@445 317 unsigned int Abstract_VM_Version::nof_parallel_worker_threads(
jmasa@445 318 unsigned int num,
jmasa@445 319 unsigned int den,
jmasa@445 320 unsigned int switch_pt) {
jmasa@445 321 if (FLAG_IS_DEFAULT(ParallelGCThreads)) {
jmasa@445 322 assert(ParallelGCThreads == 0, "Default ParallelGCThreads is not 0");
jmasa@445 323 // For very large machines, there are diminishing returns
jmasa@445 324 // for large numbers of worker threads. Instead of
jmasa@445 325 // hogging the whole system, use a fraction of the workers for every
jmasa@445 326 // processor after the first 8. For example, on a 72 cpu machine
jmasa@445 327 // and a chosen fraction of 5/8
jmasa@445 328 // use 8 + (72 - 8) * (5/8) == 48 worker threads.
tschatzl@8662 329 unsigned int ncpus = (unsigned int) os::initial_active_processor_count();
jmasa@445 330 return (ncpus <= switch_pt) ?
jmasa@445 331 ncpus :
jmasa@445 332 (switch_pt + ((ncpus - switch_pt) * num) / den);
jmasa@445 333 } else {
jmasa@445 334 return ParallelGCThreads;
jmasa@445 335 }
jmasa@445 336 }
jmasa@445 337
jmasa@445 338 unsigned int Abstract_VM_Version::calc_parallel_worker_threads() {
jmasa@445 339 return nof_parallel_worker_threads(5, 8, 8);
jmasa@445 340 }
jmasa@445 341
jmasa@445 342
jmasa@445 343 // Does not set the _initialized flag since it is
jmasa@445 344 // a global flag.
jmasa@445 345 unsigned int Abstract_VM_Version::parallel_worker_threads() {
jmasa@445 346 if (!_parallel_worker_threads_initialized) {
jmasa@445 347 if (FLAG_IS_DEFAULT(ParallelGCThreads)) {
jmasa@445 348 _parallel_worker_threads = VM_Version::calc_parallel_worker_threads();
jmasa@445 349 } else {
jmasa@445 350 _parallel_worker_threads = ParallelGCThreads;
jmasa@445 351 }
jmasa@445 352 _parallel_worker_threads_initialized = true;
jmasa@445 353 }
jmasa@445 354 return _parallel_worker_threads;
jmasa@445 355 }

mercurial