Merge mips64el-jdk8u252-b10

Wed, 15 Apr 2020 11:49:55 +0800

author
aoqi
date
Wed, 15 Apr 2020 11:49:55 +0800
changeset 9852
70aa912cebe5
parent 9809
8486f0c4b7c3
parent 9851
095e60e7fc8c
child 9853
51e607da02c4

Merge

.hgtags file | annotate | diff | comparison | revisions
THIRD_PARTY_README file | annotate | diff | comparison | revisions
agent/src/os/linux/ps_core.c file | annotate | diff | comparison | revisions
make/aix/makefiles/vm.make file | annotate | diff | comparison | revisions
make/bsd/makefiles/gcc.make file | annotate | diff | comparison | revisions
make/bsd/makefiles/vm.make file | annotate | diff | comparison | revisions
make/linux/makefiles/vm.make file | annotate | diff | comparison | revisions
make/solaris/makefiles/vm.make file | annotate | diff | comparison | revisions
make/windows/build.make file | annotate | diff | comparison | revisions
make/windows/makefiles/compile.make file | annotate | diff | comparison | revisions
make/windows/makefiles/defs.make file | annotate | diff | comparison | revisions
make/windows/makefiles/vm.make file | annotate | diff | comparison | revisions
src/cpu/ppc/vm/globals_ppc.hpp file | annotate | diff | comparison | revisions
src/cpu/sparc/vm/c1_FrameMap_sparc.cpp file | annotate | diff | comparison | revisions
src/cpu/sparc/vm/c1_LIRAssembler_sparc.cpp file | annotate | diff | comparison | revisions
src/cpu/sparc/vm/globals_sparc.hpp file | annotate | diff | comparison | revisions
src/cpu/x86/vm/c1_FrameMap_x86.cpp file | annotate | diff | comparison | revisions
src/cpu/x86/vm/c1_LIRAssembler_x86.cpp file | annotate | diff | comparison | revisions
src/cpu/x86/vm/c1_LIRGenerator_x86.cpp file | annotate | diff | comparison | revisions
src/cpu/x86/vm/globals_x86.hpp file | annotate | diff | comparison | revisions
src/cpu/x86/vm/sharedRuntime_x86_64.cpp file | annotate | diff | comparison | revisions
src/cpu/zero/vm/globals_zero.hpp file | annotate | diff | comparison | revisions
src/share/vm/adlc/archDesc.cpp file | annotate | diff | comparison | revisions
src/share/vm/adlc/filebuff.cpp file | annotate | diff | comparison | revisions
src/share/vm/adlc/filebuff.hpp file | annotate | diff | comparison | revisions
src/share/vm/adlc/main.cpp file | annotate | diff | comparison | revisions
src/share/vm/adlc/output_c.cpp file | annotate | diff | comparison | revisions
src/share/vm/c1/c1_FrameMap.hpp file | annotate | diff | comparison | revisions
src/share/vm/c1/c1_LIRGenerator.cpp file | annotate | diff | comparison | revisions
src/share/vm/c1/c1_LIRGenerator.hpp file | annotate | diff | comparison | revisions
src/share/vm/code/debugInfo.cpp file | annotate | diff | comparison | revisions
src/share/vm/code/vtableStubs.cpp file | annotate | diff | comparison | revisions
src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp file | annotate | diff | comparison | revisions
src/share/vm/opto/c2_globals.hpp file | annotate | diff | comparison | revisions
src/share/vm/opto/loopPredicate.cpp file | annotate | diff | comparison | revisions
src/share/vm/opto/memnode.cpp file | annotate | diff | comparison | revisions
src/share/vm/opto/node.cpp file | annotate | diff | comparison | revisions
src/share/vm/opto/type.cpp file | annotate | diff | comparison | revisions
src/share/vm/opto/type.hpp file | annotate | diff | comparison | revisions
src/share/vm/prims/forte.cpp file | annotate | diff | comparison | revisions
src/share/vm/prims/jni.cpp file | annotate | diff | comparison | revisions
src/share/vm/runtime/arguments.cpp file | annotate | diff | comparison | revisions
src/share/vm/runtime/globals.hpp file | annotate | diff | comparison | revisions
src/share/vm/runtime/java.cpp file | annotate | diff | comparison | revisions
src/share/vm/runtime/safepoint.hpp file | annotate | diff | comparison | revisions
src/share/vm/runtime/synchronizer.cpp file | annotate | diff | comparison | revisions
src/share/vm/runtime/synchronizer.hpp file | annotate | diff | comparison | revisions
src/share/vm/runtime/thread.cpp file | annotate | diff | comparison | revisions
src/share/vm/runtime/vmStructs.cpp file | annotate | diff | comparison | revisions
src/share/vm/runtime/vmThread.cpp file | annotate | diff | comparison | revisions
src/share/vm/services/heapDumper.cpp file | annotate | diff | comparison | revisions
src/share/vm/utilities/globalDefinitions.hpp file | annotate | diff | comparison | revisions
src/share/vm/utilities/resourceHash.hpp file | annotate | diff | comparison | revisions
src/share/vm/utilities/vmError.cpp file | annotate | diff | comparison | revisions
test/compiler/intrinsics/bmi/verifycode/AddnTestI.java file | annotate | diff | comparison | revisions
test/compiler/intrinsics/bmi/verifycode/AddnTestL.java file | annotate | diff | comparison | revisions
     1.1 --- a/.hgtags	Wed Apr 15 11:14:58 2020 +0800
     1.2 +++ b/.hgtags	Wed Apr 15 11:49:55 2020 +0800
     1.3 @@ -1315,5 +1315,16 @@
     1.4  2c1e9fab6964647f4eeffe55fe5592da6399a3ce jdk8u242-b05
     1.5  81ddc1072b923330f84c0ace3124226f63877582 jdk8u242-b06
     1.6  8b80409d5840142a27e274d33948f483a6406a50 jdk8u242-b07
     1.7 +7c9f6b5f8d119dc1ba3c5536595ce3ae7414599d jdk8u242-b08
     1.8 +7c9f6b5f8d119dc1ba3c5536595ce3ae7414599d jdk8u242-ga
     1.9  758c0766768231810014cf8ea6535f2b1f5186a2 mips64el-jdk8u242-b09
    1.10  a9451177555cc5e700b4f6a5515f8738faf3fe24 mips64el-jdk8u242-b10
    1.11 +8c0733543544bbcd32c4404630d764d280299056 jdk8u252-b00
    1.12 +a67e9c6edcdd73cb860a16990f0905e102c282d7 jdk8u252-b01
    1.13 +5bd3b8c0555292a967ea3b4c39a220d0c2cf40ad jdk8u252-b02
    1.14 +2e972804450764c9ec3b7e548b07be869948ecca jdk8u252-b03
    1.15 +ff1c3c1867b502c289c7c08ebc712663ec657f06 jdk8u252-b04
    1.16 +9003f35baaa0d57d225bf72cf82fb0a8ee049c98 jdk8u252-b05
    1.17 +b4fd7e078c54a23ed44f09aec3f6938bed3e3630 jdk8u252-b06
    1.18 +d17814ea88e3aa0a2f2fdb125e35a878ee27fe3e jdk8u252-b07
    1.19 +8f2780b3e4faf4792ac885f470bb1602d4ca5526 jdk8u252-b08
     2.1 --- a/THIRD_PARTY_README	Wed Apr 15 11:14:58 2020 +0800
     2.2 +++ b/THIRD_PARTY_README	Wed Apr 15 11:49:55 2020 +0800
     2.3 @@ -1712,10 +1712,9 @@
     2.4  
     2.5  --- begin of LICENSE ---
     2.6  
     2.7 - Mesa 3-D graphics library
     2.8 - Version:  5.0
     2.9 -
    2.10 - Copyright (C) 1999-2002  Brian Paul   All Rights Reserved.
    2.11 + Mesa 3-D Graphics Library v19.2.1
    2.12 +
    2.13 + Copyright (C) 1999-2007  Brian Paul   All Rights Reserved.
    2.14  
    2.15   Permission is hereby granted, free of charge, to any person obtaining a
    2.16   copy of this software and associated documentation files (the "Software"),
    2.17 @@ -1730,9 +1729,118 @@
    2.18   THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
    2.19   OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
    2.20   FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
    2.21 - BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
    2.22 - AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
    2.23 - CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
    2.24 + THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
    2.25 + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
    2.26 + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
    2.27 + SOFTWARE.
    2.28 +
    2.29 +Attention, Contributors
    2.30 +
    2.31 +When contributing to the Mesa project you must agree to the licensing terms
    2.32 +of the component to which you're contributing.
    2.33 +The following section lists the primary components of the Mesa distribution
    2.34 +and their respective licenses.
    2.35 +Mesa Component Licenses
    2.36 +
    2.37 +
    2.38 +
    2.39 +Component         Location               License
    2.40 +------------------------------------------------------------------
    2.41 +Main Mesa code    src/mesa/              MIT
    2.42 +Device drivers    src/mesa/drivers/*     MIT, generally
    2.43 +
    2.44 +Gallium code      src/gallium/           MIT
    2.45 +
    2.46 +Ext headers       GL/glext.h             Khronos
    2.47 +                  GL/glxext.h            Khronos
    2.48 +                  GL/wglext.h            Khronos
    2.49 +                  KHR/khrplatform.h      Khronos
    2.50 +
    2.51 +*****************************************************************************
    2.52 +
    2.53 +----
    2.54 +include/GL/gl.h :
    2.55 +
    2.56 +
    2.57 + Mesa 3-D graphics library
    2.58 +
    2.59 + Copyright (C) 1999-2006  Brian Paul   All Rights Reserved.
    2.60 + Copyright (C) 2009  VMware, Inc.  All Rights Reserved.
    2.61 +
    2.62 + Permission is hereby granted, free of charge, to any person obtaining a
    2.63 + copy of this software and associated documentation files (the "Software"),
    2.64 + to deal in the Software without restriction, including without limitation
    2.65 + the rights to use, copy, modify, merge, publish, distribute, sublicense,
    2.66 + and/or sell copies of the Software, and to permit persons to whom the
    2.67 + Software is furnished to do so, subject to the following conditions:
    2.68 +
    2.69 + The above copyright notice and this permission notice shall be included
    2.70 + in all copies or substantial portions of the Software.
    2.71 +
    2.72 + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
    2.73 + OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
    2.74 + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
    2.75 + THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
    2.76 + OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
    2.77 + ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
    2.78 + OTHER DEALINGS IN THE SOFTWARE.
    2.79 + 
    2.80 + *****************************************************************************
    2.81 +
    2.82 +----
    2.83 +include/GL/glext.h
    2.84 +include/GL/glxext.h
    2.85 +include/GL/wglxext.h :
    2.86 +
    2.87 +
    2.88 + Copyright (c) 2013 - 2018 The Khronos Group Inc.
    2.89 +
    2.90 + Permission is hereby granted, free of charge, to any person obtaining a
    2.91 + copy of this software and/or associated documentation files (the
    2.92 + "Materials"), to deal in the Materials without restriction, including
    2.93 + without limitation the rights to use, copy, modify, merge, publish,
    2.94 + distribute, sublicense, and/or sell copies of the Materials, and to
    2.95 + permit persons to whom the Materials are furnished to do so, subject to
    2.96 + the following conditions:
    2.97 +
    2.98 + The above copyright notice and this permission notice shall be included
    2.99 + in all copies or substantial portions of the Materials.
   2.100 +
   2.101 + THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
   2.102 + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
   2.103 + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
   2.104 + IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
   2.105 + CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
   2.106 + TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
   2.107 + MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
   2.108 +
   2.109 + *****************************************************************************
   2.110 +
   2.111 +----
   2.112 +include/KHR/khrplatform.h :
   2.113 +
   2.114 + Copyright (c) 2008 - 2018 The Khronos Group Inc.
   2.115 +
   2.116 + Permission is hereby granted, free of charge, to any person obtaining a
   2.117 + copy of this software and/or associated documentation files (the
   2.118 + "Materials"), to deal in the Materials without restriction, including
   2.119 + without limitation the rights to use, copy, modify, merge, publish,
   2.120 + distribute, sublicense, and/or sell copies of the Materials, and to
   2.121 + permit persons to whom the Materials are furnished to do so, subject to
   2.122 + the following conditions:
   2.123 +
   2.124 + The above copyright notice and this permission notice shall be included
   2.125 + in all copies or substantial portions of the Materials.
   2.126 +
   2.127 + THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
   2.128 + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
   2.129 + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
   2.130 + IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
   2.131 + CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
   2.132 + TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
   2.133 + MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
   2.134 +
   2.135 + *****************************************************************************
   2.136  
   2.137  --- end of LICENSE ---
   2.138  
     3.1 --- a/agent/src/os/linux/ps_core.c	Wed Apr 15 11:14:58 2020 +0800
     3.2 +++ b/agent/src/os/linux/ps_core.c	Wed Apr 15 11:49:55 2020 +0800
     3.3 @@ -868,6 +868,9 @@
     3.4  #define LINK_MAP_LD_OFFSET    offsetof(struct link_map, l_ld)
     3.5  #define LINK_MAP_NEXT_OFFSET  offsetof(struct link_map, l_next)
     3.6  
     3.7 +#define INVALID_LOAD_ADDRESS -1L
     3.8 +#define ZERO_LOAD_ADDRESS 0x0L
     3.9 +
    3.10  // Calculate the load address of shared library
    3.11  // on prelink-enabled environment.
    3.12  //
    3.13 @@ -884,7 +887,7 @@
    3.14    phbuf = read_program_header_table(lib_fd, elf_ehdr);
    3.15    if (phbuf == NULL) {
    3.16      print_debug("can't read program header of shared object\n");
    3.17 -    return 0L;
    3.18 +    return INVALID_LOAD_ADDRESS;
    3.19    }
    3.20  
    3.21    // Get the address of .dynamic section from shared library.
    3.22 @@ -900,7 +903,7 @@
    3.23    if (ps_pdread(ph, (psaddr_t)link_map_addr + LINK_MAP_LD_OFFSET,
    3.24                 &lib_ld, sizeof(uintptr_t)) != PS_OK) {
    3.25      print_debug("can't read address of dynamic section in shared object\n");
    3.26 -    return 0L;
    3.27 +    return INVALID_LOAD_ADDRESS;
    3.28    }
    3.29  
    3.30    // Return the load address which is calculated by the address of .dynamic
    3.31 @@ -1011,9 +1014,9 @@
    3.32              // continue with other libraries...
    3.33           } else {
    3.34              if (read_elf_header(lib_fd, &elf_ehdr)) {
    3.35 -               if (lib_base_diff == 0x0L) {
    3.36 +               if (lib_base_diff == ZERO_LOAD_ADDRESS) {
    3.37                   lib_base_diff = calc_prelinked_load_address(ph, lib_fd, &elf_ehdr, link_map_addr);
    3.38 -                 if (lib_base_diff == 0x0L) {
    3.39 +                 if (lib_base_diff == INVALID_LOAD_ADDRESS) {
    3.40                     close(lib_fd);
    3.41                     return false;
    3.42                   }
     4.1 --- a/make/aix/makefiles/vm.make	Wed Apr 15 11:14:58 2020 +0800
     4.2 +++ b/make/aix/makefiles/vm.make	Wed Apr 15 11:49:55 2020 +0800
     4.3 @@ -119,6 +119,7 @@
     4.4  # Extra flags from gnumake's invocation or environment
     4.5  CFLAGS += $(EXTRA_CFLAGS)
     4.6  LFLAGS += $(EXTRA_CFLAGS) $(EXTRA_LDFLAGS)
     4.7 +ASFLAGS += $(EXTRA_ASFLAGS)
     4.8  
     4.9  # Don't set excutable bit on stack segment
    4.10  # the same could be done by separate execstack command
     5.1 --- a/make/bsd/makefiles/gcc.make	Wed Apr 15 11:14:58 2020 +0800
     5.2 +++ b/make/bsd/makefiles/gcc.make	Wed Apr 15 11:49:55 2020 +0800
     5.3 @@ -260,14 +260,13 @@
     5.4    WARNINGS_ARE_ERRORS += -Wno-empty-body
     5.5  endif
     5.6  
     5.7 -WARNING_FLAGS = -Wpointer-arith -Wsign-compare -Wundef
     5.8 +WARNING_FLAGS = -Wpointer-arith -Wsign-compare -Wundef -Wunused-function -Wunused-value
     5.9  
    5.10 -ifeq "$(shell expr \( $(CC_VER_MAJOR) \> 4 \) \| \( \( $(CC_VER_MAJOR) = 4 \) \& \( $(CC_VER_MINOR) \>= 3 \) \))" "0"
    5.11 +ifeq ($(USE_CLANG),)
    5.12    # Since GCC 4.3, -Wconversion has changed its meanings to warn these implicit
    5.13    # conversions which might affect the values. Only enable it in earlier versions.
    5.14 -  WARNING_FLAGS = -Wunused-function
    5.15 -  ifeq ($(USE_CLANG),)
    5.16 -    WARNING_FLAGS += -Wconversion
    5.17 +  ifeq "$(shell expr \( $(CC_VER_MAJOR) \> 4 \) \| \( \( $(CC_VER_MAJOR) = 4 \) \& \( $(CC_VER_MINOR) \>= 3 \) \))" "0"
    5.18 +    WARNINGS_FLAGS += -Wconversion
    5.19    endif
    5.20  endif
    5.21  
     6.1 --- a/make/bsd/makefiles/vm.make	Wed Apr 15 11:14:58 2020 +0800
     6.2 +++ b/make/bsd/makefiles/vm.make	Wed Apr 15 11:49:55 2020 +0800
     6.3 @@ -121,6 +121,7 @@
     6.4  # Extra flags from gnumake's invocation or environment
     6.5  CFLAGS += $(EXTRA_CFLAGS)
     6.6  LFLAGS += $(EXTRA_CFLAGS) $(EXTRA_LDFLAGS)
     6.7 +ASFLAGS += $(EXTRA_ASFLAGS)
     6.8  
     6.9  # Don't set excutable bit on stack segment
    6.10  # the same could be done by separate execstack command
     7.1 --- a/make/linux/makefiles/vm.make	Wed Apr 15 11:14:58 2020 +0800
     7.2 +++ b/make/linux/makefiles/vm.make	Wed Apr 15 11:49:55 2020 +0800
     7.3 @@ -143,6 +143,7 @@
     7.4  # Extra flags from gnumake's invocation or environment
     7.5  CFLAGS += $(EXTRA_CFLAGS)
     7.6  LFLAGS += $(EXTRA_CFLAGS) $(EXTRA_LDFLAGS)
     7.7 +ASFLAGS += $(EXTRA_ASFLAGS)
     7.8  
     7.9  # Don't set excutable bit on stack segment
    7.10  # the same could be done by separate execstack command
     8.1 --- a/make/solaris/makefiles/vm.make	Wed Apr 15 11:14:58 2020 +0800
     8.2 +++ b/make/solaris/makefiles/vm.make	Wed Apr 15 11:49:55 2020 +0800
     8.3 @@ -109,6 +109,7 @@
     8.4  
     8.5  # Extra flags from gnumake's invocation or environment
     8.6  CFLAGS += $(EXTRA_CFLAGS)
     8.7 +ASFLAGS += $(EXTRA_ASFLAGS)
     8.8  
     8.9  # Math Library (libm.so), do not use -lm.
    8.10  #    There might be two versions of libm.so on the build system:
     9.1 --- a/make/windows/build.make	Wed Apr 15 11:14:58 2020 +0800
     9.2 +++ b/make/windows/build.make	Wed Apr 15 11:49:55 2020 +0800
     9.3 @@ -280,7 +280,7 @@
     9.4  	@ echo HS_COMPANY=$(COMPANY_NAME)			>> $@
     9.5  	@ echo HS_FILEDESC=$(HS_FILEDESC)			>> $@
     9.6  	@ echo HOTSPOT_VM_DISTRO=$(HOTSPOT_VM_DISTRO)		>> $@
     9.7 -	@ echo VENDOR=$(VENDOR)					>> $@
     9.8 +	@ echo VENDOR=$(COMPANY_NAME)				>> $@
     9.9  	@ echo VENDOR_URL=$(VENDOR_URL)				>> $@
    9.10  	@ echo VENDOR_URL_BUG=$(VENDOR_URL_BUG)			>> $@
    9.11  	@ echo VENDOR_URL_VM_BUG=$(VENDOR_URL_VM_BUG)		>> $@
    10.1 --- a/make/windows/makefiles/compile.make	Wed Apr 15 11:14:58 2020 +0800
    10.2 +++ b/make/windows/makefiles/compile.make	Wed Apr 15 11:49:55 2020 +0800
    10.3 @@ -346,7 +346,7 @@
    10.4  	 /D "HS_BUILD_ID=$(HS_BUILD_ID)" \
    10.5  	 /D "JDK_VER=$(JDK_VER)" \
    10.6  	 /D "JDK_DOTVER=$(JDK_DOTVER)" \
    10.7 -	 /D "HS_COMPANY=$(HS_COMPANY)" \
    10.8 +	 /D "HS_COMPANY=$(COMPANY_NAME)" \
    10.9  	 /D "HS_FILEDESC=$(HS_FILEDESC)" \
   10.10  	 /D "HS_COPYRIGHT=$(HS_COPYRIGHT)" \
   10.11  	 /D "HS_FNAME=$(HS_FNAME)" \
    11.1 --- a/make/windows/makefiles/defs.make	Wed Apr 15 11:14:58 2020 +0800
    11.2 +++ b/make/windows/makefiles/defs.make	Wed Apr 15 11:49:55 2020 +0800
    11.3 @@ -157,6 +157,15 @@
    11.4  MAKE_ARGS += RM="$(RM)"
    11.5  MAKE_ARGS += ZIPEXE=$(ZIPEXE)
    11.6  
    11.7 +MAKE_ARGS += COMPANY_NAME="$(COMPANY_NAME)"
    11.8 +MAKE_ARGS += VENDOR_URL=$(VENDOR_URL)
    11.9 +MAKE_ARGS += VENDOR_URL_BUG=$(VENDOR_URL_BUG)
   11.10 +MAKE_ARGS += VENDOR_URL_VM_BUG=$(VENDOR_URL_VM_BUG)
   11.11 +ifneq ($(VERSION_CFLAGS),)
   11.12 +  # transform syntax from -DProp='"Value"' to /D "Prop=\"Value\"" for Windows build
   11.13 +  MAKE_ARGS += VERSION_CFLAGS="$(subst -D,/D \",$(subst ',,$(subst '$() $(),\"$() $(),$(subst ",\\\",$(VERSION_CFLAGS)))))\""
   11.14 +endif
   11.15 +
   11.16  # On 32 bit windows we build server and client, on 64 bit just server.
   11.17  ifeq ($(JVM_VARIANTS),)
   11.18    ifeq ($(ARCH_DATA_MODEL), 32)
    12.1 --- a/make/windows/makefiles/vm.make	Wed Apr 15 11:14:58 2020 +0800
    12.2 +++ b/make/windows/makefiles/vm.make	Wed Apr 15 11:49:55 2020 +0800
    12.3 @@ -62,10 +62,6 @@
    12.4  CXX_FLAGS=$(CXX_FLAGS) /D "HOTSPOT_BUILD_TARGET=\"$(BUILD_FLAVOR)\""
    12.5  CXX_FLAGS=$(CXX_FLAGS) /D "HOTSPOT_BUILD_USER=\"$(BuildUser)\""
    12.6  CXX_FLAGS=$(CXX_FLAGS) /D "HOTSPOT_VM_DISTRO=\"$(HOTSPOT_VM_DISTRO)\""
    12.7 -CXX_FLAGS=$(CXX_FLAGS) /D "VENDOR=\"$(COMPANY_NAME)\""
    12.8 -CXX_FLAGS=$(CXX_FLAGS) /D "VENDOR_URL=\"$(VENDOR_URL)\""
    12.9 -CXX_FLAGS=$(CXX_FLAGS) /D "VENDOR_URL_BUG=\"$(VENDOR_URL_BUG)\""
   12.10 -CXX_FLAGS=$(CXX_FLAGS) /D "VENDOR_URL_VM_BUG=\"$(VENDOR_URL_VM_BUG)\""
   12.11  
   12.12  CXX_FLAGS=$(CXX_FLAGS) $(CXX_INCLUDE_DIRS)
   12.13  
   12.14 @@ -209,6 +205,14 @@
   12.15  bytecodeInterpreterWithChecks.obj: ..\generated\jvmtifiles\bytecodeInterpreterWithChecks.cpp
   12.16          $(CXX) $(CXX_FLAGS) $(CXX_DONT_USE_PCH) /c ..\generated\jvmtifiles\bytecodeInterpreterWithChecks.cpp
   12.17  
   12.18 +#files compiled with version flags
   12.19 +
   12.20 +vm_version.obj: $(WorkSpace)\src\share\vm\runtime\vm_version.cpp
   12.21 +        $(CXX) $(CXX_FLAGS) $(VERSION_CFLAGS) $(CXX_USE_PCH) /c $(WorkSpace)\src\share\vm\runtime\vm_version.cpp
   12.22 +
   12.23 +arguments.obj: $(WorkSpace)\src\share\vm\runtime\arguments.cpp
   12.24 +        $(CXX) $(CXX_FLAGS) $(VERSION_CFLAGS) $(CXX_USE_PCH) /c $(WorkSpace)\src\share\vm\runtime\arguments.cpp
   12.25 +
   12.26  # Default rules for the Virtual Machine
   12.27  {$(COMMONSRC)\share\vm\c1}.cpp.obj::
   12.28          $(CXX) $(CXX_FLAGS) $(CXX_USE_PCH) /c $<
    13.1 --- a/src/cpu/ppc/vm/globals_ppc.hpp	Wed Apr 15 11:14:58 2020 +0800
    13.2 +++ b/src/cpu/ppc/vm/globals_ppc.hpp	Wed Apr 15 11:49:55 2020 +0800
    13.3 @@ -1,5 +1,5 @@
    13.4  /*
    13.5 - * Copyright (c) 2002, 2018, Oracle and/or its affiliates. All rights reserved.
    13.6 + * Copyright (c) 2002, 2019, Oracle and/or its affiliates. All rights reserved.
    13.7   * Copyright 2012, 2018 SAP AG. All rights reserved.
    13.8   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    13.9   *
   13.10 @@ -33,10 +33,8 @@
   13.11  // (see globals.hpp)
   13.12  
   13.13  define_pd_global(bool, ConvertSleepToYield,   true);
   13.14 -define_pd_global(bool, ShareVtableStubs,      false); // Improves performance markedly for mtrt and compress.
   13.15  define_pd_global(bool, NeedsDeoptSuspend,     false); // Only register window machines need this.
   13.16  
   13.17 -
   13.18  define_pd_global(bool, ImplicitNullChecks,    true);  // Generate code for implicit null checks.
   13.19  define_pd_global(bool, TrapBasedNullChecks,   true);
   13.20  define_pd_global(bool, UncommonNullCast,      true);  // Uncommon-trap NULLs passed to check cast.
    14.1 --- a/src/cpu/sparc/vm/c1_FrameMap_sparc.cpp	Wed Apr 15 11:14:58 2020 +0800
    14.2 +++ b/src/cpu/sparc/vm/c1_FrameMap_sparc.cpp	Wed Apr 15 11:49:55 2020 +0800
    14.3 @@ -55,6 +55,8 @@
    14.4        opr = as_oop_opr(reg);
    14.5      } else if (type == T_METADATA) {
    14.6        opr = as_metadata_opr(reg);
    14.7 +    } else if (type == T_ADDRESS) {
    14.8 +      opr = as_address_opr(reg);
    14.9      } else {
   14.10        opr = as_opr(reg);
   14.11      }
    15.1 --- a/src/cpu/sparc/vm/c1_LIRAssembler_sparc.cpp	Wed Apr 15 11:14:58 2020 +0800
    15.2 +++ b/src/cpu/sparc/vm/c1_LIRAssembler_sparc.cpp	Wed Apr 15 11:49:55 2020 +0800
    15.3 @@ -509,8 +509,13 @@
    15.4    if (o == NULL) {
    15.5      __ set(NULL_WORD, reg);
    15.6    } else {
    15.7 +#ifdef ASSERT
    15.8 +    {
    15.9 +      ThreadInVMfromNative tiv(JavaThread::current());
   15.10 +      assert(Universe::heap()->is_in_reserved(JNIHandles::resolve(o)), "should be real oop");
   15.11 +    }
   15.12 +#endif
   15.13      int oop_index = __ oop_recorder()->find_index(o);
   15.14 -    assert(Universe::heap()->is_in_reserved(JNIHandles::resolve(o)), "should be real oop");
   15.15      RelocationHolder rspec = oop_Relocation::spec(oop_index);
   15.16      __ set(NULL_WORD, reg, rspec); // Will be set when the nmethod is created
   15.17    }
    16.1 --- a/src/cpu/sparc/vm/globals_sparc.hpp	Wed Apr 15 11:14:58 2020 +0800
    16.2 +++ b/src/cpu/sparc/vm/globals_sparc.hpp	Wed Apr 15 11:49:55 2020 +0800
    16.3 @@ -1,5 +1,5 @@
    16.4  /*
    16.5 - * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
    16.6 + * Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved.
    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 @@ -38,7 +38,6 @@
   16.11  // according to the prior table. So, we let the thread continue and let it block by itself.
   16.12  define_pd_global(bool, DontYieldALot,               true);  // yield no more than 100 times per second
   16.13  define_pd_global(bool, ConvertSleepToYield,         false); // do not convert sleep(0) to yield. Helps GUI
   16.14 -define_pd_global(bool, ShareVtableStubs,            false); // improves performance markedly for mtrt and compress
   16.15  define_pd_global(bool, CountInterpCalls,            false); // not implemented in the interpreter
   16.16  define_pd_global(bool, NeedsDeoptSuspend,           true); // register window machines need this
   16.17  
    17.1 --- a/src/cpu/x86/vm/c1_FrameMap_x86.cpp	Wed Apr 15 11:14:58 2020 +0800
    17.2 +++ b/src/cpu/x86/vm/c1_FrameMap_x86.cpp	Wed Apr 15 11:49:55 2020 +0800
    17.3 @@ -54,6 +54,8 @@
    17.4        opr = as_oop_opr(reg);
    17.5      } else if (type == T_METADATA) {
    17.6        opr = as_metadata_opr(reg);
    17.7 +    } else if (type == T_ADDRESS) {
    17.8 +      opr = as_address_opr(reg);
    17.9      } else {
   17.10        opr = as_opr(reg);
   17.11      }
    18.1 --- a/src/cpu/x86/vm/c1_LIRAssembler_x86.cpp	Wed Apr 15 11:14:58 2020 +0800
    18.2 +++ b/src/cpu/x86/vm/c1_LIRAssembler_x86.cpp	Wed Apr 15 11:49:55 2020 +0800
    18.3 @@ -964,7 +964,7 @@
    18.4      if (type == T_OBJECT || type == T_ARRAY) {
    18.5        __ verify_oop(src->as_register());
    18.6        __ movptr (dst, src->as_register());
    18.7 -    } else if (type == T_METADATA) {
    18.8 +    } else if (type == T_METADATA || type == T_ADDRESS) {
    18.9        __ movptr (dst, src->as_register());
   18.10      } else {
   18.11        __ movl (dst, src->as_register());
   18.12 @@ -1145,7 +1145,7 @@
   18.13      if (type == T_ARRAY || type == T_OBJECT) {
   18.14        __ movptr(dest->as_register(), frame_map()->address_for_slot(src->single_stack_ix()));
   18.15        __ verify_oop(dest->as_register());
   18.16 -    } else if (type == T_METADATA) {
   18.17 +    } else if (type == T_METADATA || type == T_ADDRESS) {
   18.18        __ movptr(dest->as_register(), frame_map()->address_for_slot(src->single_stack_ix()));
   18.19      } else {
   18.20        __ movl(dest->as_register(), frame_map()->address_for_slot(src->single_stack_ix()));
    19.1 --- a/src/cpu/x86/vm/c1_LIRGenerator_x86.cpp	Wed Apr 15 11:14:58 2020 +0800
    19.2 +++ b/src/cpu/x86/vm/c1_LIRGenerator_x86.cpp	Wed Apr 15 11:49:55 2020 +0800
    19.3 @@ -233,8 +233,8 @@
    19.4  }
    19.5  
    19.6  
    19.7 -bool LIRGenerator::strength_reduce_multiply(LIR_Opr left, int c, LIR_Opr result, LIR_Opr tmp) {
    19.8 -  if (tmp->is_valid()) {
    19.9 +bool LIRGenerator::strength_reduce_multiply(LIR_Opr left, jint c, LIR_Opr result, LIR_Opr tmp) {
   19.10 +  if (tmp->is_valid() && c > 0 && c < max_jint) {
   19.11      if (is_power_of_2(c + 1)) {
   19.12        __ move(left, tmp);
   19.13        __ shift_left(left, log2_jint(c + 1), left);
   19.14 @@ -602,8 +602,8 @@
   19.15        bool use_constant = false;
   19.16        bool use_tmp = false;
   19.17        if (right_arg->is_constant()) {
   19.18 -        int iconst = right_arg->get_jint_constant();
   19.19 -        if (iconst > 0) {
   19.20 +        jint iconst = right_arg->get_jint_constant();
   19.21 +        if (iconst > 0 && iconst < max_jint) {
   19.22            if (is_power_of_2(iconst)) {
   19.23              use_constant = true;
   19.24            } else if (is_power_of_2(iconst - 1) || is_power_of_2(iconst + 1)) {
    20.1 --- a/src/cpu/x86/vm/globals_x86.hpp	Wed Apr 15 11:14:58 2020 +0800
    20.2 +++ b/src/cpu/x86/vm/globals_x86.hpp	Wed Apr 15 11:49:55 2020 +0800
    20.3 @@ -1,5 +1,5 @@
    20.4  /*
    20.5 - * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
    20.6 + * Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved.
    20.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    20.8   *
    20.9   * This code is free software; you can redistribute it and/or modify it
   20.10 @@ -32,7 +32,6 @@
   20.11  // (see globals.hpp)
   20.12  
   20.13  define_pd_global(bool, ConvertSleepToYield,      true);
   20.14 -define_pd_global(bool, ShareVtableStubs,         true);
   20.15  define_pd_global(bool, CountInterpCalls,         true);
   20.16  define_pd_global(bool, NeedsDeoptSuspend,        false); // only register window machines need this
   20.17  
    21.1 --- a/src/cpu/x86/vm/sharedRuntime_x86_64.cpp	Wed Apr 15 11:14:58 2020 +0800
    21.2 +++ b/src/cpu/x86/vm/sharedRuntime_x86_64.cpp	Wed Apr 15 11:49:55 2020 +0800
    21.3 @@ -2098,7 +2098,7 @@
    21.4    // critical natives they are offset down.
    21.5    GrowableArray<int> arg_order(2 * total_in_args);
    21.6    VMRegPair tmp_vmreg;
    21.7 -  tmp_vmreg.set1(rbx->as_VMReg());
    21.8 +  tmp_vmreg.set2(rbx->as_VMReg());
    21.9  
   21.10    if (!is_critical_native) {
   21.11      for (int i = total_in_args - 1, c_arg = total_c_args - 1; i >= 0; i--, c_arg--) {
    22.1 --- a/src/cpu/zero/vm/globals_zero.hpp	Wed Apr 15 11:14:58 2020 +0800
    22.2 +++ b/src/cpu/zero/vm/globals_zero.hpp	Wed Apr 15 11:49:55 2020 +0800
    22.3 @@ -1,5 +1,5 @@
    22.4  /*
    22.5 - * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
    22.6 + * Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved.
    22.7   * Copyright 2007, 2008, 2009, 2010, 2011 Red Hat, Inc.
    22.8   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    22.9   *
   22.10 @@ -33,7 +33,6 @@
   22.11  // runtime system.  See globals.hpp for details of what they do.
   22.12  
   22.13  define_pd_global(bool,  ConvertSleepToYield,  true);
   22.14 -define_pd_global(bool,  ShareVtableStubs,     true);
   22.15  define_pd_global(bool,  CountInterpCalls,     true);
   22.16  define_pd_global(bool,  NeedsDeoptSuspend,    false);
   22.17  
    23.1 --- a/src/share/vm/adlc/archDesc.cpp	Wed Apr 15 11:14:58 2020 +0800
    23.2 +++ b/src/share/vm/adlc/archDesc.cpp	Wed Apr 15 11:49:55 2020 +0800
    23.3 @@ -43,32 +43,6 @@
    23.4    return result;
    23.5  }
    23.6  
    23.7 -// Utilities to characterize effect statements
    23.8 -static bool is_def(int usedef) {
    23.9 -  switch(usedef) {
   23.10 -  case Component::DEF:
   23.11 -  case Component::USE_DEF: return true; break;
   23.12 -  }
   23.13 -  return false;
   23.14 -}
   23.15 -
   23.16 -static bool is_use(int usedef) {
   23.17 -  switch(usedef) {
   23.18 -  case Component::USE:
   23.19 -  case Component::USE_DEF:
   23.20 -  case Component::USE_KILL: return true; break;
   23.21 -  }
   23.22 -  return false;
   23.23 -}
   23.24 -
   23.25 -static bool is_kill(int usedef) {
   23.26 -  switch(usedef) {
   23.27 -  case Component::KILL:
   23.28 -  case Component::USE_KILL: return true; break;
   23.29 -  }
   23.30 -  return false;
   23.31 -}
   23.32 -
   23.33  //---------------------------ChainList Methods-------------------------------
   23.34  ChainList::ChainList() {
   23.35  }
    24.1 --- a/src/share/vm/adlc/filebuff.cpp	Wed Apr 15 11:14:58 2020 +0800
    24.2 +++ b/src/share/vm/adlc/filebuff.cpp	Wed Apr 15 11:49:55 2020 +0800
    24.3 @@ -1,5 +1,5 @@
    24.4  /*
    24.5 - * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
    24.6 + * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
    24.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    24.8   *
    24.9   * This code is free software; you can redistribute it and/or modify it
   24.10 @@ -89,200 +89,6 @@
   24.11    return retval;
   24.12  }
   24.13  
   24.14 -//------------------------------FileBuffRegion---------------------------------
   24.15 -// Create a new region in a FileBuff.
   24.16 -FileBuffRegion::FileBuffRegion( FileBuff* bufr, int soln, int ln,
   24.17 -                                int off, int len)
   24.18 -: _bfr(bufr), _sol(soln), _line(ln), _offset(off), _length(len) {
   24.19 -  _next = NULL;                 // No chained regions
   24.20 -}
   24.21 -
   24.22 -//------------------------------~FileBuffRegion--------------------------------
   24.23 -// Delete the entire linked list of buffer regions.
   24.24 -FileBuffRegion::~FileBuffRegion() {
   24.25 -  if( _next ) delete _next;
   24.26 -}
   24.27 -
   24.28 -//------------------------------copy-------------------------------------------
   24.29 -// Deep copy a FileBuffRegion
   24.30 -FileBuffRegion *FileBuffRegion::copy() {
   24.31 -  if( !this ) return NULL;      // The empty buffer region
   24.32 -  FileBuffRegion *br = new FileBuffRegion(_bfr,_sol,_line,_offset,_length);
   24.33 -  if( _next ) br->_next = _next->copy();
   24.34 -  return br;
   24.35 -}
   24.36 -
   24.37 -//------------------------------merge------------------------------------------
   24.38 -// Merge another buffer region into this buffer region.  Make overlapping areas
   24.39 -// become a single region.  Remove (delete) the input FileBuffRegion.
   24.40 -// Since the buffer regions are sorted by file offset, this is a varient of a
   24.41 -// "sorted-merge" running in linear time.
   24.42 -FileBuffRegion *FileBuffRegion::merge( FileBuffRegion *br ) {
   24.43 -  if( !br ) return this;        // Merging nothing
   24.44 -  if( !this ) return br;        // Merging into nothing
   24.45 -
   24.46 -  assert( _bfr == br->_bfr, "" );     // Check for pointer-equivalent buffers
   24.47 -
   24.48 -  if( _offset < br->_offset ) { // "this" starts before "br"
   24.49 -    if( _offset+_length < br->_offset ) { // "this" ends before "br"
   24.50 -      if( _next ) _next->merge( br );    // Merge with remainder of list
   24.51 -      else _next = br;                 // No more in this list; just append.
   24.52 -    } else {                           // Regions overlap.
   24.53 -      int l = br->_offset + br->_length - _offset;
   24.54 -      if( l > _length ) _length = l;     // Pick larger region
   24.55 -      FileBuffRegion *nr = br->_next;     // Get rest of region
   24.56 -      br->_next = NULL;         // Remove indication of rest of region
   24.57 -      delete br;                // Delete this region (it's been subsumed).
   24.58 -      if( nr ) merge( nr );     // Merge with rest of region
   24.59 -    }                           // End of if regions overlap or not.
   24.60 -  } else {                      // "this" starts after "br"
   24.61 -    if( br->_offset+br->_length < _offset ) {    // "br" ends before "this"
   24.62 -      FileBuffRegion *nr = new FileBuffRegion(_bfr,_sol,_line,_offset,_length);
   24.63 -      nr->_next = _next;                // Structure copy "this" guy to "nr"
   24.64 -      *this = *br;              // Structure copy "br" over "this".
   24.65 -      br->_next = NULL;         // Remove indication of rest of region
   24.66 -      delete br;                // Delete this region (it's been copied)
   24.67 -      merge( nr );              // Finish merging
   24.68 -    } else {                    // Regions overlap.
   24.69 -      int l = _offset + _length - br->_offset;
   24.70 -      if( l > _length ) _length = l;    // Pick larger region
   24.71 -      _offset = br->_offset;            // Start with earlier region
   24.72 -      _sol = br->_sol;                  // Also use earlier line start
   24.73 -      _line = br->_line;                        // Also use earlier line
   24.74 -      FileBuffRegion *nr = br->_next;   // Get rest of region
   24.75 -      br->_next = NULL;         // Remove indication of rest of region
   24.76 -      delete br;                // Delete this region (it's been subsumed).
   24.77 -      if( nr ) merge( nr );     // Merge with rest of region
   24.78 -    }                           // End of if regions overlap or not.
   24.79 -  }
   24.80 -  return this;
   24.81 -}
   24.82 -
   24.83 -//------------------------------expandtab--------------------------------------
   24.84 -static int expandtab( ostream &os, int off, char c, char fill1, char fill2 ) {
   24.85 -  if( c == '\t' ) {             // Tab?
   24.86 -    do os << fill1;             // Expand the tab; Output space
   24.87 -    while( (++off) & 7 );       // Expand to tab stop
   24.88 -  } else {                      // Normal character
   24.89 -    os << fill2;                // Display normal character
   24.90 -    off++;                      // Increment "cursor" offset
   24.91 -  }
   24.92 -  return off;
   24.93 -}
   24.94 -
   24.95 -//------------------------------printline--------------------------------------
   24.96 -// Print and highlite a region of a line.  Return the amount of highliting left
   24.97 -// to do (i.e. highlite length minus length of line).
   24.98 -static int printline( ostream& os, const char *fname, int line,
   24.99 -                        const char *_sol, int skip, int len ) {
  24.100 -
  24.101 -  // Display the entire tab-expanded line
  24.102 -  os << fname << ":" << line << ": ";
  24.103 -  const char *t = strchr(_sol,'\n')+1; // End of line
  24.104 -  int off = 0;                  // Cursor offset for tab expansion
  24.105 -  const char *s = _sol;         // Nice string pointer
  24.106 -  while( t-s ) {                // Display whole line
  24.107 -    char c = *s++;              // Get next character to display
  24.108 -    off = expandtab(os,off,c,' ',c);
  24.109 -  }
  24.110 -
  24.111 -  // Display the tab-expanded skippings before underlining.
  24.112 -  os << fname << ":" << line << ": ";
  24.113 -  off = 0;                      // Cursor offset for tab expansion
  24.114 -  s = _sol;                     // Restart string pointer
  24.115 -
  24.116 -  // Start underlining.
  24.117 -  if( skip != -1 ) {            // The no-start-indicating flag
  24.118 -    const char *u = _sol+skip;  // Amount to skip
  24.119 -    while( u-s )                // Display skipped part
  24.120 -      off = expandtab(os,off,*s++,' ',' ');
  24.121 -    os << '^';                  // Start region
  24.122 -    off++;                      // Moved cursor
  24.123 -    len--;                      // 1 less char to do
  24.124 -    if( *s++ == '\t' )          // Starting character is a tab?
  24.125 -      off = expandtab(os,off,'\t','-','^');
  24.126 -  }
  24.127 -
  24.128 -  // Long region doesn't end on this line
  24.129 -  int llen = (int)(t-s);        // Length of line, minus what's already done
  24.130 -  if( len > llen ) {            // Doing entire rest of line?
  24.131 -    while( t-s )                // Display rest of line
  24.132 -      off = expandtab(os,off,*s++,'-','-');
  24.133 -    os << '\n';                 // EOL
  24.134 -    return len-llen;            // Return what's not yet done.
  24.135 -  }
  24.136 -
  24.137 -  // Region does end on this line.  This code fails subtly if the region ends
  24.138 -  // in a tab character.
  24.139 -  int i;
  24.140 -  for( i=1; i<len; i++ )        // Underline just what's needed
  24.141 -    off = expandtab(os,off,*s++,'-','-');
  24.142 -  if( i == len ) os << '^';     // Mark end of region
  24.143 -  os << '\n';                   // End of marked line
  24.144 -  return 0;                     // All done
  24.145 -}
  24.146 -
  24.147 -//------------------------------print------------------------------------------
  24.148 -//std::ostream& operator<< ( std::ostream& os, FileBuffRegion &br ) {
  24.149 -ostream& operator<< ( ostream& os, FileBuffRegion &br ) {
  24.150 -  if( &br == NULL ) return os;  // The empty buffer region
  24.151 -  FileBuffRegion *brp = &br;    // Pointer to region
  24.152 -  while( brp ) {                // While have chained regions
  24.153 -    brp->print(os);             // Print region
  24.154 -    brp = brp->_next;           // Chain to next
  24.155 -  }
  24.156 -  return os;                    // Return final stream
  24.157 -}
  24.158 -
  24.159 -//------------------------------print------------------------------------------
  24.160 -// Print the FileBuffRegion to a stream. FileBuffRegions are printed with the
  24.161 -// filename and line number to the left, and complete text lines to the right.
  24.162 -// Selected portions (portions of a line actually in the FileBuffRegion are
  24.163 -// underlined.  Ellipses are used for long multi-line regions.
  24.164 -//void FileBuffRegion::print( std::ostream& os ) {
  24.165 -void FileBuffRegion::print( ostream& os ) {
  24.166 -  if( !this ) return;           // Nothing to print
  24.167 -  char *s = _bfr->get_line();
  24.168 -  int skip = (int)(_offset - _sol);     // Amount to skip to start of data
  24.169 -  int len = printline( os, _bfr->_fp->_name, _line, s, skip, _length );
  24.170 -
  24.171 -  if( !len ) return;                    // All done; exit
  24.172 -
  24.173 -  // Here we require at least 2 lines
  24.174 -  int off1 = _length - len + skip;      // Length of line 1
  24.175 -  int off2 = off1 + _sol;               // Offset to start of line 2
  24.176 -  char *s2 = _bfr->get_line();           // Start of line 2
  24.177 -  char *s3 = strchr( s2, '\n' )+1;      // Start of line 3 (unread)
  24.178 -  if( len <= (s3-s2) ) {                // It all fits on the next line
  24.179 -    printline( os, _bfr->_fp->_name, _line+1, s2, -1, len ); // Print&underline
  24.180 -    return;
  24.181 -  }
  24.182 -
  24.183 -  // Here we require at least 3 lines
  24.184 -  int off3 = off2 + (int)(s3-s2);       // Offset to start of line 3
  24.185 -  s3 = _bfr->get_line();                // Start of line 3 (read)
  24.186 -  const char *s4 = strchr( s3, '\n' )+1;// Start of line 4 (unread)
  24.187 -  if( len < (s4-s3) ) {                 // It all fits on the next 2 lines
  24.188 -    s2 = _bfr->get_line();
  24.189 -    len = printline( os, _bfr->_fp->_name, _line+1, s2, -1, len ); // Line 2
  24.190 -    s3 = _bfr->get_line();
  24.191 -    printline( os, _bfr->_fp->_name, _line+2, s3, -1, len );     // Line 3
  24.192 -    return;
  24.193 -  }
  24.194 -
  24.195 -  // Here we require at least 4 lines.
  24.196 -  // Print only the 1st and last line, with ellipses in middle.
  24.197 -  os << "...\n";                // The ellipses
  24.198 -  int cline = _line+1;          // Skipped 2 lines
  24.199 -  do {                          // Do until find last line
  24.200 -    len -= (int)(s3-s2);        // Remove length of line
  24.201 -    cline++;                    // Next line
  24.202 -    s2 = _bfr->get_line();      // Get next line from end of this line
  24.203 -    s3 = strchr( s2, '\n' ) + 1;// Get end of next line
  24.204 -  } while( len > (s3-s2) );     // Repeat until last line
  24.205 -  printline( os, _bfr->_fp->_name, cline, s2, -1, len ); // Print & underline
  24.206 -}
  24.207 -
  24.208  //------------------------------file_error-------------------------------------
  24.209  void FileBuff::file_error(int flag, int linenum, const char *fmt, ...)
  24.210  {
    25.1 --- a/src/share/vm/adlc/filebuff.hpp	Wed Apr 15 11:14:58 2020 +0800
    25.2 +++ b/src/share/vm/adlc/filebuff.hpp	Wed Apr 15 11:49:55 2020 +0800
    25.3 @@ -1,5 +1,5 @@
    25.4  /*
    25.5 - * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
    25.6 + * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
    25.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    25.8   *
    25.9   * This code is free software; you can redistribute it and/or modify it
   25.10 @@ -46,7 +46,6 @@
   25.11  // This class defines a nicely behaved buffer of text.  Entire file of text
   25.12  // is read into buffer at creation, with sentinels at start and end.
   25.13  class FileBuff {
   25.14 -  friend class FileBuffRegion;
   25.15   private:
   25.16    long  _bufferSize;            // Size of text holding buffer.
   25.17    long  _offset;                // Expected filepointer offset.
   25.18 @@ -82,29 +81,4 @@
   25.19    // when the pointer is valid (i.e. just obtained from getline()).
   25.20    long getoff(const char* s) { return _bufoff + (long)(s - _buf); }
   25.21  };
   25.22 -
   25.23 -//------------------------------FileBuffRegion---------------------------------
   25.24 -// A buffer region is really a region of some file, specified as a linked list
   25.25 -// of offsets and lengths.  These regions can be merged; overlapping regions
   25.26 -// will coalesce.
   25.27 -class FileBuffRegion {
   25.28 - public:                        // Workaround dev-studio friend/private bug
   25.29 -  FileBuffRegion *_next;        // Linked list of regions sorted by offset.
   25.30 - private:
   25.31 -  FileBuff       *_bfr;         // The Buffer of the file
   25.32 -  int _offset, _length;         // The file area
   25.33 -  int             _sol;         // Start of line where the file area starts
   25.34 -  int             _line;        // First line of region
   25.35 -
   25.36 - public:
   25.37 -  FileBuffRegion(FileBuff*, int sol, int line, int offset, int len);
   25.38 -  ~FileBuffRegion();
   25.39 -
   25.40 -  FileBuffRegion *copy();                   // Deep copy
   25.41 -  FileBuffRegion *merge(FileBuffRegion*); // Merge 2 regions; delete input
   25.42 -
   25.43 -  void print(ostream&);
   25.44 -  friend ostream& operator<< (ostream&, FileBuffRegion&);
   25.45 -};
   25.46 -
   25.47  #endif // SHARE_VM_ADLC_FILEBUFF_HPP
    26.1 --- a/src/share/vm/adlc/main.cpp	Wed Apr 15 11:14:58 2020 +0800
    26.2 +++ b/src/share/vm/adlc/main.cpp	Wed Apr 15 11:49:55 2020 +0800
    26.3 @@ -35,7 +35,6 @@
    26.4  static void  usage(ArchDesc& AD);          // Print usage message and exit
    26.5  static char *strip_ext(char *fname);       // Strip off name extension
    26.6  static char *base_plus_suffix(const char* base, const char *suffix);// New concatenated string
    26.7 -static char *prefix_plus_base_plus_suffix(const char* prefix, const char* base, const char *suffix);// New concatenated string
    26.8  static int get_legal_text(FileBuff &fbuf, char **legal_text); // Get pointer to legal text
    26.9  
   26.10  ArchDesc* globalAD = NULL;      // global reference to Architecture Description object
    27.1 --- a/src/share/vm/adlc/output_c.cpp	Wed Apr 15 11:14:58 2020 +0800
    27.2 +++ b/src/share/vm/adlc/output_c.cpp	Wed Apr 15 11:49:55 2020 +0800
    27.3 @@ -41,23 +41,6 @@
    27.4    return false;
    27.5  }
    27.6  
    27.7 -static bool is_use(int usedef) {
    27.8 -  switch(usedef) {
    27.9 -  case Component::USE:
   27.10 -  case Component::USE_DEF:
   27.11 -  case Component::USE_KILL: return true; break;
   27.12 -  }
   27.13 -  return false;
   27.14 -}
   27.15 -
   27.16 -static bool is_kill(int usedef) {
   27.17 -  switch(usedef) {
   27.18 -  case Component::KILL:
   27.19 -  case Component::USE_KILL: return true; break;
   27.20 -  }
   27.21 -  return false;
   27.22 -}
   27.23 -
   27.24  // Define  an array containing the machine register names, strings.
   27.25  static void defineRegNames(FILE *fp, RegisterForm *registers) {
   27.26    if (registers) {
    28.1 --- a/src/share/vm/c1/c1_FrameMap.hpp	Wed Apr 15 11:14:58 2020 +0800
    28.2 +++ b/src/share/vm/c1/c1_FrameMap.hpp	Wed Apr 15 11:49:55 2020 +0800
    28.3 @@ -207,6 +207,10 @@
    28.4      return LIR_OprFact::single_cpu_metadata(cpu_reg2rnr(r));
    28.5    }
    28.6  
    28.7 +  static LIR_Opr as_address_opr(Register r) {
    28.8 +    return LIR_OprFact::single_cpu_address(cpu_reg2rnr(r));
    28.9 +  }
   28.10 +
   28.11    FrameMap(ciMethod* method, int monitors, int reserved_argument_area_size);
   28.12    bool finalize_frame(int nof_slots);
   28.13  
    29.1 --- a/src/share/vm/c1/c1_LIRGenerator.cpp	Wed Apr 15 11:14:58 2020 +0800
    29.2 +++ b/src/share/vm/c1/c1_LIRGenerator.cpp	Wed Apr 15 11:49:55 2020 +0800
    29.3 @@ -580,11 +580,11 @@
    29.4  
    29.5      case Bytecodes::_imul:
    29.6        {
    29.7 -        bool    did_strength_reduce = false;
    29.8 +        bool did_strength_reduce = false;
    29.9  
   29.10          if (right->is_constant()) {
   29.11 -          int c = right->as_jint();
   29.12 -          if (is_power_of_2(c)) {
   29.13 +          jint c = right->as_jint();
   29.14 +          if (c > 0 && is_power_of_2(c)) {
   29.15              // do not need tmp here
   29.16              __ shift_left(left_op, exact_log2(c), result_op);
   29.17              did_strength_reduce = true;
   29.18 @@ -2528,7 +2528,7 @@
   29.19          __ branch(lir_cond_equal, src_reg, LIR_OprFact::oopConst(NULL),  Lcont->label());
   29.20  #endif
   29.21        }
   29.22 -      LIR_Opr src_klass = new_register(T_OBJECT);
   29.23 +      LIR_Opr src_klass = new_register(T_METADATA);
   29.24        if (gen_type_check) {
   29.25          // We have determined that offset == referent_offset && src != null.
   29.26          // if (src->_klass->_reference_type == REF_NONE) -> continue
   29.27 @@ -3530,7 +3530,7 @@
   29.28  void LIRGenerator::do_ProfileCall(ProfileCall* x) {
   29.29    // Need recv in a temporary register so it interferes with the other temporaries
   29.30    LIR_Opr recv = LIR_OprFact::illegalOpr;
   29.31 -  LIR_Opr mdo = new_register(T_OBJECT);
   29.32 +  LIR_Opr mdo = new_register(T_METADATA);
   29.33    // tmp is used to hold the counters on SPARC
   29.34    LIR_Opr tmp = new_pointer_register();
   29.35  
    30.1 --- a/src/share/vm/c1/c1_LIRGenerator.hpp	Wed Apr 15 11:14:58 2020 +0800
    30.2 +++ b/src/share/vm/c1/c1_LIRGenerator.hpp	Wed Apr 15 11:49:55 2020 +0800
    30.3 @@ -325,7 +325,7 @@
    30.4    // is_strictfp is only needed for mul and div (and only generates different code on i486)
    30.5    void arithmetic_op(Bytecodes::Code code, LIR_Opr result, LIR_Opr left, LIR_Opr right, bool is_strictfp, LIR_Opr tmp, CodeEmitInfo* info = NULL);
    30.6    // machine dependent.  returns true if it emitted code for the multiply
    30.7 -  bool strength_reduce_multiply(LIR_Opr left, int constant, LIR_Opr result, LIR_Opr tmp);
    30.8 +  bool strength_reduce_multiply(LIR_Opr left, jint constant, LIR_Opr result, LIR_Opr tmp);
    30.9  
   30.10    void store_stack_parameter (LIR_Opr opr, ByteSize offset_from_sp_in_bytes);
   30.11  
    31.1 --- a/src/share/vm/code/debugInfo.cpp	Wed Apr 15 11:14:58 2020 +0800
    31.2 +++ b/src/share/vm/code/debugInfo.cpp	Wed Apr 15 11:49:55 2020 +0800
    31.3 @@ -27,6 +27,8 @@
    31.4  #include "code/debugInfoRec.hpp"
    31.5  #include "code/nmethod.hpp"
    31.6  #include "runtime/handles.inline.hpp"
    31.7 +#include "runtime/interfaceSupport.hpp"
    31.8 +#include "runtime/thread.hpp"
    31.9  
   31.10  PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
   31.11  
   31.12 @@ -204,14 +206,24 @@
   31.13  // ConstantOopWriteValue
   31.14  
   31.15  void ConstantOopWriteValue::write_on(DebugInfoWriteStream* stream) {
   31.16 -  assert(JNIHandles::resolve(value()) == NULL ||
   31.17 -         Universe::heap()->is_in_reserved(JNIHandles::resolve(value())),
   31.18 -         "Should be in heap");
   31.19 +#ifdef ASSERT
   31.20 +  {
   31.21 +    // cannot use ThreadInVMfromNative here since in case of JVMCI compiler,
   31.22 +    // thread is already in VM state.
   31.23 +    ThreadInVMfromUnknown tiv;
   31.24 +    assert(JNIHandles::resolve(value()) == NULL ||
   31.25 +           Universe::heap()->is_in_reserved(JNIHandles::resolve(value())),
   31.26 +           "Should be in heap");
   31.27 + }
   31.28 +#endif
   31.29    stream->write_int(CONSTANT_OOP_CODE);
   31.30    stream->write_handle(value());
   31.31  }
   31.32  
   31.33  void ConstantOopWriteValue::print_on(outputStream* st) const {
   31.34 +  // using ThreadInVMfromUnknown here since in case of JVMCI compiler,
   31.35 +  // thread is already in VM state.
   31.36 +  ThreadInVMfromUnknown tiv;
   31.37    JNIHandles::resolve(value())->print_value_on(st);
   31.38  }
   31.39  
    32.1 --- a/src/share/vm/code/vtableStubs.cpp	Wed Apr 15 11:14:58 2020 +0800
    32.2 +++ b/src/share/vm/code/vtableStubs.cpp	Wed Apr 15 11:49:55 2020 +0800
    32.3 @@ -1,5 +1,5 @@
    32.4  /*
    32.5 - * Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved.
    32.6 + * Copyright (c) 1997, 2019, 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 @@ -110,7 +110,7 @@
   32.11  address VtableStubs::find_stub(bool is_vtable_stub, int vtable_index) {
   32.12    assert(vtable_index >= 0, "must be positive");
   32.13  
   32.14 -  VtableStub* s = ShareVtableStubs ? lookup(is_vtable_stub, vtable_index) : NULL;
   32.15 +  VtableStub* s = lookup(is_vtable_stub, vtable_index);
   32.16    if (s == NULL) {
   32.17      if (is_vtable_stub) {
   32.18        s = create_vtable_stub(vtable_index);
    33.1 --- a/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp	Wed Apr 15 11:14:58 2020 +0800
    33.2 +++ b/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp	Wed Apr 15 11:49:55 2020 +0800
    33.3 @@ -1928,9 +1928,7 @@
    33.4  
    33.5      // Has the GC time limit been exceeded?
    33.6      DefNewGeneration* young_gen = _young_gen->as_DefNewGeneration();
    33.7 -    size_t max_eden_size = young_gen->max_capacity() -
    33.8 -                           young_gen->to()->capacity() -
    33.9 -                           young_gen->from()->capacity();
   33.10 +    size_t max_eden_size = young_gen->max_eden_size();
   33.11      GenCollectedHeap* gch = GenCollectedHeap::heap();
   33.12      GCCause::Cause gc_cause = gch->gc_cause();
   33.13      size_policy()->check_gc_overhead_limit(_young_gen->used(),
    34.1 --- a/src/share/vm/opto/c2_globals.hpp	Wed Apr 15 11:14:58 2020 +0800
    34.2 +++ b/src/share/vm/opto/c2_globals.hpp	Wed Apr 15 11:49:55 2020 +0800
    34.3 @@ -369,9 +369,6 @@
    34.4            "File to dump ideal graph to.  If set overrides the "             \
    34.5            "use of the network")                                             \
    34.6                                                                              \
    34.7 -  product(bool, UseOldInlining, true,                                       \
    34.8 -          "Enable the 1.3 inlining strategy")                               \
    34.9 -                                                                            \
   34.10    product(bool, UseBimorphicInlining, true,                                 \
   34.11            "Profiling based inlining for two receivers")                     \
   34.12                                                                              \
    35.1 --- a/src/share/vm/opto/loopPredicate.cpp	Wed Apr 15 11:14:58 2020 +0800
    35.2 +++ b/src/share/vm/opto/loopPredicate.cpp	Wed Apr 15 11:49:55 2020 +0800
    35.3 @@ -502,7 +502,31 @@
    35.4      _lpt(lpt), _phase(lpt->_phase),
    35.5      _visited(area), _invariant(area), _stack(area, 10 /* guess */),
    35.6      _clone_visited(area), _old_new(area)
    35.7 -  {}
    35.8 +  {
    35.9 +    Node* head = _lpt->_head;
   35.10 +    Node* entry = head->in(LoopNode::EntryControl);
   35.11 +    if (entry->outcnt() != 1) {
   35.12 +      // If a node is pinned between the predicates and the loop
   35.13 +      // entry, we won't be able to move any node in the loop that
   35.14 +      // depends on it above it in a predicate. Mark all those nodes
   35.15 +      // as non loop invariatnt.
   35.16 +      Unique_Node_List wq;
   35.17 +      wq.push(entry);
   35.18 +      for (uint next = 0; next < wq.size(); ++next) {
   35.19 +        Node *n = wq.at(next);
   35.20 +        for (DUIterator_Fast imax, i = n->fast_outs(imax); i < imax; i++) {
   35.21 +          Node* u = n->fast_out(i);
   35.22 +          if (!u->is_CFG()) {
   35.23 +            Node* c = _phase->get_ctrl(u);
   35.24 +            if (_lpt->is_member(_phase->get_loop(c)) || _phase->is_dominator(c, head)) {
   35.25 +              _visited.set(u->_idx);
   35.26 +              wq.push(u);
   35.27 +            }
   35.28 +          }
   35.29 +        }
   35.30 +      }
   35.31 +    }
   35.32 +  }
   35.33  
   35.34    // Map old to n for invariance computation and clone
   35.35    void map_ctrl(Node* old, Node* n) {
    36.1 --- a/src/share/vm/opto/memnode.cpp	Wed Apr 15 11:14:58 2020 +0800
    36.2 +++ b/src/share/vm/opto/memnode.cpp	Wed Apr 15 11:49:55 2020 +0800
    36.3 @@ -2485,7 +2485,8 @@
    36.4      assert(mem != mem->in(MemNode::Memory), "dead loop in StoreNode::Ideal");
    36.5  
    36.6      assert(Opcode() == mem->Opcode() ||
    36.7 -           phase->C->get_alias_index(adr_type()) == Compile::AliasIdxRaw,
    36.8 +           phase->C->get_alias_index(adr_type()) == Compile::AliasIdxRaw ||
    36.9 +           (is_mismatched_access() || mem->as_Store()->is_mismatched_access()),
   36.10             "no mismatched stores, except on raw memory");
   36.11  
   36.12      if (mem->outcnt() == 1 &&           // check for intervening uses
    37.1 --- a/src/share/vm/opto/node.cpp	Wed Apr 15 11:14:58 2020 +0800
    37.2 +++ b/src/share/vm/opto/node.cpp	Wed Apr 15 11:49:55 2020 +0800
    37.3 @@ -286,6 +286,10 @@
    37.4  #ifdef _MSC_VER // the IDX_INIT hack falls foul of warning C4355
    37.5  #pragma warning( disable:4355 ) // 'this' : used in base member initializer list
    37.6  #endif
    37.7 +#ifdef __clang__
    37.8 +#pragma clang diagnostic push
    37.9 +#pragma GCC diagnostic ignored "-Wuninitialized"
   37.10 +#endif
   37.11  
   37.12  // Out-of-line code from node constructors.
   37.13  // Executed only when extra debug info. is being passed around.
   37.14 @@ -493,6 +497,10 @@
   37.15    _in[6] = n6; if (n6 != NULL) n6->add_out((Node *)this);
   37.16  }
   37.17  
   37.18 +#ifdef __clang__
   37.19 +#pragma clang diagnostic pop
   37.20 +#endif
   37.21 +
   37.22  
   37.23  //------------------------------clone------------------------------------------
   37.24  // Clone a Node.
    38.1 --- a/src/share/vm/opto/type.cpp	Wed Apr 15 11:14:58 2020 +0800
    38.2 +++ b/src/share/vm/opto/type.cpp	Wed Apr 15 11:49:55 2020 +0800
    38.3 @@ -3758,29 +3758,22 @@
    38.4    return make(_ptr, const_oop(), _ary, klass(), _klass_is_exact, _offset, instance_id, _speculative, _inline_depth);
    38.5  }
    38.6  
    38.7 +//-----------------------------max_array_length-------------------------------
    38.8 +// A wrapper around arrayOopDesc::max_array_length(etype) with some input normalization.
    38.9 +jint TypeAryPtr::max_array_length(BasicType etype) {
   38.10 +  if (!is_java_primitive(etype) && !is_reference_type(etype)) {
   38.11 +    if (etype == T_NARROWOOP) {
   38.12 +      etype = T_OBJECT;
   38.13 +    } else if (etype == T_ILLEGAL) { // bottom[]
   38.14 +      etype = T_BYTE; // will produce conservatively high value
   38.15 +    } else {
   38.16 +      fatal(err_msg("not an element type: %s", type2name(etype)));
   38.17 +    }
   38.18 +  }
   38.19 +  return arrayOopDesc::max_array_length(etype);
   38.20 +}
   38.21 +
   38.22  //-----------------------------narrow_size_type-------------------------------
   38.23 -// Local cache for arrayOopDesc::max_array_length(etype),
   38.24 -// which is kind of slow (and cached elsewhere by other users).
   38.25 -static jint max_array_length_cache[T_CONFLICT+1];
   38.26 -static jint max_array_length(BasicType etype) {
   38.27 -  jint& cache = max_array_length_cache[etype];
   38.28 -  jint res = cache;
   38.29 -  if (res == 0) {
   38.30 -    switch (etype) {
   38.31 -    case T_NARROWOOP:
   38.32 -      etype = T_OBJECT;
   38.33 -      break;
   38.34 -    case T_NARROWKLASS:
   38.35 -    case T_CONFLICT:
   38.36 -    case T_ILLEGAL:
   38.37 -    case T_VOID:
   38.38 -      etype = T_BYTE;           // will produce conservatively high value
   38.39 -    }
   38.40 -    cache = res = arrayOopDesc::max_array_length(etype);
   38.41 -  }
   38.42 -  return res;
   38.43 -}
   38.44 -
   38.45  // Narrow the given size type to the index range for the given array base type.
   38.46  // Return NULL if the resulting int type becomes empty.
   38.47  const TypeInt* TypeAryPtr::narrow_size_type(const TypeInt* size) const {
    39.1 --- a/src/share/vm/opto/type.hpp	Wed Apr 15 11:14:58 2020 +0800
    39.2 +++ b/src/share/vm/opto/type.hpp	Wed Apr 15 11:49:55 2020 +0800
    39.3 @@ -433,7 +433,6 @@
    39.4  
    39.5  private:
    39.6    // support arrays
    39.7 -  static const BasicType _basic_type[];
    39.8    static const Type*        _zero_type[T_CONFLICT+1];
    39.9    static const Type* _const_basic_type[T_CONFLICT+1];
   39.10  };
   39.11 @@ -1154,6 +1153,8 @@
   39.12    const TypeAryPtr* cast_to_stable(bool stable, int stable_dimension = 1) const;
   39.13    int stable_dimension() const;
   39.14  
   39.15 +  static jint max_array_length(BasicType etype) ;
   39.16 +
   39.17    // Convenience common pre-built types.
   39.18    static const TypeAryPtr *RANGE;
   39.19    static const TypeAryPtr *OOPS;
    40.1 --- a/src/share/vm/prims/forte.cpp	Wed Apr 15 11:14:58 2020 +0800
    40.2 +++ b/src/share/vm/prims/forte.cpp	Wed Apr 15 11:49:55 2020 +0800
    40.3 @@ -625,7 +625,7 @@
    40.4  #ifdef __APPLE__
    40.5  // XXXDARWIN: Link errors occur even when __attribute__((weak_import))
    40.6  // is added
    40.7 -#define collector_func_load(x0,x1,x2,x3,x4,x5,x6) (0)
    40.8 +#define collector_func_load(x0,x1,x2,x3,x4,x5,x6) ((void) 0)
    40.9  #else
   40.10  void    collector_func_load(char* name,
   40.11                              void* null_argument_1,
    41.1 --- a/src/share/vm/prims/jni.cpp	Wed Apr 15 11:14:58 2020 +0800
    41.2 +++ b/src/share/vm/prims/jni.cpp	Wed Apr 15 11:49:55 2020 +0800
    41.3 @@ -5101,6 +5101,7 @@
    41.4  void TestNewSize_test();
    41.5  void TestKlass_test();
    41.6  void Test_linked_list();
    41.7 +void TestResourcehash_test();
    41.8  void TestChunkedList_test();
    41.9  #if INCLUDE_ALL_GCS
   41.10  void TestOldFreeSpaceCalculation_test();
   41.11 @@ -5133,6 +5134,7 @@
   41.12      run_unit_test(test_snprintf());
   41.13      run_unit_test(TestNewSize_test());
   41.14      run_unit_test(TestKlass_test());
   41.15 +    run_unit_test(TestResourcehash_test());
   41.16      run_unit_test(Test_linked_list());
   41.17      run_unit_test(TestChunkedList_test());
   41.18      run_unit_test(ObjectMonitor::sanity_checks());
    42.1 --- a/src/share/vm/runtime/arguments.cpp	Wed Apr 15 11:14:58 2020 +0800
    42.2 +++ b/src/share/vm/runtime/arguments.cpp	Wed Apr 15 11:49:55 2020 +0800
    42.3 @@ -302,9 +302,10 @@
    42.4    { "UsePermISM",                    JDK_Version::jdk(8), JDK_Version::jdk(9) },
    42.5    { "UseMPSS",                       JDK_Version::jdk(8), JDK_Version::jdk(9) },
    42.6    { "UseStringCache",                JDK_Version::jdk(8), JDK_Version::jdk(9) },
    42.7 -  { "UseOldInlining",                JDK_Version::jdk(9), JDK_Version::jdk(10) },
    42.8 -  { "AutoShutdownNMT",               JDK_Version::jdk(9), JDK_Version::jdk(10) },
    42.9 +  { "UseOldInlining",                JDK_Version::jdk_update(8, 20), JDK_Version::jdk(10) },
   42.10 +  { "AutoShutdownNMT",               JDK_Version::jdk_update(8, 40), JDK_Version::jdk(10) },
   42.11    { "CompilationRepeat",             JDK_Version::jdk(8), JDK_Version::jdk(9) },
   42.12 +  { "SegmentedHeapDumpThreshold",    JDK_Version::jdk_update(8, 252), JDK_Version::jdk(10) },
   42.13  #ifdef PRODUCT
   42.14    { "DesiredMethodLimit",
   42.15                             JDK_Version::jdk_update(7, 2), JDK_Version::jdk(8) },
    43.1 --- a/src/share/vm/runtime/globals.hpp	Wed Apr 15 11:14:58 2020 +0800
    43.2 +++ b/src/share/vm/runtime/globals.hpp	Wed Apr 15 11:49:55 2020 +0800
    43.3 @@ -1,5 +1,5 @@
    43.4  /*
    43.5 - * Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved.
    43.6 + * Copyright (c) 1997, 2019, Oracle and/or its affiliates. All rights reserved.
    43.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    43.8   *
    43.9   * This code is free software; you can redistribute it and/or modify it
   43.10 @@ -1192,9 +1192,6 @@
   43.11    product(bool, ReduceSignalUsage, false,                                   \
   43.12            "Reduce the use of OS signals in Java and/or the VM")             \
   43.13                                                                              \
   43.14 -  develop_pd(bool, ShareVtableStubs,                                        \
   43.15 -          "Share vtable stubs (smaller code but worse branch prediction")   \
   43.16 -                                                                            \
   43.17    develop(bool, LoadLineNumberTables, true,                                 \
   43.18            "Tell whether the class file parser loads line number tables")    \
   43.19                                                                              \
    44.1 --- a/src/share/vm/runtime/java.cpp	Wed Apr 15 11:14:58 2020 +0800
    44.2 +++ b/src/share/vm/runtime/java.cpp	Wed Apr 15 11:49:55 2020 +0800
    44.3 @@ -344,7 +344,7 @@
    44.4      klassVtable::print_statistics();
    44.5      klassItable::print_statistics();
    44.6    }
    44.7 -  if (VerifyOops) {
    44.8 +  if (VerifyOops && Verbose) {
    44.9      tty->print_cr("+VerifyOops count: %d", StubRoutines::verify_oop_count());
   44.10    }
   44.11  
    45.1 --- a/src/share/vm/runtime/safepoint.hpp	Wed Apr 15 11:14:58 2020 +0800
    45.2 +++ b/src/share/vm/runtime/safepoint.hpp	Wed Apr 15 11:49:55 2020 +0800
    45.3 @@ -190,7 +190,7 @@
    45.4  };
    45.5  
    45.6  // State class for a thread suspended at a safepoint
    45.7 -class ThreadSafepointState: public CHeapObj<mtInternal> {
    45.8 +class ThreadSafepointState: public CHeapObj<mtThread> {
    45.9   public:
   45.10    // These states are maintained by VM thread while threads are being brought
   45.11    // to a safepoint.  After SafepointSynchronize::end(), they are reset to
    46.1 --- a/src/share/vm/runtime/synchronizer.cpp	Wed Apr 15 11:14:58 2020 +0800
    46.2 +++ b/src/share/vm/runtime/synchronizer.cpp	Wed Apr 15 11:49:55 2020 +0800
    46.3 @@ -149,7 +149,7 @@
    46.4  #define NINFLATIONLOCKS 256
    46.5  static volatile intptr_t InflationLocks [NINFLATIONLOCKS] ;
    46.6  
    46.7 -ObjectMonitor * ObjectSynchronizer::gBlockList = NULL ;
    46.8 +ObjectMonitor * volatile ObjectSynchronizer::gBlockList = NULL;
    46.9  ObjectMonitor * volatile ObjectSynchronizer::gFreeList  = NULL ;
   46.10  ObjectMonitor * volatile ObjectSynchronizer::gOmInUseList  = NULL ;
   46.11  int ObjectSynchronizer::gOmInUseCount = 0;
   46.12 @@ -830,18 +830,18 @@
   46.13  // Visitors ...
   46.14  
   46.15  void ObjectSynchronizer::monitors_iterate(MonitorClosure* closure) {
   46.16 -  ObjectMonitor* block = gBlockList;
   46.17 -  ObjectMonitor* mid;
   46.18 -  while (block) {
   46.19 +  ObjectMonitor* block =
   46.20 +    (ObjectMonitor*)OrderAccess::load_ptr_acquire(&gBlockList);
   46.21 +  while (block != NULL) {
   46.22      assert(block->object() == CHAINMARKER, "must be a block header");
   46.23      for (int i = _BLOCKSIZE - 1; i > 0; i--) {
   46.24 -      mid = block + i;
   46.25 -      oop object = (oop) mid->object();
   46.26 +      ObjectMonitor* mid = (ObjectMonitor *)(block + i);
   46.27 +      oop object = (oop)mid->object();
   46.28        if (object != NULL) {
   46.29          closure->do_monitor(mid);
   46.30        }
   46.31      }
   46.32 -    block = (ObjectMonitor*) block->FreeNext;
   46.33 +    block = (ObjectMonitor*)block->FreeNext;
   46.34    }
   46.35  }
   46.36  
   46.37 @@ -856,7 +856,9 @@
   46.38  
   46.39  void ObjectSynchronizer::oops_do(OopClosure* f) {
   46.40    assert(SafepointSynchronize::is_at_safepoint(), "must be at safepoint");
   46.41 -  for (ObjectMonitor* block = gBlockList; block != NULL; block = next(block)) {
   46.42 +  ObjectMonitor* block =
   46.43 +    (ObjectMonitor*)OrderAccess::load_ptr_acquire(&gBlockList);
   46.44 +  for (; block != NULL; block = (ObjectMonitor *)next(block)) {
   46.45      assert(block->object() == CHAINMARKER, "must be a block header");
   46.46      for (int i = 1; i < _BLOCKSIZE; i++) {
   46.47        ObjectMonitor* mid = &block[i];
   46.48 @@ -1059,7 +1061,9 @@
   46.49          // The very first objectMonitor in a block is reserved and dedicated.
   46.50          // It serves as blocklist "next" linkage.
   46.51          temp[0].FreeNext = gBlockList;
   46.52 -        gBlockList = temp;
   46.53 +        // There are lock-free uses of gBlockList so make sure that
   46.54 +        // the previous stores happen before we update gBlockList.
   46.55 +        OrderAccess::release_store_ptr(&gBlockList, temp);
   46.56  
   46.57          // Add the new string of objectMonitors to the global free list
   46.58          temp[_BLOCKSIZE - 1].FreeNext = gFreeList ;
   46.59 @@ -1536,29 +1540,33 @@
   46.60       nInuse += gOmInUseCount;
   46.61      }
   46.62  
   46.63 -  } else for (ObjectMonitor* block = gBlockList; block != NULL; block = next(block)) {
   46.64 -  // Iterate over all extant monitors - Scavenge all idle monitors.
   46.65 -    assert(block->object() == CHAINMARKER, "must be a block header");
   46.66 -    nInCirculation += _BLOCKSIZE ;
   46.67 -    for (int i = 1 ; i < _BLOCKSIZE; i++) {
   46.68 -      ObjectMonitor* mid = &block[i];
   46.69 -      oop obj = (oop) mid->object();
   46.70 +  } else {
   46.71 +    ObjectMonitor* block =
   46.72 +      (ObjectMonitor*)OrderAccess::load_ptr_acquire(&gBlockList);
   46.73 +    for (; block != NULL; block = (ObjectMonitor*)next(block)) {
   46.74 +      // Iterate over all extant monitors - Scavenge all idle monitors.
   46.75 +      assert(block->object() == CHAINMARKER, "must be a block header");
   46.76 +      nInCirculation += _BLOCKSIZE;
   46.77 +      for (int i = 1; i < _BLOCKSIZE; i++) {
   46.78 +        ObjectMonitor* mid = (ObjectMonitor*)&block[i];
   46.79 +        oop obj = (oop)mid->object();
   46.80  
   46.81 -      if (obj == NULL) {
   46.82 -        // The monitor is not associated with an object.
   46.83 -        // The monitor should either be a thread-specific private
   46.84 -        // free list or the global free list.
   46.85 -        // obj == NULL IMPLIES mid->is_busy() == 0
   46.86 -        guarantee (!mid->is_busy(), "invariant") ;
   46.87 -        continue ;
   46.88 -      }
   46.89 -      deflated = deflate_monitor(mid, obj, &FreeHead, &FreeTail);
   46.90 +        if (obj == NULL) {
   46.91 +          // The monitor is not associated with an object.
   46.92 +          // The monitor should either be a thread-specific private
   46.93 +          // free list or the global free list.
   46.94 +          // obj == NULL IMPLIES mid->is_busy() == 0
   46.95 +          guarantee(!mid->is_busy(), "invariant");
   46.96 +          continue;
   46.97 +        }
   46.98 +        deflated = deflate_monitor(mid, obj, &FreeHead, &FreeTail);
   46.99  
  46.100 -      if (deflated) {
  46.101 -        mid->FreeNext = NULL ;
  46.102 -        nScavenged ++ ;
  46.103 -      } else {
  46.104 -        nInuse ++;
  46.105 +        if (deflated) {
  46.106 +          mid->FreeNext = NULL;
  46.107 +          nScavenged++;
  46.108 +        } else {
  46.109 +          nInuse++;
  46.110 +        }
  46.111        }
  46.112      }
  46.113    }
  46.114 @@ -1693,13 +1701,13 @@
  46.115  
  46.116  // Verify all monitors in the monitor cache, the verification is weak.
  46.117  void ObjectSynchronizer::verify() {
  46.118 -  ObjectMonitor* block = gBlockList;
  46.119 -  ObjectMonitor* mid;
  46.120 -  while (block) {
  46.121 +  ObjectMonitor* block =
  46.122 +    (ObjectMonitor *)OrderAccess::load_ptr_acquire(&gBlockList);
  46.123 +  while (block != NULL) {
  46.124      assert(block->object() == CHAINMARKER, "must be a block header");
  46.125      for (int i = 1; i < _BLOCKSIZE; i++) {
  46.126 -      mid = block + i;
  46.127 -      oop object = (oop) mid->object();
  46.128 +      ObjectMonitor* mid = (ObjectMonitor *)(block + i);
  46.129 +      oop object = (oop)mid->object();
  46.130        if (object != NULL) {
  46.131          mid->verify();
  46.132        }
  46.133 @@ -1713,18 +1721,18 @@
  46.134  // the list of extant blocks without taking a lock.
  46.135  
  46.136  int ObjectSynchronizer::verify_objmon_isinpool(ObjectMonitor *monitor) {
  46.137 -  ObjectMonitor* block = gBlockList;
  46.138 -
  46.139 -  while (block) {
  46.140 +  ObjectMonitor* block =
  46.141 +    (ObjectMonitor*)OrderAccess::load_ptr_acquire(&gBlockList);
  46.142 +  while (block != NULL) {
  46.143      assert(block->object() == CHAINMARKER, "must be a block header");
  46.144      if (monitor > &block[0] && monitor < &block[_BLOCKSIZE]) {
  46.145 -      address mon = (address) monitor;
  46.146 -      address blk = (address) block;
  46.147 +      address mon = (address)monitor;
  46.148 +      address blk = (address)block;
  46.149        size_t diff = mon - blk;
  46.150 -      assert((diff % sizeof(ObjectMonitor)) == 0, "check");
  46.151 +      assert((diff % sizeof(ObjectMonitor)) == 0, "must be aligned");
  46.152        return 1;
  46.153      }
  46.154 -    block = (ObjectMonitor*) block->FreeNext;
  46.155 +    block = (ObjectMonitor*)block->FreeNext;
  46.156    }
  46.157    return 0;
  46.158  }
    47.1 --- a/src/share/vm/runtime/synchronizer.hpp	Wed Apr 15 11:14:58 2020 +0800
    47.2 +++ b/src/share/vm/runtime/synchronizer.hpp	Wed Apr 15 11:49:55 2020 +0800
    47.3 @@ -131,7 +131,7 @@
    47.4  
    47.5   private:
    47.6    enum { _BLOCKSIZE = 128 };
    47.7 -  static ObjectMonitor* gBlockList;
    47.8 +  static ObjectMonitor * volatile gBlockList;
    47.9    static ObjectMonitor * volatile gFreeList;
   47.10    static ObjectMonitor * volatile gOmInUseList; // for moribund thread, so monitors they inflated still get scanned
   47.11    static int gOmInUseCount;
    48.1 --- a/src/share/vm/runtime/thread.cpp	Wed Apr 15 11:14:58 2020 +0800
    48.2 +++ b/src/share/vm/runtime/thread.cpp	Wed Apr 15 11:49:55 2020 +0800
    48.3 @@ -842,7 +842,9 @@
    48.4  }
    48.5  
    48.6  void Thread::oops_do(OopClosure* f, CLDClosure* cld_f, CodeBlobClosure* cf) {
    48.7 -  active_handles()->oops_do(f);
    48.8 +  if (active_handles() != NULL) {
    48.9 +    active_handles()->oops_do(f);
   48.10 +  }
   48.11    // Do oop for ThreadShadow
   48.12    f->do_oop((oop*)&_pending_exception);
   48.13    handle_area()->oops_do(f);
    49.1 --- a/src/share/vm/runtime/vmStructs.cpp	Wed Apr 15 11:14:58 2020 +0800
    49.2 +++ b/src/share/vm/runtime/vmStructs.cpp	Wed Apr 15 11:49:55 2020 +0800
    49.3 @@ -271,6 +271,7 @@
    49.4  
    49.5  #define VM_STRUCTS(nonstatic_field, \
    49.6                     static_field, \
    49.7 +                   static_ptr_volatile_field, \
    49.8                     unchecked_nonstatic_field, \
    49.9                     volatile_nonstatic_field, \
   49.10                     nonproduct_nonstatic_field, \
   49.11 @@ -1096,7 +1097,7 @@
   49.12    volatile_nonstatic_field(BasicLock,          _displaced_header,                             markOop)                               \
   49.13    nonstatic_field(BasicObjectLock,             _lock,                                         BasicLock)                             \
   49.14    nonstatic_field(BasicObjectLock,             _obj,                                          oop)                                   \
   49.15 -  static_field(ObjectSynchronizer,             gBlockList,                                    ObjectMonitor*)                        \
   49.16 +  static_ptr_volatile_field(ObjectSynchronizer,gBlockList,                                    ObjectMonitor*)                        \
   49.17                                                                                                                                       \
   49.18    /*********************/                                                                                                            \
   49.19    /* Matcher (C2 only) */                                                                                                            \
   49.20 @@ -2681,6 +2682,11 @@
   49.21  #define GENERATE_STATIC_VM_STRUCT_ENTRY(typeName, fieldName, type)                 \
   49.22   { QUOTE(typeName), QUOTE(fieldName), QUOTE(type), 1, 0, &typeName::fieldName },
   49.23  
   49.24 +// This macro generates a VMStructEntry line for a static pointer volatile field,
   49.25 +// e.g.: "static ObjectMonitor * volatile gBlockList;"
   49.26 +#define GENERATE_STATIC_PTR_VOLATILE_VM_STRUCT_ENTRY(typeName, fieldName, type)    \
   49.27 + { QUOTE(typeName), QUOTE(fieldName), QUOTE(type), 1, 0, (void*)&typeName::fieldName },
   49.28 +
   49.29  // This macro generates a VMStructEntry line for an unchecked
   49.30  // nonstatic field, in which the size of the type is also specified.
   49.31  // The type string is given as NULL, indicating an "opaque" type.
   49.32 @@ -2706,10 +2712,15 @@
   49.33  #define CHECK_VOLATILE_NONSTATIC_VM_STRUCT_ENTRY(typeName, fieldName, type)        \
   49.34   {typedef type dummyvtype; typeName *dummyObj = NULL; volatile dummyvtype* dummy = &dummyObj->fieldName; }
   49.35  
   49.36 -// This macro checks the type of a VMStructEntry by comparing pointer types
   49.37 +// This macro checks the type of a static VMStructEntry by comparing pointer types
   49.38  #define CHECK_STATIC_VM_STRUCT_ENTRY(typeName, fieldName, type)                    \
   49.39   {type* dummy = &typeName::fieldName; }
   49.40  
   49.41 +// This macro checks the type of a static pointer volatile VMStructEntry by comparing pointer types,
   49.42 +// e.g.: "static ObjectMonitor * volatile gBlockList;"
   49.43 +#define CHECK_STATIC_PTR_VOLATILE_VM_STRUCT_ENTRY(typeName, fieldName, type)       \
   49.44 + {type volatile * dummy = &typeName::fieldName; }
   49.45 +
   49.46  // This macro ensures the type of a field and its containing type are
   49.47  // present in the type table. The assertion string is shorter than
   49.48  // preferable because (incredibly) of a bug in Solstice NFS client
   49.49 @@ -2903,6 +2914,7 @@
   49.50  
   49.51    VM_STRUCTS(GENERATE_NONSTATIC_VM_STRUCT_ENTRY,
   49.52               GENERATE_STATIC_VM_STRUCT_ENTRY,
   49.53 +             GENERATE_STATIC_PTR_VOLATILE_VM_STRUCT_ENTRY,
   49.54               GENERATE_UNCHECKED_NONSTATIC_VM_STRUCT_ENTRY,
   49.55               GENERATE_NONSTATIC_VM_STRUCT_ENTRY,
   49.56               GENERATE_NONPRODUCT_NONSTATIC_VM_STRUCT_ENTRY,
   49.57 @@ -3061,6 +3073,7 @@
   49.58  VMStructs::init() {
   49.59    VM_STRUCTS(CHECK_NONSTATIC_VM_STRUCT_ENTRY,
   49.60               CHECK_STATIC_VM_STRUCT_ENTRY,
   49.61 +             CHECK_STATIC_PTR_VOLATILE_VM_STRUCT_ENTRY,
   49.62               CHECK_NO_OP,
   49.63               CHECK_VOLATILE_NONSTATIC_VM_STRUCT_ENTRY,
   49.64               CHECK_NONPRODUCT_NONSTATIC_VM_STRUCT_ENTRY,
   49.65 @@ -3176,9 +3189,11 @@
   49.66                          CHECK_NO_OP,
   49.67                          CHECK_NO_OP,
   49.68                          CHECK_NO_OP,
   49.69 +                        CHECK_NO_OP,
   49.70                          CHECK_NO_OP));
   49.71    debug_only(VM_STRUCTS(CHECK_NO_OP,
   49.72                          ENSURE_FIELD_TYPE_PRESENT,
   49.73 +                        ENSURE_FIELD_TYPE_PRESENT,
   49.74                          CHECK_NO_OP,
   49.75                          ENSURE_FIELD_TYPE_PRESENT,
   49.76                          ENSURE_NONPRODUCT_FIELD_TYPE_PRESENT,
    50.1 --- a/src/share/vm/runtime/vmThread.cpp	Wed Apr 15 11:14:58 2020 +0800
    50.2 +++ b/src/share/vm/runtime/vmThread.cpp	Wed Apr 15 11:49:55 2020 +0800
    50.3 @@ -507,6 +507,7 @@
    50.4            _cur_vm_operation = safepoint_ops;
    50.5            if (_cur_vm_operation != NULL) {
    50.6              do {
    50.7 +              EventMark em("Executing coalesced safepoint VM operation: %s", _cur_vm_operation->name());
    50.8                // evaluate_operation deletes the op object so we have
    50.9                // to grab the next op now
   50.10                VM_Operation* next = _cur_vm_operation->next();
    51.1 --- a/src/share/vm/services/heapDumper.cpp	Wed Apr 15 11:14:58 2020 +0800
    51.2 +++ b/src/share/vm/services/heapDumper.cpp	Wed Apr 15 11:49:55 2020 +0800
    51.3 @@ -50,8 +50,7 @@
    51.4   *   src/share/demo/jvmti/hprof/hprof_io.c
    51.5   *
    51.6   *
    51.7 - *  header    "JAVA PROFILE 1.0.1" or "JAVA PROFILE 1.0.2"
    51.8 - *            (0-terminated)
    51.9 + *  header    "JAVA PROFILE 1.0.2" (0-terminated)
   51.10   *
   51.11   *  u4        size of identifiers. Identifiers are used to represent
   51.12   *            UTF8 strings, objects, stack traces, etc. They usually
   51.13 @@ -382,6 +381,8 @@
   51.14    size_t _size;
   51.15    size_t _pos;
   51.16  
   51.17 +  jlong _dump_start;
   51.18 +
   51.19    char* _error;   // error message when I/O fails
   51.20  
   51.21    void set_file_descriptor(int fd)              { _fd = fd; }
   51.22 @@ -405,6 +406,10 @@
   51.23    bool is_open() const                  { return file_descriptor() >= 0; }
   51.24    void flush();
   51.25  
   51.26 +  jlong dump_start() const                      { return _dump_start; }
   51.27 +  void set_dump_start(jlong pos);
   51.28 +  julong current_record_length();
   51.29 +
   51.30    // total number of bytes written to the disk
   51.31    julong bytes_written() const          { return _bytes_written; }
   51.32  
   51.33 @@ -446,6 +451,7 @@
   51.34    _pos = 0;
   51.35    _error = NULL;
   51.36    _bytes_written = 0L;
   51.37 +  _dump_start = (jlong)-1;
   51.38    _fd = os::create_binary_file(path, false);    // don't replace existing file
   51.39  
   51.40    // if the open failed we record the error
   51.41 @@ -473,6 +479,22 @@
   51.42    }
   51.43  }
   51.44  
   51.45 +// sets the dump starting position
   51.46 +void DumpWriter::set_dump_start(jlong pos) {
   51.47 +  _dump_start = pos;
   51.48 +}
   51.49 +
   51.50 +julong DumpWriter::current_record_length() {
   51.51 +  if (is_open()) {
   51.52 +    // calculate the size of the dump record
   51.53 +    julong dump_end = bytes_written() + bytes_unwritten();
   51.54 +    assert(dump_end == (size_t)current_offset(), "checking");
   51.55 +    julong dump_len = dump_end - dump_start() - 4;
   51.56 +    return dump_len;
   51.57 +  }
   51.58 +  return 0;
   51.59 +}
   51.60 +
   51.61  // write directly to the file
   51.62  void DumpWriter::write_internal(void* s, size_t len) {
   51.63    if (is_open()) {
   51.64 @@ -641,6 +663,18 @@
   51.65    static void dump_prim_array(DumpWriter* writer, typeArrayOop array);
   51.66    // create HPROF_FRAME record for the given method and bci
   51.67    static void dump_stack_frame(DumpWriter* writer, int frame_serial_num, int class_serial_num, Method* m, int bci);
   51.68 +
   51.69 +  // check if we need to truncate an array
   51.70 +  static int calculate_array_max_length(DumpWriter* writer, arrayOop array, short header_size);
   51.71 +
   51.72 +  // writes a HPROF_HEAP_DUMP_SEGMENT record
   51.73 +  static void write_dump_header(DumpWriter* writer);
   51.74 +
   51.75 +  // fixes up the length of the current dump record
   51.76 +  static void write_current_dump_record_length(DumpWriter* writer);
   51.77 +
   51.78 +  // fixes up the current dump record and writes HPROF_HEAP_DUMP_END record
   51.79 +  static void end_of_dump(DumpWriter* writer);
   51.80  };
   51.81  
   51.82  // write a header of the given type
   51.83 @@ -1047,50 +1081,103 @@
   51.84    }
   51.85  }
   51.86  
   51.87 +// Hprof uses an u4 as record length field,
   51.88 +// which means we need to truncate arrays that are too long.
   51.89 +int DumperSupport::calculate_array_max_length(DumpWriter* writer, arrayOop array, short header_size) {
   51.90 +  BasicType type = ArrayKlass::cast(array->klass())->element_type();
   51.91 +  assert(type >= T_BOOLEAN && type <= T_OBJECT, "invalid array element type");
   51.92 +
   51.93 +  int length = array->length();
   51.94 +
   51.95 +  int type_size;
   51.96 +  if (type == T_OBJECT) {
   51.97 +    type_size = sizeof(address);
   51.98 +  } else {
   51.99 +    type_size = type2aelembytes(type);
  51.100 +  }
  51.101 +
  51.102 +  size_t length_in_bytes = (size_t)length * type_size;
  51.103 +
  51.104 +  // Create a new record if the current record is non-empty and the array can't fit.
  51.105 +  julong current_record_length = writer->current_record_length();
  51.106 +  if (current_record_length > 0 &&
  51.107 +      (current_record_length + header_size + length_in_bytes) > max_juint) {
  51.108 +    write_current_dump_record_length(writer);
  51.109 +    write_dump_header(writer);
  51.110 +
  51.111 +    // We now have an empty record.
  51.112 +    current_record_length = 0;
  51.113 +  }
  51.114 +
  51.115 +  // Calculate max bytes we can use.
  51.116 +  uint max_bytes = max_juint - (header_size + current_record_length);
  51.117 +
  51.118 +  // Array too long for the record?
  51.119 +  // Calculate max length and return it.
  51.120 +  if (length_in_bytes > max_bytes) {
  51.121 +    length = max_bytes / type_size;
  51.122 +    length_in_bytes = (size_t)length * type_size;
  51.123 +
  51.124 +    warning("cannot dump array of type %s[] with length %d; truncating to length %d",
  51.125 +            type2name_tab[type], array->length(), length);
  51.126 +  }
  51.127 +  return length;
  51.128 +}
  51.129 +
  51.130  // creates HPROF_GC_OBJ_ARRAY_DUMP record for the given object array
  51.131  void DumperSupport::dump_object_array(DumpWriter* writer, objArrayOop array) {
  51.132 +  // sizeof(u1) + 2 * sizeof(u4) + sizeof(objectID) + sizeof(classID)
  51.133 +  short header_size = 1 + 2 * 4 + 2 * sizeof(address);
  51.134 +
  51.135 +  int length = calculate_array_max_length(writer, array, header_size);
  51.136  
  51.137    writer->write_u1(HPROF_GC_OBJ_ARRAY_DUMP);
  51.138    writer->write_objectID(array);
  51.139    writer->write_u4(STACK_TRACE_ID);
  51.140 -  writer->write_u4((u4)array->length());
  51.141 +  writer->write_u4(length);
  51.142 +
  51.143  
  51.144    // array class ID
  51.145    writer->write_classID(array->klass());
  51.146  
  51.147    // [id]* elements
  51.148 -  for (int index=0; index<array->length(); index++) {
  51.149 +  for (int index = 0; index < length; index++) {
  51.150      oop o = array->obj_at(index);
  51.151      writer->write_objectID(o);
  51.152    }
  51.153  }
  51.154  
  51.155 -#define WRITE_ARRAY(Array, Type, Size) \
  51.156 -  for (int i=0; i<Array->length(); i++) { writer->write_##Size((Size)array->Type##_at(i)); }
  51.157 -
  51.158 +#define WRITE_ARRAY(Array, Type, Size, Length) \
  51.159 +  for (int i = 0; i < Length; i++) { writer->write_##Size((Size)array->Type##_at(i)); }
  51.160  
  51.161  // creates HPROF_GC_PRIM_ARRAY_DUMP record for the given type array
  51.162  void DumperSupport::dump_prim_array(DumpWriter* writer, typeArrayOop array) {
  51.163    BasicType type = TypeArrayKlass::cast(array->klass())->element_type();
  51.164  
  51.165 +  // 2 * sizeof(u1) + 2 * sizeof(u4) + sizeof(objectID)
  51.166 +  short header_size = 2 * 1 + 2 * 4 + sizeof(address);
  51.167 +
  51.168 +  int length = calculate_array_max_length(writer, array, header_size);
  51.169 +  int type_size = type2aelembytes(type);
  51.170 +  u4 length_in_bytes = (u4)length * type_size;
  51.171 +
  51.172    writer->write_u1(HPROF_GC_PRIM_ARRAY_DUMP);
  51.173    writer->write_objectID(array);
  51.174    writer->write_u4(STACK_TRACE_ID);
  51.175 -  writer->write_u4((u4)array->length());
  51.176 +  writer->write_u4(length);
  51.177    writer->write_u1(type2tag(type));
  51.178  
  51.179    // nothing to copy
  51.180 -  if (array->length() == 0) {
  51.181 +  if (length == 0) {
  51.182      return;
  51.183    }
  51.184  
  51.185    // If the byte ordering is big endian then we can copy most types directly
  51.186 -  u4 length_in_bytes = (u4)array->length() * type2aelembytes(type);
  51.187  
  51.188    switch (type) {
  51.189      case T_INT : {
  51.190        if (Bytes::is_Java_byte_ordering_different()) {
  51.191 -        WRITE_ARRAY(array, int, u4);
  51.192 +        WRITE_ARRAY(array, int, u4, length);
  51.193        } else {
  51.194          writer->write_raw((void*)(array->int_at_addr(0)), length_in_bytes);
  51.195        }
  51.196 @@ -1102,7 +1189,7 @@
  51.197      }
  51.198      case T_CHAR : {
  51.199        if (Bytes::is_Java_byte_ordering_different()) {
  51.200 -        WRITE_ARRAY(array, char, u2);
  51.201 +        WRITE_ARRAY(array, char, u2, length);
  51.202        } else {
  51.203          writer->write_raw((void*)(array->char_at_addr(0)), length_in_bytes);
  51.204        }
  51.205 @@ -1110,7 +1197,7 @@
  51.206      }
  51.207      case T_SHORT : {
  51.208        if (Bytes::is_Java_byte_ordering_different()) {
  51.209 -        WRITE_ARRAY(array, short, u2);
  51.210 +        WRITE_ARRAY(array, short, u2, length);
  51.211        } else {
  51.212          writer->write_raw((void*)(array->short_at_addr(0)), length_in_bytes);
  51.213        }
  51.214 @@ -1118,7 +1205,7 @@
  51.215      }
  51.216      case T_BOOLEAN : {
  51.217        if (Bytes::is_Java_byte_ordering_different()) {
  51.218 -        WRITE_ARRAY(array, bool, u1);
  51.219 +        WRITE_ARRAY(array, bool, u1, length);
  51.220        } else {
  51.221          writer->write_raw((void*)(array->bool_at_addr(0)), length_in_bytes);
  51.222        }
  51.223 @@ -1126,7 +1213,7 @@
  51.224      }
  51.225      case T_LONG : {
  51.226        if (Bytes::is_Java_byte_ordering_different()) {
  51.227 -        WRITE_ARRAY(array, long, u8);
  51.228 +        WRITE_ARRAY(array, long, u8, length);
  51.229        } else {
  51.230          writer->write_raw((void*)(array->long_at_addr(0)), length_in_bytes);
  51.231        }
  51.232 @@ -1138,14 +1225,14 @@
  51.233      // use IEEE 754.
  51.234  
  51.235      case T_FLOAT : {
  51.236 -      for (int i=0; i<array->length(); i++) {
  51.237 -        dump_float( writer, array->float_at(i) );
  51.238 +      for (int i = 0; i < length; i++) {
  51.239 +        dump_float(writer, array->float_at(i));
  51.240        }
  51.241        break;
  51.242      }
  51.243      case T_DOUBLE : {
  51.244 -      for (int i=0; i<array->length(); i++) {
  51.245 -        dump_double( writer, array->double_at(i) );
  51.246 +      for (int i = 0; i < length; i++) {
  51.247 +        dump_double(writer, array->double_at(i));
  51.248        }
  51.249        break;
  51.250      }
  51.251 @@ -1362,8 +1449,6 @@
  51.252    JavaThread*           _oome_thread;
  51.253    Method*               _oome_constructor;
  51.254    bool _gc_before_heap_dump;
  51.255 -  bool _is_segmented_dump;
  51.256 -  jlong _dump_start;
  51.257    GrowableArray<Klass*>* _klass_map;
  51.258    ThreadStackTrace** _stack_traces;
  51.259    int _num_threads;
  51.260 @@ -1382,11 +1467,6 @@
  51.261    void clear_global_dumper() { _global_dumper = NULL; }
  51.262    void clear_global_writer() { _global_writer = NULL; }
  51.263  
  51.264 -  bool is_segmented_dump() const                { return _is_segmented_dump; }
  51.265 -  void set_segmented_dump()                     { _is_segmented_dump = true; }
  51.266 -  jlong dump_start() const                      { return _dump_start; }
  51.267 -  void set_dump_start(jlong pos);
  51.268 -
  51.269    bool skip_operation() const;
  51.270  
  51.271    // writes a HPROF_LOAD_CLASS record
  51.272 @@ -1411,16 +1491,6 @@
  51.273    // HPROF_TRACE and HPROF_FRAME records
  51.274    void dump_stack_traces();
  51.275  
  51.276 -  // writes a HPROF_HEAP_DUMP or HPROF_HEAP_DUMP_SEGMENT record
  51.277 -  void write_dump_header();
  51.278 -
  51.279 -  // fixes up the length of the current dump record
  51.280 -  void write_current_dump_record_length();
  51.281 -
  51.282 -  // fixes up the current dump record )and writes HPROF_HEAP_DUMP_END
  51.283 -  // record in the case of a segmented heap dump)
  51.284 -  void end_of_dump();
  51.285 -
  51.286   public:
  51.287    VM_HeapDumper(DumpWriter* writer, bool gc_before_heap_dump, bool oome) :
  51.288      VM_GC_Operation(0 /* total collections,      dummy, ignored */,
  51.289 @@ -1429,8 +1499,6 @@
  51.290                      gc_before_heap_dump) {
  51.291      _local_writer = writer;
  51.292      _gc_before_heap_dump = gc_before_heap_dump;
  51.293 -    _is_segmented_dump = false;
  51.294 -    _dump_start = (jlong)-1;
  51.295      _klass_map = new (ResourceObj::C_HEAP, mtInternal) GrowableArray<Klass*>(INITIAL_CLASS_COUNT, true);
  51.296      _stack_traces = NULL;
  51.297      _num_threads = 0;
  51.298 @@ -1470,35 +1538,23 @@
  51.299    return false;
  51.300  }
  51.301  
  51.302 -// sets the dump starting position
  51.303 -void VM_HeapDumper::set_dump_start(jlong pos) {
  51.304 -  _dump_start = pos;
  51.305 -}
  51.306 -
  51.307 - // writes a HPROF_HEAP_DUMP or HPROF_HEAP_DUMP_SEGMENT record
  51.308 -void VM_HeapDumper::write_dump_header() {
  51.309 -  if (writer()->is_open()) {
  51.310 -    if (is_segmented_dump()) {
  51.311 -      writer()->write_u1(HPROF_HEAP_DUMP_SEGMENT);
  51.312 -    } else {
  51.313 -      writer()->write_u1(HPROF_HEAP_DUMP);
  51.314 -    }
  51.315 -    writer()->write_u4(0); // current ticks
  51.316 + // writes a HPROF_HEAP_DUMP_SEGMENT record
  51.317 +void DumperSupport::write_dump_header(DumpWriter* writer) {
  51.318 +  if (writer->is_open()) {
  51.319 +    writer->write_u1(HPROF_HEAP_DUMP_SEGMENT);
  51.320 +    writer->write_u4(0); // current ticks
  51.321  
  51.322      // record the starting position for the dump (its length will be fixed up later)
  51.323 -    set_dump_start(writer()->current_offset());
  51.324 -    writer()->write_u4(0);
  51.325 +    writer->set_dump_start(writer->current_offset());
  51.326 +    writer->write_u4(0);
  51.327    }
  51.328  }
  51.329  
  51.330  // fixes up the length of the current dump record
  51.331 -void VM_HeapDumper::write_current_dump_record_length() {
  51.332 -  if (writer()->is_open()) {
  51.333 -    assert(dump_start() >= 0, "no dump start recorded");
  51.334 -
  51.335 -    // calculate the size of the dump record
  51.336 -    julong dump_end = writer()->current_offset();
  51.337 -    julong dump_len = (dump_end - dump_start() - 4);
  51.338 +void DumperSupport::write_current_dump_record_length(DumpWriter* writer) {
  51.339 +  if (writer->is_open()) {
  51.340 +    julong dump_end = writer->bytes_written() + writer->bytes_unwritten();
  51.341 +    julong dump_len = writer->current_record_length();
  51.342  
  51.343      // record length must fit in a u4
  51.344      if (dump_len > max_juint) {
  51.345 @@ -1506,17 +1562,18 @@
  51.346      }
  51.347  
  51.348      // seek to the dump start and fix-up the length
  51.349 -    writer()->seek_to_offset(dump_start());
  51.350 -    writer()->write_u4((u4)dump_len);
  51.351 +    assert(writer->dump_start() >= 0, "no dump start recorded");
  51.352 +    writer->seek_to_offset(writer->dump_start());
  51.353 +    writer->write_u4((u4)dump_len);
  51.354  
  51.355      // adjust the total size written to keep the bytes written correct.
  51.356 -    writer()->adjust_bytes_written(-((jlong) sizeof(u4)));
  51.357 +    writer->adjust_bytes_written(-((jlong) sizeof(u4)));
  51.358  
  51.359      // seek to dump end so we can continue
  51.360 -    writer()->seek_to_offset(dump_end);
  51.361 +    writer->seek_to_offset(dump_end);
  51.362  
  51.363      // no current dump record
  51.364 -    set_dump_start((jlong)-1);
  51.365 +    writer->set_dump_start((jlong)-1);
  51.366    }
  51.367  }
  51.368  
  51.369 @@ -1524,33 +1581,23 @@
  51.370  // new segment.
  51.371  void VM_HeapDumper::check_segment_length() {
  51.372    if (writer()->is_open()) {
  51.373 -    if (is_segmented_dump()) {
  51.374 -      // don't use current_offset that would be too expensive on a per record basis
  51.375 -      julong dump_end = writer()->bytes_written() + writer()->bytes_unwritten();
  51.376 -      assert(dump_end == (julong)writer()->current_offset(), "checking");
  51.377 -      julong dump_len = (dump_end - dump_start() - 4);
  51.378 -      assert(dump_len <= max_juint, "bad dump length");
  51.379 +    julong dump_len = writer()->current_record_length();
  51.380  
  51.381 -      if (dump_len > HeapDumpSegmentSize) {
  51.382 -        write_current_dump_record_length();
  51.383 -        write_dump_header();
  51.384 -      }
  51.385 +    if (dump_len > 2UL*G) {
  51.386 +      DumperSupport::write_current_dump_record_length(writer());
  51.387 +      DumperSupport::write_dump_header(writer());
  51.388      }
  51.389    }
  51.390  }
  51.391  
  51.392 -// fixes up the current dump record )and writes HPROF_HEAP_DUMP_END
  51.393 -// record in the case of a segmented heap dump)
  51.394 -void VM_HeapDumper::end_of_dump() {
  51.395 -  if (writer()->is_open()) {
  51.396 -    write_current_dump_record_length();
  51.397 +// fixes up the current dump record and writes HPROF_HEAP_DUMP_END record
  51.398 +void DumperSupport::end_of_dump(DumpWriter* writer) {
  51.399 +  if (writer->is_open()) {
  51.400 +    write_current_dump_record_length(writer);
  51.401  
  51.402 -    // for segmented dump we write the end record
  51.403 -    if (is_segmented_dump()) {
  51.404 -      writer()->write_u1(HPROF_HEAP_DUMP_END);
  51.405 -      writer()->write_u4(0);
  51.406 -      writer()->write_u4(0);
  51.407 -    }
  51.408 +    writer->write_u1(HPROF_HEAP_DUMP_END);
  51.409 +    writer->write_u4(0);
  51.410 +    writer->write_u4(0);
  51.411    }
  51.412  }
  51.413  
  51.414 @@ -1716,16 +1763,17 @@
  51.415  //  [HPROF_LOAD_CLASS]*
  51.416  //  [[HPROF_FRAME]*|HPROF_TRACE]*
  51.417  //  [HPROF_GC_CLASS_DUMP]*
  51.418 -//  HPROF_HEAP_DUMP
  51.419 +//  [HPROF_HEAP_DUMP_SEGMENT]*
  51.420 +//  HPROF_HEAP_DUMP_END
  51.421  //
  51.422  // The HPROF_TRACE records represent the stack traces where the heap dump
  51.423  // is generated and a "dummy trace" record which does not include
  51.424  // any frames. The dummy trace record is used to be referenced as the
  51.425  // unknown object alloc site.
  51.426  //
  51.427 -// The HPROF_HEAP_DUMP record has a length following by sub-records. To allow
  51.428 -// the heap dump be generated in a single pass we remember the position of
  51.429 -// the dump length and fix it up after all sub-records have been written.
  51.430 +// Each HPROF_HEAP_DUMP_SEGMENT record has a length followed by sub-records.
  51.431 +// To allow the heap dump be generated in a single pass we remember the position
  51.432 +// of the dump length and fix it up after all sub-records have been written.
  51.433  // To generate the sub-records we iterate over the heap, writing
  51.434  // HPROF_GC_INSTANCE_DUMP, HPROF_GC_OBJ_ARRAY_DUMP, and HPROF_GC_PRIM_ARRAY_DUMP
  51.435  // records as we go. Once that is done we write records for some of the GC
  51.436 @@ -1752,15 +1800,9 @@
  51.437    set_global_dumper();
  51.438    set_global_writer();
  51.439  
  51.440 -  // Write the file header - use 1.0.2 for large heaps, otherwise 1.0.1
  51.441 +  // Write the file header - we always use 1.0.2
  51.442    size_t used = ch->used();
  51.443 -  const char* header;
  51.444 -  if (used > (size_t)SegmentedHeapDumpThreshold) {
  51.445 -    set_segmented_dump();
  51.446 -    header = "JAVA PROFILE 1.0.2";
  51.447 -  } else {
  51.448 -    header = "JAVA PROFILE 1.0.1";
  51.449 -  }
  51.450 +  const char* header = "JAVA PROFILE 1.0.2";
  51.451  
  51.452    // header is few bytes long - no chance to overflow int
  51.453    writer()->write_raw((void*)header, (int)strlen(header));
  51.454 @@ -1780,8 +1822,8 @@
  51.455    // this must be called after _klass_map is built when iterating the classes above.
  51.456    dump_stack_traces();
  51.457  
  51.458 -  // write HPROF_HEAP_DUMP or HPROF_HEAP_DUMP_SEGMENT
  51.459 -  write_dump_header();
  51.460 +  // write HPROF_HEAP_DUMP_SEGMENT
  51.461 +  DumperSupport::write_dump_header(writer());
  51.462  
  51.463    // Writes HPROF_GC_CLASS_DUMP records
  51.464    ClassLoaderDataGraph::classes_do(&do_class_dump);
  51.465 @@ -1789,9 +1831,9 @@
  51.466    check_segment_length();
  51.467  
  51.468    // writes HPROF_GC_INSTANCE_DUMP records.
  51.469 -  // After each sub-record is written check_segment_length will be invoked. When
  51.470 -  // generated a segmented heap dump this allows us to check if the current
  51.471 -  // segment exceeds a threshold and if so, then a new segment is started.
  51.472 +  // After each sub-record is written check_segment_length will be invoked
  51.473 +  // to check if the current segment exceeds a threshold. If so, a new
  51.474 +  // segment is started.
  51.475    // The HPROF_GC_CLASS_DUMP and HPROF_GC_INSTANCE_DUMP are the vast bulk
  51.476    // of the heap dump.
  51.477    HeapObjectDumper obj_dumper(this, writer());
  51.478 @@ -1817,9 +1859,8 @@
  51.479    StickyClassDumper class_dumper(writer());
  51.480    SystemDictionary::always_strong_classes_do(&class_dumper);
  51.481  
  51.482 -  // fixes up the length of the dump record. In the case of a segmented
  51.483 -  // heap then the HPROF_HEAP_DUMP_END record is also written.
  51.484 -  end_of_dump();
  51.485 +  // fixes up the length of the dump record and writes the HPROF_HEAP_DUMP_END record.
  51.486 +  DumperSupport::end_of_dump(writer());
  51.487  
  51.488    // Now we clear the global variables, so that a future dumper might run.
  51.489    clear_global_dumper();
    52.1 --- a/src/share/vm/utilities/globalDefinitions.hpp	Wed Apr 15 11:14:58 2020 +0800
    52.2 +++ b/src/share/vm/utilities/globalDefinitions.hpp	Wed Apr 15 11:49:55 2020 +0800
    52.3 @@ -653,6 +653,10 @@
    52.4    return (t == T_BYTE || t == T_SHORT);
    52.5  }
    52.6  
    52.7 +inline bool is_reference_type(BasicType t) {
    52.8 +  return (t == T_OBJECT || t == T_ARRAY);
    52.9 +}
   52.10 +
   52.11  // Convert a char from a classfile signature to a BasicType
   52.12  inline BasicType char2type(char c) {
   52.13    switch( c ) {
    53.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    53.2 +++ b/src/share/vm/utilities/resourceHash.cpp	Wed Apr 15 11:49:55 2020 +0800
    53.3 @@ -0,0 +1,182 @@
    53.4 +/*
    53.5 + * Copyright (c) 2015 Oracle and/or its affiliates. All rights reserved.
    53.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    53.7 + *
    53.8 + * This code is free software; you can redistribute it and/or modify it
    53.9 + * under the terms of the GNU General Public License version 2 only, as
   53.10 + * published by the Free Software Foundation.
   53.11 + *
   53.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
   53.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   53.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   53.15 + * version 2 for more details (a copy is included in the LICENSE file that
   53.16 + * accompanied this code).
   53.17 + *
   53.18 + * You should have received a copy of the GNU General Public License version
   53.19 + * 2 along with this work; if not, write to the Free Software Foundation,
   53.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   53.21 + *
   53.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   53.23 + * or visit www.oracle.com if you need additional information or have any
   53.24 + * questions.
   53.25 + *
   53.26 + */
   53.27 +
   53.28 +#include "precompiled.hpp"
   53.29 +#include "memory/allocation.hpp"
   53.30 +#include "memory/resourceArea.hpp"
   53.31 +#include "utilities/debug.hpp"
   53.32 +#include "utilities/resourceHash.hpp"
   53.33 +
   53.34 +#ifndef PRODUCT
   53.35 +
   53.36 +/////////////// Unit tests ///////////////
   53.37 +
   53.38 +class TestResourceHashtable : public AllStatic {
   53.39 +  typedef void* K;
   53.40 +  typedef int V;
   53.41 +
   53.42 +  static unsigned identity_hash(const K& k) {
   53.43 +    return (unsigned)(uintptr_t)k;
   53.44 +  }
   53.45 +
   53.46 +  static unsigned bad_hash(const K& k) {
   53.47 +    return 1;
   53.48 +  }
   53.49 +
   53.50 +  class EqualityTestIter {
   53.51 +   public:
   53.52 +    bool do_entry(K const& k, V const& v) {
   53.53 +      assert((uintptr_t)k == (uintptr_t)v, "");
   53.54 +      return true; // continue iteration
   53.55 +    }
   53.56 +  };
   53.57 +
   53.58 +  template<
   53.59 +  unsigned (*HASH)  (K const&)           = primitive_hash<K>,
   53.60 +  bool     (*EQUALS)(K const&, K const&) = primitive_equals<K>,
   53.61 +  unsigned SIZE = 256,
   53.62 +  ResourceObj::allocation_type ALLOC_TYPE = ResourceObj::RESOURCE_AREA,
   53.63 +  MEMFLAGS MEM_TYPE = mtInternal
   53.64 +  >
   53.65 +  class Runner : public AllStatic {
   53.66 +    static void* as_K(uintptr_t val) { return (void*)val; }
   53.67 +
   53.68 +   public:
   53.69 +    static void test_small() {
   53.70 +      EqualityTestIter et;
   53.71 +      ResourceHashtable<K, V, HASH, EQUALS, SIZE, ALLOC_TYPE, MEM_TYPE> rh;
   53.72 +
   53.73 +      assert(!rh.contains(as_K(0x1)), "");
   53.74 +
   53.75 +      assert(rh.put(as_K(0x1), 0x1), "");
   53.76 +      assert(rh.contains(as_K(0x1)), "");
   53.77 +
   53.78 +      assert(!rh.put(as_K(0x1), 0x1), "");
   53.79 +
   53.80 +      assert(rh.put(as_K(0x2), 0x2), "");
   53.81 +      assert(rh.put(as_K(0x3), 0x3), "");
   53.82 +      assert(rh.put(as_K(0x4), 0x4), "");
   53.83 +      assert(rh.put(as_K(0x5), 0x5), "");
   53.84 +
   53.85 +      assert(!rh.remove(as_K(0x0)), "");
   53.86 +      rh.iterate(&et);
   53.87 +
   53.88 +      assert(rh.remove(as_K(0x1)), "");
   53.89 +      rh.iterate(&et);
   53.90 +
   53.91 +    }
   53.92 +
   53.93 +    // We use keys with the low bits cleared since the default hash will do some shifting
   53.94 +    static void test_small_shifted() {
   53.95 +      EqualityTestIter et;
   53.96 +      ResourceHashtable<K, V, HASH, EQUALS, SIZE, ALLOC_TYPE, MEM_TYPE> rh;
   53.97 +
   53.98 +      assert(!rh.contains(as_K(0x10)), "");
   53.99 +
  53.100 +      assert(rh.put(as_K(0x10), 0x10), "");
  53.101 +      assert(rh.contains(as_K(0x10)), "");
  53.102 +
  53.103 +      assert(!rh.put(as_K(0x10), 0x10), "");
  53.104 +
  53.105 +      assert(rh.put(as_K(0x20), 0x20), "");
  53.106 +      assert(rh.put(as_K(0x30), 0x30), "");
  53.107 +      assert(rh.put(as_K(0x40), 0x40), "");
  53.108 +      assert(rh.put(as_K(0x50), 0x50), "");
  53.109 +
  53.110 +      assert(!rh.remove(as_K(0x00)), "");
  53.111 +
  53.112 +      assert(rh.remove(as_K(0x10)), "");
  53.113 +
  53.114 +      rh.iterate(&et);
  53.115 +    }
  53.116 +
  53.117 +    static void test(unsigned num_elements = SIZE) {
  53.118 +      EqualityTestIter et;
  53.119 +      ResourceHashtable<K, V, HASH, EQUALS, SIZE, ALLOC_TYPE, MEM_TYPE> rh;
  53.120 +
  53.121 +      for (uintptr_t i = 0; i < num_elements; ++i) {
  53.122 +        assert(rh.put(as_K(i), i), "");
  53.123 +      }
  53.124 +
  53.125 +      rh.iterate(&et);
  53.126 +
  53.127 +      for (uintptr_t i = num_elements; i > 0; --i) {
  53.128 +        uintptr_t index = i - 1;
  53.129 +        assert(rh.remove(as_K(index)), "");
  53.130 +      }
  53.131 +      rh.iterate(&et);
  53.132 +      for (uintptr_t i = num_elements; i > 0; --i) {
  53.133 +        uintptr_t index = i - 1;
  53.134 +        assert(!rh.remove(as_K(index)), "");
  53.135 +      }
  53.136 +      rh.iterate(&et);
  53.137 +    }
  53.138 +  };
  53.139 +
  53.140 + public:
  53.141 +  static void run_tests() {
  53.142 +    {
  53.143 +      ResourceMark rm;
  53.144 +      Runner<>::test_small();
  53.145 +      Runner<>::test_small_shifted();
  53.146 +      Runner<>::test();
  53.147 +    }
  53.148 +
  53.149 +    {
  53.150 +      ResourceMark rm;
  53.151 +      Runner<identity_hash>::test_small();
  53.152 +      Runner<identity_hash>::test_small_shifted();
  53.153 +      Runner<identity_hash>::test();
  53.154 +    }
  53.155 +
  53.156 +    {
  53.157 +      ResourceMark rm;
  53.158 +      Runner<bad_hash>::test_small();
  53.159 +      Runner<bad_hash>::test_small_shifted();
  53.160 +      Runner<bad_hash>::test();
  53.161 +    }
  53.162 +
  53.163 +
  53.164 +    assert(Thread::current()->resource_area()->nesting() == 0, "this code depends on not having an active ResourceMark");
  53.165 +    // The following test calls will cause an assert if resource allocations occur since we don't have an active mark
  53.166 +    Runner<primitive_hash<K>, primitive_equals<K>, 512, ResourceObj::C_HEAP>::test_small();
  53.167 +    Runner<primitive_hash<K>, primitive_equals<K>, 512, ResourceObj::C_HEAP>::test_small_shifted();
  53.168 +    Runner<primitive_hash<K>, primitive_equals<K>, 512, ResourceObj::C_HEAP>::test();
  53.169 +
  53.170 +    Runner<bad_hash, primitive_equals<K>, 512, ResourceObj::C_HEAP>::test_small();
  53.171 +    Runner<bad_hash, primitive_equals<K>, 512, ResourceObj::C_HEAP>::test_small_shifted();
  53.172 +    Runner<bad_hash, primitive_equals<K>, 512, ResourceObj::C_HEAP>::test();
  53.173 +
  53.174 +    Runner<identity_hash, primitive_equals<K>, 1, ResourceObj::C_HEAP>::test_small();
  53.175 +    Runner<identity_hash, primitive_equals<K>, 1, ResourceObj::C_HEAP>::test_small_shifted();
  53.176 +    Runner<identity_hash, primitive_equals<K>, 1, ResourceObj::C_HEAP>::test(512);
  53.177 +  }
  53.178 +};
  53.179 +
  53.180 +void TestResourcehash_test() {
  53.181 +  TestResourceHashtable::run_tests();
  53.182 +}
  53.183 +
  53.184 +#endif // not PRODUCT
  53.185 +
    54.1 --- a/src/share/vm/utilities/resourceHash.hpp	Wed Apr 15 11:14:58 2020 +0800
    54.2 +++ b/src/share/vm/utilities/resourceHash.hpp	Wed Apr 15 11:49:55 2020 +0800
    54.3 @@ -1,5 +1,5 @@
    54.4  /*
    54.5 - * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
    54.6 + * Copyright (c) 2012, 2015 Oracle and/or its affiliates. All rights reserved.
    54.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    54.8   *
    54.9   * This code is free software; you can redistribute it and/or modify it
   54.10 @@ -35,7 +35,7 @@
   54.11  
   54.12  template<typename K> unsigned primitive_hash(const K& k) {
   54.13    unsigned hash = (unsigned)((uintptr_t)k);
   54.14 -  return hash ^ (hash > 3); // just in case we're dealing with aligned ptrs
   54.15 +  return hash ^ (hash >> 3); // just in case we're dealing with aligned ptrs
   54.16  }
   54.17  
   54.18  template<typename K> bool primitive_equals(const K& k0, const K& k1) {
   54.19 @@ -50,7 +50,9 @@
   54.20      //typename ResourceHashtableFns<K>::equals_fn EQUALS = primitive_equals<K>,
   54.21      unsigned (*HASH)  (K const&)           = primitive_hash<K>,
   54.22      bool     (*EQUALS)(K const&, K const&) = primitive_equals<K>,
   54.23 -    unsigned SIZE = 256
   54.24 +    unsigned SIZE = 256,
   54.25 +    ResourceObj::allocation_type ALLOC_TYPE = ResourceObj::RESOURCE_AREA,
   54.26 +    MEMFLAGS MEM_TYPE = mtInternal
   54.27      >
   54.28  class ResourceHashtable : public ResourceObj {
   54.29   private:
   54.30 @@ -91,6 +93,21 @@
   54.31   public:
   54.32    ResourceHashtable() { memset(_table, 0, SIZE * sizeof(Node*)); }
   54.33  
   54.34 +  ~ResourceHashtable() {
   54.35 +    if (ALLOC_TYPE == C_HEAP) {
   54.36 +      Node* const* bucket = _table;
   54.37 +      while (bucket < &_table[SIZE]) {
   54.38 +        Node* node = *bucket;
   54.39 +        while (node != NULL) {
   54.40 +          Node* cur = node;
   54.41 +          node = node->_next;
   54.42 +          delete cur;
   54.43 +        }
   54.44 +        ++bucket;
   54.45 +      }
   54.46 +    }
   54.47 +  }
   54.48 +
   54.49    bool contains(K const& key) const {
   54.50      return get(key) != NULL;
   54.51    }
   54.52 @@ -105,17 +122,38 @@
   54.53      }
   54.54    }
   54.55  
   54.56 -  // Inserts or replaces a value in the table
   54.57 -  void put(K const& key, V const& value) {
   54.58 + /**
   54.59 +  * Inserts or replaces a value in the table.
   54.60 +  * @return: true:  if a new item is added
   54.61 +  *          false: if the item already existed and the value is updated
   54.62 +  */
   54.63 +  bool put(K const& key, V const& value) {
   54.64      unsigned hv = HASH(key);
   54.65      Node** ptr = lookup_node(hv, key);
   54.66      if (*ptr != NULL) {
   54.67        (*ptr)->_value = value;
   54.68 +      return false;
   54.69      } else {
   54.70 -      *ptr = new Node(hv, key, value);
   54.71 +      *ptr = new (ALLOC_TYPE, MEM_TYPE) Node(hv, key, value);
   54.72 +      return true;
   54.73      }
   54.74    }
   54.75  
   54.76 +  bool remove(K const& key) {
   54.77 +    unsigned hv = HASH(key);
   54.78 +    Node** ptr = lookup_node(hv, key);
   54.79 +
   54.80 +    Node* node = *ptr;
   54.81 +    if (node != NULL) {
   54.82 +      *ptr = node->_next;
   54.83 +      if (ALLOC_TYPE == C_HEAP) {
   54.84 +        delete node;
   54.85 +      }
   54.86 +      return true;
   54.87 +    }
   54.88 +    return false;
   54.89 +  }
   54.90 +
   54.91    // ITER contains bool do_entry(K const&, V const&), which will be
   54.92    // called for each entry in the table.  If do_entry() returns false,
   54.93    // the iteration is cancelled.
   54.94 @@ -132,6 +170,10 @@
   54.95        ++bucket;
   54.96      }
   54.97    }
   54.98 +
   54.99 +  static size_t node_size() {
  54.100 +    return sizeof(Node);
  54.101 +  }
  54.102  };
  54.103  
  54.104  
    55.1 --- a/src/share/vm/utilities/vmError.cpp	Wed Apr 15 11:14:58 2020 +0800
    55.2 +++ b/src/share/vm/utilities/vmError.cpp	Wed Apr 15 11:49:55 2020 +0800
    55.3 @@ -1072,7 +1072,7 @@
    55.4        out.print_raw   (cmd);
    55.5        out.print_raw_cr("\" ...");
    55.6  
    55.7 -      if (os::fork_and_exec(cmd, true) < 0) {
    55.8 +      if (os::fork_and_exec(cmd) < 0) {
    55.9          out.print_cr("os::fork_and_exec failed: %s (%d)", strerror(errno), errno);
   55.10        }
   55.11      }
   55.12 @@ -1159,7 +1159,7 @@
   55.13  #endif
   55.14      tty->print_cr("\"%s\"...", cmd);
   55.15  
   55.16 -    if (os::fork_and_exec(cmd) < 0) {
   55.17 +    if (os::fork_and_exec(cmd, true) < 0) {
   55.18        tty->print_cr("os::fork_and_exec failed: %s (%d)", strerror(errno), errno);
   55.19      }
   55.20    }
    56.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    56.2 +++ b/test/compiler/c1/MultiplyByMaxInt.java	Wed Apr 15 11:49:55 2020 +0800
    56.3 @@ -0,0 +1,53 @@
    56.4 +/*
    56.5 + * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
    56.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    56.7 + *
    56.8 + * This code is free software; you can redistribute it and/or modify it
    56.9 + * under the terms of the GNU General Public License version 2 only, as
   56.10 + * published by the Free Software Foundation.
   56.11 + *
   56.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
   56.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   56.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   56.15 + * version 2 for more details (a copy is included in the LICENSE file that
   56.16 + * accompanied this code).
   56.17 + *
   56.18 + * You should have received a copy of the GNU General Public License version
   56.19 + * 2 along with this work; if not, write to the Free Software Foundation,
   56.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   56.21 + *
   56.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   56.23 + * or visit www.oracle.com if you need additional information or have any
   56.24 + * questions.
   56.25 + */
   56.26 +
   56.27 +/*
   56.28 + * @test
   56.29 + * @bug 8181872
   56.30 + *
   56.31 + * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions
   56.32 + *                   -XX:CompileThreshold=100 -XX:+TieredCompilation -XX:TieredStopAtLevel=1
   56.33 + *                   -XX:-BackgroundCompilation -XX:CompileCommand=dontinline,compiler.c1.MultiplyByMaxInt::test
   56.34 + *                   compiler.c1.MultiplyByMaxInt
   56.35 + * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:-BackgroundCompilation
   56.36 + *                   -XX:CompileThreshold=100 -XX:+TieredCompilation -XX:TieredStopAtLevel=3
   56.37 + *                   -XX:CompileCommand=dontinline,compiler.c1.MultiplyByMaxInt::test
   56.38 + *                   compiler.c1.MultiplyByMaxInt
   56.39 + */
   56.40 +package compiler.c1;
   56.41 +
   56.42 +public class MultiplyByMaxInt {
   56.43 +    static int test(int x) {
   56.44 +        int loops = (x >>> 4) & 7;
   56.45 +        while (loops-- > 0) {
   56.46 +            x = (x * 2147483647) % 16807;
   56.47 +        }
   56.48 +        return x;
   56.49 +    }
   56.50 +
   56.51 +    public static void main(String[] args) {
   56.52 +        for (int i = 0; i < 20000; i++) {
   56.53 +            test(i);
   56.54 +        }
   56.55 +    }
   56.56 +}
    57.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    57.2 +++ b/test/compiler/criticalnatives/argumentcorruption/CheckLongArgs.java	Wed Apr 15 11:49:55 2020 +0800
    57.3 @@ -0,0 +1,54 @@
    57.4 +/*
    57.5 + * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
    57.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    57.7 + *
    57.8 + * This code is free software; you can redistribute it and/or modify it
    57.9 + * under the terms of the GNU General Public License version 2 only, as
   57.10 + * published by the Free Software Foundation.
   57.11 + *
   57.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
   57.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   57.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   57.15 + * version 2 for more details (a copy is included in the LICENSE file that
   57.16 + * accompanied this code).
   57.17 + *
   57.18 + * You should have received a copy of the GNU General Public License version
   57.19 + * 2 along with this work; if not, write to the Free Software Foundation,
   57.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   57.21 + *
   57.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   57.23 + * or visit www.oracle.com if you need additional information or have any
   57.24 + * questions.
   57.25 + */
   57.26 +
   57.27 +public class CheckLongArgs {
   57.28 +    static {
   57.29 +        System.loadLibrary("CNCheckLongArgs");
   57.30 +    }
   57.31 +    static native void m1(long a1, long a2, long a3, long a4,  long a5, long a6, long a7, long a8, byte[] result);
   57.32 +    static native void m2(long a1, int[] a2, long a3, int[] a4, long a5, int[] a6, long a7, int[] a8, long a9, byte[] result);
   57.33 +    public static void main(String args[]) throws Exception {
   57.34 +        test();
   57.35 +    }
   57.36 +    private static void test() throws Exception {
   57.37 +        int[] l1 = { 1111, 2222, 3333 };
   57.38 +        int[] l2 = { 4444, 5555, 6666 };
   57.39 +        int[] l3 = { 7777, 8888, 9999 };
   57.40 +        int[] l4 = { 1010, 2020, 3030 };
   57.41 +        byte[] result = { -1 };
   57.42 +        m1(1111111122222222L, 3333333344444444L, 5555555566666666L, 7777777788888888L, 9999999900000000L, 1212121234343434L,
   57.43 +           5656565678787878L, 9090909012121212L, result);
   57.44 +        check(result[0]);
   57.45 +        result[0] = -1;
   57.46 +        m2(1111111122222222L, l1, 3333333344444444L, l2, 5555555566666666L, l3, 7777777788888888L, l4, 9999999900000000L, result);
   57.47 +        check(result[0]);
   57.48 +    }
   57.49 +    private static void check(byte result) throws Exception {
   57.50 +        if (result != 2) {
   57.51 +            if (result == 1) {
   57.52 +              throw new Exception("critical native arguments mismatch");
   57.53 +            }
   57.54 +            throw new Exception("critical native lookup failed");
   57.55 +        }
   57.56 +    }
   57.57 +}
    58.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    58.2 +++ b/test/compiler/criticalnatives/argumentcorruption/Test8167409.sh	Wed Apr 15 11:49:55 2020 +0800
    58.3 @@ -0,0 +1,83 @@
    58.4 +#!/bin/sh
    58.5 +
    58.6 +#
    58.7 +#  Copyright (c) 1998, 2019, Oracle and/or its affiliates. All rights reserved.
    58.8 +#  Copyright (c) 2019 Huawei Technologies Co. LTD.  All Rights Reserved.
    58.9 +#  DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   58.10 +#
   58.11 +#  This code is free software; you can redistribute it and/or modify it
   58.12 +#  under the terms of the GNU General Public License version 2 only, as
   58.13 +#  published by the Free Software Foundation.
   58.14 +#
   58.15 +#  This code is distributed in the hope that it will be useful, but WITHOUT
   58.16 +#  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   58.17 +#  FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   58.18 +#  version 2 for more details (a copy is included in the LICENSE file that
   58.19 +#  accompanied this code).
   58.20 +#
   58.21 +#  You should have received a copy of the GNU General Public License version
   58.22 +#  2 along with this work; if not, write to the Free Software Foundation,
   58.23 +#  Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   58.24 +#
   58.25 +#  Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   58.26 +#  or visit www.oracle.com if you need additional information or have any
   58.27 +#  questions.
   58.28 +#
   58.29 +
   58.30 +## @test Test8167409.sh
   58.31 +## @bug 8167409
   58.32 +## @summary Invalid value passed to critical JNI function
   58.33 +## @run shell Test8167409.sh
   58.34 +
   58.35 +if [ "${TESTSRC}" = "" ]
   58.36 +then
   58.37 +  TESTSRC=${PWD}
   58.38 +  echo "TESTSRC not set.  Using "${TESTSRC}" as default"
   58.39 +fi
   58.40 +echo "TESTSRC=${TESTSRC}"
   58.41 +## Adding common setup Variables for running shell tests.
   58.42 +. ${TESTSRC}/../../../test_env.sh
   58.43 +
   58.44 +# set platform-dependent variables
   58.45 +OS=`uname -s`
   58.46 +echo "Testing on " $OS
   58.47 +case "$OS" in
   58.48 +  Linux)
   58.49 +    cc_cmd=`which gcc`
   58.50 +    if [ "x$cc_cmd" == "x" ]; then
   58.51 +        echo "WARNING: gcc not found. Cannot execute test." 2>&1
   58.52 +        exit 0;
   58.53 +    fi
   58.54 +    ;;
   58.55 +  Solaris)
   58.56 +    cc_cmd=`which cc`
   58.57 +    if [ "x$cc_cmd" == "x" ]; then
   58.58 +        echo "WARNING: cc not found. Cannot execute test." 2>&1
   58.59 +        exit 0;
   58.60 +    fi
   58.61 +    ;;
   58.62 +  *)
   58.63 +    echo "Test passed; only valid for Linux and Solaris"
   58.64 +    exit 0;
   58.65 +    ;;
   58.66 +esac
   58.67 +
   58.68 +THIS_DIR=.
   58.69 +
   58.70 +cp ${TESTSRC}${FS}*.java ${THIS_DIR}
   58.71 +${TESTJAVA}${FS}bin${FS}javac *.java
   58.72 +
   58.73 +$cc_cmd -fPIC -shared -o libCNCheckLongArgs.so \
   58.74 +    -I${TESTJAVA}${FS}include -I${TESTJAVA}${FS}include${FS}linux \
   58.75 +    ${TESTSRC}${FS}libCNCheckLongArgs.c
   58.76 +
   58.77 +LD_LIBRARY_PATH=${THIS_DIR}
   58.78 +echo   LD_LIBRARY_PATH = ${LD_LIBRARY_PATH}
   58.79 +export LD_LIBRARY_PATH
   58.80 +
   58.81 +echo
   58.82 +echo ${TESTJAVA}${FS}bin${FS}java -cp ${THIS_DIR} -Xcomp -XX:+CriticalJNINatives CheckLongArgs
   58.83 +${TESTJAVA}${FS}bin${FS}java -cp ${THIS_DIR} -Xcomp -XX:+CriticalJNINatives CheckLongArgs
   58.84 +JAVA_RETVAL=$?
   58.85 +
   58.86 +exit $JAVA_RETVAL
    59.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    59.2 +++ b/test/compiler/criticalnatives/argumentcorruption/libCNCheckLongArgs.c	Wed Apr 15 11:49:55 2020 +0800
    59.3 @@ -0,0 +1,30 @@
    59.4 +#include "jni.h"
    59.5 +JNIEXPORT void JNICALL JavaCritical_CheckLongArgs_m1
    59.6 +  (jlong a1, jlong a2, jlong a3, jlong a4, jlong a5, jlong a6, jlong a7, jlong a8,jint result_length,jbyte* result) {
    59.7 +
    59.8 +  if (a1 != 1111111122222222LL || a2 != 3333333344444444LL || a3 != 5555555566666666LL || a4 != 7777777788888888LL ||
    59.9 +      a5 != 9999999900000000LL || a6 != 1212121234343434LL || a7 != 5656565678787878LL || a8 != 9090909012121212LL ||
   59.10 +      result_length != 1 || result[0] != -1) {
   59.11 +    result[0] = 1;
   59.12 +  } else {
   59.13 +    result[0] = 2;
   59.14 +  }
   59.15 +}
   59.16 +
   59.17 +JNIEXPORT void JNICALL JavaCritical_CheckLongArgs_m2
   59.18 +  (jlong a1, jint a2_length, jint* a2, jlong a3, jint a4_length, jint* a4, jlong a5, jint a6_length, jint* a6, jlong a7,
   59.19 +   jint a8_length, jint* a8, jlong a9, jint result_length, jbyte* result) {
   59.20 +  if (a1 != 1111111122222222LL || a2_length != 3 || a2[0] != 1111 || a3 != 3333333344444444LL || a4_length != 3 || a4[0] != 4444 ||
   59.21 +      a5 != 5555555566666666LL || a6_length != 3 || a6[0] != 7777 || a7 != 7777777788888888LL || a8_length != 3 || a8[0] != 1010 || a9 != 9999999900000000LL ||
   59.22 +      result_length != 1 || result[0] != -1) {
   59.23 +    result[0] = 1;
   59.24 +  } else {
   59.25 +    result[0] = 2;
   59.26 +  }
   59.27 +}
   59.28 +
   59.29 +JNIEXPORT void JNICALL Java_CheckLongArgs_m1
   59.30 +  (JNIEnv * env, jclass jclazz, jlong a3, jlong a4, jlong a5, jlong a6, jlong a7, jlong a8, jlong a9, jlong a10, jbyteArray result) {}
   59.31 +
   59.32 +JNIEXPORT void JNICALL Java_CheckLongArgs_m2
   59.33 +  (JNIEnv * env, jclass jclazz, jlong a3, jintArray a4, jlong a5, jintArray a6, jlong a7, jintArray a8, jlong a9, jintArray a10, jlong a11, jbyteArray result) {}
    60.1 --- a/test/compiler/intrinsics/bmi/TestAndnI.java	Wed Apr 15 11:14:58 2020 +0800
    60.2 +++ b/test/compiler/intrinsics/bmi/TestAndnI.java	Wed Apr 15 11:49:55 2020 +0800
    60.3 @@ -58,15 +58,27 @@
    60.4          }
    60.5  
    60.6          public int intExpr(int src1, Expr.MemI src2) {
    60.7 -            return ~src1 & src2.value;
    60.8 +            if (src2 != null) {
    60.9 +                return ~src1 & src2.value;
   60.10 +            } else {
   60.11 +                return 0;
   60.12 +            }
   60.13          }
   60.14  
   60.15          public int intExpr(Expr.MemI src1, int src2) {
   60.16 -            return ~src1.value & src2;
   60.17 +            if (src1 != null) {
   60.18 +                return ~src1.value & src2;
   60.19 +            } else {
   60.20 +                return 0;
   60.21 +            }
   60.22          }
   60.23  
   60.24          public int intExpr(Expr.MemI src1, Expr.MemI src2) {
   60.25 -            return ~src1.value & src2.value;
   60.26 +            if (src1 != null && src2 != null) {
   60.27 +                return ~src1.value & src2.value;
   60.28 +            } else {
   60.29 +                return 0;
   60.30 +            }
   60.31          }
   60.32      }
   60.33  
   60.34 @@ -77,15 +89,27 @@
   60.35          }
   60.36  
   60.37          public int intExpr(int src1, Expr.MemI src2) {
   60.38 -            return src1 & ~src2.value;
   60.39 +            if (src2 != null) {
   60.40 +                return src1 & ~src2.value;
   60.41 +            } else {
   60.42 +                return 0;
   60.43 +            }
   60.44          }
   60.45  
   60.46          public int intExpr(Expr.MemI src1, int src2) {
   60.47 -            return src1.value & ~src2;
   60.48 +            if (src1 != null) {
   60.49 +                return src1.value & ~src2;
   60.50 +            } else {
   60.51 +                return 0;
   60.52 +            }
   60.53          }
   60.54  
   60.55          public int intExpr(Expr.MemI src1, Expr.MemI src2) {
   60.56 -            return src1.value & ~src2.value;
   60.57 +            if (src1 != null && src2 != null) {
   60.58 +                return src1.value & ~src2.value;
   60.59 +            } else {
   60.60 +                return 0;
   60.61 +            }
   60.62          }
   60.63      }
   60.64  }
    61.1 --- a/test/compiler/intrinsics/bmi/TestAndnL.java	Wed Apr 15 11:14:58 2020 +0800
    61.2 +++ b/test/compiler/intrinsics/bmi/TestAndnL.java	Wed Apr 15 11:49:55 2020 +0800
    61.3 @@ -58,15 +58,27 @@
    61.4          }
    61.5  
    61.6          public long longExpr(long src1, Expr.MemL src2) {
    61.7 -            return ~src1 & src2.value;
    61.8 +            if (src2 != null) {
    61.9 +                return ~src1 & src2.value;
   61.10 +            } else {
   61.11 +                return 0;
   61.12 +            }
   61.13          }
   61.14  
   61.15          public long longExpr(Expr.MemL src1, long src2) {
   61.16 -            return ~src1.value & src2;
   61.17 +            if (src1 != null) {
   61.18 +                return ~src1.value & src2;
   61.19 +            } else {
   61.20 +                return 0;
   61.21 +            }
   61.22          }
   61.23  
   61.24          public long longExpr(Expr.MemL src1, Expr.MemL src2) {
   61.25 -            return ~src1.value & src2.value;
   61.26 +            if (src1 != null && src2 != null) {
   61.27 +                return ~src1.value & src2.value;
   61.28 +            } else {
   61.29 +                return 0;
   61.30 +            }
   61.31          }
   61.32  
   61.33  
   61.34 @@ -79,15 +91,27 @@
   61.35          }
   61.36  
   61.37          public long longExpr(long src1, Expr.MemL src2) {
   61.38 -            return src1 & ~src2.value;
   61.39 +            if (src2 != null) {
   61.40 +                return src1 & ~src2.value;
   61.41 +            } else {
   61.42 +                return 0;
   61.43 +            }
   61.44          }
   61.45  
   61.46          public long longExpr(Expr.MemL src1, long src2) {
   61.47 -            return src1.value & ~src2;
   61.48 +            if (src1 != null) {
   61.49 +                return src1.value & ~src2;
   61.50 +            } else {
   61.51 +                return 0;
   61.52 +            }
   61.53          }
   61.54  
   61.55          public long longExpr(Expr.MemL src1, Expr.MemL src2) {
   61.56 -            return src1.value & ~src2.value;
   61.57 +            if (src1 != null && src2 != null) {
   61.58 +                return src1.value & ~src2.value;
   61.59 +            } else {
   61.60 +                return 0;
   61.61 +            }
   61.62          }
   61.63  
   61.64      }
    62.1 --- a/test/compiler/intrinsics/bmi/verifycode/AddnTestI.java	Wed Apr 15 11:14:58 2020 +0800
    62.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    62.3 @@ -1,57 +0,0 @@
    62.4 -/*
    62.5 - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
    62.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    62.7 - *
    62.8 - * This code is free software; you can redistribute it and/or modify it
    62.9 - * under the terms of the GNU General Public License version 2 only, as
   62.10 - * published by the Free Software Foundation.
   62.11 - *
   62.12 - * This code is distributed in the hope that it will be useful, but WITHOUT
   62.13 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   62.14 - * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   62.15 - * version 2 for more details (a copy is included in the LICENSE file that
   62.16 - * accompanied this code).
   62.17 - *
   62.18 - * You should have received a copy of the GNU General Public License version
   62.19 - * 2 along with this work; if not, write to the Free Software Foundation,
   62.20 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   62.21 - *
   62.22 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   62.23 - * or visit www.oracle.com if you need additional information or have any
   62.24 - * questions.
   62.25 - */
   62.26 -
   62.27 -/*
   62.28 - * @test
   62.29 - * @bug 8031321
   62.30 - * @library /testlibrary /testlibrary/whitebox /compiler/whitebox ..
   62.31 - * @build AddnTestI
   62.32 - * @run main ClassFileInstaller sun.hotspot.WhiteBox
   62.33 - * @run main/othervm -Xbootclasspath/a:. -Xbatch -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI
   62.34 - *                   -XX:+IgnoreUnrecognizedVMOptions -XX:+UseBMI1Instructions AddnTestI
   62.35 - */
   62.36 -
   62.37 -import java.lang.reflect.Method;
   62.38 -
   62.39 -public class AddnTestI extends BmiIntrinsicBase.BmiTestCase {
   62.40 -
   62.41 -    protected AddnTestI(Method method) {
   62.42 -        super(method);
   62.43 -        // from intel manual VEX.NDS.LZ.0F38.W0 F2 /r, example c4e260f2c2
   62.44 -        instrMask = new byte[]{
   62.45 -                (byte) 0xFF,
   62.46 -                (byte) 0x1F,
   62.47 -                (byte) 0x00,
   62.48 -                (byte) 0xFF};
   62.49 -        instrPattern = new byte[]{
   62.50 -                (byte) 0xC4, // prefix for 3-byte VEX instruction
   62.51 -                (byte) 0x02, // 00010 implied 0F 38 leading opcode bytes
   62.52 -                (byte) 0x00,
   62.53 -                (byte) 0xF2};
   62.54 -    }
   62.55 -
   62.56 -    public static void main(String[] args) throws Exception {
   62.57 -        BmiIntrinsicBase.verifyTestCase(AddnTestI::new, TestAndnI.AndnIExpr.class.getDeclaredMethods());
   62.58 -        BmiIntrinsicBase.verifyTestCase(AddnTestI::new, TestAndnI.AndnICommutativeExpr.class.getDeclaredMethods());
   62.59 -    }
   62.60 -}
    63.1 --- a/test/compiler/intrinsics/bmi/verifycode/AddnTestL.java	Wed Apr 15 11:14:58 2020 +0800
    63.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    63.3 @@ -1,47 +0,0 @@
    63.4 -/*
    63.5 - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
    63.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    63.7 - *
    63.8 - * This code is free software; you can redistribute it and/or modify it
    63.9 - * under the terms of the GNU General Public License version 2 only, as
   63.10 - * published by the Free Software Foundation.
   63.11 - *
   63.12 - * This code is distributed in the hope that it will be useful, but WITHOUT
   63.13 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   63.14 - * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   63.15 - * version 2 for more details (a copy is included in the LICENSE file that
   63.16 - * accompanied this code).
   63.17 - *
   63.18 - * You should have received a copy of the GNU General Public License version
   63.19 - * 2 along with this work; if not, write to the Free Software Foundation,
   63.20 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   63.21 - *
   63.22 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   63.23 - * or visit www.oracle.com if you need additional information or have any
   63.24 - * questions.
   63.25 - */
   63.26 -
   63.27 -/*
   63.28 - * @test
   63.29 - * @bug 8031321
   63.30 - * @library /testlibrary /testlibrary/whitebox /compiler/whitebox ..
   63.31 - * @build AddnTestL
   63.32 - * @run main ClassFileInstaller sun.hotspot.WhiteBox
   63.33 - * @run main/othervm -Xbootclasspath/a:. -Xbatch -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI
   63.34 - *                   -XX:+IgnoreUnrecognizedVMOptions -XX:+UseBMI1Instructions AddnTestL
   63.35 - */
   63.36 -
   63.37 -import java.lang.reflect.Method;
   63.38 -
   63.39 -public class AddnTestL extends AddnTestI {
   63.40 -
   63.41 -    protected AddnTestL(Method method) {
   63.42 -        super(method);
   63.43 -        isLongOperation = true;
   63.44 -    }
   63.45 -
   63.46 -    public static void main(String[] args) throws Exception {
   63.47 -        BmiIntrinsicBase.verifyTestCase(AddnTestL::new, TestAndnL.AndnLExpr.class.getDeclaredMethods());
   63.48 -        BmiIntrinsicBase.verifyTestCase(AddnTestL::new, TestAndnL.AndnLCommutativeExpr.class.getDeclaredMethods());
   63.49 -    }
   63.50 -}
    64.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    64.2 +++ b/test/compiler/intrinsics/bmi/verifycode/AndnTestI.java	Wed Apr 15 11:49:55 2020 +0800
    64.3 @@ -0,0 +1,57 @@
    64.4 +/*
    64.5 + * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
    64.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    64.7 + *
    64.8 + * This code is free software; you can redistribute it and/or modify it
    64.9 + * under the terms of the GNU General Public License version 2 only, as
   64.10 + * published by the Free Software Foundation.
   64.11 + *
   64.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
   64.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   64.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   64.15 + * version 2 for more details (a copy is included in the LICENSE file that
   64.16 + * accompanied this code).
   64.17 + *
   64.18 + * You should have received a copy of the GNU General Public License version
   64.19 + * 2 along with this work; if not, write to the Free Software Foundation,
   64.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   64.21 + *
   64.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   64.23 + * or visit www.oracle.com if you need additional information or have any
   64.24 + * questions.
   64.25 + */
   64.26 +
   64.27 +/*
   64.28 + * @test
   64.29 + * @bug 8031321
   64.30 + * @library /testlibrary /testlibrary/whitebox /compiler/whitebox ..
   64.31 + * @build AndnTestI
   64.32 + * @run main ClassFileInstaller sun.hotspot.WhiteBox
   64.33 + * @run main/othervm -Xbootclasspath/a:. -Xbatch -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI
   64.34 + *                   -XX:+IgnoreUnrecognizedVMOptions -XX:+UseBMI1Instructions AndnTestI
   64.35 + */
   64.36 +
   64.37 +import java.lang.reflect.Method;
   64.38 +
   64.39 +public class AndnTestI extends BmiIntrinsicBase.BmiTestCase {
   64.40 +
   64.41 +    protected AndnTestI(Method method) {
   64.42 +        super(method);
   64.43 +        // from intel manual VEX.NDS.LZ.0F38.W0 F2 /r, example c4e260f2c2
   64.44 +        instrMask = new byte[]{
   64.45 +                (byte) 0xFF,
   64.46 +                (byte) 0x1F,
   64.47 +                (byte) 0x00,
   64.48 +                (byte) 0xFF};
   64.49 +        instrPattern = new byte[]{
   64.50 +                (byte) 0xC4, // prefix for 3-byte VEX instruction
   64.51 +                (byte) 0x02, // 00010 implied 0F 38 leading opcode bytes
   64.52 +                (byte) 0x00,
   64.53 +                (byte) 0xF2};
   64.54 +    }
   64.55 +
   64.56 +    public static void main(String[] args) throws Exception {
   64.57 +        BmiIntrinsicBase.verifyTestCase(AndnTestI::new, TestAndnI.AndnIExpr.class.getDeclaredMethods());
   64.58 +        BmiIntrinsicBase.verifyTestCase(AndnTestI::new, TestAndnI.AndnICommutativeExpr.class.getDeclaredMethods());
   64.59 +    }
   64.60 +}
    65.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    65.2 +++ b/test/compiler/intrinsics/bmi/verifycode/AndnTestL.java	Wed Apr 15 11:49:55 2020 +0800
    65.3 @@ -0,0 +1,47 @@
    65.4 +/*
    65.5 + * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
    65.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    65.7 + *
    65.8 + * This code is free software; you can redistribute it and/or modify it
    65.9 + * under the terms of the GNU General Public License version 2 only, as
   65.10 + * published by the Free Software Foundation.
   65.11 + *
   65.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
   65.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   65.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   65.15 + * version 2 for more details (a copy is included in the LICENSE file that
   65.16 + * accompanied this code).
   65.17 + *
   65.18 + * You should have received a copy of the GNU General Public License version
   65.19 + * 2 along with this work; if not, write to the Free Software Foundation,
   65.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   65.21 + *
   65.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   65.23 + * or visit www.oracle.com if you need additional information or have any
   65.24 + * questions.
   65.25 + */
   65.26 +
   65.27 +/*
   65.28 + * @test
   65.29 + * @bug 8031321
   65.30 + * @library /testlibrary /testlibrary/whitebox /compiler/whitebox ..
   65.31 + * @build AndnTestL
   65.32 + * @run main ClassFileInstaller sun.hotspot.WhiteBox
   65.33 + * @run main/othervm -Xbootclasspath/a:. -Xbatch -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI
   65.34 + *                   -XX:+IgnoreUnrecognizedVMOptions -XX:+UseBMI1Instructions AndnTestL
   65.35 + */
   65.36 +
   65.37 +import java.lang.reflect.Method;
   65.38 +
   65.39 +public class AndnTestL extends AndnTestI {
   65.40 +
   65.41 +    protected AndnTestL(Method method) {
   65.42 +        super(method);
   65.43 +        isLongOperation = true;
   65.44 +    }
   65.45 +
   65.46 +    public static void main(String[] args) throws Exception {
   65.47 +        BmiIntrinsicBase.verifyTestCase(AndnTestL::new, TestAndnL.AndnLExpr.class.getDeclaredMethods());
   65.48 +        BmiIntrinsicBase.verifyTestCase(AndnTestL::new, TestAndnL.AndnLCommutativeExpr.class.getDeclaredMethods());
   65.49 +    }
   65.50 +}
    66.1 --- a/test/compiler/intrinsics/bmi/verifycode/LZcntTestI.java	Wed Apr 15 11:14:58 2020 +0800
    66.2 +++ b/test/compiler/intrinsics/bmi/verifycode/LZcntTestI.java	Wed Apr 15 11:49:55 2020 +0800
    66.3 @@ -44,6 +44,8 @@
    66.4      public static void main(String[] args) throws Exception {
    66.5          // j.l.Integer and Long should be loaded to allow a compilation of the methods that use their methods
    66.6          System.out.println("class java.lang.Integer should be loaded. Proof: " + Integer.class);
    66.7 +        // Avoid uncommon traps.
    66.8 +        System.out.println("Num leading zeroes: " + new TestLzcntI.LzcntIExpr().intExpr(12341341));
    66.9          BmiIntrinsicBase.verifyTestCase(LZcntTestI::new, TestLzcntI.LzcntIExpr.class.getDeclaredMethods());
   66.10      }
   66.11  
    67.1 --- a/test/compiler/intrinsics/bmi/verifycode/LZcntTestL.java	Wed Apr 15 11:14:58 2020 +0800
    67.2 +++ b/test/compiler/intrinsics/bmi/verifycode/LZcntTestL.java	Wed Apr 15 11:49:55 2020 +0800
    67.3 @@ -49,6 +49,8 @@
    67.4      public static void main(String[] args) throws Exception {
    67.5          // j.l.Integer and Long should be loaded to allow a compilation of the methods that use their methods
    67.6          System.out.println("classes java.lang.Long should be loaded. Proof: " + Long.class);
    67.7 +        // Avoid uncommon traps.
    67.8 +        System.out.println("Num leading zeroes: " + new  TestLzcntL.LzcntLExpr().longExpr(12341341));
    67.9          BmiIntrinsicBase.verifyTestCase(LZcntTestL::new, TestLzcntL.LzcntLExpr.class.getDeclaredMethods());
   67.10      }
   67.11  }
    68.1 --- a/test/compiler/intrinsics/bmi/verifycode/TZcntTestI.java	Wed Apr 15 11:14:58 2020 +0800
    68.2 +++ b/test/compiler/intrinsics/bmi/verifycode/TZcntTestI.java	Wed Apr 15 11:49:55 2020 +0800
    68.3 @@ -44,6 +44,8 @@
    68.4      public static void main(String[] args) throws Exception {
    68.5          // j.l.Integer and Long should be loaded to allow a compilation of the methods that use their methods
    68.6          System.out.println("class java.lang.Integer should be loaded. Proof: " + Integer.class);
    68.7 +        // Avoid uncommon traps.
    68.8 +        System.out.println("Num trailing zeroes: " + new TestTzcntI.TzcntIExpr().intExpr(12341341));
    68.9          BmiIntrinsicBase.verifyTestCase(TZcntTestI::new, TestTzcntI.TzcntIExpr.class.getDeclaredMethods());
   68.10      }
   68.11  
    69.1 --- a/test/compiler/intrinsics/bmi/verifycode/TZcntTestL.java	Wed Apr 15 11:14:58 2020 +0800
    69.2 +++ b/test/compiler/intrinsics/bmi/verifycode/TZcntTestL.java	Wed Apr 15 11:49:55 2020 +0800
    69.3 @@ -50,6 +50,8 @@
    69.4      public static void main(String[] args) throws Exception {
    69.5          // j.l.Integer and Long should be loaded to allow a compilation of the methods that use their methods
    69.6          System.out.println("classes java.lang.Long should be loaded. Proof: " + Long.class);
    69.7 +        // Avoid uncommon traps.
    69.8 +        System.out.println("Num trailing zeroes: " + new TestTzcntL.TzcntLExpr().longExpr(12341341));
    69.9          BmiIntrinsicBase.verifyTestCase(TZcntTestL::new, TestTzcntL.TzcntLExpr.class.getDeclaredMethods());
   69.10      }
   69.11  }
    70.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    70.2 +++ b/test/compiler/loopopts/BadPredicateAfterPartialPeel.java	Wed Apr 15 11:49:55 2020 +0800
    70.3 @@ -0,0 +1,312 @@
    70.4 +/*
    70.5 + * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
    70.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    70.7 + *
    70.8 + * This code is free software; you can redistribute it and/or modify it
    70.9 + * under the terms of the GNU General Public License version 2 only, as
   70.10 + * published by the Free Software Foundation.
   70.11 + *
   70.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
   70.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   70.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   70.15 + * version 2 for more details (a copy is included in the LICENSE file that
   70.16 + * accompanied this code).
   70.17 + *
   70.18 + * You should have received a copy of the GNU General Public License version
   70.19 + * 2 along with this work; if not, write to the Free Software Foundation,
   70.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   70.21 + *
   70.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   70.23 + * or visit www.oracle.com if you need additional information or have any
   70.24 + * questions.
   70.25 + *
   70.26 + */
   70.27 +
   70.28 +/**
   70.29 + * @test
   70.30 + * @bug 8146792
   70.31 + * @summary Predicate moved after partial peel may lead to broken graph
   70.32 + * @run main/othervm -XX:-TieredCompilation -XX:-BackgroundCompilation -XX:-UseOnStackReplacement -XX:CompileOnly=BadPredicateAfterPartialPeel::m -XX:CompileCommand=dontinline,BadPredicateAfterPartialPeel::not_inlined* -XX:CompileCommand=quiet BadPredicateAfterPartialPeel
   70.33 + *
   70.34 + */
   70.35 +
   70.36 +public class BadPredicateAfterPartialPeel {
   70.37 +
   70.38 +    static void not_inlined1() {}
   70.39 +    static void not_inlined4() {}
   70.40 +
   70.41 +    static int m_helper(int i, int i3, int i4) {
   70.42 +        return i3 == 4 ? i4 : i;
   70.43 +    }
   70.44 +
   70.45 +    static float[] array = new float[1000];
   70.46 +    static int[] array2 = new int[1000];
   70.47 +
   70.48 +    boolean flag;
   70.49 +    int j;
   70.50 +
   70.51 +    static void m(BadPredicateAfterPartialPeel o1, BadPredicateAfterPartialPeel o2, BadPredicateAfterPartialPeel o, int i4) {
   70.52 +        int i1 = 1;
   70.53 +
   70.54 +        // To delay partial peeling to the loop opts pass right before CCP
   70.55 +        int i2 = 0;
   70.56 +        for (; i2 < 10; i2 += i1);
   70.57 +        i2 = i2 / 10;
   70.58 +
   70.59 +        // Simplified during CCP:
   70.60 +        int i3 = 2;
   70.61 +        for (; i3 < 4; i3 *= 2);
   70.62 +
   70.63 +        // Loop is partial peeled right before CCP
   70.64 +        int i = 0;
   70.65 +        boolean b = true;
   70.66 +
   70.67 +        not_inlined1();
   70.68 +
   70.69 +        array[0] = -1;
   70.70 +        do {
   70.71 +            // peeled section starts here
   70.72 +            o.flag = false;
   70.73 +            o.j = 0;
   70.74 +
   70.75 +            if (b) {
   70.76 +                // The following store will be pinned between
   70.77 +                // predicates and the loop after partial peeling. All
   70.78 +                // control flow will be optimized out and so nothing
   70.79 +                // will prevent predicates from being moved out the
   70.80 +                // loop.
   70.81 +                array[i] = 0;
   70.82 +            }
   70.83 +            if (array[0] != 0) {
   70.84 +            }
   70.85 +            if (i >= 10) {
   70.86 +                // peeled section ends here
   70.87 +                return;
   70.88 +            }
   70.89 +            i += i2;
   70.90 +            b = false;
   70.91 +            int i5 = m_helper(i, i3, i4); // This will be simpliflied during CCP
   70.92 +            if (array[i5] != 0) { // and this will become a predicate
   70.93 +            }
   70.94 +            if (o2.flag) {
   70.95 +            }
   70.96 +            // A bunch of stuff to grow loop body size and prevent peeling:
   70.97 +            array2[0] = 0;
   70.98 +            array2[1] = 0;
   70.99 +            array2[2] = 0;
  70.100 +            array2[3] = 0;
  70.101 +            array2[4] = 0;
  70.102 +            array2[5] = 0;
  70.103 +            array2[6] = 0;
  70.104 +            array2[7] = 0;
  70.105 +            array2[8] = 0;
  70.106 +            array2[9] = 0;
  70.107 +            array2[10] = 0;
  70.108 +            array2[11] = 0;
  70.109 +            array2[12] = 0;
  70.110 +            array2[13] = 0;
  70.111 +            array2[14] = 0;
  70.112 +            array2[15] = 0;
  70.113 +            array2[16] = 0;
  70.114 +            array2[17] = 0;
  70.115 +            array2[18] = 0;
  70.116 +            array2[19] = 0;
  70.117 +            array2[20] = 0;
  70.118 +            array2[21] = 0;
  70.119 +            array2[22] = 0;
  70.120 +            array2[23] = 0;
  70.121 +            array2[24] = 0;
  70.122 +            array2[25] = 0;
  70.123 +            array2[26] = 0;
  70.124 +            array2[27] = 0;
  70.125 +            array2[28] = 0;
  70.126 +            array2[29] = 0;
  70.127 +            array2[30] = 0;
  70.128 +            array2[31] = 0;
  70.129 +            array2[32] = 0;
  70.130 +            array2[33] = 0;
  70.131 +            array2[34] = 0;
  70.132 +            array2[35] = 0;
  70.133 +            array2[36] = 0;
  70.134 +            array2[37] = 0;
  70.135 +            array2[38] = 0;
  70.136 +            array2[39] = 0;
  70.137 +            array2[40] = 0;
  70.138 +            array2[41] = 0;
  70.139 +            array2[42] = 0;
  70.140 +            array2[43] = 0;
  70.141 +            array2[44] = 0;
  70.142 +            array2[45] = 0;
  70.143 +            array2[46] = 0;
  70.144 +            array2[47] = 0;
  70.145 +            array2[48] = 0;
  70.146 +            array2[49] = 0;
  70.147 +            array2[50] = 0;
  70.148 +            array2[51] = 0;
  70.149 +            array2[52] = 0;
  70.150 +            array2[53] = 0;
  70.151 +            array2[54] = 0;
  70.152 +            array2[55] = 0;
  70.153 +            array2[56] = 0;
  70.154 +            array2[57] = 0;
  70.155 +            array2[58] = 0;
  70.156 +            array2[59] = 0;
  70.157 +            array2[60] = 0;
  70.158 +            array2[61] = 0;
  70.159 +            array2[62] = 0;
  70.160 +            array2[63] = 0;
  70.161 +            array2[64] = 0;
  70.162 +            array2[65] = 0;
  70.163 +            array2[66] = 0;
  70.164 +            array2[67] = 0;
  70.165 +            array2[68] = 0;
  70.166 +            array2[69] = 0;
  70.167 +            array2[70] = 0;
  70.168 +            array2[71] = 0;
  70.169 +            array2[72] = 0;
  70.170 +            array2[73] = 0;
  70.171 +            array2[74] = 0;
  70.172 +            array2[75] = 0;
  70.173 +            array2[76] = 0;
  70.174 +            array2[77] = 0;
  70.175 +            array2[78] = 0;
  70.176 +            array2[79] = 0;
  70.177 +            array2[80] = 0;
  70.178 +            array2[81] = 0;
  70.179 +            array2[82] = 0;
  70.180 +            array2[83] = 0;
  70.181 +            array2[84] = 0;
  70.182 +            array2[85] = 0;
  70.183 +            array2[86] = 0;
  70.184 +            array2[87] = 0;
  70.185 +            array2[88] = 0;
  70.186 +            array2[89] = 0;
  70.187 +            array2[90] = 0;
  70.188 +            array2[91] = 0;
  70.189 +            array2[92] = 0;
  70.190 +            array2[93] = 0;
  70.191 +            array2[94] = 0;
  70.192 +            array2[95] = 0;
  70.193 +            array2[96] = 0;
  70.194 +            array2[97] = 0;
  70.195 +            array2[98] = 0;
  70.196 +            array2[99] = 0;
  70.197 +
  70.198 +            array2[100] = 0;
  70.199 +            array2[101] = 0;
  70.200 +            array2[102] = 0;
  70.201 +            array2[103] = 0;
  70.202 +            array2[104] = 0;
  70.203 +            array2[105] = 0;
  70.204 +            array2[106] = 0;
  70.205 +            array2[107] = 0;
  70.206 +            array2[108] = 0;
  70.207 +            array2[109] = 0;
  70.208 +            array2[110] = 0;
  70.209 +            array2[111] = 0;
  70.210 +            array2[112] = 0;
  70.211 +            array2[113] = 0;
  70.212 +            array2[114] = 0;
  70.213 +            array2[115] = 0;
  70.214 +            array2[116] = 0;
  70.215 +            array2[117] = 0;
  70.216 +            array2[118] = 0;
  70.217 +            array2[119] = 0;
  70.218 +            array2[120] = 0;
  70.219 +            array2[121] = 0;
  70.220 +            array2[122] = 0;
  70.221 +            array2[123] = 0;
  70.222 +            array2[124] = 0;
  70.223 +            array2[125] = 0;
  70.224 +            array2[126] = 0;
  70.225 +            array2[127] = 0;
  70.226 +            array2[128] = 0;
  70.227 +            array2[129] = 0;
  70.228 +            array2[130] = 0;
  70.229 +            array2[131] = 0;
  70.230 +            array2[132] = 0;
  70.231 +            array2[133] = 0;
  70.232 +            array2[134] = 0;
  70.233 +            array2[135] = 0;
  70.234 +            array2[136] = 0;
  70.235 +            array2[137] = 0;
  70.236 +            array2[138] = 0;
  70.237 +            array2[139] = 0;
  70.238 +            array2[140] = 0;
  70.239 +            array2[141] = 0;
  70.240 +            array2[142] = 0;
  70.241 +            array2[143] = 0;
  70.242 +            array2[144] = 0;
  70.243 +            array2[145] = 0;
  70.244 +            array2[146] = 0;
  70.245 +            array2[147] = 0;
  70.246 +            array2[148] = 0;
  70.247 +            array2[149] = 0;
  70.248 +            array2[150] = 0;
  70.249 +            array2[151] = 0;
  70.250 +            array2[152] = 0;
  70.251 +            array2[153] = 0;
  70.252 +            array2[154] = 0;
  70.253 +            array2[155] = 0;
  70.254 +            array2[156] = 0;
  70.255 +            array2[157] = 0;
  70.256 +            array2[158] = 0;
  70.257 +            array2[159] = 0;
  70.258 +            array2[160] = 0;
  70.259 +            array2[161] = 0;
  70.260 +            array2[162] = 0;
  70.261 +            array2[163] = 0;
  70.262 +            array2[164] = 0;
  70.263 +            array2[165] = 0;
  70.264 +            array2[166] = 0;
  70.265 +            array2[167] = 0;
  70.266 +            array2[168] = 0;
  70.267 +            array2[169] = 0;
  70.268 +            array2[170] = 0;
  70.269 +            array2[171] = 0;
  70.270 +            array2[172] = 0;
  70.271 +            array2[173] = 0;
  70.272 +            array2[174] = 0;
  70.273 +            array2[175] = 0;
  70.274 +            array2[176] = 0;
  70.275 +            array2[177] = 0;
  70.276 +            array2[178] = 0;
  70.277 +            array2[179] = 0;
  70.278 +            array2[180] = 0;
  70.279 +            array2[181] = 0;
  70.280 +            array2[182] = 0;
  70.281 +            array2[183] = 0;
  70.282 +            array2[184] = 0;
  70.283 +            array2[185] = 0;
  70.284 +            array2[186] = 0;
  70.285 +            array2[187] = 0;
  70.286 +            array2[188] = 0;
  70.287 +            array2[189] = 0;
  70.288 +            array2[190] = 0;
  70.289 +            array2[191] = 0;
  70.290 +            array2[192] = 0;
  70.291 +            array2[193] = 0;
  70.292 +            array2[194] = 0;
  70.293 +            array2[195] = 0;
  70.294 +            array2[196] = 0;
  70.295 +            array2[197] = 0;
  70.296 +            array2[198] = 0;
  70.297 +            array2[199] = 0;
  70.298 +            if (o1.j >= 20) {
  70.299 +                break;
  70.300 +            }
  70.301 +            o1.j++;
  70.302 +        } while(true);
  70.303 +        not_inlined4();
  70.304 +    }
  70.305 +
  70.306 +    static public void main(String[] args) {
  70.307 +        BadPredicateAfterPartialPeel o1 = new BadPredicateAfterPartialPeel();
  70.308 +        BadPredicateAfterPartialPeel o2 = new BadPredicateAfterPartialPeel();
  70.309 +        for (int i = 0; i < 20000; i++) {
  70.310 +            o1.j = 0;
  70.311 +            m(o1, o2, o2, 0);
  70.312 +            m_helper(i, 2, i); // pollute profile
  70.313 +        }
  70.314 +    }
  70.315 +}

mercurial