Wed, 03 Jul 2019 20:42:37 +0800
Merge
1.1 --- a/.hgtags Wed Jul 03 20:04:13 2019 +0800 1.2 +++ b/.hgtags Wed Jul 03 20:42:37 2019 +0800 1.3 @@ -1254,6 +1254,11 @@ 1.4 dee6a1ce4a0c526c47d71ef402d10e4b8915c5cb jdk8u201-b07 1.5 e4daab85ac15ae3c51f14ed8fba888e54e4c6830 jdk8u201-b77 1.6 e2c2448a1ca75333879e055655f11525decc2c39 jdk8u201-b08 1.7 +48947e4db9f3b88fd0ec55801e969a3bd6cb74a9 jdk8u201-b09 1.8 +bd988b43db1b5ca6ee545097e79ddc5a4c8b5c87 jdk8u201-b79 1.9 +b9347a42530a741b7028e0cce47ce0bdd70697a3 jdk8u201-b25 1.10 +fb760c9d9649ab7d107b777a41f1424eebfb4883 jdk8u201-b26 1.11 +48947e4db9f3b88fd0ec55801e969a3bd6cb74a9 jdk8u201-ga 1.12 79b4c0a88c00226dcd14496652adf84d53b5cb9c jdk8u202-b01 1.13 9ce27f0a4683a2083d3aed59a40d6a3ccfc8e397 jdk8u202-b02 1.14 c0836eee40e5cfc7b3eebbb7a53bfcd98bc66278 jdk8u202-b03 1.15 @@ -1264,3 +1269,9 @@ 1.16 818b1963f7a227a2368a4f363d5500dd226a529e jdk8u202-b08 1.17 624a0741915c0159d5a300c55aa0d40ce96b3214 mips64el-jdk8u202-b09 1.18 f10841009d272787f9be0c483b1f100e98e17cdb mips64el-jdk8u202-b10 1.19 +1083b49a881011f43667ebebc280d519f077f9e6 jdk8u202-b25 1.20 +7a69774c67cb79a79ccb2ac2d6d258a11e22aa6f jdk8u202-b26 1.21 +818b1963f7a227a2368a4f363d5500dd226a529e jdk8u202-ga 1.22 +9ce27f0a4683a2083d3aed59a40d6a3ccfc8e397 jdk8u212-b00 1.23 +9ee244aee077ffad50d1b183a61d9f5fc39a1285 jdk8u212-b01 1.24 +2d94aac71d3337c7c3284bdb101b7ea15ef6d5f5 jdk8u212-b02
2.1 --- a/THIRD_PARTY_README Wed Jul 03 20:04:13 2019 +0800 2.2 +++ b/THIRD_PARTY_README Wed Jul 03 20:42:37 2019 +0800 2.3 @@ -1096,33 +1096,6 @@ 2.4 OF SUCH DAMAGE. 2.5 --- end of LICENSE --- 2.6 2.7 -%% This notice is provided with respect to FontConfig 2.5, which may be 2.8 -included with JRE 8, JDK 8, and OpenJDK 8 source distributions on 2.9 -Linux and Solaris. 2.10 - 2.11 ---- begin of LICENSE --- 2.12 - 2.13 -Copyright ?? 2001,2003 Keith Packard 2.14 - 2.15 -Permission to use, copy, modify, distribute, and sell this software and its 2.16 -documentation for any purpose is hereby granted without fee, provided that the 2.17 -above copyright notice appear in all copies and that both that copyright 2.18 -notice and this permission notice appear in supporting documentation, and that 2.19 -the name of Keith Packard not be used in advertising or publicity pertaining 2.20 -to distribution of the software without specific, written prior permission. 2.21 -Keith Packard makes no representations about the suitability of this software 2.22 -for any purpose. It is provided "as is" without express or implied warranty. 2.23 - 2.24 -KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING 2.25 -ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL KEITH 2.26 -PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY 2.27 -DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 2.28 -ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN 2.29 -CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 2.30 - 2.31 - 2.32 ---- end of LICENSE --- 2.33 - 2.34 ------------------------------------------------------------------------------- 2.35 2.36 %% This notice is provided with respect to freebXML Registry 3.0 & 3.1,
3.1 --- a/agent/src/os/linux/libproc_impl.c Wed Jul 03 20:04:13 2019 +0800 3.2 +++ b/agent/src/os/linux/libproc_impl.c Wed Jul 03 20:42:37 2019 +0800 3.3 @@ -29,54 +29,51 @@ 3.4 #include <thread_db.h> 3.5 #include "libproc_impl.h" 3.6 3.7 -static const char* alt_root = NULL; 3.8 -static int alt_root_len = -1; 3.9 - 3.10 #define SA_ALTROOT "SA_ALTROOT" 3.11 3.12 -static void init_alt_root() { 3.13 - if (alt_root_len == -1) { 3.14 - alt_root = getenv(SA_ALTROOT); 3.15 - if (alt_root) { 3.16 - alt_root_len = strlen(alt_root); 3.17 - } else { 3.18 - alt_root_len = 0; 3.19 - } 3.20 - } 3.21 -} 3.22 +int pathmap_open(const char* name) { 3.23 + static const char *alt_root = NULL; 3.24 + static int alt_root_initialized = 0; 3.25 3.26 -int pathmap_open(const char* name) { 3.27 - int fd; 3.28 - char alt_path[PATH_MAX + 1]; 3.29 + int fd; 3.30 + char alt_path[PATH_MAX + 1], *alt_path_end; 3.31 + const char *s; 3.32 3.33 - init_alt_root(); 3.34 + if (!alt_root_initialized) { 3.35 + alt_root_initialized = -1; 3.36 + alt_root = getenv(SA_ALTROOT); 3.37 + } 3.38 3.39 - if (alt_root_len > 0) { 3.40 - strcpy(alt_path, alt_root); 3.41 - strcat(alt_path, name); 3.42 - fd = open(alt_path, O_RDONLY); 3.43 - if (fd >= 0) { 3.44 - print_debug("path %s substituted for %s\n", alt_path, name); 3.45 - return fd; 3.46 - } 3.47 + if (alt_root == NULL) { 3.48 + return open(name, O_RDONLY); 3.49 + } 3.50 3.51 - if (strrchr(name, '/')) { 3.52 - strcpy(alt_path, alt_root); 3.53 - strcat(alt_path, strrchr(name, '/')); 3.54 - fd = open(alt_path, O_RDONLY); 3.55 - if (fd >= 0) { 3.56 - print_debug("path %s substituted for %s\n", alt_path, name); 3.57 - return fd; 3.58 - } 3.59 - } 3.60 - } else { 3.61 - fd = open(name, O_RDONLY); 3.62 - if (fd >= 0) { 3.63 - return fd; 3.64 - } 3.65 - } 3.66 + strcpy(alt_path, alt_root); 3.67 + alt_path_end = alt_path + strlen(alt_path); 3.68 3.69 - return -1; 3.70 + // Strip path items one by one and try to open file with alt_root prepended 3.71 + s = name; 3.72 + while (1) { 3.73 + strcat(alt_path, s); 3.74 + s += 1; 3.75 + 3.76 + fd = open(alt_path, O_RDONLY); 3.77 + if (fd >= 0) { 3.78 + print_debug("path %s substituted for %s\n", alt_path, name); 3.79 + return fd; 3.80 + } 3.81 + 3.82 + // Linker always put full path to solib to process, so we can rely 3.83 + // on presence of /. If slash is not present, it means, that SOlib doesn't 3.84 + // physically exist (e.g. linux-gate.so) and we fail opening it anyway 3.85 + if ((s = strchr(s, '/')) == NULL) { 3.86 + break; 3.87 + } 3.88 + 3.89 + *alt_path_end = 0; 3.90 + } 3.91 + 3.92 + return -1; 3.93 } 3.94 3.95 static bool _libsaproc_debug;
4.1 --- a/agent/src/share/classes/sun/jvm/hotspot/CLHSDB.java Wed Jul 03 20:04:13 2019 +0800 4.2 +++ b/agent/src/share/classes/sun/jvm/hotspot/CLHSDB.java Wed Jul 03 20:42:37 2019 +0800 4.3 @@ -113,7 +113,8 @@ 4.4 private String coreFilename; 4.5 4.6 private void doUsage() { 4.7 - System.out.println("Usage: java CLHSDB [[pid] | [path-to-java-executable [path-to-corefile]] | help ]"); 4.8 + // With JDK-8059038 launchers for this class exist. Print usage for those launchers. 4.9 + System.out.println("Usage: clhsdb [[pid] | [path-to-java-executable [path-to-corefile]] | help | -help ]"); 4.10 System.out.println(" pid: attach to the process whose id is 'pid'"); 4.11 System.out.println(" path-to-java-executable: Debug a core file produced by this program"); 4.12 System.out.println(" path-to-corefile: Debug this corefile. The default is 'core'");
5.1 --- a/agent/src/share/classes/sun/jvm/hotspot/HSDB.java Wed Jul 03 20:04:13 2019 +0800 5.2 +++ b/agent/src/share/classes/sun/jvm/hotspot/HSDB.java Wed Jul 03 20:42:37 2019 +0800 5.3 @@ -82,7 +82,8 @@ 5.4 private String coreFilename; 5.5 5.6 private void doUsage() { 5.7 - System.out.println("Usage: java HSDB [[pid] | [path-to-java-executable [path-to-corefile]] | help ]"); 5.8 + // With JDK-8059038 launchers for this class exist. Print usage for those launchers. 5.9 + System.out.println("Usage: hsdb [[pid] | [path-to-java-executable [path-to-corefile]] | help | -help ]"); 5.10 System.out.println(" pid: attach to the process whose id is 'pid'"); 5.11 System.out.println(" path-to-java-executable: Debug a core file produced by this program"); 5.12 System.out.println(" path-to-corefile: Debug this corefile. The default is 'core'");
6.1 --- a/agent/src/share/classes/sun/jvm/hotspot/debugger/linux/LinuxCDebugger.java Wed Jul 03 20:04:13 2019 +0800 6.2 +++ b/agent/src/share/classes/sun/jvm/hotspot/debugger/linux/LinuxCDebugger.java Wed Jul 03 20:42:37 2019 +0800 6.3 @@ -57,31 +57,21 @@ 6.4 if (pc == null) { 6.5 return null; 6.6 } 6.7 + 6.8 + /* Typically we have about ten loaded objects here. So no reason to do 6.9 + sort/binary search here. Linear search gives us acceptable performance.*/ 6.10 + 6.11 List objs = getLoadObjectList(); 6.12 - Object[] arr = objs.toArray(); 6.13 - // load objects are sorted by base address, do binary search 6.14 - int mid = -1; 6.15 - int low = 0; 6.16 - int high = arr.length - 1; 6.17 6.18 - while (low <= high) { 6.19 - mid = (low + high) >> 1; 6.20 - LoadObject midVal = (LoadObject) arr[mid]; 6.21 - long cmp = pc.minus(midVal.getBase()); 6.22 - if (cmp < 0) { 6.23 - high = mid - 1; 6.24 - } else if (cmp > 0) { 6.25 - long size = midVal.getSize(); 6.26 - if (cmp >= size) { 6.27 - low = mid + 1; 6.28 - } else { 6.29 - return (LoadObject) arr[mid]; 6.30 - } 6.31 - } else { // match found 6.32 - return (LoadObject) arr[mid]; 6.33 - } 6.34 + for (int i = 0; i < objs.size(); i++) { 6.35 + LoadObject ob = (LoadObject) objs.get(i); 6.36 + Address base = ob.getBase(); 6.37 + long size = ob.getSize(); 6.38 + if ( pc.greaterThanOrEqual(base) && pc.lessThan(base.addOffsetTo(size))) { 6.39 + return ob; 6.40 + } 6.41 } 6.42 - // no match found. 6.43 + 6.44 return null; 6.45 } 6.46
7.1 --- a/agent/src/share/classes/sun/jvm/hotspot/utilities/soql/sa.js Wed Jul 03 20:04:13 2019 +0800 7.2 +++ b/agent/src/share/classes/sun/jvm/hotspot/utilities/soql/sa.js Wed Jul 03 20:42:37 2019 +0800 7.3 @@ -371,19 +371,23 @@ 7.4 return sa.dbg.lookup(dso, sym); 7.5 } 7.6 7.7 +function loadObjectContainingPC(addr) { 7.8 + if (sa.cdbg == null) { 7.9 + // no CDebugger support, return null 7.10 + return null; 7.11 + } 7.12 + 7.13 + return sa.cdbg.loadObjectContainingPC(addr); 7.14 +} 7.15 + 7.16 // returns the ClosestSymbol or null 7.17 function closestSymbolFor(addr) { 7.18 - if (sa.cdbg == null) { 7.19 - // no CDebugger support, return null 7.20 - return null; 7.21 - } else { 7.22 - var dso = sa.cdbg.loadObjectContainingPC(addr); 7.23 - if (dso != null) { 7.24 - return dso.closestSymbolToPC(addr); 7.25 - } else { 7.26 - return null; 7.27 - } 7.28 - } 7.29 + var dso = loadObjectContainingPC(addr); 7.30 + if (dso != null) { 7.31 + return dso.closestSymbolToPC(addr); 7.32 + } 7.33 + 7.34 + return null; 7.35 } 7.36 7.37 // Address-to-symbol 7.38 @@ -884,21 +888,29 @@ 7.39 7.40 // returns description of given pointer as a String 7.41 function whatis(addr) { 7.42 - addr = any2addr(addr); 7.43 - var ptrLoc = findPtr(addr); 7.44 - if (ptrLoc.isUnknown()) { 7.45 - var vmType = vmTypeof(addr); 7.46 - if (vmType != null) { 7.47 - return "pointer to " + vmType.name; 7.48 - } else { 7.49 - var sym = closestSymbolFor(addr); 7.50 - if (sym != null) { 7.51 - return sym.name + '+' + sym.offset; 7.52 - } else { 7.53 - return ptrLoc.toString(); 7.54 - } 7.55 - } 7.56 - } else { 7.57 - return ptrLoc.toString(); 7.58 - } 7.59 + addr = any2addr(addr); 7.60 + var ptrLoc = findPtr(addr); 7.61 + if (!ptrLoc.isUnknown()) { 7.62 + return ptrLoc.toString(); 7.63 + } 7.64 + 7.65 + var vmType = vmTypeof(addr); 7.66 + if (vmType != null) { 7.67 + return "pointer to " + vmType.name; 7.68 + } 7.69 + 7.70 + var dso = loadObjectContainingPC(addr); 7.71 + if (dso == null) { 7.72 + return ptrLoc.toString(); 7.73 + } 7.74 + 7.75 + var sym = dso.closestSymbolToPC(addr); 7.76 + if (sym != null) { 7.77 + return sym.name + '+' + sym.offset; 7.78 + } 7.79 + 7.80 + var s = dso.getName(); 7.81 + var p = s.lastIndexOf("/"); 7.82 + var base = dso.getBase(); 7.83 + return s.substring(p+1, s.length) + '+' + addr.minus(base); 7.84 }
8.1 --- a/make/aix/makefiles/buildtree.make Wed Jul 03 20:04:13 2019 +0800 8.2 +++ b/make/aix/makefiles/buildtree.make Wed Jul 03 20:42:37 2019 +0800 8.3 @@ -1,6 +1,7 @@ 8.4 # 8.5 # Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved. 8.6 # Copyright 2012, 2013 SAP AG. All rights reserved. 8.7 +# Copyright 2019 Red Hat, Inc. 8.8 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 8.9 # 8.10 # This code is free software; you can redistribute it and/or modify it 8.11 @@ -215,6 +216,10 @@ 8.12 echo "SA_BUILD_VERSION = $(HS_BUILD_VER)"; \ 8.13 echo "HOTSPOT_BUILD_USER = $(HOTSPOT_BUILD_USER)"; \ 8.14 echo "HOTSPOT_VM_DISTRO = $(HOTSPOT_VM_DISTRO)"; \ 8.15 + echo "VENDOR = $(COMPANY_NAME)"; \ 8.16 + echo "VENDOR_URL = $(VENDOR_URL)"; \ 8.17 + echo "VENDOR_URL_BUG = $(VENDOR_URL_BUG)"; \ 8.18 + echo "VENDOR_URL_VM_BUG = $(VENDOR_URL_VM_BUG)"; \ 8.19 echo "OPENJDK = $(OPENJDK)"; \ 8.20 echo "$(LP64_SETTING/$(DATA_MODE))"; \ 8.21 echo; \
9.1 --- a/make/aix/makefiles/vm.make Wed Jul 03 20:04:13 2019 +0800 9.2 +++ b/make/aix/makefiles/vm.make Wed Jul 03 20:42:37 2019 +0800 9.3 @@ -1,5 +1,5 @@ 9.4 # 9.5 -# Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved. 9.6 +# Copyright (c) 1999, 2019, Oracle and/or its affiliates. All rights reserved. 9.7 # Copyright 2012, 2013 SAP AG. All rights reserved. 9.8 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 9.9 # 9.10 @@ -101,7 +101,8 @@ 9.11 # This is VERY important! The version define must only be supplied to vm_version.o 9.12 # If not, ccache will not re-use the cache at all, since the version string might contain 9.13 # a time and date. 9.14 -CXXFLAGS/vm_version.o += ${JRE_VERSION} 9.15 +CXXFLAGS/vm_version.o += ${JRE_VERSION} ${VERSION_CFLAGS} 9.16 +CXXFLAGS/arguments.o += ${VERSION_CFLAGS} 9.17 9.18 CXXFLAGS/BYFILE = $(CXXFLAGS/$@) 9.19
10.1 --- a/make/bsd/makefiles/buildtree.make Wed Jul 03 20:04:13 2019 +0800 10.2 +++ b/make/bsd/makefiles/buildtree.make Wed Jul 03 20:42:37 2019 +0800 10.3 @@ -1,5 +1,6 @@ 10.4 # 10.5 # Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved. 10.6 +# Copyright 2019 Red Hat Inc. 10.7 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 10.8 # 10.9 # This code is free software; you can redistribute it and/or modify it 10.10 @@ -221,6 +222,10 @@ 10.11 echo "SA_BUILD_VERSION = $(HS_BUILD_VER)"; \ 10.12 echo "HOTSPOT_BUILD_USER = $(HOTSPOT_BUILD_USER)"; \ 10.13 echo "HOTSPOT_VM_DISTRO = $(HOTSPOT_VM_DISTRO)"; \ 10.14 + echo "VENDOR = $(COMPANY_NAME)"; \ 10.15 + echo "VENDOR_URL = $(VENDOR_URL)"; \ 10.16 + echo "VENDOR_URL_BUG = $(VENDOR_URL_BUG)"; \ 10.17 + echo "VENDOR_URL_VM_BUG = $(VENDOR_URL_VM_BUG)"; \ 10.18 echo "OPENJDK = $(OPENJDK)"; \ 10.19 echo "$(LP64_SETTING/$(DATA_MODE))"; \ 10.20 echo; \
11.1 --- a/make/bsd/makefiles/vm.make Wed Jul 03 20:04:13 2019 +0800 11.2 +++ b/make/bsd/makefiles/vm.make Wed Jul 03 20:42:37 2019 +0800 11.3 @@ -1,5 +1,5 @@ 11.4 # 11.5 -# Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved. 11.6 +# Copyright (c) 1999, 2019, Oracle and/or its affiliates. All rights reserved. 11.7 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 11.8 # 11.9 # This code is free software; you can redistribute it and/or modify it 11.10 @@ -100,7 +100,8 @@ 11.11 # This is VERY important! The version define must only be supplied to vm_version.o 11.12 # If not, ccache will not re-use the cache at all, since the version string might contain 11.13 # a time and date. 11.14 -CXXFLAGS/vm_version.o += ${JRE_VERSION} 11.15 +CXXFLAGS/vm_version.o += ${JRE_VERSION} ${VERSION_CFLAGS} 11.16 +CXXFLAGS/arguments.o += ${VERSION_CFLAGS} 11.17 11.18 CXXFLAGS/BYFILE = $(CXXFLAGS/$@) 11.19
12.1 --- a/make/linux/Makefile Wed Jul 03 20:04:13 2019 +0800 12.2 +++ b/make/linux/Makefile Wed Jul 03 20:42:37 2019 +0800 12.3 @@ -231,20 +231,7 @@ 12.4 @echo " $(TARGETS_SHARK)" 12.5 @echo " $(TARGETS_MINIMAL1)" 12.6 12.7 -checks: check_os_version check_j2se_version 12.8 - 12.9 -# We do not want people accidentally building on old systems (e.g. Linux 2.2.x, 12.10 -# Solaris 2.5.1, 2.6). 12.11 -# Disable this check by setting DISABLE_HOTSPOT_OS_VERSION_CHECK=ok. 12.12 - 12.13 -SUPPORTED_OS_VERSION = 2.4% 2.5% 2.6% 3% 4% 12.14 -OS_VERSION := $(shell uname -r) 12.15 -EMPTY_IF_NOT_SUPPORTED = $(filter $(SUPPORTED_OS_VERSION),$(OS_VERSION)) 12.16 - 12.17 -check_os_version: 12.18 -ifeq ($(DISABLE_HOTSPOT_OS_VERSION_CHECK)$(EMPTY_IF_NOT_SUPPORTED),) 12.19 - $(QUIETLY) >&2 echo "*** This OS is not supported:" `uname -a`; exit 1; 12.20 -endif 12.21 +checks: check_j2se_version 12.22 12.23 # jvmti.make requires XSLT (J2SE 1.4.x or newer): 12.24 XSLT_CHECK = $(REMOTE) $(RUN.JAVAP) javax.xml.transform.TransformerFactory
13.1 --- a/make/linux/makefiles/buildtree.make Wed Jul 03 20:04:13 2019 +0800 13.2 +++ b/make/linux/makefiles/buildtree.make Wed Jul 03 20:42:37 2019 +0800 13.3 @@ -1,5 +1,6 @@ 13.4 # 13.5 # Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved. 13.6 +# Copyright 2019 Red Hat, Inc. 13.7 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 13.8 # 13.9 # This code is free software; you can redistribute it and/or modify it 13.10 @@ -220,6 +221,10 @@ 13.11 echo "SA_BUILD_VERSION = $(HS_BUILD_VER)"; \ 13.12 echo "HOTSPOT_BUILD_USER = $(HOTSPOT_BUILD_USER)"; \ 13.13 echo "HOTSPOT_VM_DISTRO = $(HOTSPOT_VM_DISTRO)"; \ 13.14 + echo "VENDOR = $(COMPANY_NAME)"; \ 13.15 + echo "VENDOR_URL = $(VENDOR_URL)"; \ 13.16 + echo "VENDOR_URL_BUG = $(VENDOR_URL_BUG)"; \ 13.17 + echo "VENDOR_URL_VM_BUG = $(VENDOR_URL_VM_BUG)"; \ 13.18 echo "OPENJDK = $(OPENJDK)"; \ 13.19 echo "$(LP64_SETTING/$(DATA_MODE))"; \ 13.20 echo; \
14.1 --- a/make/linux/makefiles/saproc.make Wed Jul 03 20:04:13 2019 +0800 14.2 +++ b/make/linux/makefiles/saproc.make Wed Jul 03 20:42:37 2019 +0800 14.3 @@ -66,6 +66,11 @@ 14.4 SA_DEBUG_CFLAGS = -g 14.5 endif 14.6 14.7 +# Optimize saproc lib at level -O3 unless it's a slowdebug build 14.8 +ifneq ($(BUILD_FLAVOR), debug) 14.9 + SA_OPT_FLAGS = $(OPT_CFLAGS) 14.10 +endif 14.11 + 14.12 # if $(AGENT_DIR) does not exist, we don't build SA 14.13 # also, we don't build SA on Itanium or zero. 14.14 14.15 @@ -107,6 +112,7 @@ 14.16 $(SASRCFILES) \ 14.17 $(SA_LFLAGS) \ 14.18 $(SA_DEBUG_CFLAGS) \ 14.19 + $(SA_OPT_FLAGS) \ 14.20 $(EXTRA_CFLAGS) \ 14.21 -o $@ \ 14.22 -lthread_db -ldl
15.1 --- a/make/linux/makefiles/vm.make Wed Jul 03 20:04:13 2019 +0800 15.2 +++ b/make/linux/makefiles/vm.make Wed Jul 03 20:42:37 2019 +0800 15.3 @@ -1,5 +1,5 @@ 15.4 # 15.5 -# Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved. 15.6 +# Copyright (c) 1999, 2019, Oracle and/or its affiliates. All rights reserved. 15.7 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 15.8 # 15.9 # This code is free software; you can redistribute it and/or modify it 15.10 @@ -121,7 +121,8 @@ 15.11 LOONGSON_VM_INFO = -DLOONGSON_RUNTIME_NAME="\"\"" 15.12 endif 15.13 CXXFLAGS/vmError.o += ${LOONGSON_VM_INFO} 15.14 -CXXFLAGS/vm_version.o += ${JRE_VERSION} 15.15 +CXXFLAGS/vm_version.o += ${JRE_VERSION} ${VERSION_CFLAGS} 15.16 +CXXFLAGS/arguments.o += ${VERSION_CFLAGS} 15.17 15.18 CXXFLAGS/BYFILE = $(CXXFLAGS/$@) 15.19
16.1 --- a/make/openjdk_distro Wed Jul 03 20:04:13 2019 +0800 16.2 +++ b/make/openjdk_distro Wed Jul 03 20:42:37 2019 +0800 16.3 @@ -1,5 +1,6 @@ 16.4 # 16.5 # Copyright (c) 2007, 2008, Oracle and/or its affiliates. All rights reserved. 16.6 +# Copyright 2019 Red Hat, Inc. 16.7 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 16.8 # 16.9 # This code is free software; you can redistribute it and/or modify it 16.10 @@ -28,5 +29,4 @@ 16.11 16.12 # Don't put quotes (fail windows build). 16.13 HOTSPOT_VM_DISTRO=OpenJDK 16.14 -COMPANY_NAME= 16.15 PRODUCT_NAME=OpenJDK
17.1 --- a/make/solaris/makefiles/buildtree.make Wed Jul 03 20:04:13 2019 +0800 17.2 +++ b/make/solaris/makefiles/buildtree.make Wed Jul 03 20:42:37 2019 +0800 17.3 @@ -1,5 +1,6 @@ 17.4 # 17.5 # Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. 17.6 +# Copyright 2019 Red Hat, Inc. 17.7 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 17.8 # 17.9 # This code is free software; you can redistribute it and/or modify it 17.10 @@ -208,6 +209,10 @@ 17.11 echo "SA_BUILD_VERSION = $(HS_BUILD_VER)"; \ 17.12 echo "HOTSPOT_BUILD_USER = $(HOTSPOT_BUILD_USER)"; \ 17.13 echo "HOTSPOT_VM_DISTRO = $(HOTSPOT_VM_DISTRO)"; \ 17.14 + echo "VENDOR = $(COMPANY_NAME)"; \ 17.15 + echo "VENDOR_URL = $(VENDOR_URL)"; \ 17.16 + echo "VENDOR_URL_BUG = $(VENDOR_URL_BUG)"; \ 17.17 + echo "VENDOR_URL_VM_BUG = $(VENDOR_URL_VM_BUG)"; \ 17.18 echo "OPENJDK = $(OPENJDK)"; \ 17.19 echo "$(LP64_SETTING/$(DATA_MODE))"; \ 17.20 echo; \
18.1 --- a/make/solaris/makefiles/vm.make Wed Jul 03 20:04:13 2019 +0800 18.2 +++ b/make/solaris/makefiles/vm.make Wed Jul 03 20:42:37 2019 +0800 18.3 @@ -1,5 +1,5 @@ 18.4 # 18.5 -# Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved. 18.6 +# Copyright (c) 1998, 2019, Oracle and/or its affiliates. All rights reserved. 18.7 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 18.8 # 18.9 # This code is free software; you can redistribute it and/or modify it 18.10 @@ -88,7 +88,8 @@ 18.11 # This is VERY important! The version define must only be supplied to vm_version.o 18.12 # If not, ccache will not re-use the cache at all, since the version string might contain 18.13 # a time and date. 18.14 -CXXFLAGS/vm_version.o += ${JRE_VERSION} 18.15 +CXXFLAGS/vm_version.o += ${JRE_VERSION} ${VERSION_CFLAGS} 18.16 +CXXFLAGS/arguments.o += ${VERSION_CFLAGS} 18.17 18.18 CXXFLAGS/BYFILE = $(CXXFLAGS/$@) 18.19
19.1 --- a/make/windows/build.make Wed Jul 03 20:04:13 2019 +0800 19.2 +++ b/make/windows/build.make Wed Jul 03 20:42:37 2019 +0800 19.3 @@ -1,5 +1,6 @@ 19.4 # 19.5 # Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved. 19.6 +# Copyright 2019 Red Hat, Inc. 19.7 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 19.8 # 19.9 # This code is free software; you can redistribute it and/or modify it 19.10 @@ -279,6 +280,10 @@ 19.11 @ echo HS_COMPANY=$(COMPANY_NAME) >> $@ 19.12 @ echo HS_FILEDESC=$(HS_FILEDESC) >> $@ 19.13 @ echo HOTSPOT_VM_DISTRO=$(HOTSPOT_VM_DISTRO) >> $@ 19.14 + @ echo VENDOR=$(VENDOR) >> $@ 19.15 + @ echo VENDOR_URL=$(VENDOR_URL) >> $@ 19.16 + @ echo VENDOR_URL_BUG=$(VENDOR_URL_BUG) >> $@ 19.17 + @ echo VENDOR_URL_VM_BUG=$(VENDOR_URL_VM_BUG) >> $@ 19.18 @ if "$(OPENJDK)" NEQ "" echo OPENJDK=$(OPENJDK) >> $@ 19.19 @ echo HS_COPYRIGHT=$(HOTSPOT_VM_COPYRIGHT) >> $@ 19.20 @ echo HS_NAME=$(PRODUCT_NAME) $(JDK_MKTG_VERSION) >> $@
20.1 --- a/make/windows/makefiles/sa.make Wed Jul 03 20:04:13 2019 +0800 20.2 +++ b/make/windows/makefiles/sa.make Wed Jul 03 20:42:37 2019 +0800 20.3 @@ -99,27 +99,38 @@ 20.4 20.5 checkAndBuildSA:: $(SAWINDBG) 20.6 20.7 -# These do not need to be optimized (don't run a lot of code) and it 20.8 -# will be useful to have the assertion checks in place 20.9 +!if "$(BUILD_FLAVOR)" == "debug" 20.10 +SA_EXTRA_CFLAGS = -Od -D "_DEBUG" 20.11 +!if "$(BUILDARCH)" == "i486" 20.12 +SA_EXTRA_CFLAGS = $(SA_EXTRA_CFLAGS) -RTC1 20.13 +!endif 20.14 +!elseif "$(BUILD_FLAVOR)" == "fastdebug" 20.15 +SA_EXTRA_CFLAGS = -O2 -D "_DEBUG" 20.16 +!else 20.17 +SA_EXTRA_CFLAGS = -O2 20.18 +!endif 20.19 20.20 !if "$(BUILDARCH)" == "ia64" 20.21 -SA_CFLAGS = -nologo $(MS_RUNTIME_OPTION) -W3 $(GX_OPTION) -Od -D "WIN32" -D "WIN64" -D "_WINDOWS" -D "_DEBUG" -D "_CONSOLE" -D "_MBCS" -YX -FD -c 20.22 +SA_CFLAGS = -nologo $(MS_RUNTIME_OPTION) -W3 $(GX_OPTION) -D "WIN32" -D "WIN64" -D "_WINDOWS" -D "_CONSOLE" -D "_MBCS" -YX -FD -c 20.23 !elseif "$(BUILDARCH)" == "amd64" 20.24 -SA_CFLAGS = -nologo $(MS_RUNTIME_OPTION) -W3 $(GX_OPTION) -Od -D "WIN32" -D "WIN64" -D "_WINDOWS" -D "_DEBUG" -D "_CONSOLE" -D "_MBCS" -YX -FD -c 20.25 +SA_CFLAGS = -nologo $(MS_RUNTIME_OPTION) -W3 $(GX_OPTION) -D "WIN32" -D "WIN64" -D "_WINDOWS" -D "_CONSOLE" -D "_MBCS" -YX -FD -c 20.26 !if "$(COMPILER_NAME)" == "VS2005" 20.27 # On amd64, VS2005 compiler requires bufferoverflowU.lib on the link command line, 20.28 # otherwise we get missing __security_check_cookie externals at link time. 20.29 SA_LD_FLAGS = bufferoverflowU.lib 20.30 !endif 20.31 !else 20.32 -SA_CFLAGS = -nologo $(MS_RUNTIME_OPTION) -W3 -Gm $(GX_OPTION) -Od -D "WIN32" -D "_WINDOWS" -D "_DEBUG" -D "_CONSOLE" -D "_MBCS" -YX -FD -GZ -c 20.33 +SA_CFLAGS = -nologo $(MS_RUNTIME_OPTION) -W3 -Gm $(GX_OPTION) -D "WIN32" -D "_WINDOWS" -D "_CONSOLE" -D "_MBCS" -YX -FD -c 20.34 !if "$(ENABLE_FULL_DEBUG_SYMBOLS)" == "1" 20.35 -SA_CFLAGS = $(SA_CFLAGS) -ZI 20.36 +# -ZI is incompatible with -O2 used for release/fastdebug builds. 20.37 +# Using -Zi instead. 20.38 +SA_CFLAGS = $(SA_CFLAGS) -Zi 20.39 !endif 20.40 !endif 20.41 !if "$(MT)" != "" 20.42 SA_LD_FLAGS = -manifest $(SA_LD_FLAGS) 20.43 !endif 20.44 +SA_CFLAGS = $(SA_CFLAGS) $(SA_EXTRA_CFLAGS) 20.45 20.46 SASRCFILES = $(AGENT_DIR)/src/os/win32/windbg/sawindbg.cpp \ 20.47 $(AGENT_DIR)/src/share/native/sadis.c
21.1 --- a/make/windows/makefiles/vm.make Wed Jul 03 20:04:13 2019 +0800 21.2 +++ b/make/windows/makefiles/vm.make Wed Jul 03 20:42:37 2019 +0800 21.3 @@ -1,5 +1,6 @@ 21.4 # 21.5 # Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. 21.6 +# Copyright 2019 Red Hat, Inc. 21.7 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 21.8 # 21.9 # This code is free software; you can redistribute it and/or modify it 21.10 @@ -61,6 +62,10 @@ 21.11 CXX_FLAGS=$(CXX_FLAGS) /D "HOTSPOT_BUILD_TARGET=\"$(BUILD_FLAVOR)\"" 21.12 CXX_FLAGS=$(CXX_FLAGS) /D "HOTSPOT_BUILD_USER=\"$(BuildUser)\"" 21.13 CXX_FLAGS=$(CXX_FLAGS) /D "HOTSPOT_VM_DISTRO=\"$(HOTSPOT_VM_DISTRO)\"" 21.14 +CXX_FLAGS=$(CXX_FLAGS) /D "VENDOR=\"$(COMPANY_NAME)\"" 21.15 +CXX_FLAGS=$(CXX_FLAGS) /D "VENDOR_URL=\"$(VENDOR_URL)\"" 21.16 +CXX_FLAGS=$(CXX_FLAGS) /D "VENDOR_URL_BUG=\"$(VENDOR_URL_BUG)\"" 21.17 +CXX_FLAGS=$(CXX_FLAGS) /D "VENDOR_URL_VM_BUG=\"$(VENDOR_URL_VM_BUG)\"" 21.18 21.19 CXX_FLAGS=$(CXX_FLAGS) $(CXX_INCLUDE_DIRS) 21.20
22.1 --- a/src/cpu/ppc/vm/assembler_ppc.hpp Wed Jul 03 20:04:13 2019 +0800 22.2 +++ b/src/cpu/ppc/vm/assembler_ppc.hpp Wed Jul 03 20:42:37 2019 +0800 22.3 @@ -1,6 +1,6 @@ 22.4 /* 22.5 - * Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved. 22.6 - * Copyright 2012, 2013 SAP AG. All rights reserved. 22.7 + * Copyright (c) 2002, 2018, Oracle and/or its affiliates. All rights reserved. 22.8 + * Copyright (c) 2012, 2018, SAP SE. All rights reserved. 22.9 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 22.10 * 22.11 * This code is free software; you can redistribute it and/or modify it 22.12 @@ -1838,7 +1838,7 @@ 22.13 inline void vperm( VectorRegister d, VectorRegister a, VectorRegister b, VectorRegister c); 22.14 inline void vsel( VectorRegister d, VectorRegister a, VectorRegister b, VectorRegister c); 22.15 inline void vsl( VectorRegister d, VectorRegister a, VectorRegister b); 22.16 - inline void vsldoi( VectorRegister d, VectorRegister a, VectorRegister b, int si4); 22.17 + inline void vsldoi( VectorRegister d, VectorRegister a, VectorRegister b, int ui4); 22.18 inline void vslo( VectorRegister d, VectorRegister a, VectorRegister b); 22.19 inline void vsr( VectorRegister d, VectorRegister a, VectorRegister b); 22.20 inline void vsro( VectorRegister d, VectorRegister a, VectorRegister b);
23.1 --- a/src/cpu/ppc/vm/assembler_ppc.inline.hpp Wed Jul 03 20:04:13 2019 +0800 23.2 +++ b/src/cpu/ppc/vm/assembler_ppc.inline.hpp Wed Jul 03 20:42:37 2019 +0800 23.3 @@ -1,6 +1,6 @@ 23.4 /* 23.5 - * Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved. 23.6 - * Copyright 2012, 2014 SAP AG. All rights reserved. 23.7 + * Copyright (c) 2002, 2018, Oracle and/or its affiliates. All rights reserved. 23.8 + * Copyright (c) 2012, 2018, SAP SE. All rights reserved. 23.9 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 23.10 * 23.11 * This code is free software; you can redistribute it and/or modify it 23.12 @@ -657,7 +657,7 @@ 23.13 inline void Assembler::vperm( VectorRegister d, VectorRegister a, VectorRegister b, VectorRegister c){ emit_int32( VPERM_OPCODE | vrt(d) | vra(a) | vrb(b) | vrc(c)); } 23.14 inline void Assembler::vsel( VectorRegister d, VectorRegister a, VectorRegister b, VectorRegister c){ emit_int32( VSEL_OPCODE | vrt(d) | vra(a) | vrb(b) | vrc(c)); } 23.15 inline void Assembler::vsl( VectorRegister d, VectorRegister a, VectorRegister b) { emit_int32( VSL_OPCODE | vrt(d) | vra(a) | vrb(b)); } 23.16 -inline void Assembler::vsldoi( VectorRegister d, VectorRegister a, VectorRegister b, int si4) { emit_int32( VSLDOI_OPCODE| vrt(d) | vra(a) | vrb(b) | vsldoi_shb(simm(si4,4))); } 23.17 +inline void Assembler::vsldoi( VectorRegister d, VectorRegister a, VectorRegister b, int ui4) { emit_int32( VSLDOI_OPCODE| vrt(d) | vra(a) | vrb(b) | vsldoi_shb(uimm(ui4,4))); } 23.18 inline void Assembler::vslo( VectorRegister d, VectorRegister a, VectorRegister b) { emit_int32( VSLO_OPCODE | vrt(d) | vra(a) | vrb(b)); } 23.19 inline void Assembler::vsr( VectorRegister d, VectorRegister a, VectorRegister b) { emit_int32( VSR_OPCODE | vrt(d) | vra(a) | vrb(b)); } 23.20 inline void Assembler::vsro( VectorRegister d, VectorRegister a, VectorRegister b) { emit_int32( VSRO_OPCODE | vrt(d) | vra(a) | vrb(b)); }
24.1 --- a/src/cpu/ppc/vm/macroAssembler_ppc.cpp Wed Jul 03 20:04:13 2019 +0800 24.2 +++ b/src/cpu/ppc/vm/macroAssembler_ppc.cpp Wed Jul 03 20:42:37 2019 +0800 24.3 @@ -1,6 +1,6 @@ 24.4 /* 24.5 - * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved. 24.6 - * Copyright 2012, 2017 SAP AG. All rights reserved. 24.7 + * Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved. 24.8 + * Copyright (c) 2012, 2018, SAP SE. All rights reserved. 24.9 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 24.10 * 24.11 * This code is free software; you can redistribute it and/or modify it 24.12 @@ -3570,12 +3570,12 @@ 24.13 vspltisw(VR0, -1); 24.14 24.15 vsldoi(mask_32bit, zeroes, VR0, 4); 24.16 - vsldoi(mask_64bit, zeroes, VR0, -8); 24.17 + vsldoi(mask_64bit, zeroes, VR0, 8); 24.18 24.19 // Get the initial value into v8 24.20 vxor(VR8, VR8, VR8); 24.21 mtvrd(VR8, crc); 24.22 - vsldoi(VR8, zeroes, VR8, -8); // shift into bottom 32 bits 24.23 + vsldoi(VR8, zeroes, VR8, 8); // shift into bottom 32 bits 24.24 24.25 li (rLoaded, 0); 24.26 24.27 @@ -3924,7 +3924,7 @@ 24.28 addi(barretConstants, barretConstants, 16); 24.29 lvx(const2, barretConstants); 24.30 24.31 - vsldoi(VR1, VR0, VR0, -8); 24.32 + vsldoi(VR1, VR0, VR0, 8); 24.33 vxor(VR0, VR0, VR1); // xor two 64 bit results together 24.34 24.35 // shift left one bit
25.1 --- a/src/cpu/ppc/vm/stubGenerator_ppc.cpp Wed Jul 03 20:04:13 2019 +0800 25.2 +++ b/src/cpu/ppc/vm/stubGenerator_ppc.cpp Wed Jul 03 20:42:37 2019 +0800 25.3 @@ -1,6 +1,6 @@ 25.4 /* 25.5 - * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. 25.6 - * Copyright 2012, 2014 SAP AG. All rights reserved. 25.7 + * Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved. 25.8 + * Copyright (c) 2012, 2018, SAP SE. All rights reserved. 25.9 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 25.10 * 25.11 * This code is free software; you can redistribute it and/or modify it 25.12 @@ -2023,7 +2023,7 @@ 25.13 __ vspltisb (vTmp2, -16); 25.14 __ vrld (keyPerm, keyPerm, vTmp2); 25.15 __ vrld (keyPerm, keyPerm, vTmp2); 25.16 - __ vsldoi (keyPerm, keyPerm, keyPerm, -8); 25.17 + __ vsldoi (keyPerm, keyPerm, keyPerm, 8); 25.18 25.19 // load the 1st round key to vKey1 25.20 __ li (keypos, 0); 25.21 @@ -2223,7 +2223,7 @@ 25.22 __ vspltisb (vTmp2, -16); 25.23 __ vrld (keyPerm, keyPerm, vTmp2); 25.24 __ vrld (keyPerm, keyPerm, vTmp2); 25.25 - __ vsldoi (keyPerm, keyPerm, keyPerm, -8); 25.26 + __ vsldoi (keyPerm, keyPerm, keyPerm, 8); 25.27 25.28 __ cmpwi (CCR0, keylen, 44); 25.29 __ beq (CCR0, L_do44);
26.1 --- a/src/cpu/ppc/vm/templateInterpreter_ppc.hpp Wed Jul 03 20:04:13 2019 +0800 26.2 +++ b/src/cpu/ppc/vm/templateInterpreter_ppc.hpp Wed Jul 03 20:42:37 2019 +0800 26.3 @@ -34,7 +34,7 @@ 26.4 // Run with +PrintInterpreter to get the VM to print out the size. 26.5 // Max size with JVMTI 26.6 26.7 - const static int InterpreterCodeSize = 210*K; 26.8 + const static int InterpreterCodeSize = 220*K; 26.9 26.10 #endif // CPU_PPC_VM_TEMPLATEINTERPRETER_PPC_HPP 26.11
27.1 --- a/src/cpu/sparc/vm/c1_LIRAssembler_sparc.cpp Wed Jul 03 20:04:13 2019 +0800 27.2 +++ b/src/cpu/sparc/vm/c1_LIRAssembler_sparc.cpp Wed Jul 03 20:42:37 2019 +0800 27.3 @@ -579,7 +579,7 @@ 27.4 __ and3(Rscratch, divisor - 1, Rscratch); 27.5 } 27.6 __ add(Rdividend, Rscratch, Rscratch); 27.7 - __ sra(Rscratch, log2_intptr(divisor), Rresult); 27.8 + __ sra(Rscratch, log2_int(divisor), Rresult); 27.9 return; 27.10 } else { 27.11 if (divisor == 2) {
28.1 --- a/src/cpu/sparc/vm/c1_LIRGenerator_sparc.cpp Wed Jul 03 20:04:13 2019 +0800 28.2 +++ b/src/cpu/sparc/vm/c1_LIRGenerator_sparc.cpp Wed Jul 03 20:42:37 2019 +0800 28.3 @@ -294,11 +294,11 @@ 28.4 bool LIRGenerator::strength_reduce_multiply(LIR_Opr left, int c, LIR_Opr result, LIR_Opr tmp) { 28.5 assert(left != result, "should be different registers"); 28.6 if (is_power_of_2(c + 1)) { 28.7 - __ shift_left(left, log2_intptr(c + 1), result); 28.8 + __ shift_left(left, log2_int(c + 1), result); 28.9 __ sub(result, left, result); 28.10 return true; 28.11 } else if (is_power_of_2(c - 1)) { 28.12 - __ shift_left(left, log2_intptr(c - 1), result); 28.13 + __ shift_left(left, log2_int(c - 1), result); 28.14 __ add(result, left, result); 28.15 return true; 28.16 }
29.1 --- a/src/cpu/x86/vm/c1_LIRAssembler_x86.cpp Wed Jul 03 20:04:13 2019 +0800 29.2 +++ b/src/cpu/x86/vm/c1_LIRAssembler_x86.cpp Wed Jul 03 20:42:37 2019 +0800 29.3 @@ -2650,7 +2650,7 @@ 29.4 Register dreg = result->as_register(); 29.5 29.6 if (right->is_constant()) { 29.7 - int divisor = right->as_constant_ptr()->as_jint(); 29.8 + jint divisor = right->as_constant_ptr()->as_jint(); 29.9 assert(divisor > 0 && is_power_of_2(divisor), "must be"); 29.10 if (code == lir_idiv) { 29.11 assert(lreg == rax, "must be rax,"); 29.12 @@ -2662,7 +2662,7 @@ 29.13 __ andl(rdx, divisor - 1); 29.14 __ addl(lreg, rdx); 29.15 } 29.16 - __ sarl(lreg, log2_intptr(divisor)); 29.17 + __ sarl(lreg, log2_jint(divisor)); 29.18 move_regs(lreg, dreg); 29.19 } else if (code == lir_irem) { 29.20 Label done;
30.1 --- a/src/cpu/x86/vm/c1_LIRGenerator_x86.cpp Wed Jul 03 20:04:13 2019 +0800 30.2 +++ b/src/cpu/x86/vm/c1_LIRGenerator_x86.cpp Wed Jul 03 20:42:37 2019 +0800 30.3 @@ -237,12 +237,12 @@ 30.4 if (tmp->is_valid()) { 30.5 if (is_power_of_2(c + 1)) { 30.6 __ move(left, tmp); 30.7 - __ shift_left(left, log2_intptr(c + 1), left); 30.8 + __ shift_left(left, log2_jint(c + 1), left); 30.9 __ sub(left, tmp, result); 30.10 return true; 30.11 } else if (is_power_of_2(c - 1)) { 30.12 __ move(left, tmp); 30.13 - __ shift_left(left, log2_intptr(c - 1), left); 30.14 + __ shift_left(left, log2_jint(c - 1), left); 30.15 __ add(left, tmp, result); 30.16 return true; 30.17 }
31.1 --- a/src/cpu/x86/vm/interp_masm_x86_32.cpp Wed Jul 03 20:04:13 2019 +0800 31.2 +++ b/src/cpu/x86/vm/interp_masm_x86_32.cpp Wed Jul 03 20:42:37 2019 +0800 31.3 @@ -1,5 +1,5 @@ 31.4 /* 31.5 - * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved. 31.6 + * Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved. 31.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 31.8 * 31.9 * This code is free software; you can redistribute it and/or modify it 31.10 @@ -1445,5 +1445,7 @@ 31.11 incrementl(scratch, increment); 31.12 movl(counter_addr, scratch); 31.13 andl(scratch, mask); 31.14 - jcc(cond, *where); 31.15 + if (where != NULL) { 31.16 + jcc(cond, *where); 31.17 + } 31.18 }
32.1 --- a/src/cpu/x86/vm/interp_masm_x86_64.cpp Wed Jul 03 20:04:13 2019 +0800 32.2 +++ b/src/cpu/x86/vm/interp_masm_x86_64.cpp Wed Jul 03 20:42:37 2019 +0800 32.3 @@ -1,5 +1,5 @@ 32.4 /* 32.5 - * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved. 32.6 + * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. 32.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 32.8 * 32.9 * This code is free software; you can redistribute it and/or modify it 32.10 @@ -1505,5 +1505,7 @@ 32.11 incrementl(scratch, increment); 32.12 movl(counter_addr, scratch); 32.13 andl(scratch, mask); 32.14 - jcc(cond, *where); 32.15 + if (where != NULL) { 32.16 + jcc(cond, *where); 32.17 + } 32.18 }
33.1 --- a/src/cpu/x86/vm/templateTable_x86_32.cpp Wed Jul 03 20:04:13 2019 +0800 33.2 +++ b/src/cpu/x86/vm/templateTable_x86_32.cpp Wed Jul 03 20:42:37 2019 +0800 33.3 @@ -1,5 +1,5 @@ 33.4 /* 33.5 - * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved. 33.6 + * Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved. 33.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 33.8 * 33.9 * This code is free software; you can redistribute it and/or modify it 33.10 @@ -1640,15 +1640,16 @@ 33.11 // Increment the MDO backedge counter 33.12 const Address mdo_backedge_counter(rbx, in_bytes(MethodData::backedge_counter_offset()) + 33.13 in_bytes(InvocationCounter::counter_offset())); 33.14 - __ increment_mask_and_jump(mdo_backedge_counter, increment, mask, 33.15 - rax, false, Assembler::zero, &backedge_counter_overflow); 33.16 + __ increment_mask_and_jump(mdo_backedge_counter, increment, mask, rax, false, Assembler::zero, 33.17 + UseOnStackReplacement ? &backedge_counter_overflow : NULL); 33.18 __ jmp(dispatch); 33.19 } 33.20 __ bind(no_mdo); 33.21 // Increment backedge counter in MethodCounters* 33.22 __ movptr(rcx, Address(rcx, Method::method_counters_offset())); 33.23 __ increment_mask_and_jump(Address(rcx, be_offset), increment, mask, 33.24 - rax, false, Assembler::zero, &backedge_counter_overflow); 33.25 + rax, false, Assembler::zero, 33.26 + UseOnStackReplacement ? &backedge_counter_overflow : NULL); 33.27 } else { 33.28 // increment counter 33.29 __ movptr(rcx, Address(rcx, Method::method_counters_offset()));
34.1 --- a/src/cpu/x86/vm/templateTable_x86_64.cpp Wed Jul 03 20:04:13 2019 +0800 34.2 +++ b/src/cpu/x86/vm/templateTable_x86_64.cpp Wed Jul 03 20:42:37 2019 +0800 34.3 @@ -1,5 +1,5 @@ 34.4 /* 34.5 - * Copyright (c) 2003, 2017, Oracle and/or its affiliates. All rights reserved. 34.6 + * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. 34.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 34.8 * 34.9 * This code is free software; you can redistribute it and/or modify it 34.10 @@ -1665,15 +1665,16 @@ 34.11 // Increment the MDO backedge counter 34.12 const Address mdo_backedge_counter(rbx, in_bytes(MethodData::backedge_counter_offset()) + 34.13 in_bytes(InvocationCounter::counter_offset())); 34.14 - __ increment_mask_and_jump(mdo_backedge_counter, increment, mask, 34.15 - rax, false, Assembler::zero, &backedge_counter_overflow); 34.16 + __ increment_mask_and_jump(mdo_backedge_counter, increment, mask, rax, false, Assembler::zero, 34.17 + UseOnStackReplacement ? &backedge_counter_overflow : NULL); 34.18 __ jmp(dispatch); 34.19 } 34.20 __ bind(no_mdo); 34.21 // Increment backedge counter in MethodCounters* 34.22 __ movptr(rcx, Address(rcx, Method::method_counters_offset())); 34.23 __ increment_mask_and_jump(Address(rcx, be_offset), increment, mask, 34.24 - rax, false, Assembler::zero, &backedge_counter_overflow); 34.25 + rax, false, Assembler::zero, 34.26 + UseOnStackReplacement ? &backedge_counter_overflow : NULL); 34.27 } else { 34.28 // increment counter 34.29 __ movptr(rcx, Address(rcx, Method::method_counters_offset()));
35.1 --- a/src/os/aix/vm/os_aix.cpp Wed Jul 03 20:04:13 2019 +0800 35.2 +++ b/src/os/aix/vm/os_aix.cpp Wed Jul 03 20:42:37 2019 +0800 35.3 @@ -1,5 +1,5 @@ 35.4 /* 35.5 - * Copyright (c) 1999, 2018, Oracle and/or its affiliates. All rights reserved. 35.6 + * Copyright (c) 1999, 2019, Oracle and/or its affiliates. All rights reserved. 35.7 * Copyright 2012, 2014 SAP AG. All rights reserved. 35.8 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 35.9 * 35.10 @@ -5142,7 +5142,7 @@ 35.11 // or -1 on failure (e.g. can't fork a new process). 35.12 // Unlike system(), this function can be called from signal handler. It 35.13 // doesn't block SIGINT et al. 35.14 -int os::fork_and_exec(char* cmd) { 35.15 +int os::fork_and_exec(char* cmd, bool use_vfork_if_available) { 35.16 char * argv[4] = {"sh", "-c", cmd, NULL}; 35.17 35.18 pid_t pid = fork();
36.1 --- a/src/os/bsd/vm/os_bsd.cpp Wed Jul 03 20:04:13 2019 +0800 36.2 +++ b/src/os/bsd/vm/os_bsd.cpp Wed Jul 03 20:42:37 2019 +0800 36.3 @@ -1,5 +1,5 @@ 36.4 /* 36.5 - * Copyright (c) 1999, 2018, Oracle and/or its affiliates. All rights reserved. 36.6 + * Copyright (c) 1999, 2019, Oracle and/or its affiliates. All rights reserved. 36.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 36.8 * 36.9 * This code is free software; you can redistribute it and/or modify it 36.10 @@ -4716,7 +4716,7 @@ 36.11 // or -1 on failure (e.g. can't fork a new process). 36.12 // Unlike system(), this function can be called from signal handler. It 36.13 // doesn't block SIGINT et al. 36.14 -int os::fork_and_exec(char* cmd) { 36.15 +int os::fork_and_exec(char* cmd, bool use_vfork_if_available) { 36.16 const char * argv[4] = {"sh", "-c", cmd, NULL}; 36.17 36.18 // fork() in BsdThreads/NPTL is not async-safe. It needs to run
37.1 --- a/src/os/linux/vm/os_linux.cpp Wed Jul 03 20:04:13 2019 +0800 37.2 +++ b/src/os/linux/vm/os_linux.cpp Wed Jul 03 20:42:37 2019 +0800 37.3 @@ -1,5 +1,5 @@ 37.4 /* 37.5 - * Copyright (c) 1999, 2018, Oracle and/or its affiliates. All rights reserved. 37.6 + * Copyright (c) 1999, 2019, Oracle and/or its affiliates. All rights reserved. 37.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 37.8 * 37.9 * This code is free software; you can redistribute it and/or modify it 37.10 @@ -724,6 +724,10 @@ 37.11 } 37.12 } 37.13 37.14 +void os::Linux::expand_stack_to(address bottom) { 37.15 + _expand_stack_to(bottom); 37.16 +} 37.17 + 37.18 bool os::Linux::manually_expand_stack(JavaThread * t, address addr) { 37.19 assert(t!=NULL, "just checking"); 37.20 assert(t->osthread()->expanding_stack(), "expand should be set"); 37.21 @@ -6354,10 +6358,16 @@ 37.22 // or -1 on failure (e.g. can't fork a new process). 37.23 // Unlike system(), this function can be called from signal handler. It 37.24 // doesn't block SIGINT et al. 37.25 -int os::fork_and_exec(char* cmd) { 37.26 +int os::fork_and_exec(char* cmd, bool use_vfork_if_available) { 37.27 const char * argv[4] = {"sh", "-c", cmd, NULL}; 37.28 37.29 - pid_t pid = fork(); 37.30 + pid_t pid ; 37.31 + 37.32 + if (use_vfork_if_available) { 37.33 + pid = vfork(); 37.34 + } else { 37.35 + pid = fork(); 37.36 + } 37.37 37.38 if (pid < 0) { 37.39 // fork failed
38.1 --- a/src/os/linux/vm/os_linux.hpp Wed Jul 03 20:04:13 2019 +0800 38.2 +++ b/src/os/linux/vm/os_linux.hpp Wed Jul 03 20:42:37 2019 +0800 38.3 @@ -249,6 +249,8 @@ 38.4 static int safe_cond_timedwait(pthread_cond_t *_cond, pthread_mutex_t *_mutex, const struct timespec *_abstime); 38.5 38.6 private: 38.7 + static void expand_stack_to(address bottom); 38.8 + 38.9 typedef int (*sched_getcpu_func_t)(void); 38.10 typedef int (*numa_node_to_cpus_func_t)(int node, unsigned long *buffer, int bufferlen); 38.11 typedef int (*numa_max_node_func_t)(void);
39.1 --- a/src/os/posix/vm/os_posix.cpp Wed Jul 03 20:04:13 2019 +0800 39.2 +++ b/src/os/posix/vm/os_posix.cpp Wed Jul 03 20:42:37 2019 +0800 39.3 @@ -604,7 +604,11 @@ 39.4 strncpy(buffer, "none", size); 39.5 39.6 const struct { 39.7 - int i; 39.8 + // NB: i is an unsigned int here because SA_RESETHAND is on some 39.9 + // systems 0x80000000, which is implicitly unsigned. Assignining 39.10 + // it to an int field would be an overflow in unsigned-to-signed 39.11 + // conversion. 39.12 + unsigned int i; 39.13 const char* s; 39.14 } flaginfo [] = { 39.15 { SA_NOCLDSTOP, "SA_NOCLDSTOP" },
40.1 --- a/src/os/solaris/vm/os_solaris.cpp Wed Jul 03 20:04:13 2019 +0800 40.2 +++ b/src/os/solaris/vm/os_solaris.cpp Wed Jul 03 20:42:37 2019 +0800 40.3 @@ -1,5 +1,5 @@ 40.4 /* 40.5 - * Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved. 40.6 + * Copyright (c) 1997, 2019, Oracle and/or its affiliates. All rights reserved. 40.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 40.8 * 40.9 * This code is free software; you can redistribute it and/or modify it 40.10 @@ -6153,7 +6153,7 @@ 40.11 // or -1 on failure (e.g. can't fork a new process). 40.12 // Unlike system(), this function can be called from signal handler. It 40.13 // doesn't block SIGINT et al. 40.14 -int os::fork_and_exec(char* cmd) { 40.15 +int os::fork_and_exec(char* cmd, bool use_vfork_if_available) { 40.16 char * argv[4]; 40.17 argv[0] = (char *)"sh"; 40.18 argv[1] = (char *)"-c";
41.1 --- a/src/os/windows/vm/os_windows.cpp Wed Jul 03 20:04:13 2019 +0800 41.2 +++ b/src/os/windows/vm/os_windows.cpp Wed Jul 03 20:42:37 2019 +0800 41.3 @@ -1,5 +1,5 @@ 41.4 /* 41.5 - * Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved. 41.6 + * Copyright (c) 1997, 2019, Oracle and/or its affiliates. All rights reserved. 41.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 41.8 * 41.9 * This code is free software; you can redistribute it and/or modify it 41.10 @@ -1757,7 +1757,13 @@ 41.11 if (is_workstation) { 41.12 st->print("10"); 41.13 } else { 41.14 - st->print("Server 2016"); 41.15 + // distinguish Windows Server 2016 and 2019 by build number 41.16 + // Windows server 2019 GA 10/2018 build number is 17763 41.17 + if (build_number > 17762) { 41.18 + st->print("Server 2019"); 41.19 + } else { 41.20 + st->print("Server 2016"); 41.21 + } 41.22 } 41.23 break; 41.24 41.25 @@ -5034,7 +5040,7 @@ 41.26 41.27 // Run the specified command in a separate process. Return its exit value, 41.28 // or -1 on failure (e.g. can't create a new process). 41.29 -int os::fork_and_exec(char* cmd) { 41.30 +int os::fork_and_exec(char* cmd, bool use_vfork_if_available) { 41.31 STARTUPINFO si; 41.32 PROCESS_INFORMATION pi; 41.33
42.1 --- a/src/os_cpu/linux_x86/vm/os_linux_x86.cpp Wed Jul 03 20:04:13 2019 +0800 42.2 +++ b/src/os_cpu/linux_x86/vm/os_linux_x86.cpp Wed Jul 03 20:42:37 2019 +0800 42.3 @@ -892,6 +892,27 @@ 42.4 void os::workaround_expand_exec_shield_cs_limit() { 42.5 #if defined(IA32) 42.6 size_t page_size = os::vm_page_size(); 42.7 + 42.8 + /* 42.9 + * JDK-8197429 42.10 + * 42.11 + * Expand the stack mapping to the end of the initial stack before 42.12 + * attempting to install the codebuf. This is needed because newer 42.13 + * Linux kernels impose a distance of a megabyte between stack 42.14 + * memory and other memory regions. If we try to install the 42.15 + * codebuf before expanding the stack the installation will appear 42.16 + * to succeed but we'll get a segfault later if we expand the stack 42.17 + * in Java code. 42.18 + * 42.19 + */ 42.20 + if (os::is_primordial_thread()) { 42.21 + address limit = Linux::initial_thread_stack_bottom(); 42.22 + if (! DisablePrimordialThreadGuardPages) { 42.23 + limit += (StackYellowPages + StackRedPages) * page_size; 42.24 + } 42.25 + os::Linux::expand_stack_to(limit); 42.26 + } 42.27 + 42.28 /* 42.29 * Take the highest VA the OS will give us and exec 42.30 * 42.31 @@ -910,6 +931,16 @@ 42.32 char* hint = (char*) (Linux::initial_thread_stack_bottom() - 42.33 ((StackYellowPages + StackRedPages + 1) * page_size)); 42.34 char* codebuf = os::attempt_reserve_memory_at(page_size, hint); 42.35 + 42.36 + if (codebuf == NULL) { 42.37 + // JDK-8197429: There may be a stack gap of one megabyte between 42.38 + // the limit of the stack and the nearest memory region: this is a 42.39 + // Linux kernel workaround for CVE-2017-1000364. If we failed to 42.40 + // map our codebuf, try again at an address one megabyte lower. 42.41 + hint -= 1 * M; 42.42 + codebuf = os::attempt_reserve_memory_at(page_size, hint); 42.43 + } 42.44 + 42.45 if ( (codebuf == NULL) || (!os::commit_memory(codebuf, page_size, true)) ) { 42.46 return; // No matter, we tried, best effort. 42.47 }
43.1 --- a/src/share/vm/adlc/adlparse.cpp Wed Jul 03 20:04:13 2019 +0800 43.2 +++ b/src/share/vm/adlc/adlparse.cpp Wed Jul 03 20:42:37 2019 +0800 43.3 @@ -2868,7 +2868,8 @@ 43.4 const char* param = NULL; 43.5 inst._parameters.reset(); 43.6 while ((param = inst._parameters.iter()) != NULL) { 43.7 - OperandForm* opForm = (OperandForm*) inst._localNames[param]; 43.8 + OpClassForm* opForm = inst._localNames[param]->is_opclass(); 43.9 + assert(opForm != NULL, "sanity"); 43.10 encoding->add_parameter(opForm->_ident, param); 43.11 } 43.12 43.13 @@ -3338,7 +3339,8 @@ 43.14 const char* param = NULL; 43.15 inst._parameters.reset(); 43.16 while ((param = inst._parameters.iter()) != NULL) { 43.17 - OperandForm* opForm = (OperandForm*) inst._localNames[param]; 43.18 + OpClassForm* opForm = inst._localNames[param]->is_opclass(); 43.19 + assert(opForm != NULL, "sanity"); 43.20 encoding->add_parameter(opForm->_ident, param); 43.21 } 43.22
44.1 --- a/src/share/vm/adlc/dfa.cpp Wed Jul 03 20:04:13 2019 +0800 44.2 +++ b/src/share/vm/adlc/dfa.cpp Wed Jul 03 20:42:37 2019 +0800 44.3 @@ -757,19 +757,27 @@ 44.4 } 44.5 44.6 int Expr::compute_min(const Expr *c1, const Expr *c2) { 44.7 - int result = c1->_min_value + c2->_min_value; 44.8 - assert( result >= 0, "Invalid cost computation"); 44.9 + int v1 = c1->_min_value; 44.10 + int v2 = c2->_min_value; 44.11 + assert(0 <= v2 && v2 <= Expr::Max, "sanity"); 44.12 + assert(v1 <= Expr::Max - v2, "Invalid cost computation"); 44.13 44.14 - return result; 44.15 + return v1 + v2; 44.16 } 44.17 44.18 + 44.19 int Expr::compute_max(const Expr *c1, const Expr *c2) { 44.20 - int result = c1->_max_value + c2->_max_value; 44.21 - if( result < 0 ) { // check for overflow 44.22 - result = Expr::Max; 44.23 + int v1 = c1->_max_value; 44.24 + int v2 = c2->_max_value; 44.25 + 44.26 + // Check for overflow without producing UB. If v2 is positive 44.27 + // and not larger than Max, the subtraction cannot underflow. 44.28 + assert(0 <= v2 && v2 <= Expr::Max, "sanity"); 44.29 + if (v1 > Expr::Max - v2) { 44.30 + return Expr::Max; 44.31 } 44.32 44.33 - return result; 44.34 + return v1 + v2; 44.35 } 44.36 44.37 void Expr::print() const {
45.1 --- a/src/share/vm/adlc/formssel.cpp Wed Jul 03 20:04:13 2019 +0800 45.2 +++ b/src/share/vm/adlc/formssel.cpp Wed Jul 03 20:42:37 2019 +0800 45.3 @@ -921,7 +921,8 @@ 45.4 const char *name; 45.5 const char *kill_name = NULL; 45.6 for (_parameters.reset(); (name = _parameters.iter()) != NULL;) { 45.7 - OperandForm *opForm = (OperandForm*)_localNames[name]; 45.8 + OpClassForm *opForm = _localNames[name]->is_opclass(); 45.9 + assert(opForm != NULL, "sanity"); 45.10 45.11 Effect* e = NULL; 45.12 { 45.13 @@ -938,7 +939,8 @@ 45.14 // complex so simply enforce the restriction during parse. 45.15 if (kill_name != NULL && 45.16 e->isa(Component::TEMP) && !e->isa(Component::DEF)) { 45.17 - OperandForm* kill = (OperandForm*)_localNames[kill_name]; 45.18 + OpClassForm* kill = _localNames[kill_name]->is_opclass(); 45.19 + assert(kill != NULL, "sanity"); 45.20 globalAD->syntax_err(_linenum, "%s: %s %s must be at the end of the argument list\n", 45.21 _ident, kill->_ident, kill_name); 45.22 } else if (e->isa(Component::KILL) && !e->isa(Component::USE)) { 45.23 @@ -2339,7 +2341,8 @@ 45.24 // Add parameters that "do not appear in match rule". 45.25 const char *name; 45.26 for (_parameters.reset(); (name = _parameters.iter()) != NULL;) { 45.27 - OperandForm *opForm = (OperandForm*)_localNames[name]; 45.28 + OpClassForm *opForm = _localNames[name]->is_opclass(); 45.29 + assert(opForm != NULL, "sanity"); 45.30 45.31 if ( _components.operand_position(name) == -1 ) { 45.32 _components.insert(name, opForm->_ident, Component::INVALID, false);
46.1 --- a/src/share/vm/asm/assembler.hpp Wed Jul 03 20:04:13 2019 +0800 46.2 +++ b/src/share/vm/asm/assembler.hpp Wed Jul 03 20:42:37 2019 +0800 46.3 @@ -1,5 +1,5 @@ 46.4 /* 46.5 - * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. 46.6 + * Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved. 46.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 46.8 * 46.9 * This code is free software; you can redistribute it and/or modify it 46.10 @@ -179,6 +179,14 @@ 46.11 Label() { 46.12 init(); 46.13 } 46.14 + 46.15 + ~Label() { 46.16 + assert(is_bound() || is_unused(), "Label was never bound to a location, but it was used as a jmp target"); 46.17 + } 46.18 + 46.19 + void reset() { 46.20 + init(); //leave _patch_overflow because it points to CodeBuffer. 46.21 + } 46.22 }; 46.23 46.24 // A union type for code which has to assemble both constant and
47.1 --- a/src/share/vm/c1/c1_LIRAssembler.cpp Wed Jul 03 20:04:13 2019 +0800 47.2 +++ b/src/share/vm/c1/c1_LIRAssembler.cpp Wed Jul 03 20:42:37 2019 +0800 47.3 @@ -1,5 +1,5 @@ 47.4 /* 47.5 - * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. 47.6 + * Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved. 47.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 47.8 * 47.9 * This code is free software; you can redistribute it and/or modify it 47.10 @@ -138,6 +138,9 @@ 47.11 47.12 47.13 LIR_Assembler::~LIR_Assembler() { 47.14 + // The unwind handler label may be unbound if this destructor is invoked because of a bail-out. 47.15 + // Reset it here to avoid an assertion. 47.16 + _unwind_handler_entry.reset(); 47.17 } 47.18 47.19
48.1 --- a/src/share/vm/c1/c1_LIRGenerator.cpp Wed Jul 03 20:04:13 2019 +0800 48.2 +++ b/src/share/vm/c1/c1_LIRGenerator.cpp Wed Jul 03 20:42:37 2019 +0800 48.3 @@ -2491,6 +2491,10 @@ 48.4 48.5 // We can have generate one runtime check here. Let's start with 48.6 // the offset check. 48.7 + // Allocate temp register to src and load it here, otherwise 48.8 + // control flow below may confuse register allocator. 48.9 + LIR_Opr src_reg = new_register(T_OBJECT); 48.10 + __ move(src.result(), src_reg); 48.11 if (gen_offset_check) { 48.12 // if (offset != referent_offset) -> continue 48.13 // If offset is an int then we can do the comparison with the 48.14 @@ -2518,17 +2522,17 @@ 48.15 // offset is a const and equals referent offset 48.16 // if (source == null) -> continue 48.17 #ifndef MIPS 48.18 - __ cmp(lir_cond_equal, src.result(), LIR_OprFact::oopConst(NULL)); 48.19 + __ cmp(lir_cond_equal, src_reg, LIR_OprFact::oopConst(NULL)); 48.20 __ branch(lir_cond_equal, T_OBJECT, Lcont->label()); 48.21 #else 48.22 - __ branch(lir_cond_equal, src.result(), LIR_OprFact::oopConst(NULL), Lcont->label()); 48.23 + __ branch(lir_cond_equal, src_reg, LIR_OprFact::oopConst(NULL), Lcont->label()); 48.24 #endif 48.25 } 48.26 LIR_Opr src_klass = new_register(T_OBJECT); 48.27 if (gen_type_check) { 48.28 // We have determined that offset == referent_offset && src != null. 48.29 // if (src->_klass->_reference_type == REF_NONE) -> continue 48.30 - __ move(new LIR_Address(src.result(), oopDesc::klass_offset_in_bytes(), T_ADDRESS), src_klass); 48.31 + __ move(new LIR_Address(src_reg, oopDesc::klass_offset_in_bytes(), T_ADDRESS), src_klass); 48.32 LIR_Address* reference_type_addr = new LIR_Address(src_klass, in_bytes(InstanceKlass::reference_type_offset()), T_BYTE); 48.33 LIR_Opr reference_type = new_register(T_INT); 48.34 __ move(reference_type_addr, reference_type);
49.1 --- a/src/share/vm/code/dependencies.cpp Wed Jul 03 20:04:13 2019 +0800 49.2 +++ b/src/share/vm/code/dependencies.cpp Wed Jul 03 20:42:37 2019 +0800 49.3 @@ -525,7 +525,7 @@ 49.4 xtty->object("x", arg.metadata_value()); 49.5 } 49.6 } else { 49.7 - char xn[10]; sprintf(xn, "x%d", j); 49.8 + char xn[12]; sprintf(xn, "x%d", j); 49.9 if (arg.is_oop()) { 49.10 xtty->object(xn, arg.oop_value()); 49.11 } else {
50.1 --- a/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp Wed Jul 03 20:04:13 2019 +0800 50.2 +++ b/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp Wed Jul 03 20:42:37 2019 +0800 50.3 @@ -1,5 +1,5 @@ 50.4 /* 50.5 - * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved. 50.6 + * Copyright (c) 2001, 2019, Oracle and/or its affiliates. All rights reserved. 50.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 50.8 * 50.9 * This code is free software; you can redistribute it and/or modify it 50.10 @@ -9541,6 +9541,7 @@ 50.11 case CMSCollector::InitialMarking: 50.12 initialize(true /* fullGC */ , 50.13 cause /* cause of the GC */, 50.14 + true /* allMemoryPoolsAffected */, 50.15 true /* recordGCBeginTime */, 50.16 true /* recordPreGCUsage */, 50.17 false /* recordPeakUsage */, 50.18 @@ -9553,6 +9554,7 @@ 50.19 case CMSCollector::FinalMarking: 50.20 initialize(true /* fullGC */ , 50.21 cause /* cause of the GC */, 50.22 + true /* allMemoryPoolsAffected */, 50.23 false /* recordGCBeginTime */, 50.24 false /* recordPreGCUsage */, 50.25 false /* recordPeakUsage */, 50.26 @@ -9565,6 +9567,7 @@ 50.27 case CMSCollector::Sweeping: 50.28 initialize(true /* fullGC */ , 50.29 cause /* cause of the GC */, 50.30 + true /* allMemoryPoolsAffected */, 50.31 false /* recordGCBeginTime */, 50.32 false /* recordPreGCUsage */, 50.33 true /* recordPeakUsage */,
51.1 --- a/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp Wed Jul 03 20:04:13 2019 +0800 51.2 +++ b/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp Wed Jul 03 20:42:37 2019 +0800 51.3 @@ -1,5 +1,5 @@ 51.4 /* 51.5 - * Copyright (c) 2001, 2015, Oracle and/or its affiliates. All rights reserved. 51.6 + * Copyright (c) 2001, 2019, Oracle and/or its affiliates. All rights reserved. 51.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 51.8 * 51.9 * This code is free software; you can redistribute it and/or modify it 51.10 @@ -4008,7 +4008,8 @@ 51.11 log_gc_header(); 51.12 51.13 TraceCollectorStats tcs(g1mm()->incremental_collection_counters()); 51.14 - TraceMemoryManagerStats tms(false /* fullGC */, gc_cause()); 51.15 + TraceMemoryManagerStats tms(false /* fullGC */, gc_cause(), 51.16 + yc_type() == Mixed /* allMemoryPoolsAffected */); 51.17 51.18 // If the secondary_free_list is not empty, append it to the 51.19 // free_list. No need to wait for the cleanup operation to finish;
52.1 --- a/src/share/vm/memory/metaspace.cpp Wed Jul 03 20:04:13 2019 +0800 52.2 +++ b/src/share/vm/memory/metaspace.cpp Wed Jul 03 20:42:37 2019 +0800 52.3 @@ -1,5 +1,5 @@ 52.4 /* 52.5 - * Copyright (c) 2011, 2018, Oracle and/or its affiliates. All rights reserved. 52.6 + * Copyright (c) 2011, 2019, Oracle and/or its affiliates. All rights reserved. 52.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 52.8 * 52.9 * This code is free software; you can redistribute it and/or modify it 52.10 @@ -1422,7 +1422,15 @@ 52.11 return value; 52.12 } 52.13 52.14 -bool MetaspaceGC::inc_capacity_until_GC(size_t v, size_t* new_cap_until_GC, size_t* old_cap_until_GC) { 52.15 +// Try to increase the _capacity_until_GC limit counter by v bytes. 52.16 +// Returns true if it succeeded. It may fail if either another thread 52.17 +// concurrently increased the limit or the new limit would be larger 52.18 +// than MaxMetaspaceSize. 52.19 +// On success, optionally returns new and old metaspace capacity in 52.20 +// new_cap_until_GC and old_cap_until_GC respectively. 52.21 +// On error, optionally sets can_retry to indicate whether if there is 52.22 +// actually enough space remaining to satisfy the request. 52.23 +bool MetaspaceGC::inc_capacity_until_GC(size_t v, size_t* new_cap_until_GC, size_t* old_cap_until_GC, bool* can_retry) { 52.24 assert_is_size_aligned(v, Metaspace::commit_alignment()); 52.25 52.26 size_t capacity_until_GC = (size_t) _capacity_until_GC; 52.27 @@ -1433,6 +1441,17 @@ 52.28 new_value = align_size_down(max_uintx, Metaspace::commit_alignment()); 52.29 } 52.30 52.31 + if (new_value > MaxMetaspaceSize) { 52.32 + if (can_retry != NULL) { 52.33 + *can_retry = false; 52.34 + } 52.35 + return false; 52.36 + } 52.37 + 52.38 + if (can_retry != NULL) { 52.39 + *can_retry = true; 52.40 + } 52.41 + 52.42 intptr_t expected = (intptr_t) capacity_until_GC; 52.43 intptr_t actual = Atomic::cmpxchg_ptr((intptr_t) new_value, &_capacity_until_GC, expected); 52.44 52.45 @@ -1520,7 +1539,7 @@ 52.46 52.47 const double min_tmp = used_after_gc / maximum_used_percentage; 52.48 size_t minimum_desired_capacity = 52.49 - (size_t)MIN2(min_tmp, double(max_uintx)); 52.50 + (size_t)MIN2(min_tmp, double(MaxMetaspaceSize)); 52.51 // Don't shrink less than the initial generation size 52.52 minimum_desired_capacity = MAX2(minimum_desired_capacity, 52.53 MetaspaceSize); 52.54 @@ -1579,7 +1598,7 @@ 52.55 const double maximum_free_percentage = MaxMetaspaceFreeRatio / 100.0; 52.56 const double minimum_used_percentage = 1.0 - maximum_free_percentage; 52.57 const double max_tmp = used_after_gc / minimum_used_percentage; 52.58 - size_t maximum_desired_capacity = (size_t)MIN2(max_tmp, double(max_uintx)); 52.59 + size_t maximum_desired_capacity = (size_t)MIN2(max_tmp, double(MaxMetaspaceSize)); 52.60 maximum_desired_capacity = MAX2(maximum_desired_capacity, 52.61 MetaspaceSize); 52.62 if (PrintGCDetails && Verbose) { 52.63 @@ -3451,6 +3470,7 @@ 52.64 52.65 size_t before = 0; 52.66 size_t after = 0; 52.67 + bool can_retry = true; 52.68 MetaWord* res; 52.69 bool incremented; 52.70 52.71 @@ -3458,9 +3478,9 @@ 52.72 // the HWM, an allocation is still attempted. This is because another thread must then 52.73 // have incremented the HWM and therefore the allocation might still succeed. 52.74 do { 52.75 - incremented = MetaspaceGC::inc_capacity_until_GC(delta_bytes, &after, &before); 52.76 + incremented = MetaspaceGC::inc_capacity_until_GC(delta_bytes, &after, &before, &can_retry); 52.77 res = allocate(word_size, mdtype); 52.78 - } while (!incremented && res == NULL); 52.79 + } while (!incremented && res == NULL && can_retry); 52.80 52.81 if (incremented) { 52.82 tracer()->report_gc_threshold(before, after,
53.1 --- a/src/share/vm/memory/metaspace.hpp Wed Jul 03 20:04:13 2019 +0800 53.2 +++ b/src/share/vm/memory/metaspace.hpp Wed Jul 03 20:42:37 2019 +0800 53.3 @@ -1,5 +1,5 @@ 53.4 /* 53.5 - * Copyright (c) 2011, 2018, Oracle and/or its affiliates. All rights reserved. 53.6 + * Copyright (c) 2011, 2019, Oracle and/or its affiliates. All rights reserved. 53.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 53.8 * 53.9 * This code is free software; you can redistribute it and/or modify it 53.10 @@ -259,7 +259,7 @@ 53.11 // Debugging support 53.12 void verify(); 53.13 53.14 - static void print_compressed_class_space(outputStream* st, const char* requested_addr = 0); 53.15 + static void print_compressed_class_space(outputStream* st, const char* requested_addr = 0) NOT_LP64({}); 53.16 53.17 class AllocRecordClosure : public StackObj { 53.18 public: 53.19 @@ -416,7 +416,8 @@ 53.20 static size_t capacity_until_GC(); 53.21 static bool inc_capacity_until_GC(size_t v, 53.22 size_t* new_cap_until_GC = NULL, 53.23 - size_t* old_cap_until_GC = NULL); 53.24 + size_t* old_cap_until_GC = NULL, 53.25 + bool* can_retry = NULL); 53.26 static size_t dec_capacity_until_GC(size_t v); 53.27 53.28 static bool should_concurrent_collect() { return _should_concurrent_collect; }
54.1 --- a/src/share/vm/opto/addnode.cpp Wed Jul 03 20:04:13 2019 +0800 54.2 +++ b/src/share/vm/opto/addnode.cpp Wed Jul 03 20:42:37 2019 +0800 54.3 @@ -344,8 +344,8 @@ 54.4 const Type *AddINode::add_ring( const Type *t0, const Type *t1 ) const { 54.5 const TypeInt *r0 = t0->is_int(); // Handy access 54.6 const TypeInt *r1 = t1->is_int(); 54.7 - int lo = r0->_lo + r1->_lo; 54.8 - int hi = r0->_hi + r1->_hi; 54.9 + int lo = java_add(r0->_lo, r1->_lo); 54.10 + int hi = java_add(r0->_hi, r1->_hi); 54.11 if( !(r0->is_con() && r1->is_con()) ) { 54.12 // Not both constants, compute approximate result 54.13 if( (r0->_lo & r1->_lo) < 0 && lo >= 0 ) { 54.14 @@ -462,8 +462,8 @@ 54.15 const Type *AddLNode::add_ring( const Type *t0, const Type *t1 ) const { 54.16 const TypeLong *r0 = t0->is_long(); // Handy access 54.17 const TypeLong *r1 = t1->is_long(); 54.18 - jlong lo = r0->_lo + r1->_lo; 54.19 - jlong hi = r0->_hi + r1->_hi; 54.20 + jlong lo = java_add(r0->_lo, r1->_lo); 54.21 + jlong hi = java_add(r0->_hi, r1->_hi); 54.22 if( !(r0->is_con() && r1->is_con()) ) { 54.23 // Not both constants, compute approximate result 54.24 if( (r0->_lo & r1->_lo) < 0 && lo >= 0 ) {
55.1 --- a/src/share/vm/opto/divnode.cpp Wed Jul 03 20:04:13 2019 +0800 55.2 +++ b/src/share/vm/opto/divnode.cpp Wed Jul 03 20:42:37 2019 +0800 55.3 @@ -131,7 +131,7 @@ 55.4 } 55.5 55.6 // Add rounding to the shift to handle the sign bit 55.7 - int l = log2_intptr(d-1)+1; 55.8 + int l = log2_jint(d-1)+1; 55.9 if (needs_rounding) { 55.10 // Divide-by-power-of-2 can be made into a shift, but you have to do 55.11 // more math for the rounding. You need to add 0 for positive
56.1 --- a/src/share/vm/opto/loopTransform.cpp Wed Jul 03 20:04:13 2019 +0800 56.2 +++ b/src/share/vm/opto/loopTransform.cpp Wed Jul 03 20:42:37 2019 +0800 56.3 @@ -1310,8 +1310,8 @@ 56.4 limit = new (C) Opaque2Node( C, limit ); 56.5 register_new_node( limit, opaq_ctrl ); 56.6 } 56.7 - if (stride_con > 0 && ((limit_type->_lo - stride_con) < limit_type->_lo) || 56.8 - stride_con < 0 && ((limit_type->_hi - stride_con) > limit_type->_hi)) { 56.9 + if (stride_con > 0 && (java_subtract(limit_type->_lo, stride_con) < limit_type->_lo) || 56.10 + stride_con < 0 && (java_subtract(limit_type->_hi, stride_con) > limit_type->_hi)) { 56.11 // No underflow. 56.12 new_limit = new (C) SubINode(limit, stride); 56.13 } else {
57.1 --- a/src/share/vm/opto/mulnode.cpp Wed Jul 03 20:04:13 2019 +0800 57.2 +++ b/src/share/vm/opto/mulnode.cpp Wed Jul 03 20:42:37 2019 +0800 57.3 @@ -169,7 +169,6 @@ 57.4 return mul_ring(t1,t2); // Local flavor of type multiplication 57.5 } 57.6 57.7 - 57.8 //============================================================================= 57.9 //------------------------------Ideal------------------------------------------ 57.10 // Check for power-of-2 multiply, then try the regular MulNode::Ideal 57.11 @@ -184,42 +183,43 @@ 57.12 } 57.13 57.14 // Now we have a constant Node on the right and the constant in con 57.15 - if( con == 0 ) return NULL; // By zero is handled by Value call 57.16 - if( con == 1 ) return NULL; // By one is handled by Identity call 57.17 + if (con == 0) return NULL; // By zero is handled by Value call 57.18 + if (con == 1) return NULL; // By one is handled by Identity call 57.19 57.20 // Check for negative constant; if so negate the final result 57.21 bool sign_flip = false; 57.22 - if( con < 0 ) { 57.23 - con = -con; 57.24 + 57.25 + unsigned int abs_con = uabs(con); 57.26 + if (abs_con != (unsigned int)con) { 57.27 sign_flip = true; 57.28 } 57.29 57.30 // Get low bit; check for being the only bit 57.31 Node *res = NULL; 57.32 - jint bit1 = con & -con; // Extract low bit 57.33 - if( bit1 == con ) { // Found a power of 2? 57.34 - res = new (phase->C) LShiftINode( in(1), phase->intcon(log2_intptr(bit1)) ); 57.35 + unsigned int bit1 = abs_con & (0-abs_con); // Extract low bit 57.36 + if (bit1 == abs_con) { // Found a power of 2? 57.37 + res = new (phase->C) LShiftINode(in(1), phase->intcon(log2_uint(bit1))); 57.38 } else { 57.39 57.40 // Check for constant with 2 bits set 57.41 - jint bit2 = con-bit1; 57.42 - bit2 = bit2 & -bit2; // Extract 2nd bit 57.43 - if( bit2 + bit1 == con ) { // Found all bits in con? 57.44 - Node *n1 = phase->transform( new (phase->C) LShiftINode( in(1), phase->intcon(log2_intptr(bit1)) ) ); 57.45 - Node *n2 = phase->transform( new (phase->C) LShiftINode( in(1), phase->intcon(log2_intptr(bit2)) ) ); 57.46 - res = new (phase->C) AddINode( n2, n1 ); 57.47 + unsigned int bit2 = abs_con-bit1; 57.48 + bit2 = bit2 & (0-bit2); // Extract 2nd bit 57.49 + if (bit2 + bit1 == abs_con) { // Found all bits in con? 57.50 + Node *n1 = phase->transform( new (phase->C) LShiftINode(in(1), phase->intcon(log2_uint(bit1)))); 57.51 + Node *n2 = phase->transform( new (phase->C) LShiftINode(in(1), phase->intcon(log2_uint(bit2)))); 57.52 + res = new (phase->C) AddINode(n2, n1); 57.53 57.54 - } else if (is_power_of_2(con+1)) { 57.55 + } else if (is_power_of_2(abs_con+1)) { 57.56 // Sleezy: power-of-2 -1. Next time be generic. 57.57 - jint temp = (jint) (con + 1); 57.58 - Node *n1 = phase->transform( new (phase->C) LShiftINode( in(1), phase->intcon(log2_intptr(temp)) ) ); 57.59 - res = new (phase->C) SubINode( n1, in(1) ); 57.60 + unsigned int temp = abs_con + 1; 57.61 + Node *n1 = phase->transform(new (phase->C) LShiftINode(in(1), phase->intcon(log2_uint(temp)))); 57.62 + res = new (phase->C) SubINode(n1, in(1)); 57.63 } else { 57.64 return MulNode::Ideal(phase, can_reshape); 57.65 } 57.66 } 57.67 57.68 - if( sign_flip ) { // Need to negate result? 57.69 + if (sign_flip) { // Need to negate result? 57.70 res = phase->transform(res);// Transform, before making the zero con 57.71 res = new (phase->C) SubINode(phase->intcon(0),res); 57.72 } 57.73 @@ -244,13 +244,13 @@ 57.74 double d = (double)hi1; 57.75 57.76 // Compute all endpoints & check for overflow 57.77 - int32 A = lo0*lo1; 57.78 + int32 A = java_multiply(lo0, lo1); 57.79 if( (double)A != a*c ) return TypeInt::INT; // Overflow? 57.80 - int32 B = lo0*hi1; 57.81 + int32 B = java_multiply(lo0, hi1); 57.82 if( (double)B != a*d ) return TypeInt::INT; // Overflow? 57.83 - int32 C = hi0*lo1; 57.84 + int32 C = java_multiply(hi0, lo1); 57.85 if( (double)C != b*c ) return TypeInt::INT; // Overflow? 57.86 - int32 D = hi0*hi1; 57.87 + int32 D = java_multiply(hi0, hi1); 57.88 if( (double)D != b*d ) return TypeInt::INT; // Overflow? 57.89 57.90 if( A < B ) { lo0 = A; hi0 = B; } // Sort range endpoints 57.91 @@ -280,42 +280,42 @@ 57.92 } 57.93 57.94 // Now we have a constant Node on the right and the constant in con 57.95 - if( con == CONST64(0) ) return NULL; // By zero is handled by Value call 57.96 - if( con == CONST64(1) ) return NULL; // By one is handled by Identity call 57.97 + if (con == CONST64(0)) return NULL; // By zero is handled by Value call 57.98 + if (con == CONST64(1)) return NULL; // By one is handled by Identity call 57.99 57.100 // Check for negative constant; if so negate the final result 57.101 bool sign_flip = false; 57.102 - if( con < 0 ) { 57.103 - con = -con; 57.104 + julong abs_con = uabs(con); 57.105 + if (abs_con != (julong)con) { 57.106 sign_flip = true; 57.107 } 57.108 57.109 // Get low bit; check for being the only bit 57.110 Node *res = NULL; 57.111 - jlong bit1 = con & -con; // Extract low bit 57.112 - if( bit1 == con ) { // Found a power of 2? 57.113 - res = new (phase->C) LShiftLNode( in(1), phase->intcon(log2_long(bit1)) ); 57.114 + julong bit1 = abs_con & (0-abs_con); // Extract low bit 57.115 + if (bit1 == abs_con) { // Found a power of 2? 57.116 + res = new (phase->C) LShiftLNode(in(1), phase->intcon(log2_long(bit1))); 57.117 } else { 57.118 57.119 // Check for constant with 2 bits set 57.120 - jlong bit2 = con-bit1; 57.121 - bit2 = bit2 & -bit2; // Extract 2nd bit 57.122 - if( bit2 + bit1 == con ) { // Found all bits in con? 57.123 - Node *n1 = phase->transform( new (phase->C) LShiftLNode( in(1), phase->intcon(log2_long(bit1)) ) ); 57.124 - Node *n2 = phase->transform( new (phase->C) LShiftLNode( in(1), phase->intcon(log2_long(bit2)) ) ); 57.125 - res = new (phase->C) AddLNode( n2, n1 ); 57.126 + julong bit2 = abs_con-bit1; 57.127 + bit2 = bit2 & (0-bit2); // Extract 2nd bit 57.128 + if (bit2 + bit1 == abs_con) { // Found all bits in con? 57.129 + Node *n1 = phase->transform(new (phase->C) LShiftLNode(in(1), phase->intcon(log2_long(bit1)))); 57.130 + Node *n2 = phase->transform(new (phase->C) LShiftLNode(in(1), phase->intcon(log2_long(bit2)))); 57.131 + res = new (phase->C) AddLNode(n2, n1); 57.132 57.133 - } else if (is_power_of_2_long(con+1)) { 57.134 + } else if (is_power_of_2_long(abs_con+1)) { 57.135 // Sleezy: power-of-2 -1. Next time be generic. 57.136 - jlong temp = (jlong) (con + 1); 57.137 - Node *n1 = phase->transform( new (phase->C) LShiftLNode( in(1), phase->intcon(log2_long(temp)) ) ); 57.138 - res = new (phase->C) SubLNode( n1, in(1) ); 57.139 + julong temp = abs_con + 1; 57.140 + Node *n1 = phase->transform( new (phase->C) LShiftLNode(in(1), phase->intcon(log2_long(temp)))); 57.141 + res = new (phase->C) SubLNode(n1, in(1)); 57.142 } else { 57.143 return MulNode::Ideal(phase, can_reshape); 57.144 } 57.145 } 57.146 57.147 - if( sign_flip ) { // Need to negate result? 57.148 + if (sign_flip) { // Need to negate result? 57.149 res = phase->transform(res);// Transform, before making the zero con 57.150 res = new (phase->C) SubLNode(phase->longcon(0),res); 57.151 } 57.152 @@ -340,13 +340,13 @@ 57.153 double d = (double)hi1; 57.154 57.155 // Compute all endpoints & check for overflow 57.156 - jlong A = lo0*lo1; 57.157 + jlong A = java_multiply(lo0, lo1); 57.158 if( (double)A != a*c ) return TypeLong::LONG; // Overflow? 57.159 - jlong B = lo0*hi1; 57.160 + jlong B = java_multiply(lo0, hi1); 57.161 if( (double)B != a*d ) return TypeLong::LONG; // Overflow? 57.162 - jlong C = hi0*lo1; 57.163 + jlong C = java_multiply(hi0, lo1); 57.164 if( (double)C != b*c ) return TypeLong::LONG; // Overflow? 57.165 - jlong D = hi0*hi1; 57.166 + jlong D = java_multiply(hi0, hi1); 57.167 if( (double)D != b*d ) return TypeLong::LONG; // Overflow? 57.168 57.169 if( A < B ) { lo0 = A; hi0 = B; } // Sort range endpoints 57.170 @@ -444,7 +444,7 @@ 57.171 // Masking off high bits which are always zero is useless. 57.172 const TypeInt* t1 = phase->type( in(1) )->isa_int(); 57.173 if (t1 != NULL && t1->_lo >= 0) { 57.174 - jint t1_support = right_n_bits(1 + log2_intptr(t1->_hi)); 57.175 + jint t1_support = right_n_bits(1 + log2_jint(t1->_hi)); 57.176 if ((t1_support & con) == t1_support) 57.177 return in1; 57.178 } 57.179 @@ -573,7 +573,8 @@ 57.180 // Masking off high bits which are always zero is useless. 57.181 const TypeLong* t1 = phase->type( in(1) )->isa_long(); 57.182 if (t1 != NULL && t1->_lo >= 0) { 57.183 - jlong t1_support = ((jlong)1 << (1 + log2_long(t1->_hi))) - 1; 57.184 + int bit_count = log2_long(t1->_hi) + 1; 57.185 + jlong t1_support = jlong(max_julong >> (BitsPerJavaLong - bit_count)); 57.186 if ((t1_support & con) == t1_support) 57.187 return usr; 57.188 } 57.189 @@ -801,7 +802,7 @@ 57.190 57.191 // Check for ((x & ((CONST64(1)<<(64-c0))-1)) << c0) which ANDs off high bits 57.192 // before shifting them away. 57.193 - const jlong bits_mask = ((jlong)CONST64(1) << (jlong)(BitsPerJavaLong - con)) - CONST64(1); 57.194 + const jlong bits_mask = jlong(max_julong >> con); 57.195 if( add1_op == Op_AndL && 57.196 phase->type(add1->in(2)) == TypeLong::make( bits_mask ) ) 57.197 return new (phase->C) LShiftLNode( add1->in(1), in(2) ); 57.198 @@ -1253,7 +1254,7 @@ 57.199 if ( con == 0 ) return NULL; // let Identity() handle a 0 shift count 57.200 // note: mask computation below does not work for 0 shift count 57.201 // We'll be wanting the right-shift amount as a mask of that many bits 57.202 - const jlong mask = (((jlong)CONST64(1) << (jlong)(BitsPerJavaLong - con)) -1); 57.203 + const jlong mask = jlong(max_julong >> con); 57.204 57.205 // Check for ((x << z) + Y) >>> z. Replace with x + con>>>z 57.206 // The idiom for rounding to a power of 2 is "(Q+(2^z-1)) >>> z".
58.1 --- a/src/share/vm/opto/subnode.cpp Wed Jul 03 20:04:13 2019 +0800 58.2 +++ b/src/share/vm/opto/subnode.cpp Wed Jul 03 20:42:37 2019 +0800 58.3 @@ -252,8 +252,8 @@ 58.4 const Type *SubINode::sub( const Type *t1, const Type *t2 ) const { 58.5 const TypeInt *r0 = t1->is_int(); // Handy access 58.6 const TypeInt *r1 = t2->is_int(); 58.7 - int32 lo = r0->_lo - r1->_hi; 58.8 - int32 hi = r0->_hi - r1->_lo; 58.9 + int32 lo = java_subtract(r0->_lo, r1->_hi); 58.10 + int32 hi = java_subtract(r0->_hi, r1->_lo); 58.11 58.12 // We next check for 32-bit overflow. 58.13 // If that happens, we just assume all integers are possible. 58.14 @@ -361,8 +361,8 @@ 58.15 const Type *SubLNode::sub( const Type *t1, const Type *t2 ) const { 58.16 const TypeLong *r0 = t1->is_long(); // Handy access 58.17 const TypeLong *r1 = t2->is_long(); 58.18 - jlong lo = r0->_lo - r1->_hi; 58.19 - jlong hi = r0->_hi - r1->_lo; 58.20 + jlong lo = java_subtract(r0->_lo, r1->_hi); 58.21 + jlong hi = java_subtract(r0->_hi, r1->_lo); 58.22 58.23 // We next check for 32-bit overflow. 58.24 // If that happens, we just assume all integers are possible.
59.1 --- a/src/share/vm/opto/type.cpp Wed Jul 03 20:04:13 2019 +0800 59.2 +++ b/src/share/vm/opto/type.cpp Wed Jul 03 20:42:37 2019 +0800 59.3 @@ -1334,8 +1334,8 @@ 59.4 59.5 // The new type narrows the old type, so look for a "death march". 59.6 // See comments on PhaseTransform::saturate. 59.7 - juint nrange = _hi - _lo; 59.8 - juint orange = ohi - olo; 59.9 + juint nrange = (juint)_hi - _lo; 59.10 + juint orange = (juint)ohi - olo; 59.11 if (nrange < max_juint - 1 && nrange > (orange >> 1) + (SMALLINT*2)) { 59.12 // Use the new type only if the range shrinks a lot. 59.13 // We do not want the optimizer computing 2^31 point by point. 59.14 @@ -1368,7 +1368,7 @@ 59.15 //------------------------------hash------------------------------------------- 59.16 // Type-specific hashing function. 59.17 int TypeInt::hash(void) const { 59.18 - return _lo+_hi+_widen+(int)Type::Int; 59.19 + return java_add(java_add(_lo, _hi), java_add(_widen, (int)Type::Int)); 59.20 } 59.21 59.22 //------------------------------is_finite-------------------------------------- 59.23 @@ -1549,7 +1549,7 @@ 59.24 // If neither endpoint is extremal yet, push out the endpoint 59.25 // which is closer to its respective limit. 59.26 if (_lo >= 0 || // easy common case 59.27 - (julong)(_lo - min) >= (julong)(max - _hi)) { 59.28 + ((julong)_lo - min) >= ((julong)max - _hi)) { 59.29 // Try to widen to an unsigned range type of 32/63 bits: 59.30 if (max >= max_juint && _hi < max_juint) 59.31 return make(_lo, max_juint, WidenMax); 59.32 @@ -2319,7 +2319,7 @@ 59.33 //------------------------------hash------------------------------------------- 59.34 // Type-specific hashing function. 59.35 int TypePtr::hash(void) const { 59.36 - return _ptr + _offset; 59.37 + return java_add(_ptr, _offset); 59.38 } 59.39 59.40 //------------------------------dump2------------------------------------------ 59.41 @@ -2909,12 +2909,8 @@ 59.42 // Type-specific hashing function. 59.43 int TypeOopPtr::hash(void) const { 59.44 return 59.45 - (const_oop() ? const_oop()->hash() : 0) + 59.46 - _klass_is_exact + 59.47 - _instance_id + 59.48 - hash_speculative() + 59.49 - _inline_depth + 59.50 - TypePtr::hash(); 59.51 + java_add(java_add(java_add(const_oop() ? const_oop()->hash() : 0, _klass_is_exact), 59.52 + java_add(_instance_id , hash_speculative())), java_add(_inline_depth , TypePtr::hash())); 59.53 } 59.54 59.55 //------------------------------dump2------------------------------------------ 59.56 @@ -3640,7 +3636,7 @@ 59.57 //------------------------------hash------------------------------------------- 59.58 // Type-specific hashing function. 59.59 int TypeInstPtr::hash(void) const { 59.60 - int hash = klass()->hash() + TypeOopPtr::hash(); 59.61 + int hash = java_add(klass()->hash(), TypeOopPtr::hash()); 59.62 return hash; 59.63 } 59.64 59.65 @@ -4535,7 +4531,7 @@ 59.66 //------------------------------hash------------------------------------------- 59.67 // Type-specific hashing function. 59.68 int TypeKlassPtr::hash(void) const { 59.69 - return klass()->hash() + TypePtr::hash(); 59.70 + return java_add(klass()->hash(), TypePtr::hash()); 59.71 } 59.72 59.73 //------------------------------singleton--------------------------------------
60.1 --- a/src/share/vm/prims/whitebox.cpp Wed Jul 03 20:04:13 2019 +0800 60.2 +++ b/src/share/vm/prims/whitebox.cpp Wed Jul 03 20:42:37 2019 +0800 60.3 @@ -171,7 +171,7 @@ 60.4 WB_ENTRY(void, WB_PrintHeapSizes(JNIEnv* env, jobject o)) { 60.5 CollectorPolicy * p = Universe::heap()->collector_policy(); 60.6 gclog_or_tty->print_cr("Minimum heap " SIZE_FORMAT " Initial heap " 60.7 - SIZE_FORMAT" Maximum heap " SIZE_FORMAT " Min alignment " SIZE_FORMAT " Max alignment " SIZE_FORMAT, 60.8 + SIZE_FORMAT " Maximum heap " SIZE_FORMAT " Space alignment " SIZE_FORMAT " Heap alignment " SIZE_FORMAT, 60.9 p->min_heap_byte_size(), p->initial_heap_byte_size(), p->max_heap_byte_size(), 60.10 p->space_alignment(), p->heap_alignment()); 60.11 } 60.12 @@ -371,6 +371,13 @@ 60.13 return (jlong)(uintptr_t)os::malloc(size, mtTest, stack); 60.14 WB_END 60.15 60.16 +// Alloc memory with pseudo call stack and specific memory type. 60.17 +WB_ENTRY(jlong, WB_NMTMallocWithPseudoStackAndType(JNIEnv* env, jobject o, jlong size, jint pseudo_stack, jint type)) 60.18 + address pc = (address)(size_t)pseudo_stack; 60.19 + NativeCallStack stack(&pc, 1); 60.20 + return (jlong)(uintptr_t)os::malloc(size, (MEMFLAGS)type, stack); 60.21 +WB_END 60.22 + 60.23 // Free the memory allocated by NMTAllocTest 60.24 WB_ENTRY(void, WB_NMTFree(JNIEnv* env, jobject o, jlong mem)) 60.25 os::free((void*)(uintptr_t)mem, mtTest); 60.26 @@ -1081,6 +1088,7 @@ 60.27 #if INCLUDE_NMT 60.28 {CC"NMTMalloc", CC"(J)J", (void*)&WB_NMTMalloc }, 60.29 {CC"NMTMallocWithPseudoStack", CC"(JI)J", (void*)&WB_NMTMallocWithPseudoStack}, 60.30 + {CC"NMTMallocWithPseudoStackAndType", CC"(JII)J", (void*)&WB_NMTMallocWithPseudoStackAndType}, 60.31 {CC"NMTFree", CC"(J)V", (void*)&WB_NMTFree }, 60.32 {CC"NMTReserveMemory", CC"(J)J", (void*)&WB_NMTReserveMemory }, 60.33 {CC"NMTCommitMemory", CC"(JJ)V", (void*)&WB_NMTCommitMemory },
61.1 --- a/src/share/vm/runtime/advancedThresholdPolicy.cpp Wed Jul 03 20:04:13 2019 +0800 61.2 +++ b/src/share/vm/runtime/advancedThresholdPolicy.cpp Wed Jul 03 20:42:37 2019 +0800 61.3 @@ -47,8 +47,8 @@ 61.4 int count = CICompilerCount; 61.5 if (CICompilerCountPerCPU) { 61.6 // Simple log n seems to grow too slowly for tiered, try something faster: log n * log log n 61.7 - int log_cpu = log2_intptr(os::active_processor_count()); 61.8 - int loglog_cpu = log2_intptr(MAX2(log_cpu, 1)); 61.9 + int log_cpu = log2_int(os::active_processor_count()); 61.10 + int loglog_cpu = log2_int(MAX2(log_cpu, 1)); 61.11 count = MAX2(log_cpu * loglog_cpu, 1) * 3 / 2; 61.12 } 61.13 61.14 @@ -131,7 +131,8 @@ 61.15 } 61.16 61.17 double AdvancedThresholdPolicy::weight(Method* method) { 61.18 - return (method->rate() + 1) * ((method->invocation_count() + 1) * (method->backedge_count() + 1)); 61.19 + return (double)(method->rate() + 1) * 61.20 + (method->invocation_count() + 1) * (method->backedge_count() + 1); 61.21 } 61.22 61.23 // Apply heuristics and return true if x should be compiled before y
62.1 --- a/src/share/vm/runtime/arguments.cpp Wed Jul 03 20:04:13 2019 +0800 62.2 +++ b/src/share/vm/runtime/arguments.cpp Wed Jul 03 20:42:37 2019 +0800 62.3 @@ -1,5 +1,5 @@ 62.4 /* 62.5 - * Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved. 62.6 + * Copyright (c) 1997, 2019, Oracle and/or its affiliates. All rights reserved. 62.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 62.8 * 62.9 * This code is free software; you can redistribute it and/or modify it 62.10 @@ -66,7 +66,11 @@ 62.11 #endif // INCLUDE_ALL_GCS 62.12 62.13 // Note: This is a special bug reporting site for the JVM 62.14 -#define DEFAULT_VENDOR_URL_BUG "http://bugreport.java.com/bugreport/crash.jsp" 62.15 +#ifdef VENDOR_URL_VM_BUG 62.16 +# define DEFAULT_VENDOR_URL_BUG VENDOR_URL_VM_BUG 62.17 +#else 62.18 +# define DEFAULT_VENDOR_URL_BUG "http://bugreport.java.com/bugreport/crash.jsp" 62.19 +#endif 62.20 #define DEFAULT_JAVA_LAUNCHER "generic" 62.21 62.22 // Disable options not supported in this release, with a warning if they
63.1 --- a/src/share/vm/runtime/compilationPolicy.cpp Wed Jul 03 20:04:13 2019 +0800 63.2 +++ b/src/share/vm/runtime/compilationPolicy.cpp Wed Jul 03 20:42:37 2019 +0800 63.3 @@ -181,7 +181,7 @@ 63.4 // Example: if CICompilerCountPerCPU is true, then we get 63.5 // max(log2(8)-1,1) = 2 compiler threads on an 8-way machine. 63.6 // May help big-app startup time. 63.7 - _compiler_count = MAX2(log2_intptr(os::active_processor_count())-1,1); 63.8 + _compiler_count = MAX2(log2_int(os::active_processor_count())-1,1); 63.9 FLAG_SET_ERGO(intx, CICompilerCount, _compiler_count); 63.10 } else { 63.11 _compiler_count = CICompilerCount;
64.1 --- a/src/share/vm/runtime/fprofiler.cpp Wed Jul 03 20:04:13 2019 +0800 64.2 +++ b/src/share/vm/runtime/fprofiler.cpp Wed Jul 03 20:42:37 2019 +0800 64.3 @@ -775,7 +775,7 @@ 64.4 } 64.5 64.6 void ThreadProfiler::vm_update(TickPosition where) { 64.7 - vm_update(NULL, where); 64.8 + vm_update("", where); 64.9 } 64.10 64.11 void ThreadProfiler::vm_update(const char* name, TickPosition where) {
65.1 --- a/src/share/vm/runtime/globals.hpp Wed Jul 03 20:04:13 2019 +0800 65.2 +++ b/src/share/vm/runtime/globals.hpp Wed Jul 03 20:42:37 2019 +0800 65.3 @@ -780,8 +780,8 @@ 65.4 "Time out and warn or fail after SafepointTimeoutDelay " \ 65.5 "milliseconds if failed to reach safepoint") \ 65.6 \ 65.7 - develop(bool, DieOnSafepointTimeout, false, \ 65.8 - "Die upon failure to reach safepoint (see SafepointTimeout)") \ 65.9 + diagnostic(bool, AbortVMOnSafepointTimeout, false, \ 65.10 + "Abort upon failure to reach safepoint (see SafepointTimeout)") \ 65.11 \ 65.12 /* 50 retries * (5 * current_retry_count) millis = ~6.375 seconds */ \ 65.13 /* typically, at most a few retries are needed */ \
66.1 --- a/src/share/vm/runtime/os.cpp Wed Jul 03 20:04:13 2019 +0800 66.2 +++ b/src/share/vm/runtime/os.cpp Wed Jul 03 20:42:37 2019 +0800 66.3 @@ -1284,7 +1284,7 @@ 66.4 } 66.5 66.6 void os::set_memory_serialize_page(address page) { 66.7 - int count = log2_intptr(sizeof(class JavaThread)) - log2_intptr(64); 66.8 + int count = log2_intptr(sizeof(class JavaThread)) - log2_int(64); 66.9 _mem_serialize_page = (volatile int32_t *)page; 66.10 // We initialize the serialization page shift count here 66.11 // We assume a cache line size of 64 bytes
67.1 --- a/src/share/vm/runtime/os.hpp Wed Jul 03 20:04:13 2019 +0800 67.2 +++ b/src/share/vm/runtime/os.hpp Wed Jul 03 20:42:37 2019 +0800 67.3 @@ -1,5 +1,5 @@ 67.4 /* 67.5 - * Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved. 67.6 + * Copyright (c) 1997, 2019, Oracle and/or its affiliates. All rights reserved. 67.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 67.8 * 67.9 * This code is free software; you can redistribute it and/or modify it 67.10 @@ -533,7 +533,7 @@ 67.11 static char* do_you_want_to_debug(const char* message); 67.12 67.13 // run cmd in a separate process and return its exit code; or -1 on failures 67.14 - static int fork_and_exec(char *cmd); 67.15 + static int fork_and_exec(char *cmd, bool use_vfork_if_available = false); 67.16 67.17 // os::exit() is merged with vm_exit() 67.18 // static void exit(int num);
68.1 --- a/src/share/vm/runtime/safepoint.cpp Wed Jul 03 20:04:13 2019 +0800 68.2 +++ b/src/share/vm/runtime/safepoint.cpp Wed Jul 03 20:42:37 2019 +0800 68.3 @@ -800,9 +800,9 @@ 68.4 tty->print_cr("# SafepointSynchronize::begin: (End of list)"); 68.5 } 68.6 68.7 - // To debug the long safepoint, specify both DieOnSafepointTimeout & 68.8 + // To debug the long safepoint, specify both AbortVMOnSafepointTimeout & 68.9 // ShowMessageBoxOnError. 68.10 - if (DieOnSafepointTimeout) { 68.11 + if (AbortVMOnSafepointTimeout) { 68.12 char msg[1024]; 68.13 VM_Operation *op = VMThread::vm_operation(); 68.14 sprintf(msg, "Safepoint sync time longer than " INTX_FORMAT "ms detected when executing %s.",
69.1 --- a/src/share/vm/runtime/simpleThresholdPolicy.cpp Wed Jul 03 20:04:13 2019 +0800 69.2 +++ b/src/share/vm/runtime/simpleThresholdPolicy.cpp Wed Jul 03 20:42:37 2019 +0800 69.3 @@ -139,7 +139,7 @@ 69.4 } 69.5 int count = CICompilerCount; 69.6 if (CICompilerCountPerCPU) { 69.7 - count = MAX2(log2_intptr(os::active_processor_count()), 1) * 3 / 2; 69.8 + count = MAX2(log2_int(os::active_processor_count()), 1) * 3 / 2; 69.9 } 69.10 set_c1_count(MAX2(count / 3, 1)); 69.11 set_c2_count(MAX2(count - c1_count(), 1));
70.1 --- a/src/share/vm/runtime/vm_version.cpp Wed Jul 03 20:04:13 2019 +0800 70.2 +++ b/src/share/vm/runtime/vm_version.cpp Wed Jul 03 20:42:37 2019 +0800 70.3 @@ -149,7 +149,7 @@ 70.4 70.5 const char* Abstract_VM_Version::vm_vendor() { 70.6 #ifdef VENDOR 70.7 - return XSTR(VENDOR); 70.8 + return VENDOR; 70.9 #else 70.10 return JDK_Version::is_gte_jdk17x_version() ? 70.11 "Oracle Corporation" : "Sun Microsystems Inc.";
71.1 --- a/src/share/vm/services/memReporter.cpp Wed Jul 03 20:04:13 2019 +0800 71.2 +++ b/src/share/vm/services/memReporter.cpp Wed Jul 03 20:42:37 2019 +0800 71.3 @@ -572,9 +572,15 @@ 71.4 71.5 void MemDetailDiffReporter::diff_malloc_site(const MallocSite* early, 71.6 const MallocSite* current) const { 71.7 - assert(early->flags() == current->flags(), "Must be the same memory type"); 71.8 - diff_malloc_site(current->call_stack(), current->size(), current->count(), 71.9 - early->size(), early->count(), early->flags()); 71.10 + if (early->flags() != current->flags()) { 71.11 + // If malloc site type changed, treat it as deallocation of old type and 71.12 + // allocation of new type. 71.13 + old_malloc_site(early); 71.14 + new_malloc_site(current); 71.15 + } else { 71.16 + diff_malloc_site(current->call_stack(), current->size(), current->count(), 71.17 + early->size(), early->count(), early->flags()); 71.18 + } 71.19 } 71.20 71.21 void MemDetailDiffReporter::diff_malloc_site(const NativeCallStack* stack, size_t current_size,
72.1 --- a/src/share/vm/services/memoryManager.cpp Wed Jul 03 20:04:13 2019 +0800 72.2 +++ b/src/share/vm/services/memoryManager.cpp Wed Jul 03 20:42:37 2019 +0800 72.3 @@ -1,5 +1,5 @@ 72.4 /* 72.5 - * Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved. 72.6 + * Copyright (c) 2003, 2019, Oracle and/or its affiliates. All rights reserved. 72.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 72.8 * 72.9 * This code is free software; you can redistribute it and/or modify it 72.10 @@ -49,13 +49,15 @@ 72.11 (void)const_cast<instanceOop&>(_memory_mgr_obj = instanceOop(NULL)); 72.12 } 72.13 72.14 -void MemoryManager::add_pool(MemoryPool* pool) { 72.15 - assert(_num_pools < MemoryManager::max_num_pools, "_num_pools exceeds the max"); 72.16 - if (_num_pools < MemoryManager::max_num_pools) { 72.17 - _pools[_num_pools] = pool; 72.18 +int MemoryManager::add_pool(MemoryPool* pool) { 72.19 + int index = _num_pools; 72.20 + assert(index < MemoryManager::max_num_pools, "_num_pools exceeds the max"); 72.21 + if (index < MemoryManager::max_num_pools) { 72.22 + _pools[index] = pool; 72.23 _num_pools++; 72.24 } 72.25 pool->add_manager(this); 72.26 + return index; 72.27 } 72.28 72.29 MemoryManager* MemoryManager::get_code_cache_memory_manager() { 72.30 @@ -217,6 +219,15 @@ 72.31 delete _current_gc_stat; 72.32 } 72.33 72.34 +void GCMemoryManager::add_pool(MemoryPool* pool) { 72.35 + add_pool(pool, true); 72.36 +} 72.37 + 72.38 +void GCMemoryManager::add_pool(MemoryPool* pool, bool always_affected_by_gc) { 72.39 + int index = MemoryManager::add_pool(pool); 72.40 + _pool_always_affected_by_gc[index] = always_affected_by_gc; 72.41 +} 72.42 + 72.43 void GCMemoryManager::initialize_gc_stat_info() { 72.44 assert(MemoryService::num_memory_pools() > 0, "should have one or more memory pools"); 72.45 _last_gc_stat = new(ResourceObj::C_HEAP, mtGC) GCStatInfo(MemoryService::num_memory_pools()); 72.46 @@ -266,7 +277,8 @@ 72.47 void GCMemoryManager::gc_end(bool recordPostGCUsage, 72.48 bool recordAccumulatedGCTime, 72.49 bool recordGCEndTime, bool countCollection, 72.50 - GCCause::Cause cause) { 72.51 + GCCause::Cause cause, 72.52 + bool allMemoryPoolsAffected) { 72.53 if (recordAccumulatedGCTime) { 72.54 _accumulated_timer.stop(); 72.55 } 72.56 @@ -304,8 +316,11 @@ 72.57 MemoryUsage usage = pool->get_memory_usage(); 72.58 72.59 // Compare with GC usage threshold 72.60 - pool->set_last_collection_usage(usage); 72.61 - LowMemoryDetector::detect_after_gc_memory(pool); 72.62 + if (allMemoryPoolsAffected || pool_always_affected_by_gc(i)) { 72.63 + // Compare with GC usage threshold 72.64 + pool->set_last_collection_usage(usage); 72.65 + LowMemoryDetector::detect_after_gc_memory(pool); 72.66 + } 72.67 } 72.68 } 72.69
73.1 --- a/src/share/vm/services/memoryManager.hpp Wed Jul 03 20:04:13 2019 +0800 73.2 +++ b/src/share/vm/services/memoryManager.hpp Wed Jul 03 20:42:37 2019 +0800 73.3 @@ -1,5 +1,5 @@ 73.4 /* 73.5 - * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved. 73.6 + * Copyright (c) 2003, 2019, Oracle and/or its affiliates. All rights reserved. 73.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 73.8 * 73.9 * This code is free software; you can redistribute it and/or modify it 73.10 @@ -41,11 +41,12 @@ 73.11 class OopClosure; 73.12 73.13 class MemoryManager : public CHeapObj<mtInternal> { 73.14 -private: 73.15 +protected: 73.16 enum { 73.17 max_num_pools = 10 73.18 }; 73.19 73.20 +private: 73.21 MemoryPool* _pools[max_num_pools]; 73.22 int _num_pools; 73.23 73.24 @@ -75,7 +76,7 @@ 73.25 return _pools[index]; 73.26 } 73.27 73.28 - void add_pool(MemoryPool* pool); 73.29 + int add_pool(MemoryPool* pool); 73.30 73.31 bool is_manager(instanceHandle mh) { return mh() == _memory_mgr_obj; } 73.32 73.33 @@ -177,10 +178,20 @@ 73.34 GCStatInfo* _current_gc_stat; 73.35 int _num_gc_threads; 73.36 volatile bool _notification_enabled; 73.37 + bool _pool_always_affected_by_gc[MemoryManager::max_num_pools]; 73.38 + 73.39 public: 73.40 GCMemoryManager(); 73.41 ~GCMemoryManager(); 73.42 73.43 + void add_pool(MemoryPool* pool); 73.44 + void add_pool(MemoryPool* pool, bool always_affected_by_gc); 73.45 + 73.46 + bool pool_always_affected_by_gc(int index) { 73.47 + assert(index >= 0 && index < num_memory_pools(), "Invalid index"); 73.48 + return _pool_always_affected_by_gc[index]; 73.49 + } 73.50 + 73.51 void initialize_gc_stat_info(); 73.52 73.53 bool is_gc_memory_manager() { return true; } 73.54 @@ -192,7 +203,8 @@ 73.55 void gc_begin(bool recordGCBeginTime, bool recordPreGCUsage, 73.56 bool recordAccumulatedGCTime); 73.57 void gc_end(bool recordPostGCUsage, bool recordAccumulatedGCTime, 73.58 - bool recordGCEndTime, bool countCollection, GCCause::Cause cause); 73.59 + bool recordGCEndTime, bool countCollection, GCCause::Cause cause, 73.60 + bool allMemoryPoolsAffected); 73.61 73.62 void reset_gc_stat() { _num_collections = 0; _accumulated_timer.reset(); } 73.63
74.1 --- a/src/share/vm/services/memoryService.cpp Wed Jul 03 20:04:13 2019 +0800 74.2 +++ b/src/share/vm/services/memoryService.cpp Wed Jul 03 20:42:37 2019 +0800 74.3 @@ -1,5 +1,5 @@ 74.4 /* 74.5 - * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved. 74.6 + * Copyright (c) 2003, 2019, Oracle and/or its affiliates. All rights reserved. 74.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 74.8 * 74.9 * This code is free software; you can redistribute it and/or modify it 74.10 @@ -187,7 +187,7 @@ 74.11 _managers_list->append(_major_gc_manager); 74.12 74.13 add_g1YoungGen_memory_pool(g1h, _major_gc_manager, _minor_gc_manager); 74.14 - add_g1OldGen_memory_pool(g1h, _major_gc_manager); 74.15 + add_g1OldGen_memory_pool(g1h, _major_gc_manager, _minor_gc_manager); 74.16 } 74.17 #endif // INCLUDE_ALL_GCS 74.18 74.19 @@ -241,8 +241,8 @@ 74.20 74.21 // Add memory pool(s) for one generation 74.22 void MemoryService::add_generation_memory_pool(Generation* gen, 74.23 - MemoryManager* major_mgr, 74.24 - MemoryManager* minor_mgr) { 74.25 + GCMemoryManager* major_mgr, 74.26 + GCMemoryManager* minor_mgr) { 74.27 guarantee(gen != NULL, "No generation for memory pool"); 74.28 Generation::Name kind = gen->kind(); 74.29 int index = _pools_list->length(); 74.30 @@ -332,7 +332,9 @@ 74.31 74.32 74.33 #if INCLUDE_ALL_GCS 74.34 -void MemoryService::add_psYoung_memory_pool(PSYoungGen* gen, MemoryManager* major_mgr, MemoryManager* minor_mgr) { 74.35 +void MemoryService::add_psYoung_memory_pool(PSYoungGen* gen, 74.36 + GCMemoryManager* major_mgr, 74.37 + GCMemoryManager* minor_mgr) { 74.38 assert(major_mgr != NULL && minor_mgr != NULL, "Should have two managers"); 74.39 74.40 // Add a memory pool for each space and young gen doesn't 74.41 @@ -356,7 +358,7 @@ 74.42 _pools_list->append(survivor); 74.43 } 74.44 74.45 -void MemoryService::add_psOld_memory_pool(PSOldGen* gen, MemoryManager* mgr) { 74.46 +void MemoryService::add_psOld_memory_pool(PSOldGen* gen, GCMemoryManager* mgr) { 74.47 PSGenerationPool* old_gen = new PSGenerationPool(gen, 74.48 "PS Old Gen", 74.49 MemoryPool::Heap, 74.50 @@ -366,8 +368,8 @@ 74.51 } 74.52 74.53 void MemoryService::add_g1YoungGen_memory_pool(G1CollectedHeap* g1h, 74.54 - MemoryManager* major_mgr, 74.55 - MemoryManager* minor_mgr) { 74.56 + GCMemoryManager* major_mgr, 74.57 + GCMemoryManager* minor_mgr) { 74.58 assert(major_mgr != NULL && minor_mgr != NULL, "should have two managers"); 74.59 74.60 G1EdenPool* eden = new G1EdenPool(g1h); 74.61 @@ -382,11 +384,13 @@ 74.62 } 74.63 74.64 void MemoryService::add_g1OldGen_memory_pool(G1CollectedHeap* g1h, 74.65 - MemoryManager* mgr) { 74.66 - assert(mgr != NULL, "should have one manager"); 74.67 + GCMemoryManager* major_mgr, 74.68 + GCMemoryManager* minor_mgr) { 74.69 + assert(major_mgr != NULL && minor_mgr != NULL, "should have two managers"); 74.70 74.71 G1OldGenPool* old_gen = new G1OldGenPool(g1h); 74.72 - mgr->add_pool(old_gen); 74.73 + major_mgr->add_pool(old_gen); 74.74 + minor_mgr->add_pool(old_gen, false /* always_affected_by_gc */); 74.75 _pools_list->append(old_gen); 74.76 } 74.77 #endif // INCLUDE_ALL_GCS 74.78 @@ -484,7 +488,8 @@ 74.79 void MemoryService::gc_end(bool fullGC, bool recordPostGCUsage, 74.80 bool recordAccumulatedGCTime, 74.81 bool recordGCEndTime, bool countCollection, 74.82 - GCCause::Cause cause) { 74.83 + GCCause::Cause cause, 74.84 + bool allMemoryPoolsAffected) { 74.85 74.86 GCMemoryManager* mgr; 74.87 if (fullGC) { 74.88 @@ -496,7 +501,7 @@ 74.89 74.90 // register the GC end statistics and memory usage 74.91 mgr->gc_end(recordPostGCUsage, recordAccumulatedGCTime, recordGCEndTime, 74.92 - countCollection, cause); 74.93 + countCollection, cause, allMemoryPoolsAffected); 74.94 } 74.95 74.96 void MemoryService::oops_do(OopClosure* f) { 74.97 @@ -573,10 +578,11 @@ 74.98 } 74.99 // this has to be called in a stop the world pause and represent 74.100 // an entire gc pause, start to finish: 74.101 - initialize(_fullGC, cause,true, true, true, true, true, true, true); 74.102 + initialize(_fullGC, cause, true, true, true, true, true, true, true, true); 74.103 } 74.104 TraceMemoryManagerStats::TraceMemoryManagerStats(bool fullGC, 74.105 GCCause::Cause cause, 74.106 + bool allMemoryPoolsAffected, 74.107 bool recordGCBeginTime, 74.108 bool recordPreGCUsage, 74.109 bool recordPeakUsage, 74.110 @@ -584,7 +590,8 @@ 74.111 bool recordAccumulatedGCTime, 74.112 bool recordGCEndTime, 74.113 bool countCollection) { 74.114 - initialize(fullGC, cause, recordGCBeginTime, recordPreGCUsage, recordPeakUsage, 74.115 + initialize(fullGC, cause, allMemoryPoolsAffected, 74.116 + recordGCBeginTime, recordPreGCUsage, recordPeakUsage, 74.117 recordPostGCUsage, recordAccumulatedGCTime, recordGCEndTime, 74.118 countCollection); 74.119 } 74.120 @@ -593,6 +600,7 @@ 74.121 // the MemoryService 74.122 void TraceMemoryManagerStats::initialize(bool fullGC, 74.123 GCCause::Cause cause, 74.124 + bool allMemoryPoolsAffected, 74.125 bool recordGCBeginTime, 74.126 bool recordPreGCUsage, 74.127 bool recordPeakUsage, 74.128 @@ -601,6 +609,7 @@ 74.129 bool recordGCEndTime, 74.130 bool countCollection) { 74.131 _fullGC = fullGC; 74.132 + _allMemoryPoolsAffected = allMemoryPoolsAffected; 74.133 _recordGCBeginTime = recordGCBeginTime; 74.134 _recordPreGCUsage = recordPreGCUsage; 74.135 _recordPeakUsage = recordPeakUsage; 74.136 @@ -616,5 +625,5 @@ 74.137 74.138 TraceMemoryManagerStats::~TraceMemoryManagerStats() { 74.139 MemoryService::gc_end(_fullGC, _recordPostGCUsage, _recordAccumulatedGCTime, 74.140 - _recordGCEndTime, _countCollection, _cause); 74.141 + _recordGCEndTime, _countCollection, _cause, _allMemoryPoolsAffected); 74.142 }
75.1 --- a/src/share/vm/services/memoryService.hpp Wed Jul 03 20:04:13 2019 +0800 75.2 +++ b/src/share/vm/services/memoryService.hpp Wed Jul 03 20:42:37 2019 +0800 75.3 @@ -1,5 +1,5 @@ 75.4 /* 75.5 - * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved. 75.6 + * Copyright (c) 2003, 2019, Oracle and/or its affiliates. All rights reserved. 75.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 75.8 * 75.9 * This code is free software; you can redistribute it and/or modify it 75.10 @@ -77,25 +77,26 @@ 75.11 static MemoryPool* _compressed_class_pool; 75.12 75.13 static void add_generation_memory_pool(Generation* gen, 75.14 - MemoryManager* major_mgr, 75.15 - MemoryManager* minor_mgr); 75.16 + GCMemoryManager* major_mgr, 75.17 + GCMemoryManager* minor_mgr); 75.18 static void add_generation_memory_pool(Generation* gen, 75.19 - MemoryManager* major_mgr) { 75.20 + GCMemoryManager* major_mgr) { 75.21 add_generation_memory_pool(gen, major_mgr, NULL); 75.22 } 75.23 75.24 75.25 static void add_psYoung_memory_pool(PSYoungGen* gen, 75.26 - MemoryManager* major_mgr, 75.27 - MemoryManager* minor_mgr); 75.28 + GCMemoryManager* major_mgr, 75.29 + GCMemoryManager* minor_mgr); 75.30 static void add_psOld_memory_pool(PSOldGen* gen, 75.31 - MemoryManager* mgr); 75.32 + GCMemoryManager* mgr); 75.33 75.34 static void add_g1YoungGen_memory_pool(G1CollectedHeap* g1h, 75.35 - MemoryManager* major_mgr, 75.36 - MemoryManager* minor_mgr); 75.37 + GCMemoryManager* major_mgr, 75.38 + GCMemoryManager* minor_mgr); 75.39 static void add_g1OldGen_memory_pool(G1CollectedHeap* g1h, 75.40 - MemoryManager* mgr); 75.41 + GCMemoryManager* major_mgr, 75.42 + GCMemoryManager* minor_mgr); 75.43 75.44 static MemoryPool* add_space(ContiguousSpace* space, 75.45 const char* name, 75.46 @@ -162,7 +163,8 @@ 75.47 static void gc_end(bool fullGC, bool recordPostGCUsage, 75.48 bool recordAccumulatedGCTime, 75.49 bool recordGCEndTime, bool countCollection, 75.50 - GCCause::Cause cause); 75.51 + GCCause::Cause cause, 75.52 + bool allMemoryPoolsAffected); 75.53 75.54 75.55 static void oops_do(OopClosure* f); 75.56 @@ -185,6 +187,7 @@ 75.57 class TraceMemoryManagerStats : public StackObj { 75.58 private: 75.59 bool _fullGC; 75.60 + bool _allMemoryPoolsAffected; 75.61 bool _recordGCBeginTime; 75.62 bool _recordPreGCUsage; 75.63 bool _recordPeakUsage; 75.64 @@ -197,6 +200,7 @@ 75.65 TraceMemoryManagerStats() {} 75.66 TraceMemoryManagerStats(bool fullGC, 75.67 GCCause::Cause cause, 75.68 + bool allMemoryPoolsAffected = true, 75.69 bool recordGCBeginTime = true, 75.70 bool recordPreGCUsage = true, 75.71 bool recordPeakUsage = true, 75.72 @@ -207,6 +211,7 @@ 75.73 75.74 void initialize(bool fullGC, 75.75 GCCause::Cause cause, 75.76 + bool allMemoryPoolsAffected, 75.77 bool recordGCBeginTime, 75.78 bool recordPreGCUsage, 75.79 bool recordPeakUsage,
76.1 --- a/src/share/vm/utilities/bitMap.cpp Wed Jul 03 20:04:13 2019 +0800 76.2 +++ b/src/share/vm/utilities/bitMap.cpp Wed Jul 03 20:42:37 2019 +0800 76.3 @@ -154,14 +154,24 @@ 76.4 } 76.5 } 76.6 76.7 +bool BitMap::is_small_range_of_words(idx_t beg_full_word, idx_t end_full_word) { 76.8 + // There is little point to call large version on small ranges. 76.9 + // Need to check carefully, keeping potential idx_t underflow in mind. 76.10 + // The threshold should be at least one word. 76.11 + STATIC_ASSERT(small_range_words >= 1); 76.12 + return (beg_full_word + small_range_words >= end_full_word); 76.13 +} 76.14 + 76.15 void BitMap::set_large_range(idx_t beg, idx_t end) { 76.16 verify_range(beg, end); 76.17 76.18 idx_t beg_full_word = word_index_round_up(beg); 76.19 idx_t end_full_word = word_index(end); 76.20 76.21 - assert(end_full_word - beg_full_word >= 32, 76.22 - "the range must include at least 32 bytes"); 76.23 + if (is_small_range_of_words(beg_full_word, end_full_word)) { 76.24 + set_range(beg, end); 76.25 + return; 76.26 + } 76.27 76.28 // The range includes at least one full word. 76.29 set_range_within_word(beg, bit_index(beg_full_word)); 76.30 @@ -175,8 +185,10 @@ 76.31 idx_t beg_full_word = word_index_round_up(beg); 76.32 idx_t end_full_word = word_index(end); 76.33 76.34 - assert(end_full_word - beg_full_word >= 32, 76.35 - "the range must include at least 32 bytes"); 76.36 + if (is_small_range_of_words(beg_full_word, end_full_word)) { 76.37 + clear_range(beg, end); 76.38 + return; 76.39 + } 76.40 76.41 // The range includes at least one full word. 76.42 clear_range_within_word(beg, bit_index(beg_full_word)); 76.43 @@ -264,8 +276,10 @@ 76.44 idx_t beg_full_word = word_index_round_up(beg); 76.45 idx_t end_full_word = word_index(end); 76.46 76.47 - assert(end_full_word - beg_full_word >= 32, 76.48 - "the range must include at least 32 bytes"); 76.49 + if (is_small_range_of_words(beg_full_word, end_full_word)) { 76.50 + par_at_put_range(beg, end, value); 76.51 + return; 76.52 + } 76.53 76.54 // The range includes at least one full word. 76.55 par_put_range_within_word(beg, bit_index(beg_full_word), value);
77.1 --- a/src/share/vm/utilities/bitMap.hpp Wed Jul 03 20:04:13 2019 +0800 77.2 +++ b/src/share/vm/utilities/bitMap.hpp Wed Jul 03 20:42:37 2019 +0800 77.3 @@ -56,6 +56,10 @@ 77.4 // the bitmap appropriately if needed using factor-of-two expansion. 77.5 void at_put_grow(idx_t index, bool value); 77.6 77.7 + // Threshold for performing small range operation, even when large range 77.8 + // operation was requested. Measured in words. 77.9 + static const size_t small_range_words = 32; 77.10 + 77.11 protected: 77.12 // Return the position of bit within the word that contains it (e.g., if 77.13 // bitmap words are 32 bits, return a number 0 <= n <= 31). 77.14 @@ -97,6 +101,8 @@ 77.15 void set_large_range_of_words (idx_t beg, idx_t end); 77.16 void clear_large_range_of_words (idx_t beg, idx_t end); 77.17 77.18 + static bool is_small_range_of_words(idx_t beg_full_word, idx_t end_full_word); 77.19 + 77.20 // The index of the first full word in a range. 77.21 idx_t word_index_round_up(idx_t bit) const; 77.22
78.1 --- a/src/share/vm/utilities/bitMap.inline.hpp Wed Jul 03 20:04:13 2019 +0800 78.2 +++ b/src/share/vm/utilities/bitMap.inline.hpp Wed Jul 03 20:42:37 2019 +0800 78.3 @@ -321,10 +321,12 @@ 78.4 } 78.5 78.6 inline void BitMap::set_large_range_of_words(idx_t beg, idx_t end) { 78.7 + assert(beg <= end, "underflow"); 78.8 memset(_map + beg, ~(unsigned char)0, (end - beg) * sizeof(uintptr_t)); 78.9 } 78.10 78.11 inline void BitMap::clear_large_range_of_words(idx_t beg, idx_t end) { 78.12 + assert(beg <= end, "underflow"); 78.13 memset(_map + beg, 0, (end - beg) * sizeof(uintptr_t)); 78.14 } 78.15
79.1 --- a/src/share/vm/utilities/globalDefinitions.hpp Wed Jul 03 20:04:13 2019 +0800 79.2 +++ b/src/share/vm/utilities/globalDefinitions.hpp Wed Jul 03 20:42:37 2019 +0800 79.3 @@ -1145,10 +1145,10 @@ 79.4 79.5 //* largest i such that 2^i <= x 79.6 // A negative value of 'x' will return '31' 79.7 -inline int log2_intptr(intptr_t x) { 79.8 +inline int log2_intptr(uintptr_t x) { 79.9 int i = -1; 79.10 uintptr_t p = 1; 79.11 - while (p != 0 && p <= (uintptr_t)x) { 79.12 + while (p != 0 && p <= x) { 79.13 // p = 2^(i+1) && p <= x (i.e., 2^(i+1) <= x) 79.14 i++; p *= 2; 79.15 } 79.16 @@ -1158,11 +1158,10 @@ 79.17 } 79.18 79.19 //* largest i such that 2^i <= x 79.20 -// A negative value of 'x' will return '63' 79.21 -inline int log2_long(jlong x) { 79.22 +inline int log2_long(julong x) { 79.23 int i = -1; 79.24 julong p = 1; 79.25 - while (p != 0 && p <= (julong)x) { 79.26 + while (p != 0 && p <= x) { 79.27 // p = 2^(i+1) && p <= x (i.e., 2^(i+1) <= x) 79.28 i++; p *= 2; 79.29 } 79.30 @@ -1171,6 +1170,27 @@ 79.31 return i; 79.32 } 79.33 79.34 +inline int log2_intptr(intptr_t x) { 79.35 + return log2_intptr((uintptr_t)x); 79.36 +} 79.37 + 79.38 +inline int log2_int(int x) { 79.39 + return log2_intptr((uintptr_t)x); 79.40 +} 79.41 + 79.42 +inline int log2_jint(jint x) { 79.43 + return log2_intptr((uintptr_t)x); 79.44 +} 79.45 + 79.46 +inline int log2_uint(uint x) { 79.47 + return log2_intptr((uintptr_t)x); 79.48 +} 79.49 + 79.50 +// A negative value of 'x' will return '63' 79.51 +inline int log2_jlong(jlong x) { 79.52 + return log2_long((julong)x); 79.53 +} 79.54 + 79.55 //* the argument must be exactly a power of 2 79.56 inline int exact_log2(intptr_t x) { 79.57 #ifdef ASSERT 79.58 @@ -1210,6 +1230,29 @@ 79.59 inline bool is_odd (intx x) { return x & 1; } 79.60 inline bool is_even(intx x) { return !is_odd(x); } 79.61 79.62 +// abs methods which cannot overflow and so are well-defined across 79.63 +// the entire domain of integer types. 79.64 +static inline unsigned int uabs(unsigned int n) { 79.65 + union { 79.66 + unsigned int result; 79.67 + int value; 79.68 + }; 79.69 + result = n; 79.70 + if (value < 0) result = 0-result; 79.71 + return result; 79.72 +} 79.73 +static inline julong uabs(julong n) { 79.74 + union { 79.75 + julong result; 79.76 + jlong value; 79.77 + }; 79.78 + result = n; 79.79 + if (value < 0) result = 0-result; 79.80 + return result; 79.81 +} 79.82 +static inline julong uabs(jlong n) { return uabs((julong)n); } 79.83 +static inline unsigned int uabs(int n) { return uabs((unsigned int)n); } 79.84 + 79.85 // "to" should be greater than "from." 79.86 inline intx byte_size(void* from, void* to) { 79.87 return (address)to - (address)from; 79.88 @@ -1412,6 +1455,32 @@ 79.89 79.90 #define ARRAY_SIZE(array) (sizeof(array)/sizeof((array)[0])) 79.91 79.92 +//---------------------------------------------------------------------------------------------------- 79.93 +// Sum and product which can never overflow: they wrap, just like the 79.94 +// Java operations. Note that we don't intend these to be used for 79.95 +// general-purpose arithmetic: their purpose is to emulate Java 79.96 +// operations. 79.97 + 79.98 +// The goal of this code to avoid undefined or implementation-defined 79.99 +// behaviour. The use of an lvalue to reference cast is explicitly 79.100 +// permitted by Lvalues and rvalues [basic.lval]. [Section 3.10 Para 79.101 +// 15 in C++03] 79.102 +#define JAVA_INTEGER_OP(OP, NAME, TYPE, UNSIGNED_TYPE) \ 79.103 +inline TYPE NAME (TYPE in1, TYPE in2) { \ 79.104 + UNSIGNED_TYPE ures = static_cast<UNSIGNED_TYPE>(in1); \ 79.105 + ures OP ## = static_cast<UNSIGNED_TYPE>(in2); \ 79.106 + return reinterpret_cast<TYPE&>(ures); \ 79.107 +} 79.108 + 79.109 +JAVA_INTEGER_OP(+, java_add, jint, juint) 79.110 +JAVA_INTEGER_OP(-, java_subtract, jint, juint) 79.111 +JAVA_INTEGER_OP(*, java_multiply, jint, juint) 79.112 +JAVA_INTEGER_OP(+, java_add, jlong, julong) 79.113 +JAVA_INTEGER_OP(-, java_subtract, jlong, julong) 79.114 +JAVA_INTEGER_OP(*, java_multiply, jlong, julong) 79.115 + 79.116 +#undef JAVA_INTEGER_OP 79.117 + 79.118 // Dereference vptr 79.119 // All C++ compilers that we know of have the vtbl pointer in the first 79.120 // word. If there are exceptions, this function needs to be made compiler
80.1 --- a/src/share/vm/utilities/hashtable.cpp Wed Jul 03 20:04:13 2019 +0800 80.2 +++ b/src/share/vm/utilities/hashtable.cpp Wed Jul 03 20:42:37 2019 +0800 80.3 @@ -55,7 +55,7 @@ 80.4 if (_first_free_entry + _entry_size >= _end_block) { 80.5 int block_size = MIN2(512, MAX2((int)_table_size / 2, (int)_number_of_entries)); 80.6 int len = _entry_size * block_size; 80.7 - len = 1 << log2_intptr(len); // round down to power of 2 80.8 + len = 1 << log2_int(len); // round down to power of 2 80.9 assert(len >= _entry_size, ""); 80.10 _first_free_entry = NEW_C_HEAP_ARRAY2(char, len, F, CURRENT_PC); 80.11 _end_block = _first_free_entry + len;
81.1 --- a/src/share/vm/utilities/vmError.cpp Wed Jul 03 20:04:13 2019 +0800 81.2 +++ b/src/share/vm/utilities/vmError.cpp Wed Jul 03 20:42:37 2019 +0800 81.3 @@ -1,5 +1,5 @@ 81.4 /* 81.5 - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. 81.6 + * Copyright (c) 2003, 2019, Oracle and/or its affiliates. All rights reserved. 81.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 81.8 * 81.9 * This code is free software; you can redistribute it and/or modify it 81.10 @@ -1072,7 +1072,7 @@ 81.11 out.print_raw (cmd); 81.12 out.print_raw_cr("\" ..."); 81.13 81.14 - if (os::fork_and_exec(cmd) < 0) { 81.15 + if (os::fork_and_exec(cmd, true) < 0) { 81.16 out.print_cr("os::fork_and_exec failed: %s (%d)", strerror(errno), errno); 81.17 } 81.18 }
82.1 --- a/test/Makefile Wed Jul 03 20:04:13 2019 +0800 82.2 +++ b/test/Makefile Wed Jul 03 20:42:37 2019 +0800 82.3 @@ -262,6 +262,8 @@ 82.4 # Default JTREG to run 82.5 JTREG = $(JT_HOME)/bin/jtreg 82.6 82.7 +# Use agent mode 82.8 +JTREG_BASIC_OPTIONS += -agentvm 82.9 # Only run automatic tests 82.10 JTREG_BASIC_OPTIONS += -a 82.11 # Report details on all failed or error tests, times too
83.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 83.2 +++ b/test/compiler/integerArithmetic/MultiplyByConstantLongMax.java Wed Jul 03 20:42:37 2019 +0800 83.3 @@ -0,0 +1,45 @@ 83.4 +/* 83.5 + * Copyright (c) 2018, Red Hat, Inc. All rights reserved. 83.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 83.7 + * 83.8 + * This code is free software; you can redistribute it and/or modify it 83.9 + * under the terms of the GNU General Public License version 2 only, as 83.10 + * published by the Free Software Foundation. 83.11 + * 83.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 83.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 83.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 83.15 + * version 2 for more details (a copy is included in the LICENSE file that 83.16 + * accompanied this code). 83.17 + * 83.18 + * You should have received a copy of the GNU General Public License version 83.19 + * 2 along with this work; if not, write to the Free Software Foundation, 83.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 83.21 + * 83.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 83.23 + * or visit www.oracle.com if you need additional information or have any 83.24 + * questions. 83.25 + */ 83.26 + 83.27 +/** 83.28 + * @test 83.29 + * @bug 8214189 83.30 + * @summary test/hotspot/jtreg/compiler/intrinsics/mathexact/MulExactLConstantTest.java fails on Windows x64 when run with -XX:-TieredCompilation 83.31 + * 83.32 + * @run main/othervm -XX:-TieredCompilation -XX:-BackgroundCompilation -XX:-UseOnStackReplacement MultiplyByConstantLongMax 83.33 + * 83.34 + */ 83.35 + 83.36 +public class MultiplyByConstantLongMax { 83.37 + public static void main(String[] args) { 83.38 + for (int i = 0; i < 20_000; i++) { 83.39 + if (test(1) != Long.MAX_VALUE) { 83.40 + throw new RuntimeException("incorrect result"); 83.41 + } 83.42 + } 83.43 + } 83.44 + 83.45 + private static long test(long v) { 83.46 + return v * Long.MAX_VALUE; 83.47 + } 83.48 +}
84.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 84.2 +++ b/test/compiler/integerArithmetic/MultiplyByIntegerMinHang.java Wed Jul 03 20:42:37 2019 +0800 84.3 @@ -0,0 +1,64 @@ 84.4 +/* 84.5 + * Copyright (c) 2018, Red Hat, Inc. All rights reserved. 84.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 84.7 + * 84.8 + * This code is free software; you can redistribute it and/or modify it 84.9 + * under the terms of the GNU General Public License version 2 only, as 84.10 + * published by the Free Software Foundation. 84.11 + * 84.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 84.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 84.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 84.15 + * version 2 for more details (a copy is included in the LICENSE file that 84.16 + * accompanied this code). 84.17 + * 84.18 + * You should have received a copy of the GNU General Public License version 84.19 + * 2 along with this work; if not, write to the Free Software Foundation, 84.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 84.21 + * 84.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 84.23 + * or visit www.oracle.com if you need additional information or have any 84.24 + * questions. 84.25 + */ 84.26 + 84.27 +/** 84.28 + * @test 84.29 + * @bug 8213419 84.30 + * @summary C2 may hang in MulLNode::Ideal()/MulINode::Ideal() with gcc 8.2.1 84.31 + * 84.32 + * @run main/othervm -XX:-TieredCompilation -XX:-BackgroundCompilation -XX:-UseOnStackReplacement MultiplyByIntegerMinHang 84.33 + * 84.34 + */ 84.35 + 84.36 +public class MultiplyByIntegerMinHang { 84.37 + public static void main(String[] args) { 84.38 + for (int i = 0; i < 20_000; i++) { 84.39 + if (test1(0) != 0) { 84.40 + throw new RuntimeException("incorrect result"); 84.41 + } 84.42 + if (test1(1) != Integer.MIN_VALUE) { 84.43 + throw new RuntimeException("incorrect result"); 84.44 + } 84.45 + if (test1(2) != 0) { 84.46 + throw new RuntimeException("incorrect result"); 84.47 + } 84.48 + if (test2(0) != 0) { 84.49 + throw new RuntimeException("incorrect result"); 84.50 + } 84.51 + if (test2(1) != Long.MIN_VALUE) { 84.52 + throw new RuntimeException("incorrect result"); 84.53 + } 84.54 + if (test2(2) != 0) { 84.55 + throw new RuntimeException("incorrect result"); 84.56 + } 84.57 + } 84.58 + } 84.59 + 84.60 + private static int test1(int v) { 84.61 + return v * Integer.MIN_VALUE; 84.62 + } 84.63 + 84.64 + private static long test2(long v) { 84.65 + return v * Long.MIN_VALUE; 84.66 + } 84.67 +}
85.1 --- a/test/compiler/jsr292/RedefineMethodUsedByMultipleMethodHandles.java Wed Jul 03 20:04:13 2019 +0800 85.2 +++ b/test/compiler/jsr292/RedefineMethodUsedByMultipleMethodHandles.java Wed Jul 03 20:42:37 2019 +0800 85.3 @@ -26,7 +26,7 @@ 85.4 * @bug 8042235 85.5 * @summary redefining method used by multiple MethodHandles crashes VM 85.6 * @compile -XDignore.symbol.file RedefineMethodUsedByMultipleMethodHandles.java 85.7 - * @run main RedefineMethodUsedByMultipleMethodHandles 85.8 + * @run main/othervm RedefineMethodUsedByMultipleMethodHandles 85.9 */ 85.10 85.11 import java.io.*;
86.1 --- a/test/compiler/rtm/locking/TestRTMTotalCountIncrRate.java Wed Jul 03 20:04:13 2019 +0800 86.2 +++ b/test/compiler/rtm/locking/TestRTMTotalCountIncrRate.java Wed Jul 03 20:42:37 2019 +0800 86.3 @@ -1,5 +1,5 @@ 86.4 /* 86.5 - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. 86.6 + * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. 86.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 86.8 * 86.9 * This code is free software; you can redistribute it and/or modify it 86.10 @@ -34,6 +34,7 @@ 86.11 * -XX:+WhiteBoxAPI TestRTMTotalCountIncrRate 86.12 */ 86.13 86.14 +import sun.misc.Unsafe; 86.15 import java.util.List; 86.16 86.17 import com.oracle.java.testlibrary.*; 86.18 @@ -96,14 +97,12 @@ 86.19 Asserts.assertEQ(lock.getTotalLocks(), Test.TOTAL_ITERATIONS, 86.20 "Total locks should be exactly the same as amount of " 86.21 + "iterations."); 86.22 - } else { 86.23 - Asserts.assertGT(lock.getTotalLocks(), 0L, "RTM statistics " 86.24 - + "should contain information for at least on lock."); 86.25 } 86.26 } 86.27 86.28 public static class Test implements CompilableTest { 86.29 private static final long TOTAL_ITERATIONS = 10000L; 86.30 + private static final Unsafe UNSAFE = Utils.getUnsafe(); 86.31 private final Object monitor = new Object(); 86.32 // Following field have to be static in order to avoid escape analysis. 86.33 @SuppressWarnings("UnsuedDeclaration") 86.34 @@ -119,8 +118,17 @@ 86.35 return new String[] { getMethodWithLockName() }; 86.36 } 86.37 86.38 - public void lock() { 86.39 + public void lock(boolean forceAbort) { 86.40 synchronized(monitor) { 86.41 + if (forceAbort) { 86.42 + // We're calling native method in order to force 86.43 + // abort. It's done by explicit xabort call emitted 86.44 + // in SharedRuntime::generate_native_wrapper. 86.45 + // If an actual JNI call will be replaced by 86.46 + // intrinsic - we'll be in trouble, since xabort 86.47 + // will be no longer called and test may fail. 86.48 + UNSAFE.addressSize(); 86.49 + } 86.50 Test.field++; 86.51 } 86.52 } 86.53 @@ -139,7 +147,11 @@ 86.54 for (long i = 0L; i < Test.TOTAL_ITERATIONS; i++) { 86.55 AbortProvoker.verifyMonitorState(test.monitor, 86.56 shouldBeInflated); 86.57 - test.lock(); 86.58 + // Force abort on first iteration to avoid rare case when 86.59 + // there were no aborts and locks count was not incremented 86.60 + // with RTMTotalCountIncrRate > 1 (in such case JVM won't 86.61 + // print JVM locking statistics). 86.62 + test.lock(i == 0); 86.63 } 86.64 } 86.65 }
87.1 --- a/test/compiler/rtm/print/TestPrintPreciseRTMLockingStatistics.java Wed Jul 03 20:04:13 2019 +0800 87.2 +++ b/test/compiler/rtm/print/TestPrintPreciseRTMLockingStatistics.java Wed Jul 03 20:42:37 2019 +0800 87.3 @@ -124,9 +124,6 @@ 87.4 87.5 RTMLockingStatistics lock = statistics.get(0); 87.6 87.7 - Asserts.assertGT(lock.getTotalLocks(), 0L, "RTM locking statistics " 87.8 - + "should contain non zero total locks count"); 87.9 - 87.10 Asserts.assertGT(lock.getTotalAborts(), 0L, 87.11 "RTM locking statistics should contain non zero total aborts " 87.12 + "count");
88.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 88.2 +++ b/test/gc/TestMemoryMXBeansAndPoolsPresence.java Wed Jul 03 20:42:37 2019 +0800 88.3 @@ -0,0 +1,101 @@ 88.4 +/* 88.5 + * Copyright (c) 2017, 2019, Oracle and/or its affiliates. All rights reserved. 88.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 88.7 + * 88.8 + * This code is free software; you can redistribute it and/or modify it 88.9 + * under the terms of the GNU General Public License version 2 only, as 88.10 + * published by the Free Software Foundation. 88.11 + * 88.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 88.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 88.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 88.15 + * version 2 for more details (a copy is included in the LICENSE file that 88.16 + * accompanied this code). 88.17 + * 88.18 + * You should have received a copy of the GNU General Public License version 88.19 + * 2 along with this work; if not, write to the Free Software Foundation, 88.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 88.21 + * 88.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 88.23 + * or visit www.oracle.com if you need additional information or have any 88.24 + * questions. 88.25 + */ 88.26 + 88.27 +/* @test TestMemoryMXBeansAndPoolsPresence 88.28 + * @key gc 88.29 + * @bug 8191564 88.30 + * @summary Tests that GarbageCollectorMXBeans and GC MemoryPools are created. 88.31 + * @library /testlibrary 88.32 + * @requires vm.gc == null 88.33 + * @run main/othervm -XX:+UseParallelGC TestMemoryMXBeansAndPoolsPresence Parallel 88.34 + * @run main/othervm -XX:+UseSerialGC TestMemoryMXBeansAndPoolsPresence Serial 88.35 + * @run main/othervm -XX:+UseConcMarkSweepGC TestMemoryMXBeansAndPoolsPresence CMS 88.36 + * @run main/othervm -XX:+UseG1GC TestMemoryMXBeansAndPoolsPresence G1 88.37 + */ 88.38 + 88.39 +import java.util.List; 88.40 +import java.util.ArrayList; 88.41 +import java.lang.management.*; 88.42 +import java.util.stream.*; 88.43 + 88.44 +import com.oracle.java.testlibrary.Asserts; 88.45 + 88.46 +class GCBeanDescription { 88.47 + public String name; 88.48 + public String[] poolNames; 88.49 + 88.50 + public GCBeanDescription(String name, String[] poolNames) { 88.51 + this.name = name; 88.52 + this.poolNames = poolNames; 88.53 + } 88.54 +} 88.55 + 88.56 +public class TestMemoryMXBeansAndPoolsPresence { 88.57 + public static void test(GCBeanDescription... expectedBeans) { 88.58 + List<MemoryPoolMXBean> memoryPools = ManagementFactory.getMemoryPoolMXBeans(); 88.59 + 88.60 + List<GarbageCollectorMXBean> gcBeans = ManagementFactory.getGarbageCollectorMXBeans(); 88.61 + Asserts.assertEQ(expectedBeans.length, gcBeans.size()); 88.62 + 88.63 + for (GCBeanDescription desc : expectedBeans) { 88.64 + List<GarbageCollectorMXBean> beans = gcBeans.stream() 88.65 + .filter(b -> b.getName().equals(desc.name)) 88.66 + .collect(Collectors.toList()); 88.67 + Asserts.assertEQ(beans.size(), 1); 88.68 + 88.69 + GarbageCollectorMXBean bean = beans.get(0); 88.70 + Asserts.assertEQ(desc.name, bean.getName()); 88.71 + 88.72 + String[] pools = bean.getMemoryPoolNames(); 88.73 + Asserts.assertEQ(desc.poolNames.length, pools.length); 88.74 + for (int i = 0; i < desc.poolNames.length; i++) { 88.75 + Asserts.assertEQ(desc.poolNames[i], pools[i]); 88.76 + } 88.77 + } 88.78 + } 88.79 + 88.80 + public static void main(String[] args) { 88.81 + switch (args[0]) { 88.82 + case "G1": 88.83 + test(new GCBeanDescription("G1 Young Generation", new String[] {"G1 Eden Space", "G1 Survivor Space", "G1 Old Gen"}), 88.84 + new GCBeanDescription("G1 Old Generation", new String[] {"G1 Eden Space", "G1 Survivor Space", "G1 Old Gen"})); 88.85 + break; 88.86 + case "CMS": 88.87 + test(new GCBeanDescription("ParNew", new String[] {"Par Eden Space", "Par Survivor Space"}), 88.88 + new GCBeanDescription("ConcurrentMarkSweep", new String[] {"Par Eden Space", "Par Survivor Space", "CMS Old Gen"})); 88.89 + break; 88.90 + case "Parallel": 88.91 + test(new GCBeanDescription("PS Scavenge", new String[] {"PS Eden Space", "PS Survivor Space"}), 88.92 + new GCBeanDescription("PS MarkSweep", new String[] {"PS Eden Space", "PS Survivor Space", "PS Old Gen"})); 88.93 + break; 88.94 + case "Serial": 88.95 + test(new GCBeanDescription("Copy", new String[] {"Eden Space", "Survivor Space"}), 88.96 + new GCBeanDescription("MarkSweepCompact", new String[] {"Eden Space", "Survivor Space", "Tenured Gen"})); 88.97 + break; 88.98 + default: 88.99 + Asserts.assertTrue(false); 88.100 + break; 88.101 + 88.102 + } 88.103 + } 88.104 +}
89.1 --- a/test/gc/arguments/TestG1HeapRegionSize.java Wed Jul 03 20:04:13 2019 +0800 89.2 +++ b/test/gc/arguments/TestG1HeapRegionSize.java Wed Jul 03 20:42:37 2019 +0800 89.3 @@ -1,5 +1,5 @@ 89.4 /* 89.5 -* Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved. 89.6 +* Copyright (c) 2013, 2018, Oracle and/or its affiliates. All rights reserved. 89.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 89.8 * 89.9 * This code is free software; you can redistribute it and/or modify it 89.10 @@ -25,12 +25,11 @@ 89.11 * @test TestG1HeapRegionSize 89.12 * @key gc 89.13 * @bug 8021879 89.14 - * @requires vm.gc=="G1" | vm.gc=="null" 89.15 * @summary Verify that the flag G1HeapRegionSize is updated properly 89.16 * @run main/othervm -Xmx64m TestG1HeapRegionSize 1048576 89.17 - * @run main/othervm -XX:G1HeapRegionSize=2m -Xmx64m -XX:+UseG1GC TestG1HeapRegionSize 2097152 89.18 - * @run main/othervm -XX:G1HeapRegionSize=3m -Xmx64m -XX:+UseG1GC TestG1HeapRegionSize 2097152 89.19 - * @run main/othervm -XX:G1HeapRegionSize=64m -Xmx256m -XX:+UseG1GC TestG1HeapRegionSize 33554432 89.20 + * @run main/othervm -XX:G1HeapRegionSize=2m -Xmx64m TestG1HeapRegionSize 2097152 89.21 + * @run main/othervm -XX:G1HeapRegionSize=3m -Xmx64m TestG1HeapRegionSize 2097152 89.22 + * @run main/othervm -XX:G1HeapRegionSize=64m -Xmx256m TestG1HeapRegionSize 33554432 89.23 */ 89.24 89.25 import sun.management.ManagementFactoryHelper; 89.26 @@ -43,7 +42,13 @@ 89.27 HotSpotDiagnosticMXBean diagnostic = ManagementFactoryHelper.getDiagnosticMXBean(); 89.28 89.29 String expectedValue = getExpectedValue(args); 89.30 - VMOption option = diagnostic.getVMOption("G1HeapRegionSize"); 89.31 + VMOption option = diagnostic.getVMOption("UseG1GC"); 89.32 + if (option.getValue().equals("false")) { 89.33 + System.out.println("Skipping this test. It is only a G1 test."); 89.34 + return; 89.35 + } 89.36 + 89.37 + option = diagnostic.getVMOption("G1HeapRegionSize"); 89.38 if (!expectedValue.equals(option.getValue())) { 89.39 throw new RuntimeException("Wrong value for G1HeapRegionSize. Expected " + expectedValue + " but got " + option.getValue()); 89.40 }
90.1 --- a/test/gc/arguments/TestMaxHeapSizeTools.java Wed Jul 03 20:04:13 2019 +0800 90.2 +++ b/test/gc/arguments/TestMaxHeapSizeTools.java Wed Jul 03 20:42:37 2019 +0800 90.3 @@ -41,8 +41,8 @@ 90.4 public long initialHeapSize; 90.5 public long maxHeapSize; 90.6 90.7 - public long minAlignment; 90.8 - public long maxAlignment; 90.9 + public long spaceAlignment; 90.10 + public long heapAlignment; 90.11 } 90.12 90.13 class TestMaxHeapSizeTools { 90.14 @@ -192,7 +192,7 @@ 90.15 // Unfortunately there is no other way to retrieve the minimum heap size and 90.16 // the alignments. 90.17 90.18 - Matcher m = Pattern.compile("Minimum heap \\d+ Initial heap \\d+ Maximum heap \\d+ Min alignment \\d+ Max alignment \\d+"). 90.19 + Matcher m = Pattern.compile("Minimum heap \\d+ Initial heap \\d+ Maximum heap \\d+ Space alignment \\d+ Heap alignment \\d+"). 90.20 matcher(output.getStdout()); 90.21 if (!m.find()) { 90.22 throw new RuntimeException("Could not find heap size string."); 90.23 @@ -204,8 +204,8 @@ 90.24 val.minHeapSize = valueAfter(match, "Minimum heap "); 90.25 val.initialHeapSize = valueAfter(match, "Initial heap "); 90.26 val.maxHeapSize = valueAfter(match, "Maximum heap "); 90.27 - val.minAlignment = valueAfter(match, "Min alignment "); 90.28 - val.maxAlignment = valueAfter(match, "Max alignment "); 90.29 + val.spaceAlignment = valueAfter(match, "Space alignment "); 90.30 + val.heapAlignment = valueAfter(match, "Heap alignment "); 90.31 } 90.32 90.33 /** 90.34 @@ -218,12 +218,12 @@ 90.35 MinInitialMaxValues v = new MinInitialMaxValues(); 90.36 getMinInitialMaxHeap(args, v); 90.37 90.38 - if ((expectedMin != -1) && (align_up(expectedMin, v.minAlignment) != v.minHeapSize)) { 90.39 + if ((expectedMin != -1) && (align_up(expectedMin, v.heapAlignment) != v.minHeapSize)) { 90.40 throw new RuntimeException("Actual minimum heap size of " + v.minHeapSize + 90.41 " differs from expected minimum heap size of " + expectedMin); 90.42 } 90.43 90.44 - if ((expectedInitial != -1) && (align_up(expectedInitial, v.minAlignment) != v.initialHeapSize)) { 90.45 + if ((expectedInitial != -1) && (align_up(expectedInitial, v.heapAlignment) != v.initialHeapSize)) { 90.46 throw new RuntimeException("Actual initial heap size of " + v.initialHeapSize + 90.47 " differs from expected initial heap size of " + expectedInitial); 90.48 } 90.49 @@ -247,7 +247,7 @@ 90.50 MinInitialMaxValues v = new MinInitialMaxValues(); 90.51 getMinInitialMaxHeap(new String[] { gcflag, "-XX:MaxHeapSize=" + maxHeapsize + "M" }, v); 90.52 90.53 - long expectedHeapSize = align_up(maxHeapsize * K * K, v.maxAlignment); 90.54 + long expectedHeapSize = align_up(maxHeapsize * K * K, v.heapAlignment); 90.55 long actualHeapSize = v.maxHeapSize; 90.56 90.57 if (actualHeapSize > expectedHeapSize) {
91.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 91.2 +++ b/test/gc/g1/mixedgc/TestOldGenCollectionUsage.java Wed Jul 03 20:42:37 2019 +0800 91.3 @@ -0,0 +1,231 @@ 91.4 +/* 91.5 + * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved. 91.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 91.7 + * 91.8 + * This code is free software; you can redistribute it and/or modify it 91.9 + * under the terms of the GNU General Public License version 2 only, as 91.10 + * published by the Free Software Foundation. 91.11 + * 91.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 91.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 91.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 91.15 + * version 2 for more details (a copy is included in the LICENSE file that 91.16 + * accompanied this code). 91.17 + * 91.18 + * You should have received a copy of the GNU General Public License version 91.19 + * 2 along with this work; if not, write to the Free Software Foundation, 91.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 91.21 + * 91.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 91.23 + * or visit www.oracle.com if you need additional information or have any 91.24 + * questions. 91.25 + */ 91.26 + 91.27 +/* 91.28 + * @test TestOldGenCollectionUsage.java 91.29 + * @bug 8195115 91.30 + * @summary G1 Old Gen's CollectionUsage.used is zero after mixed GC which is incorrect 91.31 + * @key gc 91.32 + * @requires vm.gc=="G1" | vm.gc=="null" 91.33 + * @library /testlibrary /testlibrary/whitebox 91.34 + * @build ClassFileInstaller com.oracle.java.testlibrary.* sun.hotspot.WhiteBox TestOldGenCollectionUsage 91.35 + * @run main ClassFileInstaller sun.hotspot.WhiteBox 91.36 + * sun.hotspot.WhiteBox$WhiteBoxPermission 91.37 + * @run main/othervm -Xbootclasspath/a:. -XX:+UseG1GC -XX:+UnlockExperimentalVMOptions -XX:+UnlockDiagnosticVMOptions 91.38 + * -XX:+WhiteBoxAPI -verbose:gc -XX:SurvivorRatio=1 -Xmx14m -Xms14m -XX:MaxTenuringThreshold=1 91.39 + * -XX:InitiatingHeapOccupancyPercent=100 -XX:G1MixedGCCountTarget=4 -XX:MaxGCPauseMillis=30000 91.40 + * -XX:G1HeapRegionSize=1m -XX:G1HeapWastePercent=0 -XX:G1MixedGCLiveThresholdPercent=100 91.41 + * TestOldGenCollectionUsage 91.42 + */ 91.43 + 91.44 +import com.oracle.java.testlibrary.Asserts; 91.45 +import sun.hotspot.WhiteBox; 91.46 + 91.47 +import java.util.ArrayList; 91.48 +import java.util.List; 91.49 +import java.util.Collections; 91.50 + 91.51 +import java.lang.management.*; 91.52 + 91.53 +// 8195115 says that for the "G1 Old Gen" MemoryPool, CollectionUsage.used 91.54 +// is zero for G1 after a mixed collection, which is incorrect. 91.55 + 91.56 +public class TestOldGenCollectionUsage { 91.57 + 91.58 + private String poolName = "G1 Old Gen"; 91.59 + private String collectorName = "G1 Young Generation"; 91.60 + 91.61 + public static void main(String [] args) throws Exception { 91.62 + TestOldGenCollectionUsage t = new TestOldGenCollectionUsage(); 91.63 + t.run(); 91.64 + } 91.65 + 91.66 + public TestOldGenCollectionUsage() { 91.67 + System.out.println("Monitor G1 Old Gen pool with G1 Young Generation collector."); 91.68 + } 91.69 + 91.70 + public void run() { 91.71 + // Find memory pool and collector 91.72 + List<MemoryPoolMXBean> pools = ManagementFactory.getMemoryPoolMXBeans(); 91.73 + MemoryPoolMXBean pool = null; 91.74 + boolean foundPool = false; 91.75 + for (int i = 0; i < pools.size(); i++) { 91.76 + pool = pools.get(i); 91.77 + String name = pool.getName(); 91.78 + if (name.contains(poolName)) { 91.79 + System.out.println("Found pool: " + name); 91.80 + foundPool = true; 91.81 + break; 91.82 + } 91.83 + } 91.84 + if (!foundPool) { 91.85 + throw new RuntimeException(poolName + " not found, test with -XX:+UseG1GC"); 91.86 + } 91.87 + 91.88 + List<GarbageCollectorMXBean> collectors = ManagementFactory.getGarbageCollectorMXBeans(); 91.89 + GarbageCollectorMXBean collector = null; 91.90 + boolean foundCollector = false; 91.91 + for (int i = 0; i < collectors.size(); i++) { 91.92 + collector = collectors.get(i); 91.93 + String name = collector.getName(); 91.94 + if (name.contains(collectorName)) { 91.95 + System.out.println("Found collector: " + name); 91.96 + foundCollector = true; 91.97 + break; 91.98 + } 91.99 + } 91.100 + if (!foundCollector) { 91.101 + throw new RuntimeException(collectorName + " not found, test with -XX:+UseG1GC"); 91.102 + } 91.103 + 91.104 + MixedGCProvoker gcProvoker = new MixedGCProvoker(); 91.105 + gcProvoker.allocateOldObjects(); 91.106 + 91.107 + // Verify no non-zero result was stored 91.108 + long usage = pool.getCollectionUsage().getUsed(); 91.109 + System.out.println(poolName + ": usage after GC = " + usage); 91.110 + if (usage > 0) { 91.111 + throw new RuntimeException("Premature mixed collections(s)"); 91.112 + } 91.113 + 91.114 + // Verify that collections were done 91.115 + long collectionCount = collector.getCollectionCount(); 91.116 + System.out.println(collectorName + ": collection count = " 91.117 + + collectionCount); 91.118 + long collectionTime = collector.getCollectionTime(); 91.119 + System.out.println(collectorName + ": collection time = " 91.120 + + collectionTime); 91.121 + if (collectionCount <= 0) { 91.122 + throw new RuntimeException("Collection count <= 0"); 91.123 + } 91.124 + if (collectionTime <= 0) { 91.125 + throw new RuntimeException("Collector has not run"); 91.126 + } 91.127 + 91.128 + gcProvoker.provokeMixedGC(); 91.129 + 91.130 + usage = pool.getCollectionUsage().getUsed(); 91.131 + System.out.println(poolName + ": usage after GC = " + usage); 91.132 + if (usage <= 0) { 91.133 + throw new RuntimeException(poolName + " found with zero usage"); 91.134 + } 91.135 + 91.136 + long newCollectionCount = collector.getCollectionCount(); 91.137 + System.out.println(collectorName + ": collection count = " 91.138 + + newCollectionCount); 91.139 + long newCollectionTime = collector.getCollectionTime(); 91.140 + System.out.println(collectorName + ": collection time = " 91.141 + + newCollectionTime); 91.142 + if (newCollectionCount <= collectionCount) { 91.143 + throw new RuntimeException("No new collection"); 91.144 + } 91.145 + if (newCollectionTime <= collectionTime) { 91.146 + throw new RuntimeException("Collector has not run some more"); 91.147 + } 91.148 + 91.149 + System.out.println("Test passed."); 91.150 + } 91.151 + 91.152 + /** 91.153 + * Utility class to guarantee a mixed GC. The class allocates several arrays and 91.154 + * promotes them to the oldgen. After that it tries to provoke mixed GC by 91.155 + * allocating new objects. 91.156 + * 91.157 + * The necessary condition for guaranteed mixed GC is running MixedGCProvoker is 91.158 + * running in VM with the following flags: -XX:MaxTenuringThreshold=1 -Xms12M 91.159 + * -Xmx12M -XX:G1MixedGCLiveThresholdPercent=100 -XX:G1HeapWastePercent=0 91.160 + * -XX:G1HeapRegionSize=1m 91.161 + */ 91.162 + public class MixedGCProvoker { 91.163 + private final WhiteBox WB = WhiteBox.getWhiteBox(); 91.164 + private final List<byte[]> liveOldObjects = new ArrayList<>(); 91.165 + private final List<byte[]> newObjects = new ArrayList<>(); 91.166 + 91.167 + public static final int ALLOCATION_SIZE = 20000; 91.168 + public static final int ALLOCATION_COUNT = 15; 91.169 + 91.170 + public void allocateOldObjects() { 91.171 + List<byte[]> deadOldObjects = new ArrayList<>(); 91.172 + // Allocates buffer and promotes it to the old gen. Mix live and dead old 91.173 + // objects 91.174 + for (int i = 0; i < ALLOCATION_COUNT; ++i) { 91.175 + liveOldObjects.add(new byte[ALLOCATION_SIZE * 5]); 91.176 + deadOldObjects.add(new byte[ALLOCATION_SIZE * 5]); 91.177 + } 91.178 + 91.179 + // Do two young collections, MaxTenuringThreshold=1 will force promotion. 91.180 + // G1HeapRegionSize=1m guarantees that old gen regions will be filled. 91.181 + WB.youngGC(); 91.182 + WB.youngGC(); 91.183 + // Check it is promoted & keep alive 91.184 + Asserts.assertTrue(WB.isObjectInOldGen(liveOldObjects), 91.185 + "List of the objects is suppose to be in OldGen"); 91.186 + Asserts.assertTrue(WB.isObjectInOldGen(deadOldObjects), 91.187 + "List of the objects is suppose to be in OldGen"); 91.188 + } 91.189 + 91.190 + /** 91.191 + * Waits until Concurent Mark Cycle finishes 91.192 + * @param wb Whitebox instance 91.193 + * @param sleepTime sleep time 91.194 + */ 91.195 + private void waitTillCMCFinished(int sleepTime) { 91.196 + while (WB.g1InConcurrentMark()) { 91.197 + if (sleepTime > -1) { 91.198 + try { 91.199 + Thread.sleep(sleepTime); 91.200 + } catch (InterruptedException e) { 91.201 + System.out.println("Got InterruptedException while waiting for ConcMarkCycle to finish"); 91.202 + } 91.203 + } 91.204 + } 91.205 + } 91.206 + 91.207 + public void provokeMixedGC() { 91.208 + waitTillCMCFinished(0); 91.209 + WB.g1StartConcMarkCycle(); 91.210 + waitTillCMCFinished(0); 91.211 + WB.youngGC(); 91.212 + 91.213 + System.out.println("Allocating new objects to provoke mixed GC"); 91.214 + // Provoke a mixed collection. G1MixedGCLiveThresholdPercent=100 91.215 + // guarantees that full old gen regions will be included. 91.216 + for (int i = 0; i < (ALLOCATION_COUNT * 20); i++) { 91.217 + try { 91.218 + newObjects.add(new byte[ALLOCATION_SIZE]); 91.219 + } catch (OutOfMemoryError e) { 91.220 + newObjects.clear(); 91.221 + WB.youngGC(); 91.222 + WB.youngGC(); 91.223 + System.out.println("OutOfMemoryError is reported, stop allocating new objects"); 91.224 + break; 91.225 + } 91.226 + } 91.227 + // check that liveOldObjects still alive 91.228 + Asserts.assertTrue(WB.isObjectInOldGen(liveOldObjects), 91.229 + "List of the objects is suppose to be in OldGen"); 91.230 + } 91.231 + 91.232 + } 91.233 + 91.234 +}
92.1 --- a/test/runtime/6981737/Test6981737.java Wed Jul 03 20:04:13 2019 +0800 92.2 +++ b/test/runtime/6981737/Test6981737.java Wed Jul 03 20:42:37 2019 +0800 92.3 @@ -48,8 +48,6 @@ 92.4 vendor_re = "Sun Microsystems Inc\\."; 92.5 vm_spec_version_re = "1\\.0"; 92.6 } 92.7 - verifyProperty("java.vendor", vendor_re); 92.8 - verifyProperty("java.vm.vendor", vendor_re); 92.9 verifyProperty("java.vm.specification.vendor", vendor_re); 92.10 verifyProperty("java.specification.vendor", vendor_re); 92.11 verifyProperty("java.vm.specification.version", vm_spec_version_re);
93.1 --- a/test/runtime/ErrorHandling/TestCrashOnOutOfMemoryError.java Wed Jul 03 20:04:13 2019 +0800 93.2 +++ b/test/runtime/ErrorHandling/TestCrashOnOutOfMemoryError.java Wed Jul 03 20:42:37 2019 +0800 93.3 @@ -25,7 +25,7 @@ 93.4 * @test TestCrashOnOutOfMemoryError 93.5 * @summary Test using -XX:+CrashOnOutOfMemoryError 93.6 * @library /testlibrary 93.7 - * @build jdk.test.lib.* 93.8 + * @build com.oracle.java.testlibrary.* 93.9 * @run driver TestCrashOnOutOfMemoryError 93.10 * @bug 8138745 93.11 */
94.1 --- a/test/runtime/ErrorHandling/TestExitOnOutOfMemoryError.java Wed Jul 03 20:04:13 2019 +0800 94.2 +++ b/test/runtime/ErrorHandling/TestExitOnOutOfMemoryError.java Wed Jul 03 20:42:37 2019 +0800 94.3 @@ -25,7 +25,7 @@ 94.4 * @test TestExitOnOutOfMemoryError 94.5 * @summary Test using -XX:ExitOnOutOfMemoryError 94.6 * @library /testlibrary 94.7 - * @build jdk.test.lib.* 94.8 + * @build com.oracle.java.testlibrary.* 94.9 * @run driver TestExitOnOutOfMemoryError 94.10 * @bug 8138745 94.11 */
95.1 --- a/test/runtime/NMT/JcmdDetailDiff.java Wed Jul 03 20:04:13 2019 +0800 95.2 +++ b/test/runtime/NMT/JcmdDetailDiff.java Wed Jul 03 20:42:37 2019 +0800 95.3 @@ -26,7 +26,6 @@ 95.4 * @summary run NMT baseline, allocate memory and verify output from detail.diff 95.5 * @key nmt jcmd 95.6 * @library /testlibrary /testlibrary/whitebox 95.7 - * @ignore 95.8 * @build JcmdDetailDiff 95.9 * @run main ClassFileInstaller sun.hotspot.WhiteBox 95.10 * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -XX:NativeMemoryTracking=detail JcmdDetailDiff
96.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 96.2 +++ b/test/runtime/NMT/MallocSiteTypeChange.java Wed Jul 03 20:42:37 2019 +0800 96.3 @@ -0,0 +1,69 @@ 96.4 +/* 96.5 + * Copyright (c) 2019, Red Hat, Inc. All rights reserved. 96.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 96.7 + * 96.8 + * This code is free software; you can redistribute it and/or modify it 96.9 + * under the terms of the GNU General Public License version 2 only, as 96.10 + * published by the Free Software Foundation. 96.11 + * 96.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 96.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 96.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 96.15 + * version 2 for more details (a copy is included in the LICENSE file that 96.16 + * accompanied this code). 96.17 + * 96.18 + * You should have received a copy of the GNU General Public License version 96.19 + * 2 along with this work; if not, write to the Free Software Foundation, 96.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 96.21 + * 96.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 96.23 + * or visit www.oracle.com if you need additional information or have any 96.24 + * questions. 96.25 + * 96.26 + */ 96.27 + 96.28 +/* 96.29 + * @test MallocSiteTypeChange 96.30 + * @summary Test a malloc site type change results NMT to report deallocation of old type and allocation of new type 96.31 + * @bug 8200109 96.32 + * @key nmt jcmd 96.33 + * @modules java.base/jdk.internal.misc 96.34 + * @library /testlibrary /testlibrary/whitebox 96.35 + * @build sun.hotspot.WhiteBox 96.36 + * @run driver ClassFileInstaller sun.hotspot.WhiteBox 96.37 + * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -XX:NativeMemoryTracking=detail MallocSiteTypeChange 96.38 + */ 96.39 + 96.40 +import com.oracle.java.testlibrary.*; 96.41 +import sun.hotspot.WhiteBox; 96.42 + 96.43 +public class MallocSiteTypeChange { 96.44 + public static void main(String args[]) throws Exception { 96.45 + OutputAnalyzer output; 96.46 + WhiteBox wb = WhiteBox.getWhiteBox(); 96.47 + 96.48 + // Grab my own PID 96.49 + String pid = Long.toString(ProcessTools.getProcessId()); 96.50 + ProcessBuilder pb = new ProcessBuilder(); 96.51 + 96.52 + int pc = 1; 96.53 + long addr = wb.NMTMallocWithPseudoStack(4 * 1024, pc); 96.54 + 96.55 + // Verify that current tracking level is "detail" 96.56 + pb.command(new String[] { JDKToolFinder.getJDKTool("jcmd"), pid, "VM.native_memory", "summary"}); 96.57 + output = new OutputAnalyzer(pb.start()); 96.58 + output.shouldContain("Test (reserved=4KB, committed=4KB)"); 96.59 + 96.60 + pb.command(new String[] { JDKToolFinder.getJDKTool("jcmd"), pid, "VM.native_memory", "baseline"}); 96.61 + output = new OutputAnalyzer(pb.start()); 96.62 + output.shouldContain("Baseline succeeded"); 96.63 + 96.64 + wb.NMTFree(addr); 96.65 + addr = wb.NMTMallocWithPseudoStackAndType(2 * 1024, pc, 7 /* mtInternal */ ); 96.66 + pb.command(new String[] { JDKToolFinder.getJDKTool("jcmd"), pid, "VM.native_memory", "detail.diff"}); 96.67 + output = new OutputAnalyzer(pb.start()); 96.68 + output.shouldContain("(malloc=0KB type=Test -4KB)"); 96.69 + output.shouldContain("(malloc=2KB type=Internal +2KB #1 +1)"); 96.70 + output.shouldHaveExitValue(0); 96.71 + } 96.72 +}
97.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 97.2 +++ b/test/runtime/StackGap/T.java Wed Jul 03 20:42:37 2019 +0800 97.3 @@ -0,0 +1,33 @@ 97.4 +/* 97.5 + * Copyright (c) 2018, Red Hat, Inc. All rights reserved. 97.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 97.7 + * 97.8 + * This code is free software; you can redistribute it and/or modify it 97.9 + * under the terms of the GNU General Public License version 2 only, as 97.10 + * published by the Free Software Foundation. 97.11 + * 97.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 97.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 97.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 97.15 + * version 2 for more details (a copy is included in the LICENSE file that 97.16 + * accompanied this code). 97.17 + * 97.18 + * You should have received a copy of the GNU General Public License version 97.19 + * 2 along with this work; if not, write to the Free Software Foundation, 97.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 97.21 + * 97.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 97.23 + * or visit www.oracle.com if you need additional information or have any 97.24 + * questions. 97.25 + */ 97.26 + 97.27 +public class T { 97.28 + 97.29 + public static void test(int n) { 97.30 + if (n == 0) return; 97.31 + System.out.println (n); 97.32 + test (n - 1); 97.33 + 97.34 + } 97.35 + 97.36 +}
98.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 98.2 +++ b/test/runtime/StackGap/exestack-gap.c Wed Jul 03 20:42:37 2019 +0800 98.3 @@ -0,0 +1,82 @@ 98.4 +/* 98.5 + * Copyright (c) 2018, Red Hat, Inc. All rights reserved. 98.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 98.7 + * 98.8 + * This code is free software; you can redistribute it and/or modify it 98.9 + * under the terms of the GNU General Public License version 2 only, as 98.10 + * published by the Free Software Foundation. 98.11 + * 98.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 98.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 98.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 98.15 + * version 2 for more details (a copy is included in the LICENSE file that 98.16 + * accompanied this code). 98.17 + * 98.18 + * You should have received a copy of the GNU General Public License version 98.19 + * 2 along with this work; if not, write to the Free Software Foundation, 98.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 98.21 + * 98.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 98.23 + * or visit www.oracle.com if you need additional information or have any 98.24 + * questions. 98.25 + */ 98.26 + 98.27 +#include <jni.h> 98.28 +#include <stdio.h> 98.29 +#include <stdlib.h> 98.30 + 98.31 +JNIEnv* create_vm(JavaVM **jvm, char *extra_option) 98.32 +{ 98.33 + JNIEnv* env; 98.34 + JavaVMInitArgs args; 98.35 + JavaVMOption options[4]; 98.36 + args.version = JNI_VERSION_1_8; 98.37 + args.nOptions = 3 + (extra_option != NULL); 98.38 + options[0].optionString = "-Xss2048k"; 98.39 + char classpath[4096]; 98.40 + snprintf(classpath, sizeof classpath, 98.41 + "-Djava.class.path=%s", getenv("CLASSPATH")); 98.42 + options[1].optionString = classpath; 98.43 + options[2].optionString = "-XX:+UnlockExperimentalVMOptions"; 98.44 + if (extra_option) { 98.45 + options[3].optionString = extra_option; 98.46 + } 98.47 + args.options = &options[0]; 98.48 + args.ignoreUnrecognized = 0; 98.49 + int rv; 98.50 + rv = JNI_CreateJavaVM(jvm, (void**)&env, &args); 98.51 + if (rv < 0) return NULL; 98.52 + return env; 98.53 +} 98.54 + 98.55 +void run(char *extra_arg) { 98.56 + JavaVM *jvm; 98.57 + jclass T_class; 98.58 + jmethodID test_method; 98.59 + JNIEnv *env = create_vm(&jvm, extra_arg); 98.60 + if (env == NULL) 98.61 + exit(1); 98.62 + T_class = (*env)->FindClass(env, "T"); 98.63 + if ((*env)->ExceptionCheck(env) == JNI_TRUE) { 98.64 + (*env)->ExceptionDescribe(env); 98.65 + exit(1); 98.66 + } 98.67 + test_method = (*env)->GetStaticMethodID(env, T_class, "test", "(I)V"); 98.68 + if ((*env)->ExceptionCheck(env) == JNI_TRUE) { 98.69 + (*env)->ExceptionDescribe(env); 98.70 + exit(1); 98.71 + } 98.72 + (*env)->CallStaticVoidMethod(env, T_class, test_method, 1000); 98.73 +} 98.74 + 98.75 + 98.76 +int main(int argc, char **argv) 98.77 +{ 98.78 + if (argc > 1) { 98.79 + run(argv[1]); 98.80 + } else { 98.81 + run(NULL); 98.82 + } 98.83 + 98.84 + return 0; 98.85 +}
99.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 99.2 +++ b/test/runtime/StackGap/testme.sh Wed Jul 03 20:42:37 2019 +0800 99.3 @@ -0,0 +1,73 @@ 99.4 +# Copyright (c) 2014, 2018, Oracle and/or its affiliates. All rights reserved. 99.5 +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 99.6 +# 99.7 +# This code is free software; you can redistribute it and/or modify it 99.8 +# under the terms of the GNU General Public License version 2 only, as 99.9 +# published by the Free Software Foundation. 99.10 +# 99.11 +# This code is distributed in the hope that it will be useful, but WITHOUT 99.12 +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 99.13 +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 99.14 +# version 2 for more details (a copy is included in the LICENSE file that 99.15 +# accompanied this code). 99.16 +# 99.17 +# You should have received a copy of the GNU General Public License version 99.18 +# 2 along with this work; if not, write to the Free Software Foundation, 99.19 +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 99.20 +# 99.21 +# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 99.22 +# or visit www.oracle.com if you need additional information or have any 99.23 +# questions. 99.24 +#!/bin/sh 99.25 + 99.26 +# 99.27 +# @test testme.sh 99.28 +# @bug 8197429 99.29 +# @summary Linux kernel stack guard should not cause segfaults on x86-32 99.30 +# @compile T.java 99.31 +# @run shell testme.sh 99.32 +# 99.33 + 99.34 +if [ "${TESTSRC}" = "" ] 99.35 +then 99.36 + TESTSRC=${PWD} 99.37 + echo "TESTSRC not set. Using "${TESTSRC}" as default" 99.38 +fi 99.39 +echo "TESTSRC=${TESTSRC}" 99.40 +## Adding common setup Variables for running shell tests. 99.41 +. ${TESTSRC}/../../test_env.sh 99.42 + 99.43 +if [ "${VM_OS}" != "linux" ] 99.44 +then 99.45 + echo "Test only valid for Linux" 99.46 + exit 0 99.47 +fi 99.48 + 99.49 +gcc_cmd=`which gcc` 99.50 +if [ "x$gcc_cmd" = "x" ]; then 99.51 + echo "WARNING: gcc not found. Cannot execute test." 2>&1 99.52 + exit 0; 99.53 +fi 99.54 + 99.55 +CFLAGS="-m${VM_BITS}" 99.56 + 99.57 +LD_LIBRARY_PATH=.:${COMPILEJAVA}/jre/lib/${VM_CPU}/${VM_TYPE}:/usr/lib:$LD_LIBRARY_PATH 99.58 +export LD_LIBRARY_PATH 99.59 + 99.60 +cp ${TESTSRC}${FS}exestack-gap.c . 99.61 + 99.62 +# Copy the result of our @compile action: 99.63 +cp ${TESTCLASSES}${FS}T.class . 99.64 + 99.65 +echo "Compilation flag: ${COMP_FLAG}" 99.66 +# Note pthread may not be found thus invoke creation will fail to be created. 99.67 +# Check to ensure you have a /usr/lib/libpthread.so if you don't please look 99.68 +# for /usr/lib/`uname -m`-linux-gnu version ensure to add that path to below compilation. 99.69 + 99.70 +$gcc_cmd -DLINUX ${CFLAGS} -o stack-gap \ 99.71 + -I${COMPILEJAVA}/include -I${COMPILEJAVA}/include/linux \ 99.72 + -L${COMPILEJAVA}/jre/lib/${VM_CPU}/${VM_TYPE} \ 99.73 + -ljvm -lpthread exestack-gap.c 99.74 + 99.75 +./stack-gap || exit $? 99.76 +./stack-gap -XX:+DisablePrimordialThreadGuardPages || exit $?
100.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 100.2 +++ b/test/sanity/MismatchedWhiteBox/WhiteBox.java Wed Jul 03 20:42:37 2019 +0800 100.3 @@ -0,0 +1,58 @@ 100.4 +/* 100.5 + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. 100.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 100.7 + * 100.8 + * This code is free software; you can redistribute it and/or modify it 100.9 + * under the terms of the GNU General Public License version 2 only, as 100.10 + * published by the Free Software Foundation. 100.11 + * 100.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 100.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 100.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 100.15 + * version 2 for more details (a copy is included in the LICENSE file that 100.16 + * accompanied this code). 100.17 + * 100.18 + * You should have received a copy of the GNU General Public License version 100.19 + * 2 along with this work; if not, write to the Free Software Foundation, 100.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 100.21 + * 100.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 100.23 + * or visit www.oracle.com if you need additional information or have any 100.24 + * questions. 100.25 + */ 100.26 + 100.27 +/* 100.28 + * @test WhiteBox 100.29 + * @bug 8011675 100.30 + * @summary verify that whitebox can be used even if not all functions are declared in java-part 100.31 + * @author igor.ignatyev@oracle.com 100.32 + * @library /testlibrary 100.33 + * @compile WhiteBox.java 100.34 + * @run main ClassFileInstaller sun.hotspot.WhiteBox 100.35 + * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI sun.hotspot.WhiteBox 100.36 + * @clean sun.hotspot.WhiteBox 100.37 + */ 100.38 + 100.39 +package sun.hotspot; 100.40 + 100.41 +public class WhiteBox { 100.42 + private static native void registerNatives(); 100.43 + static { registerNatives(); } 100.44 + public native int notExistedMethod(); 100.45 + public native int getHeapOopSize(); 100.46 + public static void main(String[] args) { 100.47 + WhiteBox wb = new WhiteBox(); 100.48 + if (wb.getHeapOopSize() < 0) { 100.49 + throw new Error("wb.getHeapOopSize() < 0"); 100.50 + } 100.51 + boolean catched = false; 100.52 + try { 100.53 + wb.notExistedMethod(); 100.54 + } catch (UnsatisfiedLinkError e) { 100.55 + catched = true; 100.56 + } 100.57 + if (!catched) { 100.58 + throw new Error("wb.notExistedMethod() was invoked"); 100.59 + } 100.60 + } 100.61 +}
101.1 --- a/test/sanity/WhiteBox.java Wed Jul 03 20:04:13 2019 +0800 101.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 101.3 @@ -1,58 +0,0 @@ 101.4 -/* 101.5 - * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. 101.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 101.7 - * 101.8 - * This code is free software; you can redistribute it and/or modify it 101.9 - * under the terms of the GNU General Public License version 2 only, as 101.10 - * published by the Free Software Foundation. 101.11 - * 101.12 - * This code is distributed in the hope that it will be useful, but WITHOUT 101.13 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 101.14 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 101.15 - * version 2 for more details (a copy is included in the LICENSE file that 101.16 - * accompanied this code). 101.17 - * 101.18 - * You should have received a copy of the GNU General Public License version 101.19 - * 2 along with this work; if not, write to the Free Software Foundation, 101.20 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 101.21 - * 101.22 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 101.23 - * or visit www.oracle.com if you need additional information or have any 101.24 - * questions. 101.25 - */ 101.26 - 101.27 -/* 101.28 - * @test WhiteBox 101.29 - * @bug 8011675 101.30 - * @summary verify that whitebox can be used even if not all functions are declared in java-part 101.31 - * @author igor.ignatyev@oracle.com 101.32 - * @library /testlibrary 101.33 - * @compile WhiteBox.java 101.34 - * @run main ClassFileInstaller sun.hotspot.WhiteBox 101.35 - * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI sun.hotspot.WhiteBox 101.36 - * @clean sun.hotspot.WhiteBox 101.37 - */ 101.38 - 101.39 -package sun.hotspot; 101.40 - 101.41 -public class WhiteBox { 101.42 - private static native void registerNatives(); 101.43 - static { registerNatives(); } 101.44 - public native int notExistedMethod(); 101.45 - public native int getHeapOopSize(); 101.46 - public static void main(String[] args) { 101.47 - WhiteBox wb = new WhiteBox(); 101.48 - if (wb.getHeapOopSize() < 0) { 101.49 - throw new Error("wb.getHeapOopSize() < 0"); 101.50 - } 101.51 - boolean catched = false; 101.52 - try { 101.53 - wb.notExistedMethod(); 101.54 - } catch (UnsatisfiedLinkError e) { 101.55 - catched = true; 101.56 - } 101.57 - if (!catched) { 101.58 - throw new Error("wb.notExistedMethod() was invoked"); 101.59 - } 101.60 - } 101.61 -}
102.1 --- a/test/testlibrary/com/oracle/java/testlibrary/ProcessTools.java Wed Jul 03 20:04:13 2019 +0800 102.2 +++ b/test/testlibrary/com/oracle/java/testlibrary/ProcessTools.java Wed Jul 03 20:42:37 2019 +0800 102.3 @@ -152,6 +152,9 @@ 102.4 args.add(javapath); 102.5 Collections.addAll(args, getPlatformSpecificVMArgs()); 102.6 102.7 + args.add("-cp"); 102.8 + args.add(System.getProperty("java.class.path")); 102.9 + 102.10 if (addTestVmOptions) { 102.11 String vmopts = System.getProperty("test.vm.opts"); 102.12 if (vmopts != null && vmopts.length() > 0) {
103.1 --- a/test/testlibrary/whitebox/sun/hotspot/WhiteBox.java Wed Jul 03 20:04:13 2019 +0800 103.2 +++ b/test/testlibrary/whitebox/sun/hotspot/WhiteBox.java Wed Jul 03 20:42:37 2019 +0800 103.3 @@ -1,5 +1,5 @@ 103.4 /* 103.5 - * Copyright (c) 2012, 2018, Oracle and/or its affiliates. All rights reserved. 103.6 + * Copyright (c) 2012, 2019, Oracle and/or its affiliates. All rights reserved. 103.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 103.8 * 103.9 * This code is free software; you can redistribute it and/or modify it 103.10 @@ -117,6 +117,7 @@ 103.11 public native void NMTUncommitMemory(long addr, long size); 103.12 public native void NMTReleaseMemory(long addr, long size); 103.13 public native long NMTMallocWithPseudoStack(long size, int index); 103.14 + public native long NMTMallocWithPseudoStackAndType(long size, int index, int type); 103.15 public native boolean NMTIsDetailSupported(); 103.16 public native boolean NMTChangeTrackingLevel(); 103.17 public native int NMTGetHashSize();