Merge jdk8u212-b01

Mon, 18 Mar 2019 08:03:04 +0100

author
clanger
date
Mon, 18 Mar 2019 08:03:04 +0100
changeset 9632
9ee244aee077
parent 9594
111b95ad4584
parent 9631
5af8ec63c21c
child 9633
6e2900603bc6

Merge

test/sanity/WhiteBox.java file | annotate | diff | comparison | revisions
     1.1 --- a/.hgtags	Mon Mar 04 21:10:27 2019 +0100
     1.2 +++ b/.hgtags	Mon Mar 18 08:03:04 2019 +0100
     1.3 @@ -1255,3 +1255,4 @@
     1.4  1083b49a881011f43667ebebc280d519f077f9e6 jdk8u202-b25
     1.5  7a69774c67cb79a79ccb2ac2d6d258a11e22aa6f jdk8u202-b26
     1.6  818b1963f7a227a2368a4f363d5500dd226a529e jdk8u202-ga
     1.7 +9ce27f0a4683a2083d3aed59a40d6a3ccfc8e397 jdk8u212-b00
     2.1 --- a/THIRD_PARTY_README	Mon Mar 04 21:10:27 2019 +0100
     2.2 +++ b/THIRD_PARTY_README	Mon Mar 18 08:03:04 2019 +0100
     2.3 @@ -1096,33 +1096,6 @@
     2.4  OF SUCH DAMAGE.
     2.5  --- end of LICENSE ---
     2.6  
     2.7 -%% This notice is provided with respect to FontConfig 2.5, which may be 
     2.8 -included with JRE 8, JDK 8, and OpenJDK 8 source distributions on
     2.9 -Linux and Solaris.
    2.10 -
    2.11 ---- begin of LICENSE ---
    2.12 -
    2.13 -Copyright ?? 2001,2003 Keith Packard
    2.14 -
    2.15 -Permission to use, copy, modify, distribute, and sell this software and its
    2.16 -documentation for any purpose is hereby granted without fee, provided that the
    2.17 -above copyright notice appear in all copies and that both that copyright
    2.18 -notice and this permission notice appear in supporting documentation, and that
    2.19 -the name of Keith Packard not be used in advertising or publicity pertaining
    2.20 -to distribution of the software without specific, written prior permission.
    2.21 -Keith Packard makes no representations about the suitability of this software
    2.22 -for any purpose.  It is provided "as is" without express or implied warranty.
    2.23 -
    2.24 -KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
    2.25 -ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL KEITH
    2.26 -PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY
    2.27 -DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
    2.28 -ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
    2.29 -CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
    2.30 -
    2.31 -
    2.32 ---- end of LICENSE ---
    2.33 -
    2.34  -------------------------------------------------------------------------------
    2.35  
    2.36  %% This notice is provided with respect to freebXML Registry 3.0 & 3.1,
     3.1 --- a/agent/src/os/linux/libproc_impl.c	Mon Mar 04 21:10:27 2019 +0100
     3.2 +++ b/agent/src/os/linux/libproc_impl.c	Mon Mar 18 08:03:04 2019 +0100
     3.3 @@ -29,54 +29,51 @@
     3.4  #include <thread_db.h>
     3.5  #include "libproc_impl.h"
     3.6  
     3.7 -static const char* alt_root = NULL;
     3.8 -static int alt_root_len = -1;
     3.9 -
    3.10  #define SA_ALTROOT "SA_ALTROOT"
    3.11  
    3.12 -static void init_alt_root() {
    3.13 -   if (alt_root_len == -1) {
    3.14 -      alt_root = getenv(SA_ALTROOT);
    3.15 -      if (alt_root) {
    3.16 -         alt_root_len = strlen(alt_root);
    3.17 -      } else {
    3.18 -         alt_root_len = 0;
    3.19 -      }
    3.20 -   }
    3.21 -}
    3.22 +int pathmap_open(const char* name) {
    3.23 +  static const char *alt_root = NULL;
    3.24 +  static int alt_root_initialized = 0;
    3.25  
    3.26 -int pathmap_open(const char* name) {
    3.27 -   int fd;
    3.28 -   char alt_path[PATH_MAX + 1];
    3.29 +  int fd;
    3.30 +  char alt_path[PATH_MAX + 1], *alt_path_end;
    3.31 +  const char *s;
    3.32  
    3.33 -   init_alt_root();
    3.34 +  if (!alt_root_initialized) {
    3.35 +    alt_root_initialized = -1;
    3.36 +    alt_root = getenv(SA_ALTROOT);
    3.37 +  }
    3.38  
    3.39 -   if (alt_root_len > 0) {
    3.40 -      strcpy(alt_path, alt_root);
    3.41 -      strcat(alt_path, name);
    3.42 -      fd = open(alt_path, O_RDONLY);
    3.43 -      if (fd >= 0) {
    3.44 -         print_debug("path %s substituted for %s\n", alt_path, name);
    3.45 -         return fd;
    3.46 -      }
    3.47 +  if (alt_root == NULL) {
    3.48 +    return open(name, O_RDONLY);
    3.49 +  }
    3.50  
    3.51 -      if (strrchr(name, '/')) {
    3.52 -         strcpy(alt_path, alt_root);
    3.53 -         strcat(alt_path, strrchr(name, '/'));
    3.54 -         fd = open(alt_path, O_RDONLY);
    3.55 -         if (fd >= 0) {
    3.56 -            print_debug("path %s substituted for %s\n", alt_path, name);
    3.57 -            return fd;
    3.58 -         }
    3.59 -      }
    3.60 -   } else {
    3.61 -      fd = open(name, O_RDONLY);
    3.62 -      if (fd >= 0) {
    3.63 -         return fd;
    3.64 -      }
    3.65 -   }
    3.66 +  strcpy(alt_path, alt_root);
    3.67 +  alt_path_end = alt_path + strlen(alt_path);
    3.68  
    3.69 -   return -1;
    3.70 +  // Strip path items one by one and try to open file with alt_root prepended
    3.71 +  s = name;
    3.72 +  while (1) {
    3.73 +    strcat(alt_path, s);
    3.74 +    s += 1;
    3.75 +
    3.76 +    fd = open(alt_path, O_RDONLY);
    3.77 +    if (fd >= 0) {
    3.78 +      print_debug("path %s substituted for %s\n", alt_path, name);
    3.79 +      return fd;
    3.80 +    }
    3.81 +
    3.82 +    // Linker always put full path to solib to process, so we can rely
    3.83 +    // on presence of /. If slash is not present, it means, that SOlib doesn't
    3.84 +    // physically exist (e.g. linux-gate.so) and we fail opening it anyway
    3.85 +    if ((s = strchr(s, '/')) == NULL) {
    3.86 +      break;
    3.87 +    }
    3.88 +
    3.89 +    *alt_path_end = 0;
    3.90 +  }
    3.91 +
    3.92 +  return -1;
    3.93  }
    3.94  
    3.95  static bool _libsaproc_debug;
     4.1 --- a/agent/src/share/classes/sun/jvm/hotspot/CLHSDB.java	Mon Mar 04 21:10:27 2019 +0100
     4.2 +++ b/agent/src/share/classes/sun/jvm/hotspot/CLHSDB.java	Mon Mar 18 08:03:04 2019 +0100
     4.3 @@ -113,7 +113,8 @@
     4.4      private String coreFilename;
     4.5  
     4.6      private void doUsage() {
     4.7 -        System.out.println("Usage:  java CLHSDB [[pid] | [path-to-java-executable [path-to-corefile]] | help ]");
     4.8 +        // With JDK-8059038 launchers for this class exist. Print usage for those launchers.
     4.9 +        System.out.println("Usage:  clhsdb [[pid] | [path-to-java-executable [path-to-corefile]] | help | -help ]");
    4.10          System.out.println("           pid:                     attach to the process whose id is 'pid'");
    4.11          System.out.println("           path-to-java-executable: Debug a core file produced by this program");
    4.12          System.out.println("           path-to-corefile:        Debug this corefile.  The default is 'core'");
     5.1 --- a/agent/src/share/classes/sun/jvm/hotspot/HSDB.java	Mon Mar 04 21:10:27 2019 +0100
     5.2 +++ b/agent/src/share/classes/sun/jvm/hotspot/HSDB.java	Mon Mar 18 08:03:04 2019 +0100
     5.3 @@ -82,7 +82,8 @@
     5.4    private String coreFilename;
     5.5  
     5.6    private void doUsage() {
     5.7 -    System.out.println("Usage:  java HSDB [[pid] | [path-to-java-executable [path-to-corefile]] | help ]");
     5.8 +    // With JDK-8059038 launchers for this class exist. Print usage for those launchers.
     5.9 +    System.out.println("Usage:  hsdb [[pid] | [path-to-java-executable [path-to-corefile]] | help | -help ]");
    5.10      System.out.println("           pid:                     attach to the process whose id is 'pid'");
    5.11      System.out.println("           path-to-java-executable: Debug a core file produced by this program");
    5.12      System.out.println("           path-to-corefile:        Debug this corefile.  The default is 'core'");
     6.1 --- a/agent/src/share/classes/sun/jvm/hotspot/debugger/linux/LinuxCDebugger.java	Mon Mar 04 21:10:27 2019 +0100
     6.2 +++ b/agent/src/share/classes/sun/jvm/hotspot/debugger/linux/LinuxCDebugger.java	Mon Mar 18 08:03:04 2019 +0100
     6.3 @@ -55,31 +55,21 @@
     6.4      if (pc == null) {
     6.5        return null;
     6.6      }
     6.7 +
     6.8 +    /* Typically we have about ten loaded objects here. So no reason to do
     6.9 +      sort/binary search here. Linear search gives us acceptable performance.*/
    6.10 +
    6.11      List objs = getLoadObjectList();
    6.12 -    Object[] arr = objs.toArray();
    6.13 -    // load objects are sorted by base address, do binary search
    6.14 -    int mid  = -1;
    6.15 -    int low  = 0;
    6.16 -    int high = arr.length - 1;
    6.17  
    6.18 -    while (low <= high) {
    6.19 -       mid = (low + high) >> 1;
    6.20 -       LoadObject midVal = (LoadObject) arr[mid];
    6.21 -       long cmp = pc.minus(midVal.getBase());
    6.22 -       if (cmp < 0) {
    6.23 -          high = mid - 1;
    6.24 -       } else if (cmp > 0) {
    6.25 -          long size = midVal.getSize();
    6.26 -          if (cmp >= size) {
    6.27 -             low = mid + 1;
    6.28 -          } else {
    6.29 -             return (LoadObject) arr[mid];
    6.30 -          }
    6.31 -       } else { // match found
    6.32 -          return (LoadObject) arr[mid];
    6.33 -       }
    6.34 +    for (int i = 0; i < objs.size(); i++) {
    6.35 +      LoadObject ob = (LoadObject) objs.get(i);
    6.36 +      Address base = ob.getBase();
    6.37 +      long size = ob.getSize();
    6.38 +      if ( pc.greaterThanOrEqual(base) && pc.lessThan(base.addOffsetTo(size))) {
    6.39 +        return ob;
    6.40 +      }
    6.41      }
    6.42 -    // no match found.
    6.43 +
    6.44      return null;
    6.45    }
    6.46  
     7.1 --- a/agent/src/share/classes/sun/jvm/hotspot/utilities/soql/sa.js	Mon Mar 04 21:10:27 2019 +0100
     7.2 +++ b/agent/src/share/classes/sun/jvm/hotspot/utilities/soql/sa.js	Mon Mar 18 08:03:04 2019 +0100
     7.3 @@ -371,19 +371,23 @@
     7.4     return sa.dbg.lookup(dso, sym);
     7.5  }
     7.6  
     7.7 +function loadObjectContainingPC(addr) {
     7.8 +    if (sa.cdbg == null) {
     7.9 +      // no CDebugger support, return null
    7.10 +      return null;
    7.11 +    }
    7.12 +
    7.13 +    return  sa.cdbg.loadObjectContainingPC(addr);
    7.14 +}
    7.15 +
    7.16  // returns the ClosestSymbol or null
    7.17  function closestSymbolFor(addr) {
    7.18 -   if (sa.cdbg == null) {
    7.19 -      // no CDebugger support, return null
    7.20 -      return null;
    7.21 -   } else {
    7.22 -      var dso = sa.cdbg.loadObjectContainingPC(addr);
    7.23 -      if (dso != null) {
    7.24 -         return dso.closestSymbolToPC(addr);
    7.25 -      } else {
    7.26 -         return null;
    7.27 -      }
    7.28 -   }
    7.29 +    var dso = loadObjectContainingPC(addr);
    7.30 +    if (dso != null) {
    7.31 +      return dso.closestSymbolToPC(addr);
    7.32 +    }
    7.33 +
    7.34 +    return null;
    7.35  }
    7.36  
    7.37  // Address-to-symbol
    7.38 @@ -884,21 +888,29 @@
    7.39  
    7.40  // returns description of given pointer as a String
    7.41  function whatis(addr) {
    7.42 -   addr = any2addr(addr);
    7.43 -   var ptrLoc = findPtr(addr);
    7.44 -   if (ptrLoc.isUnknown()) {
    7.45 -      var vmType = vmTypeof(addr);
    7.46 -      if (vmType != null) {
    7.47 -         return "pointer to " + vmType.name;
    7.48 -      } else {
    7.49 -         var sym = closestSymbolFor(addr);
    7.50 -         if (sym != null) {
    7.51 -            return sym.name + '+' + sym.offset;
    7.52 -         } else {
    7.53 -            return ptrLoc.toString();
    7.54 -         }
    7.55 -      }
    7.56 -   } else {
    7.57 -      return ptrLoc.toString();
    7.58 -   }
    7.59 +  addr = any2addr(addr);
    7.60 +  var ptrLoc = findPtr(addr);
    7.61 +  if (!ptrLoc.isUnknown()) {
    7.62 +    return ptrLoc.toString();
    7.63 +  }
    7.64 +
    7.65 +  var vmType = vmTypeof(addr);
    7.66 +  if (vmType != null) {
    7.67 +    return "pointer to " + vmType.name;
    7.68 +  }
    7.69 +
    7.70 +  var dso = loadObjectContainingPC(addr);
    7.71 +  if (dso == null) {
    7.72 +    return ptrLoc.toString();
    7.73 +  }
    7.74 +
    7.75 +  var sym = dso.closestSymbolToPC(addr);
    7.76 +  if (sym != null) {
    7.77 +    return sym.name + '+' + sym.offset;
    7.78 +  }
    7.79 +
    7.80 +  var s = dso.getName();
    7.81 +  var p = s.lastIndexOf("/");
    7.82 +  var base = dso.getBase();
    7.83 +  return s.substring(p+1, s.length) + '+' + addr.minus(base);
    7.84  }
     8.1 --- a/make/linux/Makefile	Mon Mar 04 21:10:27 2019 +0100
     8.2 +++ b/make/linux/Makefile	Mon Mar 18 08:03:04 2019 +0100
     8.3 @@ -227,20 +227,7 @@
     8.4  	@echo "  $(TARGETS_SHARK)"
     8.5  	@echo "  $(TARGETS_MINIMAL1)"
     8.6  
     8.7 -checks: check_os_version check_j2se_version
     8.8 -
     8.9 -# We do not want people accidentally building on old systems (e.g. Linux 2.2.x,
    8.10 -# Solaris 2.5.1, 2.6).
    8.11 -# Disable this check by setting DISABLE_HOTSPOT_OS_VERSION_CHECK=ok.
    8.12 -
    8.13 -SUPPORTED_OS_VERSION = 2.4% 2.5% 2.6% 3% 4%
    8.14 -OS_VERSION := $(shell uname -r)
    8.15 -EMPTY_IF_NOT_SUPPORTED = $(filter $(SUPPORTED_OS_VERSION),$(OS_VERSION))
    8.16 -
    8.17 -check_os_version:
    8.18 -ifeq ($(DISABLE_HOTSPOT_OS_VERSION_CHECK)$(EMPTY_IF_NOT_SUPPORTED),)
    8.19 -	$(QUIETLY) >&2 echo "*** This OS is not supported:" `uname -a`; exit 1;
    8.20 -endif
    8.21 +checks: check_j2se_version
    8.22  
    8.23  # jvmti.make requires XSLT (J2SE 1.4.x or newer):
    8.24  XSLT_CHECK	= $(REMOTE) $(RUN.JAVAP) javax.xml.transform.TransformerFactory
     9.1 --- a/make/linux/makefiles/saproc.make	Mon Mar 04 21:10:27 2019 +0100
     9.2 +++ b/make/linux/makefiles/saproc.make	Mon Mar 18 08:03:04 2019 +0100
     9.3 @@ -59,6 +59,11 @@
     9.4    SA_DEBUG_CFLAGS = -g
     9.5  endif
     9.6  
     9.7 +# Optimize saproc lib at level -O3 unless it's a slowdebug build
     9.8 +ifneq ($(BUILD_FLAVOR), debug)
     9.9 +  SA_OPT_FLAGS = $(OPT_CFLAGS)
    9.10 +endif
    9.11 +
    9.12  # if $(AGENT_DIR) does not exist, we don't build SA
    9.13  # also, we don't build SA on Itanium or zero.
    9.14  
    9.15 @@ -95,6 +100,7 @@
    9.16  	           $(SASRCFILES)                                        \
    9.17  	           $(SA_LFLAGS)                                         \
    9.18  	           $(SA_DEBUG_CFLAGS)                                   \
    9.19 +	           $(SA_OPT_FLAGS)                                      \
    9.20  	           $(EXTRA_CFLAGS)                                      \
    9.21  	           -o $@                                                \
    9.22  	           -lthread_db -ldl
    10.1 --- a/make/windows/makefiles/sa.make	Mon Mar 04 21:10:27 2019 +0100
    10.2 +++ b/make/windows/makefiles/sa.make	Mon Mar 18 08:03:04 2019 +0100
    10.3 @@ -99,27 +99,38 @@
    10.4  
    10.5  checkAndBuildSA:: $(SAWINDBG)
    10.6  
    10.7 -# These do not need to be optimized (don't run a lot of code) and it
    10.8 -# will be useful to have the assertion checks in place
    10.9 +!if "$(BUILD_FLAVOR)" == "debug"
   10.10 +SA_EXTRA_CFLAGS = -Od -D "_DEBUG"
   10.11 +!if "$(BUILDARCH)" == "i486"
   10.12 +SA_EXTRA_CFLAGS = $(SA_EXTRA_CFLAGS) -RTC1
   10.13 +!endif
   10.14 +!elseif "$(BUILD_FLAVOR)" == "fastdebug"
   10.15 +SA_EXTRA_CFLAGS = -O2 -D "_DEBUG"
   10.16 +!else
   10.17 +SA_EXTRA_CFLAGS = -O2
   10.18 +!endif
   10.19  
   10.20  !if "$(BUILDARCH)" == "ia64"
   10.21 -SA_CFLAGS = -nologo $(MS_RUNTIME_OPTION) -W3 $(GX_OPTION) -Od -D "WIN32" -D "WIN64" -D "_WINDOWS" -D "_DEBUG" -D "_CONSOLE" -D "_MBCS" -YX -FD -c
   10.22 +SA_CFLAGS = -nologo $(MS_RUNTIME_OPTION) -W3 $(GX_OPTION) -D "WIN32" -D "WIN64" -D "_WINDOWS"  -D "_CONSOLE" -D "_MBCS" -YX -FD -c
   10.23  !elseif "$(BUILDARCH)" == "amd64"
   10.24 -SA_CFLAGS = -nologo $(MS_RUNTIME_OPTION) -W3 $(GX_OPTION) -Od -D "WIN32" -D "WIN64" -D "_WINDOWS" -D "_DEBUG" -D "_CONSOLE" -D "_MBCS" -YX -FD -c
   10.25 +SA_CFLAGS = -nologo $(MS_RUNTIME_OPTION) -W3 $(GX_OPTION) -D "WIN32" -D "WIN64" -D "_WINDOWS" -D "_CONSOLE" -D "_MBCS" -YX -FD -c
   10.26  !if "$(COMPILER_NAME)" == "VS2005"
   10.27  # On amd64, VS2005 compiler requires bufferoverflowU.lib on the link command line, 
   10.28  # otherwise we get missing __security_check_cookie externals at link time. 
   10.29  SA_LD_FLAGS = bufferoverflowU.lib
   10.30  !endif
   10.31  !else
   10.32 -SA_CFLAGS = -nologo $(MS_RUNTIME_OPTION) -W3 -Gm $(GX_OPTION) -Od -D "WIN32" -D "_WINDOWS" -D "_DEBUG" -D "_CONSOLE" -D "_MBCS" -YX -FD -GZ -c
   10.33 +SA_CFLAGS = -nologo $(MS_RUNTIME_OPTION) -W3 -Gm $(GX_OPTION) -D "WIN32" -D "_WINDOWS" -D "_CONSOLE" -D "_MBCS" -YX -FD -c
   10.34  !if "$(ENABLE_FULL_DEBUG_SYMBOLS)" == "1"
   10.35 -SA_CFLAGS = $(SA_CFLAGS) -ZI
   10.36 +# -ZI is incompatible with -O2 used for release/fastdebug builds.
   10.37 +# Using -Zi instead.
   10.38 +SA_CFLAGS = $(SA_CFLAGS) -Zi
   10.39  !endif
   10.40  !endif
   10.41  !if "$(MT)" != ""
   10.42  SA_LD_FLAGS = -manifest $(SA_LD_FLAGS)
   10.43  !endif
   10.44 +SA_CFLAGS = $(SA_CFLAGS) $(SA_EXTRA_CFLAGS)
   10.45  
   10.46  SASRCFILES = $(AGENT_DIR)/src/os/win32/windbg/sawindbg.cpp \
   10.47  		$(AGENT_DIR)/src/share/native/sadis.c
    11.1 --- a/src/cpu/ppc/vm/assembler_ppc.hpp	Mon Mar 04 21:10:27 2019 +0100
    11.2 +++ b/src/cpu/ppc/vm/assembler_ppc.hpp	Mon Mar 18 08:03:04 2019 +0100
    11.3 @@ -1,6 +1,6 @@
    11.4  /*
    11.5 - * Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved.
    11.6 - * Copyright 2012, 2013 SAP AG. All rights reserved.
    11.7 + * Copyright (c) 2002, 2018, Oracle and/or its affiliates. All rights reserved.
    11.8 + * Copyright (c) 2012, 2018, SAP SE. All rights reserved.
    11.9   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   11.10   *
   11.11   * This code is free software; you can redistribute it and/or modify it
   11.12 @@ -1838,7 +1838,7 @@
   11.13    inline void vperm(    VectorRegister d, VectorRegister a, VectorRegister b, VectorRegister c);
   11.14    inline void vsel(     VectorRegister d, VectorRegister a, VectorRegister b, VectorRegister c);
   11.15    inline void vsl(      VectorRegister d, VectorRegister a, VectorRegister b);
   11.16 -  inline void vsldoi(   VectorRegister d, VectorRegister a, VectorRegister b, int si4);
   11.17 +  inline void vsldoi(   VectorRegister d, VectorRegister a, VectorRegister b, int ui4);
   11.18    inline void vslo(     VectorRegister d, VectorRegister a, VectorRegister b);
   11.19    inline void vsr(      VectorRegister d, VectorRegister a, VectorRegister b);
   11.20    inline void vsro(     VectorRegister d, VectorRegister a, VectorRegister b);
    12.1 --- a/src/cpu/ppc/vm/assembler_ppc.inline.hpp	Mon Mar 04 21:10:27 2019 +0100
    12.2 +++ b/src/cpu/ppc/vm/assembler_ppc.inline.hpp	Mon Mar 18 08:03:04 2019 +0100
    12.3 @@ -1,6 +1,6 @@
    12.4  /*
    12.5 - * Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved.
    12.6 - * Copyright 2012, 2014 SAP AG. All rights reserved.
    12.7 + * Copyright (c) 2002, 2018, Oracle and/or its affiliates. All rights reserved.
    12.8 + * Copyright (c) 2012, 2018, SAP SE. All rights reserved.
    12.9   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   12.10   *
   12.11   * This code is free software; you can redistribute it and/or modify it
   12.12 @@ -657,7 +657,7 @@
   12.13  inline void Assembler::vperm(   VectorRegister d, VectorRegister a, VectorRegister b, VectorRegister c){ emit_int32( VPERM_OPCODE | vrt(d) | vra(a) | vrb(b) | vrc(c)); }
   12.14  inline void Assembler::vsel(    VectorRegister d, VectorRegister a, VectorRegister b, VectorRegister c){ emit_int32( VSEL_OPCODE  | vrt(d) | vra(a) | vrb(b) | vrc(c)); }
   12.15  inline void Assembler::vsl(     VectorRegister d, VectorRegister a, VectorRegister b)                  { emit_int32( VSL_OPCODE   | vrt(d) | vra(a) | vrb(b)); }
   12.16 -inline void Assembler::vsldoi(  VectorRegister d, VectorRegister a, VectorRegister b, int si4)         { emit_int32( VSLDOI_OPCODE| vrt(d) | vra(a) | vrb(b) | vsldoi_shb(simm(si4,4))); }
   12.17 +inline void Assembler::vsldoi(  VectorRegister d, VectorRegister a, VectorRegister b, int ui4)         { emit_int32( VSLDOI_OPCODE| vrt(d) | vra(a) | vrb(b) | vsldoi_shb(uimm(ui4,4))); }
   12.18  inline void Assembler::vslo(    VectorRegister d, VectorRegister a, VectorRegister b) { emit_int32( VSLO_OPCODE    | vrt(d) | vra(a) | vrb(b)); }
   12.19  inline void Assembler::vsr(     VectorRegister d, VectorRegister a, VectorRegister b) { emit_int32( VSR_OPCODE     | vrt(d) | vra(a) | vrb(b)); }
   12.20  inline void Assembler::vsro(    VectorRegister d, VectorRegister a, VectorRegister b) { emit_int32( VSRO_OPCODE    | vrt(d) | vra(a) | vrb(b)); }
    13.1 --- a/src/cpu/ppc/vm/macroAssembler_ppc.cpp	Mon Mar 04 21:10:27 2019 +0100
    13.2 +++ b/src/cpu/ppc/vm/macroAssembler_ppc.cpp	Mon Mar 18 08:03:04 2019 +0100
    13.3 @@ -1,6 +1,6 @@
    13.4  /*
    13.5 - * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
    13.6 - * Copyright 2012, 2017 SAP AG. All rights reserved.
    13.7 + * Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved.
    13.8 + * Copyright (c) 2012, 2018, SAP SE. All rights reserved.
    13.9   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   13.10   *
   13.11   * This code is free software; you can redistribute it and/or modify it
   13.12 @@ -3570,12 +3570,12 @@
   13.13    vspltisw(VR0, -1);
   13.14  
   13.15    vsldoi(mask_32bit, zeroes, VR0, 4);
   13.16 -  vsldoi(mask_64bit, zeroes, VR0, -8);
   13.17 +  vsldoi(mask_64bit, zeroes, VR0, 8);
   13.18  
   13.19    // Get the initial value into v8
   13.20    vxor(VR8, VR8, VR8);
   13.21    mtvrd(VR8, crc);
   13.22 -  vsldoi(VR8, zeroes, VR8, -8); // shift into bottom 32 bits
   13.23 +  vsldoi(VR8, zeroes, VR8, 8); // shift into bottom 32 bits
   13.24  
   13.25    li (rLoaded, 0);
   13.26  
   13.27 @@ -3924,7 +3924,7 @@
   13.28    addi(barretConstants, barretConstants, 16);
   13.29    lvx(const2, barretConstants);
   13.30  
   13.31 -  vsldoi(VR1, VR0, VR0, -8);
   13.32 +  vsldoi(VR1, VR0, VR0, 8);
   13.33    vxor(VR0, VR0, VR1);    // xor two 64 bit results together
   13.34  
   13.35    // shift left one bit
    14.1 --- a/src/cpu/ppc/vm/stubGenerator_ppc.cpp	Mon Mar 04 21:10:27 2019 +0100
    14.2 +++ b/src/cpu/ppc/vm/stubGenerator_ppc.cpp	Mon Mar 18 08:03:04 2019 +0100
    14.3 @@ -1,6 +1,6 @@
    14.4  /*
    14.5 - * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
    14.6 - * Copyright 2012, 2014 SAP AG. All rights reserved.
    14.7 + * Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved.
    14.8 + * Copyright (c) 2012, 2018, SAP SE. All rights reserved.
    14.9   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   14.10   *
   14.11   * This code is free software; you can redistribute it and/or modify it
   14.12 @@ -2023,7 +2023,7 @@
   14.13      __ vspltisb        (vTmp2, -16);
   14.14      __ vrld            (keyPerm, keyPerm, vTmp2);
   14.15      __ vrld            (keyPerm, keyPerm, vTmp2);
   14.16 -    __ vsldoi          (keyPerm, keyPerm, keyPerm, -8);
   14.17 +    __ vsldoi          (keyPerm, keyPerm, keyPerm, 8);
   14.18  
   14.19      // load the 1st round key to vKey1
   14.20      __ li              (keypos, 0);
   14.21 @@ -2223,7 +2223,7 @@
   14.22      __ vspltisb        (vTmp2, -16);
   14.23      __ vrld            (keyPerm, keyPerm, vTmp2);
   14.24      __ vrld            (keyPerm, keyPerm, vTmp2);
   14.25 -    __ vsldoi          (keyPerm, keyPerm, keyPerm, -8);
   14.26 +    __ vsldoi          (keyPerm, keyPerm, keyPerm, 8);
   14.27  
   14.28      __ cmpwi           (CCR0, keylen, 44);
   14.29      __ beq             (CCR0, L_do44);
    15.1 --- a/src/cpu/sparc/vm/c1_LIRAssembler_sparc.cpp	Mon Mar 04 21:10:27 2019 +0100
    15.2 +++ b/src/cpu/sparc/vm/c1_LIRAssembler_sparc.cpp	Mon Mar 18 08:03:04 2019 +0100
    15.3 @@ -579,7 +579,7 @@
    15.4          __ and3(Rscratch, divisor - 1, Rscratch);
    15.5        }
    15.6        __ add(Rdividend, Rscratch, Rscratch);
    15.7 -      __ sra(Rscratch, log2_intptr(divisor), Rresult);
    15.8 +      __ sra(Rscratch, log2_int(divisor), Rresult);
    15.9        return;
   15.10      } else {
   15.11        if (divisor == 2) {
    16.1 --- a/src/cpu/sparc/vm/c1_LIRGenerator_sparc.cpp	Mon Mar 04 21:10:27 2019 +0100
    16.2 +++ b/src/cpu/sparc/vm/c1_LIRGenerator_sparc.cpp	Mon Mar 18 08:03:04 2019 +0100
    16.3 @@ -294,11 +294,11 @@
    16.4  bool LIRGenerator::strength_reduce_multiply(LIR_Opr left, int c, LIR_Opr result, LIR_Opr tmp) {
    16.5    assert(left != result, "should be different registers");
    16.6    if (is_power_of_2(c + 1)) {
    16.7 -    __ shift_left(left, log2_intptr(c + 1), result);
    16.8 +    __ shift_left(left, log2_int(c + 1), result);
    16.9      __ sub(result, left, result);
   16.10      return true;
   16.11    } else if (is_power_of_2(c - 1)) {
   16.12 -    __ shift_left(left, log2_intptr(c - 1), result);
   16.13 +    __ shift_left(left, log2_int(c - 1), result);
   16.14      __ add(result, left, result);
   16.15      return true;
   16.16    }
    17.1 --- a/src/cpu/x86/vm/c1_LIRAssembler_x86.cpp	Mon Mar 04 21:10:27 2019 +0100
    17.2 +++ b/src/cpu/x86/vm/c1_LIRAssembler_x86.cpp	Mon Mar 18 08:03:04 2019 +0100
    17.3 @@ -2650,7 +2650,7 @@
    17.4    Register dreg = result->as_register();
    17.5  
    17.6    if (right->is_constant()) {
    17.7 -    int divisor = right->as_constant_ptr()->as_jint();
    17.8 +    jint divisor = right->as_constant_ptr()->as_jint();
    17.9      assert(divisor > 0 && is_power_of_2(divisor), "must be");
   17.10      if (code == lir_idiv) {
   17.11        assert(lreg == rax, "must be rax,");
   17.12 @@ -2662,7 +2662,7 @@
   17.13          __ andl(rdx, divisor - 1);
   17.14          __ addl(lreg, rdx);
   17.15        }
   17.16 -      __ sarl(lreg, log2_intptr(divisor));
   17.17 +      __ sarl(lreg, log2_jint(divisor));
   17.18        move_regs(lreg, dreg);
   17.19      } else if (code == lir_irem) {
   17.20        Label done;
    18.1 --- a/src/cpu/x86/vm/c1_LIRGenerator_x86.cpp	Mon Mar 04 21:10:27 2019 +0100
    18.2 +++ b/src/cpu/x86/vm/c1_LIRGenerator_x86.cpp	Mon Mar 18 08:03:04 2019 +0100
    18.3 @@ -237,12 +237,12 @@
    18.4    if (tmp->is_valid()) {
    18.5      if (is_power_of_2(c + 1)) {
    18.6        __ move(left, tmp);
    18.7 -      __ shift_left(left, log2_intptr(c + 1), left);
    18.8 +      __ shift_left(left, log2_jint(c + 1), left);
    18.9        __ sub(left, tmp, result);
   18.10        return true;
   18.11      } else if (is_power_of_2(c - 1)) {
   18.12        __ move(left, tmp);
   18.13 -      __ shift_left(left, log2_intptr(c - 1), left);
   18.14 +      __ shift_left(left, log2_jint(c - 1), left);
   18.15        __ add(left, tmp, result);
   18.16        return true;
   18.17      }
    19.1 --- a/src/cpu/x86/vm/interp_masm_x86_32.cpp	Mon Mar 04 21:10:27 2019 +0100
    19.2 +++ b/src/cpu/x86/vm/interp_masm_x86_32.cpp	Mon Mar 18 08:03:04 2019 +0100
    19.3 @@ -1,5 +1,5 @@
    19.4  /*
    19.5 - * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
    19.6 + * Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved.
    19.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    19.8   *
    19.9   * This code is free software; you can redistribute it and/or modify it
   19.10 @@ -1445,5 +1445,7 @@
   19.11    incrementl(scratch, increment);
   19.12    movl(counter_addr, scratch);
   19.13    andl(scratch, mask);
   19.14 -  jcc(cond, *where);
   19.15 +  if (where != NULL) {
   19.16 +    jcc(cond, *where);
   19.17 +  }
   19.18  }
    20.1 --- a/src/cpu/x86/vm/interp_masm_x86_64.cpp	Mon Mar 04 21:10:27 2019 +0100
    20.2 +++ b/src/cpu/x86/vm/interp_masm_x86_64.cpp	Mon Mar 18 08:03:04 2019 +0100
    20.3 @@ -1,5 +1,5 @@
    20.4  /*
    20.5 - * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
    20.6 + * Copyright (c) 2003, 2018, 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 @@ -1505,5 +1505,7 @@
   20.11    incrementl(scratch, increment);
   20.12    movl(counter_addr, scratch);
   20.13    andl(scratch, mask);
   20.14 -  jcc(cond, *where);
   20.15 +  if (where != NULL) {
   20.16 +    jcc(cond, *where);
   20.17 +  }
   20.18  }
    21.1 --- a/src/cpu/x86/vm/templateTable_x86_32.cpp	Mon Mar 04 21:10:27 2019 +0100
    21.2 +++ b/src/cpu/x86/vm/templateTable_x86_32.cpp	Mon Mar 18 08:03:04 2019 +0100
    21.3 @@ -1,5 +1,5 @@
    21.4  /*
    21.5 - * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
    21.6 + * Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved.
    21.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    21.8   *
    21.9   * This code is free software; you can redistribute it and/or modify it
   21.10 @@ -1640,15 +1640,16 @@
   21.11          // Increment the MDO backedge counter
   21.12          const Address mdo_backedge_counter(rbx, in_bytes(MethodData::backedge_counter_offset()) +
   21.13                                                  in_bytes(InvocationCounter::counter_offset()));
   21.14 -        __ increment_mask_and_jump(mdo_backedge_counter, increment, mask,
   21.15 -                                   rax, false, Assembler::zero, &backedge_counter_overflow);
   21.16 +        __ increment_mask_and_jump(mdo_backedge_counter, increment, mask, rax, false, Assembler::zero,
   21.17 +                                   UseOnStackReplacement ? &backedge_counter_overflow : NULL);
   21.18          __ jmp(dispatch);
   21.19        }
   21.20        __ bind(no_mdo);
   21.21        // Increment backedge counter in MethodCounters*
   21.22        __ movptr(rcx, Address(rcx, Method::method_counters_offset()));
   21.23        __ increment_mask_and_jump(Address(rcx, be_offset), increment, mask,
   21.24 -                                 rax, false, Assembler::zero, &backedge_counter_overflow);
   21.25 +                                 rax, false, Assembler::zero,
   21.26 +                                 UseOnStackReplacement ? &backedge_counter_overflow : NULL);
   21.27      } else {
   21.28        // increment counter
   21.29        __ movptr(rcx, Address(rcx, Method::method_counters_offset()));
    22.1 --- a/src/cpu/x86/vm/templateTable_x86_64.cpp	Mon Mar 04 21:10:27 2019 +0100
    22.2 +++ b/src/cpu/x86/vm/templateTable_x86_64.cpp	Mon Mar 18 08:03:04 2019 +0100
    22.3 @@ -1,5 +1,5 @@
    22.4  /*
    22.5 - * Copyright (c) 2003, 2017, Oracle and/or its affiliates. All rights reserved.
    22.6 + * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved.
    22.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    22.8   *
    22.9   * This code is free software; you can redistribute it and/or modify it
   22.10 @@ -1665,15 +1665,16 @@
   22.11          // Increment the MDO backedge counter
   22.12          const Address mdo_backedge_counter(rbx, in_bytes(MethodData::backedge_counter_offset()) +
   22.13                                             in_bytes(InvocationCounter::counter_offset()));
   22.14 -        __ increment_mask_and_jump(mdo_backedge_counter, increment, mask,
   22.15 -                                   rax, false, Assembler::zero, &backedge_counter_overflow);
   22.16 +        __ increment_mask_and_jump(mdo_backedge_counter, increment, mask, rax, false, Assembler::zero,
   22.17 +                                   UseOnStackReplacement ? &backedge_counter_overflow : NULL);
   22.18          __ jmp(dispatch);
   22.19        }
   22.20        __ bind(no_mdo);
   22.21        // Increment backedge counter in MethodCounters*
   22.22        __ movptr(rcx, Address(rcx, Method::method_counters_offset()));
   22.23        __ increment_mask_and_jump(Address(rcx, be_offset), increment, mask,
   22.24 -                                 rax, false, Assembler::zero, &backedge_counter_overflow);
   22.25 +                                 rax, false, Assembler::zero,
   22.26 +                                 UseOnStackReplacement ? &backedge_counter_overflow : NULL);
   22.27      } else {
   22.28        // increment counter
   22.29        __ movptr(rcx, Address(rcx, Method::method_counters_offset()));
    23.1 --- a/src/os/aix/vm/os_aix.cpp	Mon Mar 04 21:10:27 2019 +0100
    23.2 +++ b/src/os/aix/vm/os_aix.cpp	Mon Mar 18 08:03:04 2019 +0100
    23.3 @@ -1,5 +1,5 @@
    23.4  /*
    23.5 - * Copyright (c) 1999, 2018, Oracle and/or its affiliates. All rights reserved.
    23.6 + * Copyright (c) 1999, 2019, Oracle and/or its affiliates. All rights reserved.
    23.7   * Copyright 2012, 2014 SAP AG. All rights reserved.
    23.8   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    23.9   *
   23.10 @@ -5142,7 +5142,7 @@
   23.11  // or -1 on failure (e.g. can't fork a new process).
   23.12  // Unlike system(), this function can be called from signal handler. It
   23.13  // doesn't block SIGINT et al.
   23.14 -int os::fork_and_exec(char* cmd) {
   23.15 +int os::fork_and_exec(char* cmd, bool use_vfork_if_available) {
   23.16    char * argv[4] = {"sh", "-c", cmd, NULL};
   23.17  
   23.18    pid_t pid = fork();
    24.1 --- a/src/os/bsd/vm/os_bsd.cpp	Mon Mar 04 21:10:27 2019 +0100
    24.2 +++ b/src/os/bsd/vm/os_bsd.cpp	Mon Mar 18 08:03:04 2019 +0100
    24.3 @@ -1,5 +1,5 @@
    24.4  /*
    24.5 - * Copyright (c) 1999, 2018, Oracle and/or its affiliates. All rights reserved.
    24.6 + * Copyright (c) 1999, 2019, 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 @@ -4716,7 +4716,7 @@
   24.11  // or -1 on failure (e.g. can't fork a new process).
   24.12  // Unlike system(), this function can be called from signal handler. It
   24.13  // doesn't block SIGINT et al.
   24.14 -int os::fork_and_exec(char* cmd) {
   24.15 +int os::fork_and_exec(char* cmd, bool use_vfork_if_available) {
   24.16    const char * argv[4] = {"sh", "-c", cmd, NULL};
   24.17  
   24.18    // fork() in BsdThreads/NPTL is not async-safe. It needs to run
    25.1 --- a/src/os/linux/vm/os_linux.cpp	Mon Mar 04 21:10:27 2019 +0100
    25.2 +++ b/src/os/linux/vm/os_linux.cpp	Mon Mar 18 08:03:04 2019 +0100
    25.3 @@ -1,5 +1,5 @@
    25.4  /*
    25.5 - * Copyright (c) 1999, 2018, Oracle and/or its affiliates. All rights reserved.
    25.6 + * Copyright (c) 1999, 2019, 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 @@ -724,6 +724,10 @@
   25.11    }
   25.12  }
   25.13  
   25.14 +void os::Linux::expand_stack_to(address bottom) {
   25.15 +  _expand_stack_to(bottom);
   25.16 +}
   25.17 +
   25.18  bool os::Linux::manually_expand_stack(JavaThread * t, address addr) {
   25.19    assert(t!=NULL, "just checking");
   25.20    assert(t->osthread()->expanding_stack(), "expand should be set");
   25.21 @@ -6333,10 +6337,16 @@
   25.22  // or -1 on failure (e.g. can't fork a new process).
   25.23  // Unlike system(), this function can be called from signal handler. It
   25.24  // doesn't block SIGINT et al.
   25.25 -int os::fork_and_exec(char* cmd) {
   25.26 +int os::fork_and_exec(char* cmd, bool use_vfork_if_available) {
   25.27    const char * argv[4] = {"sh", "-c", cmd, NULL};
   25.28  
   25.29 -  pid_t pid = fork();
   25.30 +  pid_t pid ;
   25.31 +
   25.32 +  if (use_vfork_if_available) {
   25.33 +    pid = vfork();
   25.34 +  } else {
   25.35 +    pid = fork();
   25.36 +  }
   25.37  
   25.38    if (pid < 0) {
   25.39      // fork failed
    26.1 --- a/src/os/linux/vm/os_linux.hpp	Mon Mar 04 21:10:27 2019 +0100
    26.2 +++ b/src/os/linux/vm/os_linux.hpp	Mon Mar 18 08:03:04 2019 +0100
    26.3 @@ -249,6 +249,8 @@
    26.4    static int safe_cond_timedwait(pthread_cond_t *_cond, pthread_mutex_t *_mutex, const struct timespec *_abstime);
    26.5  
    26.6  private:
    26.7 +  static void expand_stack_to(address bottom);
    26.8 +
    26.9    typedef int (*sched_getcpu_func_t)(void);
   26.10    typedef int (*numa_node_to_cpus_func_t)(int node, unsigned long *buffer, int bufferlen);
   26.11    typedef int (*numa_max_node_func_t)(void);
    27.1 --- a/src/os/posix/vm/os_posix.cpp	Mon Mar 04 21:10:27 2019 +0100
    27.2 +++ b/src/os/posix/vm/os_posix.cpp	Mon Mar 18 08:03:04 2019 +0100
    27.3 @@ -604,7 +604,11 @@
    27.4    strncpy(buffer, "none", size);
    27.5  
    27.6    const struct {
    27.7 -    int i;
    27.8 +    // NB: i is an unsigned int here because SA_RESETHAND is on some
    27.9 +    // systems 0x80000000, which is implicitly unsigned.  Assignining
   27.10 +    // it to an int field would be an overflow in unsigned-to-signed
   27.11 +    // conversion.
   27.12 +    unsigned int i;
   27.13      const char* s;
   27.14    } flaginfo [] = {
   27.15      { SA_NOCLDSTOP, "SA_NOCLDSTOP" },
    28.1 --- a/src/os/solaris/vm/os_solaris.cpp	Mon Mar 04 21:10:27 2019 +0100
    28.2 +++ b/src/os/solaris/vm/os_solaris.cpp	Mon Mar 18 08:03:04 2019 +0100
    28.3 @@ -1,5 +1,5 @@
    28.4  /*
    28.5 - * Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved.
    28.6 + * Copyright (c) 1997, 2019, Oracle and/or its affiliates. All rights reserved.
    28.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    28.8   *
    28.9   * This code is free software; you can redistribute it and/or modify it
   28.10 @@ -6153,7 +6153,7 @@
   28.11  // or -1 on failure (e.g. can't fork a new process).
   28.12  // Unlike system(), this function can be called from signal handler. It
   28.13  // doesn't block SIGINT et al.
   28.14 -int os::fork_and_exec(char* cmd) {
   28.15 +int os::fork_and_exec(char* cmd, bool use_vfork_if_available) {
   28.16    char * argv[4];
   28.17    argv[0] = (char *)"sh";
   28.18    argv[1] = (char *)"-c";
    29.1 --- a/src/os/windows/vm/os_windows.cpp	Mon Mar 04 21:10:27 2019 +0100
    29.2 +++ b/src/os/windows/vm/os_windows.cpp	Mon Mar 18 08:03:04 2019 +0100
    29.3 @@ -1,5 +1,5 @@
    29.4  /*
    29.5 - * Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved.
    29.6 + * Copyright (c) 1997, 2019, Oracle and/or its affiliates. All rights reserved.
    29.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    29.8   *
    29.9   * This code is free software; you can redistribute it and/or modify it
   29.10 @@ -1757,7 +1757,13 @@
   29.11      if (is_workstation) {
   29.12        st->print("10");
   29.13      } else {
   29.14 -      st->print("Server 2016");
   29.15 +      // distinguish Windows Server 2016 and 2019 by build number
   29.16 +      // Windows server 2019 GA 10/2018 build number is 17763
   29.17 +      if (build_number > 17762) {
   29.18 +        st->print("Server 2019");
   29.19 +      } else {
   29.20 +        st->print("Server 2016");
   29.21 +      }
   29.22      }
   29.23      break;
   29.24  
   29.25 @@ -5034,7 +5040,7 @@
   29.26  
   29.27  // Run the specified command in a separate process. Return its exit value,
   29.28  // or -1 on failure (e.g. can't create a new process).
   29.29 -int os::fork_and_exec(char* cmd) {
   29.30 +int os::fork_and_exec(char* cmd, bool use_vfork_if_available) {
   29.31    STARTUPINFO si;
   29.32    PROCESS_INFORMATION pi;
   29.33  
    30.1 --- a/src/os_cpu/linux_x86/vm/os_linux_x86.cpp	Mon Mar 04 21:10:27 2019 +0100
    30.2 +++ b/src/os_cpu/linux_x86/vm/os_linux_x86.cpp	Mon Mar 18 08:03:04 2019 +0100
    30.3 @@ -892,6 +892,27 @@
    30.4  void os::workaround_expand_exec_shield_cs_limit() {
    30.5  #if defined(IA32)
    30.6    size_t page_size = os::vm_page_size();
    30.7 +
    30.8 +  /*
    30.9 +   * JDK-8197429
   30.10 +   *
   30.11 +   * Expand the stack mapping to the end of the initial stack before
   30.12 +   * attempting to install the codebuf.  This is needed because newer
   30.13 +   * Linux kernels impose a distance of a megabyte between stack
   30.14 +   * memory and other memory regions.  If we try to install the
   30.15 +   * codebuf before expanding the stack the installation will appear
   30.16 +   * to succeed but we'll get a segfault later if we expand the stack
   30.17 +   * in Java code.
   30.18 +   *
   30.19 +   */
   30.20 +  if (os::is_primordial_thread()) {
   30.21 +    address limit = Linux::initial_thread_stack_bottom();
   30.22 +    if (! DisablePrimordialThreadGuardPages) {
   30.23 +      limit += (StackYellowPages + StackRedPages) * page_size;
   30.24 +    }
   30.25 +    os::Linux::expand_stack_to(limit);
   30.26 +  }
   30.27 +
   30.28    /*
   30.29     * Take the highest VA the OS will give us and exec
   30.30     *
   30.31 @@ -910,6 +931,16 @@
   30.32    char* hint = (char*) (Linux::initial_thread_stack_bottom() -
   30.33                          ((StackYellowPages + StackRedPages + 1) * page_size));
   30.34    char* codebuf = os::attempt_reserve_memory_at(page_size, hint);
   30.35 +
   30.36 +  if (codebuf == NULL) {
   30.37 +    // JDK-8197429: There may be a stack gap of one megabyte between
   30.38 +    // the limit of the stack and the nearest memory region: this is a
   30.39 +    // Linux kernel workaround for CVE-2017-1000364.  If we failed to
   30.40 +    // map our codebuf, try again at an address one megabyte lower.
   30.41 +    hint -= 1 * M;
   30.42 +    codebuf = os::attempt_reserve_memory_at(page_size, hint);
   30.43 +  }
   30.44 +
   30.45    if ( (codebuf == NULL) || (!os::commit_memory(codebuf, page_size, true)) ) {
   30.46      return; // No matter, we tried, best effort.
   30.47    }
    31.1 --- a/src/share/vm/adlc/adlparse.cpp	Mon Mar 04 21:10:27 2019 +0100
    31.2 +++ b/src/share/vm/adlc/adlparse.cpp	Mon Mar 18 08:03:04 2019 +0100
    31.3 @@ -2868,7 +2868,8 @@
    31.4    const char* param = NULL;
    31.5    inst._parameters.reset();
    31.6    while ((param = inst._parameters.iter()) != NULL) {
    31.7 -    OperandForm* opForm = (OperandForm*) inst._localNames[param];
    31.8 +    OpClassForm* opForm = inst._localNames[param]->is_opclass();
    31.9 +    assert(opForm != NULL, "sanity");
   31.10      encoding->add_parameter(opForm->_ident, param);
   31.11    }
   31.12  
   31.13 @@ -3338,7 +3339,8 @@
   31.14    const char* param = NULL;
   31.15    inst._parameters.reset();
   31.16    while ((param = inst._parameters.iter()) != NULL) {
   31.17 -    OperandForm* opForm = (OperandForm*) inst._localNames[param];
   31.18 +    OpClassForm* opForm = inst._localNames[param]->is_opclass();
   31.19 +    assert(opForm != NULL, "sanity");
   31.20      encoding->add_parameter(opForm->_ident, param);
   31.21    }
   31.22  
    32.1 --- a/src/share/vm/adlc/dfa.cpp	Mon Mar 04 21:10:27 2019 +0100
    32.2 +++ b/src/share/vm/adlc/dfa.cpp	Mon Mar 18 08:03:04 2019 +0100
    32.3 @@ -757,19 +757,27 @@
    32.4  }
    32.5  
    32.6  int Expr::compute_min(const Expr *c1, const Expr *c2) {
    32.7 -  int result = c1->_min_value + c2->_min_value;
    32.8 -  assert( result >= 0, "Invalid cost computation");
    32.9 +  int v1 = c1->_min_value;
   32.10 +  int v2 = c2->_min_value;
   32.11 +  assert(0 <= v2 && v2 <= Expr::Max, "sanity");
   32.12 +  assert(v1 <= Expr::Max - v2, "Invalid cost computation");
   32.13  
   32.14 -  return result;
   32.15 +  return v1 + v2;
   32.16  }
   32.17  
   32.18 +
   32.19  int Expr::compute_max(const Expr *c1, const Expr *c2) {
   32.20 -  int result = c1->_max_value + c2->_max_value;
   32.21 -  if( result < 0 ) {  // check for overflow
   32.22 -    result = Expr::Max;
   32.23 +  int v1 = c1->_max_value;
   32.24 +  int v2 = c2->_max_value;
   32.25 +
   32.26 +  // Check for overflow without producing UB. If v2 is positive
   32.27 +  // and not larger than Max, the subtraction cannot underflow.
   32.28 +  assert(0 <= v2 && v2 <= Expr::Max, "sanity");
   32.29 +  if (v1 > Expr::Max - v2) {
   32.30 +    return Expr::Max;
   32.31    }
   32.32  
   32.33 -  return result;
   32.34 +  return v1 + v2;
   32.35  }
   32.36  
   32.37  void Expr::print() const {
    33.1 --- a/src/share/vm/adlc/formssel.cpp	Mon Mar 04 21:10:27 2019 +0100
    33.2 +++ b/src/share/vm/adlc/formssel.cpp	Mon Mar 18 08:03:04 2019 +0100
    33.3 @@ -921,7 +921,8 @@
    33.4    const char *name;
    33.5    const char *kill_name = NULL;
    33.6    for (_parameters.reset(); (name = _parameters.iter()) != NULL;) {
    33.7 -    OperandForm *opForm = (OperandForm*)_localNames[name];
    33.8 +    OpClassForm *opForm = _localNames[name]->is_opclass();
    33.9 +    assert(opForm != NULL, "sanity");
   33.10  
   33.11      Effect* e = NULL;
   33.12      {
   33.13 @@ -938,7 +939,8 @@
   33.14        // complex so simply enforce the restriction during parse.
   33.15        if (kill_name != NULL &&
   33.16            e->isa(Component::TEMP) && !e->isa(Component::DEF)) {
   33.17 -        OperandForm* kill = (OperandForm*)_localNames[kill_name];
   33.18 +        OpClassForm* kill = _localNames[kill_name]->is_opclass();
   33.19 +        assert(kill != NULL, "sanity");
   33.20          globalAD->syntax_err(_linenum, "%s: %s %s must be at the end of the argument list\n",
   33.21                               _ident, kill->_ident, kill_name);
   33.22        } else if (e->isa(Component::KILL) && !e->isa(Component::USE)) {
   33.23 @@ -2339,7 +2341,8 @@
   33.24    // Add parameters that "do not appear in match rule".
   33.25    const char *name;
   33.26    for (_parameters.reset(); (name = _parameters.iter()) != NULL;) {
   33.27 -    OperandForm *opForm = (OperandForm*)_localNames[name];
   33.28 +    OpClassForm *opForm = _localNames[name]->is_opclass();
   33.29 +    assert(opForm != NULL, "sanity");
   33.30  
   33.31      if ( _components.operand_position(name) == -1 ) {
   33.32        _components.insert(name, opForm->_ident, Component::INVALID, false);
    34.1 --- a/src/share/vm/asm/assembler.hpp	Mon Mar 04 21:10:27 2019 +0100
    34.2 +++ b/src/share/vm/asm/assembler.hpp	Mon Mar 18 08:03:04 2019 +0100
    34.3 @@ -1,5 +1,5 @@
    34.4  /*
    34.5 - * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
    34.6 + * Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved.
    34.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    34.8   *
    34.9   * This code is free software; you can redistribute it and/or modify it
   34.10 @@ -169,6 +169,14 @@
   34.11    Label() {
   34.12      init();
   34.13    }
   34.14 +
   34.15 +  ~Label() {
   34.16 +    assert(is_bound() || is_unused(), "Label was never bound to a location, but it was used as a jmp target");
   34.17 +  }
   34.18 +
   34.19 +  void reset() {
   34.20 +    init(); //leave _patch_overflow because it points to CodeBuffer.
   34.21 +  }
   34.22  };
   34.23  
   34.24  // A union type for code which has to assemble both constant and
    35.1 --- a/src/share/vm/c1/c1_LIRAssembler.cpp	Mon Mar 04 21:10:27 2019 +0100
    35.2 +++ b/src/share/vm/c1/c1_LIRAssembler.cpp	Mon Mar 18 08:03:04 2019 +0100
    35.3 @@ -1,5 +1,5 @@
    35.4  /*
    35.5 - * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
    35.6 + * Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved.
    35.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    35.8   *
    35.9   * This code is free software; you can redistribute it and/or modify it
   35.10 @@ -128,6 +128,9 @@
   35.11  
   35.12  
   35.13  LIR_Assembler::~LIR_Assembler() {
   35.14 +  // The unwind handler label may be unbound if this destructor is invoked because of a bail-out.
   35.15 +  // Reset it here to avoid an assertion.
   35.16 +  _unwind_handler_entry.reset();
   35.17  }
   35.18  
   35.19  
    36.1 --- a/src/share/vm/c1/c1_LIRGenerator.cpp	Mon Mar 04 21:10:27 2019 +0100
    36.2 +++ b/src/share/vm/c1/c1_LIRGenerator.cpp	Mon Mar 18 08:03:04 2019 +0100
    36.3 @@ -2305,6 +2305,10 @@
    36.4  
    36.5        // We can have generate one runtime check here. Let's start with
    36.6        // the offset check.
    36.7 +      // Allocate temp register to src and load it here, otherwise
    36.8 +      // control flow below may confuse register allocator.
    36.9 +      LIR_Opr src_reg = new_register(T_OBJECT);
   36.10 +      __ move(src.result(), src_reg);
   36.11        if (gen_offset_check) {
   36.12          // if (offset != referent_offset) -> continue
   36.13          // If offset is an int then we can do the comparison with the
   36.14 @@ -2327,14 +2331,14 @@
   36.15        if (gen_source_check) {
   36.16          // offset is a const and equals referent offset
   36.17          // if (source == null) -> continue
   36.18 -        __ cmp(lir_cond_equal, src.result(), LIR_OprFact::oopConst(NULL));
   36.19 +        __ cmp(lir_cond_equal, src_reg, LIR_OprFact::oopConst(NULL));
   36.20          __ branch(lir_cond_equal, T_OBJECT, Lcont->label());
   36.21        }
   36.22        LIR_Opr src_klass = new_register(T_OBJECT);
   36.23        if (gen_type_check) {
   36.24          // We have determined that offset == referent_offset && src != null.
   36.25          // if (src->_klass->_reference_type == REF_NONE) -> continue
   36.26 -        __ move(new LIR_Address(src.result(), oopDesc::klass_offset_in_bytes(), T_ADDRESS), src_klass);
   36.27 +        __ move(new LIR_Address(src_reg, oopDesc::klass_offset_in_bytes(), T_ADDRESS), src_klass);
   36.28          LIR_Address* reference_type_addr = new LIR_Address(src_klass, in_bytes(InstanceKlass::reference_type_offset()), T_BYTE);
   36.29          LIR_Opr reference_type = new_register(T_INT);
   36.30          __ move(reference_type_addr, reference_type);
    37.1 --- a/src/share/vm/code/dependencies.cpp	Mon Mar 04 21:10:27 2019 +0100
    37.2 +++ b/src/share/vm/code/dependencies.cpp	Mon Mar 18 08:03:04 2019 +0100
    37.3 @@ -525,7 +525,7 @@
    37.4          xtty->object("x", arg.metadata_value());
    37.5        }
    37.6      } else {
    37.7 -      char xn[10]; sprintf(xn, "x%d", j);
    37.8 +      char xn[12]; sprintf(xn, "x%d", j);
    37.9        if (arg.is_oop()) {
   37.10          xtty->object(xn, arg.oop_value());
   37.11        } else {
    38.1 --- a/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp	Mon Mar 04 21:10:27 2019 +0100
    38.2 +++ b/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp	Mon Mar 18 08:03:04 2019 +0100
    38.3 @@ -1,5 +1,5 @@
    38.4  /*
    38.5 - * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved.
    38.6 + * Copyright (c) 2001, 2019, Oracle and/or its affiliates. All rights reserved.
    38.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    38.8   *
    38.9   * This code is free software; you can redistribute it and/or modify it
   38.10 @@ -9541,6 +9541,7 @@
   38.11      case CMSCollector::InitialMarking:
   38.12        initialize(true  /* fullGC */ ,
   38.13                   cause /* cause of the GC */,
   38.14 +                 true  /* allMemoryPoolsAffected */,
   38.15                   true  /* recordGCBeginTime */,
   38.16                   true  /* recordPreGCUsage */,
   38.17                   false /* recordPeakUsage */,
   38.18 @@ -9553,6 +9554,7 @@
   38.19      case CMSCollector::FinalMarking:
   38.20        initialize(true  /* fullGC */ ,
   38.21                   cause /* cause of the GC */,
   38.22 +                 true  /* allMemoryPoolsAffected */,
   38.23                   false /* recordGCBeginTime */,
   38.24                   false /* recordPreGCUsage */,
   38.25                   false /* recordPeakUsage */,
   38.26 @@ -9565,6 +9567,7 @@
   38.27      case CMSCollector::Sweeping:
   38.28        initialize(true  /* fullGC */ ,
   38.29                   cause /* cause of the GC */,
   38.30 +                 true  /* allMemoryPoolsAffected */,
   38.31                   false /* recordGCBeginTime */,
   38.32                   false /* recordPreGCUsage */,
   38.33                   true  /* recordPeakUsage */,
    39.1 --- a/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp	Mon Mar 04 21:10:27 2019 +0100
    39.2 +++ b/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp	Mon Mar 18 08:03:04 2019 +0100
    39.3 @@ -1,5 +1,5 @@
    39.4  /*
    39.5 - * Copyright (c) 2001, 2015, Oracle and/or its affiliates. All rights reserved.
    39.6 + * Copyright (c) 2001, 2019, Oracle and/or its affiliates. All rights reserved.
    39.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    39.8   *
    39.9   * This code is free software; you can redistribute it and/or modify it
   39.10 @@ -4008,7 +4008,8 @@
   39.11      log_gc_header();
   39.12  
   39.13      TraceCollectorStats tcs(g1mm()->incremental_collection_counters());
   39.14 -    TraceMemoryManagerStats tms(false /* fullGC */, gc_cause());
   39.15 +    TraceMemoryManagerStats tms(false /* fullGC */, gc_cause(),
   39.16 +                                yc_type() == Mixed /* allMemoryPoolsAffected */);
   39.17  
   39.18      // If the secondary_free_list is not empty, append it to the
   39.19      // free_list. No need to wait for the cleanup operation to finish;
    40.1 --- a/src/share/vm/memory/metaspace.cpp	Mon Mar 04 21:10:27 2019 +0100
    40.2 +++ b/src/share/vm/memory/metaspace.cpp	Mon Mar 18 08:03:04 2019 +0100
    40.3 @@ -1,5 +1,5 @@
    40.4  /*
    40.5 - * Copyright (c) 2011, 2018, Oracle and/or its affiliates. All rights reserved.
    40.6 + * Copyright (c) 2011, 2019, Oracle and/or its affiliates. All rights reserved.
    40.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    40.8   *
    40.9   * This code is free software; you can redistribute it and/or modify it
   40.10 @@ -1422,7 +1422,15 @@
   40.11    return value;
   40.12  }
   40.13  
   40.14 -bool MetaspaceGC::inc_capacity_until_GC(size_t v, size_t* new_cap_until_GC, size_t* old_cap_until_GC) {
   40.15 +// Try to increase the _capacity_until_GC limit counter by v bytes.
   40.16 +// Returns true if it succeeded. It may fail if either another thread
   40.17 +// concurrently increased the limit or the new limit would be larger
   40.18 +// than MaxMetaspaceSize.
   40.19 +// On success, optionally returns new and old metaspace capacity in
   40.20 +// new_cap_until_GC and old_cap_until_GC respectively.
   40.21 +// On error, optionally sets can_retry to indicate whether if there is
   40.22 +// actually enough space remaining to satisfy the request.
   40.23 +bool MetaspaceGC::inc_capacity_until_GC(size_t v, size_t* new_cap_until_GC, size_t* old_cap_until_GC, bool* can_retry) {
   40.24    assert_is_size_aligned(v, Metaspace::commit_alignment());
   40.25  
   40.26    size_t capacity_until_GC = (size_t) _capacity_until_GC;
   40.27 @@ -1433,6 +1441,17 @@
   40.28      new_value = align_size_down(max_uintx, Metaspace::commit_alignment());
   40.29    }
   40.30  
   40.31 +  if (new_value > MaxMetaspaceSize) {
   40.32 +    if (can_retry != NULL) {
   40.33 +      *can_retry = false;
   40.34 +    }
   40.35 +    return false;
   40.36 +  }
   40.37 +
   40.38 +  if (can_retry != NULL) {
   40.39 +    *can_retry = true;
   40.40 +  }
   40.41 +
   40.42    intptr_t expected = (intptr_t) capacity_until_GC;
   40.43    intptr_t actual = Atomic::cmpxchg_ptr((intptr_t) new_value, &_capacity_until_GC, expected);
   40.44  
   40.45 @@ -1520,7 +1539,7 @@
   40.46  
   40.47    const double min_tmp = used_after_gc / maximum_used_percentage;
   40.48    size_t minimum_desired_capacity =
   40.49 -    (size_t)MIN2(min_tmp, double(max_uintx));
   40.50 +    (size_t)MIN2(min_tmp, double(MaxMetaspaceSize));
   40.51    // Don't shrink less than the initial generation size
   40.52    minimum_desired_capacity = MAX2(minimum_desired_capacity,
   40.53                                    MetaspaceSize);
   40.54 @@ -1579,7 +1598,7 @@
   40.55      const double maximum_free_percentage = MaxMetaspaceFreeRatio / 100.0;
   40.56      const double minimum_used_percentage = 1.0 - maximum_free_percentage;
   40.57      const double max_tmp = used_after_gc / minimum_used_percentage;
   40.58 -    size_t maximum_desired_capacity = (size_t)MIN2(max_tmp, double(max_uintx));
   40.59 +    size_t maximum_desired_capacity = (size_t)MIN2(max_tmp, double(MaxMetaspaceSize));
   40.60      maximum_desired_capacity = MAX2(maximum_desired_capacity,
   40.61                                      MetaspaceSize);
   40.62      if (PrintGCDetails && Verbose) {
   40.63 @@ -3408,6 +3427,7 @@
   40.64  
   40.65    size_t before = 0;
   40.66    size_t after = 0;
   40.67 +  bool can_retry = true;
   40.68    MetaWord* res;
   40.69    bool incremented;
   40.70  
   40.71 @@ -3415,9 +3435,9 @@
   40.72    // the HWM, an allocation is still attempted. This is because another thread must then
   40.73    // have incremented the HWM and therefore the allocation might still succeed.
   40.74    do {
   40.75 -    incremented = MetaspaceGC::inc_capacity_until_GC(delta_bytes, &after, &before);
   40.76 +    incremented = MetaspaceGC::inc_capacity_until_GC(delta_bytes, &after, &before, &can_retry);
   40.77      res = allocate(word_size, mdtype);
   40.78 -  } while (!incremented && res == NULL);
   40.79 +  } while (!incremented && res == NULL && can_retry);
   40.80  
   40.81    if (incremented) {
   40.82      tracer()->report_gc_threshold(before, after,
    41.1 --- a/src/share/vm/memory/metaspace.hpp	Mon Mar 04 21:10:27 2019 +0100
    41.2 +++ b/src/share/vm/memory/metaspace.hpp	Mon Mar 18 08:03:04 2019 +0100
    41.3 @@ -1,5 +1,5 @@
    41.4  /*
    41.5 - * Copyright (c) 2011, 2018, Oracle and/or its affiliates. All rights reserved.
    41.6 + * Copyright (c) 2011, 2019, Oracle and/or its affiliates. All rights reserved.
    41.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    41.8   *
    41.9   * This code is free software; you can redistribute it and/or modify it
   41.10 @@ -259,7 +259,7 @@
   41.11    // Debugging support
   41.12    void verify();
   41.13  
   41.14 -  static void print_compressed_class_space(outputStream* st, const char* requested_addr = 0);
   41.15 +  static void print_compressed_class_space(outputStream* st, const char* requested_addr = 0) NOT_LP64({});
   41.16  
   41.17    class AllocRecordClosure :  public StackObj {
   41.18    public:
   41.19 @@ -416,7 +416,8 @@
   41.20    static size_t capacity_until_GC();
   41.21    static bool inc_capacity_until_GC(size_t v,
   41.22                                      size_t* new_cap_until_GC = NULL,
   41.23 -                                    size_t* old_cap_until_GC = NULL);
   41.24 +                                    size_t* old_cap_until_GC = NULL,
   41.25 +                                    bool* can_retry = NULL);
   41.26    static size_t dec_capacity_until_GC(size_t v);
   41.27  
   41.28    static bool should_concurrent_collect() { return _should_concurrent_collect; }
    42.1 --- a/src/share/vm/opto/addnode.cpp	Mon Mar 04 21:10:27 2019 +0100
    42.2 +++ b/src/share/vm/opto/addnode.cpp	Mon Mar 18 08:03:04 2019 +0100
    42.3 @@ -344,8 +344,8 @@
    42.4  const Type *AddINode::add_ring( const Type *t0, const Type *t1 ) const {
    42.5    const TypeInt *r0 = t0->is_int(); // Handy access
    42.6    const TypeInt *r1 = t1->is_int();
    42.7 -  int lo = r0->_lo + r1->_lo;
    42.8 -  int hi = r0->_hi + r1->_hi;
    42.9 +  int lo = java_add(r0->_lo, r1->_lo);
   42.10 +  int hi = java_add(r0->_hi, r1->_hi);
   42.11    if( !(r0->is_con() && r1->is_con()) ) {
   42.12      // Not both constants, compute approximate result
   42.13      if( (r0->_lo & r1->_lo) < 0 && lo >= 0 ) {
   42.14 @@ -462,8 +462,8 @@
   42.15  const Type *AddLNode::add_ring( const Type *t0, const Type *t1 ) const {
   42.16    const TypeLong *r0 = t0->is_long(); // Handy access
   42.17    const TypeLong *r1 = t1->is_long();
   42.18 -  jlong lo = r0->_lo + r1->_lo;
   42.19 -  jlong hi = r0->_hi + r1->_hi;
   42.20 +  jlong lo = java_add(r0->_lo, r1->_lo);
   42.21 +  jlong hi = java_add(r0->_hi, r1->_hi);
   42.22    if( !(r0->is_con() && r1->is_con()) ) {
   42.23      // Not both constants, compute approximate result
   42.24      if( (r0->_lo & r1->_lo) < 0 && lo >= 0 ) {
    43.1 --- a/src/share/vm/opto/divnode.cpp	Mon Mar 04 21:10:27 2019 +0100
    43.2 +++ b/src/share/vm/opto/divnode.cpp	Mon Mar 18 08:03:04 2019 +0100
    43.3 @@ -131,7 +131,7 @@
    43.4      }
    43.5  
    43.6      // Add rounding to the shift to handle the sign bit
    43.7 -    int l = log2_intptr(d-1)+1;
    43.8 +    int l = log2_jint(d-1)+1;
    43.9      if (needs_rounding) {
   43.10        // Divide-by-power-of-2 can be made into a shift, but you have to do
   43.11        // more math for the rounding.  You need to add 0 for positive
    44.1 --- a/src/share/vm/opto/loopTransform.cpp	Mon Mar 04 21:10:27 2019 +0100
    44.2 +++ b/src/share/vm/opto/loopTransform.cpp	Mon Mar 18 08:03:04 2019 +0100
    44.3 @@ -1310,8 +1310,8 @@
    44.4            limit = new (C) Opaque2Node( C, limit );
    44.5            register_new_node( limit, opaq_ctrl );
    44.6          }
    44.7 -        if (stride_con > 0 && ((limit_type->_lo - stride_con) < limit_type->_lo) ||
    44.8 -                   stride_con < 0 && ((limit_type->_hi - stride_con) > limit_type->_hi)) {
    44.9 +        if (stride_con > 0 && (java_subtract(limit_type->_lo, stride_con) < limit_type->_lo) ||
   44.10 +            stride_con < 0 && (java_subtract(limit_type->_hi, stride_con) > limit_type->_hi)) {
   44.11            // No underflow.
   44.12            new_limit = new (C) SubINode(limit, stride);
   44.13          } else {
    45.1 --- a/src/share/vm/opto/mulnode.cpp	Mon Mar 04 21:10:27 2019 +0100
    45.2 +++ b/src/share/vm/opto/mulnode.cpp	Mon Mar 18 08:03:04 2019 +0100
    45.3 @@ -169,7 +169,6 @@
    45.4    return mul_ring(t1,t2);            // Local flavor of type multiplication
    45.5  }
    45.6  
    45.7 -
    45.8  //=============================================================================
    45.9  //------------------------------Ideal------------------------------------------
   45.10  // Check for power-of-2 multiply, then try the regular MulNode::Ideal
   45.11 @@ -184,42 +183,43 @@
   45.12    }
   45.13  
   45.14    // Now we have a constant Node on the right and the constant in con
   45.15 -  if( con == 0 ) return NULL;   // By zero is handled by Value call
   45.16 -  if( con == 1 ) return NULL;   // By one  is handled by Identity call
   45.17 +  if (con == 0) return NULL;   // By zero is handled by Value call
   45.18 +  if (con == 1) return NULL;   // By one  is handled by Identity call
   45.19  
   45.20    // Check for negative constant; if so negate the final result
   45.21    bool sign_flip = false;
   45.22 -  if( con < 0 ) {
   45.23 -    con = -con;
   45.24 +
   45.25 +  unsigned int abs_con = uabs(con);
   45.26 +  if (abs_con != (unsigned int)con) {
   45.27      sign_flip = true;
   45.28    }
   45.29  
   45.30    // Get low bit; check for being the only bit
   45.31    Node *res = NULL;
   45.32 -  jint bit1 = con & -con;       // Extract low bit
   45.33 -  if( bit1 == con ) {           // Found a power of 2?
   45.34 -    res = new (phase->C) LShiftINode( in(1), phase->intcon(log2_intptr(bit1)) );
   45.35 +  unsigned int bit1 = abs_con & (0-abs_con);       // Extract low bit
   45.36 +  if (bit1 == abs_con) {           // Found a power of 2?
   45.37 +    res = new (phase->C) LShiftINode(in(1), phase->intcon(log2_uint(bit1)));
   45.38    } else {
   45.39  
   45.40      // Check for constant with 2 bits set
   45.41 -    jint bit2 = con-bit1;
   45.42 -    bit2 = bit2 & -bit2;          // Extract 2nd bit
   45.43 -    if( bit2 + bit1 == con ) {    // Found all bits in con?
   45.44 -      Node *n1 = phase->transform( new (phase->C) LShiftINode( in(1), phase->intcon(log2_intptr(bit1)) ) );
   45.45 -      Node *n2 = phase->transform( new (phase->C) LShiftINode( in(1), phase->intcon(log2_intptr(bit2)) ) );
   45.46 -      res = new (phase->C) AddINode( n2, n1 );
   45.47 +    unsigned int bit2 = abs_con-bit1;
   45.48 +    bit2 = bit2 & (0-bit2);          // Extract 2nd bit
   45.49 +    if (bit2 + bit1 == abs_con) {    // Found all bits in con?
   45.50 +      Node *n1 = phase->transform( new (phase->C) LShiftINode(in(1), phase->intcon(log2_uint(bit1))));
   45.51 +      Node *n2 = phase->transform( new (phase->C) LShiftINode(in(1), phase->intcon(log2_uint(bit2))));
   45.52 +      res = new (phase->C) AddINode(n2, n1);
   45.53  
   45.54 -    } else if (is_power_of_2(con+1)) {
   45.55 +    } else if (is_power_of_2(abs_con+1)) {
   45.56        // Sleezy: power-of-2 -1.  Next time be generic.
   45.57 -      jint temp = (jint) (con + 1);
   45.58 -      Node *n1 = phase->transform( new (phase->C) LShiftINode( in(1), phase->intcon(log2_intptr(temp)) ) );
   45.59 -      res = new (phase->C) SubINode( n1, in(1) );
   45.60 +      unsigned int temp = abs_con + 1;
   45.61 +      Node *n1 = phase->transform(new (phase->C) LShiftINode(in(1), phase->intcon(log2_uint(temp))));
   45.62 +      res = new (phase->C) SubINode(n1, in(1));
   45.63      } else {
   45.64        return MulNode::Ideal(phase, can_reshape);
   45.65      }
   45.66    }
   45.67  
   45.68 -  if( sign_flip ) {             // Need to negate result?
   45.69 +  if (sign_flip) {             // Need to negate result?
   45.70      res = phase->transform(res);// Transform, before making the zero con
   45.71      res = new (phase->C) SubINode(phase->intcon(0),res);
   45.72    }
   45.73 @@ -244,13 +244,13 @@
   45.74    double d = (double)hi1;
   45.75  
   45.76    // Compute all endpoints & check for overflow
   45.77 -  int32 A = lo0*lo1;
   45.78 +  int32 A = java_multiply(lo0, lo1);
   45.79    if( (double)A != a*c ) return TypeInt::INT; // Overflow?
   45.80 -  int32 B = lo0*hi1;
   45.81 +  int32 B = java_multiply(lo0, hi1);
   45.82    if( (double)B != a*d ) return TypeInt::INT; // Overflow?
   45.83 -  int32 C = hi0*lo1;
   45.84 +  int32 C = java_multiply(hi0, lo1);
   45.85    if( (double)C != b*c ) return TypeInt::INT; // Overflow?
   45.86 -  int32 D = hi0*hi1;
   45.87 +  int32 D = java_multiply(hi0, hi1);
   45.88    if( (double)D != b*d ) return TypeInt::INT; // Overflow?
   45.89  
   45.90    if( A < B ) { lo0 = A; hi0 = B; } // Sort range endpoints
   45.91 @@ -280,42 +280,42 @@
   45.92    }
   45.93  
   45.94    // Now we have a constant Node on the right and the constant in con
   45.95 -  if( con == CONST64(0) ) return NULL;  // By zero is handled by Value call
   45.96 -  if( con == CONST64(1) ) return NULL;  // By one  is handled by Identity call
   45.97 +  if (con == CONST64(0)) return NULL;  // By zero is handled by Value call
   45.98 +  if (con == CONST64(1)) return NULL;  // By one  is handled by Identity call
   45.99  
  45.100    // Check for negative constant; if so negate the final result
  45.101    bool sign_flip = false;
  45.102 -  if( con < 0 ) {
  45.103 -    con = -con;
  45.104 +  julong abs_con = uabs(con);
  45.105 +  if (abs_con != (julong)con) {
  45.106      sign_flip = true;
  45.107    }
  45.108  
  45.109    // Get low bit; check for being the only bit
  45.110    Node *res = NULL;
  45.111 -  jlong bit1 = con & -con;      // Extract low bit
  45.112 -  if( bit1 == con ) {           // Found a power of 2?
  45.113 -    res = new (phase->C) LShiftLNode( in(1), phase->intcon(log2_long(bit1)) );
  45.114 +  julong bit1 = abs_con & (0-abs_con);      // Extract low bit
  45.115 +  if (bit1 == abs_con) {           // Found a power of 2?
  45.116 +    res = new (phase->C) LShiftLNode(in(1), phase->intcon(log2_long(bit1)));
  45.117    } else {
  45.118  
  45.119      // Check for constant with 2 bits set
  45.120 -    jlong bit2 = con-bit1;
  45.121 -    bit2 = bit2 & -bit2;          // Extract 2nd bit
  45.122 -    if( bit2 + bit1 == con ) {    // Found all bits in con?
  45.123 -      Node *n1 = phase->transform( new (phase->C) LShiftLNode( in(1), phase->intcon(log2_long(bit1)) ) );
  45.124 -      Node *n2 = phase->transform( new (phase->C) LShiftLNode( in(1), phase->intcon(log2_long(bit2)) ) );
  45.125 -      res = new (phase->C) AddLNode( n2, n1 );
  45.126 +    julong bit2 = abs_con-bit1;
  45.127 +    bit2 = bit2 & (0-bit2);          // Extract 2nd bit
  45.128 +    if (bit2 + bit1 == abs_con) {    // Found all bits in con?
  45.129 +      Node *n1 = phase->transform(new (phase->C) LShiftLNode(in(1), phase->intcon(log2_long(bit1))));
  45.130 +      Node *n2 = phase->transform(new (phase->C) LShiftLNode(in(1), phase->intcon(log2_long(bit2))));
  45.131 +      res = new (phase->C) AddLNode(n2, n1);
  45.132  
  45.133 -    } else if (is_power_of_2_long(con+1)) {
  45.134 +    } else if (is_power_of_2_long(abs_con+1)) {
  45.135        // Sleezy: power-of-2 -1.  Next time be generic.
  45.136 -      jlong temp = (jlong) (con + 1);
  45.137 -      Node *n1 = phase->transform( new (phase->C) LShiftLNode( in(1), phase->intcon(log2_long(temp)) ) );
  45.138 -      res = new (phase->C) SubLNode( n1, in(1) );
  45.139 +      julong temp = abs_con + 1;
  45.140 +      Node *n1 = phase->transform( new (phase->C) LShiftLNode(in(1), phase->intcon(log2_long(temp))));
  45.141 +      res = new (phase->C) SubLNode(n1, in(1));
  45.142      } else {
  45.143        return MulNode::Ideal(phase, can_reshape);
  45.144      }
  45.145    }
  45.146  
  45.147 -  if( sign_flip ) {             // Need to negate result?
  45.148 +  if (sign_flip) {             // Need to negate result?
  45.149      res = phase->transform(res);// Transform, before making the zero con
  45.150      res = new (phase->C) SubLNode(phase->longcon(0),res);
  45.151    }
  45.152 @@ -340,13 +340,13 @@
  45.153    double d = (double)hi1;
  45.154  
  45.155    // Compute all endpoints & check for overflow
  45.156 -  jlong A = lo0*lo1;
  45.157 +  jlong A = java_multiply(lo0, lo1);
  45.158    if( (double)A != a*c ) return TypeLong::LONG; // Overflow?
  45.159 -  jlong B = lo0*hi1;
  45.160 +  jlong B = java_multiply(lo0, hi1);
  45.161    if( (double)B != a*d ) return TypeLong::LONG; // Overflow?
  45.162 -  jlong C = hi0*lo1;
  45.163 +  jlong C = java_multiply(hi0, lo1);
  45.164    if( (double)C != b*c ) return TypeLong::LONG; // Overflow?
  45.165 -  jlong D = hi0*hi1;
  45.166 +  jlong D = java_multiply(hi0, hi1);
  45.167    if( (double)D != b*d ) return TypeLong::LONG; // Overflow?
  45.168  
  45.169    if( A < B ) { lo0 = A; hi0 = B; } // Sort range endpoints
  45.170 @@ -444,7 +444,7 @@
  45.171      // Masking off high bits which are always zero is useless.
  45.172      const TypeInt* t1 = phase->type( in(1) )->isa_int();
  45.173      if (t1 != NULL && t1->_lo >= 0) {
  45.174 -      jint t1_support = right_n_bits(1 + log2_intptr(t1->_hi));
  45.175 +      jint t1_support = right_n_bits(1 + log2_jint(t1->_hi));
  45.176        if ((t1_support & con) == t1_support)
  45.177          return in1;
  45.178      }
  45.179 @@ -573,7 +573,8 @@
  45.180      // Masking off high bits which are always zero is useless.
  45.181      const TypeLong* t1 = phase->type( in(1) )->isa_long();
  45.182      if (t1 != NULL && t1->_lo >= 0) {
  45.183 -      jlong t1_support = ((jlong)1 << (1 + log2_long(t1->_hi))) - 1;
  45.184 +      int bit_count = log2_long(t1->_hi) + 1;
  45.185 +      jlong t1_support = jlong(max_julong >> (BitsPerJavaLong - bit_count));
  45.186        if ((t1_support & con) == t1_support)
  45.187          return usr;
  45.188      }
  45.189 @@ -801,7 +802,7 @@
  45.190  
  45.191    // Check for ((x & ((CONST64(1)<<(64-c0))-1)) << c0) which ANDs off high bits
  45.192    // before shifting them away.
  45.193 -  const jlong bits_mask = ((jlong)CONST64(1) << (jlong)(BitsPerJavaLong - con)) - CONST64(1);
  45.194 +  const jlong bits_mask = jlong(max_julong >> con);
  45.195    if( add1_op == Op_AndL &&
  45.196        phase->type(add1->in(2)) == TypeLong::make( bits_mask ) )
  45.197      return new (phase->C) LShiftLNode( add1->in(1), in(2) );
  45.198 @@ -1253,7 +1254,7 @@
  45.199    if ( con == 0 ) return NULL;  // let Identity() handle a 0 shift count
  45.200                                // note: mask computation below does not work for 0 shift count
  45.201    // We'll be wanting the right-shift amount as a mask of that many bits
  45.202 -  const jlong mask = (((jlong)CONST64(1) << (jlong)(BitsPerJavaLong - con)) -1);
  45.203 +  const jlong mask = jlong(max_julong >> con);
  45.204  
  45.205    // Check for ((x << z) + Y) >>> z.  Replace with x + con>>>z
  45.206    // The idiom for rounding to a power of 2 is "(Q+(2^z-1)) >>> z".
    46.1 --- a/src/share/vm/opto/subnode.cpp	Mon Mar 04 21:10:27 2019 +0100
    46.2 +++ b/src/share/vm/opto/subnode.cpp	Mon Mar 18 08:03:04 2019 +0100
    46.3 @@ -252,8 +252,8 @@
    46.4  const Type *SubINode::sub( const Type *t1, const Type *t2 ) const {
    46.5    const TypeInt *r0 = t1->is_int(); // Handy access
    46.6    const TypeInt *r1 = t2->is_int();
    46.7 -  int32 lo = r0->_lo - r1->_hi;
    46.8 -  int32 hi = r0->_hi - r1->_lo;
    46.9 +  int32 lo = java_subtract(r0->_lo, r1->_hi);
   46.10 +  int32 hi = java_subtract(r0->_hi, r1->_lo);
   46.11  
   46.12    // We next check for 32-bit overflow.
   46.13    // If that happens, we just assume all integers are possible.
   46.14 @@ -361,8 +361,8 @@
   46.15  const Type *SubLNode::sub( const Type *t1, const Type *t2 ) const {
   46.16    const TypeLong *r0 = t1->is_long(); // Handy access
   46.17    const TypeLong *r1 = t2->is_long();
   46.18 -  jlong lo = r0->_lo - r1->_hi;
   46.19 -  jlong hi = r0->_hi - r1->_lo;
   46.20 +  jlong lo = java_subtract(r0->_lo, r1->_hi);
   46.21 +  jlong hi = java_subtract(r0->_hi, r1->_lo);
   46.22  
   46.23    // We next check for 32-bit overflow.
   46.24    // If that happens, we just assume all integers are possible.
    47.1 --- a/src/share/vm/opto/type.cpp	Mon Mar 04 21:10:27 2019 +0100
    47.2 +++ b/src/share/vm/opto/type.cpp	Mon Mar 18 08:03:04 2019 +0100
    47.3 @@ -1329,8 +1329,8 @@
    47.4  
    47.5    // The new type narrows the old type, so look for a "death march".
    47.6    // See comments on PhaseTransform::saturate.
    47.7 -  juint nrange = _hi - _lo;
    47.8 -  juint orange = ohi - olo;
    47.9 +  juint nrange = (juint)_hi - _lo;
   47.10 +  juint orange = (juint)ohi - olo;
   47.11    if (nrange < max_juint - 1 && nrange > (orange >> 1) + (SMALLINT*2)) {
   47.12      // Use the new type only if the range shrinks a lot.
   47.13      // We do not want the optimizer computing 2^31 point by point.
   47.14 @@ -1363,7 +1363,7 @@
   47.15  //------------------------------hash-------------------------------------------
   47.16  // Type-specific hashing function.
   47.17  int TypeInt::hash(void) const {
   47.18 -  return _lo+_hi+_widen+(int)Type::Int;
   47.19 +  return java_add(java_add(_lo, _hi), java_add(_widen, (int)Type::Int));
   47.20  }
   47.21  
   47.22  //------------------------------is_finite--------------------------------------
   47.23 @@ -1544,7 +1544,7 @@
   47.24          // If neither endpoint is extremal yet, push out the endpoint
   47.25          // which is closer to its respective limit.
   47.26          if (_lo >= 0 ||                 // easy common case
   47.27 -            (julong)(_lo - min) >= (julong)(max - _hi)) {
   47.28 +            ((julong)_lo - min) >= ((julong)max - _hi)) {
   47.29            // Try to widen to an unsigned range type of 32/63 bits:
   47.30            if (max >= max_juint && _hi < max_juint)
   47.31              return make(_lo, max_juint, WidenMax);
   47.32 @@ -2314,7 +2314,7 @@
   47.33  //------------------------------hash-------------------------------------------
   47.34  // Type-specific hashing function.
   47.35  int TypePtr::hash(void) const {
   47.36 -  return _ptr + _offset;
   47.37 +  return java_add(_ptr, _offset);
   47.38  }
   47.39  
   47.40  //------------------------------dump2------------------------------------------
   47.41 @@ -2904,12 +2904,8 @@
   47.42  // Type-specific hashing function.
   47.43  int TypeOopPtr::hash(void) const {
   47.44    return
   47.45 -    (const_oop() ? const_oop()->hash() : 0) +
   47.46 -    _klass_is_exact +
   47.47 -    _instance_id +
   47.48 -    hash_speculative() +
   47.49 -    _inline_depth +
   47.50 -    TypePtr::hash();
   47.51 +    java_add(java_add(java_add(const_oop() ? const_oop()->hash() : 0, _klass_is_exact),
   47.52 +                      java_add(_instance_id , hash_speculative())), java_add(_inline_depth , TypePtr::hash()));
   47.53  }
   47.54  
   47.55  //------------------------------dump2------------------------------------------
   47.56 @@ -3635,7 +3631,7 @@
   47.57  //------------------------------hash-------------------------------------------
   47.58  // Type-specific hashing function.
   47.59  int TypeInstPtr::hash(void) const {
   47.60 -  int hash = klass()->hash() + TypeOopPtr::hash();
   47.61 +  int hash = java_add(klass()->hash(), TypeOopPtr::hash());
   47.62    return hash;
   47.63  }
   47.64  
   47.65 @@ -4530,7 +4526,7 @@
   47.66  //------------------------------hash-------------------------------------------
   47.67  // Type-specific hashing function.
   47.68  int TypeKlassPtr::hash(void) const {
   47.69 -  return klass()->hash() + TypePtr::hash();
   47.70 +  return java_add(klass()->hash(), TypePtr::hash());
   47.71  }
   47.72  
   47.73  //------------------------------singleton--------------------------------------
    48.1 --- a/src/share/vm/prims/whitebox.cpp	Mon Mar 04 21:10:27 2019 +0100
    48.2 +++ b/src/share/vm/prims/whitebox.cpp	Mon Mar 18 08:03:04 2019 +0100
    48.3 @@ -171,7 +171,7 @@
    48.4  WB_ENTRY(void, WB_PrintHeapSizes(JNIEnv* env, jobject o)) {
    48.5    CollectorPolicy * p = Universe::heap()->collector_policy();
    48.6    gclog_or_tty->print_cr("Minimum heap " SIZE_FORMAT " Initial heap "
    48.7 -    SIZE_FORMAT" Maximum heap " SIZE_FORMAT " Min alignment " SIZE_FORMAT " Max alignment " SIZE_FORMAT,
    48.8 +    SIZE_FORMAT " Maximum heap " SIZE_FORMAT " Space alignment " SIZE_FORMAT " Heap alignment " SIZE_FORMAT,
    48.9      p->min_heap_byte_size(), p->initial_heap_byte_size(), p->max_heap_byte_size(),
   48.10      p->space_alignment(), p->heap_alignment());
   48.11  }
   48.12 @@ -371,6 +371,13 @@
   48.13    return (jlong)(uintptr_t)os::malloc(size, mtTest, stack);
   48.14  WB_END
   48.15  
   48.16 +// Alloc memory with pseudo call stack and specific memory type.
   48.17 +WB_ENTRY(jlong, WB_NMTMallocWithPseudoStackAndType(JNIEnv* env, jobject o, jlong size, jint pseudo_stack, jint type))
   48.18 +  address pc = (address)(size_t)pseudo_stack;
   48.19 +  NativeCallStack stack(&pc, 1);
   48.20 +  return (jlong)(uintptr_t)os::malloc(size, (MEMFLAGS)type, stack);
   48.21 +WB_END
   48.22 +
   48.23  // Free the memory allocated by NMTAllocTest
   48.24  WB_ENTRY(void, WB_NMTFree(JNIEnv* env, jobject o, jlong mem))
   48.25    os::free((void*)(uintptr_t)mem, mtTest);
   48.26 @@ -1081,6 +1088,7 @@
   48.27  #if INCLUDE_NMT
   48.28    {CC"NMTMalloc",           CC"(J)J",                 (void*)&WB_NMTMalloc          },
   48.29    {CC"NMTMallocWithPseudoStack", CC"(JI)J",           (void*)&WB_NMTMallocWithPseudoStack},
   48.30 +  {CC"NMTMallocWithPseudoStackAndType", CC"(JII)J",   (void*)&WB_NMTMallocWithPseudoStackAndType},
   48.31    {CC"NMTFree",             CC"(J)V",                 (void*)&WB_NMTFree            },
   48.32    {CC"NMTReserveMemory",    CC"(J)J",                 (void*)&WB_NMTReserveMemory   },
   48.33    {CC"NMTCommitMemory",     CC"(JJ)V",                (void*)&WB_NMTCommitMemory    },
    49.1 --- a/src/share/vm/runtime/advancedThresholdPolicy.cpp	Mon Mar 04 21:10:27 2019 +0100
    49.2 +++ b/src/share/vm/runtime/advancedThresholdPolicy.cpp	Mon Mar 18 08:03:04 2019 +0100
    49.3 @@ -47,8 +47,8 @@
    49.4    int count = CICompilerCount;
    49.5    if (CICompilerCountPerCPU) {
    49.6      // Simple log n seems to grow too slowly for tiered, try something faster: log n * log log n
    49.7 -    int log_cpu = log2_intptr(os::active_processor_count());
    49.8 -    int loglog_cpu = log2_intptr(MAX2(log_cpu, 1));
    49.9 +    int log_cpu = log2_int(os::active_processor_count());
   49.10 +    int loglog_cpu = log2_int(MAX2(log_cpu, 1));
   49.11      count = MAX2(log_cpu * loglog_cpu, 1) * 3 / 2;
   49.12    }
   49.13  
   49.14 @@ -131,7 +131,8 @@
   49.15  }
   49.16  
   49.17  double AdvancedThresholdPolicy::weight(Method* method) {
   49.18 -  return (method->rate() + 1) * ((method->invocation_count() + 1) *  (method->backedge_count() + 1));
   49.19 +  return (double)(method->rate() + 1) *
   49.20 +    (method->invocation_count() + 1) * (method->backedge_count() + 1);
   49.21  }
   49.22  
   49.23  // Apply heuristics and return true if x should be compiled before y
    50.1 --- a/src/share/vm/runtime/compilationPolicy.cpp	Mon Mar 04 21:10:27 2019 +0100
    50.2 +++ b/src/share/vm/runtime/compilationPolicy.cpp	Mon Mar 18 08:03:04 2019 +0100
    50.3 @@ -181,7 +181,7 @@
    50.4      // Example: if CICompilerCountPerCPU is true, then we get
    50.5      // max(log2(8)-1,1) = 2 compiler threads on an 8-way machine.
    50.6      // May help big-app startup time.
    50.7 -    _compiler_count = MAX2(log2_intptr(os::active_processor_count())-1,1);
    50.8 +    _compiler_count = MAX2(log2_int(os::active_processor_count())-1,1);
    50.9      FLAG_SET_ERGO(intx, CICompilerCount, _compiler_count);
   50.10    } else {
   50.11      _compiler_count = CICompilerCount;
    51.1 --- a/src/share/vm/runtime/fprofiler.cpp	Mon Mar 04 21:10:27 2019 +0100
    51.2 +++ b/src/share/vm/runtime/fprofiler.cpp	Mon Mar 18 08:03:04 2019 +0100
    51.3 @@ -775,7 +775,7 @@
    51.4  }
    51.5  
    51.6  void ThreadProfiler::vm_update(TickPosition where) {
    51.7 -  vm_update(NULL, where);
    51.8 +  vm_update("", where);
    51.9  }
   51.10  
   51.11  void ThreadProfiler::vm_update(const char* name, TickPosition where) {
    52.1 --- a/src/share/vm/runtime/globals.hpp	Mon Mar 04 21:10:27 2019 +0100
    52.2 +++ b/src/share/vm/runtime/globals.hpp	Mon Mar 18 08:03:04 2019 +0100
    52.3 @@ -768,8 +768,8 @@
    52.4            "Time out and warn or fail after SafepointTimeoutDelay "          \
    52.5            "milliseconds if failed to reach safepoint")                      \
    52.6                                                                              \
    52.7 -  develop(bool, DieOnSafepointTimeout, false,                               \
    52.8 -          "Die upon failure to reach safepoint (see SafepointTimeout)")     \
    52.9 +  diagnostic(bool, AbortVMOnSafepointTimeout, false,                        \
   52.10 +          "Abort upon failure to reach safepoint (see SafepointTimeout)")   \
   52.11                                                                              \
   52.12    /* 50 retries * (5 * current_retry_count) millis = ~6.375 seconds */      \
   52.13    /* typically, at most a few retries are needed */                         \
    53.1 --- a/src/share/vm/runtime/os.cpp	Mon Mar 04 21:10:27 2019 +0100
    53.2 +++ b/src/share/vm/runtime/os.cpp	Mon Mar 18 08:03:04 2019 +0100
    53.3 @@ -1284,7 +1284,7 @@
    53.4  }
    53.5  
    53.6  void os::set_memory_serialize_page(address page) {
    53.7 -  int count = log2_intptr(sizeof(class JavaThread)) - log2_intptr(64);
    53.8 +  int count = log2_intptr(sizeof(class JavaThread)) - log2_int(64);
    53.9    _mem_serialize_page = (volatile int32_t *)page;
   53.10    // We initialize the serialization page shift count here
   53.11    // We assume a cache line size of 64 bytes
    54.1 --- a/src/share/vm/runtime/os.hpp	Mon Mar 04 21:10:27 2019 +0100
    54.2 +++ b/src/share/vm/runtime/os.hpp	Mon Mar 18 08:03:04 2019 +0100
    54.3 @@ -1,5 +1,5 @@
    54.4  /*
    54.5 - * Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved.
    54.6 + * Copyright (c) 1997, 2019, 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 @@ -527,7 +527,7 @@
   54.11    static char* do_you_want_to_debug(const char* message);
   54.12  
   54.13    // run cmd in a separate process and return its exit code; or -1 on failures
   54.14 -  static int fork_and_exec(char *cmd);
   54.15 +  static int fork_and_exec(char *cmd, bool use_vfork_if_available = false);
   54.16  
   54.17    // os::exit() is merged with vm_exit()
   54.18    // static void exit(int num);
    55.1 --- a/src/share/vm/runtime/safepoint.cpp	Mon Mar 04 21:10:27 2019 +0100
    55.2 +++ b/src/share/vm/runtime/safepoint.cpp	Mon Mar 18 08:03:04 2019 +0100
    55.3 @@ -790,9 +790,9 @@
    55.4      tty->print_cr("# SafepointSynchronize::begin: (End of list)");
    55.5    }
    55.6  
    55.7 -  // To debug the long safepoint, specify both DieOnSafepointTimeout &
    55.8 +  // To debug the long safepoint, specify both AbortVMOnSafepointTimeout &
    55.9    // ShowMessageBoxOnError.
   55.10 -  if (DieOnSafepointTimeout) {
   55.11 +  if (AbortVMOnSafepointTimeout) {
   55.12      char msg[1024];
   55.13      VM_Operation *op = VMThread::vm_operation();
   55.14      sprintf(msg, "Safepoint sync time longer than " INTX_FORMAT "ms detected when executing %s.",
    56.1 --- a/src/share/vm/runtime/simpleThresholdPolicy.cpp	Mon Mar 04 21:10:27 2019 +0100
    56.2 +++ b/src/share/vm/runtime/simpleThresholdPolicy.cpp	Mon Mar 18 08:03:04 2019 +0100
    56.3 @@ -139,7 +139,7 @@
    56.4    }
    56.5    int count = CICompilerCount;
    56.6    if (CICompilerCountPerCPU) {
    56.7 -    count = MAX2(log2_intptr(os::active_processor_count()), 1) * 3 / 2;
    56.8 +    count = MAX2(log2_int(os::active_processor_count()), 1) * 3 / 2;
    56.9    }
   56.10    set_c1_count(MAX2(count / 3, 1));
   56.11    set_c2_count(MAX2(count - c1_count(), 1));
    57.1 --- a/src/share/vm/services/memReporter.cpp	Mon Mar 04 21:10:27 2019 +0100
    57.2 +++ b/src/share/vm/services/memReporter.cpp	Mon Mar 18 08:03:04 2019 +0100
    57.3 @@ -572,9 +572,15 @@
    57.4  
    57.5  void MemDetailDiffReporter::diff_malloc_site(const MallocSite* early,
    57.6    const MallocSite* current)  const {
    57.7 -  assert(early->flags() == current->flags(), "Must be the same memory type");
    57.8 -  diff_malloc_site(current->call_stack(), current->size(), current->count(),
    57.9 -    early->size(), early->count(), early->flags());
   57.10 +  if (early->flags() != current->flags()) {
   57.11 +    // If malloc site type changed, treat it as deallocation of old type and
   57.12 +    // allocation of new type.
   57.13 +    old_malloc_site(early);
   57.14 +    new_malloc_site(current);
   57.15 +  } else {
   57.16 +    diff_malloc_site(current->call_stack(), current->size(), current->count(),
   57.17 +      early->size(), early->count(), early->flags());
   57.18 +  }
   57.19  }
   57.20  
   57.21  void MemDetailDiffReporter::diff_malloc_site(const NativeCallStack* stack, size_t current_size,
    58.1 --- a/src/share/vm/services/memoryManager.cpp	Mon Mar 04 21:10:27 2019 +0100
    58.2 +++ b/src/share/vm/services/memoryManager.cpp	Mon Mar 18 08:03:04 2019 +0100
    58.3 @@ -1,5 +1,5 @@
    58.4  /*
    58.5 - * Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved.
    58.6 + * Copyright (c) 2003, 2019, Oracle and/or its affiliates. All rights reserved.
    58.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    58.8   *
    58.9   * This code is free software; you can redistribute it and/or modify it
   58.10 @@ -49,13 +49,15 @@
   58.11    (void)const_cast<instanceOop&>(_memory_mgr_obj = instanceOop(NULL));
   58.12  }
   58.13  
   58.14 -void MemoryManager::add_pool(MemoryPool* pool) {
   58.15 -  assert(_num_pools < MemoryManager::max_num_pools, "_num_pools exceeds the max");
   58.16 -  if (_num_pools < MemoryManager::max_num_pools) {
   58.17 -    _pools[_num_pools] = pool;
   58.18 +int MemoryManager::add_pool(MemoryPool* pool) {
   58.19 +  int index = _num_pools;
   58.20 +  assert(index < MemoryManager::max_num_pools, "_num_pools exceeds the max");
   58.21 +  if (index < MemoryManager::max_num_pools) {
   58.22 +    _pools[index] = pool;
   58.23      _num_pools++;
   58.24    }
   58.25    pool->add_manager(this);
   58.26 +  return index;
   58.27  }
   58.28  
   58.29  MemoryManager* MemoryManager::get_code_cache_memory_manager() {
   58.30 @@ -217,6 +219,15 @@
   58.31    delete _current_gc_stat;
   58.32  }
   58.33  
   58.34 +void GCMemoryManager::add_pool(MemoryPool* pool) {
   58.35 +  add_pool(pool, true);
   58.36 +}
   58.37 +
   58.38 +void GCMemoryManager::add_pool(MemoryPool* pool, bool always_affected_by_gc) {
   58.39 +  int index = MemoryManager::add_pool(pool);
   58.40 +  _pool_always_affected_by_gc[index] = always_affected_by_gc;
   58.41 +}
   58.42 +
   58.43  void GCMemoryManager::initialize_gc_stat_info() {
   58.44    assert(MemoryService::num_memory_pools() > 0, "should have one or more memory pools");
   58.45    _last_gc_stat = new(ResourceObj::C_HEAP, mtGC) GCStatInfo(MemoryService::num_memory_pools());
   58.46 @@ -266,7 +277,8 @@
   58.47  void GCMemoryManager::gc_end(bool recordPostGCUsage,
   58.48                               bool recordAccumulatedGCTime,
   58.49                               bool recordGCEndTime, bool countCollection,
   58.50 -                             GCCause::Cause cause) {
   58.51 +                             GCCause::Cause cause,
   58.52 +                             bool allMemoryPoolsAffected) {
   58.53    if (recordAccumulatedGCTime) {
   58.54      _accumulated_timer.stop();
   58.55    }
   58.56 @@ -304,8 +316,11 @@
   58.57        MemoryUsage usage = pool->get_memory_usage();
   58.58  
   58.59        // Compare with GC usage threshold
   58.60 -      pool->set_last_collection_usage(usage);
   58.61 -      LowMemoryDetector::detect_after_gc_memory(pool);
   58.62 +      if (allMemoryPoolsAffected || pool_always_affected_by_gc(i)) {
   58.63 +        // Compare with GC usage threshold
   58.64 +        pool->set_last_collection_usage(usage);
   58.65 +        LowMemoryDetector::detect_after_gc_memory(pool);
   58.66 +      }
   58.67      }
   58.68    }
   58.69  
    59.1 --- a/src/share/vm/services/memoryManager.hpp	Mon Mar 04 21:10:27 2019 +0100
    59.2 +++ b/src/share/vm/services/memoryManager.hpp	Mon Mar 18 08:03:04 2019 +0100
    59.3 @@ -1,5 +1,5 @@
    59.4  /*
    59.5 - * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
    59.6 + * Copyright (c) 2003, 2019, Oracle and/or its affiliates. All rights reserved.
    59.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    59.8   *
    59.9   * This code is free software; you can redistribute it and/or modify it
   59.10 @@ -41,11 +41,12 @@
   59.11  class OopClosure;
   59.12  
   59.13  class MemoryManager : public CHeapObj<mtInternal> {
   59.14 -private:
   59.15 +protected:
   59.16    enum {
   59.17      max_num_pools = 10
   59.18    };
   59.19  
   59.20 +private:
   59.21    MemoryPool* _pools[max_num_pools];
   59.22    int         _num_pools;
   59.23  
   59.24 @@ -75,7 +76,7 @@
   59.25      return _pools[index];
   59.26    }
   59.27  
   59.28 -  void add_pool(MemoryPool* pool);
   59.29 +  int add_pool(MemoryPool* pool);
   59.30  
   59.31    bool is_manager(instanceHandle mh)     { return mh() == _memory_mgr_obj; }
   59.32  
   59.33 @@ -177,10 +178,20 @@
   59.34    GCStatInfo*  _current_gc_stat;
   59.35    int          _num_gc_threads;
   59.36    volatile bool _notification_enabled;
   59.37 +  bool         _pool_always_affected_by_gc[MemoryManager::max_num_pools];
   59.38 +
   59.39  public:
   59.40    GCMemoryManager();
   59.41    ~GCMemoryManager();
   59.42  
   59.43 +  void add_pool(MemoryPool* pool);
   59.44 +  void add_pool(MemoryPool* pool, bool always_affected_by_gc);
   59.45 +
   59.46 +  bool pool_always_affected_by_gc(int index) {
   59.47 +    assert(index >= 0 && index < num_memory_pools(), "Invalid index");
   59.48 +    return _pool_always_affected_by_gc[index];
   59.49 +  }
   59.50 +
   59.51    void   initialize_gc_stat_info();
   59.52  
   59.53    bool   is_gc_memory_manager()         { return true; }
   59.54 @@ -192,7 +203,8 @@
   59.55    void   gc_begin(bool recordGCBeginTime, bool recordPreGCUsage,
   59.56                    bool recordAccumulatedGCTime);
   59.57    void   gc_end(bool recordPostGCUsage, bool recordAccumulatedGCTime,
   59.58 -                bool recordGCEndTime, bool countCollection, GCCause::Cause cause);
   59.59 +                bool recordGCEndTime, bool countCollection, GCCause::Cause cause,
   59.60 +                bool allMemoryPoolsAffected);
   59.61  
   59.62    void        reset_gc_stat()   { _num_collections = 0; _accumulated_timer.reset(); }
   59.63  
    60.1 --- a/src/share/vm/services/memoryService.cpp	Mon Mar 04 21:10:27 2019 +0100
    60.2 +++ b/src/share/vm/services/memoryService.cpp	Mon Mar 18 08:03:04 2019 +0100
    60.3 @@ -1,5 +1,5 @@
    60.4  /*
    60.5 - * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
    60.6 + * Copyright (c) 2003, 2019, Oracle and/or its affiliates. All rights reserved.
    60.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    60.8   *
    60.9   * This code is free software; you can redistribute it and/or modify it
   60.10 @@ -187,7 +187,7 @@
   60.11    _managers_list->append(_major_gc_manager);
   60.12  
   60.13    add_g1YoungGen_memory_pool(g1h, _major_gc_manager, _minor_gc_manager);
   60.14 -  add_g1OldGen_memory_pool(g1h, _major_gc_manager);
   60.15 +  add_g1OldGen_memory_pool(g1h, _major_gc_manager, _minor_gc_manager);
   60.16  }
   60.17  #endif // INCLUDE_ALL_GCS
   60.18  
   60.19 @@ -241,8 +241,8 @@
   60.20  
   60.21  // Add memory pool(s) for one generation
   60.22  void MemoryService::add_generation_memory_pool(Generation* gen,
   60.23 -                                               MemoryManager* major_mgr,
   60.24 -                                               MemoryManager* minor_mgr) {
   60.25 +                                               GCMemoryManager* major_mgr,
   60.26 +                                               GCMemoryManager* minor_mgr) {
   60.27    guarantee(gen != NULL, "No generation for memory pool");
   60.28    Generation::Name kind = gen->kind();
   60.29    int index = _pools_list->length();
   60.30 @@ -332,7 +332,9 @@
   60.31  
   60.32  
   60.33  #if INCLUDE_ALL_GCS
   60.34 -void MemoryService::add_psYoung_memory_pool(PSYoungGen* gen, MemoryManager* major_mgr, MemoryManager* minor_mgr) {
   60.35 +void MemoryService::add_psYoung_memory_pool(PSYoungGen* gen,
   60.36 +                                            GCMemoryManager* major_mgr,
   60.37 +                                            GCMemoryManager* minor_mgr) {
   60.38    assert(major_mgr != NULL && minor_mgr != NULL, "Should have two managers");
   60.39  
   60.40    // Add a memory pool for each space and young gen doesn't
   60.41 @@ -356,7 +358,7 @@
   60.42    _pools_list->append(survivor);
   60.43  }
   60.44  
   60.45 -void MemoryService::add_psOld_memory_pool(PSOldGen* gen, MemoryManager* mgr) {
   60.46 +void MemoryService::add_psOld_memory_pool(PSOldGen* gen, GCMemoryManager* mgr) {
   60.47    PSGenerationPool* old_gen = new PSGenerationPool(gen,
   60.48                                                     "PS Old Gen",
   60.49                                                     MemoryPool::Heap,
   60.50 @@ -366,8 +368,8 @@
   60.51  }
   60.52  
   60.53  void MemoryService::add_g1YoungGen_memory_pool(G1CollectedHeap* g1h,
   60.54 -                                               MemoryManager* major_mgr,
   60.55 -                                               MemoryManager* minor_mgr) {
   60.56 +                                               GCMemoryManager* major_mgr,
   60.57 +                                               GCMemoryManager* minor_mgr) {
   60.58    assert(major_mgr != NULL && minor_mgr != NULL, "should have two managers");
   60.59  
   60.60    G1EdenPool* eden = new G1EdenPool(g1h);
   60.61 @@ -382,11 +384,13 @@
   60.62  }
   60.63  
   60.64  void MemoryService::add_g1OldGen_memory_pool(G1CollectedHeap* g1h,
   60.65 -                                             MemoryManager* mgr) {
   60.66 -  assert(mgr != NULL, "should have one manager");
   60.67 +                                             GCMemoryManager* major_mgr,
   60.68 +                                             GCMemoryManager* minor_mgr) {
   60.69 +  assert(major_mgr != NULL && minor_mgr != NULL, "should have two managers");
   60.70  
   60.71    G1OldGenPool* old_gen = new G1OldGenPool(g1h);
   60.72 -  mgr->add_pool(old_gen);
   60.73 +  major_mgr->add_pool(old_gen);
   60.74 +  minor_mgr->add_pool(old_gen, false /* always_affected_by_gc */);
   60.75    _pools_list->append(old_gen);
   60.76  }
   60.77  #endif // INCLUDE_ALL_GCS
   60.78 @@ -484,7 +488,8 @@
   60.79  void MemoryService::gc_end(bool fullGC, bool recordPostGCUsage,
   60.80                             bool recordAccumulatedGCTime,
   60.81                             bool recordGCEndTime, bool countCollection,
   60.82 -                           GCCause::Cause cause) {
   60.83 +                           GCCause::Cause cause,
   60.84 +                           bool allMemoryPoolsAffected) {
   60.85  
   60.86    GCMemoryManager* mgr;
   60.87    if (fullGC) {
   60.88 @@ -496,7 +501,7 @@
   60.89  
   60.90    // register the GC end statistics and memory usage
   60.91    mgr->gc_end(recordPostGCUsage, recordAccumulatedGCTime, recordGCEndTime,
   60.92 -              countCollection, cause);
   60.93 +              countCollection, cause, allMemoryPoolsAffected);
   60.94  }
   60.95  
   60.96  void MemoryService::oops_do(OopClosure* f) {
   60.97 @@ -573,10 +578,11 @@
   60.98    }
   60.99    // this has to be called in a stop the world pause and represent
  60.100    // an entire gc pause, start to finish:
  60.101 -  initialize(_fullGC, cause,true, true, true, true, true, true, true);
  60.102 +  initialize(_fullGC, cause, true, true, true, true, true, true, true, true);
  60.103  }
  60.104  TraceMemoryManagerStats::TraceMemoryManagerStats(bool fullGC,
  60.105                                                   GCCause::Cause cause,
  60.106 +                                                 bool allMemoryPoolsAffected,
  60.107                                                   bool recordGCBeginTime,
  60.108                                                   bool recordPreGCUsage,
  60.109                                                   bool recordPeakUsage,
  60.110 @@ -584,7 +590,8 @@
  60.111                                                   bool recordAccumulatedGCTime,
  60.112                                                   bool recordGCEndTime,
  60.113                                                   bool countCollection) {
  60.114 -    initialize(fullGC, cause, recordGCBeginTime, recordPreGCUsage, recordPeakUsage,
  60.115 +  initialize(fullGC, cause, allMemoryPoolsAffected,
  60.116 +             recordGCBeginTime, recordPreGCUsage, recordPeakUsage,
  60.117               recordPostGCUsage, recordAccumulatedGCTime, recordGCEndTime,
  60.118               countCollection);
  60.119  }
  60.120 @@ -593,6 +600,7 @@
  60.121  // the MemoryService
  60.122  void TraceMemoryManagerStats::initialize(bool fullGC,
  60.123                                           GCCause::Cause cause,
  60.124 +                                         bool allMemoryPoolsAffected,
  60.125                                           bool recordGCBeginTime,
  60.126                                           bool recordPreGCUsage,
  60.127                                           bool recordPeakUsage,
  60.128 @@ -601,6 +609,7 @@
  60.129                                           bool recordGCEndTime,
  60.130                                           bool countCollection) {
  60.131    _fullGC = fullGC;
  60.132 +  _allMemoryPoolsAffected = allMemoryPoolsAffected;
  60.133    _recordGCBeginTime = recordGCBeginTime;
  60.134    _recordPreGCUsage = recordPreGCUsage;
  60.135    _recordPeakUsage = recordPeakUsage;
  60.136 @@ -616,5 +625,5 @@
  60.137  
  60.138  TraceMemoryManagerStats::~TraceMemoryManagerStats() {
  60.139    MemoryService::gc_end(_fullGC, _recordPostGCUsage, _recordAccumulatedGCTime,
  60.140 -                        _recordGCEndTime, _countCollection, _cause);
  60.141 +                        _recordGCEndTime, _countCollection, _cause, _allMemoryPoolsAffected);
  60.142  }
    61.1 --- a/src/share/vm/services/memoryService.hpp	Mon Mar 04 21:10:27 2019 +0100
    61.2 +++ b/src/share/vm/services/memoryService.hpp	Mon Mar 18 08:03:04 2019 +0100
    61.3 @@ -1,5 +1,5 @@
    61.4  /*
    61.5 - * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
    61.6 + * Copyright (c) 2003, 2019, Oracle and/or its affiliates. All rights reserved.
    61.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    61.8   *
    61.9   * This code is free software; you can redistribute it and/or modify it
   61.10 @@ -77,25 +77,26 @@
   61.11    static MemoryPool*                    _compressed_class_pool;
   61.12  
   61.13    static void add_generation_memory_pool(Generation* gen,
   61.14 -                                         MemoryManager* major_mgr,
   61.15 -                                         MemoryManager* minor_mgr);
   61.16 +                                         GCMemoryManager* major_mgr,
   61.17 +                                         GCMemoryManager* minor_mgr);
   61.18    static void add_generation_memory_pool(Generation* gen,
   61.19 -                                         MemoryManager* major_mgr) {
   61.20 +                                         GCMemoryManager* major_mgr) {
   61.21      add_generation_memory_pool(gen, major_mgr, NULL);
   61.22    }
   61.23  
   61.24  
   61.25    static void add_psYoung_memory_pool(PSYoungGen* gen,
   61.26 -                                      MemoryManager* major_mgr,
   61.27 -                                      MemoryManager* minor_mgr);
   61.28 +                                      GCMemoryManager* major_mgr,
   61.29 +                                      GCMemoryManager* minor_mgr);
   61.30    static void add_psOld_memory_pool(PSOldGen* gen,
   61.31 -                                    MemoryManager* mgr);
   61.32 +                                    GCMemoryManager* mgr);
   61.33  
   61.34    static void add_g1YoungGen_memory_pool(G1CollectedHeap* g1h,
   61.35 -                                         MemoryManager* major_mgr,
   61.36 -                                         MemoryManager* minor_mgr);
   61.37 +                                         GCMemoryManager* major_mgr,
   61.38 +                                         GCMemoryManager* minor_mgr);
   61.39    static void add_g1OldGen_memory_pool(G1CollectedHeap* g1h,
   61.40 -                                       MemoryManager* mgr);
   61.41 +                                       GCMemoryManager* major_mgr,
   61.42 +                                       GCMemoryManager* minor_mgr);
   61.43  
   61.44    static MemoryPool* add_space(ContiguousSpace* space,
   61.45                                 const char* name,
   61.46 @@ -162,7 +163,8 @@
   61.47    static void gc_end(bool fullGC, bool recordPostGCUsage,
   61.48                       bool recordAccumulatedGCTime,
   61.49                       bool recordGCEndTime, bool countCollection,
   61.50 -                     GCCause::Cause cause);
   61.51 +                     GCCause::Cause cause,
   61.52 +                     bool allMemoryPoolsAffected);
   61.53  
   61.54  
   61.55    static void oops_do(OopClosure* f);
   61.56 @@ -185,6 +187,7 @@
   61.57  class TraceMemoryManagerStats : public StackObj {
   61.58  private:
   61.59    bool         _fullGC;
   61.60 +  bool         _allMemoryPoolsAffected;
   61.61    bool         _recordGCBeginTime;
   61.62    bool         _recordPreGCUsage;
   61.63    bool         _recordPeakUsage;
   61.64 @@ -197,6 +200,7 @@
   61.65    TraceMemoryManagerStats() {}
   61.66    TraceMemoryManagerStats(bool fullGC,
   61.67                            GCCause::Cause cause,
   61.68 +                          bool allMemoryPoolsAffected = true,
   61.69                            bool recordGCBeginTime = true,
   61.70                            bool recordPreGCUsage = true,
   61.71                            bool recordPeakUsage = true,
   61.72 @@ -207,6 +211,7 @@
   61.73  
   61.74    void initialize(bool fullGC,
   61.75                    GCCause::Cause cause,
   61.76 +                  bool allMemoryPoolsAffected,
   61.77                    bool recordGCBeginTime,
   61.78                    bool recordPreGCUsage,
   61.79                    bool recordPeakUsage,
    62.1 --- a/src/share/vm/utilities/bitMap.cpp	Mon Mar 04 21:10:27 2019 +0100
    62.2 +++ b/src/share/vm/utilities/bitMap.cpp	Mon Mar 18 08:03:04 2019 +0100
    62.3 @@ -154,14 +154,24 @@
    62.4    }
    62.5  }
    62.6  
    62.7 +bool BitMap::is_small_range_of_words(idx_t beg_full_word, idx_t end_full_word) {
    62.8 +  // There is little point to call large version on small ranges.
    62.9 +  // Need to check carefully, keeping potential idx_t underflow in mind.
   62.10 +  // The threshold should be at least one word.
   62.11 +  STATIC_ASSERT(small_range_words >= 1);
   62.12 +  return (beg_full_word + small_range_words >= end_full_word);
   62.13 +}
   62.14 +
   62.15  void BitMap::set_large_range(idx_t beg, idx_t end) {
   62.16    verify_range(beg, end);
   62.17  
   62.18    idx_t beg_full_word = word_index_round_up(beg);
   62.19    idx_t end_full_word = word_index(end);
   62.20  
   62.21 -  assert(end_full_word - beg_full_word >= 32,
   62.22 -         "the range must include at least 32 bytes");
   62.23 +  if (is_small_range_of_words(beg_full_word, end_full_word)) {
   62.24 +    set_range(beg, end);
   62.25 +    return;
   62.26 +  }
   62.27  
   62.28    // The range includes at least one full word.
   62.29    set_range_within_word(beg, bit_index(beg_full_word));
   62.30 @@ -175,8 +185,10 @@
   62.31    idx_t beg_full_word = word_index_round_up(beg);
   62.32    idx_t end_full_word = word_index(end);
   62.33  
   62.34 -  assert(end_full_word - beg_full_word >= 32,
   62.35 -         "the range must include at least 32 bytes");
   62.36 +  if (is_small_range_of_words(beg_full_word, end_full_word)) {
   62.37 +    clear_range(beg, end);
   62.38 +    return;
   62.39 +  }
   62.40  
   62.41    // The range includes at least one full word.
   62.42    clear_range_within_word(beg, bit_index(beg_full_word));
   62.43 @@ -264,8 +276,10 @@
   62.44    idx_t beg_full_word = word_index_round_up(beg);
   62.45    idx_t end_full_word = word_index(end);
   62.46  
   62.47 -  assert(end_full_word - beg_full_word >= 32,
   62.48 -         "the range must include at least 32 bytes");
   62.49 +  if (is_small_range_of_words(beg_full_word, end_full_word)) {
   62.50 +    par_at_put_range(beg, end, value);
   62.51 +    return;
   62.52 +  }
   62.53  
   62.54    // The range includes at least one full word.
   62.55    par_put_range_within_word(beg, bit_index(beg_full_word), value);
    63.1 --- a/src/share/vm/utilities/bitMap.hpp	Mon Mar 04 21:10:27 2019 +0100
    63.2 +++ b/src/share/vm/utilities/bitMap.hpp	Mon Mar 18 08:03:04 2019 +0100
    63.3 @@ -56,6 +56,10 @@
    63.4    // the bitmap appropriately if needed using factor-of-two expansion.
    63.5    void at_put_grow(idx_t index, bool value);
    63.6  
    63.7 +  // Threshold for performing small range operation, even when large range
    63.8 +  // operation was requested. Measured in words.
    63.9 +  static const size_t small_range_words = 32;
   63.10 +
   63.11   protected:
   63.12    // Return the position of bit within the word that contains it (e.g., if
   63.13    // bitmap words are 32 bits, return a number 0 <= n <= 31).
   63.14 @@ -97,6 +101,8 @@
   63.15    void      set_large_range_of_words   (idx_t beg, idx_t end);
   63.16    void      clear_large_range_of_words (idx_t beg, idx_t end);
   63.17  
   63.18 +  static bool is_small_range_of_words(idx_t beg_full_word, idx_t end_full_word);
   63.19 +
   63.20    // The index of the first full word in a range.
   63.21    idx_t word_index_round_up(idx_t bit) const;
   63.22  
    64.1 --- a/src/share/vm/utilities/bitMap.inline.hpp	Mon Mar 04 21:10:27 2019 +0100
    64.2 +++ b/src/share/vm/utilities/bitMap.inline.hpp	Mon Mar 18 08:03:04 2019 +0100
    64.3 @@ -321,10 +321,12 @@
    64.4  }
    64.5  
    64.6  inline void BitMap::set_large_range_of_words(idx_t beg, idx_t end) {
    64.7 +  assert(beg <= end, "underflow");
    64.8    memset(_map + beg, ~(unsigned char)0, (end - beg) * sizeof(uintptr_t));
    64.9  }
   64.10  
   64.11  inline void BitMap::clear_large_range_of_words(idx_t beg, idx_t end) {
   64.12 +  assert(beg <= end, "underflow");
   64.13    memset(_map + beg, 0, (end - beg) * sizeof(uintptr_t));
   64.14  }
   64.15  
    65.1 --- a/src/share/vm/utilities/globalDefinitions.hpp	Mon Mar 04 21:10:27 2019 +0100
    65.2 +++ b/src/share/vm/utilities/globalDefinitions.hpp	Mon Mar 18 08:03:04 2019 +0100
    65.3 @@ -1136,10 +1136,10 @@
    65.4  
    65.5  //* largest i such that 2^i <= x
    65.6  //  A negative value of 'x' will return '31'
    65.7 -inline int log2_intptr(intptr_t x) {
    65.8 +inline int log2_intptr(uintptr_t x) {
    65.9    int i = -1;
   65.10    uintptr_t p =  1;
   65.11 -  while (p != 0 && p <= (uintptr_t)x) {
   65.12 +  while (p != 0 && p <= x) {
   65.13      // p = 2^(i+1) && p <= x (i.e., 2^(i+1) <= x)
   65.14      i++; p *= 2;
   65.15    }
   65.16 @@ -1149,11 +1149,10 @@
   65.17  }
   65.18  
   65.19  //* largest i such that 2^i <= x
   65.20 -//  A negative value of 'x' will return '63'
   65.21 -inline int log2_long(jlong x) {
   65.22 +inline int log2_long(julong x) {
   65.23    int i = -1;
   65.24    julong p =  1;
   65.25 -  while (p != 0 && p <= (julong)x) {
   65.26 +  while (p != 0 && p <= x) {
   65.27      // p = 2^(i+1) && p <= x (i.e., 2^(i+1) <= x)
   65.28      i++; p *= 2;
   65.29    }
   65.30 @@ -1162,6 +1161,27 @@
   65.31    return i;
   65.32  }
   65.33  
   65.34 +inline int log2_intptr(intptr_t x) {
   65.35 +  return log2_intptr((uintptr_t)x);
   65.36 +}
   65.37 +
   65.38 +inline int log2_int(int x) {
   65.39 +  return log2_intptr((uintptr_t)x);
   65.40 +}
   65.41 +
   65.42 +inline int log2_jint(jint x) {
   65.43 +  return log2_intptr((uintptr_t)x);
   65.44 +}
   65.45 +
   65.46 +inline int log2_uint(uint x) {
   65.47 +  return log2_intptr((uintptr_t)x);
   65.48 +}
   65.49 +
   65.50 +//  A negative value of 'x' will return '63'
   65.51 +inline int log2_jlong(jlong x) {
   65.52 +  return log2_long((julong)x);
   65.53 +}
   65.54 +
   65.55  //* the argument must be exactly a power of 2
   65.56  inline int exact_log2(intptr_t x) {
   65.57    #ifdef ASSERT
   65.58 @@ -1201,6 +1221,29 @@
   65.59  inline bool is_odd (intx x) { return x & 1;      }
   65.60  inline bool is_even(intx x) { return !is_odd(x); }
   65.61  
   65.62 +// abs methods which cannot overflow and so are well-defined across
   65.63 +// the entire domain of integer types.
   65.64 +static inline unsigned int uabs(unsigned int n) {
   65.65 +  union {
   65.66 +    unsigned int result;
   65.67 +    int value;
   65.68 +  };
   65.69 +  result = n;
   65.70 +  if (value < 0) result = 0-result;
   65.71 +  return result;
   65.72 +}
   65.73 +static inline julong uabs(julong n) {
   65.74 +  union {
   65.75 +    julong result;
   65.76 +    jlong value;
   65.77 +  };
   65.78 +  result = n;
   65.79 +  if (value < 0) result = 0-result;
   65.80 +  return result;
   65.81 +}
   65.82 +static inline julong uabs(jlong n) { return uabs((julong)n); }
   65.83 +static inline unsigned int uabs(int n) { return uabs((unsigned int)n); }
   65.84 +
   65.85  // "to" should be greater than "from."
   65.86  inline intx byte_size(void* from, void* to) {
   65.87    return (address)to - (address)from;
   65.88 @@ -1403,6 +1446,32 @@
   65.89  
   65.90  #define ARRAY_SIZE(array) (sizeof(array)/sizeof((array)[0]))
   65.91  
   65.92 +//----------------------------------------------------------------------------------------------------
   65.93 +// Sum and product which can never overflow: they wrap, just like the
   65.94 +// Java operations.  Note that we don't intend these to be used for
   65.95 +// general-purpose arithmetic: their purpose is to emulate Java
   65.96 +// operations.
   65.97 +
   65.98 +// The goal of this code to avoid undefined or implementation-defined
   65.99 +// behaviour.  The use of an lvalue to reference cast is explicitly
  65.100 +// permitted by Lvalues and rvalues [basic.lval].  [Section 3.10 Para
  65.101 +// 15 in C++03]
  65.102 +#define JAVA_INTEGER_OP(OP, NAME, TYPE, UNSIGNED_TYPE)  \
  65.103 +inline TYPE NAME (TYPE in1, TYPE in2) {                 \
  65.104 +  UNSIGNED_TYPE ures = static_cast<UNSIGNED_TYPE>(in1); \
  65.105 +  ures OP ## = static_cast<UNSIGNED_TYPE>(in2);         \
  65.106 +  return reinterpret_cast<TYPE&>(ures);                 \
  65.107 +}
  65.108 +
  65.109 +JAVA_INTEGER_OP(+, java_add, jint, juint)
  65.110 +JAVA_INTEGER_OP(-, java_subtract, jint, juint)
  65.111 +JAVA_INTEGER_OP(*, java_multiply, jint, juint)
  65.112 +JAVA_INTEGER_OP(+, java_add, jlong, julong)
  65.113 +JAVA_INTEGER_OP(-, java_subtract, jlong, julong)
  65.114 +JAVA_INTEGER_OP(*, java_multiply, jlong, julong)
  65.115 +
  65.116 +#undef JAVA_INTEGER_OP
  65.117 +
  65.118  // Dereference vptr
  65.119  // All C++ compilers that we know of have the vtbl pointer in the first
  65.120  // word.  If there are exceptions, this function needs to be made compiler
    66.1 --- a/src/share/vm/utilities/hashtable.cpp	Mon Mar 04 21:10:27 2019 +0100
    66.2 +++ b/src/share/vm/utilities/hashtable.cpp	Mon Mar 18 08:03:04 2019 +0100
    66.3 @@ -55,7 +55,7 @@
    66.4      if (_first_free_entry + _entry_size >= _end_block) {
    66.5        int block_size = MIN2(512, MAX2((int)_table_size / 2, (int)_number_of_entries));
    66.6        int len = _entry_size * block_size;
    66.7 -      len = 1 << log2_intptr(len); // round down to power of 2
    66.8 +      len = 1 << log2_int(len); // round down to power of 2
    66.9        assert(len >= _entry_size, "");
   66.10        _first_free_entry = NEW_C_HEAP_ARRAY2(char, len, F, CURRENT_PC);
   66.11        _end_block = _first_free_entry + len;
    67.1 --- a/src/share/vm/utilities/vmError.cpp	Mon Mar 04 21:10:27 2019 +0100
    67.2 +++ b/src/share/vm/utilities/vmError.cpp	Mon Mar 18 08:03:04 2019 +0100
    67.3 @@ -1,5 +1,5 @@
    67.4  /*
    67.5 - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved.
    67.6 + * Copyright (c) 2003, 2019, Oracle and/or its affiliates. All rights reserved.
    67.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    67.8   *
    67.9   * This code is free software; you can redistribute it and/or modify it
   67.10 @@ -1060,7 +1060,7 @@
   67.11        out.print_raw   (cmd);
   67.12        out.print_raw_cr("\" ...");
   67.13  
   67.14 -      if (os::fork_and_exec(cmd) < 0) {
   67.15 +      if (os::fork_and_exec(cmd, true) < 0) {
   67.16          out.print_cr("os::fork_and_exec failed: %s (%d)", strerror(errno), errno);
   67.17        }
   67.18      }
    68.1 --- a/test/Makefile	Mon Mar 04 21:10:27 2019 +0100
    68.2 +++ b/test/Makefile	Mon Mar 18 08:03:04 2019 +0100
    68.3 @@ -262,6 +262,8 @@
    68.4  # Default JTREG to run
    68.5  JTREG = $(JT_HOME)/bin/jtreg
    68.6  
    68.7 +# Use agent mode
    68.8 +JTREG_BASIC_OPTIONS += -agentvm
    68.9  # Only run automatic tests
   68.10  JTREG_BASIC_OPTIONS += -a
   68.11  # Report details on all failed or error tests, times too
    69.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    69.2 +++ b/test/compiler/integerArithmetic/MultiplyByConstantLongMax.java	Mon Mar 18 08:03:04 2019 +0100
    69.3 @@ -0,0 +1,45 @@
    69.4 +/*
    69.5 + * Copyright (c) 2018, Red Hat, Inc. All rights reserved.
    69.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    69.7 + *
    69.8 + * This code is free software; you can redistribute it and/or modify it
    69.9 + * under the terms of the GNU General Public License version 2 only, as
   69.10 + * published by the Free Software Foundation.
   69.11 + *
   69.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
   69.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   69.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   69.15 + * version 2 for more details (a copy is included in the LICENSE file that
   69.16 + * accompanied this code).
   69.17 + *
   69.18 + * You should have received a copy of the GNU General Public License version
   69.19 + * 2 along with this work; if not, write to the Free Software Foundation,
   69.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   69.21 + *
   69.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   69.23 + * or visit www.oracle.com if you need additional information or have any
   69.24 + * questions.
   69.25 + */
   69.26 +
   69.27 +/**
   69.28 + * @test
   69.29 + * @bug 8214189
   69.30 + * @summary test/hotspot/jtreg/compiler/intrinsics/mathexact/MulExactLConstantTest.java fails on Windows x64 when run with -XX:-TieredCompilation
   69.31 + *
   69.32 + * @run main/othervm -XX:-TieredCompilation -XX:-BackgroundCompilation -XX:-UseOnStackReplacement MultiplyByConstantLongMax
   69.33 + *
   69.34 + */
   69.35 +
   69.36 +public class MultiplyByConstantLongMax {
   69.37 +    public static void main(String[] args) {
   69.38 +        for (int i = 0; i < 20_000; i++) {
   69.39 +            if (test(1) != Long.MAX_VALUE) {
   69.40 +                throw new RuntimeException("incorrect result");
   69.41 +            }
   69.42 +        }
   69.43 +    }
   69.44 +
   69.45 +    private static long test(long v) {
   69.46 +        return v * Long.MAX_VALUE;
   69.47 +    }
   69.48 +}
    70.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    70.2 +++ b/test/compiler/integerArithmetic/MultiplyByIntegerMinHang.java	Mon Mar 18 08:03:04 2019 +0100
    70.3 @@ -0,0 +1,64 @@
    70.4 +/*
    70.5 + * Copyright (c) 2018, Red Hat, Inc. 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 + * @test
   70.29 + * @bug 8213419
   70.30 + * @summary C2 may hang in MulLNode::Ideal()/MulINode::Ideal() with gcc 8.2.1
   70.31 + *
   70.32 + * @run main/othervm -XX:-TieredCompilation -XX:-BackgroundCompilation -XX:-UseOnStackReplacement MultiplyByIntegerMinHang
   70.33 + *
   70.34 + */
   70.35 +
   70.36 +public class MultiplyByIntegerMinHang {
   70.37 +    public static void main(String[] args) {
   70.38 +        for (int i = 0; i < 20_000; i++) {
   70.39 +            if (test1(0) != 0) {
   70.40 +                throw new RuntimeException("incorrect result");
   70.41 +            }
   70.42 +            if (test1(1) != Integer.MIN_VALUE) {
   70.43 +                throw new RuntimeException("incorrect result");
   70.44 +            }
   70.45 +            if (test1(2) != 0) {
   70.46 +                throw new RuntimeException("incorrect result");
   70.47 +            }
   70.48 +            if (test2(0) != 0) {
   70.49 +                throw new RuntimeException("incorrect result");
   70.50 +            }
   70.51 +            if (test2(1) != Long.MIN_VALUE) {
   70.52 +                throw new RuntimeException("incorrect result");
   70.53 +            }
   70.54 +            if (test2(2) != 0) {
   70.55 +                throw new RuntimeException("incorrect result");
   70.56 +            }
   70.57 +        }
   70.58 +    }
   70.59 +
   70.60 +    private static int test1(int v) {
   70.61 +        return v * Integer.MIN_VALUE;
   70.62 +    }
   70.63 +
   70.64 +    private static long test2(long v) {
   70.65 +        return v * Long.MIN_VALUE;
   70.66 +    }
   70.67 +}
    71.1 --- a/test/compiler/jsr292/RedefineMethodUsedByMultipleMethodHandles.java	Mon Mar 04 21:10:27 2019 +0100
    71.2 +++ b/test/compiler/jsr292/RedefineMethodUsedByMultipleMethodHandles.java	Mon Mar 18 08:03:04 2019 +0100
    71.3 @@ -26,7 +26,7 @@
    71.4   * @bug 8042235
    71.5   * @summary redefining method used by multiple MethodHandles crashes VM
    71.6   * @compile -XDignore.symbol.file RedefineMethodUsedByMultipleMethodHandles.java
    71.7 - * @run main RedefineMethodUsedByMultipleMethodHandles
    71.8 + * @run main/othervm RedefineMethodUsedByMultipleMethodHandles
    71.9   */
   71.10  
   71.11  import java.io.*;
    72.1 --- a/test/compiler/rtm/locking/TestRTMTotalCountIncrRate.java	Mon Mar 04 21:10:27 2019 +0100
    72.2 +++ b/test/compiler/rtm/locking/TestRTMTotalCountIncrRate.java	Mon Mar 18 08:03:04 2019 +0100
    72.3 @@ -1,5 +1,5 @@
    72.4  /*
    72.5 - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
    72.6 + * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
    72.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    72.8   *
    72.9   * This code is free software; you can redistribute it and/or modify it
   72.10 @@ -34,6 +34,7 @@
   72.11   *                   -XX:+WhiteBoxAPI TestRTMTotalCountIncrRate
   72.12   */
   72.13  
   72.14 +import sun.misc.Unsafe;
   72.15  import java.util.List;
   72.16  
   72.17  import com.oracle.java.testlibrary.*;
   72.18 @@ -96,14 +97,12 @@
   72.19              Asserts.assertEQ(lock.getTotalLocks(), Test.TOTAL_ITERATIONS,
   72.20                      "Total locks should be exactly the same as amount of "
   72.21                      + "iterations.");
   72.22 -        } else {
   72.23 -            Asserts.assertGT(lock.getTotalLocks(), 0L, "RTM statistics "
   72.24 -                    + "should contain information for at least on lock.");
   72.25          }
   72.26      }
   72.27  
   72.28      public static class Test implements CompilableTest {
   72.29          private static final long TOTAL_ITERATIONS = 10000L;
   72.30 +        private static final Unsafe UNSAFE = Utils.getUnsafe();
   72.31          private final Object monitor = new Object();
   72.32          // Following field have to be static in order to avoid escape analysis.
   72.33          @SuppressWarnings("UnsuedDeclaration")
   72.34 @@ -119,8 +118,17 @@
   72.35              return new String[] { getMethodWithLockName() };
   72.36          }
   72.37  
   72.38 -        public void lock() {
   72.39 +        public void lock(boolean forceAbort) {
   72.40              synchronized(monitor) {
   72.41 +                if (forceAbort) {
   72.42 +                    // We're calling native method in order to force
   72.43 +                    // abort. It's done by explicit xabort call emitted
   72.44 +                    // in SharedRuntime::generate_native_wrapper.
   72.45 +                    // If an actual JNI call will be replaced by
   72.46 +                    // intrinsic - we'll be in trouble, since xabort
   72.47 +                    // will be no longer called and test may fail.
   72.48 +                    UNSAFE.addressSize();
   72.49 +                }
   72.50                  Test.field++;
   72.51              }
   72.52          }
   72.53 @@ -139,7 +147,11 @@
   72.54              for (long i = 0L; i < Test.TOTAL_ITERATIONS; i++) {
   72.55                  AbortProvoker.verifyMonitorState(test.monitor,
   72.56                          shouldBeInflated);
   72.57 -                test.lock();
   72.58 +                // Force abort on first iteration to avoid rare case when
   72.59 +                // there were no aborts and locks count was not incremented
   72.60 +                // with RTMTotalCountIncrRate > 1 (in such case JVM won't
   72.61 +                // print JVM locking statistics).
   72.62 +                test.lock(i == 0);
   72.63              }
   72.64          }
   72.65      }
    73.1 --- a/test/compiler/rtm/print/TestPrintPreciseRTMLockingStatistics.java	Mon Mar 04 21:10:27 2019 +0100
    73.2 +++ b/test/compiler/rtm/print/TestPrintPreciseRTMLockingStatistics.java	Mon Mar 18 08:03:04 2019 +0100
    73.3 @@ -124,9 +124,6 @@
    73.4  
    73.5          RTMLockingStatistics lock = statistics.get(0);
    73.6  
    73.7 -        Asserts.assertGT(lock.getTotalLocks(), 0L, "RTM locking statistics "
    73.8 -                + "should contain non zero total locks count");
    73.9 -
   73.10          Asserts.assertGT(lock.getTotalAborts(), 0L,
   73.11                  "RTM locking statistics should contain non zero total aborts "
   73.12                  + "count");
    74.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    74.2 +++ b/test/gc/TestMemoryMXBeansAndPoolsPresence.java	Mon Mar 18 08:03:04 2019 +0100
    74.3 @@ -0,0 +1,101 @@
    74.4 +/*
    74.5 + * Copyright (c) 2017, 2019, Oracle and/or its affiliates. All rights reserved.
    74.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    74.7 + *
    74.8 + * This code is free software; you can redistribute it and/or modify it
    74.9 + * under the terms of the GNU General Public License version 2 only, as
   74.10 + * published by the Free Software Foundation.
   74.11 + *
   74.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
   74.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   74.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   74.15 + * version 2 for more details (a copy is included in the LICENSE file that
   74.16 + * accompanied this code).
   74.17 + *
   74.18 + * You should have received a copy of the GNU General Public License version
   74.19 + * 2 along with this work; if not, write to the Free Software Foundation,
   74.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   74.21 + *
   74.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   74.23 + * or visit www.oracle.com if you need additional information or have any
   74.24 + * questions.
   74.25 + */
   74.26 +
   74.27 +/* @test TestMemoryMXBeansAndPoolsPresence
   74.28 + * @key gc
   74.29 + * @bug 8191564
   74.30 + * @summary Tests that GarbageCollectorMXBeans and GC MemoryPools are created.
   74.31 + * @library /testlibrary
   74.32 + * @requires vm.gc == null
   74.33 + * @run main/othervm -XX:+UseParallelGC TestMemoryMXBeansAndPoolsPresence Parallel
   74.34 + * @run main/othervm -XX:+UseSerialGC TestMemoryMXBeansAndPoolsPresence Serial
   74.35 + * @run main/othervm -XX:+UseConcMarkSweepGC TestMemoryMXBeansAndPoolsPresence CMS
   74.36 + * @run main/othervm -XX:+UseG1GC TestMemoryMXBeansAndPoolsPresence G1
   74.37 + */
   74.38 +
   74.39 +import java.util.List;
   74.40 +import java.util.ArrayList;
   74.41 +import java.lang.management.*;
   74.42 +import java.util.stream.*;
   74.43 +
   74.44 +import com.oracle.java.testlibrary.Asserts;
   74.45 +
   74.46 +class GCBeanDescription {
   74.47 +    public String name;
   74.48 +    public String[] poolNames;
   74.49 +
   74.50 +    public GCBeanDescription(String name, String[] poolNames) {
   74.51 +        this.name = name;
   74.52 +        this.poolNames = poolNames;
   74.53 +    }
   74.54 +}
   74.55 +
   74.56 +public class TestMemoryMXBeansAndPoolsPresence {
   74.57 +    public static void test(GCBeanDescription... expectedBeans) {
   74.58 +        List<MemoryPoolMXBean> memoryPools = ManagementFactory.getMemoryPoolMXBeans();
   74.59 +
   74.60 +        List<GarbageCollectorMXBean> gcBeans = ManagementFactory.getGarbageCollectorMXBeans();
   74.61 +        Asserts.assertEQ(expectedBeans.length, gcBeans.size());
   74.62 +
   74.63 +        for (GCBeanDescription desc : expectedBeans) {
   74.64 +            List<GarbageCollectorMXBean> beans = gcBeans.stream()
   74.65 +                                                        .filter(b -> b.getName().equals(desc.name))
   74.66 +                                                        .collect(Collectors.toList());
   74.67 +            Asserts.assertEQ(beans.size(), 1);
   74.68 +
   74.69 +            GarbageCollectorMXBean bean = beans.get(0);
   74.70 +            Asserts.assertEQ(desc.name, bean.getName());
   74.71 +
   74.72 +            String[] pools = bean.getMemoryPoolNames();
   74.73 +            Asserts.assertEQ(desc.poolNames.length, pools.length);
   74.74 +            for (int i = 0; i < desc.poolNames.length; i++) {
   74.75 +                Asserts.assertEQ(desc.poolNames[i], pools[i]);
   74.76 +            }
   74.77 +        }
   74.78 +    }
   74.79 +
   74.80 +    public static void main(String[] args) {
   74.81 +        switch (args[0]) {
   74.82 +            case "G1":
   74.83 +                test(new GCBeanDescription("G1 Young Generation", new String[] {"G1 Eden Space", "G1 Survivor Space", "G1 Old Gen"}),
   74.84 +                     new GCBeanDescription("G1 Old Generation",   new String[] {"G1 Eden Space", "G1 Survivor Space", "G1 Old Gen"}));
   74.85 +                break;
   74.86 +            case "CMS":
   74.87 +                test(new GCBeanDescription("ParNew",              new String[] {"Par Eden Space", "Par Survivor Space"}),
   74.88 +                     new GCBeanDescription("ConcurrentMarkSweep", new String[] {"Par Eden Space", "Par Survivor Space", "CMS Old Gen"}));
   74.89 +                break;
   74.90 +            case "Parallel":
   74.91 +                test(new GCBeanDescription("PS Scavenge",         new String[] {"PS Eden Space", "PS Survivor Space"}),
   74.92 +                     new GCBeanDescription("PS MarkSweep",        new String[] {"PS Eden Space", "PS Survivor Space", "PS Old Gen"}));
   74.93 +                break;
   74.94 +            case "Serial":
   74.95 +                test(new GCBeanDescription("Copy",              new String[] {"Eden Space", "Survivor Space"}),
   74.96 +                     new GCBeanDescription("MarkSweepCompact",  new String[] {"Eden Space", "Survivor Space", "Tenured Gen"}));
   74.97 +                break;
   74.98 +            default:
   74.99 +                Asserts.assertTrue(false);
  74.100 +                break;
  74.101 +
  74.102 +        }
  74.103 +    }
  74.104 +}
    75.1 --- a/test/gc/arguments/TestG1HeapRegionSize.java	Mon Mar 04 21:10:27 2019 +0100
    75.2 +++ b/test/gc/arguments/TestG1HeapRegionSize.java	Mon Mar 18 08:03:04 2019 +0100
    75.3 @@ -1,5 +1,5 @@
    75.4  /*
    75.5 -* Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
    75.6 +* Copyright (c) 2013, 2018, Oracle and/or its affiliates. All rights reserved.
    75.7  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    75.8  *
    75.9  * This code is free software; you can redistribute it and/or modify it
   75.10 @@ -25,12 +25,11 @@
   75.11   * @test TestG1HeapRegionSize
   75.12   * @key gc
   75.13   * @bug 8021879
   75.14 - * @requires vm.gc=="G1" | vm.gc=="null"
   75.15   * @summary Verify that the flag G1HeapRegionSize is updated properly
   75.16   * @run main/othervm -Xmx64m TestG1HeapRegionSize 1048576
   75.17 - * @run main/othervm -XX:G1HeapRegionSize=2m -Xmx64m -XX:+UseG1GC TestG1HeapRegionSize 2097152
   75.18 - * @run main/othervm -XX:G1HeapRegionSize=3m -Xmx64m -XX:+UseG1GC TestG1HeapRegionSize 2097152
   75.19 - * @run main/othervm -XX:G1HeapRegionSize=64m -Xmx256m -XX:+UseG1GC TestG1HeapRegionSize 33554432
   75.20 + * @run main/othervm -XX:G1HeapRegionSize=2m -Xmx64m TestG1HeapRegionSize 2097152
   75.21 + * @run main/othervm -XX:G1HeapRegionSize=3m -Xmx64m TestG1HeapRegionSize 2097152
   75.22 + * @run main/othervm -XX:G1HeapRegionSize=64m -Xmx256m TestG1HeapRegionSize 33554432
   75.23   */
   75.24  
   75.25  import sun.management.ManagementFactoryHelper;
   75.26 @@ -43,7 +42,13 @@
   75.27      HotSpotDiagnosticMXBean diagnostic = ManagementFactoryHelper.getDiagnosticMXBean();
   75.28  
   75.29      String expectedValue = getExpectedValue(args);
   75.30 -    VMOption option = diagnostic.getVMOption("G1HeapRegionSize");
   75.31 +    VMOption option = diagnostic.getVMOption("UseG1GC");
   75.32 +    if (option.getValue().equals("false")) {
   75.33 +      System.out.println("Skipping this test. It is only a G1 test.");
   75.34 +      return;
   75.35 +    }
   75.36 +
   75.37 +    option = diagnostic.getVMOption("G1HeapRegionSize");
   75.38      if (!expectedValue.equals(option.getValue())) {
   75.39        throw new RuntimeException("Wrong value for G1HeapRegionSize. Expected " + expectedValue + " but got " + option.getValue());
   75.40      }
    76.1 --- a/test/gc/arguments/TestMaxHeapSizeTools.java	Mon Mar 04 21:10:27 2019 +0100
    76.2 +++ b/test/gc/arguments/TestMaxHeapSizeTools.java	Mon Mar 18 08:03:04 2019 +0100
    76.3 @@ -41,8 +41,8 @@
    76.4    public long initialHeapSize;
    76.5    public long maxHeapSize;
    76.6  
    76.7 -  public long minAlignment;
    76.8 -  public long maxAlignment;
    76.9 +  public long spaceAlignment;
   76.10 +  public long heapAlignment;
   76.11  }
   76.12  
   76.13  class TestMaxHeapSizeTools {
   76.14 @@ -192,7 +192,7 @@
   76.15      // Unfortunately there is no other way to retrieve the minimum heap size and
   76.16      // the alignments.
   76.17  
   76.18 -    Matcher m = Pattern.compile("Minimum heap \\d+ Initial heap \\d+ Maximum heap \\d+ Min alignment \\d+ Max alignment \\d+").
   76.19 +    Matcher m = Pattern.compile("Minimum heap \\d+ Initial heap \\d+ Maximum heap \\d+ Space alignment \\d+ Heap alignment \\d+").
   76.20        matcher(output.getStdout());
   76.21      if (!m.find()) {
   76.22        throw new RuntimeException("Could not find heap size string.");
   76.23 @@ -204,8 +204,8 @@
   76.24      val.minHeapSize = valueAfter(match, "Minimum heap ");
   76.25      val.initialHeapSize = valueAfter(match, "Initial heap ");
   76.26      val.maxHeapSize = valueAfter(match, "Maximum heap ");
   76.27 -    val.minAlignment = valueAfter(match, "Min alignment ");
   76.28 -    val.maxAlignment = valueAfter(match, "Max alignment ");
   76.29 +    val.spaceAlignment = valueAfter(match, "Space alignment ");
   76.30 +    val.heapAlignment = valueAfter(match, "Heap alignment ");
   76.31    }
   76.32  
   76.33    /**
   76.34 @@ -218,12 +218,12 @@
   76.35      MinInitialMaxValues v = new MinInitialMaxValues();
   76.36      getMinInitialMaxHeap(args, v);
   76.37  
   76.38 -    if ((expectedMin != -1) && (align_up(expectedMin, v.minAlignment) != v.minHeapSize)) {
   76.39 +    if ((expectedMin != -1) && (align_up(expectedMin, v.heapAlignment) != v.minHeapSize)) {
   76.40        throw new RuntimeException("Actual minimum heap size of " + v.minHeapSize +
   76.41          " differs from expected minimum heap size of " + expectedMin);
   76.42      }
   76.43  
   76.44 -    if ((expectedInitial != -1) && (align_up(expectedInitial, v.minAlignment) != v.initialHeapSize)) {
   76.45 +    if ((expectedInitial != -1) && (align_up(expectedInitial, v.heapAlignment) != v.initialHeapSize)) {
   76.46        throw new RuntimeException("Actual initial heap size of " + v.initialHeapSize +
   76.47          " differs from expected initial heap size of " + expectedInitial);
   76.48      }
   76.49 @@ -247,7 +247,7 @@
   76.50      MinInitialMaxValues v = new MinInitialMaxValues();
   76.51      getMinInitialMaxHeap(new String[] { gcflag, "-XX:MaxHeapSize=" + maxHeapsize + "M" }, v);
   76.52  
   76.53 -    long expectedHeapSize = align_up(maxHeapsize * K * K, v.maxAlignment);
   76.54 +    long expectedHeapSize = align_up(maxHeapsize * K * K, v.heapAlignment);
   76.55      long actualHeapSize = v.maxHeapSize;
   76.56  
   76.57      if (actualHeapSize > expectedHeapSize) {
    77.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    77.2 +++ b/test/gc/g1/mixedgc/TestOldGenCollectionUsage.java	Mon Mar 18 08:03:04 2019 +0100
    77.3 @@ -0,0 +1,231 @@
    77.4 +/*
    77.5 + * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
    77.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    77.7 + *
    77.8 + * This code is free software; you can redistribute it and/or modify it
    77.9 + * under the terms of the GNU General Public License version 2 only, as
   77.10 + * published by the Free Software Foundation.
   77.11 + *
   77.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
   77.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   77.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   77.15 + * version 2 for more details (a copy is included in the LICENSE file that
   77.16 + * accompanied this code).
   77.17 + *
   77.18 + * You should have received a copy of the GNU General Public License version
   77.19 + * 2 along with this work; if not, write to the Free Software Foundation,
   77.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   77.21 + *
   77.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   77.23 + * or visit www.oracle.com if you need additional information or have any
   77.24 + * questions.
   77.25 + */
   77.26 +
   77.27 +/*
   77.28 + * @test TestOldGenCollectionUsage.java
   77.29 + * @bug 8195115
   77.30 + * @summary G1 Old Gen's CollectionUsage.used is zero after mixed GC which is incorrect
   77.31 + * @key gc
   77.32 + * @requires vm.gc=="G1" | vm.gc=="null"
   77.33 + * @library /testlibrary /testlibrary/whitebox
   77.34 + * @build ClassFileInstaller com.oracle.java.testlibrary.* sun.hotspot.WhiteBox TestOldGenCollectionUsage
   77.35 + * @run main ClassFileInstaller sun.hotspot.WhiteBox
   77.36 + *                              sun.hotspot.WhiteBox$WhiteBoxPermission
   77.37 + * @run main/othervm -Xbootclasspath/a:. -XX:+UseG1GC -XX:+UnlockExperimentalVMOptions -XX:+UnlockDiagnosticVMOptions
   77.38 + *                   -XX:+WhiteBoxAPI -verbose:gc -XX:SurvivorRatio=1 -Xmx14m -Xms14m -XX:MaxTenuringThreshold=1
   77.39 + *                   -XX:InitiatingHeapOccupancyPercent=100 -XX:G1MixedGCCountTarget=4 -XX:MaxGCPauseMillis=30000
   77.40 + *                   -XX:G1HeapRegionSize=1m -XX:G1HeapWastePercent=0 -XX:G1MixedGCLiveThresholdPercent=100
   77.41 + *                   TestOldGenCollectionUsage
   77.42 + */
   77.43 +
   77.44 +import com.oracle.java.testlibrary.Asserts;
   77.45 +import sun.hotspot.WhiteBox;
   77.46 +
   77.47 +import java.util.ArrayList;
   77.48 +import java.util.List;
   77.49 +import java.util.Collections;
   77.50 +
   77.51 +import java.lang.management.*;
   77.52 +
   77.53 +// 8195115 says that for the "G1 Old Gen" MemoryPool, CollectionUsage.used
   77.54 +// is zero for G1 after a mixed collection, which is incorrect.
   77.55 +
   77.56 +public class TestOldGenCollectionUsage {
   77.57 +
   77.58 +    private String poolName = "G1 Old Gen";
   77.59 +    private String collectorName = "G1 Young Generation";
   77.60 +
   77.61 +    public static void main(String [] args) throws Exception {
   77.62 +        TestOldGenCollectionUsage t = new TestOldGenCollectionUsage();
   77.63 +        t.run();
   77.64 +    }
   77.65 +
   77.66 +    public TestOldGenCollectionUsage() {
   77.67 +        System.out.println("Monitor G1 Old Gen pool with G1 Young Generation collector.");
   77.68 +    }
   77.69 +
   77.70 +    public void run() {
   77.71 +        // Find memory pool and collector
   77.72 +        List<MemoryPoolMXBean> pools = ManagementFactory.getMemoryPoolMXBeans();
   77.73 +        MemoryPoolMXBean pool = null;
   77.74 +        boolean foundPool = false;
   77.75 +        for (int i = 0; i < pools.size(); i++) {
   77.76 +            pool = pools.get(i);
   77.77 +            String name = pool.getName();
   77.78 +            if (name.contains(poolName)) {
   77.79 +                System.out.println("Found pool: " + name);
   77.80 +                foundPool = true;
   77.81 +                break;
   77.82 +            }
   77.83 +        }
   77.84 +        if (!foundPool) {
   77.85 +            throw new RuntimeException(poolName + " not found, test with -XX:+UseG1GC");
   77.86 +        }
   77.87 +
   77.88 +        List<GarbageCollectorMXBean> collectors = ManagementFactory.getGarbageCollectorMXBeans();
   77.89 +        GarbageCollectorMXBean collector = null;
   77.90 +        boolean foundCollector = false;
   77.91 +        for (int i = 0; i < collectors.size(); i++) {
   77.92 +            collector = collectors.get(i);
   77.93 +            String name = collector.getName();
   77.94 +            if (name.contains(collectorName)) {
   77.95 +                System.out.println("Found collector: " + name);
   77.96 +                foundCollector = true;
   77.97 +                break;
   77.98 +            }
   77.99 +        }
  77.100 +        if (!foundCollector) {
  77.101 +            throw new RuntimeException(collectorName + " not found, test with -XX:+UseG1GC");
  77.102 +        }
  77.103 +
  77.104 +        MixedGCProvoker gcProvoker = new MixedGCProvoker();
  77.105 +        gcProvoker.allocateOldObjects();
  77.106 +
  77.107 +        // Verify no non-zero result was stored
  77.108 +        long usage = pool.getCollectionUsage().getUsed();
  77.109 +        System.out.println(poolName + ": usage after GC = " + usage);
  77.110 +        if (usage > 0) {
  77.111 +            throw new RuntimeException("Premature mixed collections(s)");
  77.112 +        }
  77.113 +
  77.114 +        // Verify that collections were done
  77.115 +        long collectionCount = collector.getCollectionCount();
  77.116 +        System.out.println(collectorName + ": collection count = "
  77.117 +                           + collectionCount);
  77.118 +        long collectionTime = collector.getCollectionTime();
  77.119 +        System.out.println(collectorName + ": collection time  = "
  77.120 +                           + collectionTime);
  77.121 +        if (collectionCount <= 0) {
  77.122 +            throw new RuntimeException("Collection count <= 0");
  77.123 +        }
  77.124 +        if (collectionTime <= 0) {
  77.125 +            throw new RuntimeException("Collector has not run");
  77.126 +        }
  77.127 +
  77.128 +        gcProvoker.provokeMixedGC();
  77.129 +
  77.130 +        usage = pool.getCollectionUsage().getUsed();
  77.131 +        System.out.println(poolName + ": usage after GC = " + usage);
  77.132 +        if (usage <= 0) {
  77.133 +            throw new RuntimeException(poolName + " found with zero usage");
  77.134 +        }
  77.135 +
  77.136 +        long newCollectionCount = collector.getCollectionCount();
  77.137 +        System.out.println(collectorName + ": collection count = "
  77.138 +                           + newCollectionCount);
  77.139 +        long newCollectionTime = collector.getCollectionTime();
  77.140 +        System.out.println(collectorName + ": collection time  = "
  77.141 +                           + newCollectionTime);
  77.142 +        if (newCollectionCount <= collectionCount) {
  77.143 +            throw new RuntimeException("No new collection");
  77.144 +        }
  77.145 +        if (newCollectionTime <= collectionTime) {
  77.146 +            throw new RuntimeException("Collector has not run some more");
  77.147 +        }
  77.148 +
  77.149 +        System.out.println("Test passed.");
  77.150 +    }
  77.151 +
  77.152 +    /**
  77.153 +     * Utility class to guarantee a mixed GC. The class allocates several arrays and
  77.154 +     * promotes them to the oldgen. After that it tries to provoke mixed GC by
  77.155 +     * allocating new objects.
  77.156 +     *
  77.157 +     * The necessary condition for guaranteed mixed GC is running MixedGCProvoker is
  77.158 +     * running in VM with the following flags: -XX:MaxTenuringThreshold=1 -Xms12M
  77.159 +     * -Xmx12M -XX:G1MixedGCLiveThresholdPercent=100 -XX:G1HeapWastePercent=0
  77.160 +     * -XX:G1HeapRegionSize=1m
  77.161 +     */
  77.162 +    public class MixedGCProvoker {
  77.163 +        private final WhiteBox WB = WhiteBox.getWhiteBox();
  77.164 +        private final List<byte[]> liveOldObjects = new ArrayList<>();
  77.165 +        private final List<byte[]> newObjects = new ArrayList<>();
  77.166 +
  77.167 +        public static final int ALLOCATION_SIZE = 20000;
  77.168 +        public static final int ALLOCATION_COUNT = 15;
  77.169 +
  77.170 +        public void allocateOldObjects() {
  77.171 +            List<byte[]> deadOldObjects = new ArrayList<>();
  77.172 +            // Allocates buffer and promotes it to the old gen. Mix live and dead old
  77.173 +            // objects
  77.174 +            for (int i = 0; i < ALLOCATION_COUNT; ++i) {
  77.175 +                liveOldObjects.add(new byte[ALLOCATION_SIZE * 5]);
  77.176 +                deadOldObjects.add(new byte[ALLOCATION_SIZE * 5]);
  77.177 +            }
  77.178 +
  77.179 +            // Do two young collections, MaxTenuringThreshold=1 will force promotion.
  77.180 +            // G1HeapRegionSize=1m guarantees that old gen regions will be filled.
  77.181 +            WB.youngGC();
  77.182 +            WB.youngGC();
  77.183 +            // Check it is promoted & keep alive
  77.184 +            Asserts.assertTrue(WB.isObjectInOldGen(liveOldObjects),
  77.185 +                               "List of the objects is suppose to be in OldGen");
  77.186 +            Asserts.assertTrue(WB.isObjectInOldGen(deadOldObjects),
  77.187 +                               "List of the objects is suppose to be in OldGen");
  77.188 +        }
  77.189 +
  77.190 +        /**
  77.191 +         * Waits until Concurent Mark Cycle finishes
  77.192 +         * @param wb  Whitebox instance
  77.193 +         * @param sleepTime sleep time
  77.194 +         */
  77.195 +        private void waitTillCMCFinished(int sleepTime) {
  77.196 +            while (WB.g1InConcurrentMark()) {
  77.197 +                if (sleepTime > -1) {
  77.198 +                    try {
  77.199 +                        Thread.sleep(sleepTime);
  77.200 +                    } catch (InterruptedException e) {
  77.201 +                        System.out.println("Got InterruptedException while waiting for ConcMarkCycle to finish");
  77.202 +                    }
  77.203 +                }
  77.204 +            }
  77.205 +        }
  77.206 +
  77.207 +        public void provokeMixedGC() {
  77.208 +            waitTillCMCFinished(0);
  77.209 +            WB.g1StartConcMarkCycle();
  77.210 +            waitTillCMCFinished(0);
  77.211 +            WB.youngGC();
  77.212 +
  77.213 +            System.out.println("Allocating new objects to provoke mixed GC");
  77.214 +            // Provoke a mixed collection. G1MixedGCLiveThresholdPercent=100
  77.215 +            // guarantees that full old gen regions will be included.
  77.216 +            for (int i = 0; i < (ALLOCATION_COUNT * 20); i++) {
  77.217 +                try {
  77.218 +                    newObjects.add(new byte[ALLOCATION_SIZE]);
  77.219 +                } catch (OutOfMemoryError e) {
  77.220 +                    newObjects.clear();
  77.221 +                    WB.youngGC();
  77.222 +                    WB.youngGC();
  77.223 +                    System.out.println("OutOfMemoryError is reported, stop allocating new objects");
  77.224 +                    break;
  77.225 +                }
  77.226 +            }
  77.227 +            // check that liveOldObjects still alive
  77.228 +            Asserts.assertTrue(WB.isObjectInOldGen(liveOldObjects),
  77.229 +                               "List of the objects is suppose to be in OldGen");
  77.230 +        }
  77.231 +
  77.232 +    }
  77.233 +
  77.234 +}
    78.1 --- a/test/runtime/6981737/Test6981737.java	Mon Mar 04 21:10:27 2019 +0100
    78.2 +++ b/test/runtime/6981737/Test6981737.java	Mon Mar 18 08:03:04 2019 +0100
    78.3 @@ -48,8 +48,6 @@
    78.4              vendor_re = "Sun Microsystems Inc\\.";
    78.5              vm_spec_version_re = "1\\.0";
    78.6          }
    78.7 -        verifyProperty("java.vendor", vendor_re);
    78.8 -        verifyProperty("java.vm.vendor", vendor_re);
    78.9          verifyProperty("java.vm.specification.vendor", vendor_re);
   78.10          verifyProperty("java.specification.vendor", vendor_re);
   78.11          verifyProperty("java.vm.specification.version", vm_spec_version_re);
    79.1 --- a/test/runtime/ErrorHandling/TestCrashOnOutOfMemoryError.java	Mon Mar 04 21:10:27 2019 +0100
    79.2 +++ b/test/runtime/ErrorHandling/TestCrashOnOutOfMemoryError.java	Mon Mar 18 08:03:04 2019 +0100
    79.3 @@ -25,7 +25,7 @@
    79.4   * @test TestCrashOnOutOfMemoryError
    79.5   * @summary Test using -XX:+CrashOnOutOfMemoryError
    79.6   * @library /testlibrary
    79.7 - * @build jdk.test.lib.*
    79.8 + * @build com.oracle.java.testlibrary.*
    79.9   * @run driver TestCrashOnOutOfMemoryError
   79.10   * @bug 8138745
   79.11   */
    80.1 --- a/test/runtime/ErrorHandling/TestExitOnOutOfMemoryError.java	Mon Mar 04 21:10:27 2019 +0100
    80.2 +++ b/test/runtime/ErrorHandling/TestExitOnOutOfMemoryError.java	Mon Mar 18 08:03:04 2019 +0100
    80.3 @@ -25,7 +25,7 @@
    80.4   * @test TestExitOnOutOfMemoryError
    80.5   * @summary Test using -XX:ExitOnOutOfMemoryError
    80.6   * @library /testlibrary
    80.7 - * @build jdk.test.lib.*
    80.8 + * @build com.oracle.java.testlibrary.*
    80.9   * @run driver TestExitOnOutOfMemoryError
   80.10   * @bug 8138745
   80.11   */
    81.1 --- a/test/runtime/NMT/JcmdDetailDiff.java	Mon Mar 04 21:10:27 2019 +0100
    81.2 +++ b/test/runtime/NMT/JcmdDetailDiff.java	Mon Mar 18 08:03:04 2019 +0100
    81.3 @@ -26,7 +26,6 @@
    81.4   * @summary run NMT baseline, allocate memory and verify output from detail.diff
    81.5   * @key nmt jcmd
    81.6   * @library /testlibrary /testlibrary/whitebox
    81.7 - * @ignore
    81.8   * @build JcmdDetailDiff
    81.9   * @run main ClassFileInstaller sun.hotspot.WhiteBox
   81.10   * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -XX:NativeMemoryTracking=detail JcmdDetailDiff
    82.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    82.2 +++ b/test/runtime/NMT/MallocSiteTypeChange.java	Mon Mar 18 08:03:04 2019 +0100
    82.3 @@ -0,0 +1,69 @@
    82.4 +/*
    82.5 + * Copyright (c) 2019, Red Hat, Inc. All rights reserved.
    82.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    82.7 + *
    82.8 + * This code is free software; you can redistribute it and/or modify it
    82.9 + * under the terms of the GNU General Public License version 2 only, as
   82.10 + * published by the Free Software Foundation.
   82.11 + *
   82.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
   82.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   82.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   82.15 + * version 2 for more details (a copy is included in the LICENSE file that
   82.16 + * accompanied this code).
   82.17 + *
   82.18 + * You should have received a copy of the GNU General Public License version
   82.19 + * 2 along with this work; if not, write to the Free Software Foundation,
   82.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   82.21 + *
   82.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   82.23 + * or visit www.oracle.com if you need additional information or have any
   82.24 + * questions.
   82.25 + *
   82.26 + */
   82.27 +
   82.28 +/*
   82.29 + * @test MallocSiteTypeChange
   82.30 + * @summary Test a malloc site type change results NMT to report deallocation of old type and allocation of new type
   82.31 + * @bug 8200109
   82.32 + * @key nmt jcmd
   82.33 + * @modules java.base/jdk.internal.misc
   82.34 + * @library /testlibrary /testlibrary/whitebox
   82.35 + * @build sun.hotspot.WhiteBox
   82.36 + * @run driver ClassFileInstaller sun.hotspot.WhiteBox
   82.37 + * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -XX:NativeMemoryTracking=detail MallocSiteTypeChange
   82.38 + */
   82.39 +
   82.40 +import com.oracle.java.testlibrary.*;
   82.41 +import sun.hotspot.WhiteBox;
   82.42 +
   82.43 +public class MallocSiteTypeChange {
   82.44 +    public static void main(String args[]) throws Exception {
   82.45 +        OutputAnalyzer output;
   82.46 +        WhiteBox wb = WhiteBox.getWhiteBox();
   82.47 +
   82.48 +        // Grab my own PID
   82.49 +        String pid = Long.toString(ProcessTools.getProcessId());
   82.50 +        ProcessBuilder pb = new ProcessBuilder();
   82.51 +
   82.52 +        int pc = 1;
   82.53 +        long addr = wb.NMTMallocWithPseudoStack(4 * 1024, pc);
   82.54 +
   82.55 +        // Verify that current tracking level is "detail"
   82.56 +        pb.command(new String[] { JDKToolFinder.getJDKTool("jcmd"), pid, "VM.native_memory", "summary"});
   82.57 +        output = new OutputAnalyzer(pb.start());
   82.58 +        output.shouldContain("Test (reserved=4KB, committed=4KB)");
   82.59 +
   82.60 +        pb.command(new String[] { JDKToolFinder.getJDKTool("jcmd"), pid, "VM.native_memory", "baseline"});
   82.61 +        output = new OutputAnalyzer(pb.start());
   82.62 +        output.shouldContain("Baseline succeeded");
   82.63 +
   82.64 +        wb.NMTFree(addr);
   82.65 +        addr = wb.NMTMallocWithPseudoStackAndType(2 * 1024, pc, 7 /* mtInternal */ );
   82.66 +        pb.command(new String[] { JDKToolFinder.getJDKTool("jcmd"), pid, "VM.native_memory", "detail.diff"});
   82.67 +        output = new OutputAnalyzer(pb.start());
   82.68 +        output.shouldContain("(malloc=0KB type=Test -4KB)");
   82.69 +        output.shouldContain("(malloc=2KB type=Internal +2KB #1 +1)");
   82.70 +        output.shouldHaveExitValue(0);
   82.71 +  }
   82.72 +}
    83.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    83.2 +++ b/test/runtime/StackGap/T.java	Mon Mar 18 08:03:04 2019 +0100
    83.3 @@ -0,0 +1,33 @@
    83.4 +/*
    83.5 + * Copyright (c) 2018, Red Hat, Inc. All rights reserved.
    83.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    83.7 + *
    83.8 + * This code is free software; you can redistribute it and/or modify it
    83.9 + * under the terms of the GNU General Public License version 2 only, as
   83.10 + * published by the Free Software Foundation.
   83.11 + *
   83.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
   83.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   83.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   83.15 + * version 2 for more details (a copy is included in the LICENSE file that
   83.16 + * accompanied this code).
   83.17 + *
   83.18 + * You should have received a copy of the GNU General Public License version
   83.19 + * 2 along with this work; if not, write to the Free Software Foundation,
   83.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   83.21 + *
   83.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   83.23 + * or visit www.oracle.com if you need additional information or have any
   83.24 + * questions.
   83.25 + */
   83.26 +
   83.27 +public class T {
   83.28 +
   83.29 +  public static void test(int n) {
   83.30 +    if (n == 0) return;
   83.31 +    System.out.println (n);
   83.32 +    test (n - 1);
   83.33 +
   83.34 +  }
   83.35 +
   83.36 +}
    84.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    84.2 +++ b/test/runtime/StackGap/exestack-gap.c	Mon Mar 18 08:03:04 2019 +0100
    84.3 @@ -0,0 +1,82 @@
    84.4 +/*
    84.5 + * Copyright (c) 2018, Red Hat, Inc. All rights reserved.
    84.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    84.7 + *
    84.8 + * This code is free software; you can redistribute it and/or modify it
    84.9 + * under the terms of the GNU General Public License version 2 only, as
   84.10 + * published by the Free Software Foundation.
   84.11 + *
   84.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
   84.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   84.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   84.15 + * version 2 for more details (a copy is included in the LICENSE file that
   84.16 + * accompanied this code).
   84.17 + *
   84.18 + * You should have received a copy of the GNU General Public License version
   84.19 + * 2 along with this work; if not, write to the Free Software Foundation,
   84.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   84.21 + *
   84.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   84.23 + * or visit www.oracle.com if you need additional information or have any
   84.24 + * questions.
   84.25 + */
   84.26 +
   84.27 +#include <jni.h>
   84.28 +#include <stdio.h>
   84.29 +#include <stdlib.h>
   84.30 +
   84.31 +JNIEnv* create_vm(JavaVM **jvm, char *extra_option)
   84.32 +{
   84.33 +    JNIEnv* env;
   84.34 +    JavaVMInitArgs args;
   84.35 +    JavaVMOption options[4];
   84.36 +    args.version = JNI_VERSION_1_8;
   84.37 +    args.nOptions = 3 + (extra_option != NULL);
   84.38 +    options[0].optionString = "-Xss2048k";
   84.39 +    char classpath[4096];
   84.40 +    snprintf(classpath, sizeof classpath,
   84.41 +             "-Djava.class.path=%s", getenv("CLASSPATH"));
   84.42 +    options[1].optionString = classpath;
   84.43 +    options[2].optionString = "-XX:+UnlockExperimentalVMOptions";
   84.44 +    if (extra_option) {
   84.45 +      options[3].optionString = extra_option;
   84.46 +    }
   84.47 +    args.options = &options[0];
   84.48 +    args.ignoreUnrecognized = 0;
   84.49 +    int rv;
   84.50 +    rv = JNI_CreateJavaVM(jvm, (void**)&env, &args);
   84.51 +    if (rv < 0) return NULL;
   84.52 +    return env;
   84.53 +}
   84.54 +
   84.55 +void run(char *extra_arg) {
   84.56 +  JavaVM *jvm;
   84.57 +  jclass T_class;
   84.58 +  jmethodID test_method;
   84.59 +  JNIEnv *env = create_vm(&jvm, extra_arg);
   84.60 +  if (env == NULL)
   84.61 +    exit(1);
   84.62 +  T_class = (*env)->FindClass(env, "T");
   84.63 +  if ((*env)->ExceptionCheck(env) == JNI_TRUE) {
   84.64 +    (*env)->ExceptionDescribe(env);
   84.65 +    exit(1);
   84.66 +  }
   84.67 +  test_method = (*env)->GetStaticMethodID(env, T_class, "test", "(I)V");
   84.68 +  if ((*env)->ExceptionCheck(env) == JNI_TRUE) {
   84.69 +    (*env)->ExceptionDescribe(env);
   84.70 +    exit(1);
   84.71 +  }
   84.72 +  (*env)->CallStaticVoidMethod(env, T_class, test_method, 1000);
   84.73 +}
   84.74 +
   84.75 +
   84.76 +int main(int argc, char **argv)
   84.77 +{
   84.78 +  if (argc > 1) {
   84.79 +    run(argv[1]);
   84.80 +  } else {
   84.81 +    run(NULL);
   84.82 +  }
   84.83 +
   84.84 +  return 0;
   84.85 +}
    85.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    85.2 +++ b/test/runtime/StackGap/testme.sh	Mon Mar 18 08:03:04 2019 +0100
    85.3 @@ -0,0 +1,73 @@
    85.4 +# Copyright (c) 2014, 2018, Oracle and/or its affiliates. All rights reserved.
    85.5 +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    85.6 +#
    85.7 +# This code is free software; you can redistribute it and/or modify it
    85.8 +# under the terms of the GNU General Public License version 2 only, as
    85.9 +# published by the Free Software Foundation.
   85.10 +#
   85.11 +# This code is distributed in the hope that it will be useful, but WITHOUT
   85.12 +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   85.13 +# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   85.14 +# version 2 for more details (a copy is included in the LICENSE file that
   85.15 +# accompanied this code).
   85.16 +#
   85.17 +# You should have received a copy of the GNU General Public License version
   85.18 +# 2 along with this work; if not, write to the Free Software Foundation,
   85.19 +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   85.20 +#
   85.21 +# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   85.22 +# or visit www.oracle.com if you need additional information or have any
   85.23 +# questions.
   85.24 +#!/bin/sh
   85.25 +
   85.26 +#
   85.27 +# @test testme.sh
   85.28 +# @bug 8197429
   85.29 +# @summary Linux kernel stack guard should not cause segfaults on x86-32
   85.30 +# @compile T.java
   85.31 +# @run shell testme.sh
   85.32 +#
   85.33 +
   85.34 +if [ "${TESTSRC}" = "" ]
   85.35 +then
   85.36 +  TESTSRC=${PWD}
   85.37 +  echo "TESTSRC not set.  Using "${TESTSRC}" as default"
   85.38 +fi
   85.39 +echo "TESTSRC=${TESTSRC}"
   85.40 +## Adding common setup Variables for running shell tests.
   85.41 +. ${TESTSRC}/../../test_env.sh
   85.42 +
   85.43 +if [ "${VM_OS}" != "linux" ]
   85.44 +then
   85.45 +  echo "Test only valid for Linux"
   85.46 +  exit 0
   85.47 +fi
   85.48 +
   85.49 +gcc_cmd=`which gcc`
   85.50 +if [ "x$gcc_cmd" = "x" ]; then
   85.51 +    echo "WARNING: gcc not found. Cannot execute test." 2>&1
   85.52 +    exit 0;
   85.53 +fi
   85.54 +
   85.55 +CFLAGS="-m${VM_BITS}"
   85.56 +
   85.57 +LD_LIBRARY_PATH=.:${COMPILEJAVA}/jre/lib/${VM_CPU}/${VM_TYPE}:/usr/lib:$LD_LIBRARY_PATH
   85.58 +export LD_LIBRARY_PATH
   85.59 +
   85.60 +cp ${TESTSRC}${FS}exestack-gap.c .
   85.61 +
   85.62 +# Copy the result of our @compile action:
   85.63 +cp ${TESTCLASSES}${FS}T.class .
   85.64 +
   85.65 +echo "Compilation flag: ${COMP_FLAG}"
   85.66 +# Note pthread may not be found thus invoke creation will fail to be created.
   85.67 +# Check to ensure you have a /usr/lib/libpthread.so if you don't please look
   85.68 +# for /usr/lib/`uname -m`-linux-gnu version ensure to add that path to below compilation.
   85.69 +
   85.70 +$gcc_cmd -DLINUX ${CFLAGS} -o stack-gap \
   85.71 +    -I${COMPILEJAVA}/include -I${COMPILEJAVA}/include/linux \
   85.72 +    -L${COMPILEJAVA}/jre/lib/${VM_CPU}/${VM_TYPE} \
   85.73 +    -ljvm -lpthread exestack-gap.c
   85.74 +
   85.75 +./stack-gap || exit $?
   85.76 +./stack-gap -XX:+DisablePrimordialThreadGuardPages || exit $?
    86.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    86.2 +++ b/test/sanity/MismatchedWhiteBox/WhiteBox.java	Mon Mar 18 08:03:04 2019 +0100
    86.3 @@ -0,0 +1,58 @@
    86.4 +/*
    86.5 + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
    86.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    86.7 + *
    86.8 + * This code is free software; you can redistribute it and/or modify it
    86.9 + * under the terms of the GNU General Public License version 2 only, as
   86.10 + * published by the Free Software Foundation.
   86.11 + *
   86.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
   86.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   86.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   86.15 + * version 2 for more details (a copy is included in the LICENSE file that
   86.16 + * accompanied this code).
   86.17 + *
   86.18 + * You should have received a copy of the GNU General Public License version
   86.19 + * 2 along with this work; if not, write to the Free Software Foundation,
   86.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   86.21 + *
   86.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   86.23 + * or visit www.oracle.com if you need additional information or have any
   86.24 + * questions.
   86.25 + */
   86.26 +
   86.27 +/*
   86.28 + * @test WhiteBox
   86.29 + * @bug 8011675
   86.30 + * @summary verify that whitebox can be used even if not all functions are declared in java-part
   86.31 + * @author igor.ignatyev@oracle.com
   86.32 + * @library /testlibrary
   86.33 + * @compile WhiteBox.java
   86.34 + * @run main ClassFileInstaller sun.hotspot.WhiteBox
   86.35 + * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI sun.hotspot.WhiteBox
   86.36 + * @clean sun.hotspot.WhiteBox
   86.37 + */
   86.38 +
   86.39 +package sun.hotspot;
   86.40 +
   86.41 +public class WhiteBox {
   86.42 +    private static native void registerNatives();
   86.43 +    static { registerNatives(); }
   86.44 +    public native int notExistedMethod();
   86.45 +    public native int getHeapOopSize();
   86.46 +    public static void main(String[] args) {
   86.47 +        WhiteBox wb = new WhiteBox();
   86.48 +        if (wb.getHeapOopSize() < 0) {
   86.49 +            throw new Error("wb.getHeapOopSize() < 0");
   86.50 +        }
   86.51 +        boolean catched = false;
   86.52 +        try {
   86.53 +            wb.notExistedMethod();
   86.54 +        } catch (UnsatisfiedLinkError e) {
   86.55 +            catched = true;
   86.56 +        }
   86.57 +        if (!catched) {
   86.58 +            throw new Error("wb.notExistedMethod() was invoked");
   86.59 +        }
   86.60 +    }
   86.61 +}
    87.1 --- a/test/sanity/WhiteBox.java	Mon Mar 04 21:10:27 2019 +0100
    87.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    87.3 @@ -1,58 +0,0 @@
    87.4 -/*
    87.5 - * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
    87.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    87.7 - *
    87.8 - * This code is free software; you can redistribute it and/or modify it
    87.9 - * under the terms of the GNU General Public License version 2 only, as
   87.10 - * published by the Free Software Foundation.
   87.11 - *
   87.12 - * This code is distributed in the hope that it will be useful, but WITHOUT
   87.13 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   87.14 - * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   87.15 - * version 2 for more details (a copy is included in the LICENSE file that
   87.16 - * accompanied this code).
   87.17 - *
   87.18 - * You should have received a copy of the GNU General Public License version
   87.19 - * 2 along with this work; if not, write to the Free Software Foundation,
   87.20 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   87.21 - *
   87.22 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   87.23 - * or visit www.oracle.com if you need additional information or have any
   87.24 - * questions.
   87.25 - */
   87.26 -
   87.27 -/*
   87.28 - * @test WhiteBox
   87.29 - * @bug 8011675
   87.30 - * @summary verify that whitebox can be used even if not all functions are declared in java-part
   87.31 - * @author igor.ignatyev@oracle.com
   87.32 - * @library /testlibrary
   87.33 - * @compile WhiteBox.java
   87.34 - * @run main ClassFileInstaller sun.hotspot.WhiteBox
   87.35 - * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI sun.hotspot.WhiteBox
   87.36 - * @clean sun.hotspot.WhiteBox
   87.37 - */
   87.38 -
   87.39 -package sun.hotspot;
   87.40 -
   87.41 -public class WhiteBox {
   87.42 -    private static native void registerNatives();
   87.43 -    static { registerNatives(); }
   87.44 -    public native int notExistedMethod();
   87.45 -    public native int getHeapOopSize();
   87.46 -    public static void main(String[] args) {
   87.47 -        WhiteBox wb = new WhiteBox();
   87.48 -        if (wb.getHeapOopSize() < 0) {
   87.49 -            throw new Error("wb.getHeapOopSize() < 0");
   87.50 -        }
   87.51 -        boolean catched = false;
   87.52 -        try {
   87.53 -            wb.notExistedMethod();
   87.54 -        } catch (UnsatisfiedLinkError e) {
   87.55 -            catched = true;
   87.56 -        }
   87.57 -        if (!catched) {
   87.58 -            throw new Error("wb.notExistedMethod() was invoked");
   87.59 -        }
   87.60 -    }
   87.61 -}
    88.1 --- a/test/testlibrary/com/oracle/java/testlibrary/ProcessTools.java	Mon Mar 04 21:10:27 2019 +0100
    88.2 +++ b/test/testlibrary/com/oracle/java/testlibrary/ProcessTools.java	Mon Mar 18 08:03:04 2019 +0100
    88.3 @@ -152,6 +152,9 @@
    88.4      args.add(javapath);
    88.5      Collections.addAll(args, getPlatformSpecificVMArgs());
    88.6  
    88.7 +    args.add("-cp");
    88.8 +    args.add(System.getProperty("java.class.path"));
    88.9 +
   88.10      if (addTestVmOptions) {
   88.11        String vmopts = System.getProperty("test.vm.opts");
   88.12        if (vmopts != null && vmopts.length() > 0) {
    89.1 --- a/test/testlibrary/whitebox/sun/hotspot/WhiteBox.java	Mon Mar 04 21:10:27 2019 +0100
    89.2 +++ b/test/testlibrary/whitebox/sun/hotspot/WhiteBox.java	Mon Mar 18 08:03:04 2019 +0100
    89.3 @@ -1,5 +1,5 @@
    89.4  /*
    89.5 - * Copyright (c) 2012, 2018, Oracle and/or its affiliates. All rights reserved.
    89.6 + * Copyright (c) 2012, 2019, Oracle and/or its affiliates. All rights reserved.
    89.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    89.8   *
    89.9   * This code is free software; you can redistribute it and/or modify it
   89.10 @@ -117,6 +117,7 @@
   89.11    public native void NMTUncommitMemory(long addr, long size);
   89.12    public native void NMTReleaseMemory(long addr, long size);
   89.13    public native long NMTMallocWithPseudoStack(long size, int index);
   89.14 +  public native long NMTMallocWithPseudoStackAndType(long size, int index, int type);
   89.15    public native boolean NMTIsDetailSupported();
   89.16    public native boolean NMTChangeTrackingLevel();
   89.17    public native int NMTGetHashSize();

mercurial