Merge
authorjwilhelm
Thu, 21 Dec 2017 00:07:38 +0100
changeset 48475 18fb03624696
parent 48356 29e165bdf669 (current diff)
parent 48474 6e69aea2aee7 (diff)
child 48476 ca9489245872
Merge
src/hotspot/share/runtime/arguments.cpp
src/java.base/share/native/libjava/System.c
src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.test/src/org/graalvm/compiler/core/test/CooperativePhaseTest.java
src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.replacements/src/org/graalvm/compiler/replacements/classfile/Classfile.java
--- a/.hgignore	Wed Dec 20 09:14:52 2017 -0800
+++ b/.hgignore	Thu Dec 21 00:07:38 2017 +0100
@@ -11,3 +11,5 @@
 test/nashorn/script/external
 test/nashorn/lib
 NashornProfile.txt
+.*/JTreport/.*
+.*/JTwork/.*
--- a/make/test/JtregNativeHotspot.gmk	Wed Dec 20 09:14:52 2017 -0800
+++ b/make/test/JtregNativeHotspot.gmk	Thu Dec 21 00:07:38 2017 +0100
@@ -113,6 +113,8 @@
     BUILD_HOTSPOT_JTREG_LIBRARIES_LIBS_libHandshakeTransitionTest := -lc
     BUILD_HOTSPOT_JTREG_LIBRARIES_LIBS_libHasNoEntryPoint := -lc
     BUILD_HOTSPOT_JTREG_LIBRARIES_LIBS_libReturnError := -lc
+    BUILD_HOTSPOT_JTREG_LIBRARIES_LIBS_libCNLookUp := -lc
+    BUILD_HOTSPOT_JTREG_LIBRARIES_LDFLAGS_libTestCheckedEnsureLocalCapacity := -lc
 endif
 
 ifeq ($(OPENJDK_TARGET_OS), linux)
--- a/src/hotspot/cpu/x86/macroAssembler_x86_pow.cpp	Wed Dec 20 09:14:52 2017 -0800
+++ b/src/hotspot/cpu/x86/macroAssembler_x86_pow.cpp	Thu Dec 21 00:07:38 2017 +0100
@@ -765,6 +765,11 @@
     0xfefa39efUL, 0x3fe62e42UL, 0xfefa39efUL, 0xbfe62e42UL
 };
 
+ALIGNED_(8) juint _DOUBLE2[] =
+{
+    0x00000000UL, 0x40000000UL
+};
+
 //registers,
 // input: xmm0, xmm1
 // scratch: xmm1, xmm2, xmm3, xmm4, xmm5, xmm6, xmm7
@@ -803,6 +808,7 @@
   address HIGHMASK_LOG_X = (address)_HIGHMASK_LOG_X;
   address HALFMASK = (address)_HALFMASK;
   address log2 = (address)_log2_pow;
+  address DOUBLE2 = (address)_DOUBLE2;
 
 
   bind(start);
@@ -810,6 +816,13 @@
   movsd(Address(rsp, 8), xmm0);
   movsd(Address(rsp, 16), xmm1);
 
+  // Special case: pow(x, 2.0) => x * x
+  movdq(tmp1, xmm1);
+  cmp64(tmp1, ExternalAddress(DOUBLE2));
+  jccb(Assembler::notEqual, B1_2);
+  mulsd(xmm0, xmm0);
+  jmp(B1_5);
+
   bind(B1_2);
   pextrw(eax, xmm0, 3);
   xorpd(xmm2, xmm2);
--- a/src/hotspot/cpu/x86/stubGenerator_x86_32.cpp	Wed Dec 20 09:14:52 2017 -0800
+++ b/src/hotspot/cpu/x86/stubGenerator_x86_32.cpp	Thu Dec 21 00:07:38 2017 +0100
@@ -433,7 +433,7 @@
 
 
   //----------------------------------------------------------------------------------------------------
-  // Support for jint Atomic::xchg(jint exchange_value, volatile jint* dest)
+  // Support for int32_t Atomic::xchg(int32_t exchange_value, volatile int32_t* dest)
   //
   // xchg exists as far back as 8086, lock needed for MP only
   // Stack layout immediately after call:
--- a/src/hotspot/cpu/x86/stubGenerator_x86_64.cpp	Wed Dec 20 09:14:52 2017 -0800
+++ b/src/hotspot/cpu/x86/stubGenerator_x86_64.cpp	Thu Dec 21 00:07:38 2017 +0100
@@ -611,8 +611,8 @@
     return start;
   }
 
-  // Support for jbyte atomic::atomic_cmpxchg(jbyte exchange_value, volatile jbyte* dest,
-  //                                          jbyte compare_value)
+  // Support for int8_t atomic::atomic_cmpxchg(int8_t exchange_value, volatile int8_t* dest,
+  //                                           int8_t compare_value)
   //
   // Arguments :
   //    c_rarg0: exchange_value
@@ -637,9 +637,9 @@
     return start;
   }
 
-  // Support for jlong atomic::atomic_cmpxchg(jlong exchange_value,
-  //                                          volatile jlong* dest,
-  //                                          jlong compare_value)
+  // Support for int64_t atomic::atomic_cmpxchg(int64_t exchange_value,
+  //                                            volatile int64_t* dest,
+  //                                            int64_t compare_value)
   // Arguments :
   //    c_rarg0: exchange_value
   //    c_rarg1: dest
@@ -694,8 +694,8 @@
   // Result:
   //    *dest += add_value
   //    return *dest;
-  address generate_atomic_add_ptr() {
-    StubCodeMark mark(this, "StubRoutines", "atomic_add_ptr");
+  address generate_atomic_add_long() {
+    StubCodeMark mark(this, "StubRoutines", "atomic_add_long");
     address start = __ pc();
 
     __ movptr(rax, c_rarg0); // Copy to eax we need a return value anyhow
@@ -5015,14 +5015,14 @@
     StubRoutines::_catch_exception_entry = generate_catch_exception();
 
     // atomic calls
-    StubRoutines::_atomic_xchg_entry         = generate_atomic_xchg();
-    StubRoutines::_atomic_xchg_long_entry    = generate_atomic_xchg_long();
-    StubRoutines::_atomic_cmpxchg_entry      = generate_atomic_cmpxchg();
-    StubRoutines::_atomic_cmpxchg_byte_entry = generate_atomic_cmpxchg_byte();
-    StubRoutines::_atomic_cmpxchg_long_entry = generate_atomic_cmpxchg_long();
-    StubRoutines::_atomic_add_entry          = generate_atomic_add();
-    StubRoutines::_atomic_add_ptr_entry      = generate_atomic_add_ptr();
-    StubRoutines::_fence_entry               = generate_orderaccess_fence();
+    StubRoutines::_atomic_xchg_entry          = generate_atomic_xchg();
+    StubRoutines::_atomic_xchg_long_entry     = generate_atomic_xchg_long();
+    StubRoutines::_atomic_cmpxchg_entry       = generate_atomic_cmpxchg();
+    StubRoutines::_atomic_cmpxchg_byte_entry  = generate_atomic_cmpxchg_byte();
+    StubRoutines::_atomic_cmpxchg_long_entry  = generate_atomic_cmpxchg_long();
+    StubRoutines::_atomic_add_entry           = generate_atomic_add();
+    StubRoutines::_atomic_add_long_entry      = generate_atomic_add_long();
+    StubRoutines::_fence_entry                = generate_orderaccess_fence();
 
     // platform dependent
     StubRoutines::x86::_get_previous_fp_entry = generate_get_previous_fp();
--- a/src/hotspot/cpu/zero/stubGenerator_zero.cpp	Wed Dec 20 09:14:52 2017 -0800
+++ b/src/hotspot/cpu/zero/stubGenerator_zero.cpp	Thu Dec 21 00:07:38 2017 +0100
@@ -258,7 +258,7 @@
     StubRoutines::_atomic_cmpxchg_byte_entry = ShouldNotCallThisStub();
     StubRoutines::_atomic_cmpxchg_long_entry = ShouldNotCallThisStub();
     StubRoutines::_atomic_add_entry          = ShouldNotCallThisStub();
-    StubRoutines::_atomic_add_ptr_entry      = ShouldNotCallThisStub();
+    StubRoutines::_atomic_add_long_entry     = ShouldNotCallThisStub();
     StubRoutines::_fence_entry               = ShouldNotCallThisStub();
   }
 
--- a/src/hotspot/os_cpu/bsd_x86/atomic_bsd_x86.hpp	Wed Dec 20 09:14:52 2017 -0800
+++ b/src/hotspot/os_cpu/bsd_x86/atomic_bsd_x86.hpp	Thu Dec 21 00:07:38 2017 +0100
@@ -132,8 +132,8 @@
 
 extern "C" {
   // defined in bsd_x86.s
-  jlong _Atomic_cmpxchg_long(jlong, volatile jlong*, jlong, bool);
-  void _Atomic_move_long(const volatile jlong* src, volatile jlong* dst);
+  int64_t _Atomic_cmpxchg_long(int64_t, volatile int64_t*, int64_t, bool);
+  void _Atomic_move_long(const volatile int64_t* src, volatile int64_t* dst);
 }
 
 template<>
@@ -143,15 +143,15 @@
                                                 T compare_value,
                                                 cmpxchg_memory_order order) const {
   STATIC_ASSERT(8 == sizeof(T));
-  return cmpxchg_using_helper<jlong>(_Atomic_cmpxchg_long, exchange_value, dest, compare_value);
+  return cmpxchg_using_helper<int64_t>(_Atomic_cmpxchg_long, exchange_value, dest, compare_value);
 }
 
 template<>
 template<typename T>
 inline T Atomic::PlatformLoad<8>::operator()(T const volatile* src) const {
   STATIC_ASSERT(8 == sizeof(T));
-  volatile jlong dest;
-  _Atomic_move_long(reinterpret_cast<const volatile jlong*>(src), reinterpret_cast<volatile jlong*>(&dest));
+  volatile int64_t dest;
+  _Atomic_move_long(reinterpret_cast<const volatile int64_t*>(src), reinterpret_cast<volatile int64_t*>(&dest));
   return PrimitiveConversions::cast<T>(dest);
 }
 
@@ -160,7 +160,7 @@
 inline void Atomic::PlatformStore<8>::operator()(T store_value,
                                                  T volatile* dest) const {
   STATIC_ASSERT(8 == sizeof(T));
-  _Atomic_move_long(reinterpret_cast<const volatile jlong*>(&store_value), reinterpret_cast<volatile jlong*>(dest));
+  _Atomic_move_long(reinterpret_cast<const volatile int64_t*>(&store_value), reinterpret_cast<volatile int64_t*>(dest));
 }
 
 #endif // AMD64
--- a/src/hotspot/os_cpu/bsd_x86/bsd_x86_32.s	Wed Dec 20 09:14:52 2017 -0800
+++ b/src/hotspot/os_cpu/bsd_x86/bsd_x86_32.s	Thu Dec 21 00:07:38 2017 +0100
@@ -633,10 +633,10 @@
         ret
 
 
-        # Support for jlong Atomic::cmpxchg(jlong exchange_value,
-        #                                   volatile jlong* dest,
-        #                                   jlong compare_value,
-        #                                   bool is_MP)
+        # Support for int64_t Atomic::cmpxchg(int64_t exchange_value,
+        #                                     volatile int64_t* dest,
+        #                                     int64_t compare_value,
+        #                                     bool is_MP)
         #
         .p2align 4,,15
         ELF_TYPE(_Atomic_cmpxchg_long,@function)
@@ -658,8 +658,8 @@
         ret
 
 
-        # Support for jlong Atomic::load and Atomic::store.
-        # void _Atomic_move_long(const volatile jlong* src, volatile jlong* dst)
+        # Support for int64_t Atomic::load and Atomic::store.
+        # void _Atomic_move_long(const volatile int64_t* src, volatile int64_t* dst)
         .p2align 4,,15
         ELF_TYPE(_Atomic_move_long,@function)
 SYMBOL(_Atomic_move_long):
--- a/src/hotspot/os_cpu/bsd_zero/atomic_bsd_zero.hpp	Wed Dec 20 09:14:52 2017 -0800
+++ b/src/hotspot/os_cpu/bsd_zero/atomic_bsd_zero.hpp	Thu Dec 21 00:07:38 2017 +0100
@@ -265,8 +265,8 @@
 template<typename T>
 inline T Atomic::PlatformLoad<8>::operator()(T const volatile* src) const {
   STATIC_ASSERT(8 == sizeof(T));
-  volatile jlong dest;
-  os::atomic_copy64(reinterpret_cast<const volatile jlong*>(src), reinterpret_cast<volatile jlong*>(&dest));
+  volatile int64_t dest;
+  os::atomic_copy64(reinterpret_cast<const volatile int64_t*>(src), reinterpret_cast<volatile int64_t*>(&dest));
   return PrimitiveConversions::cast<T>(dest);
 }
 
@@ -275,7 +275,7 @@
 inline void Atomic::PlatformStore<8>::operator()(T store_value,
                                                  T volatile* dest) const {
   STATIC_ASSERT(8 == sizeof(T));
-  os::atomic_copy64(reinterpret_cast<const volatile jlong*>(&store_value), reinterpret_cast<volatile jlong*>(dest));
+  os::atomic_copy64(reinterpret_cast<const volatile int64_t*>(&store_value), reinterpret_cast<volatile int64_t*>(dest));
 }
 
 #endif // OS_CPU_BSD_ZERO_VM_ATOMIC_BSD_ZERO_HPP
--- a/src/hotspot/os_cpu/linux_arm/atomic_linux_arm.hpp	Wed Dec 20 09:14:52 2017 -0800
+++ b/src/hotspot/os_cpu/linux_arm/atomic_linux_arm.hpp	Thu Dec 21 00:07:38 2017 +0100
@@ -50,7 +50,7 @@
 inline T Atomic::PlatformLoad<8>::operator()(T const volatile* src) const {
   STATIC_ASSERT(8 == sizeof(T));
   return PrimitiveConversions::cast<T>(
-    (*os::atomic_load_long_func)(reinterpret_cast<const volatile jlong*>(src)));
+    (*os::atomic_load_long_func)(reinterpret_cast<const volatile int64_t*>(src)));
 }
 
 template<>
@@ -59,7 +59,7 @@
                                                  T volatile* dest) const {
   STATIC_ASSERT(8 == sizeof(T));
   (*os::atomic_store_long_func)(
-    PrimitiveConversions::cast<jlong>(store_value), reinterpret_cast<volatile jlong*>(dest));
+    PrimitiveConversions::cast<int64_t>(store_value), reinterpret_cast<volatile int64_t*>(dest));
 }
 #endif
 
@@ -103,7 +103,7 @@
     : "memory");
   return val;
 #else
-  return add_using_helper<jint>(os::atomic_add_func, add_value, dest);
+  return add_using_helper<int32_t>(os::atomic_add_func, add_value, dest);
 #endif
 }
 
@@ -146,7 +146,7 @@
     : "memory");
   return old_val;
 #else
-  return xchg_using_helper<jint>(os::atomic_xchg_func, exchange_value, dest);
+  return xchg_using_helper<int32_t>(os::atomic_xchg_func, exchange_value, dest);
 #endif
 }
 
@@ -178,17 +178,17 @@
 
 #ifndef AARCH64
 
-inline jint reorder_cmpxchg_func(jint exchange_value,
-                                 jint volatile* dest,
-                                 jint compare_value) {
+inline int32_t reorder_cmpxchg_func(int32_t exchange_value,
+                                    int32_t volatile* dest,
+                                    int32_t compare_value) {
   // Warning:  Arguments are swapped to avoid moving them for kernel call
   return (*os::atomic_cmpxchg_func)(compare_value, exchange_value, dest);
 }
 
-inline jlong reorder_cmpxchg_long_func(jlong exchange_value,
-                                       jlong volatile* dest,
-                                       jlong compare_value) {
-  assert(VM_Version::supports_cx8(), "Atomic compare and exchange jlong not supported on this architecture!");
+inline int64_t reorder_cmpxchg_long_func(int64_t exchange_value,
+                                         int64_t volatile* dest,
+                                         int64_t compare_value) {
+  assert(VM_Version::supports_cx8(), "Atomic compare and exchange int64_t not supported on this architecture!");
   // Warning:  Arguments are swapped to avoid moving them for kernel call
   return (*os::atomic_cmpxchg_long_func)(compare_value, exchange_value, dest);
 }
@@ -221,7 +221,7 @@
     : "memory");
   return rv;
 #else
-  return cmpxchg_using_helper<jint>(reorder_cmpxchg_func, exchange_value, dest, compare_value);
+  return cmpxchg_using_helper<int32_t>(reorder_cmpxchg_func, exchange_value, dest, compare_value);
 #endif
 }
 
@@ -251,7 +251,7 @@
     : "memory");
   return rv;
 #else
-  return cmpxchg_using_helper<jlong>(reorder_cmpxchg_long_func, exchange_value, dest, compare_value);
+  return cmpxchg_using_helper<int64_t>(reorder_cmpxchg_long_func, exchange_value, dest, compare_value);
 #endif
 }
 
--- a/src/hotspot/os_cpu/linux_arm/os_linux_arm.cpp	Wed Dec 20 09:14:52 2017 -0800
+++ b/src/hotspot/os_cpu/linux_arm/os_linux_arm.cpp	Thu Dec 21 00:07:38 2017 +0100
@@ -598,11 +598,11 @@
 
 #ifndef AARCH64
 
-typedef jlong cmpxchg_long_func_t(jlong, jlong, volatile jlong*);
+typedef int64_t cmpxchg_long_func_t(int64_t, int64_t, volatile int64_t*);
 
 cmpxchg_long_func_t* os::atomic_cmpxchg_long_func = os::atomic_cmpxchg_long_bootstrap;
 
-jlong os::atomic_cmpxchg_long_bootstrap(jlong compare_value, jlong exchange_value, volatile jlong* dest) {
+int64_t os::atomic_cmpxchg_long_bootstrap(int64_t compare_value, int64_t exchange_value, volatile int64_t* dest) {
   // try to use the stub:
   cmpxchg_long_func_t* func = CAST_TO_FN_PTR(cmpxchg_long_func_t*, StubRoutines::atomic_cmpxchg_long_entry());
 
@@ -612,16 +612,16 @@
   }
   assert(Threads::number_of_threads() == 0, "for bootstrap only");
 
-  jlong old_value = *dest;
+  int64_t old_value = *dest;
   if (old_value == compare_value)
     *dest = exchange_value;
   return old_value;
 }
-typedef jlong load_long_func_t(const volatile jlong*);
+typedef int64_t load_long_func_t(const volatile int64_t*);
 
 load_long_func_t* os::atomic_load_long_func = os::atomic_load_long_bootstrap;
 
-jlong os::atomic_load_long_bootstrap(const volatile jlong* src) {
+int64_t os::atomic_load_long_bootstrap(const volatile int64_t* src) {
   // try to use the stub:
   load_long_func_t* func = CAST_TO_FN_PTR(load_long_func_t*, StubRoutines::atomic_load_long_entry());
 
@@ -631,15 +631,15 @@
   }
   assert(Threads::number_of_threads() == 0, "for bootstrap only");
 
-  jlong old_value = *src;
+  int64_t old_value = *src;
   return old_value;
 }
 
-typedef void store_long_func_t(jlong, volatile jlong*);
+typedef void store_long_func_t(int64_t, volatile int64_t*);
 
 store_long_func_t* os::atomic_store_long_func = os::atomic_store_long_bootstrap;
 
-void os::atomic_store_long_bootstrap(jlong val, volatile jlong* dest) {
+void os::atomic_store_long_bootstrap(int64_t val, volatile int64_t* dest) {
   // try to use the stub:
   store_long_func_t* func = CAST_TO_FN_PTR(store_long_func_t*, StubRoutines::atomic_store_long_entry());
 
@@ -652,11 +652,11 @@
   *dest = val;
 }
 
-typedef jint  atomic_add_func_t(jint add_value, volatile jint *dest);
+typedef int32_t  atomic_add_func_t(int32_t add_value, volatile int32_t *dest);
 
 atomic_add_func_t * os::atomic_add_func = os::atomic_add_bootstrap;
 
-jint  os::atomic_add_bootstrap(jint add_value, volatile jint *dest) {
+int32_t  os::atomic_add_bootstrap(int32_t add_value, volatile int32_t *dest) {
   atomic_add_func_t * func = CAST_TO_FN_PTR(atomic_add_func_t*,
                                             StubRoutines::atomic_add_entry());
   if (func != NULL) {
@@ -664,16 +664,16 @@
     return (*func)(add_value, dest);
   }
 
-  jint old_value = *dest;
+  int32_t old_value = *dest;
   *dest = old_value + add_value;
   return (old_value + add_value);
 }
 
-typedef jint  atomic_xchg_func_t(jint exchange_value, volatile jint *dest);
+typedef int32_t  atomic_xchg_func_t(int32_t exchange_value, volatile int32_t *dest);
 
 atomic_xchg_func_t * os::atomic_xchg_func = os::atomic_xchg_bootstrap;
 
-jint  os::atomic_xchg_bootstrap(jint exchange_value, volatile jint *dest) {
+int32_t  os::atomic_xchg_bootstrap(int32_t exchange_value, volatile int32_t *dest) {
   atomic_xchg_func_t * func = CAST_TO_FN_PTR(atomic_xchg_func_t*,
                                             StubRoutines::atomic_xchg_entry());
   if (func != NULL) {
@@ -681,16 +681,16 @@
     return (*func)(exchange_value, dest);
   }
 
-  jint old_value = *dest;
+  int32_t old_value = *dest;
   *dest = exchange_value;
   return (old_value);
 }
 
-typedef jint cmpxchg_func_t(jint, jint, volatile jint*);
+typedef int32_t cmpxchg_func_t(int32_t, int32_t, volatile int32_t*);
 
 cmpxchg_func_t* os::atomic_cmpxchg_func = os::atomic_cmpxchg_bootstrap;
 
-jint os::atomic_cmpxchg_bootstrap(jint compare_value, jint exchange_value, volatile jint* dest) {
+int32_t os::atomic_cmpxchg_bootstrap(int32_t compare_value, int32_t exchange_value, volatile int32_t* dest) {
   // try to use the stub:
   cmpxchg_func_t* func = CAST_TO_FN_PTR(cmpxchg_func_t*, StubRoutines::atomic_cmpxchg_entry());
 
@@ -700,7 +700,7 @@
   }
   assert(Threads::number_of_threads() == 0, "for bootstrap only");
 
-  jint old_value = *dest;
+  int32_t old_value = *dest;
   if (old_value == compare_value)
     *dest = exchange_value;
   return old_value;
--- a/src/hotspot/os_cpu/linux_arm/os_linux_arm.hpp	Wed Dec 20 09:14:52 2017 -0800
+++ b/src/hotspot/os_cpu/linux_arm/os_linux_arm.hpp	Thu Dec 21 00:07:38 2017 +0100
@@ -45,35 +45,35 @@
   static bool register_code_area(char *low, char *high) { return true; }
 
 #ifndef AARCH64
-  static jlong (*atomic_cmpxchg_long_func)(jlong compare_value,
-                                           jlong exchange_value,
-                                           volatile jlong *dest);
+  static int64_t (*atomic_cmpxchg_long_func)(int64_t compare_value,
+                                             int64_t exchange_value,
+                                             volatile int64_t *dest);
 
-  static jlong (*atomic_load_long_func)(const volatile jlong*);
+  static int64_t (*atomic_load_long_func)(const volatile int64_t*);
 
-  static void (*atomic_store_long_func)(jlong, volatile jlong*);
+  static void (*atomic_store_long_func)(int64_t, volatile int64_t*);
 
-  static jint  (*atomic_add_func)(jint add_value, volatile jint *dest);
+  static int32_t  (*atomic_add_func)(int32_t add_value, volatile int32_t *dest);
 
-  static jint  (*atomic_xchg_func)(jint exchange_value, volatile jint *dest);
+  static int32_t  (*atomic_xchg_func)(int32_t exchange_value, volatile int32_t *dest);
 
-  static jint  (*atomic_cmpxchg_func)(jint compare_value,
-                                      jint exchange_value,
-                                      volatile jint *dest);
+  static int32_t  (*atomic_cmpxchg_func)(int32_t compare_value,
+                                         int32_t exchange_value,
+                                         volatile int32_t *dest);
 
-  static jlong atomic_cmpxchg_long_bootstrap(jlong, jlong, volatile jlong*);
+  static int64_t atomic_cmpxchg_long_bootstrap(int64_t, int64_t, volatile int64_t*);
 
-  static jlong atomic_load_long_bootstrap(const volatile jlong*);
+  static int64_t atomic_load_long_bootstrap(const volatile int64_t*);
 
-  static void atomic_store_long_bootstrap(jlong, volatile jlong*);
+  static void atomic_store_long_bootstrap(int64_t, volatile int64_t*);
 
-  static jint  atomic_add_bootstrap(jint add_value, volatile jint *dest);
+  static int32_t  atomic_add_bootstrap(int32_t add_value, volatile int32_t *dest);
 
-  static jint  atomic_xchg_bootstrap(jint exchange_value, volatile jint *dest);
+  static int32_t  atomic_xchg_bootstrap(int32_t exchange_value, volatile int32_t *dest);
 
-  static jint  atomic_cmpxchg_bootstrap(jint compare_value,
-                                        jint exchange_value,
-                                        volatile jint *dest);
+  static int32_t  atomic_cmpxchg_bootstrap(int32_t compare_value,
+                                           int32_t exchange_value,
+                                           volatile int32_t *dest);
 #endif // !AARCH64
 
 #endif // OS_CPU_LINUX_ARM_VM_OS_LINUX_ARM_HPP
--- a/src/hotspot/os_cpu/linux_sparc/os_linux_sparc.hpp	Wed Dec 20 09:14:52 2017 -0800
+++ b/src/hotspot/os_cpu/linux_sparc/os_linux_sparc.hpp	Thu Dec 21 00:07:38 2017 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -28,15 +28,15 @@
   //
   // NOTE: we are back in class os here, not Linux
   //
-  static jint  (*atomic_xchg_func)        (jint,  volatile jint*);
-  static jint  (*atomic_cmpxchg_func)     (jint,  volatile jint*,  jint);
-  static jlong (*atomic_cmpxchg_long_func)(jlong, volatile jlong*, jlong);
-  static jint  (*atomic_add_func)         (jint,  volatile jint*);
+  static int32_t  (*atomic_xchg_func)        (int32_t,  volatile int32_t*);
+  static int32_t  (*atomic_cmpxchg_func)     (int32_t,  volatile int32_t*, int32_t);
+  static int64_t  (*atomic_cmpxchg_long_func)(int64_t,  volatile int64_t*, int64_t);
+  static int32_t  (*atomic_add_func)         (int32_t,  volatile int32_t*);
 
-  static jint  atomic_xchg_bootstrap        (jint,  volatile jint*);
-  static jint  atomic_cmpxchg_bootstrap     (jint,  volatile jint*,  jint);
-  static jlong atomic_cmpxchg_long_bootstrap(jlong, volatile jlong*, jlong);
-  static jint  atomic_add_bootstrap         (jint,  volatile jint*);
+  static int32_t  atomic_xchg_bootstrap        (int32_t,  volatile int32_t*);
+  static int32_t  atomic_cmpxchg_bootstrap     (int32_t,  volatile int32_t*, int32_t);
+  static int64_t  atomic_cmpxchg_long_bootstrap(int64_t,  volatile int64_t*, int64_t);
+  static int32_t  atomic_add_bootstrap         (int32_t,  volatile int32_t*);
 
   static void setup_fpu() {}
 
--- a/src/hotspot/os_cpu/linux_x86/atomic_linux_x86.hpp	Wed Dec 20 09:14:52 2017 -0800
+++ b/src/hotspot/os_cpu/linux_x86/atomic_linux_x86.hpp	Thu Dec 21 00:07:38 2017 +0100
@@ -133,8 +133,8 @@
 
 extern "C" {
   // defined in linux_x86.s
-  jlong _Atomic_cmpxchg_long(jlong, volatile jlong*, jlong);
-  void _Atomic_move_long(const volatile jlong* src, volatile jlong* dst);
+  int64_t _Atomic_cmpxchg_long(int64_t, volatile int64_t*, int64_t);
+  void _Atomic_move_long(const volatile int64_t* src, volatile int64_t* dst);
 }
 
 template<>
@@ -144,15 +144,15 @@
                                                 T compare_value,
                                                 cmpxchg_memory_order order) const {
   STATIC_ASSERT(8 == sizeof(T));
-  return cmpxchg_using_helper<jlong>(_Atomic_cmpxchg_long, exchange_value, dest, compare_value);
+  return cmpxchg_using_helper<int64_t>(_Atomic_cmpxchg_long, exchange_value, dest, compare_value);
 }
 
 template<>
 template<typename T>
 inline T Atomic::PlatformLoad<8>::operator()(T const volatile* src) const {
   STATIC_ASSERT(8 == sizeof(T));
-  volatile jlong dest;
-  _Atomic_move_long(reinterpret_cast<const volatile jlong*>(src), reinterpret_cast<volatile jlong*>(&dest));
+  volatile int64_t dest;
+  _Atomic_move_long(reinterpret_cast<const volatile int64_t*>(src), reinterpret_cast<volatile int64_t*>(&dest));
   return PrimitiveConversions::cast<T>(dest);
 }
 
@@ -161,7 +161,7 @@
 inline void Atomic::PlatformStore<8>::operator()(T store_value,
                                                  T volatile* dest) const {
   STATIC_ASSERT(8 == sizeof(T));
-  _Atomic_move_long(reinterpret_cast<const volatile jlong*>(&store_value), reinterpret_cast<volatile jlong*>(dest));
+  _Atomic_move_long(reinterpret_cast<const volatile int64_t*>(&store_value), reinterpret_cast<volatile int64_t*>(dest));
 }
 
 #endif // AMD64
--- a/src/hotspot/os_cpu/linux_zero/atomic_linux_zero.hpp	Wed Dec 20 09:14:52 2017 -0800
+++ b/src/hotspot/os_cpu/linux_zero/atomic_linux_zero.hpp	Thu Dec 21 00:07:38 2017 +0100
@@ -185,8 +185,8 @@
 template<typename T>
 inline T Atomic::PlatformLoad<8>::operator()(T const volatile* src) const {
   STATIC_ASSERT(8 == sizeof(T));
-  volatile jlong dest;
-  os::atomic_copy64(reinterpret_cast<const volatile jlong*>(src), reinterpret_cast<volatile jlong*>(&dest));
+  volatile int64_t dest;
+  os::atomic_copy64(reinterpret_cast<const volatile int64_t*>(src), reinterpret_cast<volatile int64_t*>(&dest));
   return PrimitiveConversions::cast<T>(dest);
 }
 
@@ -195,7 +195,7 @@
 inline void Atomic::PlatformStore<8>::operator()(T store_value,
                                                  T volatile* dest) const {
   STATIC_ASSERT(8 == sizeof(T));
-  os::atomic_copy64(reinterpret_cast<const volatile jlong*>(&store_value), reinterpret_cast<volatile jlong*>(dest));
+  os::atomic_copy64(reinterpret_cast<const volatile int64_t*>(&store_value), reinterpret_cast<volatile int64_t*>(dest));
 }
 
 #endif // OS_CPU_LINUX_ZERO_VM_ATOMIC_LINUX_ZERO_HPP
--- a/src/hotspot/os_cpu/solaris_sparc/os_solaris_sparc.hpp	Wed Dec 20 09:14:52 2017 -0800
+++ b/src/hotspot/os_cpu/solaris_sparc/os_solaris_sparc.hpp	Thu Dec 21 00:07:38 2017 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -28,15 +28,15 @@
   //
   // NOTE: we are back in class os here, not Solaris
   //
-  static jint  (*atomic_xchg_func)        (jint,  volatile jint*);
-  static jint  (*atomic_cmpxchg_func)     (jint,  volatile jint*,  jint);
-  static jlong (*atomic_cmpxchg_long_func)(jlong, volatile jlong*, jlong);
-  static jint  (*atomic_add_func)         (jint,  volatile jint*);
+  static int32_t  (*atomic_xchg_func)        (int32_t,  volatile int32_t*);
+  static int32_t  (*atomic_cmpxchg_func)     (int32_t,  volatile int32_t*,  int32_t);
+  static int64_t  (*atomic_cmpxchg_long_func)(int64_t,  volatile int64_t*,  int64_t);
+  static int32_t  (*atomic_add_func)         (int32_t,  volatile int32_t*);
 
-  static jint  atomic_xchg_bootstrap        (jint,  volatile jint*);
-  static jint  atomic_cmpxchg_bootstrap     (jint,  volatile jint*,  jint);
-  static jlong atomic_cmpxchg_long_bootstrap(jlong, volatile jlong*, jlong);
-  static jint  atomic_add_bootstrap         (jint,  volatile jint*);
+  static int32_t  atomic_xchg_bootstrap        (int32_t,  volatile int32_t*);
+  static int32_t  atomic_cmpxchg_bootstrap     (int32_t,  volatile int32_t*,  int32_t);
+  static int64_t  atomic_cmpxchg_long_bootstrap(int64_t,  volatile int64_t*,  int64_t);
+  static int32_t  atomic_add_bootstrap         (int32_t,  volatile int32_t*);
 
   static void setup_fpu() {}
 
--- a/src/hotspot/os_cpu/solaris_x86/atomic_solaris_x86.hpp	Wed Dec 20 09:14:52 2017 -0800
+++ b/src/hotspot/os_cpu/solaris_x86/atomic_solaris_x86.hpp	Thu Dec 21 00:07:38 2017 +0100
@@ -28,16 +28,16 @@
 // For Sun Studio - implementation is in solaris_x86_64.il.
 
 extern "C" {
-  jint _Atomic_add(jint add_value, volatile jint* dest);
-  jlong _Atomic_add_long(jlong add_value, volatile jlong* dest);
+  int32_t _Atomic_add(int32_t add_value, volatile int32_t* dest);
+  int64_t _Atomic_add_long(int64_t add_value, volatile int64_t* dest);
 
-  jint _Atomic_xchg(jint exchange_value, volatile jint* dest);
-  jbyte _Atomic_cmpxchg_byte(jbyte exchange_value, volatile jbyte* dest,
-                             jbyte compare_value);
-  jint _Atomic_cmpxchg(jint exchange_value, volatile jint* dest,
-                       jint compare_value);
-  jlong _Atomic_cmpxchg_long(jlong exchange_value, volatile jlong* dest,
-                             jlong compare_value);
+  int32_t _Atomic_xchg(int32_t exchange_value, volatile int32_t* dest);
+  int8_t  _Atomic_cmpxchg_byte(int8_t exchange_value, volatile int8_t* dest,
+                               int8_t compare_value);
+  int32_t _Atomic_cmpxchg(int32_t exchange_value, volatile int32_t* dest,
+                          int32_t compare_value);
+  int64_t _Atomic_cmpxchg_long(int64_t exchange_value, volatile int64_t* dest,
+                               int64_t compare_value);
 }
 
 template<size_t byte_size>
@@ -55,8 +55,8 @@
   STATIC_ASSERT(4 == sizeof(I));
   STATIC_ASSERT(4 == sizeof(D));
   return PrimitiveConversions::cast<D>(
-    _Atomic_add(PrimitiveConversions::cast<jint>(add_value),
-                reinterpret_cast<jint volatile*>(dest)));
+    _Atomic_add(PrimitiveConversions::cast<int32_t>(add_value),
+                reinterpret_cast<int32_t volatile*>(dest)));
 }
 
 // Not using add_using_helper; see comment for cmpxchg.
@@ -66,8 +66,8 @@
   STATIC_ASSERT(8 == sizeof(I));
   STATIC_ASSERT(8 == sizeof(D));
   return PrimitiveConversions::cast<D>(
-    _Atomic_add_long(PrimitiveConversions::cast<jlong>(add_value),
-                     reinterpret_cast<jlong volatile*>(dest)));
+    _Atomic_add_long(PrimitiveConversions::cast<int64_t>(add_value),
+                     reinterpret_cast<int64_t volatile*>(dest)));
 }
 
 template<>
@@ -76,11 +76,11 @@
                                              T volatile* dest) const {
   STATIC_ASSERT(4 == sizeof(T));
   return PrimitiveConversions::cast<T>(
-    _Atomic_xchg(PrimitiveConversions::cast<jint>(exchange_value),
-                 reinterpret_cast<jint volatile*>(dest)));
+    _Atomic_xchg(PrimitiveConversions::cast<int32_t>(exchange_value),
+                 reinterpret_cast<int32_t volatile*>(dest)));
 }
 
-extern "C" jlong _Atomic_xchg_long(jlong exchange_value, volatile jlong* dest);
+extern "C" int64_t _Atomic_xchg_long(int64_t exchange_value, volatile int64_t* dest);
 
 template<>
 template<typename T>
@@ -88,8 +88,8 @@
                                              T volatile* dest) const {
   STATIC_ASSERT(8 == sizeof(T));
   return PrimitiveConversions::cast<T>(
-    _Atomic_xchg_long(PrimitiveConversions::cast<jlong>(exchange_value),
-                      reinterpret_cast<jlong volatile*>(dest)));
+    _Atomic_xchg_long(PrimitiveConversions::cast<int64_t>(exchange_value),
+                      reinterpret_cast<int64_t volatile*>(dest)));
 }
 
 // Not using cmpxchg_using_helper here, because some configurations of
@@ -106,9 +106,9 @@
                                                 cmpxchg_memory_order order) const {
   STATIC_ASSERT(1 == sizeof(T));
   return PrimitiveConversions::cast<T>(
-    _Atomic_cmpxchg_byte(PrimitiveConversions::cast<jbyte>(exchange_value),
-                         reinterpret_cast<jbyte volatile*>(dest),
-                         PrimitiveConversions::cast<jbyte>(compare_value)));
+    _Atomic_cmpxchg_byte(PrimitiveConversions::cast<int8_t>(exchange_value),
+                         reinterpret_cast<int8_t volatile*>(dest),
+                         PrimitiveConversions::cast<int8_t>(compare_value)));
 }
 
 template<>
@@ -119,9 +119,9 @@
                                                 cmpxchg_memory_order order) const {
   STATIC_ASSERT(4 == sizeof(T));
   return PrimitiveConversions::cast<T>(
-    _Atomic_cmpxchg(PrimitiveConversions::cast<jint>(exchange_value),
-                    reinterpret_cast<jint volatile*>(dest),
-                    PrimitiveConversions::cast<jint>(compare_value)));
+    _Atomic_cmpxchg(PrimitiveConversions::cast<int32_t>(exchange_value),
+                    reinterpret_cast<int32_t volatile*>(dest),
+                    PrimitiveConversions::cast<int32_t>(compare_value)));
 }
 
 template<>
@@ -132,9 +132,9 @@
                                                 cmpxchg_memory_order order) const {
   STATIC_ASSERT(8 == sizeof(T));
   return PrimitiveConversions::cast<T>(
-    _Atomic_cmpxchg_long(PrimitiveConversions::cast<jlong>(exchange_value),
-                         reinterpret_cast<jlong volatile*>(dest),
-                         PrimitiveConversions::cast<jlong>(compare_value)));
+    _Atomic_cmpxchg_long(PrimitiveConversions::cast<int64_t>(exchange_value),
+                         reinterpret_cast<int64_t volatile*>(dest),
+                         PrimitiveConversions::cast<int64_t>(compare_value)));
 }
 
 #endif // OS_CPU_SOLARIS_X86_VM_ATOMIC_SOLARIS_X86_HPP
--- a/src/hotspot/os_cpu/solaris_x86/os_solaris_x86.cpp	Wed Dec 20 09:14:52 2017 -0800
+++ b/src/hotspot/os_cpu/solaris_x86/os_solaris_x86.cpp	Thu Dec 21 00:07:38 2017 +0100
@@ -904,12 +904,12 @@
 // until initialization is complete.
 // TODO - replace with .il implementation when compiler supports it.
 
-typedef jint  xchg_func_t        (jint,  volatile jint*);
-typedef jint  cmpxchg_func_t     (jint,  volatile jint*,  jint);
-typedef jlong cmpxchg_long_func_t(jlong, volatile jlong*, jlong);
-typedef jint  add_func_t         (jint,  volatile jint*);
+typedef int32_t  xchg_func_t        (int32_t,  volatile int32_t*);
+typedef int32_t  cmpxchg_func_t     (int32_t,  volatile int32_t*,  int32_t);
+typedef int64_t  cmpxchg_long_func_t(int64_t,  volatile int64_t*,  int64_t);
+typedef int32_t  add_func_t         (int32_t,  volatile int32_t*);
 
-jint os::atomic_xchg_bootstrap(jint exchange_value, volatile jint* dest) {
+int32_t os::atomic_xchg_bootstrap(int32_t exchange_value, volatile int32_t* dest) {
   // try to use the stub:
   xchg_func_t* func = CAST_TO_FN_PTR(xchg_func_t*, StubRoutines::atomic_xchg_entry());
 
@@ -919,12 +919,12 @@
   }
   assert(Threads::number_of_threads() == 0, "for bootstrap only");
 
-  jint old_value = *dest;
+  int32_t old_value = *dest;
   *dest = exchange_value;
   return old_value;
 }
 
-jint os::atomic_cmpxchg_bootstrap(jint exchange_value, volatile jint* dest, jint compare_value) {
+int32_t os::atomic_cmpxchg_bootstrap(int32_t exchange_value, volatile int32_t* dest, int32_t compare_value) {
   // try to use the stub:
   cmpxchg_func_t* func = CAST_TO_FN_PTR(cmpxchg_func_t*, StubRoutines::atomic_cmpxchg_entry());
 
@@ -934,13 +934,13 @@
   }
   assert(Threads::number_of_threads() == 0, "for bootstrap only");
 
-  jint old_value = *dest;
+  int32_t old_value = *dest;
   if (old_value == compare_value)
     *dest = exchange_value;
   return old_value;
 }
 
-jlong os::atomic_cmpxchg_long_bootstrap(jlong exchange_value, volatile jlong* dest, jlong compare_value) {
+int64_t os::atomic_cmpxchg_long_bootstrap(int64_t exchange_value, volatile int64_t* dest, int64_t compare_value) {
   // try to use the stub:
   cmpxchg_long_func_t* func = CAST_TO_FN_PTR(cmpxchg_long_func_t*, StubRoutines::atomic_cmpxchg_long_entry());
 
@@ -950,13 +950,13 @@
   }
   assert(Threads::number_of_threads() == 0, "for bootstrap only");
 
-  jlong old_value = *dest;
+  int64_t old_value = *dest;
   if (old_value == compare_value)
     *dest = exchange_value;
   return old_value;
 }
 
-jint os::atomic_add_bootstrap(jint add_value, volatile jint* dest) {
+int32_t os::atomic_add_bootstrap(int32_t add_value, volatile int32_t* dest) {
   // try to use the stub:
   add_func_t* func = CAST_TO_FN_PTR(add_func_t*, StubRoutines::atomic_add_entry());
 
--- a/src/hotspot/os_cpu/solaris_x86/os_solaris_x86.hpp	Wed Dec 20 09:14:52 2017 -0800
+++ b/src/hotspot/os_cpu/solaris_x86/os_solaris_x86.hpp	Thu Dec 21 00:07:38 2017 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -31,15 +31,15 @@
 #ifdef AMD64
   static void setup_fpu() {}
 #else
-  static jint  (*atomic_xchg_func)        (jint,  volatile jint*);
-  static jint  (*atomic_cmpxchg_func)     (jint,  volatile jint*,  jint);
-  static jlong (*atomic_cmpxchg_long_func)(jlong, volatile jlong*, jlong);
-  static jint  (*atomic_add_func)         (jint,  volatile jint*);
+  static int32_t  (*atomic_xchg_func)        (int32_t,  volatile int32_t*);
+  static int32_t  (*atomic_cmpxchg_func)     (int32_t,  volatile int32_t*, int32_t);
+  static int64_t  (*atomic_cmpxchg_long_func)(int64_t,  volatile int64_t*, int64_t);
+  static int32_t  (*atomic_add_func)         (int32_t,  volatile int32_t*);
 
-  static jint  atomic_xchg_bootstrap        (jint,  volatile jint*);
-  static jint  atomic_cmpxchg_bootstrap     (jint,  volatile jint*,  jint);
-  static jlong atomic_cmpxchg_long_bootstrap(jlong, volatile jlong*, jlong);
-  static jint  atomic_add_bootstrap         (jint,  volatile jint*);
+  static int32_t  atomic_xchg_bootstrap        (int32_t,  volatile int32_t*);
+  static int32_t  atomic_cmpxchg_bootstrap     (int32_t,  volatile int32_t*, int32_t);
+  static int64_t  atomic_cmpxchg_long_bootstrap(int64_t,  volatile int64_t*, int64_t);
+  static int32_t  atomic_add_bootstrap         (int32_t,  volatile int32_t*);
 
   static void setup_fpu();
 #endif // AMD64
--- a/src/hotspot/os_cpu/windows_x86/atomic_windows_x86.hpp	Wed Dec 20 09:14:52 2017 -0800
+++ b/src/hotspot/os_cpu/windows_x86/atomic_windows_x86.hpp	Thu Dec 21 00:07:38 2017 +0100
@@ -54,13 +54,13 @@
 template<>
 template<typename I, typename D>
 inline D Atomic::PlatformAdd<4>::add_and_fetch(I add_value, D volatile* dest) const {
-  return add_using_helper<jint>(os::atomic_add_func, add_value, dest);
+  return add_using_helper<int32_t>(os::atomic_add_func, add_value, dest);
 }
 
 template<>
 template<typename I, typename D>
 inline D Atomic::PlatformAdd<8>::add_and_fetch(I add_value, D volatile* dest) const {
-  return add_using_helper<intptr_t>(os::atomic_add_ptr_func, add_value, dest);
+  return add_using_helper<int64_t>(os::atomic_add_long_func, add_value, dest);
 }
 
 #define DEFINE_STUB_XCHG(ByteSize, StubType, StubName)                  \
@@ -72,8 +72,8 @@
     return xchg_using_helper<StubType>(StubName, exchange_value, dest); \
   }
 
-DEFINE_STUB_XCHG(4, jint, os::atomic_xchg_func)
-DEFINE_STUB_XCHG(8, jlong, os::atomic_xchg_long_func)
+DEFINE_STUB_XCHG(4, int32_t, os::atomic_xchg_func)
+DEFINE_STUB_XCHG(8, int64_t, os::atomic_xchg_long_func)
 
 #undef DEFINE_STUB_XCHG
 
@@ -88,9 +88,9 @@
     return cmpxchg_using_helper<StubType>(StubName, exchange_value, dest, compare_value); \
   }
 
-DEFINE_STUB_CMPXCHG(1, jbyte, os::atomic_cmpxchg_byte_func)
-DEFINE_STUB_CMPXCHG(4, jint,  os::atomic_cmpxchg_func)
-DEFINE_STUB_CMPXCHG(8, jlong, os::atomic_cmpxchg_long_func)
+DEFINE_STUB_CMPXCHG(1, int8_t,  os::atomic_cmpxchg_byte_func)
+DEFINE_STUB_CMPXCHG(4, int32_t, os::atomic_cmpxchg_func)
+DEFINE_STUB_CMPXCHG(8, int64_t, os::atomic_cmpxchg_long_func)
 
 #undef DEFINE_STUB_CMPXCHG
 
@@ -162,10 +162,10 @@
                                                 T compare_value,
                                                 cmpxchg_memory_order order) const {
   STATIC_ASSERT(8 == sizeof(T));
-  jint ex_lo  = (jint)exchange_value;
-  jint ex_hi  = *( ((jint*)&exchange_value) + 1 );
-  jint cmp_lo = (jint)compare_value;
-  jint cmp_hi = *( ((jint*)&compare_value) + 1 );
+  int32_t ex_lo  = (int32_t)exchange_value;
+  int32_t ex_hi  = *( ((int32_t*)&exchange_value) + 1 );
+  int32_t cmp_lo = (int32_t)compare_value;
+  int32_t cmp_hi = *( ((int32_t*)&compare_value) + 1 );
   __asm {
     push ebx
     push edi
--- a/src/hotspot/os_cpu/windows_x86/os_windows_x86.cpp	Wed Dec 20 09:14:52 2017 -0800
+++ b/src/hotspot/os_cpu/windows_x86/os_windows_x86.cpp	Thu Dec 21 00:07:38 2017 +0100
@@ -218,17 +218,17 @@
 
 // Atomics and Stub Functions
 
-typedef jint      xchg_func_t            (jint,     volatile jint*);
-typedef intptr_t  xchg_long_func_t       (jlong,    volatile jlong*);
-typedef jint      cmpxchg_func_t         (jint,     volatile jint*,  jint);
-typedef jbyte     cmpxchg_byte_func_t    (jbyte,    volatile jbyte*, jbyte);
-typedef jlong     cmpxchg_long_func_t    (jlong,    volatile jlong*, jlong);
-typedef jint      add_func_t             (jint,     volatile jint*);
-typedef intptr_t  add_ptr_func_t         (intptr_t, volatile intptr_t*);
+typedef int32_t   xchg_func_t            (int32_t,  volatile int32_t*);
+typedef int64_t   xchg_long_func_t       (int64_t,  volatile int64_t*);
+typedef int32_t   cmpxchg_func_t         (int32_t,  volatile int32_t*, int32_t);
+typedef int8_t    cmpxchg_byte_func_t    (int8_t,   volatile int8_t*,  int8_t);
+typedef int64_t   cmpxchg_long_func_t    (int64_t,  volatile int64_t*, int64_t);
+typedef int32_t   add_func_t             (int32_t,  volatile int32_t*);
+typedef int64_t   add_long_func_t        (int64_t,  volatile int64_t*);
 
 #ifdef AMD64
 
-jint os::atomic_xchg_bootstrap(jint exchange_value, volatile jint* dest) {
+int32_t os::atomic_xchg_bootstrap(int32_t exchange_value, volatile int32_t* dest) {
   // try to use the stub:
   xchg_func_t* func = CAST_TO_FN_PTR(xchg_func_t*, StubRoutines::atomic_xchg_entry());
 
@@ -238,12 +238,12 @@
   }
   assert(Threads::number_of_threads() == 0, "for bootstrap only");
 
-  jint old_value = *dest;
+  int32_t old_value = *dest;
   *dest = exchange_value;
   return old_value;
 }
 
-intptr_t os::atomic_xchg_long_bootstrap(jlong exchange_value, volatile jlong* dest) {
+int64_t os::atomic_xchg_long_bootstrap(int64_t exchange_value, volatile int64_t* dest) {
   // try to use the stub:
   xchg_long_func_t* func = CAST_TO_FN_PTR(xchg_long_func_t*, StubRoutines::atomic_xchg_long_entry());
 
@@ -253,13 +253,13 @@
   }
   assert(Threads::number_of_threads() == 0, "for bootstrap only");
 
-  intptr_t old_value = *dest;
+  int64_t old_value = *dest;
   *dest = exchange_value;
   return old_value;
 }
 
 
-jint os::atomic_cmpxchg_bootstrap(jint exchange_value, volatile jint* dest, jint compare_value) {
+int32_t os::atomic_cmpxchg_bootstrap(int32_t exchange_value, volatile int32_t* dest, int32_t compare_value) {
   // try to use the stub:
   cmpxchg_func_t* func = CAST_TO_FN_PTR(cmpxchg_func_t*, StubRoutines::atomic_cmpxchg_entry());
 
@@ -269,13 +269,13 @@
   }
   assert(Threads::number_of_threads() == 0, "for bootstrap only");
 
-  jint old_value = *dest;
+  int32_t old_value = *dest;
   if (old_value == compare_value)
     *dest = exchange_value;
   return old_value;
 }
 
-jbyte os::atomic_cmpxchg_byte_bootstrap(jbyte exchange_value, volatile jbyte* dest, jbyte compare_value) {
+int8_t os::atomic_cmpxchg_byte_bootstrap(int8_t exchange_value, volatile int8_t* dest, int8_t compare_value) {
   // try to use the stub:
   cmpxchg_byte_func_t* func = CAST_TO_FN_PTR(cmpxchg_byte_func_t*, StubRoutines::atomic_cmpxchg_byte_entry());
 
@@ -285,7 +285,7 @@
   }
   assert(Threads::number_of_threads() == 0, "for bootstrap only");
 
-  jbyte old_value = *dest;
+  int8_t old_value = *dest;
   if (old_value == compare_value)
     *dest = exchange_value;
   return old_value;
@@ -293,7 +293,7 @@
 
 #endif // AMD64
 
-jlong os::atomic_cmpxchg_long_bootstrap(jlong exchange_value, volatile jlong* dest, jlong compare_value) {
+int64_t os::atomic_cmpxchg_long_bootstrap(int64_t exchange_value, volatile int64_t* dest, int64_t compare_value) {
   // try to use the stub:
   cmpxchg_long_func_t* func = CAST_TO_FN_PTR(cmpxchg_long_func_t*, StubRoutines::atomic_cmpxchg_long_entry());
 
@@ -303,7 +303,7 @@
   }
   assert(Threads::number_of_threads() == 0, "for bootstrap only");
 
-  jlong old_value = *dest;
+  int64_t old_value = *dest;
   if (old_value == compare_value)
     *dest = exchange_value;
   return old_value;
@@ -311,7 +311,7 @@
 
 #ifdef AMD64
 
-jint os::atomic_add_bootstrap(jint add_value, volatile jint* dest) {
+int32_t os::atomic_add_bootstrap(int32_t add_value, volatile int32_t* dest) {
   // try to use the stub:
   add_func_t* func = CAST_TO_FN_PTR(add_func_t*, StubRoutines::atomic_add_entry());
 
@@ -324,12 +324,12 @@
   return (*dest) += add_value;
 }
 
-intptr_t os::atomic_add_ptr_bootstrap(intptr_t add_value, volatile intptr_t* dest) {
+int64_t os::atomic_add_long_bootstrap(int64_t add_value, volatile int64_t* dest) {
   // try to use the stub:
-  add_ptr_func_t* func = CAST_TO_FN_PTR(add_ptr_func_t*, StubRoutines::atomic_add_ptr_entry());
+  add_long_func_t* func = CAST_TO_FN_PTR(add_long_func_t*, StubRoutines::atomic_add_long_entry());
 
   if (func != NULL) {
-    os::atomic_add_ptr_func = func;
+    os::atomic_add_long_func = func;
     return (*func)(add_value, dest);
   }
   assert(Threads::number_of_threads() == 0, "for bootstrap only");
@@ -342,7 +342,7 @@
 cmpxchg_func_t*      os::atomic_cmpxchg_func      = os::atomic_cmpxchg_bootstrap;
 cmpxchg_byte_func_t* os::atomic_cmpxchg_byte_func = os::atomic_cmpxchg_byte_bootstrap;
 add_func_t*          os::atomic_add_func          = os::atomic_add_bootstrap;
-add_ptr_func_t*      os::atomic_add_ptr_func      = os::atomic_add_ptr_bootstrap;
+add_long_func_t*     os::atomic_add_long_func     = os::atomic_add_long_bootstrap;
 
 #endif // AMD64
 
--- a/src/hotspot/os_cpu/windows_x86/os_windows_x86.hpp	Wed Dec 20 09:14:52 2017 -0800
+++ b/src/hotspot/os_cpu/windows_x86/os_windows_x86.hpp	Thu Dec 21 00:07:38 2017 +0100
@@ -29,32 +29,32 @@
   // NOTE: we are back in class os here, not win32
   //
 #ifdef AMD64
-  static jint      (*atomic_xchg_func)          (jint,      volatile jint*);
-  static intptr_t  (*atomic_xchg_long_func)     (jlong,     volatile jlong*);
+  static int32_t   (*atomic_xchg_func)          (int32_t, volatile int32_t*);
+  static int64_t   (*atomic_xchg_long_func)     (int64_t, volatile int64_t*);
 
-  static jint      (*atomic_cmpxchg_func)       (jint,      volatile jint*,  jint);
-  static jbyte     (*atomic_cmpxchg_byte_func)  (jbyte,     volatile jbyte*, jbyte);
-  static jlong     (*atomic_cmpxchg_long_func)  (jlong,     volatile jlong*, jlong);
+  static int32_t   (*atomic_cmpxchg_func)       (int32_t,  volatile int32_t*, int32_t);
+  static int8_t    (*atomic_cmpxchg_byte_func)  (int8_t,   volatile int8_t*,  int8_t);
+  static int64_t   (*atomic_cmpxchg_long_func)  (int64_t,  volatile int64_t*, int64_t);
 
-  static jint      (*atomic_add_func)           (jint,      volatile jint*);
-  static intptr_t  (*atomic_add_ptr_func)       (intptr_t,  volatile intptr_t*);
+  static int32_t   (*atomic_add_func)           (int32_t,  volatile int32_t*);
+  static int64_t   (*atomic_add_long_func)      (int64_t,  volatile int64_t*);
 
-  static jint      atomic_xchg_bootstrap        (jint,      volatile jint*);
-  static intptr_t  atomic_xchg_long_bootstrap   (jlong,     volatile jlong*);
+  static int32_t   atomic_xchg_bootstrap        (int32_t,  volatile int32_t*);
+  static int64_t   atomic_xchg_long_bootstrap   (int64_t,  volatile int64_t*);
 
-  static jint      atomic_cmpxchg_bootstrap     (jint,      volatile jint*,  jint);
-  static jbyte     atomic_cmpxchg_byte_bootstrap(jbyte,     volatile jbyte*, jbyte);
+  static int32_t   atomic_cmpxchg_bootstrap     (int32_t,  volatile int32_t*, int32_t);
+  static int8_t    atomic_cmpxchg_byte_bootstrap(int8_t,   volatile int8_t*,  int8_t);
 #else
 
-  static jlong (*atomic_cmpxchg_long_func)  (jlong, volatile jlong*, jlong);
+  static int64_t (*atomic_cmpxchg_long_func)  (int64_t, volatile int64_t*, int64_t);
 
 #endif // AMD64
 
-  static jlong atomic_cmpxchg_long_bootstrap(jlong, volatile jlong*, jlong);
+  static int64_t atomic_cmpxchg_long_bootstrap(int64_t, volatile int64_t*, int64_t);
 
 #ifdef AMD64
-  static jint      atomic_add_bootstrap         (jint,      volatile jint*);
-  static intptr_t  atomic_add_ptr_bootstrap     (intptr_t,  volatile intptr_t*);
+  static int32_t  atomic_add_bootstrap         (int32_t,  volatile int32_t*);
+  static int64_t  atomic_add_long_bootstrap    (int64_t,  volatile int64_t*);
 #endif // AMD64
 
   static void setup_fpu();
--- a/src/hotspot/share/classfile/classListParser.cpp	Wed Dec 20 09:14:52 2017 -0800
+++ b/src/hotspot/share/classfile/classListParser.cpp	Thu Dec 21 00:07:38 2017 +0100
@@ -315,12 +315,13 @@
   return k;
 }
 
-InstanceKlass* ClassListParser::load_current_class(TRAPS) {
+Klass* ClassListParser::load_current_class(TRAPS) {
   TempNewSymbol class_name_symbol = SymbolTable::new_symbol(_class_name, THREAD);
   guarantee(!HAS_PENDING_EXCEPTION, "Exception creating a symbol.");
 
-  InstanceKlass *klass = NULL;
+  Klass *klass = NULL;
   if (!is_loading_from_source()) {
+    // Load classes for the boot/platform/app loaders only.
     if (is_super_specified()) {
       error("If source location is not specified, super class must not be specified");
     }
@@ -330,40 +331,36 @@
 
     bool non_array = !FieldType::is_array(class_name_symbol);
 
-    Handle s = java_lang_String::create_from_symbol(class_name_symbol, CHECK_0);
-    // Translate to external class name format, i.e., convert '/' chars to '.'
-    Handle string = java_lang_String::externalize_classname(s, CHECK_0);
     JavaValue result(T_OBJECT);
-    InstanceKlass* spec_klass =  non_array ?
-      SystemDictionary::ClassLoader_klass() : SystemDictionary::Class_klass();
-    Symbol* method_name = non_array ?
-      vmSymbols::loadClass_name() : vmSymbols::forName_name();
-    Handle loader = Handle(THREAD, SystemDictionary::java_system_loader());
+    if (non_array) {
+      // At this point, we are executing in the context of the boot loader. We
+      // cannot call Class.forName because that is context dependent and
+      // would load only classes for the boot loader.
+      //
+      // Instead, let's call java_system_loader().loadClass() directly, which will
+      // delegate to the correct loader (boot, platform or app) depending on
+      // the class name.
 
-    if (non_array) {
+      Handle s = java_lang_String::create_from_symbol(class_name_symbol, CHECK_0);
+      // ClassLoader.loadClass() wants external class name format, i.e., convert '/' chars to '.'
+      Handle ext_class_name = java_lang_String::externalize_classname(s, CHECK_0);
+      Handle loader = Handle(THREAD, SystemDictionary::java_system_loader());
+
       JavaCalls::call_virtual(&result,
                               loader, //SystemDictionary::java_system_loader(),
-                              spec_klass,
-                              method_name, //vmSymbols::loadClass_name(),
+                              SystemDictionary::ClassLoader_klass(),
+                              vmSymbols::loadClass_name(),
                               vmSymbols::string_class_signature(),
-                              string,
+                              ext_class_name,
                               THREAD);
     } else {
-      JavaCalls::call_static(&result,
-                             spec_klass,
-                             method_name,
-                             vmSymbols::string_class_signature(),
-                             string,
-                             CHECK_NULL);
+      // array classes are not supported in class list.
+      THROW_NULL(vmSymbols::java_lang_ClassNotFoundException());
     }
     assert(result.get_type() == T_OBJECT, "just checking");
     oop obj = (oop) result.get_jobject();
     if (!HAS_PENDING_EXCEPTION && (obj != NULL)) {
-      if (non_array) {
-        klass = InstanceKlass::cast(java_lang_Class::as_Klass(obj));
-      } else {
-        klass = static_cast<InstanceKlass*>(java_lang_Class::array_klass_acquire(obj));
-      }
+      klass = java_lang_Class::as_Klass(obj);
     } else { // load classes in bootclasspath/a
       if (HAS_PENDING_EXCEPTION) {
         CLEAR_PENDING_EXCEPTION;
@@ -372,7 +369,7 @@
       if (non_array) {
         Klass* k = SystemDictionary::resolve_or_null(class_name_symbol, CHECK_NULL);
         if (k != NULL) {
-          klass = InstanceKlass::cast(k);
+          klass = k;
         } else {
           if (!HAS_PENDING_EXCEPTION) {
             THROW_NULL(vmSymbols::java_lang_ClassNotFoundException());
@@ -388,14 +385,15 @@
     }
   }
 
-  if (klass != NULL && is_id_specified()) {
+  if (klass != NULL && klass->is_instance_klass() && is_id_specified()) {
+    InstanceKlass* ik = InstanceKlass::cast(klass);
     int id = this->id();
-    SystemDictionaryShared::update_shared_entry(klass, id);
+    SystemDictionaryShared::update_shared_entry(ik, id);
     InstanceKlass* old = table()->lookup(id);
-    if (old != NULL && old != klass) {
+    if (old != NULL && old != ik) {
       error("Duplicated ID %d for class %s", id, _class_name);
     }
-    table()->add(id, klass);
+    table()->add(id, ik);
   }
 
   return klass;
--- a/src/hotspot/share/classfile/classListParser.hpp	Wed Dec 20 09:14:52 2017 -0800
+++ b/src/hotspot/share/classfile/classListParser.hpp	Thu Dec 21 00:07:38 2017 +0100
@@ -136,7 +136,7 @@
     return _class_name;
   }
 
-  InstanceKlass* load_current_class(TRAPS);
+  Klass* load_current_class(TRAPS);
 
   bool is_loading_from_source();
 
--- a/src/hotspot/share/classfile/classLoader.cpp	Wed Dec 20 09:14:52 2017 -0800
+++ b/src/hotspot/share/classfile/classLoader.cpp	Thu Dec 21 00:07:38 2017 +0100
@@ -802,6 +802,14 @@
   int end = 0;
   bool set_base_piece = true;
 
+#if INCLUDE_CDS
+  if (DumpSharedSpaces) {
+    if (!Arguments::has_jimage()) {
+      vm_exit_during_initialization("CDS is not supported in exploded JDK build", NULL);
+    }
+  }
+#endif
+
   // Iterate over class path entries
   for (int start = 0; start < len; start = end) {
     while (class_path[end] && class_path[end] != os::path_separator()[0]) {
--- a/src/hotspot/share/classfile/classLoaderData.cpp	Wed Dec 20 09:14:52 2017 -0800
+++ b/src/hotspot/share/classfile/classLoaderData.cpp	Thu Dec 21 00:07:38 2017 +0100
@@ -574,9 +574,9 @@
     ls.cr();
   }
 
-  // In some rare cases items added to this list will not be freed elsewhere.
-  // To keep it simple, just free everything in it here.
-  free_deallocate_list();
+  // Some items on the _deallocate_list need to free their C heap structures
+  // if they are not already on the _klasses list.
+  unload_deallocate_list();
 
   // Clean up global class iterator for compiler
   static_klass_iterator.adjust_saved_class(this);
@@ -755,6 +755,7 @@
 }
 
 void ClassLoaderData::remove_handle(OopHandle h) {
+  assert(!is_unloading(), "Do not remove a handle for a CLD that is unloading");
   oop* ptr = h.ptr_raw();
   if (ptr != NULL) {
     assert(_handles.contains(ptr), "Got unexpected handle " PTR_FORMAT, p2i(ptr));
@@ -799,6 +800,7 @@
 void ClassLoaderData::free_deallocate_list() {
   // Don't need lock, at safepoint
   assert(SafepointSynchronize::is_at_safepoint(), "only called at safepoint");
+  assert(!is_unloading(), "only called for ClassLoaderData that are not unloading");
   if (_deallocate_list == NULL) {
     return;
   }
@@ -828,6 +830,29 @@
   }
 }
 
+// This is distinct from free_deallocate_list.  For class loader data that are
+// unloading, this frees the C heap memory for constant pools on the list.  If there
+// were C heap memory allocated for methods, it would free that too.  The C heap memory
+// for InstanceKlasses on this list is freed in the ClassLoaderData destructor.
+void ClassLoaderData::unload_deallocate_list() {
+  // Don't need lock, at safepoint
+  assert(SafepointSynchronize::is_at_safepoint(), "only called at safepoint");
+  assert(is_unloading(), "only called for ClassLoaderData that are unloading");
+  if (_deallocate_list == NULL) {
+    return;
+  }
+  // Go backwards because this removes entries that are freed.
+  for (int i = _deallocate_list->length() - 1; i >= 0; i--) {
+    Metadata* m = _deallocate_list->at(i);
+    assert (!m->on_stack(), "wouldn't be unloading if this were so");
+    _deallocate_list->remove_at(i);
+    // Only constant pool entries have C heap memory to free.
+    if (m->is_constantPool()) {
+      ((ConstantPool*)m)->release_C_heap_structures();
+    }
+  }
+}
+
 // These anonymous class loaders are to contain classes used for JSR292
 ClassLoaderData* ClassLoaderData::anonymous_class_loader_data(oop loader, TRAPS) {
   // Add a new class loader data to the graph.
--- a/src/hotspot/share/classfile/classLoaderData.hpp	Wed Dec 20 09:14:52 2017 -0800
+++ b/src/hotspot/share/classfile/classLoaderData.hpp	Thu Dec 21 00:07:38 2017 +0100
@@ -307,7 +307,8 @@
   void packages_do(void f(PackageEntry*));
 
   // Deallocate free list during class unloading.
-  void free_deallocate_list();
+  void free_deallocate_list();      // for the classes that are not unloaded
+  void unload_deallocate_list();    // for the classes that are unloaded
 
   // Allocate out of this class loader data
   MetaWord* allocate(size_t size);
--- a/src/hotspot/share/classfile/defaultMethods.cpp	Wed Dec 20 09:14:52 2017 -0800
+++ b/src/hotspot/share/classfile/defaultMethods.cpp	Thu Dec 21 00:07:38 2017 +0100
@@ -26,6 +26,7 @@
 #include "classfile/bytecodeAssembler.hpp"
 #include "classfile/defaultMethods.hpp"
 #include "classfile/symbolTable.hpp"
+#include "classfile/systemDictionary.hpp"
 #include "logging/log.hpp"
 #include "logging/logStream.hpp"
 #include "memory/allocation.hpp"
@@ -683,10 +684,11 @@
   Symbol* _method_name;
   Symbol* _method_signature;
   StatefulMethodFamily*  _family;
+  bool _cur_class_is_interface;
 
  public:
-  FindMethodsByErasedSig(Symbol* name, Symbol* signature) :
-      _method_name(name), _method_signature(signature),
+  FindMethodsByErasedSig(Symbol* name, Symbol* signature, bool is_interf) :
+      _method_name(name), _method_signature(signature), _cur_class_is_interface(is_interf),
       _family(NULL) {}
 
   void get_discovered_family(MethodFamily** family) {
@@ -709,14 +711,17 @@
     InstanceKlass* iklass = current_class();
 
     Method* m = iklass->find_method(_method_name, _method_signature);
-    // private interface methods are not candidates for default methods
-    // invokespecial to private interface methods doesn't use default method logic
-    // private class methods are not candidates for default methods,
-    // private methods do not override default methods, so need to perform
-    // default method inheritance without including private methods
-    // The overpasses are your supertypes' errors, we do not include them
-    // future: take access controls into account for superclass methods
-    if (m != NULL && !m->is_static() && !m->is_overpass() && !m->is_private()) {
+    // Private interface methods are not candidates for default methods.
+    // invokespecial to private interface methods doesn't use default method logic.
+    // Private class methods are not candidates for default methods.
+    // Private methods do not override default methods, so need to perform
+    // default method inheritance without including private methods.
+    // The overpasses are your supertypes' errors, we do not include them.
+    // Non-public methods in java.lang.Object are not candidates for default
+    // methods.
+    // Future: take access controls into account for superclass methods
+    if (m != NULL && !m->is_static() && !m->is_overpass() && !m->is_private() &&
+     (!_cur_class_is_interface || !SystemDictionary::is_nonpublic_Object_method(m))) {
       if (_family == NULL) {
         _family = new StatefulMethodFamily();
       }
@@ -726,8 +731,8 @@
         scope->add_mark(restorer);
       } else {
         // This is the rule that methods in classes "win" (bad word) over
-        // methods in interfaces. This works because of single inheritance
-        // private methods in classes do not "win", they will be found
+        // methods in interfaces. This works because of single inheritance.
+        // Private methods in classes do not "win", they will be found
         // first on searching, but overriding for invokevirtual needs
         // to find default method candidates for the same signature
         _family->set_target_if_empty(m);
@@ -745,10 +750,10 @@
 
 static void generate_erased_defaults(
      InstanceKlass* klass, GrowableArray<EmptyVtableSlot*>* empty_slots,
-     EmptyVtableSlot* slot, TRAPS) {
+     EmptyVtableSlot* slot, bool is_intf, TRAPS) {
 
   // sets up a set of methods with the same exact erased signature
-  FindMethodsByErasedSig visitor(slot->name(), slot->signature());
+  FindMethodsByErasedSig visitor(slot->name(), slot->signature(), is_intf);
   visitor.run(klass);
 
   MethodFamily* family;
@@ -817,7 +822,7 @@
       slot->print_on(&ls);
       ls.cr();
     }
-    generate_erased_defaults(klass, empty_slots, slot, CHECK);
+    generate_erased_defaults(klass, empty_slots, slot, klass->is_interface(), CHECK);
   }
   log_debug(defaultmethods)("Creating defaults and overpasses...");
   create_defaults_and_exceptions(empty_slots, klass, CHECK);
--- a/src/hotspot/share/classfile/systemDictionary.hpp	Wed Dec 20 09:14:52 2017 -0800
+++ b/src/hotspot/share/classfile/systemDictionary.hpp	Thu Dec 21 00:07:38 2017 +0100
@@ -649,6 +649,12 @@
   static bool is_platform_class_loader(oop class_loader);
   static void clear_invoke_method_table();
 
+  // Returns TRUE if the method is a non-public member of class java.lang.Object.
+  static bool is_nonpublic_Object_method(Method* m) {
+    assert(m != NULL, "Unexpected NULL Method*");
+    return !m->is_public() && m->method_holder() == SystemDictionary::Object_klass();
+  }
+
 protected:
   static InstanceKlass* find_shared_class(Symbol* class_name);
 
--- a/src/hotspot/share/compiler/compileBroker.cpp	Wed Dec 20 09:14:52 2017 -0800
+++ b/src/hotspot/share/compiler/compileBroker.cpp	Thu Dec 21 00:07:38 2017 +0100
@@ -1852,17 +1852,23 @@
     TraceTime t1("compilation", &time);
     EventCompilation event;
 
-    JVMCIEnv env(task, system_dictionary_modification_counter);
-    methodHandle method(thread, target_handle);
-    jvmci->compile_method(method, osr_bci, &env);
-
-    post_compile(thread, task, event, task->code() != NULL, NULL);
+    // Skip redefined methods
+    if (target_handle->is_old()) {
+        failure_reason = "redefined method";
+        retry_message = "not retryable";
+        compilable = ciEnv::MethodCompilable_never;
+    } else {
+        JVMCIEnv env(task, system_dictionary_modification_counter);
+        methodHandle method(thread, target_handle);
+        jvmci->compile_method(method, osr_bci, &env);
 
-    failure_reason = env.failure_reason();
-    if (!env.retryable()) {
-      retry_message = "not retryable";
-      compilable = ciEnv::MethodCompilable_not_at_tier;
+        failure_reason = env.failure_reason();
+        if (!env.retryable()) {
+          retry_message = "not retryable";
+          compilable = ciEnv::MethodCompilable_not_at_tier;
+        }
     }
+    post_compile(thread, task, event, task->code() != NULL, NULL);
 
   } else
 #endif // INCLUDE_JVMCI
--- a/src/hotspot/share/gc/g1/g1AllocRegion.cpp	Wed Dec 20 09:14:52 2017 -0800
+++ b/src/hotspot/share/gc/g1/g1AllocRegion.cpp	Thu Dec 21 00:07:38 2017 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -42,17 +42,17 @@
 
   // Make sure that any allocation attempt on this region will fail
   // and will not trigger any asserts.
-  assert(allocate(dummy_region, 1, false) == NULL, "should fail");
-  assert(par_allocate(dummy_region, 1, false) == NULL, "should fail");
-  assert(allocate(dummy_region, 1, true) == NULL, "should fail");
-  assert(par_allocate(dummy_region, 1, true) == NULL, "should fail");
+  assert(dummy_region->allocate_no_bot_updates(1) == NULL, "should fail");
+  assert(dummy_region->allocate(1) == NULL, "should fail");
+  DEBUG_ONLY(size_t assert_tmp);
+  assert(dummy_region->par_allocate_no_bot_updates(1, 1, &assert_tmp) == NULL, "should fail");
+  assert(dummy_region->par_allocate(1, 1, &assert_tmp) == NULL, "should fail");
 
   _g1h = g1h;
   _dummy_region = dummy_region;
 }
 
-size_t G1AllocRegion::fill_up_remaining_space(HeapRegion* alloc_region,
-                                              bool bot_updates) {
+size_t G1AllocRegion::fill_up_remaining_space(HeapRegion* alloc_region) {
   assert(alloc_region != NULL && alloc_region != _dummy_region,
          "pre-condition");
   size_t result = 0;
@@ -74,7 +74,7 @@
   size_t min_word_size_to_fill = CollectedHeap::min_fill_size();
 
   while (free_word_size >= min_word_size_to_fill) {
-    HeapWord* dummy = par_allocate(alloc_region, free_word_size, bot_updates);
+    HeapWord* dummy = par_allocate(alloc_region, free_word_size);
     if (dummy != NULL) {
       // If the allocation was successful we should fill in the space.
       CollectedHeap::fill_with_object(dummy, free_word_size);
@@ -110,7 +110,7 @@
                            "the alloc region should never be empty");
 
     if (fill_up) {
-      result = fill_up_remaining_space(alloc_region, _bot_updates);
+      result = fill_up_remaining_space(alloc_region);
     }
 
     assert_alloc_region(alloc_region->used() >= _used_bytes_before, "invariant");
@@ -135,7 +135,7 @@
     new_alloc_region->reset_pre_dummy_top();
     // Need to do this before the allocation
     _used_bytes_before = new_alloc_region->used();
-    HeapWord* result = allocate(new_alloc_region, word_size, _bot_updates);
+    HeapWord* result = allocate(new_alloc_region, word_size);
     assert_alloc_region(result != NULL, "the allocation should succeeded");
 
     OrderAccess::storestore();
@@ -301,7 +301,7 @@
       // possible object. In this case this region will not be retained, so the
       // original problem cannot occur.
       if (to_allocate_words >= G1CollectedHeap::min_fill_size()) {
-        HeapWord* dummy = attempt_allocation(to_allocate_words, true /* bot_updates */);
+        HeapWord* dummy = attempt_allocation(to_allocate_words);
         CollectedHeap::fill_with_object(dummy, to_allocate_words);
       }
     }
--- a/src/hotspot/share/gc/g1/g1AllocRegion.hpp	Wed Dec 20 09:14:52 2017 -0800
+++ b/src/hotspot/share/gc/g1/g1AllocRegion.hpp	Thu Dec 21 00:07:38 2017 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -83,37 +83,27 @@
   // whether the _alloc_region is NULL or not.
   static HeapRegion* _dummy_region;
 
-  // Some of the methods below take a bot_updates parameter. Its value
-  // should be the same as the _bot_updates field. The idea is that
-  // the parameter will be a constant for a particular alloc region
-  // and, given that these methods will be hopefully inlined, the
-  // compiler should compile out the test.
-
   // Perform a non-MT-safe allocation out of the given region.
-  static inline HeapWord* allocate(HeapRegion* alloc_region,
-                                   size_t word_size,
-                                   bool bot_updates);
+  inline HeapWord* allocate(HeapRegion* alloc_region,
+                            size_t word_size);
 
   // Perform a MT-safe allocation out of the given region.
-  static inline HeapWord* par_allocate(HeapRegion* alloc_region,
-                                       size_t word_size,
-                                       bool bot_updates);
+  inline HeapWord* par_allocate(HeapRegion* alloc_region,
+                                size_t word_size);
   // Perform a MT-safe allocation out of the given region, with the given
   // minimum and desired size. Returns the actual size allocated (between
   // minimum and desired size) in actual_word_size if the allocation has been
   // successful.
-  static inline HeapWord* par_allocate(HeapRegion* alloc_region,
-                                       size_t min_word_size,
-                                       size_t desired_word_size,
-                                       size_t* actual_word_size,
-                                       bool bot_updates);
+  inline HeapWord* par_allocate(HeapRegion* alloc_region,
+                                size_t min_word_size,
+                                size_t desired_word_size,
+                                size_t* actual_word_size);
 
   // Ensure that the region passed as a parameter has been filled up
   // so that noone else can allocate out of it any more.
   // Returns the number of bytes that have been wasted by filled up
   // the space.
-  static size_t fill_up_remaining_space(HeapRegion* alloc_region,
-                                        bool bot_updates);
+  size_t fill_up_remaining_space(HeapRegion* alloc_region);
 
   // After a region is allocated by alloc_new_region, this
   // method is used to set it as the active alloc_region
@@ -160,8 +150,7 @@
   // First-level allocation: Should be called without holding a
   // lock. It will try to allocate lock-free out of the active region,
   // or return NULL if it was unable to.
-  inline HeapWord* attempt_allocation(size_t word_size,
-                                      bool bot_updates);
+  inline HeapWord* attempt_allocation(size_t word_size);
   // Perform an allocation out of the current allocation region, with the given
   // minimum and desired size. Returns the actual size allocated (between
   // minimum and desired size) in actual_word_size if the allocation has been
@@ -170,8 +159,7 @@
   // out of the active region, or return NULL if it was unable to.
   inline HeapWord* attempt_allocation(size_t min_word_size,
                                       size_t desired_word_size,
-                                      size_t* actual_word_size,
-                                      bool bot_updates);
+                                      size_t* actual_word_size);
 
   // Second-level allocation: Should be called while holding a
   // lock. It will try to first allocate lock-free out of the active
@@ -179,23 +167,20 @@
   // alloc region with a new one. We require that the caller takes the
   // appropriate lock before calling this so that it is easier to make
   // it conform to its locking protocol.
-  inline HeapWord* attempt_allocation_locked(size_t word_size,
-                                             bool bot_updates);
+  inline HeapWord* attempt_allocation_locked(size_t word_size);
   // Same as attempt_allocation_locked(size_t, bool), but allowing specification
   // of minimum word size of the block in min_word_size, and the maximum word
   // size of the allocation in desired_word_size. The actual size of the block is
   // returned in actual_word_size.
   inline HeapWord* attempt_allocation_locked(size_t min_word_size,
                                              size_t desired_word_size,
-                                             size_t* actual_word_size,
-                                             bool bot_updates);
+                                             size_t* actual_word_size);
 
   // Should be called to allocate a new region even if the max of this
   // type of regions has been reached. Should only be called if other
   // allocation attempts have failed and we are not holding a valid
   // active region.
-  inline HeapWord* attempt_allocation_force(size_t word_size,
-                                            bool bot_updates);
+  inline HeapWord* attempt_allocation_force(size_t word_size);
 
   // Should be called before we start using this object.
   void init();
@@ -236,7 +221,7 @@
   virtual void retire_region(HeapRegion* alloc_region, size_t allocated_bytes);
 
   virtual size_t retire(bool fill_up);
-public:
+
   G1GCAllocRegion(const char* name, bool bot_updates, G1EvacStats* stats, InCSetState::in_cset_state_t purpose)
   : G1AllocRegion(name, bot_updates), _stats(stats), _purpose(purpose) {
     assert(stats != NULL, "Must pass non-NULL PLAB statistics");
--- a/src/hotspot/share/gc/g1/g1AllocRegion.inline.hpp	Wed Dec 20 09:14:52 2017 -0800
+++ b/src/hotspot/share/gc/g1/g1AllocRegion.inline.hpp	Thu Dec 21 00:07:38 2017 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -37,52 +37,47 @@
 
 
 inline HeapWord* G1AllocRegion::allocate(HeapRegion* alloc_region,
-                                         size_t word_size,
-                                         bool bot_updates) {
+                                         size_t word_size) {
   assert(alloc_region != NULL, "pre-condition");
 
-  if (!bot_updates) {
+  if (!_bot_updates) {
     return alloc_region->allocate_no_bot_updates(word_size);
   } else {
     return alloc_region->allocate(word_size);
   }
 }
 
-inline HeapWord* G1AllocRegion::par_allocate(HeapRegion* alloc_region, size_t word_size, bool bot_updates) {
+inline HeapWord* G1AllocRegion::par_allocate(HeapRegion* alloc_region, size_t word_size) {
   size_t temp;
-  return par_allocate(alloc_region, word_size, word_size, &temp, bot_updates);
+  return par_allocate(alloc_region, word_size, word_size, &temp);
 }
 
 inline HeapWord* G1AllocRegion::par_allocate(HeapRegion* alloc_region,
                                              size_t min_word_size,
                                              size_t desired_word_size,
-                                             size_t* actual_word_size,
-                                             bool bot_updates) {
+                                             size_t* actual_word_size) {
   assert(alloc_region != NULL, "pre-condition");
   assert(!alloc_region->is_empty(), "pre-condition");
 
-  if (!bot_updates) {
+  if (!_bot_updates) {
     return alloc_region->par_allocate_no_bot_updates(min_word_size, desired_word_size, actual_word_size);
   } else {
     return alloc_region->par_allocate(min_word_size, desired_word_size, actual_word_size);
   }
 }
 
-inline HeapWord* G1AllocRegion::attempt_allocation(size_t word_size, bool bot_updates) {
+inline HeapWord* G1AllocRegion::attempt_allocation(size_t word_size) {
   size_t temp;
-  return attempt_allocation(word_size, word_size, &temp, bot_updates);
+  return attempt_allocation(word_size, word_size, &temp);
 }
 
 inline HeapWord* G1AllocRegion::attempt_allocation(size_t min_word_size,
                                                    size_t desired_word_size,
-                                                   size_t* actual_word_size,
-                                                   bool bot_updates) {
-  assert_alloc_region(bot_updates == _bot_updates, "pre-condition");
-
+                                                   size_t* actual_word_size) {
   HeapRegion* alloc_region = _alloc_region;
   assert_alloc_region(alloc_region != NULL, "not initialized properly");
 
-  HeapWord* result = par_allocate(alloc_region, min_word_size, desired_word_size, actual_word_size, bot_updates);
+  HeapWord* result = par_allocate(alloc_region, min_word_size, desired_word_size, actual_word_size);
   if (result != NULL) {
     trace("alloc", min_word_size, desired_word_size, *actual_word_size, result);
     return result;
@@ -91,19 +86,18 @@
   return NULL;
 }
 
-inline HeapWord* G1AllocRegion::attempt_allocation_locked(size_t word_size, bool bot_updates) {
+inline HeapWord* G1AllocRegion::attempt_allocation_locked(size_t word_size) {
   size_t temp;
-  return attempt_allocation_locked(word_size, word_size, &temp, bot_updates);
+  return attempt_allocation_locked(word_size, word_size, &temp);
 }
 
 inline HeapWord* G1AllocRegion::attempt_allocation_locked(size_t min_word_size,
                                                           size_t desired_word_size,
-                                                          size_t* actual_word_size,
-                                                          bool bot_updates) {
+                                                          size_t* actual_word_size) {
   // First we have to redo the allocation, assuming we're holding the
   // appropriate lock, in case another thread changed the region while
   // we were waiting to get the lock.
-  HeapWord* result = attempt_allocation(min_word_size, desired_word_size, actual_word_size, bot_updates);
+  HeapWord* result = attempt_allocation(min_word_size, desired_word_size, actual_word_size);
   if (result != NULL) {
     return result;
   }
@@ -119,9 +113,7 @@
   return NULL;
 }
 
-inline HeapWord* G1AllocRegion::attempt_allocation_force(size_t word_size,
-                                                         bool bot_updates) {
-  assert_alloc_region(bot_updates == _bot_updates, "pre-condition");
+inline HeapWord* G1AllocRegion::attempt_allocation_force(size_t word_size) {
   assert_alloc_region(_alloc_region != NULL, "not initialized properly");
 
   trace("forcing alloc", word_size, word_size);
--- a/src/hotspot/share/gc/g1/g1Allocator.cpp	Wed Dec 20 09:14:52 2017 -0800
+++ b/src/hotspot/share/gc/g1/g1Allocator.cpp	Thu Dec 21 00:07:38 2017 +0100
@@ -190,14 +190,12 @@
 
   HeapWord* result = survivor_gc_alloc_region(context)->attempt_allocation(min_word_size,
                                                                            desired_word_size,
-                                                                           actual_word_size,
-                                                                           false /* bot_updates */);
+                                                                           actual_word_size);
   if (result == NULL && !survivor_is_full(context)) {
     MutexLockerEx x(FreeList_lock, Mutex::_no_safepoint_check_flag);
     result = survivor_gc_alloc_region(context)->attempt_allocation_locked(min_word_size,
                                                                           desired_word_size,
-                                                                          actual_word_size,
-                                                                          false /* bot_updates */);
+                                                                          actual_word_size);
     if (result == NULL) {
       set_survivor_full(context);
     }
@@ -217,14 +215,12 @@
 
   HeapWord* result = old_gc_alloc_region(context)->attempt_allocation(min_word_size,
                                                                       desired_word_size,
-                                                                      actual_word_size,
-                                                                      true /* bot_updates */);
+                                                                      actual_word_size);
   if (result == NULL && !old_is_full(context)) {
     MutexLockerEx x(FreeList_lock, Mutex::_no_safepoint_check_flag);
     result = old_gc_alloc_region(context)->attempt_allocation_locked(min_word_size,
                                                                      desired_word_size,
-                                                                     actual_word_size,
-                                                                     true /* bot_updates */);
+                                                                     actual_word_size);
     if (result == NULL) {
       set_old_full(context);
     }
--- a/src/hotspot/share/gc/g1/g1Allocator.inline.hpp	Wed Dec 20 09:14:52 2017 -0800
+++ b/src/hotspot/share/gc/g1/g1Allocator.inline.hpp	Thu Dec 21 00:07:38 2017 +0100
@@ -30,18 +30,18 @@
 #include "gc/shared/plab.inline.hpp"
 
 HeapWord* G1Allocator::attempt_allocation(size_t word_size, AllocationContext_t context) {
-  return mutator_alloc_region(context)->attempt_allocation(word_size, false /* bot_updates */);
+  return mutator_alloc_region(context)->attempt_allocation(word_size);
 }
 
 HeapWord* G1Allocator::attempt_allocation_locked(size_t word_size, AllocationContext_t context) {
-  HeapWord* result = mutator_alloc_region(context)->attempt_allocation_locked(word_size, false /* bot_updates */);
+  HeapWord* result = mutator_alloc_region(context)->attempt_allocation_locked(word_size);
   assert(result != NULL || mutator_alloc_region(context)->get() == NULL,
          "Must not have a mutator alloc region if there is no memory, but is " PTR_FORMAT, p2i(mutator_alloc_region(context)->get()));
   return result;
 }
 
 HeapWord* G1Allocator::attempt_allocation_force(size_t word_size, AllocationContext_t context) {
-  return mutator_alloc_region(context)->attempt_allocation_force(word_size, false /* bot_updates */);
+  return mutator_alloc_region(context)->attempt_allocation_force(word_size);
 }
 
 inline HeapWord* G1PLABAllocator::plab_allocate(InCSetState dest,
--- a/src/hotspot/share/jvmci/jvmciCompilerToVM.cpp	Wed Dec 20 09:14:52 2017 -0800
+++ b/src/hotspot/share/jvmci/jvmciCompilerToVM.cpp	Thu Dec 21 00:07:38 2017 +0100
@@ -761,6 +761,10 @@
 
 C2V_VMENTRY(jboolean, isCompilable,(JNIEnv *, jobject, jobject jvmci_method))
   methodHandle method = CompilerToVM::asMethod(jvmci_method);
+  // Skip redefined methods
+  if (method->is_old()) {
+    return false;
+  }
   return !method->is_not_compilable(CompLevel_full_optimization);
 C2V_END
 
--- a/src/hotspot/share/memory/metaspace.cpp	Wed Dec 20 09:14:52 2017 -0800
+++ b/src/hotspot/share/memory/metaspace.cpp	Thu Dec 21 00:07:38 2017 +0100
@@ -3695,7 +3695,6 @@
   MaxMetaspaceExpansion = align_down_bounded(MaxMetaspaceExpansion, _commit_alignment);
 
   CompressedClassSpaceSize = align_down_bounded(CompressedClassSpaceSize, _reserve_alignment);
-  set_compressed_class_space_size(CompressedClassSpaceSize);
 
   // Initial virtual space size will be calculated at global_initialize()
   size_t min_metaspace_sz =
@@ -3714,6 +3713,7 @@
                   min_metaspace_sz);
   }
 
+  set_compressed_class_space_size(CompressedClassSpaceSize);
 }
 
 void Metaspace::global_initialize() {
--- a/src/hotspot/share/memory/metaspaceShared.cpp	Wed Dec 20 09:14:52 2017 -0800
+++ b/src/hotspot/share/memory/metaspaceShared.cpp	Thu Dec 21 00:07:38 2017 +0100
@@ -1627,14 +1627,16 @@
           log_trace(cds)("Shared spaces preloaded: %s", klass->external_name());
         }
 
-        InstanceKlass* ik = InstanceKlass::cast(klass);
+        if (klass->is_instance_klass()) {
+          InstanceKlass* ik = InstanceKlass::cast(klass);
 
-        // Link the class to cause the bytecodes to be rewritten and the
-        // cpcache to be created. The linking is done as soon as classes
-        // are loaded in order that the related data structures (klass and
-        // cpCache) are located together.
-        try_link_class(ik, THREAD);
-        guarantee(!HAS_PENDING_EXCEPTION, "exception in link_class");
+          // Link the class to cause the bytecodes to be rewritten and the
+          // cpcache to be created. The linking is done as soon as classes
+          // are loaded in order that the related data structures (klass and
+          // cpCache) are located together.
+          try_link_class(ik, THREAD);
+          guarantee(!HAS_PENDING_EXCEPTION, "exception in link_class");
+        }
 
         class_count++;
       }
--- a/src/hotspot/share/oops/cpCache.cpp	Wed Dec 20 09:14:52 2017 -0800
+++ b/src/hotspot/share/oops/cpCache.cpp	Thu Dec 21 00:07:38 2017 +0100
@@ -177,6 +177,7 @@
       // instruction somehow links to a non-interface method (in Object).
       // In that case, the method has no itable index and must be invoked as a virtual.
       // Set a flag to keep track of this corner case.
+      assert(method->is_public(), "Calling non-public method in Object with invokeinterface");
       change_to_virtual = true;
 
       // ...and fall through as if we were handling invokevirtual:
--- a/src/hotspot/share/oops/klassVtable.cpp	Wed Dec 20 09:14:52 2017 -0800
+++ b/src/hotspot/share/oops/klassVtable.cpp	Thu Dec 21 00:07:38 2017 +0100
@@ -86,13 +86,14 @@
 
   GrowableArray<Method*> new_mirandas(20);
   // compute the number of mirandas methods that must be added to the end
-  get_mirandas(&new_mirandas, all_mirandas, super, methods, NULL, local_interfaces);
+  get_mirandas(&new_mirandas, all_mirandas, super, methods, NULL, local_interfaces,
+               class_flags.is_interface());
   *num_new_mirandas = new_mirandas.length();
 
   // Interfaces do not need interface methods in their vtables
   // This includes miranda methods and during later processing, default methods
   if (!class_flags.is_interface()) {
-    vtable_length += *num_new_mirandas * vtableEntry::size();
+     vtable_length += *num_new_mirandas * vtableEntry::size();
   }
 
   if (Universe::is_bootstrapping() && vtable_length == 0) {
@@ -454,8 +455,13 @@
     } else {
       super_method = method_at(i);
     }
-    // Check if method name matches
-    if (super_method->name() == name && super_method->signature() == signature) {
+    // Check if method name matches.  Ignore match if klass is an interface and the
+    // matching method is a non-public java.lang.Object method.  (See JVMS 5.4.3.4)
+    // This is safe because the method at this slot should never get invoked.
+    // (TBD: put in a method to throw NoSuchMethodError if this slot is ever used.)
+    if (super_method->name() == name && super_method->signature() == signature &&
+        (!_klass->is_interface() ||
+         !SystemDictionary::is_nonpublic_Object_method(super_method))) {
 
       // get super_klass for method_holder for the found method
       InstanceKlass* super_klass =  super_method->method_holder();
@@ -713,7 +719,7 @@
   if (mhk->is_interface()) {
     assert(m->is_public(), "should be public");
     assert(ik()->implements_interface(method_holder) , "this class should implement the interface");
-    if (is_miranda(m, ik()->methods(), ik()->default_methods(), ik()->super())) {
+    if (is_miranda(m, ik()->methods(), ik()->default_methods(), ik()->super(), klass()->is_interface())) {
       return true;
     }
   }
@@ -738,7 +744,10 @@
 // During the first run, the current instanceKlass has not yet been
 // created, the superclasses and superinterfaces do have instanceKlasses
 // but may not have vtables, the default_methods list is empty, no overpasses.
-// This is seen by default method creation.
+// Default method generation uses the all_mirandas array as the starter set for
+// maximally-specific default method calculation.  So, for both classes and
+// interfaces, it is necessary that the first pass will find all non-private
+// interface instance methods, whether or not they are concrete.
 //
 // Pass 2: recalculated during vtable initialization: only include abstract methods.
 // The goal of pass 2 is to walk through the superinterfaces to see if any of
@@ -772,7 +781,8 @@
 // Part of the Miranda Rights in the US mean that if you do not have
 // an attorney one will be appointed for you.
 bool klassVtable::is_miranda(Method* m, Array<Method*>* class_methods,
-                             Array<Method*>* default_methods, const Klass* super) {
+                             Array<Method*>* default_methods, const Klass* super,
+                             bool is_interface) {
   if (m->is_static() || m->is_private() || m->is_overpass()) {
     return false;
   }
@@ -800,8 +810,11 @@
 
   for (const Klass* cursuper = super; cursuper != NULL; cursuper = cursuper->super())
   {
-     if (InstanceKlass::cast(cursuper)->find_local_method(name, signature,
-           Klass::find_overpass, Klass::skip_static, Klass::skip_private) != NULL) {
+     Method* found_mth = InstanceKlass::cast(cursuper)->find_local_method(name, signature,
+       Klass::find_overpass, Klass::skip_static, Klass::skip_private);
+     // Ignore non-public methods in java.lang.Object if klass is an interface.
+     if (found_mth != NULL && (!is_interface ||
+         !SystemDictionary::is_nonpublic_Object_method(found_mth))) {
        return false;
      }
   }
@@ -820,7 +833,7 @@
 void klassVtable::add_new_mirandas_to_lists(
     GrowableArray<Method*>* new_mirandas, GrowableArray<Method*>* all_mirandas,
     Array<Method*>* current_interface_methods, Array<Method*>* class_methods,
-    Array<Method*>* default_methods, const Klass* super) {
+    Array<Method*>* default_methods, const Klass* super, bool is_interface) {
 
   // iterate thru the current interface's method to see if it a miranda
   int num_methods = current_interface_methods->length();
@@ -839,7 +852,7 @@
     }
 
     if (!is_duplicate) { // we don't want duplicate miranda entries in the vtable
-      if (is_miranda(im, class_methods, default_methods, super)) { // is it a miranda at all?
+      if (is_miranda(im, class_methods, default_methods, super, is_interface)) { // is it a miranda at all?
         const InstanceKlass *sk = InstanceKlass::cast(super);
         // check if it is a duplicate of a super's miranda
         if (sk->lookup_method_in_all_interfaces(im->name(), im->signature(), Klass::find_defaults) == NULL) {
@@ -858,7 +871,8 @@
                                const Klass* super,
                                Array<Method*>* class_methods,
                                Array<Method*>* default_methods,
-                               Array<Klass*>* local_interfaces) {
+                               Array<Klass*>* local_interfaces,
+                               bool is_interface) {
   assert((new_mirandas->length() == 0) , "current mirandas must be 0");
 
   // iterate thru the local interfaces looking for a miranda
@@ -867,7 +881,7 @@
     InstanceKlass *ik = InstanceKlass::cast(local_interfaces->at(i));
     add_new_mirandas_to_lists(new_mirandas, all_mirandas,
                               ik->methods(), class_methods,
-                              default_methods, super);
+                              default_methods, super, is_interface);
     // iterate thru each local's super interfaces
     Array<Klass*>* super_ifs = ik->transitive_interfaces();
     int num_super_ifs = super_ifs->length();
@@ -875,7 +889,7 @@
       InstanceKlass *sik = InstanceKlass::cast(super_ifs->at(j));
       add_new_mirandas_to_lists(new_mirandas, all_mirandas,
                                 sik->methods(), class_methods,
-                                default_methods, super);
+                                default_methods, super, is_interface);
     }
   }
 }
@@ -888,7 +902,8 @@
 int klassVtable::fill_in_mirandas(int initialized) {
   GrowableArray<Method*> mirandas(20);
   get_mirandas(&mirandas, NULL, ik()->super(), ik()->methods(),
-               ik()->default_methods(), ik()->local_interfaces());
+               ik()->default_methods(), ik()->local_interfaces(),
+               klass()->is_interface());
   for (int i = 0; i < mirandas.length(); i++) {
     if (log_develop_is_enabled(Trace, vtables)) {
       Method* meth = mirandas.at(i);
--- a/src/hotspot/share/oops/klassVtable.hpp	Wed Dec 20 09:14:52 2017 -0800
+++ b/src/hotspot/share/oops/klassVtable.hpp	Thu Dec 21 00:07:38 2017 +0100
@@ -144,21 +144,24 @@
   bool is_miranda_entry_at(int i);
   int fill_in_mirandas(int initialized);
   static bool is_miranda(Method* m, Array<Method*>* class_methods,
-                         Array<Method*>* default_methods, const Klass* super);
+                         Array<Method*>* default_methods, const Klass* super,
+                         bool is_interface);
   static void add_new_mirandas_to_lists(
       GrowableArray<Method*>* new_mirandas,
       GrowableArray<Method*>* all_mirandas,
       Array<Method*>* current_interface_methods,
       Array<Method*>* class_methods,
       Array<Method*>* default_methods,
-      const Klass* super);
+      const Klass* super,
+      bool is_interface);
   static void get_mirandas(
       GrowableArray<Method*>* new_mirandas,
       GrowableArray<Method*>* all_mirandas,
       const Klass* super,
       Array<Method*>* class_methods,
       Array<Method*>* default_methods,
-      Array<Klass*>* local_interfaces);
+      Array<Klass*>* local_interfaces,
+      bool is_interface);
   void verify_against(outputStream* st, klassVtable* vt, int index);
   inline InstanceKlass* ik() const;
   // When loading a class from CDS archive at run time, and no class redefintion
--- a/src/hotspot/share/opto/library_call.cpp	Wed Dec 20 09:14:52 2017 -0800
+++ b/src/hotspot/share/opto/library_call.cpp	Thu Dec 21 00:07:38 2017 +0100
@@ -1789,10 +1789,19 @@
     return StubRoutines::dexp() != NULL ?
       runtime_math(OptoRuntime::Math_D_D_Type(), StubRoutines::dexp(),  "dexp") :
       runtime_math(OptoRuntime::Math_D_D_Type(), FN_PTR(SharedRuntime::dexp),  "EXP");
-  case vmIntrinsics::_dpow:
-    return StubRoutines::dpow() != NULL ?
-      runtime_math(OptoRuntime::Math_DD_D_Type(), StubRoutines::dpow(), "dpow") :
+  case vmIntrinsics::_dpow: {
+    Node* exp = round_double_node(argument(2));
+    const TypeD* d = _gvn.type(exp)->isa_double_constant();
+    if (d != NULL && d->getd() == 2.0) {
+      // Special case: pow(x, 2.0) => x * x
+      Node* base = round_double_node(argument(0));
+      set_result(_gvn.transform(new MulDNode(base, base)));
+      return true;
+    }
+    return StubRoutines::dexp() != NULL ?
+      runtime_math(OptoRuntime::Math_DD_D_Type(), StubRoutines::dpow(),  "dpow") :
       runtime_math(OptoRuntime::Math_DD_D_Type(), FN_PTR(SharedRuntime::dpow),  "POW");
+  }
 #undef FN_PTR
 
    // These intrinsics are not yet correctly implemented
--- a/src/hotspot/share/prims/jniCheck.cpp	Wed Dec 20 09:14:52 2017 -0800
+++ b/src/hotspot/share/prims/jniCheck.cpp	Thu Dec 21 00:07:38 2017 +0100
@@ -826,7 +826,10 @@
     }
     jint result = UNCHECKED()->EnsureLocalCapacity(env, capacity);
     if (result == JNI_OK) {
-      add_planned_handle_capacity(thr->active_handles(), capacity);
+      // increase local ref capacity if needed
+      if ((size_t)capacity > thr->active_handles()->get_planned_capacity()) {
+        add_planned_handle_capacity(thr->active_handles(), capacity);
+      }
     }
     functionExit(thr);
     return result;
--- a/src/hotspot/share/prims/whitebox.cpp	Wed Dec 20 09:14:52 2017 -0800
+++ b/src/hotspot/share/prims/whitebox.cpp	Thu Dec 21 00:07:38 2017 +0100
@@ -1727,10 +1727,16 @@
 
 WB_ENTRY(jboolean, WB_IsCDSIncludedInVmBuild(JNIEnv* env))
 #if INCLUDE_CDS
+# ifdef _LP64
+    if (!UseCompressedOops || !UseCompressedClassPointers) {
+      // On 64-bit VMs, CDS is supported only with compressed oops/pointers
+      return false;
+    }
+# endif // _LP64
   return true;
 #else
   return false;
-#endif
+#endif // INCLUDE_CDS
 WB_END
 
 
--- a/src/hotspot/share/runtime/arguments.cpp	Wed Dec 20 09:14:52 2017 -0800
+++ b/src/hotspot/share/runtime/arguments.cpp	Thu Dec 21 00:07:38 2017 +0100
@@ -200,7 +200,9 @@
   _writeable = writeable;
 }
 
-AgentLibrary::AgentLibrary(const char* name, const char* options, bool is_absolute_path, void* os_lib) {
+AgentLibrary::AgentLibrary(const char* name, const char* options,
+               bool is_absolute_path, void* os_lib,
+               bool instrument_lib) {
   _name = AllocateHeap(strlen(name)+1, mtArguments);
   strcpy(_name, name);
   if (options == NULL) {
@@ -214,6 +216,7 @@
   _next = NULL;
   _state = agent_invalid;
   _is_static_lib = false;
+  _is_instrument_lib = instrument_lib;
 }
 
 // Check if head of 'option' matches 'name', and sets 'tail' to the remaining
@@ -290,6 +293,10 @@
   _agentList.add(new AgentLibrary(name, options, absolute_path, NULL));
 }
 
+void Arguments::add_instrument_agent(const char* name, char* options, bool absolute_path) {
+  _agentList.add(new AgentLibrary(name, options, absolute_path, NULL, true));
+}
+
 // Late-binding agents not started via arguments
 void Arguments::add_loaded_agent(AgentLibrary *agentLib) {
   _agentList.add(agentLib);
@@ -497,7 +504,7 @@
   { "MaxRAMFraction",               JDK_Version::jdk(10),  JDK_Version::undefined(), JDK_Version::undefined() },
   { "MinRAMFraction",               JDK_Version::jdk(10),  JDK_Version::undefined(), JDK_Version::undefined() },
   { "InitialRAMFraction",           JDK_Version::jdk(10),  JDK_Version::undefined(), JDK_Version::undefined() },
-  { "UseMembar",                    JDK_Version::jdk(10), JDK_Version::jdk(11), JDK_Version::jdk(12) },
+  { "UseMembar",                    JDK_Version::jdk(10), JDK_Version::undefined(), JDK_Version::undefined() },
   { "FastTLABRefill",               JDK_Version::jdk(10), JDK_Version::jdk(11), JDK_Version::jdk(12) },
   { "SafepointSpinBeforeYield",     JDK_Version::jdk(10), JDK_Version::jdk(11), JDK_Version::jdk(12) },
   { "DeferThrSuspendLoopCount",     JDK_Version::jdk(10), JDK_Version::jdk(11), JDK_Version::jdk(12) },
@@ -2797,7 +2804,7 @@
         size_t length = strlen(tail) + 1;
         char *options = NEW_C_HEAP_ARRAY(char, length, mtArguments);
         jio_snprintf(options, length, "%s", tail);
-        add_init_agent("instrument", options, false);
+        add_instrument_agent("instrument", options, false);
         // java agents need module java.instrument
         if (!create_numbered_property("jdk.module.addmods", "java.instrument", addmods_count++)) {
           return JNI_ENOMEM;
--- a/src/hotspot/share/runtime/arguments.hpp	Wed Dec 20 09:14:52 2017 -0800
+++ b/src/hotspot/share/runtime/arguments.hpp	Thu Dec 21 00:07:38 2017 +0100
@@ -142,6 +142,7 @@
   void*           _os_lib;
   bool            _is_absolute_path;
   bool            _is_static_lib;
+  bool            _is_instrument_lib;
   AgentState      _state;
   AgentLibrary*   _next;
 
@@ -154,13 +155,15 @@
   void set_os_lib(void* os_lib)             { _os_lib = os_lib; }
   AgentLibrary* next() const                { return _next; }
   bool is_static_lib() const                { return _is_static_lib; }
+  bool is_instrument_lib() const            { return _is_instrument_lib; }
   void set_static_lib(bool is_static_lib)   { _is_static_lib = is_static_lib; }
   bool valid()                              { return (_state == agent_valid); }
   void set_valid()                          { _state = agent_valid; }
   void set_invalid()                        { _state = agent_invalid; }
 
   // Constructor
-  AgentLibrary(const char* name, const char* options, bool is_absolute_path, void* os_lib);
+  AgentLibrary(const char* name, const char* options, bool is_absolute_path,
+               void* os_lib, bool instrument_lib=false);
 };
 
 // maintain an order of entry list of AgentLibrary
@@ -337,6 +340,7 @@
   // -agentlib and -agentpath arguments
   static AgentLibraryList _agentList;
   static void add_init_agent(const char* name, char* options, bool absolute_path);
+  static void add_instrument_agent(const char* name, char* options, bool absolute_path);
 
   // Late-binding agents not started via arguments
   static void add_loaded_agent(AgentLibrary *agentLib);
--- a/src/hotspot/share/runtime/atomic.hpp	Wed Dec 20 09:14:52 2017 -0800
+++ b/src/hotspot/share/runtime/atomic.hpp	Thu Dec 21 00:07:38 2017 +0100
@@ -45,8 +45,8 @@
 
 class Atomic : AllStatic {
 public:
-  // Atomic operations on jlong types are not available on all 32-bit
-  // platforms. If atomic ops on jlongs are defined here they must only
+  // Atomic operations on int64 types are not available on all 32-bit
+  // platforms. If atomic ops on int64 are defined here they must only
   // be used from code that verifies they are available at runtime and
   // can provide an alternative action if not - see supports_cx8() for
   // a means to test availability.
@@ -639,16 +639,16 @@
 //
 // Use the ATOMIC_SHORT_PAIR macro (see macros.hpp) to get the desired alignment.
 template<>
-struct Atomic::AddImpl<jshort, jshort> VALUE_OBJ_CLASS_SPEC {
-  jshort operator()(jshort add_value, jshort volatile* dest) const {
+struct Atomic::AddImpl<short, short> VALUE_OBJ_CLASS_SPEC {
+  short operator()(short add_value, short volatile* dest) const {
 #ifdef VM_LITTLE_ENDIAN
     assert((intx(dest) & 0x03) == 0x02, "wrong alignment");
-    jint new_value = Atomic::add(add_value << 16, (volatile jint*)(dest-1));
+    int new_value = Atomic::add(add_value << 16, (volatile int*)(dest-1));
 #else
     assert((intx(dest) & 0x03) == 0x00, "wrong alignment");
-    jint new_value = Atomic::add(add_value << 16, (volatile jint*)(dest));
+    int new_value = Atomic::add(add_value << 16, (volatile int*)(dest));
 #endif
-    return (jshort)(new_value >> 16); // preserves sign
+    return (short)(new_value >> 16); // preserves sign
   }
 };
 
@@ -807,7 +807,7 @@
   do {
     // value to swap in matches current value ...
     uint32_t new_value = cur;
-    // ... except for the one jbyte we want to update
+    // ... except for the one byte we want to update
     reinterpret_cast<uint8_t*>(&new_value)[offset] = canon_exchange_value;
 
     uint32_t res = cmpxchg(new_value, aligned_dest, cur, order);
--- a/src/hotspot/share/runtime/java.cpp	Wed Dec 20 09:14:52 2017 -0800
+++ b/src/hotspot/share/runtime/java.cpp	Thu Dec 21 00:07:38 2017 +0100
@@ -357,7 +357,7 @@
     MemTracker::final_report(tty);
   }
 
-  ThreadsSMRSupport::log_smr_statistics();
+  ThreadsSMRSupport::log_statistics();
 }
 
 #else // PRODUCT MODE STATISTICS
@@ -399,7 +399,7 @@
     Method::print_touched_methods(tty);
   }
 
-  ThreadsSMRSupport::log_smr_statistics();
+  ThreadsSMRSupport::log_statistics();
 }
 
 #endif
--- a/src/hotspot/share/runtime/jniHandles.cpp	Wed Dec 20 09:14:52 2017 -0800
+++ b/src/hotspot/share/runtime/jniHandles.cpp	Thu Dec 21 00:07:38 2017 +0100
@@ -47,6 +47,7 @@
   } else {
     Thread* thread = Thread::current();
     assert(Universe::heap()->is_in_reserved(obj), "sanity check");
+    assert(!current_thread_in_native(), "must not be in native");
     return thread->active_handles()->allocate_handle(obj);
   }
 }
@@ -59,6 +60,8 @@
     return NULL;                // ignore null handles
   } else {
     assert(Universe::heap()->is_in_reserved(obj), "sanity check");
+    assert(thread->is_Java_thread(), "not a Java thread");
+    assert(!current_thread_in_native(), "must not be in native");
     return thread->active_handles()->allocate_handle(obj);
   }
 }
@@ -70,6 +73,7 @@
   } else {
     JavaThread* thread = JavaThread::thread_from_jni_environment(env);
     assert(Universe::heap()->is_in_reserved(obj), "sanity check");
+    assert(!current_thread_in_native(), "must not be in native");
     return thread->active_handles()->allocate_handle(obj);
   }
 }
@@ -77,6 +81,7 @@
 
 jobject JNIHandles::make_global(Handle obj) {
   assert(!Universe::heap()->is_gc_active(), "can't extend the root set during GC");
+  assert(!current_thread_in_native(), "must not be in native");
   jobject res = NULL;
   if (!obj.is_null()) {
     // ignore null handles
@@ -93,6 +98,7 @@
 
 jobject JNIHandles::make_weak_global(Handle obj) {
   assert(!Universe::heap()->is_gc_active(), "can't extend the root set during GC");
+  assert(!current_thread_in_native(), "must not be in native");
   jobject res = NULL;
   if (!obj.is_null()) {
     // ignore null handles
@@ -265,6 +271,13 @@
   weak_oops_do(&verify_handle);
 }
 
+// This method is implemented here to avoid circular includes between
+// jniHandles.hpp and thread.hpp.
+bool JNIHandles::current_thread_in_native() {
+  Thread* thread = Thread::current();
+  return (thread->is_Java_thread() &&
+          JavaThread::current()->thread_state() == _thread_in_native);
+}
 
 
 void jni_handles_init() {
--- a/src/hotspot/share/runtime/jniHandles.hpp	Wed Dec 20 09:14:52 2017 -0800
+++ b/src/hotspot/share/runtime/jniHandles.hpp	Thu Dec 21 00:07:38 2017 +0100
@@ -48,6 +48,10 @@
   template<bool external_guard> inline static oop resolve_impl(jobject handle);
   template<bool external_guard> static oop resolve_jweak(jweak handle);
 
+  // This method is not inlined in order to avoid circular includes between
+  // this header file and thread.hpp.
+  static bool current_thread_in_native();
+
  public:
   // Low tag bit in jobject used to distinguish a jweak.  jweak is
   // type equivalent to jobject, but there are places where we need to
@@ -230,6 +234,7 @@
 template<bool external_guard>
 inline oop JNIHandles::resolve_impl(jobject handle) {
   assert(handle != NULL, "precondition");
+  assert(!current_thread_in_native(), "must not be in native");
   oop result;
   if (is_jweak(handle)) {       // Unlikely
     result = resolve_jweak<external_guard>(handle);
--- a/src/hotspot/share/runtime/safepoint.cpp	Wed Dec 20 09:14:52 2017 -0800
+++ b/src/hotspot/share/runtime/safepoint.cpp	Thu Dec 21 00:07:38 2017 +0100
@@ -103,7 +103,7 @@
 
   int nof_threads = Threads::number_of_threads();
 
-  log_debug(safepoint)("Safepoint synchronization initiated. (%d)", nof_threads);
+  log_debug(safepoint)("Safepoint synchronization initiated. (%d threads)", nof_threads);
 
   RuntimeService::record_safepoint_begin();
 
@@ -407,9 +407,7 @@
   // Update the count of active JNI critical regions
   GCLocker::set_jni_lock_count(_current_jni_active_count);
 
-  if (log_is_enabled(Debug, safepoint)) {
-    log_debug(safepoint)("Entering safepoint region: %s", VMThread::vm_safepoint_description());
-  }
+  log_info(safepoint)("Entering safepoint region: %s", VMThread::vm_safepoint_description());
 
   RuntimeService::record_safepoint_synchronized();
   if (PrintSafepointStatistics) {
@@ -496,14 +494,14 @@
           cur_state->restart(); // TSS _running
           SafepointMechanism::disarm_local_poll(current); // release store, local state -> polling page
         }
-        log_debug(safepoint)("Leaving safepoint region");
+        log_info(safepoint)("Leaving safepoint region");
       } else {
         // Set to not synchronized, so the threads will not go into the signal_thread_blocked method
         // when they get restarted.
         _state = _not_synchronized;
         OrderAccess::fence();
 
-        log_debug(safepoint)("Leaving safepoint region");
+        log_info(safepoint)("Leaving safepoint region");
 
         // Start suspended threads
         jtiwh.rewind();
--- a/src/hotspot/share/runtime/stubRoutines.cpp	Wed Dec 20 09:14:52 2017 -0800
+++ b/src/hotspot/share/runtime/stubRoutines.cpp	Thu Dec 21 00:07:38 2017 +0100
@@ -62,12 +62,11 @@
 address StubRoutines::_atomic_xchg_entry                        = NULL;
 address StubRoutines::_atomic_xchg_long_entry                   = NULL;
 address StubRoutines::_atomic_store_entry                       = NULL;
-address StubRoutines::_atomic_store_ptr_entry                   = NULL;
 address StubRoutines::_atomic_cmpxchg_entry                     = NULL;
 address StubRoutines::_atomic_cmpxchg_byte_entry                = NULL;
 address StubRoutines::_atomic_cmpxchg_long_entry                = NULL;
 address StubRoutines::_atomic_add_entry                         = NULL;
-address StubRoutines::_atomic_add_ptr_entry                     = NULL;
+address StubRoutines::_atomic_add_long_entry                    = NULL;
 address StubRoutines::_fence_entry                              = NULL;
 address StubRoutines::_d2i_wrapper                              = NULL;
 address StubRoutines::_d2l_wrapper                              = NULL;
--- a/src/hotspot/share/runtime/stubRoutines.hpp	Wed Dec 20 09:14:52 2017 -0800
+++ b/src/hotspot/share/runtime/stubRoutines.hpp	Thu Dec 21 00:07:38 2017 +0100
@@ -103,12 +103,11 @@
   static address _atomic_xchg_entry;
   static address _atomic_xchg_long_entry;
   static address _atomic_store_entry;
-  static address _atomic_store_ptr_entry;
   static address _atomic_cmpxchg_entry;
   static address _atomic_cmpxchg_byte_entry;
   static address _atomic_cmpxchg_long_entry;
   static address _atomic_add_entry;
-  static address _atomic_add_ptr_entry;
+  static address _atomic_add_long_entry;
   static address _fence_entry;
   static address _d2i_wrapper;
   static address _d2l_wrapper;
@@ -277,12 +276,11 @@
   static address atomic_xchg_entry()                       { return _atomic_xchg_entry; }
   static address atomic_xchg_long_entry()                  { return _atomic_xchg_long_entry; }
   static address atomic_store_entry()                      { return _atomic_store_entry; }
-  static address atomic_store_ptr_entry()                  { return _atomic_store_ptr_entry; }
   static address atomic_cmpxchg_entry()                    { return _atomic_cmpxchg_entry; }
   static address atomic_cmpxchg_byte_entry()               { return _atomic_cmpxchg_byte_entry; }
   static address atomic_cmpxchg_long_entry()               { return _atomic_cmpxchg_long_entry; }
   static address atomic_add_entry()                        { return _atomic_add_entry; }
-  static address atomic_add_ptr_entry()                    { return _atomic_add_ptr_entry; }
+  static address atomic_add_long_entry()                   { return _atomic_add_long_entry; }
   static address fence_entry()                             { return _fence_entry; }
 
   static address d2i_wrapper()                             { return _d2i_wrapper; }
--- a/src/hotspot/share/runtime/thread.cpp	Wed Dec 20 09:14:52 2017 -0800
+++ b/src/hotspot/share/runtime/thread.cpp	Thu Dec 21 00:07:38 2017 +0100
@@ -3473,7 +3473,7 @@
              X = (JavaThread*)prefetch_and_load_ptr((void**)MACRO_current_p, (intx)MACRO_scan_interval))
 
 // All JavaThreads
-#define ALL_JAVA_THREADS(X) DO_JAVA_THREADS(ThreadsSMRSupport::get_smr_java_thread_list(), X)
+#define ALL_JAVA_THREADS(X) DO_JAVA_THREADS(ThreadsSMRSupport::get_java_thread_list(), X)
 
 // All JavaThreads + all non-JavaThreads (i.e., every thread in the system)
 void Threads::threads_do(ThreadClosure* tc) {
@@ -4038,9 +4038,16 @@
         }
         if (library == NULL) {
           const char *sub_msg = " on the library path, with error: ";
-          size_t len = strlen(msg) + strlen(name) + strlen(sub_msg) + strlen(ebuf) + 1;
+          const char *sub_msg2 = "\nModule java.instrument may be missing from runtime image.";
+
+          size_t len = strlen(msg) + strlen(name) + strlen(sub_msg) +
+                       strlen(ebuf) + strlen(sub_msg2) + 1;
           char *buf = NEW_C_HEAP_ARRAY(char, len, mtThread);
-          jio_snprintf(buf, len, "%s%s%s%s", msg, name, sub_msg, ebuf);
+          if (!agent->is_instrument_lib()) {
+            jio_snprintf(buf, len, "%s%s%s%s", msg, name, sub_msg, ebuf);
+          } else {
+            jio_snprintf(buf, len, "%s%s%s%s%s", msg, name, sub_msg, ebuf, sub_msg2);
+          }
           // If we can't find the agent, exit.
           vm_exit_during_initialization(buf, NULL);
           FREE_C_HEAP_ARRAY(char, buf);
@@ -4382,7 +4389,7 @@
   // that we do not remove thread without safepoint code notice
   { MutexLocker ml(Threads_lock);
 
-    assert(ThreadsSMRSupport::get_smr_java_thread_list()->includes(p), "p must be present");
+    assert(ThreadsSMRSupport::get_java_thread_list()->includes(p), "p must be present");
 
     // Maintain fast thread list
     ThreadsSMRSupport::remove_thread(p);
@@ -4610,7 +4617,7 @@
   }
 #endif // INCLUDE_SERVICES
 
-  ThreadsSMRSupport::print_smr_info_on(st);
+  ThreadsSMRSupport::print_info_on(st);
   st->cr();
 
   ALL_JAVA_THREADS(p) {
@@ -4679,7 +4686,7 @@
 // memory (even in resource area), it might deadlock the error handler.
 void Threads::print_on_error(outputStream* st, Thread* current, char* buf,
                              int buflen) {
-  ThreadsSMRSupport::print_smr_info_on(st);
+  ThreadsSMRSupport::print_info_on(st);
   st->cr();
 
   bool found_current = false;
--- a/src/hotspot/share/runtime/threadSMR.cpp	Wed Dec 20 09:14:52 2017 -0800
+++ b/src/hotspot/share/runtime/threadSMR.cpp	Thu Dec 21 00:07:38 2017 +0100
@@ -31,131 +31,131 @@
 #include "utilities/globalDefinitions.hpp"
 #include "utilities/resourceHash.hpp"
 
-Monitor*              ThreadsSMRSupport::_smr_delete_lock =
-                          new Monitor(Monitor::special, "smr_delete_lock",
+Monitor*              ThreadsSMRSupport::_delete_lock =
+                          new Monitor(Monitor::special, "Thread_SMR_delete_lock",
                                       false /* allow_vm_block */,
                                       Monitor::_safepoint_check_never);
 // The '_cnt', '_max' and '_times" fields are enabled via
 // -XX:+EnableThreadSMRStatistics:
 
-// # of parallel threads in _smr_delete_lock->wait().
+// # of parallel threads in _delete_lock->wait().
 // Impl note: Hard to imagine > 64K waiting threads so this could be 16-bit,
 // but there is no nice 16-bit _FORMAT support.
-uint                  ThreadsSMRSupport::_smr_delete_lock_wait_cnt = 0;
+uint                  ThreadsSMRSupport::_delete_lock_wait_cnt = 0;
 
-// Max # of parallel threads in _smr_delete_lock->wait().
-// Impl note: See _smr_delete_lock_wait_cnt note.
-uint                  ThreadsSMRSupport::_smr_delete_lock_wait_max = 0;
+// Max # of parallel threads in _delete_lock->wait().
+// Impl note: See _delete_lock_wait_cnt note.
+uint                  ThreadsSMRSupport::_delete_lock_wait_max = 0;
 
-// Flag to indicate when an _smr_delete_lock->notify() is needed.
-// Impl note: See _smr_delete_lock_wait_cnt note.
-volatile uint         ThreadsSMRSupport::_smr_delete_notify = 0;
+// Flag to indicate when an _delete_lock->notify() is needed.
+// Impl note: See _delete_lock_wait_cnt note.
+volatile uint         ThreadsSMRSupport::_delete_notify = 0;
 
 // # of threads deleted over VM lifetime.
 // Impl note: Atomically incremented over VM lifetime so use unsigned for more
 // range. Unsigned 64-bit would be more future proof, but 64-bit atomic inc
 // isn't available everywhere (or is it?).
-volatile uint         ThreadsSMRSupport::_smr_deleted_thread_cnt = 0;
+volatile uint         ThreadsSMRSupport::_deleted_thread_cnt = 0;
 
 // Max time in millis to delete a thread.
 // Impl note: 16-bit might be too small on an overloaded machine. Use
 // unsigned since this is a time value. Set via Atomic::cmpxchg() in a
 // loop for correctness.
-volatile uint         ThreadsSMRSupport::_smr_deleted_thread_time_max = 0;
+volatile uint         ThreadsSMRSupport::_deleted_thread_time_max = 0;
 
 // Cumulative time in millis to delete threads.
 // Impl note: Atomically added to over VM lifetime so use unsigned for more
 // range. Unsigned 64-bit would be more future proof, but 64-bit atomic inc
 // isn't available everywhere (or is it?).
-volatile uint         ThreadsSMRSupport::_smr_deleted_thread_times = 0;
+volatile uint         ThreadsSMRSupport::_deleted_thread_times = 0;
 
-ThreadsList* volatile ThreadsSMRSupport::_smr_java_thread_list = new ThreadsList(0);
+ThreadsList* volatile ThreadsSMRSupport::_java_thread_list = new ThreadsList(0);
 
 // # of ThreadsLists allocated over VM lifetime.
 // Impl note: We allocate a new ThreadsList for every thread create and
 // every thread delete so we need a bigger type than the
-// _smr_deleted_thread_cnt field.
-uint64_t              ThreadsSMRSupport::_smr_java_thread_list_alloc_cnt = 1;
+// _deleted_thread_cnt field.
+uint64_t              ThreadsSMRSupport::_java_thread_list_alloc_cnt = 1;
 
 // # of ThreadsLists freed over VM lifetime.
-// Impl note: See _smr_java_thread_list_alloc_cnt note.
-uint64_t              ThreadsSMRSupport::_smr_java_thread_list_free_cnt = 0;
+// Impl note: See _java_thread_list_alloc_cnt note.
+uint64_t              ThreadsSMRSupport::_java_thread_list_free_cnt = 0;
 
 // Max size ThreadsList allocated.
 // Impl note: Max # of threads alive at one time should fit in unsigned 32-bit.
-uint                  ThreadsSMRSupport::_smr_java_thread_list_max = 0;
+uint                  ThreadsSMRSupport::_java_thread_list_max = 0;
 
 // Max # of nested ThreadsLists for a thread.
 // Impl note: Hard to imagine > 64K nested ThreadsLists so this could be
 // 16-bit, but there is no nice 16-bit _FORMAT support.
-uint                  ThreadsSMRSupport::_smr_nested_thread_list_max = 0;
+uint                  ThreadsSMRSupport::_nested_thread_list_max = 0;
 
 // # of ThreadsListHandles deleted over VM lifetime.
 // Impl note: Atomically incremented over VM lifetime so use unsigned for
 // more range. There will be fewer ThreadsListHandles than threads so
 // unsigned 32-bit should be fine.
-volatile uint         ThreadsSMRSupport::_smr_tlh_cnt = 0;
+volatile uint         ThreadsSMRSupport::_tlh_cnt = 0;
 
 // Max time in millis to delete a ThreadsListHandle.
 // Impl note: 16-bit might be too small on an overloaded machine. Use
 // unsigned since this is a time value. Set via Atomic::cmpxchg() in a
 // loop for correctness.
-volatile uint         ThreadsSMRSupport::_smr_tlh_time_max = 0;
+volatile uint         ThreadsSMRSupport::_tlh_time_max = 0;
 
 // Cumulative time in millis to delete ThreadsListHandles.
 // Impl note: Atomically added to over VM lifetime so use unsigned for more
 // range. Unsigned 64-bit would be more future proof, but 64-bit atomic inc
 // isn't available everywhere (or is it?).
-volatile uint         ThreadsSMRSupport::_smr_tlh_times = 0;
+volatile uint         ThreadsSMRSupport::_tlh_times = 0;
 
-ThreadsList*          ThreadsSMRSupport::_smr_to_delete_list = NULL;
+ThreadsList*          ThreadsSMRSupport::_to_delete_list = NULL;
 
 // # of parallel ThreadsLists on the to-delete list.
 // Impl note: Hard to imagine > 64K ThreadsLists needing to be deleted so
 // this could be 16-bit, but there is no nice 16-bit _FORMAT support.
-uint                  ThreadsSMRSupport::_smr_to_delete_list_cnt = 0;
+uint                  ThreadsSMRSupport::_to_delete_list_cnt = 0;
 
 // Max # of parallel ThreadsLists on the to-delete list.
-// Impl note: See _smr_to_delete_list_cnt note.
-uint                  ThreadsSMRSupport::_smr_to_delete_list_max = 0;
+// Impl note: See _to_delete_list_cnt note.
+uint                  ThreadsSMRSupport::_to_delete_list_max = 0;
 
 
 // 'inline' functions first so the definitions are before first use:
 
-inline void ThreadsSMRSupport::add_smr_deleted_thread_times(uint add_value) {
-  Atomic::add(add_value, &_smr_deleted_thread_times);
+inline void ThreadsSMRSupport::add_deleted_thread_times(uint add_value) {
+  Atomic::add(add_value, &_deleted_thread_times);
 }
 
-inline void ThreadsSMRSupport::inc_smr_deleted_thread_cnt() {
-  Atomic::inc(&_smr_deleted_thread_cnt);
+inline void ThreadsSMRSupport::inc_deleted_thread_cnt() {
+  Atomic::inc(&_deleted_thread_cnt);
 }
 
-inline void ThreadsSMRSupport::inc_smr_java_thread_list_alloc_cnt() {
-  _smr_java_thread_list_alloc_cnt++;
+inline void ThreadsSMRSupport::inc_java_thread_list_alloc_cnt() {
+  _java_thread_list_alloc_cnt++;
 }
 
-inline void ThreadsSMRSupport::update_smr_deleted_thread_time_max(uint new_value) {
+inline void ThreadsSMRSupport::update_deleted_thread_time_max(uint new_value) {
   while (true) {
-    uint cur_value = _smr_deleted_thread_time_max;
+    uint cur_value = _deleted_thread_time_max;
     if (new_value <= cur_value) {
       // No need to update max value so we're done.
       break;
     }
-    if (Atomic::cmpxchg(new_value, &_smr_deleted_thread_time_max, cur_value) == cur_value) {
+    if (Atomic::cmpxchg(new_value, &_deleted_thread_time_max, cur_value) == cur_value) {
       // Updated max value so we're done. Otherwise try it all again.
       break;
     }
   }
 }
 
-inline void ThreadsSMRSupport::update_smr_java_thread_list_max(uint new_value) {
-  if (new_value > _smr_java_thread_list_max) {
-    _smr_java_thread_list_max = new_value;
+inline void ThreadsSMRSupport::update_java_thread_list_max(uint new_value) {
+  if (new_value > _java_thread_list_max) {
+    _java_thread_list_max = new_value;
   }
 }
 
-inline ThreadsList* ThreadsSMRSupport::xchg_smr_java_thread_list(ThreadsList* new_list) {
-  return (ThreadsList*)Atomic::xchg(new_list, &_smr_java_thread_list);
+inline ThreadsList* ThreadsSMRSupport::xchg_java_thread_list(ThreadsList* new_list) {
+  return (ThreadsList*)Atomic::xchg(new_list, &_java_thread_list);
 }
 
 
@@ -268,7 +268,7 @@
     }
 
     // The current JavaThread has a hazard ptr (ThreadsList reference)
-    // which might be _smr_java_thread_list or it might be an older
+    // which might be _java_thread_list or it might be an older
     // ThreadsList that has been removed but not freed. In either case,
     // the hazard ptr is protecting all the JavaThreads on that
     // ThreadsList.
@@ -347,7 +347,7 @@
     if (Thread::is_hazard_ptr_tagged(current_list)) return;
 
     // The current JavaThread has a hazard ptr (ThreadsList reference)
-    // which might be _smr_java_thread_list or it might be an older
+    // which might be _java_thread_list or it might be an older
     // ThreadsList that has been removed but not freed. In either case,
     // the hazard ptr is protecting all the JavaThreads on that
     // ThreadsList, but we only care about matching a specific JavaThread.
@@ -476,7 +476,7 @@
   if (EnableThreadSMRStatistics) {
     _timer.stop();
     uint millis = (uint)_timer.milliseconds();
-    ThreadsSMRSupport::update_smr_tlh_stats(millis);
+    ThreadsSMRSupport::update_tlh_stats(millis);
   }
 }
 
@@ -574,12 +574,12 @@
   ThreadsList* threads;
 
   // Stable recording of a hazard ptr for SMR. This code does not use
-  // locks so its use of the _smr_java_thread_list & _threads_hazard_ptr
+  // locks so its use of the _java_thread_list & _threads_hazard_ptr
   // fields is racy relative to code that uses those fields with locks.
   // OrderAccess and Atomic functions are used to deal with those races.
   //
   while (true) {
-    threads = get_smr_java_thread_list();
+    threads = get_java_thread_list();
 
     // Publish a tagged hazard ptr to denote that the hazard ptr is not
     // yet verified as being stable. Due to the fence after the hazard
@@ -590,9 +590,9 @@
     ThreadsList* unverified_threads = Thread::tag_hazard_ptr(threads);
     self->set_threads_hazard_ptr(unverified_threads);
 
-    // If _smr_java_thread_list has changed, we have lost a race with
+    // If _java_thread_list has changed, we have lost a race with
     // Threads::add() or Threads::remove() and have to try again.
-    if (get_smr_java_thread_list() != threads) {
+    if (get_java_thread_list() != threads) {
       continue;
     }
 
@@ -634,15 +634,15 @@
   {
     // Only grab the Threads_lock if we don't already own it.
     MutexLockerEx ml(Threads_lock->owned_by_self() ? NULL : Threads_lock);
-    node = new NestedThreadsList(get_smr_java_thread_list());
+    node = new NestedThreadsList(get_java_thread_list());
     // We insert at the front of the list to match up with the delete
     // in release_stable_list().
     node->set_next(self->get_nested_threads_hazard_ptr());
     self->set_nested_threads_hazard_ptr(node);
     if (EnableThreadSMRStatistics) {
       self->inc_nested_threads_hazard_ptr_cnt();
-      if (self->nested_threads_hazard_ptr_cnt() > _smr_nested_thread_list_max) {
-        _smr_nested_thread_list_max = self->nested_threads_hazard_ptr_cnt();
+      if (self->nested_threads_hazard_ptr_cnt() > _nested_thread_list_max) {
+        _nested_thread_list_max = self->nested_threads_hazard_ptr_cnt();
       }
     }
   }
@@ -652,25 +652,101 @@
 }
 
 void ThreadsSMRSupport::add_thread(JavaThread *thread){
-  ThreadsList *new_list = ThreadsList::add_thread(ThreadsSMRSupport::get_smr_java_thread_list(), thread);
+  ThreadsList *new_list = ThreadsList::add_thread(ThreadsSMRSupport::get_java_thread_list(), thread);
   if (EnableThreadSMRStatistics) {
-    ThreadsSMRSupport::inc_smr_java_thread_list_alloc_cnt();
-    ThreadsSMRSupport::update_smr_java_thread_list_max(new_list->length());
+    ThreadsSMRSupport::inc_java_thread_list_alloc_cnt();
+    ThreadsSMRSupport::update_java_thread_list_max(new_list->length());
   }
-  // Initial _smr_java_thread_list will not generate a "Threads::add" mesg.
+  // Initial _java_thread_list will not generate a "Threads::add" mesg.
   log_debug(thread, smr)("tid=" UINTX_FORMAT ": Threads::add: new ThreadsList=" INTPTR_FORMAT, os::current_thread_id(), p2i(new_list));
 
-  ThreadsList *old_list = ThreadsSMRSupport::xchg_smr_java_thread_list(new_list);
-  ThreadsSMRSupport::smr_free_list(old_list);
+  ThreadsList *old_list = ThreadsSMRSupport::xchg_java_thread_list(new_list);
+  ThreadsSMRSupport::free_list(old_list);
+}
+
+// set_delete_notify() and clear_delete_notify() are called
+// under the protection of the delete_lock, but we also use an
+// Atomic operation to ensure the memory update is seen earlier than
+// when the delete_lock is dropped.
+//
+void ThreadsSMRSupport::clear_delete_notify() {
+  Atomic::dec(&_delete_notify);
+}
+
+bool ThreadsSMRSupport::delete_notify() {
+  // Use load_acquire() in order to see any updates to _delete_notify
+  // earlier than when delete_lock is grabbed.
+  return (OrderAccess::load_acquire(&_delete_notify) != 0);
 }
 
-// set_smr_delete_notify() and clear_smr_delete_notify() are called
-// under the protection of the smr_delete_lock, but we also use an
-// Atomic operation to ensure the memory update is seen earlier than
-// when the smr_delete_lock is dropped.
-//
-void ThreadsSMRSupport::clear_smr_delete_notify() {
-  Atomic::dec(&_smr_delete_notify);
+// Safely free a ThreadsList after a Threads::add() or Threads::remove().
+// The specified ThreadsList may not get deleted during this call if it
+// is still in-use (referenced by a hazard ptr). Other ThreadsLists
+// in the chain may get deleted by this call if they are no longer in-use.
+void ThreadsSMRSupport::free_list(ThreadsList* threads) {
+  assert_locked_or_safepoint(Threads_lock);
+
+  threads->set_next_list(_to_delete_list);
+  _to_delete_list = threads;
+  if (EnableThreadSMRStatistics) {
+    _to_delete_list_cnt++;
+    if (_to_delete_list_cnt > _to_delete_list_max) {
+      _to_delete_list_max = _to_delete_list_cnt;
+    }
+  }
+
+  // Hash table size should be first power of two higher than twice the length of the ThreadsList
+  int hash_table_size = MIN2((int)get_java_thread_list()->length(), 32) << 1;
+  hash_table_size--;
+  hash_table_size |= hash_table_size >> 1;
+  hash_table_size |= hash_table_size >> 2;
+  hash_table_size |= hash_table_size >> 4;
+  hash_table_size |= hash_table_size >> 8;
+  hash_table_size |= hash_table_size >> 16;
+  hash_table_size++;
+
+  // Gather a hash table of the current hazard ptrs:
+  ThreadScanHashtable *scan_table = new ThreadScanHashtable(hash_table_size);
+  ScanHazardPtrGatherThreadsListClosure scan_cl(scan_table);
+  Threads::threads_do(&scan_cl);
+
+  // Walk through the linked list of pending freeable ThreadsLists
+  // and free the ones that are not referenced from hazard ptrs.
+  ThreadsList* current = _to_delete_list;
+  ThreadsList* prev = NULL;
+  ThreadsList* next = NULL;
+  bool threads_is_freed = false;
+  while (current != NULL) {
+    next = current->next_list();
+    if (!scan_table->has_entry((void*)current)) {
+      // This ThreadsList is not referenced by a hazard ptr.
+      if (prev != NULL) {
+        prev->set_next_list(next);
+      }
+      if (_to_delete_list == current) {
+        _to_delete_list = next;
+      }
+
+      log_debug(thread, smr)("tid=" UINTX_FORMAT ": ThreadsSMRSupport::free_list: threads=" INTPTR_FORMAT " is freed.", os::current_thread_id(), p2i(current));
+      if (current == threads) threads_is_freed = true;
+      delete current;
+      if (EnableThreadSMRStatistics) {
+        _java_thread_list_free_cnt++;
+        _to_delete_list_cnt--;
+      }
+    } else {
+      prev = current;
+    }
+    current = next;
+  }
+
+  if (!threads_is_freed) {
+    // Only report "is not freed" on the original call to
+    // free_list() for this ThreadsList.
+    log_debug(thread, smr)("tid=" UINTX_FORMAT ": ThreadsSMRSupport::free_list: threads=" INTPTR_FORMAT " is not freed.", os::current_thread_id(), p2i(threads));
+  }
+
+  delete scan_table;
 }
 
 // Return true if the specified JavaThread is protected by a hazard
@@ -681,7 +757,7 @@
 
   // Hash table size should be first power of two higher than twice
   // the length of the Threads list.
-  int hash_table_size = MIN2((int)get_smr_java_thread_list()->length(), 32) << 1;
+  int hash_table_size = MIN2((int)get_java_thread_list()->length(), 32) << 1;
   hash_table_size--;
   hash_table_size |= hash_table_size >> 1;
   hash_table_size |= hash_table_size >> 2;
@@ -736,10 +812,10 @@
   self->set_threads_hazard_ptr(NULL);
 
   // We use double-check locking to reduce traffic on the system
-  // wide smr_delete_lock.
-  if (ThreadsSMRSupport::smr_delete_notify()) {
+  // wide Thread-SMR delete_lock.
+  if (ThreadsSMRSupport::delete_notify()) {
     // An exiting thread might be waiting in smr_delete(); we need to
-    // check with smr_delete_lock to be sure.
+    // check with delete_lock to be sure.
     release_stable_list_wake_up((char *) "regular hazard ptr");
   }
 }
@@ -772,7 +848,7 @@
   }
 
   // An exiting thread might be waiting in smr_delete(); we need to
-  // check with smr_delete_lock to be sure.
+  // check with delete_lock to be sure.
   release_stable_list_wake_up((char *) "nested hazard ptr");
 
   log_debug(thread, smr)("tid=" UINTX_FORMAT ": ThreadsSMRSupport::release_stable_list: delete NestedThreadsList node containing ThreadsList=" INTPTR_FORMAT, os::current_thread_id(), p2i(node->t_list()));
@@ -781,21 +857,21 @@
 }
 
 // Wake up portion of the release stable ThreadsList protocol;
-// uses the smr_delete_lock().
+// uses the delete_lock().
 //
 void ThreadsSMRSupport::release_stable_list_wake_up(char *log_str) {
   assert(log_str != NULL, "sanity check");
 
-  // Note: smr_delete_lock is held in smr_delete() for the entire
+  // Note: delete_lock is held in smr_delete() for the entire
   // hazard ptr search so that we do not lose this notify() if
   // the exiting thread has to wait. That code path also holds
-  // Threads_lock (which was grabbed before smr_delete_lock) so that
+  // Threads_lock (which was grabbed before delete_lock) so that
   // threads_do() can be called. This means the system can't start a
   // safepoint which means this thread can't take too long to get to
-  // a safepoint because of being blocked on smr_delete_lock.
+  // a safepoint because of being blocked on delete_lock.
   //
-  MonitorLockerEx ml(ThreadsSMRSupport::smr_delete_lock(), Monitor::_no_safepoint_check_flag);
-  if (ThreadsSMRSupport::smr_delete_notify()) {
+  MonitorLockerEx ml(ThreadsSMRSupport::delete_lock(), Monitor::_no_safepoint_check_flag);
+  if (ThreadsSMRSupport::delete_notify()) {
     // Notify any exiting JavaThreads that are waiting in smr_delete()
     // that we've released a ThreadsList.
     ml.notify_all();
@@ -804,23 +880,23 @@
 }
 
 void ThreadsSMRSupport::remove_thread(JavaThread *thread) {
-  ThreadsList *new_list = ThreadsList::remove_thread(ThreadsSMRSupport::get_smr_java_thread_list(), thread);
+  ThreadsList *new_list = ThreadsList::remove_thread(ThreadsSMRSupport::get_java_thread_list(), thread);
   if (EnableThreadSMRStatistics) {
-    ThreadsSMRSupport::inc_smr_java_thread_list_alloc_cnt();
+    ThreadsSMRSupport::inc_java_thread_list_alloc_cnt();
     // This list is smaller so no need to check for a "longest" update.
   }
 
-  // Final _smr_java_thread_list will not generate a "Threads::remove" mesg.
+  // Final _java_thread_list will not generate a "Threads::remove" mesg.
   log_debug(thread, smr)("tid=" UINTX_FORMAT ": Threads::remove: new ThreadsList=" INTPTR_FORMAT, os::current_thread_id(), p2i(new_list));
 
-  ThreadsList *old_list = ThreadsSMRSupport::xchg_smr_java_thread_list(new_list);
-  ThreadsSMRSupport::smr_free_list(old_list);
+  ThreadsList *old_list = ThreadsSMRSupport::xchg_java_thread_list(new_list);
+  ThreadsSMRSupport::free_list(old_list);
 }
 
-// See note for clear_smr_delete_notify().
+// See note for clear_delete_notify().
 //
-void ThreadsSMRSupport::set_smr_delete_notify() {
-  Atomic::inc(&_smr_delete_notify);
+void ThreadsSMRSupport::set_delete_notify() {
+  Atomic::inc(&_delete_notify);
 }
 
 // Safely delete a JavaThread when it is no longer in use by a
@@ -842,16 +918,16 @@
       MutexLockerEx ml(Threads_lock, Mutex::_no_safepoint_check_flag);
       // Cannot use a MonitorLockerEx helper here because we have
       // to drop the Threads_lock first if we wait.
-      ThreadsSMRSupport::smr_delete_lock()->lock_without_safepoint_check();
-      // Set the smr_delete_notify flag after we grab smr_delete_lock
+      ThreadsSMRSupport::delete_lock()->lock_without_safepoint_check();
+      // Set the delete_notify flag after we grab delete_lock
       // and before we scan hazard ptrs because we're doing
       // double-check locking in release_stable_list().
-      ThreadsSMRSupport::set_smr_delete_notify();
+      ThreadsSMRSupport::set_delete_notify();
 
       if (!is_a_protected_JavaThread(thread)) {
         // This is the common case.
-        ThreadsSMRSupport::clear_smr_delete_notify();
-        ThreadsSMRSupport::smr_delete_lock()->unlock();
+        ThreadsSMRSupport::clear_delete_notify();
+        ThreadsSMRSupport::delete_lock()->unlock();
         break;
       }
       if (!has_logged_once) {
@@ -865,22 +941,22 @@
     } // We have to drop the Threads_lock to wait or delete the thread
 
     if (EnableThreadSMRStatistics) {
-      _smr_delete_lock_wait_cnt++;
-      if (_smr_delete_lock_wait_cnt > _smr_delete_lock_wait_max) {
-        _smr_delete_lock_wait_max = _smr_delete_lock_wait_cnt;
+      _delete_lock_wait_cnt++;
+      if (_delete_lock_wait_cnt > _delete_lock_wait_max) {
+        _delete_lock_wait_max = _delete_lock_wait_cnt;
       }
     }
     // Wait for a release_stable_list() call before we check again. No
     // safepoint check, no timeout, and not as suspend equivalent flag
     // because this JavaThread is not on the Threads list.
-    ThreadsSMRSupport::smr_delete_lock()->wait(Mutex::_no_safepoint_check_flag, 0,
+    ThreadsSMRSupport::delete_lock()->wait(Mutex::_no_safepoint_check_flag, 0,
                                      !Mutex::_as_suspend_equivalent_flag);
     if (EnableThreadSMRStatistics) {
-      _smr_delete_lock_wait_cnt--;
+      _delete_lock_wait_cnt--;
     }
 
-    ThreadsSMRSupport::clear_smr_delete_notify();
-    ThreadsSMRSupport::smr_delete_lock()->unlock();
+    ThreadsSMRSupport::clear_delete_notify();
+    ThreadsSMRSupport::delete_lock()->unlock();
     // Retry the whole scenario.
   }
 
@@ -893,166 +969,89 @@
   if (EnableThreadSMRStatistics) {
     timer.stop();
     uint millis = (uint)timer.milliseconds();
-    ThreadsSMRSupport::inc_smr_deleted_thread_cnt();
-    ThreadsSMRSupport::add_smr_deleted_thread_times(millis);
-    ThreadsSMRSupport::update_smr_deleted_thread_time_max(millis);
+    ThreadsSMRSupport::inc_deleted_thread_cnt();
+    ThreadsSMRSupport::add_deleted_thread_times(millis);
+    ThreadsSMRSupport::update_deleted_thread_time_max(millis);
   }
 
   log_debug(thread, smr)("tid=" UINTX_FORMAT ": ThreadsSMRSupport::smr_delete: thread=" INTPTR_FORMAT " is deleted.", os::current_thread_id(), p2i(thread));
 }
 
-bool ThreadsSMRSupport::smr_delete_notify() {
-  // Use load_acquire() in order to see any updates to _smr_delete_notify
-  // earlier than when smr_delete_lock is grabbed.
-  return (OrderAccess::load_acquire(&_smr_delete_notify) != 0);
-}
-
-// Safely free a ThreadsList after a Threads::add() or Threads::remove().
-// The specified ThreadsList may not get deleted during this call if it
-// is still in-use (referenced by a hazard ptr). Other ThreadsLists
-// in the chain may get deleted by this call if they are no longer in-use.
-void ThreadsSMRSupport::smr_free_list(ThreadsList* threads) {
-  assert_locked_or_safepoint(Threads_lock);
-
-  threads->set_next_list(_smr_to_delete_list);
-  _smr_to_delete_list = threads;
-  if (EnableThreadSMRStatistics) {
-    _smr_to_delete_list_cnt++;
-    if (_smr_to_delete_list_cnt > _smr_to_delete_list_max) {
-      _smr_to_delete_list_max = _smr_to_delete_list_cnt;
-    }
-  }
-
-  // Hash table size should be first power of two higher than twice the length of the ThreadsList
-  int hash_table_size = MIN2((int)get_smr_java_thread_list()->length(), 32) << 1;
-  hash_table_size--;
-  hash_table_size |= hash_table_size >> 1;
-  hash_table_size |= hash_table_size >> 2;
-  hash_table_size |= hash_table_size >> 4;
-  hash_table_size |= hash_table_size >> 8;
-  hash_table_size |= hash_table_size >> 16;
-  hash_table_size++;
-
-  // Gather a hash table of the current hazard ptrs:
-  ThreadScanHashtable *scan_table = new ThreadScanHashtable(hash_table_size);
-  ScanHazardPtrGatherThreadsListClosure scan_cl(scan_table);
-  Threads::threads_do(&scan_cl);
-
-  // Walk through the linked list of pending freeable ThreadsLists
-  // and free the ones that are not referenced from hazard ptrs.
-  ThreadsList* current = _smr_to_delete_list;
-  ThreadsList* prev = NULL;
-  ThreadsList* next = NULL;
-  bool threads_is_freed = false;
-  while (current != NULL) {
-    next = current->next_list();
-    if (!scan_table->has_entry((void*)current)) {
-      // This ThreadsList is not referenced by a hazard ptr.
-      if (prev != NULL) {
-        prev->set_next_list(next);
-      }
-      if (_smr_to_delete_list == current) {
-        _smr_to_delete_list = next;
-      }
-
-      log_debug(thread, smr)("tid=" UINTX_FORMAT ": ThreadsSMRSupport::smr_free_list: threads=" INTPTR_FORMAT " is freed.", os::current_thread_id(), p2i(current));
-      if (current == threads) threads_is_freed = true;
-      delete current;
-      if (EnableThreadSMRStatistics) {
-        _smr_java_thread_list_free_cnt++;
-        _smr_to_delete_list_cnt--;
-      }
-    } else {
-      prev = current;
-    }
-    current = next;
-  }
-
-  if (!threads_is_freed) {
-    // Only report "is not freed" on the original call to
-    // smr_free_list() for this ThreadsList.
-    log_debug(thread, smr)("tid=" UINTX_FORMAT ": ThreadsSMRSupport::smr_free_list: threads=" INTPTR_FORMAT " is not freed.", os::current_thread_id(), p2i(threads));
-  }
-
-  delete scan_table;
-}
-
 
 // Debug, logging, and printing stuff at the end:
 
 // Log Threads class SMR info.
-void ThreadsSMRSupport::log_smr_statistics() {
+void ThreadsSMRSupport::log_statistics() {
   LogTarget(Info, thread, smr) log;
   if (log.is_enabled()) {
     LogStream out(log);
-    print_smr_info_on(&out);
+    print_info_on(&out);
   }
 }
 
 // Print Threads class SMR info.
-void ThreadsSMRSupport::print_smr_info_on(outputStream* st) {
+void ThreadsSMRSupport::print_info_on(outputStream* st) {
   // Only grab the Threads_lock if we don't already own it
   // and if we are not reporting an error.
   MutexLockerEx ml((Threads_lock->owned_by_self() || VMError::is_error_reported()) ? NULL : Threads_lock);
 
   st->print_cr("Threads class SMR info:");
-  st->print_cr("_smr_java_thread_list=" INTPTR_FORMAT ", length=%u, "
-               "elements={", p2i(_smr_java_thread_list),
-               _smr_java_thread_list->length());
-  print_smr_info_elements_on(st, _smr_java_thread_list);
+  st->print_cr("_java_thread_list=" INTPTR_FORMAT ", length=%u, "
+               "elements={", p2i(_java_thread_list),
+               _java_thread_list->length());
+  print_info_elements_on(st, _java_thread_list);
   st->print_cr("}");
-  if (_smr_to_delete_list != NULL) {
-    st->print_cr("_smr_to_delete_list=" INTPTR_FORMAT ", length=%u, "
-                 "elements={", p2i(_smr_to_delete_list),
-                 _smr_to_delete_list->length());
-    print_smr_info_elements_on(st, _smr_to_delete_list);
+  if (_to_delete_list != NULL) {
+    st->print_cr("_to_delete_list=" INTPTR_FORMAT ", length=%u, "
+                 "elements={", p2i(_to_delete_list),
+                 _to_delete_list->length());
+    print_info_elements_on(st, _to_delete_list);
     st->print_cr("}");
-    for (ThreadsList *t_list = _smr_to_delete_list->next_list();
+    for (ThreadsList *t_list = _to_delete_list->next_list();
          t_list != NULL; t_list = t_list->next_list()) {
       st->print("next-> " INTPTR_FORMAT ", length=%u, "
                 "elements={", p2i(t_list), t_list->length());
-      print_smr_info_elements_on(st, t_list);
+      print_info_elements_on(st, t_list);
       st->print_cr("}");
     }
   }
   if (!EnableThreadSMRStatistics) {
     return;
   }
-  st->print_cr("_smr_java_thread_list_alloc_cnt=" UINT64_FORMAT ","
-               "_smr_java_thread_list_free_cnt=" UINT64_FORMAT ","
-               "_smr_java_thread_list_max=%u, "
-               "_smr_nested_thread_list_max=%u",
-               _smr_java_thread_list_alloc_cnt,
-               _smr_java_thread_list_free_cnt,
-               _smr_java_thread_list_max,
-               _smr_nested_thread_list_max);
-  if (_smr_tlh_cnt > 0) {
-    st->print_cr("_smr_tlh_cnt=%u"
-                 ", _smr_tlh_times=%u"
-                 ", avg_smr_tlh_time=%0.2f"
-                 ", _smr_tlh_time_max=%u",
-                 _smr_tlh_cnt, _smr_tlh_times,
-                 ((double) _smr_tlh_times / _smr_tlh_cnt),
-                 _smr_tlh_time_max);
+  st->print_cr("_java_thread_list_alloc_cnt=" UINT64_FORMAT ","
+               "_java_thread_list_free_cnt=" UINT64_FORMAT ","
+               "_java_thread_list_max=%u, "
+               "_nested_thread_list_max=%u",
+               _java_thread_list_alloc_cnt,
+               _java_thread_list_free_cnt,
+               _java_thread_list_max,
+               _nested_thread_list_max);
+  if (_tlh_cnt > 0) {
+    st->print_cr("_tlh_cnt=%u"
+                 ", _tlh_times=%u"
+                 ", avg_tlh_time=%0.2f"
+                 ", _tlh_time_max=%u",
+                 _tlh_cnt, _tlh_times,
+                 ((double) _tlh_times / _tlh_cnt),
+                 _tlh_time_max);
   }
-  if (_smr_deleted_thread_cnt > 0) {
-    st->print_cr("_smr_deleted_thread_cnt=%u"
-                 ", _smr_deleted_thread_times=%u"
-                 ", avg_smr_deleted_thread_time=%0.2f"
-                 ", _smr_deleted_thread_time_max=%u",
-                 _smr_deleted_thread_cnt, _smr_deleted_thread_times,
-                 ((double) _smr_deleted_thread_times / _smr_deleted_thread_cnt),
-                 _smr_deleted_thread_time_max);
+  if (_deleted_thread_cnt > 0) {
+    st->print_cr("_deleted_thread_cnt=%u"
+                 ", _deleted_thread_times=%u"
+                 ", avg_deleted_thread_time=%0.2f"
+                 ", _deleted_thread_time_max=%u",
+                 _deleted_thread_cnt, _deleted_thread_times,
+                 ((double) _deleted_thread_times / _deleted_thread_cnt),
+                 _deleted_thread_time_max);
   }
-  st->print_cr("_smr_delete_lock_wait_cnt=%u, _smr_delete_lock_wait_max=%u",
-               _smr_delete_lock_wait_cnt, _smr_delete_lock_wait_max);
-  st->print_cr("_smr_to_delete_list_cnt=%u, _smr_to_delete_list_max=%u",
-               _smr_to_delete_list_cnt, _smr_to_delete_list_max);
+  st->print_cr("_delete_lock_wait_cnt=%u, _delete_lock_wait_max=%u",
+               _delete_lock_wait_cnt, _delete_lock_wait_max);
+  st->print_cr("_to_delete_list_cnt=%u, _to_delete_list_max=%u",
+               _to_delete_list_cnt, _to_delete_list_max);
 }
 
 // Print ThreadsList elements (4 per line).
-void ThreadsSMRSupport::print_smr_info_elements_on(outputStream* st,
-                                         ThreadsList* t_list) {
+void ThreadsSMRSupport::print_info_elements_on(outputStream* st, ThreadsList* t_list) {
   uint cnt = 0;
   JavaThreadIterator jti(t_list);
   for (JavaThread *jt = jti.first(); jt != NULL; jt = jti.next()) {
--- a/src/hotspot/share/runtime/threadSMR.hpp	Wed Dec 20 09:14:52 2017 -0800
+++ b/src/hotspot/share/runtime/threadSMR.hpp	Thu Dec 21 00:07:38 2017 +0100
@@ -81,67 +81,68 @@
 //
 class ThreadsSMRSupport : AllStatic {
   // The coordination between ThreadsSMRSupport::release_stable_list() and
-  // ThreadsSMRSupport::smr_delete() uses the smr_delete_lock in order to
+  // ThreadsSMRSupport::smr_delete() uses the delete_lock in order to
   // reduce the traffic on the Threads_lock.
-  static Monitor*              _smr_delete_lock;
+  static Monitor*              _delete_lock;
   // The '_cnt', '_max' and '_times" fields are enabled via
   // -XX:+EnableThreadSMRStatistics (see thread.cpp for a
   // description about each field):
-  static uint                  _smr_delete_lock_wait_cnt;
-  static uint                  _smr_delete_lock_wait_max;
-  // The smr_delete_notify flag is used for proper double-check
-  // locking in order to reduce the traffic on the smr_delete_lock.
-  static volatile uint         _smr_delete_notify;
-  static volatile uint         _smr_deleted_thread_cnt;
-  static volatile uint         _smr_deleted_thread_time_max;
-  static volatile uint         _smr_deleted_thread_times;
-  static ThreadsList* volatile _smr_java_thread_list;
-  static uint64_t              _smr_java_thread_list_alloc_cnt;
-  static uint64_t              _smr_java_thread_list_free_cnt;
-  static uint                  _smr_java_thread_list_max;
-  static uint                  _smr_nested_thread_list_max;
-  static volatile uint         _smr_tlh_cnt;
-  static volatile uint         _smr_tlh_time_max;
-  static volatile uint         _smr_tlh_times;
-  static ThreadsList*          _smr_to_delete_list;
-  static uint                  _smr_to_delete_list_cnt;
-  static uint                  _smr_to_delete_list_max;
+  static uint                  _delete_lock_wait_cnt;
+  static uint                  _delete_lock_wait_max;
+  // The delete_notify flag is used for proper double-check
+  // locking in order to reduce the traffic on the system wide
+  // Thread-SMR delete_lock.
+  static volatile uint         _delete_notify;
+  static volatile uint         _deleted_thread_cnt;
+  static volatile uint         _deleted_thread_time_max;
+  static volatile uint         _deleted_thread_times;
+  static ThreadsList* volatile _java_thread_list;
+  static uint64_t              _java_thread_list_alloc_cnt;
+  static uint64_t              _java_thread_list_free_cnt;
+  static uint                  _java_thread_list_max;
+  static uint                  _nested_thread_list_max;
+  static volatile uint         _tlh_cnt;
+  static volatile uint         _tlh_time_max;
+  static volatile uint         _tlh_times;
+  static ThreadsList*          _to_delete_list;
+  static uint                  _to_delete_list_cnt;
+  static uint                  _to_delete_list_max;
 
   static ThreadsList *acquire_stable_list_fast_path(Thread *self);
   static ThreadsList *acquire_stable_list_nested_path(Thread *self);
-  static void add_smr_deleted_thread_times(uint add_value);
-  static void add_smr_tlh_times(uint add_value);
-  static void clear_smr_delete_notify();
-  static void inc_smr_deleted_thread_cnt();
-  static void inc_smr_java_thread_list_alloc_cnt();
-  static void inc_smr_tlh_cnt();
+  static void add_deleted_thread_times(uint add_value);
+  static void add_tlh_times(uint add_value);
+  static void clear_delete_notify();
+  static Monitor* delete_lock() { return _delete_lock; }
+  static bool delete_notify();
+  static void free_list(ThreadsList* threads);
+  static void inc_deleted_thread_cnt();
+  static void inc_java_thread_list_alloc_cnt();
+  static void inc_tlh_cnt();
   static bool is_a_protected_JavaThread(JavaThread *thread);
   static void release_stable_list_fast_path(Thread *self);
   static void release_stable_list_nested_path(Thread *self);
   static void release_stable_list_wake_up(char *log_str);
-  static void set_smr_delete_notify();
-  static Monitor* smr_delete_lock() { return _smr_delete_lock; }
-  static bool smr_delete_notify();
-  static void smr_free_list(ThreadsList* threads);
-  static void update_smr_deleted_thread_time_max(uint new_value);
-  static void update_smr_java_thread_list_max(uint new_value);
-  static void update_smr_tlh_time_max(uint new_value);
-  static ThreadsList* xchg_smr_java_thread_list(ThreadsList* new_list);
+  static void set_delete_notify();
+  static void update_deleted_thread_time_max(uint new_value);
+  static void update_java_thread_list_max(uint new_value);
+  static void update_tlh_time_max(uint new_value);
+  static ThreadsList* xchg_java_thread_list(ThreadsList* new_list);
 
  public:
   static ThreadsList *acquire_stable_list(Thread *self, bool is_ThreadsListSetter);
   static void add_thread(JavaThread *thread);
-  static ThreadsList* get_smr_java_thread_list();
+  static ThreadsList* get_java_thread_list();
   static bool is_a_protected_JavaThread_with_lock(JavaThread *thread);
   static void release_stable_list(Thread *self);
   static void remove_thread(JavaThread *thread);
   static void smr_delete(JavaThread *thread);
-  static void update_smr_tlh_stats(uint millis);
+  static void update_tlh_stats(uint millis);
 
   // Logging and printing support:
-  static void log_smr_statistics();
-  static void print_smr_info_elements_on(outputStream* st, ThreadsList* t_list);
-  static void print_smr_info_on(outputStream* st);
+  static void log_statistics();
+  static void print_info_elements_on(outputStream* st, ThreadsList* t_list);
+  static void print_info_on(outputStream* st);
 };
 
 // A fast list of JavaThreads.
--- a/src/hotspot/share/runtime/threadSMR.inline.hpp	Wed Dec 20 09:14:52 2017 -0800
+++ b/src/hotspot/share/runtime/threadSMR.inline.hpp	Thu Dec 21 00:07:38 2017 +0100
@@ -53,24 +53,24 @@
 }
 
 // These three inlines are private to ThreadsSMRSupport, but
-// they are called by public inline update_smr_tlh_stats() below:
+// they are called by public inline update_tlh_stats() below:
 
-inline void ThreadsSMRSupport::add_smr_tlh_times(uint add_value) {
-  Atomic::add(add_value, &_smr_tlh_times);
+inline void ThreadsSMRSupport::add_tlh_times(uint add_value) {
+  Atomic::add(add_value, &_tlh_times);
 }
 
-inline void ThreadsSMRSupport::inc_smr_tlh_cnt() {
-  Atomic::inc(&_smr_tlh_cnt);
+inline void ThreadsSMRSupport::inc_tlh_cnt() {
+  Atomic::inc(&_tlh_cnt);
 }
 
-inline void ThreadsSMRSupport::update_smr_tlh_time_max(uint new_value) {
+inline void ThreadsSMRSupport::update_tlh_time_max(uint new_value) {
   while (true) {
-    uint cur_value = _smr_tlh_time_max;
+    uint cur_value = _tlh_time_max;
     if (new_value <= cur_value) {
       // No need to update max value so we're done.
       break;
     }
-    if (Atomic::cmpxchg(new_value, &_smr_tlh_time_max, cur_value) == cur_value) {
+    if (Atomic::cmpxchg(new_value, &_tlh_time_max, cur_value) == cur_value) {
       // Updated max value so we're done. Otherwise try it all again.
       break;
     }
@@ -85,8 +85,8 @@
   return ret;
 }
 
-inline ThreadsList* ThreadsSMRSupport::get_smr_java_thread_list() {
-  return (ThreadsList*)OrderAccess::load_acquire(&_smr_java_thread_list);
+inline ThreadsList* ThreadsSMRSupport::get_java_thread_list() {
+  return (ThreadsList*)OrderAccess::load_acquire(&_java_thread_list);
 }
 
 inline bool ThreadsSMRSupport::is_a_protected_JavaThread_with_lock(JavaThread *thread) {
@@ -94,10 +94,10 @@
   return is_a_protected_JavaThread(thread);
 }
 
-inline void ThreadsSMRSupport::update_smr_tlh_stats(uint millis) {
-  ThreadsSMRSupport::inc_smr_tlh_cnt();
-  ThreadsSMRSupport::add_smr_tlh_times(millis);
-  ThreadsSMRSupport::update_smr_tlh_time_max(millis);
+inline void ThreadsSMRSupport::update_tlh_stats(uint millis) {
+  ThreadsSMRSupport::inc_tlh_cnt();
+  ThreadsSMRSupport::add_tlh_times(millis);
+  ThreadsSMRSupport::update_tlh_time_max(millis);
 }
 
 #endif // SHARE_VM_RUNTIME_THREADSMR_INLINE_HPP
--- a/src/java.base/share/native/libjava/System.c	Wed Dec 20 09:14:52 2017 -0800
+++ b/src/java.base/share/native/libjava/System.c	Thu Dec 21 00:07:38 2017 +0100
@@ -183,6 +183,9 @@
     jobject ret = NULL;
     jstring jVMVal = NULL;
 
+    if ((*env)->EnsureLocalCapacity(env, 50) < 0) {
+        return NULL;
+    }
     sprops = GetJavaProperties(env);
     CHECK_NULL_RETURN(sprops, NULL);
 
--- a/src/jdk.internal.vm.compiler/.mx.graal/suite.py	Wed Dec 20 09:14:52 2017 -0800
+++ b/src/jdk.internal.vm.compiler/.mx.graal/suite.py	Thu Dec 21 00:07:38 2017 +0100
@@ -107,7 +107,6 @@
       "subDir" : "share/classes",
       "dependencies" : ["JVMCI_SERVICES", "JVMCI_API", "org.graalvm.util"],
       "sourceDirs" : ["src"],
-      "dependencies" : ["org.graalvm.util"],
       "checkstyle" : "org.graalvm.compiler.graph",
       "uses" : ["org.graalvm.compiler.options.OptionDescriptors"],
       "javaCompliance" : "1.8",
@@ -148,6 +147,7 @@
       "dependencies" : [
         "JVMCI_API",
         "org.graalvm.compiler.serviceprovider",
+        "org.graalvm.graphio",
         "org.graalvm.compiler.options"
       ],
       "annotationProcessors" : ["GRAAL_OPTIONS_PROCESSOR"],
@@ -291,7 +291,6 @@
       "subDir" : "share/classes",
       "sourceDirs" : ["src"],
       "dependencies" : [
-        "org.graalvm.compiler.core.aarch64",
         "org.graalvm.compiler.hotspot",
         "org.graalvm.compiler.replacements.aarch64",
       ],
@@ -435,6 +434,7 @@
         "mx:JUNIT",
         "org.graalvm.compiler.api.test",
         "org.graalvm.compiler.graph",
+        "org.graalvm.graphio",
       ],
       "annotationProcessors" : ["GRAAL_NODEINFO_PROCESSOR"],
       "javaCompliance" : "1.8",
@@ -945,6 +945,7 @@
       "dependencies" : [
         "org.graalvm.compiler.lir.jtt",
         "org.graalvm.compiler.lir.amd64",
+        "org.graalvm.compiler.core.amd64",
         "JVMCI_HOTSPOT"
       ],
       "checkstyle" : "org.graalvm.compiler.graph",
@@ -1019,7 +1020,6 @@
       "subDir" : "share/classes",
       "sourceDirs" : ["src"],
       "dependencies" : [
-        "org.graalvm.graphio",
         "org.graalvm.compiler.core",
         "org.graalvm.compiler.java",
       ],
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.aarch64/src/org/graalvm/compiler/core/aarch64/AArch64LIRKindTool.java	Wed Dec 20 09:14:52 2017 -0800
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.aarch64/src/org/graalvm/compiler/core/aarch64/AArch64LIRKindTool.java	Thu Dec 21 00:07:38 2017 +0100
@@ -68,7 +68,7 @@
 
     @Override
     public LIRKind getNarrowOopKind() {
-        return LIRKind.reference(AArch64Kind.DWORD);
+        return LIRKind.compressedReference(AArch64Kind.DWORD);
     }
 
     @Override
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.common/src/org/graalvm/compiler/core/common/LIRKind.java	Wed Dec 20 09:14:52 2017 -0800
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.common/src/org/graalvm/compiler/core/common/LIRKind.java	Thu Dec 21 00:07:38 2017 +0100
@@ -33,8 +33,9 @@
 
 /**
  * Represents the type of values in the LIR. It is composed of a {@link PlatformKind} that gives the
- * low level representation of the value, and a {@link #referenceMask} that describes the location
- * of object references in the value, and optionally a {@link #derivedReferenceBase}.
+ * low level representation of the value, a {@link #referenceMask} that describes the location of
+ * object references in the value, a {@link #referenceCompressionMask} that indicates which of these
+ * references are compressed references, and for derived references a {@link #derivedReferenceBase}.
  *
  * <h2>Constructing {@link LIRKind} instances</h2>
  *
@@ -52,7 +53,7 @@
  * compare-and-swap. For convert operations, {@link LIRKind#combine} should be used.
  * <p>
  * If it is known that the result will be a reference (e.g. pointer arithmetic where the end result
- * is a valid oop), {@link LIRKind#reference} should be used.
+ * is a valid oop), {@link #reference} or {@link LIRKind#compressedReference} should be used.
  * <p>
  * If it is known that the result will neither be a reference nor be derived from a reference,
  * {@link LIRKind#value} can be used. If the operation producing this value has inputs, this is very
@@ -64,19 +65,28 @@
  */
 public final class LIRKind extends ValueKind<LIRKind> {
 
+    /**
+     * The location of object references in the value. If the value is a vector type, each bit
+     * represents one component of the vector.
+     */
     private final int referenceMask;
 
+    /** Mask with 1-bits indicating which references in {@link #referenceMask} are compressed. */
+    private final int referenceCompressionMask;
+
     private AllocatableValue derivedReferenceBase;
 
     private static final int UNKNOWN_REFERENCE = -1;
 
     public static final LIRKind Illegal = unknownReference(ValueKind.Illegal.getPlatformKind());
 
-    private LIRKind(PlatformKind platformKind, int referenceMask, AllocatableValue derivedReferenceBase) {
+    private LIRKind(PlatformKind platformKind, int referenceMask, int referenceCompressionMask, AllocatableValue derivedReferenceBase) {
         super(platformKind);
         this.referenceMask = referenceMask;
+        this.referenceCompressionMask = referenceCompressionMask;
         this.derivedReferenceBase = derivedReferenceBase;
 
+        assert this.referenceCompressionMask == 0 || this.referenceMask == this.referenceCompressionMask : "mixing compressed and uncompressed references is untested";
         assert derivedReferenceBase == null || !derivedReferenceBase.getValueKind(LIRKind.class).isDerivedReference() : "derived reference can't have another derived reference as base";
     }
 
@@ -86,15 +96,23 @@
      * reference. Otherwise, {@link #combine(Value...)} should be used instead.
      */
     public static LIRKind value(PlatformKind platformKind) {
-        return new LIRKind(platformKind, 0, null);
+        return new LIRKind(platformKind, 0, 0, null);
     }
 
     /**
-     * Create a {@link LIRKind} of type {@code platformKind} that contains a single tracked oop
-     * reference.
+     * Create a {@link LIRKind} of type {@code platformKind} that contains a single, tracked,
+     * uncompressed oop reference.
      */
     public static LIRKind reference(PlatformKind platformKind) {
-        return derivedReference(platformKind, null);
+        return derivedReference(platformKind, null, false);
+    }
+
+    /**
+     * Create a {@link LIRKind} of type {@code platformKind} that contains a single, tracked,
+     * compressed oop reference.
+     */
+    public static LIRKind compressedReference(PlatformKind platformKind) {
+        return derivedReference(platformKind, null, true);
     }
 
     /**
@@ -112,10 +130,12 @@
     /**
      * Create a {@link LIRKind} of type {@code platformKind} that contains a derived reference.
      */
-    public static LIRKind derivedReference(PlatformKind platformKind, AllocatableValue base) {
+    public static LIRKind derivedReference(PlatformKind platformKind, AllocatableValue base, boolean compressed) {
         int length = platformKind.getVectorLength();
         assert 0 < length && length < 32 : "vector of " + length + " references not supported";
-        return new LIRKind(platformKind, (1 << length) - 1, base);
+        int referenceMask = (1 << length) - 1;
+        int referenceCompressionMask = (compressed ? referenceMask : 0);
+        return new LIRKind(platformKind, referenceMask, referenceCompressionMask, base);
     }
 
     /**
@@ -125,7 +145,7 @@
      * used instead to automatically propagate this information.
      */
     public static LIRKind unknownReference(PlatformKind platformKind) {
-        return new LIRKind(platformKind, UNKNOWN_REFERENCE, null);
+        return new LIRKind(platformKind, UNKNOWN_REFERENCE, UNKNOWN_REFERENCE, null);
     }
 
     /**
@@ -139,9 +159,9 @@
             return makeUnknownReference();
         } else {
             if (isValue()) {
-                return derivedReference(getPlatformKind(), base);
+                return derivedReference(getPlatformKind(), base, false);
             } else {
-                return new LIRKind(getPlatformKind(), referenceMask, base);
+                return new LIRKind(getPlatformKind(), referenceMask, referenceCompressionMask, base);
             }
         }
     }
@@ -240,7 +260,7 @@
             return mergeKind;
         }
         /* {@code mergeKind} is a reference. */
-        if (mergeKind.referenceMask != inputKind.referenceMask) {
+        if (mergeKind.referenceMask != inputKind.referenceMask || mergeKind.referenceCompressionMask != inputKind.referenceCompressionMask) {
             /*
              * Reference masks do not match so the result can only be an unknown reference.
              */
@@ -284,9 +304,11 @@
         } else {
             // reference type
             int newLength = Math.min(32, newPlatformKind.getVectorLength());
-            int newReferenceMask = referenceMask & (0xFFFFFFFF >>> (32 - newLength));
+            int lengthMask = 0xFFFFFFFF >>> (32 - newLength);
+            int newReferenceMask = referenceMask & lengthMask;
+            int newReferenceCompressionMask = referenceCompressionMask & lengthMask;
             assert newReferenceMask != UNKNOWN_REFERENCE;
-            return new LIRKind(newPlatformKind, newReferenceMask, derivedReferenceBase);
+            return new LIRKind(newPlatformKind, newReferenceMask, newReferenceCompressionMask, derivedReferenceBase);
         }
     }
 
@@ -308,12 +330,14 @@
 
             // repeat reference mask to fill new kind
             int newReferenceMask = 0;
+            int newReferenceCompressionMask = 0;
             for (int i = 0; i < newLength; i += getPlatformKind().getVectorLength()) {
                 newReferenceMask |= referenceMask << i;
+                newReferenceCompressionMask |= referenceCompressionMask << i;
             }
 
             assert newReferenceMask != UNKNOWN_REFERENCE;
-            return new LIRKind(newPlatformKind, newReferenceMask, derivedReferenceBase);
+            return new LIRKind(newPlatformKind, newReferenceMask, newReferenceCompressionMask, derivedReferenceBase);
         }
     }
 
@@ -322,7 +346,7 @@
      * {@link LIRKind#unknownReference}.
      */
     public LIRKind makeUnknownReference() {
-        return new LIRKind(getPlatformKind(), UNKNOWN_REFERENCE, null);
+        return new LIRKind(getPlatformKind(), UNKNOWN_REFERENCE, UNKNOWN_REFERENCE, null);
     }
 
     /**
@@ -385,6 +409,17 @@
     }
 
     /**
+     * Check whether the {@code idx}th part of this value is a <b>compressed</b> reference.
+     *
+     * @param idx The index into the vector if this is a vector kind. Must be 0 if this is a scalar
+     *            kind.
+     */
+    public boolean isCompressedReference(int idx) {
+        assert 0 <= idx && idx < getPlatformKind().getVectorLength() : "invalid index " + idx + " in " + this;
+        return !isUnknownReference() && (referenceCompressionMask & (1 << idx)) != 0;
+    }
+
+    /**
      * Check whether this kind is a value type that doesn't need to be tracked at safepoints.
      */
     public boolean isValue() {
@@ -432,6 +467,7 @@
         result = prime * result + ((getPlatformKind() == null) ? 0 : getPlatformKind().hashCode());
         result = prime * result + ((getDerivedReferenceBase() == null) ? 0 : getDerivedReferenceBase().hashCode());
         result = prime * result + referenceMask;
+        result = prime * result + referenceCompressionMask;
         return result;
     }
 
@@ -445,7 +481,7 @@
         }
 
         LIRKind other = (LIRKind) obj;
-        if (getPlatformKind() != other.getPlatformKind() || referenceMask != other.referenceMask) {
+        if (getPlatformKind() != other.getPlatformKind() || referenceMask != other.referenceMask || referenceCompressionMask != other.referenceCompressionMask) {
             return false;
         }
         if (isDerivedReference()) {
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.common/src/org/graalvm/compiler/core/common/util/CompilationAlarm.java	Wed Dec 20 09:14:52 2017 -0800
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.common/src/org/graalvm/compiler/core/common/util/CompilationAlarm.java	Thu Dec 21 00:07:38 2017 +0100
@@ -22,6 +22,7 @@
  */
 package org.graalvm.compiler.core.common.util;
 
+import org.graalvm.compiler.debug.Assertions;
 import org.graalvm.compiler.options.Option;
 import org.graalvm.compiler.options.OptionKey;
 import org.graalvm.compiler.options.OptionType;
@@ -34,7 +35,8 @@
 
     public static class Options {
         // @formatter:off
-        @Option(help = "Time limit in seconds before a compilation expires (0 to disable the limit).", type = OptionType.Debug)
+        @Option(help = "Time limit in seconds before a compilation expires (0 to disable the limit). " +
+                       "The compilation alarm will be implicitly disabled if assertions are enabled.", type = OptionType.Debug)
         public static final OptionKey<Integer> CompilationExpirationPeriod = new OptionKey<>(300);
         // @formatter:on
     }
@@ -85,15 +87,16 @@
 
     /**
      * Starts an alarm for setting a time limit on a compilation if there isn't already an active
-     * alarm and {@link CompilationAlarm.Options#CompilationExpirationPeriod}{@code > 0}. The
-     * returned value can be used in a try-with-resource statement to disable the alarm once the
-     * compilation is finished.
+     * alarm, if assertions are disabled and
+     * {@link CompilationAlarm.Options#CompilationExpirationPeriod}{@code > 0}. The returned value
+     * can be used in a try-with-resource statement to disable the alarm once the compilation is
+     * finished.
      *
      * @return a {@link CompilationAlarm} if there was no current alarm for the calling thread
      *         before this call otherwise {@code null}
      */
     public static CompilationAlarm trackCompilationPeriod(OptionValues options) {
-        int period = Options.CompilationExpirationPeriod.getValue(options);
+        int period = Assertions.assertionsEnabled() ? 0 : Options.CompilationExpirationPeriod.getValue(options);
         if (period > 0) {
             CompilationAlarm current = currentAlarm.get();
             if (current == null) {
@@ -105,4 +108,5 @@
         }
         return null;
     }
+
 }
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.sparc/src/org/graalvm/compiler/core/sparc/SPARCLIRKindTool.java	Wed Dec 20 09:14:52 2017 -0800
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.sparc/src/org/graalvm/compiler/core/sparc/SPARCLIRKindTool.java	Thu Dec 21 00:07:38 2017 +0100
@@ -68,7 +68,7 @@
 
     @Override
     public LIRKind getNarrowOopKind() {
-        return LIRKind.reference(SPARCKind.WORD);
+        return LIRKind.compressedReference(SPARCKind.WORD);
     }
 
     @Override
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.test/src/org/graalvm/compiler/core/test/CooperativePhaseTest.java	Wed Dec 20 09:14:52 2017 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,149 +0,0 @@
-/*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package org.graalvm.compiler.core.test;
-
-import static org.graalvm.compiler.core.common.util.CompilationAlarm.Options.CompilationExpirationPeriod;
-
-import org.graalvm.compiler.core.common.RetryableBailoutException;
-import org.graalvm.compiler.core.common.util.CompilationAlarm;
-import org.graalvm.compiler.debug.GraalError;
-import org.graalvm.compiler.nodes.StructuredGraph;
-import org.graalvm.compiler.nodes.StructuredGraph.AllowAssumptions;
-import org.graalvm.compiler.options.OptionValues;
-import org.graalvm.compiler.phases.Phase;
-import org.junit.Test;
-
-public class CooperativePhaseTest extends GraalCompilerTest {
-
-    public static void snippet() {
-        // dummy snippet
-    }
-
-    private static class CooperativePhase extends Phase {
-
-        @Override
-        protected void run(StructuredGraph graph) {
-            CompilationAlarm compilationAlarm = CompilationAlarm.current();
-            while (true) {
-                sleep(200);
-                if (compilationAlarm.hasExpired()) {
-                    return;
-                }
-            }
-        }
-
-    }
-
-    private static class UnCooperativePhase extends Phase {
-
-        @Override
-        protected void run(StructuredGraph graph) {
-            CompilationAlarm compilationAlarm = CompilationAlarm.current();
-            while (true) {
-                sleep(200);
-                if (compilationAlarm.hasExpired()) {
-                    throw new RetryableBailoutException("Expiring...");
-                }
-            }
-        }
-
-    }
-
-    private static class PartiallyCooperativePhase extends Phase {
-
-        @Override
-        protected void run(StructuredGraph graph) {
-            CompilationAlarm compilationAlarm = CompilationAlarm.current();
-            for (int i = 0; i < 10; i++) {
-                sleep(200);
-                if (compilationAlarm.hasExpired()) {
-                    throw new RuntimeException("Phase must not exit in the timeout path");
-                }
-            }
-        }
-    }
-
-    private static class CooperativePhaseWithoutAlarm extends Phase {
-
-        @Override
-        protected void run(StructuredGraph graph) {
-            CompilationAlarm compilationAlarm = CompilationAlarm.current();
-            if (compilationAlarm.hasExpired()) {
-                throw new RuntimeException("Phase must not exit in the timeout path");
-            }
-        }
-    }
-
-    private static void sleep(long millis) {
-        try {
-            Thread.sleep(millis);
-        } catch (InterruptedException e) {
-            GraalError.shouldNotReachHere(e.getCause());
-        }
-    }
-
-    @Test(timeout = 60_000)
-    @SuppressWarnings("try")
-    public void test01() {
-        initializeForTimeout();
-        OptionValues initialOptions = getInitialOptions();
-        OptionValues options = new OptionValues(initialOptions, CompilationExpirationPeriod, 1/* sec */);
-        try (CompilationAlarm c1 = CompilationAlarm.trackCompilationPeriod(options)) {
-            StructuredGraph g = parseEager("snippet", AllowAssumptions.NO, options);
-            new CooperativePhase().apply(g);
-        }
-    }
-
-    @Test(expected = RetryableBailoutException.class, timeout = 60_000)
-    @SuppressWarnings("try")
-    public void test02() {
-        initializeForTimeout();
-        OptionValues initialOptions = getInitialOptions();
-        OptionValues options = new OptionValues(initialOptions, CompilationExpirationPeriod, 1/* sec */);
-        try (CompilationAlarm c1 = CompilationAlarm.trackCompilationPeriod(options)) {
-            StructuredGraph g = parseEager("snippet", AllowAssumptions.NO, options);
-            new UnCooperativePhase().apply(g);
-        }
-    }
-
-    @Test(timeout = 60_000)
-    @SuppressWarnings("try")
-    public void test03() {
-        initializeForTimeout();
-        // 0 disables alarm utility
-        OptionValues initialOptions = getInitialOptions();
-        OptionValues options = new OptionValues(initialOptions, CompilationExpirationPeriod, 0);
-        try (CompilationAlarm c1 = CompilationAlarm.trackCompilationPeriod(options)) {
-            StructuredGraph g = parseEager("snippet", AllowAssumptions.NO, options);
-            new PartiallyCooperativePhase().apply(g);
-        }
-    }
-
-    @Test(timeout = 60_000)
-    @SuppressWarnings("try")
-    public void test04() {
-        initializeForTimeout();
-        StructuredGraph g = parseEager("snippet", AllowAssumptions.NO);
-        new CooperativePhaseWithoutAlarm().apply(g);
-    }
-}
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.test/src/org/graalvm/compiler/core/test/CountedLoopTest.java	Wed Dec 20 09:14:52 2017 -0800
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.test/src/org/graalvm/compiler/core/test/CountedLoopTest.java	Thu Dec 21 00:07:38 2017 +0100
@@ -264,7 +264,7 @@
     }
 
     @Override
-    protected boolean checkMidTierGraph(StructuredGraph graph) {
+    protected boolean checkHighTierGraph(StructuredGraph graph) {
         LoopsData loops = new LoopsData(graph);
         loops.detectedCountedLoops();
         for (IVPropertyNode node : graph.getNodes().filter(IVPropertyNode.class)) {
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.debug/src/org/graalvm/compiler/debug/Assertions.java	Wed Dec 20 09:14:52 2017 -0800
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.debug/src/org/graalvm/compiler/debug/Assertions.java	Thu Dec 21 00:07:38 2017 +0100
@@ -54,8 +54,8 @@
     // @formatter:off
     public static class Options {
 
-        @Option(help = "Enable expensive assertions. (Require normal assertions enabled)", type = OptionType.Debug)
-        public static final OptionKey<Boolean> DetailedAsserts = new OptionKey<>(true);
+        @Option(help = "Enable expensive assertions if normal assertions (i.e. -ea or -esa) are enabled.", type = OptionType.Debug)
+        public static final OptionKey<Boolean> DetailedAsserts = new OptionKey<>(false);
 
     }
     // @formatter:on
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.graph/src/org/graalvm/compiler/graph/Graph.java	Wed Dec 20 09:14:52 2017 -0800
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.graph/src/org/graalvm/compiler/graph/Graph.java	Thu Dec 21 00:07:38 2017 +0100
@@ -472,6 +472,11 @@
         }
     }
 
+    public <T extends Node> T addWithoutUniqueWithInputs(T node) {
+        addInputs(node);
+        return addHelper(node);
+    }
+
     private final class AddInputsFilter extends Node.EdgeVisitor {
 
         @Override
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot.aarch64/src/org/graalvm/compiler/hotspot/aarch64/AArch64HotSpotForeignCallsProvider.java	Wed Dec 20 09:14:52 2017 -0800
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot.aarch64/src/org/graalvm/compiler/hotspot/aarch64/AArch64HotSpotForeignCallsProvider.java	Thu Dec 21 00:07:38 2017 +0100
@@ -30,6 +30,7 @@
 import static org.graalvm.compiler.hotspot.HotSpotForeignCallLinkage.RegisterEffect.PRESERVES_REGISTERS;
 import static org.graalvm.compiler.hotspot.HotSpotForeignCallLinkage.Transition.LEAF;
 import static org.graalvm.compiler.hotspot.replacements.CRC32Substitutions.UPDATE_BYTES_CRC32;
+import static org.graalvm.compiler.hotspot.replacements.CRC32CSubstitutions.UPDATE_BYTES_CRC32C;
 import static org.graalvm.word.LocationIdentity.any;
 
 import org.graalvm.compiler.core.common.LIRKind;
@@ -79,6 +80,9 @@
         if (config.useCRC32Intrinsics) {
             registerForeignCall(UPDATE_BYTES_CRC32, config.updateBytesCRC32Stub, NativeCall, PRESERVES_REGISTERS, LEAF, NOT_REEXECUTABLE, any());
         }
+        if (config.useCRC32CIntrinsics) {
+            registerForeignCall(UPDATE_BYTES_CRC32C, config.updateBytesCRC32C, NativeCall, PRESERVES_REGISTERS, LEAF, NOT_REEXECUTABLE, any());
+        }
 
         super.initialize(providers, options);
     }
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot.aarch64/src/org/graalvm/compiler/hotspot/aarch64/AArch64HotSpotLIRGenerator.java	Wed Dec 20 09:14:52 2017 -0800
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot.aarch64/src/org/graalvm/compiler/hotspot/aarch64/AArch64HotSpotLIRGenerator.java	Thu Dec 21 00:07:38 2017 +0100
@@ -30,8 +30,8 @@
 
 import org.graalvm.compiler.asm.Label;
 import org.graalvm.compiler.asm.aarch64.AArch64Address.AddressingMode;
+import org.graalvm.compiler.asm.aarch64.AArch64Assembler.ConditionFlag;
 import org.graalvm.compiler.asm.aarch64.AArch64Assembler.PrefetchMode;
-import org.graalvm.compiler.asm.aarch64.AArch64Assembler.ConditionFlag;
 import org.graalvm.compiler.core.aarch64.AArch64ArithmeticLIRGenerator;
 import org.graalvm.compiler.core.aarch64.AArch64LIRGenerator;
 import org.graalvm.compiler.core.aarch64.AArch64LIRKindTool;
@@ -202,7 +202,7 @@
         assert inputKind.getPlatformKind() == AArch64Kind.QWORD;
         if (inputKind.isReference(0)) {
             // oop
-            Variable result = newVariable(LIRKind.reference(AArch64Kind.DWORD));
+            Variable result = newVariable(LIRKind.compressedReference(AArch64Kind.DWORD));
             append(new AArch64HotSpotMove.CompressPointer(result, asAllocatable(pointer), getProviders().getRegisters().getHeapBaseRegister().asValue(), encoding, nonNull));
             return result;
         } else {
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot.amd64/src/org/graalvm/compiler/hotspot/amd64/AMD64HotSpotForeignCallsProvider.java	Wed Dec 20 09:14:52 2017 -0800
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot.amd64/src/org/graalvm/compiler/hotspot/amd64/AMD64HotSpotForeignCallsProvider.java	Thu Dec 21 00:07:38 2017 +0100
@@ -33,6 +33,7 @@
 import static org.graalvm.compiler.hotspot.HotSpotForeignCallLinkage.Transition.LEAF;
 import static org.graalvm.compiler.hotspot.HotSpotForeignCallLinkage.Transition.LEAF_NOFP;
 import static org.graalvm.compiler.hotspot.replacements.CRC32Substitutions.UPDATE_BYTES_CRC32;
+import static org.graalvm.compiler.hotspot.replacements.CRC32CSubstitutions.UPDATE_BYTES_CRC32C;
 import static org.graalvm.word.LocationIdentity.any;
 
 import org.graalvm.compiler.core.common.LIRKind;
@@ -99,6 +100,9 @@
             // This stub does callee saving
             registerForeignCall(UPDATE_BYTES_CRC32, config.updateBytesCRC32Stub, NativeCall, PRESERVES_REGISTERS, LEAF_NOFP, NOT_REEXECUTABLE, any());
         }
+        if (config.useCRC32CIntrinsics) {
+            registerForeignCall(UPDATE_BYTES_CRC32C, config.updateBytesCRC32C, NativeCall, PRESERVES_REGISTERS, LEAF_NOFP, NOT_REEXECUTABLE, any());
+        }
 
         super.initialize(providers, options);
     }
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot.amd64/src/org/graalvm/compiler/hotspot/amd64/AMD64HotSpotLIRKindTool.java	Wed Dec 20 09:14:52 2017 -0800
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot.amd64/src/org/graalvm/compiler/hotspot/amd64/AMD64HotSpotLIRKindTool.java	Thu Dec 21 00:07:38 2017 +0100
@@ -22,14 +22,15 @@
  */
 package org.graalvm.compiler.hotspot.amd64;
 
-import jdk.vm.ci.amd64.AMD64Kind;
 import org.graalvm.compiler.core.amd64.AMD64LIRKindTool;
 import org.graalvm.compiler.core.common.LIRKind;
 
+import jdk.vm.ci.amd64.AMD64Kind;
+
 public class AMD64HotSpotLIRKindTool extends AMD64LIRKindTool {
     @Override
     public LIRKind getNarrowOopKind() {
-        return LIRKind.reference(AMD64Kind.DWORD);
+        return LIRKind.compressedReference(AMD64Kind.DWORD);
     }
 
     @Override
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot.sparc/src/org/graalvm/compiler/hotspot/sparc/SPARCHotSpotForeignCallsProvider.java	Wed Dec 20 09:14:52 2017 -0800
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot.sparc/src/org/graalvm/compiler/hotspot/sparc/SPARCHotSpotForeignCallsProvider.java	Thu Dec 21 00:07:38 2017 +0100
@@ -34,6 +34,7 @@
 import static org.graalvm.compiler.hotspot.HotSpotForeignCallLinkage.RegisterEffect.PRESERVES_REGISTERS;
 import static org.graalvm.compiler.hotspot.HotSpotForeignCallLinkage.Transition.LEAF_NOFP;
 import static org.graalvm.compiler.hotspot.replacements.CRC32Substitutions.UPDATE_BYTES_CRC32;
+import static org.graalvm.compiler.hotspot.replacements.CRC32CSubstitutions.UPDATE_BYTES_CRC32C;
 import static org.graalvm.word.LocationIdentity.any;
 
 import org.graalvm.compiler.core.common.LIRKind;
@@ -87,6 +88,9 @@
             // This stub does callee saving
             registerForeignCall(UPDATE_BYTES_CRC32, config.updateBytesCRC32Stub, NativeCall, PRESERVES_REGISTERS, LEAF_NOFP, NOT_REEXECUTABLE, any());
         }
+        if (config.useCRC32CIntrinsics) {
+            registerForeignCall(UPDATE_BYTES_CRC32C, config.updateBytesCRC32C, NativeCall, PRESERVES_REGISTERS, LEAF_NOFP, NOT_REEXECUTABLE, any());
+        }
 
         super.initialize(providers, options);
     }
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot.sparc/src/org/graalvm/compiler/hotspot/sparc/SPARCHotSpotLIRGenerator.java	Wed Dec 20 09:14:52 2017 -0800
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot.sparc/src/org/graalvm/compiler/hotspot/sparc/SPARCHotSpotLIRGenerator.java	Thu Dec 21 00:07:38 2017 +0100
@@ -307,7 +307,7 @@
         assert inputKind.getPlatformKind() == XWORD : inputKind;
         if (inputKind.isReference(0)) {
             // oop
-            Variable result = newVariable(LIRKind.reference(WORD));
+            Variable result = newVariable(LIRKind.compressedReference(WORD));
             append(new SPARCHotSpotMove.CompressPointer(result, asAllocatable(pointer), getProviders().getRegisters().getHeapBaseRegister().asValue(), encoding, nonNull));
             return result;
         } else {
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot.test/src/org/graalvm/compiler/hotspot/test/CRC32CSubstitutionsTest.java	Thu Dec 21 00:07:38 2017 +0100
@@ -0,0 +1,94 @@
+/*
+ * Copyright (c) 2007, 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package org.graalvm.compiler.hotspot.test;
+
+import java.io.DataInputStream;
+import java.io.InputStream;
+import java.nio.ByteBuffer;
+import java.util.zip.Checksum;
+
+import java.lang.invoke.MethodHandle;
+import java.lang.invoke.MethodHandles;
+import java.lang.invoke.MethodType;
+
+import org.graalvm.compiler.test.GraalTest;
+import org.graalvm.compiler.core.test.GraalCompilerTest;
+
+import org.junit.Test;
+
+import static org.junit.Assume.assumeFalse;
+
+/**
+ * Tests compiled calls to {@link java.util.zip.CRC32C}.
+ */
+@SuppressWarnings("javadoc")
+public class CRC32CSubstitutionsTest extends GraalCompilerTest {
+
+    public static long updateBytes(byte[] input, int offset, int end) throws Throwable {
+        Class<?> crcClass = Class.forName("java.util.zip.CRC32C");
+        MethodHandle newMH = MethodHandles.publicLookup().findConstructor(crcClass, MethodType.methodType(void.class));
+        Checksum crc = (Checksum) newMH.invoke();
+        crc.update(input, offset, end);
+        return crc.getValue();
+    }
+
+    @Test
+    public void test1() throws Throwable {
+        assumeFalse(GraalTest.Java8OrEarlier);
+        String classfileName = CRC32CSubstitutionsTest.class.getSimpleName().replace('.', '/') + ".class";
+        InputStream s = CRC32CSubstitutionsTest.class.getResourceAsStream(classfileName);
+        byte[] buf = new byte[s.available()];
+        new DataInputStream(s).readFully(buf);
+        int end = buf.length;
+        for (int offset = 0; offset < buf.length; offset++) {
+            test("updateBytes", buf, offset, end);
+        }
+    }
+
+    public static long updateByteBuffer(ByteBuffer buffer) throws Throwable {
+        Class<?> crcClass = Class.forName("java.util.zip.CRC32C");
+        MethodHandle newMH = MethodHandles.publicLookup().findConstructor(crcClass, MethodType.methodType(void.class));
+        MethodHandle updateMH = MethodHandles.publicLookup().findVirtual(crcClass, "update", MethodType.methodType(void.class, ByteBuffer.class));
+        Checksum crc = (Checksum) newMH.invoke();
+        buffer.rewind();
+        updateMH.invokeExact(crc, buffer); // Checksum.update(ByteBuffer) is also available since 9
+        return crc.getValue();
+    }
+
+    @Test
+    public void test2() throws Throwable {
+        assumeFalse(GraalTest.Java8OrEarlier);
+        String classfileName = CRC32CSubstitutionsTest.class.getSimpleName().replace('.', '/') + ".class";
+        InputStream s = CRC32CSubstitutionsTest.class.getResourceAsStream(classfileName);
+        byte[] buf = new byte[s.available()];
+        new DataInputStream(s).readFully(buf);
+
+        ByteBuffer directBuf = ByteBuffer.allocateDirect(buf.length);
+        directBuf.put(buf);
+        ByteBuffer heapBuf = ByteBuffer.wrap(buf);
+
+        test("updateByteBuffer", directBuf);
+        test("updateByteBuffer", heapBuf);
+    }
+
+}
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot.test/src/org/graalvm/compiler/hotspot/test/CheckGraalIntrinsics.java	Wed Dec 20 09:14:52 2017 -0800
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot.test/src/org/graalvm/compiler/hotspot/test/CheckGraalIntrinsics.java	Thu Dec 21 00:07:38 2017 +0100
@@ -466,6 +466,13 @@
             }
         }
 
+        // CRC32C intrinsics
+        if (!config.useCRC32CIntrinsics) {
+            add(IGNORE,
+                            "java/util/zip/CRC32C.updateBytes(I[BII)I",
+                            "java/util/zip/CRC32C.updateDirectByteBuffer(IJII)I");
+        }
+
         // AES intrinsics
         if (!config.useAESIntrinsics) {
             if (isJDK9OrHigher()) {
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot.test/src/org/graalvm/compiler/hotspot/test/JVMCIInfopointErrorTest.java	Wed Dec 20 09:14:52 2017 -0800
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot.test/src/org/graalvm/compiler/hotspot/test/JVMCIInfopointErrorTest.java	Thu Dec 21 00:07:38 2017 +0100
@@ -33,9 +33,9 @@
 import org.graalvm.compiler.core.common.LIRKind;
 import org.graalvm.compiler.core.common.type.StampFactory;
 import org.graalvm.compiler.core.test.GraalCompilerTest;
-import org.graalvm.compiler.debug.DebugHandlersFactory;
 import org.graalvm.compiler.debug.DebugContext;
 import org.graalvm.compiler.debug.DebugContext.Scope;
+import org.graalvm.compiler.debug.DebugHandlersFactory;
 import org.graalvm.compiler.graph.NodeClass;
 import org.graalvm.compiler.hotspot.HotSpotCompiledCodeBuilder;
 import org.graalvm.compiler.lir.FullInfopointOp;
@@ -150,7 +150,7 @@
         codeCache.addCode(method, compiledCode, null, null);
     }
 
-    @Test(expected = JVMCIError.class)
+    @Test(expected = Error.class)
     public void testInvalidShortOop() {
         test((tool, state, safepoint) -> {
             PlatformKind kind = tool.target().arch.getPlatformKind(JavaKind.Short);
@@ -163,14 +163,14 @@
         });
     }
 
-    @Test(expected = JVMCIError.class)
+    @Test(expected = Error.class)
     public void testInvalidShortDerivedOop() {
         test((tool, state, safepoint) -> {
             Variable baseOop = tool.newVariable(LIRKind.fromJavaKind(tool.target().arch, JavaKind.Object));
             tool.append(new ValueDef(baseOop));
 
             PlatformKind kind = tool.target().arch.getPlatformKind(JavaKind.Short);
-            LIRKind lirKind = LIRKind.derivedReference(kind, baseOop);
+            LIRKind lirKind = LIRKind.derivedReference(kind, baseOop, false);
 
             Variable var = tool.newVariable(lirKind);
             tool.append(new ValueDef(var));
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/GraalHotSpotVMConfig.java	Wed Dec 20 09:14:52 2017 -0800
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/GraalHotSpotVMConfig.java	Thu Dec 21 00:07:38 2017 +0100
@@ -165,6 +165,7 @@
     public final boolean usePopCountInstruction = getFlag("UsePopCountInstruction", Boolean.class);
     public final boolean useAESIntrinsics = getFlag("UseAESIntrinsics", Boolean.class);
     public final boolean useCRC32Intrinsics = getFlag("UseCRC32Intrinsics", Boolean.class);
+    public final boolean useCRC32CIntrinsics = isJDK8 ? false : getFlag("UseCRC32CIntrinsics", Boolean.class);
     public final boolean threadLocalHandshakes = getFlag("ThreadLocalHandshakes", Boolean.class, false);
 
     private final boolean useMultiplyToLenIntrinsic = getFlag("UseMultiplyToLenIntrinsic", Boolean.class);
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/HotSpotHostBackend.java	Wed Dec 20 09:14:52 2017 -0800
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/HotSpotHostBackend.java	Thu Dec 21 00:07:38 2017 +0100
@@ -45,6 +45,7 @@
 import jdk.vm.ci.common.InitTimer;
 import jdk.vm.ci.hotspot.HotSpotCallingConventionType;
 import jdk.vm.ci.hotspot.HotSpotJVMCIRuntime;
+import jdk.vm.ci.meta.JavaKind;
 import jdk.vm.ci.meta.JavaType;
 import jdk.vm.ci.runtime.JVMCICompiler;
 
@@ -142,7 +143,8 @@
 
     @Override
     public ReferenceMapBuilder newReferenceMapBuilder(int totalFrameSize) {
-        return new HotSpotReferenceMapBuilder(totalFrameSize, config.maxOopMapStackOffset);
+        int uncompressedReferenceSize = getTarget().arch.getPlatformKind(JavaKind.Object).getSizeInBytes();
+        return new HotSpotReferenceMapBuilder(totalFrameSize, config.maxOopMapStackOffset, uncompressedReferenceSize);
     }
 
 }
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/HotSpotReferenceMapBuilder.java	Wed Dec 20 09:14:52 2017 -0800
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/HotSpotReferenceMapBuilder.java	Thu Dec 21 00:07:38 2017 +0100
@@ -22,15 +22,15 @@
  */
 package org.graalvm.compiler.hotspot;
 
-import static org.graalvm.compiler.lir.LIRValueUtil.isJavaConstant;
 import static jdk.vm.ci.code.ValueUtil.asRegister;
 import static jdk.vm.ci.code.ValueUtil.asStackSlot;
 import static jdk.vm.ci.code.ValueUtil.isRegister;
+import static org.graalvm.compiler.lir.LIRValueUtil.isJavaConstant;
 
 import java.util.ArrayList;
 
+import org.graalvm.compiler.core.common.LIRKind;
 import org.graalvm.compiler.core.common.PermanentBailoutException;
-import org.graalvm.compiler.core.common.LIRKind;
 import org.graalvm.compiler.debug.GraalError;
 import org.graalvm.compiler.lir.LIRFrameState;
 import org.graalvm.compiler.lir.Variable;
@@ -52,8 +52,10 @@
 
     private final int totalFrameSize;
     private final int maxOopMapStackOffset;
+    private final int uncompressedReferenceSize;
 
-    public HotSpotReferenceMapBuilder(int totalFrameSize, int maxOopMapStackOffset) {
+    public HotSpotReferenceMapBuilder(int totalFrameSize, int maxOopMapStackOffset, int uncompressedReferenceSize) {
+        this.uncompressedReferenceSize = uncompressedReferenceSize;
         this.objectValues = new ArrayList<>();
         this.objectCount = 0;
         this.maxOopMapStackOffset = maxOopMapStackOffset;
@@ -116,6 +118,7 @@
 
                 for (int i = 0; i < kind.getPlatformKind().getVectorLength(); i++) {
                     if (kind.isReference(i)) {
+                        assert kind.isCompressedReference(i) ? (bytes < uncompressedReferenceSize) : (bytes == uncompressedReferenceSize);
                         objects[idx] = toLocation(obj, i * bytes);
                         derivedBase[idx] = base;
                         sizeInBytes[idx] = bytes;
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/meta/HotSpotGraphBuilderPlugins.java	Wed Dec 20 09:14:52 2017 -0800
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/meta/HotSpotGraphBuilderPlugins.java	Thu Dec 21 00:07:38 2017 +0100
@@ -46,6 +46,7 @@
 import org.graalvm.compiler.hotspot.replacements.AESCryptSubstitutions;
 import org.graalvm.compiler.hotspot.replacements.BigIntegerSubstitutions;
 import org.graalvm.compiler.hotspot.replacements.CRC32Substitutions;
+import org.graalvm.compiler.hotspot.replacements.CRC32CSubstitutions;
 import org.graalvm.compiler.hotspot.replacements.CallSiteTargetNode;
 import org.graalvm.compiler.hotspot.replacements.CipherBlockChainingSubstitutions;
 import org.graalvm.compiler.hotspot.replacements.ClassGetHubNode;
@@ -165,6 +166,7 @@
                 registerConstantPoolPlugins(invocationPlugins, wordTypes, config, replacementBytecodeProvider);
                 registerAESPlugins(invocationPlugins, config, replacementBytecodeProvider);
                 registerCRC32Plugins(invocationPlugins, config, replacementBytecodeProvider);
+                registerCRC32CPlugins(invocationPlugins, config, replacementBytecodeProvider);
                 registerBigIntegerPlugins(invocationPlugins, config, replacementBytecodeProvider);
                 registerSHAPlugins(invocationPlugins, config, replacementBytecodeProvider);
                 registerUnsafePlugins(invocationPlugins, replacementBytecodeProvider);
@@ -530,4 +532,12 @@
             }
         }
     }
+
+    private static void registerCRC32CPlugins(InvocationPlugins plugins, GraalHotSpotVMConfig config, BytecodeProvider bytecodeProvider) {
+        if (config.useCRC32CIntrinsics) {
+            Registration r = new Registration(plugins, "java.util.zip.CRC32C", bytecodeProvider);
+            r.registerMethodSubstitution(CRC32CSubstitutions.class, "updateBytes", int.class, byte[].class, int.class, int.class);
+            r.registerMethodSubstitution(CRC32CSubstitutions.class, "updateDirectByteBuffer", int.class, long.class, int.class, int.class);
+        }
+    }
 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/replacements/CRC32CSubstitutions.java	Thu Dec 21 00:07:38 2017 +0100
@@ -0,0 +1,64 @@
+/*
+ * Copyright (c) 2012, 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package org.graalvm.compiler.hotspot.replacements;
+
+import static org.graalvm.compiler.hotspot.replacements.HotSpotReplacementsUtil.arrayBaseOffset;
+
+import org.graalvm.compiler.api.replacements.ClassSubstitution;
+import org.graalvm.compiler.api.replacements.MethodSubstitution;
+import org.graalvm.compiler.core.common.spi.ForeignCallDescriptor;
+import org.graalvm.compiler.graph.Node.ConstantNodeParameter;
+import org.graalvm.compiler.graph.Node.NodeIntrinsic;
+import org.graalvm.compiler.hotspot.nodes.ComputeObjectAddressNode;
+import org.graalvm.compiler.nodes.extended.ForeignCallNode;
+import org.graalvm.compiler.word.Word;
+import org.graalvm.word.WordBase;
+import org.graalvm.word.WordFactory;
+
+import jdk.vm.ci.meta.JavaKind;
+
+// JaCoCo Exclude
+
+/**
+ * Substitutions for java.util.zip.CRC32C.
+ */
+@ClassSubstitution(className = "java.util.zip.CRC32C", optional = true)
+public class CRC32CSubstitutions {
+
+    @MethodSubstitution
+    static int updateBytes(int crc, byte[] b, int off, int end) {
+        Word bufAddr = WordFactory.unsigned(ComputeObjectAddressNode.get(b, arrayBaseOffset(JavaKind.Byte) + off));
+        return updateBytesCRC32(UPDATE_BYTES_CRC32C, crc, bufAddr, end - off);
+    }
+
+    @MethodSubstitution
+    static int updateDirectByteBuffer(int crc, long addr, int off, int end) {
+        WordBase bufAddr = WordFactory.unsigned(addr).add(off);
+        return updateBytesCRC32(UPDATE_BYTES_CRC32C, crc, bufAddr, end - off);
+    }
+
+    public static final ForeignCallDescriptor UPDATE_BYTES_CRC32C = new ForeignCallDescriptor("updateBytesCRC32C", int.class, int.class, WordBase.class, int.class);
+
+    @NodeIntrinsic(ForeignCallNode.class)
+    public static native int updateBytesCRC32(@ConstantNodeParameter ForeignCallDescriptor descriptor, int crc, WordBase buf, int length);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.jtt/src/org/graalvm/compiler/jtt/bytecode/BC_idiv_overflow.java	Thu Dec 21 00:07:38 2017 +0100
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package org.graalvm.compiler.jtt.bytecode;
+
+import org.junit.Test;
+
+import org.graalvm.compiler.jtt.JTTTest;
+
+/*
+ */
+public class BC_idiv_overflow extends JTTTest {
+
+    public static int test(int a, int b) {
+        return a / (b | 1);
+    }
+
+    @Test
+    public void run0() throws Throwable {
+        runTest("test", Integer.MIN_VALUE, -1);
+    }
+
+    @Test
+    public void run1() throws Throwable {
+        runTest("test", Integer.MIN_VALUE, 1);
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.jtt/src/org/graalvm/compiler/jtt/bytecode/BC_ldiv_overflow.java	Thu Dec 21 00:07:38 2017 +0100
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package org.graalvm.compiler.jtt.bytecode;
+
+import org.junit.Test;
+
+import org.graalvm.compiler.jtt.JTTTest;
+
+/*
+ */
+public class BC_ldiv_overflow extends JTTTest {
+
+    public static long test(long a, long b) {
+        return a / (b | 1);
+    }
+
+    @Test
+    public void run0() throws Throwable {
+        runTest("test", Long.MIN_VALUE, -1L);
+    }
+
+    @Test
+    public void run1() throws Throwable {
+        runTest("test", Long.MIN_VALUE, 1L);
+    }
+
+}
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/IfNode.java	Wed Dec 20 09:14:52 2017 -0800
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/IfNode.java	Thu Dec 21 00:07:38 2017 +0100
@@ -30,8 +30,6 @@
 import java.util.Iterator;
 import java.util.List;
 
-import jdk.vm.ci.meta.MetaAccessProvider;
-import jdk.vm.ci.meta.ResolvedJavaType;
 import org.graalvm.compiler.core.common.calc.Condition;
 import org.graalvm.compiler.core.common.type.IntegerStamp;
 import org.graalvm.compiler.core.common.type.Stamp;
@@ -67,7 +65,9 @@
 import jdk.vm.ci.meta.Constant;
 import jdk.vm.ci.meta.JavaConstant;
 import jdk.vm.ci.meta.JavaKind;
+import jdk.vm.ci.meta.MetaAccessProvider;
 import jdk.vm.ci.meta.PrimitiveConstant;
+import jdk.vm.ci.meta.ResolvedJavaType;
 
 /**
  * The {@code IfNode} represents a branch that can go one of two directions depending on the outcome
@@ -416,6 +416,7 @@
                 if (result.graph() == null) {
                     result = graph().addOrUniqueWithInputs(result);
                 }
+                result = proxyReplacement(result);
                 /*
                  * This optimization can be performed even if multiple values merge at this phi
                  * since the two inputs get simplified into one.
@@ -698,6 +699,7 @@
                     ValueNode falseValue = singlePhi.valueAt(falseEnd);
                     ValueNode conditional = canonicalizeConditionalCascade(tool, trueValue, falseValue);
                     if (conditional != null) {
+                        conditional = proxyReplacement(conditional);
                         singlePhi.setValueAt(trueEnd, conditional);
                         removeThroughFalseBranch(tool, merge);
                         return true;
@@ -729,6 +731,36 @@
         return false;
     }
 
+    private ValueNode proxyReplacement(ValueNode replacement) {
+        /*
+         * Special case: Every empty diamond we collapse to a conditional node can potentially
+         * contain loop exit nodes on both branches. See the graph below: The two loop exits
+         * (instanceof begin node) exit the same loop. The resulting phi is defined outside the
+         * loop, but the resulting conditional node will be inside the loop, so we need to proxy the
+         * resulting conditional node. Callers of this method ensure that true and false successor
+         * have no usages, therefore a and b in the graph below can never be proxies themselves.
+         */
+        // @formatter:off
+        //              +--+
+        //              |If|
+        //              +--+      +-----+ +-----+
+        //         +----+  +----+ |  a  | |  b  |
+        //         |Lex |  |Lex | +----^+ +^----+
+        //         +----+  +----+      |   |
+        //           +-------+         +---+
+        //           | Merge +---------+Phi|
+        //           +-------+         +---+
+        // @formatter:on
+        if (this.graph().hasValueProxies()) {
+            if (trueSuccessor instanceof LoopExitNode && falseSuccessor instanceof LoopExitNode) {
+                assert ((LoopExitNode) trueSuccessor).loopBegin() == ((LoopExitNode) falseSuccessor).loopBegin();
+                assert trueSuccessor.usages().isEmpty() && falseSuccessor.usages().isEmpty();
+                return this.graph().addOrUnique(new ValueProxyNode(replacement, (LoopExitNode) trueSuccessor));
+            }
+        }
+        return replacement;
+    }
+
     protected void removeThroughFalseBranch(SimplifierTool tool, AbstractMergeNode merge) {
         AbstractBeginNode trueBegin = trueSuccessor();
         LogicNode conditionNode = condition();
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/calc/IntegerDivRemNode.java	Wed Dec 20 09:14:52 2017 -0800
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/calc/IntegerDivRemNode.java	Thu Dec 21 00:07:38 2017 +0100
@@ -60,7 +60,8 @@
 
         // Assigning canDeopt during constructor, because it must never change during lifetime of
         // the node.
-        this.canDeopt = ((IntegerStamp) getY().stamp(NodeView.DEFAULT)).contains(0);
+        IntegerStamp yStamp = (IntegerStamp) getY().stamp(NodeView.DEFAULT);
+        this.canDeopt = yStamp.contains(0) || yStamp.contains(-1);
     }
 
     public final Op getOp() {
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.phases.common/src/org/graalvm/compiler/phases/common/ProfileCompiledMethodsPhase.java	Wed Dec 20 09:14:52 2017 -0800
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.phases.common/src/org/graalvm/compiler/phases/common/ProfileCompiledMethodsPhase.java	Thu Dec 21 00:07:38 2017 +0100
@@ -121,7 +121,7 @@
 
     private static void addSectionCounters(FixedWithNextNode start, Collection<Block> sectionBlocks, Collection<Loop<Block>> childLoops, ScheduleResult schedule, ControlFlowGraph cfg) {
         HashSet<Block> blocks = new HashSet<>(sectionBlocks);
-        for (Loop<?> loop : childLoops) {
+        for (Loop<Block> loop : childLoops) {
             blocks.removeAll(loop.getBlocks());
         }
         double weight = getSectionWeight(schedule, blocks) / cfg.blockFor(start).probability();
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.printer/src/org/graalvm/compiler/printer/GraphPrinter.java	Wed Dec 20 09:14:52 2017 -0800
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.printer/src/org/graalvm/compiler/printer/GraphPrinter.java	Thu Dec 21 00:07:38 2017 +0100
@@ -194,15 +194,26 @@
 
     static String constantToString(Object value) {
         Class<?> c = value.getClass();
+        String suffix = "";
         if (c.isArray()) {
             return constantArrayToString(value);
         } else if (value instanceof Enum) {
             return ((Enum<?>) value).name();
         } else if (isToStringTrusted(c)) {
-            return value.toString();
+            try {
+                return value.toString();
+            } catch (Throwable t) {
+                suffix = "[toString error: " + t.getClass().getName() + "]";
+                if (isToStringTrusted(t.getClass())) {
+                    try {
+                        suffix = "[toString error: " + t + "]";
+                    } catch (Throwable t2) {
+                        // No point in going further
+                    }
+                }
+            }
         }
-        return MetaUtil.getSimpleName(c, true) + "@" + Integer.toHexString(System.identityHashCode(value));
-
+        return MetaUtil.getSimpleName(c, true) + "@" + Integer.toHexString(System.identityHashCode(value)) + suffix;
     }
 
     static String constantArrayToString(Object array) {
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.replacements/src/org/graalvm/compiler/replacements/StandardGraphBuilderPlugins.java	Wed Dec 20 09:14:52 2017 -0800
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.replacements/src/org/graalvm/compiler/replacements/StandardGraphBuilderPlugins.java	Thu Dec 21 00:07:38 2017 +0100
@@ -141,6 +141,7 @@
         registerJMHBlackholePlugins(plugins, bytecodeProvider);
         registerJFRThrowablePlugins(plugins, bytecodeProvider);
         registerMethodHandleImplPlugins(plugins, snippetReflection, bytecodeProvider);
+        registerJcovCollectPlugins(plugins, bytecodeProvider);
     }
 
     private static final Field STRING_VALUE_FIELD;
@@ -910,4 +911,21 @@
             }
         });
     }
+
+    /**
+     * Registers a plugin to ignore {@code com.sun.tdk.jcov.runtime.Collect.hit} within an
+     * intrinsic.
+     */
+    private static void registerJcovCollectPlugins(InvocationPlugins plugins, BytecodeProvider bytecodeProvider) {
+        Registration r = new Registration(plugins, "com.sun.tdk.jcov.runtime.Collect", bytecodeProvider);
+        r.register1("hit", int.class, new InvocationPlugin() {
+            @Override
+            public boolean apply(GraphBuilderContext b, ResolvedJavaMethod targetMethod, Receiver receiver, ValueNode object) {
+                if (b.parsingIntrinsic()) {
+                    return true;
+                }
+                return false;
+            }
+        });
+    }
 }
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.virtual/src/org/graalvm/compiler/virtual/phases/ea/GraphEffectList.java	Wed Dec 20 09:14:52 2017 -0800
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.virtual/src/org/graalvm/compiler/virtual/phases/ea/GraphEffectList.java	Thu Dec 21 00:07:38 2017 +0100
@@ -34,7 +34,6 @@
 import org.graalvm.compiler.nodes.NodeView;
 import org.graalvm.compiler.nodes.PhiNode;
 import org.graalvm.compiler.nodes.PiNode;
-import org.graalvm.compiler.nodes.ProxyNode;
 import org.graalvm.compiler.nodes.StructuredGraph;
 import org.graalvm.compiler.nodes.ValueNode;
 import org.graalvm.compiler.nodes.debug.DynamicCounterNode;
@@ -116,14 +115,7 @@
      */
     public void addFloatingNode(ValueNode node, @SuppressWarnings("unused") String cause) {
         add("add floating node", graph -> {
-            if (node instanceof ProxyNode) {
-                ProxyNode proxyNode = (ProxyNode) node;
-                ValueNode value = proxyNode.value();
-                if (!value.isAlive()) {
-                    graph.addWithoutUnique(value);
-                }
-            }
-            graph.addWithoutUnique(node);
+            graph.addWithoutUniqueWithInputs(node);
         });
     }
 
--- a/test/hotspot/jtreg/ProblemList.txt	Wed Dec 20 09:14:52 2017 -0800
+++ b/test/hotspot/jtreg/ProblemList.txt	Thu Dec 21 00:07:38 2017 +0100
@@ -42,6 +42,7 @@
 
 compiler/ciReplay/TestSAServer.java 8029528 generic-all
 compiler/codecache/stress/OverloadCompileQueueTest.java 8166554 generic-all
+compiler/codegen/Test6896617.java 8193479 generic-all
 compiler/compilercontrol/jcmd/ClearDirectivesFileStackTest.java 8140405 generic-all
 compiler/jvmci/compilerToVM/GetResolvedJavaTypeTest.java 8158860 generic-all
 compiler/jvmci/compilerToVM/InvalidateInstalledCodeTest.java 8163894 generic-all
@@ -50,6 +51,7 @@
 compiler/tiered/LevelTransitionTest.java 8067651 generic-all
 compiler/types/correctness/CorrectnessTest.java 8066173 generic-all
 compiler/types/correctness/OffTest.java 8066173 generic-all
+compiler/c2/Test8007294.java 8192992 generic-all
 
 # aot test intermittently failing in jprt 8175791
 compiler/aot/DeoptimizationTest.java 8175791 windows-all
@@ -77,7 +79,6 @@
 # This test is disabled since it will stress NMT and timeout during normal testing
 runtime/NMT/MallocStressTest.java 8166548 generic-all
 runtime/SharedArchiveFile/DefaultUseWithClient.java 8154204 generic-all
-runtime/AppCDS/UseAppCDS.java 8165603 windows-all
 
 #############################################################################
 
--- a/test/hotspot/jtreg/compiler/ciReplay/TestDumpReplay.java	Wed Dec 20 09:14:52 2017 -0800
+++ b/test/hotspot/jtreg/compiler/ciReplay/TestDumpReplay.java	Thu Dec 21 00:07:38 2017 +0100
@@ -27,7 +27,8 @@
  * @modules java.base/jdk.internal.misc:+open
  * @build sun.hotspot.WhiteBox
  * @run main ClassFileInstaller sun.hotspot.WhiteBox
- * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI
+ * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+IgnoreUnrecognizedVMOptions
+ *                   -Xbootclasspath/a:. -XX:+WhiteBoxAPI
  *                   -Xbatch -XX:-TieredCompilation -XX:+AlwaysIncrementalInline
  *                   -XX:CompileCommand=compileonly,compiler.ciReplay.TestDumpReplay::*
  *                   compiler.ciReplay.TestDumpReplay
--- a/test/hotspot/jtreg/runtime/ErrorHandling/NestedThreadsListHandleInErrorHandlingTest.java	Wed Dec 20 09:14:52 2017 -0800
+++ b/test/hotspot/jtreg/runtime/ErrorHandling/NestedThreadsListHandleInErrorHandlingTest.java	Thu Dec 21 00:07:38 2017 +0100
@@ -89,7 +89,7 @@
         // We should have a section of Threads class SMR info:
         Pattern.compile("Threads class SMR info:"),
         // We should have one nested ThreadsListHandle:
-        Pattern.compile(".*, _smr_nested_thread_list_max=1"),
+        Pattern.compile(".*, _nested_thread_list_max=1"),
         // The current thread (marked with '=>') in the threads list
         // should show a hazard ptr:
         Pattern.compile("=>.* JavaThread \"main\" .*_threads_hazard_ptr=0x[0-9A-Fa-f][0-9A-Fa-f]*, _nested_threads_hazard_ptr_cnt=1, _nested_threads_hazard_ptrs=0x.*"),
--- a/test/hotspot/jtreg/runtime/SharedArchiveFile/ArchiveDoesNotExist.java	Wed Dec 20 09:14:52 2017 -0800
+++ b/test/hotspot/jtreg/runtime/SharedArchiveFile/ArchiveDoesNotExist.java	Thu Dec 21 00:07:38 2017 +0100
@@ -28,7 +28,7 @@
  *          attempting to use CDS archive. JVM should exit gracefully
  *          when sharing mode is ON, and continue w/o sharing if sharing
  *          mode is AUTO.
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ * @requires vm.cds
  * @library /test/lib
  * @modules java.base/jdk.internal.misc
  *          java.management
--- a/test/hotspot/jtreg/runtime/SharedArchiveFile/BootAppendTests.java	Wed Dec 20 09:14:52 2017 -0800
+++ b/test/hotspot/jtreg/runtime/SharedArchiveFile/BootAppendTests.java	Thu Dec 21 00:07:38 2017 +0100
@@ -23,9 +23,9 @@
 
 /**
  * @test
- * @requires vm.cds
+ * @requires vm.cds & !vm.graal.enabled
  * @summary Testing -Xbootclasspath/a support for CDS
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ * @requires vm.cds
  * @library /test/lib
  * @modules java.base/jdk.internal.misc
  *          java.management
--- a/test/hotspot/jtreg/runtime/SharedArchiveFile/CdsDifferentCompactStrings.java	Wed Dec 20 09:14:52 2017 -0800
+++ b/test/hotspot/jtreg/runtime/SharedArchiveFile/CdsDifferentCompactStrings.java	Thu Dec 21 00:07:38 2017 +0100
@@ -26,7 +26,7 @@
  * @requires vm.cds
  * @summary CDS (class data sharing) requires the same -XX:[+-]CompactStrings
  *          setting between archive creation time and load time.
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ * @requires vm.cds
  * @library /test/lib
  * @modules java.base/jdk.internal.misc
  *          java.management
--- a/test/hotspot/jtreg/runtime/SharedArchiveFile/CdsDifferentObjectAlignment.java	Wed Dec 20 09:14:52 2017 -0800
+++ b/test/hotspot/jtreg/runtime/SharedArchiveFile/CdsDifferentObjectAlignment.java	Thu Dec 21 00:07:38 2017 +0100
@@ -29,7 +29,7 @@
  *          This is a negative test; using  object alignment for loading that
  *          is different from object alignment for creating a CDS file
  *          should fail when loading.
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ * @requires vm.cds
  * @library /test/lib
  * @bug 8025642
  * @modules java.base/jdk.internal.misc
--- a/test/hotspot/jtreg/runtime/SharedArchiveFile/CdsSameObjectAlignment.java	Wed Dec 20 09:14:52 2017 -0800
+++ b/test/hotspot/jtreg/runtime/SharedArchiveFile/CdsSameObjectAlignment.java	Thu Dec 21 00:07:38 2017 +0100
@@ -26,7 +26,7 @@
  * @requires vm.cds
  * @summary Testing CDS (class data sharing) using varying object alignment.
  *          Using same object alignment for each dump/load pair
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ * @requires vm.cds
  * @library /test/lib
  * @modules java.base/jdk.internal.misc
  *          java.management
--- a/test/hotspot/jtreg/runtime/SharedArchiveFile/DefaultUseWithClient.java	Wed Dec 20 09:14:52 2017 -0800
+++ b/test/hotspot/jtreg/runtime/SharedArchiveFile/DefaultUseWithClient.java	Thu Dec 21 00:07:38 2017 +0100
@@ -24,7 +24,7 @@
 /*
  * @test DefaultUseWithClient
  * @summary Test default behavior of sharing with -client
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ * @requires vm.cds
  * @library /test/lib
  * @modules java.base/jdk.internal.misc
  *          java.management
--- a/test/hotspot/jtreg/runtime/SharedArchiveFile/DumpSharedDictionary.java	Wed Dec 20 09:14:52 2017 -0800
+++ b/test/hotspot/jtreg/runtime/SharedArchiveFile/DumpSharedDictionary.java	Thu Dec 21 00:07:38 2017 +0100
@@ -28,7 +28,7 @@
  * Feature support: compressed oops/kptrs, 64-bit os, not on windows
  * @requires vm.cds
  * @requires (sun.arch.data.model != "32") & (os.family != "windows")
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ * @requires vm.cds
  * @library /test/lib
  * @modules java.base/jdk.internal.misc
  * @run main DumpSharedDictionary
--- a/test/hotspot/jtreg/runtime/SharedArchiveFile/NonBootLoaderClasses.java	Wed Dec 20 09:14:52 2017 -0800
+++ b/test/hotspot/jtreg/runtime/SharedArchiveFile/NonBootLoaderClasses.java	Thu Dec 21 00:07:38 2017 +0100
@@ -24,7 +24,7 @@
 /*
  * @test NonBootLoaderClasses
  * @summary Test to ensure platform and app classes are not being archived
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ * @requires vm.cds
  * @library /test/lib
  * @modules java.base/jdk.internal.misc
  *          java.management
--- a/test/hotspot/jtreg/runtime/SharedArchiveFile/PrintSharedArchiveAndExit.java	Wed Dec 20 09:14:52 2017 -0800
+++ b/test/hotspot/jtreg/runtime/SharedArchiveFile/PrintSharedArchiveAndExit.java	Thu Dec 21 00:07:38 2017 +0100
@@ -26,7 +26,7 @@
  * @requires vm.cds
  * @bug 8066670
  * @summary Testing -XX:+PrintSharedArchiveAndExit option
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ * @requires vm.cds
  * @library /test/lib
  * @modules java.base/jdk.internal.misc
  *          java.management
--- a/test/hotspot/jtreg/runtime/SharedArchiveFile/SASymbolTableTest.java	Wed Dec 20 09:14:52 2017 -0800
+++ b/test/hotspot/jtreg/runtime/SharedArchiveFile/SASymbolTableTest.java	Thu Dec 21 00:07:38 2017 +0100
@@ -25,7 +25,7 @@
  * @test SASymbolTableTest
  * @requires vm.cds
  * @summary Walk symbol table using SA, with and without CDS.
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ * @requires vm.cds
  * @library /test/lib
  * @modules java.base/jdk.internal.misc
  *          jdk.hotspot.agent/sun.jvm.hotspot.oops
--- a/test/hotspot/jtreg/runtime/SharedArchiveFile/SharedArchiveFile.java	Wed Dec 20 09:14:52 2017 -0800
+++ b/test/hotspot/jtreg/runtime/SharedArchiveFile/SharedArchiveFile.java	Thu Dec 21 00:07:38 2017 +0100
@@ -26,7 +26,7 @@
  * @requires vm.cds
  * @bug 8014138
  * @summary Testing new -XX:SharedArchiveFile=<file-name> option
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ * @requires vm.cds
  * @library /test/lib
  * @modules java.base/jdk.internal.misc
  *          java.management
--- a/test/hotspot/jtreg/runtime/SharedArchiveFile/SharedBaseAddress.java	Wed Dec 20 09:14:52 2017 -0800
+++ b/test/hotspot/jtreg/runtime/SharedArchiveFile/SharedBaseAddress.java	Thu Dec 21 00:07:38 2017 +0100
@@ -26,7 +26,7 @@
  * @requires vm.cds
  * @summary Test variety of values for SharedBaseAddress, making sure
  *          VM handles normal values as well as edge values w/o a crash.
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ * @requires vm.cds
  * @library /test/lib
  * @modules java.base/jdk.internal.misc
  *          java.management
--- a/test/hotspot/jtreg/runtime/SharedArchiveFile/SharedStrings.java	Wed Dec 20 09:14:52 2017 -0800
+++ b/test/hotspot/jtreg/runtime/SharedArchiveFile/SharedStrings.java	Thu Dec 21 00:07:38 2017 +0100
@@ -28,7 +28,7 @@
  *          are actually shared
  * Feature support: G1GC only, compressed oops/kptrs, 64-bit os, not on windows
  * @requires (sun.arch.data.model != "32") & (os.family != "windows")
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ * @requires vm.cds
  * @requires vm.gc.G1
  * @library /test/lib
  * @modules java.base/jdk.internal.misc
--- a/test/hotspot/jtreg/runtime/SharedArchiveFile/SharedStringsDedup.java	Wed Dec 20 09:14:52 2017 -0800
+++ b/test/hotspot/jtreg/runtime/SharedArchiveFile/SharedStringsDedup.java	Thu Dec 21 00:07:38 2017 +0100
@@ -27,7 +27,7 @@
  * @summary Test -Xshare:auto with shared strings and -XX:+UseStringDeduplication
  * Feature support: G1GC only, compressed oops/kptrs, 64-bit os, not on windows
  * @requires (sun.arch.data.model != "32") & (os.family != "windows")
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ * @requires vm.cds
  * @requires vm.gc.G1
  * @library /test/lib
  * @modules java.base/jdk.internal.misc
--- a/test/hotspot/jtreg/runtime/SharedArchiveFile/SharedStringsRunAuto.java	Wed Dec 20 09:14:52 2017 -0800
+++ b/test/hotspot/jtreg/runtime/SharedArchiveFile/SharedStringsRunAuto.java	Thu Dec 21 00:07:38 2017 +0100
@@ -27,7 +27,7 @@
  * @summary Test -Xshare:auto with shared strings.
  * Feature support: G1GC only, compressed oops/kptrs, 64-bit os, not on windows
  * @requires (sun.arch.data.model != "32") & (os.family != "windows")
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ * @requires vm.cds
  * @requires vm.gc.G1
  * @library /test/lib
  * @modules java.base/jdk.internal.misc
--- a/test/hotspot/jtreg/runtime/SharedArchiveFile/SharedSymbolTableBucketSize.java	Wed Dec 20 09:14:52 2017 -0800
+++ b/test/hotspot/jtreg/runtime/SharedArchiveFile/SharedSymbolTableBucketSize.java	Thu Dec 21 00:07:38 2017 +0100
@@ -26,7 +26,7 @@
  * @requires vm.cds
  * @bug 8059510
  * @summary Test SharedSymbolTableBucketSize option
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ * @requires vm.cds
  * @library /test/lib
  * @modules java.base/jdk.internal.misc
  *          java.management
--- a/test/hotspot/jtreg/runtime/SharedArchiveFile/SpaceUtilizationCheck.java	Wed Dec 20 09:14:52 2017 -0800
+++ b/test/hotspot/jtreg/runtime/SharedArchiveFile/SpaceUtilizationCheck.java	Thu Dec 21 00:07:38 2017 +0100
@@ -25,7 +25,7 @@
  * @test SpaceUtilizationCheck
  * @requires vm.cds
  * @summary Check if the space utilization for shared spaces is adequate
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ * @requires vm.cds
  * @library /test/lib
  * @modules java.base/jdk.internal.misc
  *          java.management
--- a/test/hotspot/jtreg/runtime/SharedArchiveFile/TestInterpreterMethodEntries.java	Wed Dec 20 09:14:52 2017 -0800
+++ b/test/hotspot/jtreg/runtime/SharedArchiveFile/TestInterpreterMethodEntries.java	Thu Dec 21 00:07:38 2017 +0100
@@ -27,7 +27,7 @@
  * @bug 8169711
  * @summary Test interpreter method entries for intrinsics with CDS (class data sharing)
  *          and different settings of the intrinsic flag during dump/use of the archive.
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ * @requires vm.cds
  * @library /test/lib
  * @modules java.base/jdk.internal.misc
  *          java.management
--- a/test/hotspot/jtreg/runtime/SharedArchiveFile/serviceability/transformRelatedClasses/TransformInterfaceAndImplementor.java	Wed Dec 20 09:14:52 2017 -0800
+++ b/test/hotspot/jtreg/runtime/SharedArchiveFile/serviceability/transformRelatedClasses/TransformInterfaceAndImplementor.java	Thu Dec 21 00:07:38 2017 +0100
@@ -27,7 +27,7 @@
  * @summary Exercise initial transformation (ClassFileLoadHook)
  *  with CDS with Interface/Implementor pair
  * @library /test/lib /runtime/SharedArchiveFile /testlibrary/jvmti
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ * @requires vm.cds
  * @requires vm.flavor != "minimal"
  * @modules java.base/jdk.internal.misc
  *          jdk.jartool/sun.tools.jar
--- a/test/hotspot/jtreg/runtime/SharedArchiveFile/serviceability/transformRelatedClasses/TransformSuperAndSubClasses.java	Wed Dec 20 09:14:52 2017 -0800
+++ b/test/hotspot/jtreg/runtime/SharedArchiveFile/serviceability/transformRelatedClasses/TransformSuperAndSubClasses.java	Thu Dec 21 00:07:38 2017 +0100
@@ -28,7 +28,7 @@
  * @summary Exercise initial transformation (ClassFileLoadHook)
  *  with CDS with SubClass and SuperClass
  * @library /test/lib /runtime/SharedArchiveFile /testlibrary/jvmti
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ * @requires vm.cds
  * @requires vm.flavor != "minimal"
  * @modules java.base/jdk.internal.misc
  *          jdk.jartool/sun.tools.jar
--- a/test/hotspot/jtreg/runtime/SharedArchiveFile/serviceability/transformRelatedClasses/TransformSuperSubTwoPckgs.java	Wed Dec 20 09:14:52 2017 -0800
+++ b/test/hotspot/jtreg/runtime/SharedArchiveFile/serviceability/transformRelatedClasses/TransformSuperSubTwoPckgs.java	Thu Dec 21 00:07:38 2017 +0100
@@ -28,7 +28,7 @@
  * @summary Exercise initial transformation (ClassFileLoadHook)
  *  with CDS with SubClass and SuperClass, each lives in own separate package
  * @library /test/lib /runtime/SharedArchiveFile /testlibrary/jvmti
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ * @requires vm.cds
  * @requires vm.flavor != "minimal"
  * @modules java.base/jdk.internal.misc
  *          jdk.jartool/sun.tools.jar
--- a/test/hotspot/jtreg/runtime/Thread/TestThreadDumpSMRInfo.java	Wed Dec 20 09:14:52 2017 -0800
+++ b/test/hotspot/jtreg/runtime/Thread/TestThreadDumpSMRInfo.java	Thu Dec 21 00:07:38 2017 +0100
@@ -45,7 +45,7 @@
     // Here's a sample "Threads class SMR info" section:
     //
     // Threads class SMR info:
-    // _smr_java_thread_list=0x0000000000ce8da0, length=23, elements={
+    // _java_thread_list=0x0000000000ce8da0, length=23, elements={
     // 0x000000000043a800, 0x0000000000aee800, 0x0000000000b06800, 0x0000000000b26000,
     // 0x0000000000b28800, 0x0000000000b2b000, 0x0000000000b2e000, 0x0000000000b30000,
     // 0x0000000000b32800, 0x0000000000b35000, 0x0000000000b3f000, 0x0000000000b41800,
@@ -53,9 +53,9 @@
     // 0x0000000000b55800, 0x0000000000b57800, 0x0000000000b5a000, 0x0000000000b5c800,
     // 0x0000000000cc8800, 0x0000000000fd9800, 0x0000000000ef4800
     // }
-    // _smr_java_thread_list_alloc_cnt=24, _smr_java_thread_list_free_cnt=23, _smr_java_thread_list_max=23, _smr_nested_thread_list_max=0
-    // _smr_delete_lock_wait_cnt=0, _smr_delete_lock_wait_max=0
-    // _smr_to_delete_list_cnt=0, _smr_to_delete_list_max=1
+    // _java_thread_list_alloc_cnt=24, _java_thread_list_free_cnt=23, _java_thread_list_max=23, _nested_thread_list_max=0
+    // _delete_lock_wait_cnt=0, _delete_lock_wait_max=0
+    // _to_delete_list_cnt=0, _to_delete_list_max=1
 
     final static String HEADER_STR = "Threads class SMR info:";
 
--- a/test/hotspot/jtreg/runtime/appcds/AppendClasspath.java	Wed Dec 20 09:14:52 2017 -0800
+++ b/test/hotspot/jtreg/runtime/appcds/AppendClasspath.java	Thu Dec 21 00:07:38 2017 +0100
@@ -25,8 +25,7 @@
 /*
  * @test
  * @summary At run time, it is OK to append new elements to the classpath that was used at dump time.
- * AppCDS does not support uncompressed oops
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ * @requires vm.cds
  * @library /test/lib
  * @modules java.base/jdk.internal.misc
  *          java.management
--- a/test/hotspot/jtreg/runtime/appcds/BootClassPathMismatch.java	Wed Dec 20 09:14:52 2017 -0800
+++ b/test/hotspot/jtreg/runtime/appcds/BootClassPathMismatch.java	Thu Dec 21 00:07:38 2017 +0100
@@ -25,8 +25,7 @@
 /*
  * @test
  * @summary bootclasspath mismatch test.
- * AppCDS does not support uncompressed oops
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ * @requires vm.cds
  * @library /test/lib
  * @modules java.base/jdk.internal.misc
  *          java.management
--- a/test/hotspot/jtreg/runtime/appcds/CaseSensitiveClassPath.java	Wed Dec 20 09:14:52 2017 -0800
+++ b/test/hotspot/jtreg/runtime/appcds/CaseSensitiveClassPath.java	Thu Dec 21 00:07:38 2017 +0100
@@ -27,7 +27,7 @@
  * @test
  * @summary Test case sensitive aspect of comparing class paths
  *     between dump time and archive use time
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ * @requires vm.cds
  * @library /test/lib
  * @modules java.base/jdk.internal.misc
  *          java.management
--- a/test/hotspot/jtreg/runtime/appcds/ClassLoaderTest.java	Wed Dec 20 09:14:52 2017 -0800
+++ b/test/hotspot/jtreg/runtime/appcds/ClassLoaderTest.java	Thu Dec 21 00:07:38 2017 +0100
@@ -25,8 +25,7 @@
 /*
  * @test
  * @summary Initiating and defining classloader test.
- * AppCDS does not support uncompressed oops
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ * @requires vm.cds
  * @library /test/lib
  * @modules java.base/jdk.internal.misc
  *          java.management
--- a/test/hotspot/jtreg/runtime/appcds/ClassPathAttr.java	Wed Dec 20 09:14:52 2017 -0800
+++ b/test/hotspot/jtreg/runtime/appcds/ClassPathAttr.java	Thu Dec 21 00:07:38 2017 +0100
@@ -25,8 +25,7 @@
 /*
  * @test
  * @summary Class-Path: attribute in MANIFEST file
- * AppCDS does not support uncompressed oops
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ * @requires vm.cds
  * @library /test/lib
  * @modules java.base/jdk.internal.misc
  *          java.management
--- a/test/hotspot/jtreg/runtime/appcds/CommandLineFlagCombo.java	Wed Dec 20 09:14:52 2017 -0800
+++ b/test/hotspot/jtreg/runtime/appcds/CommandLineFlagCombo.java	Thu Dec 21 00:07:38 2017 +0100
@@ -24,8 +24,8 @@
 
 /*
  * @test CommandLineFlagCombo
- * AppCDS does not support uncompressed oops
- * @requires (vm.gc=="null") & ((vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true))
+ * @requires vm.cds
+ * @requires (vm.gc=="null")
  * @summary Test command line flag combinations that
  *          could likely affect the behaviour of AppCDS
  * @library /test/lib
--- a/test/hotspot/jtreg/runtime/appcds/CommandLineFlagComboNegative.java	Wed Dec 20 09:14:52 2017 -0800
+++ b/test/hotspot/jtreg/runtime/appcds/CommandLineFlagComboNegative.java	Thu Dec 21 00:07:38 2017 +0100
@@ -28,8 +28,7 @@
  *          the dump and execute steps, in such way that they cause errors
  *          E.g. use compressed oops for creating and archive, but then
  *               execute w/o compressed oops
- * AppCDS does not support uncompressed oops
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ * @requires vm.cds
  * @library /test/lib
  * @modules java.base/jdk.internal.misc
  *          java.management
--- a/test/hotspot/jtreg/runtime/appcds/DirClasspathTest.java	Wed Dec 20 09:14:52 2017 -0800
+++ b/test/hotspot/jtreg/runtime/appcds/DirClasspathTest.java	Thu Dec 21 00:07:38 2017 +0100
@@ -25,8 +25,7 @@
 /*
  * @test
  * @summary AppCDS handling of directories in -cp
- * AppCDS does not support uncompressed oops
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ * @requires vm.cds
  * @library /test/lib
  * @run main DirClasspathTest
  */
--- a/test/hotspot/jtreg/runtime/appcds/DumpClassList.java	Wed Dec 20 09:14:52 2017 -0800
+++ b/test/hotspot/jtreg/runtime/appcds/DumpClassList.java	Thu Dec 21 00:07:38 2017 +0100
@@ -26,7 +26,7 @@
  * @test
  * @summary DumpLoadedClassList should exclude generated classes, classes in bootclasspath/a and
  *          --patch-module.
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ * @requires vm.cds
  * @library /test/lib
  * @modules java.base/jdk.internal.misc
  *          jdk.jartool/sun.tools.jar
--- a/test/hotspot/jtreg/runtime/appcds/ExtraSymbols.java	Wed Dec 20 09:14:52 2017 -0800
+++ b/test/hotspot/jtreg/runtime/appcds/ExtraSymbols.java	Thu Dec 21 00:07:38 2017 +0100
@@ -25,7 +25,7 @@
 /*
  * @test
  * @summary Adding extra symbols into CDS archive using -XX:SharedArchiveConfigFile
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ * @requires vm.cds
  * @library /test/lib
  * @modules java.base/jdk.internal.misc
  *          java.management
--- a/test/hotspot/jtreg/runtime/appcds/FieldAnnotationsTest.java	Wed Dec 20 09:14:52 2017 -0800
+++ b/test/hotspot/jtreg/runtime/appcds/FieldAnnotationsTest.java	Thu Dec 21 00:07:38 2017 +0100
@@ -25,7 +25,7 @@
 /*
  * @test
  * @summary Test for field annotations.
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ * @requires vm.cds
  * @library /test/lib
  * @modules java.base/jdk.internal.misc
  *          java.management
--- a/test/hotspot/jtreg/runtime/appcds/FreeUnusedMetadata.java	Wed Dec 20 09:14:52 2017 -0800
+++ b/test/hotspot/jtreg/runtime/appcds/FreeUnusedMetadata.java	Thu Dec 21 00:07:38 2017 +0100
@@ -25,7 +25,7 @@
 /*
  * @test
  * @summary Unused metadata created during dump time should be freed from the CDS archive.
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ * @requires vm.cds
  * @library /test/lib
  * @modules jdk.jartool/sun.tools.jar
  * @compile test-classes/MethodNoReturn.jasm test-classes/Hello.java
--- a/test/hotspot/jtreg/runtime/appcds/HelloExtTest.java	Wed Dec 20 09:14:52 2017 -0800
+++ b/test/hotspot/jtreg/runtime/appcds/HelloExtTest.java	Thu Dec 21 00:07:38 2017 +0100
@@ -25,8 +25,7 @@
 /*
  * @test
  * @summary a simple test for loading a class using the ext class loader in AppCDS
- * AppCDS does not support uncompressed oops
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ * @requires vm.cds
  * @library /test/lib
  * @modules java.base/jdk.internal.misc
  *          java.management
--- a/test/hotspot/jtreg/runtime/appcds/HelloTest.java	Wed Dec 20 09:14:52 2017 -0800
+++ b/test/hotspot/jtreg/runtime/appcds/HelloTest.java	Thu Dec 21 00:07:38 2017 +0100
@@ -25,8 +25,7 @@
 /*
  * @test
  * @summary Hello World test for AppCDS
- * AppCDS does not support uncompressed oops
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ * @requires vm.cds
  * @library /test/lib
  * @modules java.base/jdk.internal.misc
  *          java.management
@@ -36,7 +35,6 @@
  */
 
 public class HelloTest {
-
   public static void main(String[] args) throws Exception {
       TestCommon.test(JarBuilder.getOrCreateHelloJar(),
           TestCommon.list("Hello"), "Hello");
--- a/test/hotspot/jtreg/runtime/appcds/IgnoreEmptyClassPaths.java	Wed Dec 20 09:14:52 2017 -0800
+++ b/test/hotspot/jtreg/runtime/appcds/IgnoreEmptyClassPaths.java	Thu Dec 21 00:07:38 2017 +0100
@@ -25,8 +25,7 @@
 /*
  * @test
  * @summary Test the -XX:+IgnoreEmptyClassPaths flag
- * AppCDS does not support uncompressed oops
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ * @requires vm.cds
  * @library /test/lib
  * @modules java.base/jdk.internal.misc
  *          java.management
--- a/test/hotspot/jtreg/runtime/appcds/JvmtiAddPath.java	Wed Dec 20 09:14:52 2017 -0800
+++ b/test/hotspot/jtreg/runtime/appcds/JvmtiAddPath.java	Thu Dec 21 00:07:38 2017 +0100
@@ -25,8 +25,7 @@
 /*
  * @test
  * @summary JvmtiEnv::AddToBootstrapClassLoaderSearch and JvmtiEnv::AddToSystemClassLoaderSearch should disable AppCDS
- * AppCDS does not support uncompressed oops
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ * @requires vm.cds
  * @bug 8060592
  * @library /test/lib
  * @modules java.base/jdk.internal.misc
--- a/test/hotspot/jtreg/runtime/appcds/MismatchedUseAppCDS.java	Wed Dec 20 09:14:52 2017 -0800
+++ b/test/hotspot/jtreg/runtime/appcds/MismatchedUseAppCDS.java	Thu Dec 21 00:07:38 2017 +0100
@@ -25,8 +25,7 @@
 /*
  * @test
  * @summary Try different combination of mismatched UseAppCDS between dump time and run time.
- * (Note: AppCDS does not support uncompressed oops.)
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ * @requires vm.cds
  * @library /test/lib
  * @modules java.base/jdk.internal.misc
  *          java.management
--- a/test/hotspot/jtreg/runtime/appcds/MissingSuperTest.java	Wed Dec 20 09:14:52 2017 -0800
+++ b/test/hotspot/jtreg/runtime/appcds/MissingSuperTest.java	Thu Dec 21 00:07:38 2017 +0100
@@ -25,8 +25,8 @@
 /*
  * @test
  * @summary When super class is missing during dumping, no crash should happen.
- * AppCDS does not support uncompressed oops
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ *
+ * @requires vm.cds
  * @library /test/lib
  * @modules java.base/jdk.internal.misc
  *          java.management
--- a/test/hotspot/jtreg/runtime/appcds/MultiProcessSharing.java	Wed Dec 20 09:14:52 2017 -0800
+++ b/test/hotspot/jtreg/runtime/appcds/MultiProcessSharing.java	Thu Dec 21 00:07:38 2017 +0100
@@ -25,8 +25,8 @@
 /*
  * @test
  * @summary Run multiple processes with the same archive, ensure they share
- * AppCDS does not support uncompressed oops
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ *
+ * @requires vm.cds
  * @library /test/lib
  * @modules java.base/jdk.internal.misc
  *          java.management
--- a/test/hotspot/jtreg/runtime/appcds/MultiReleaseJars.java	Wed Dec 20 09:14:52 2017 -0800
+++ b/test/hotspot/jtreg/runtime/appcds/MultiReleaseJars.java	Thu Dec 21 00:07:38 2017 +0100
@@ -26,8 +26,7 @@
  * @test MultiReleaseJars
  * @bug 8170105
  * @summary Test multi-release jar with AppCDS.
- * AppCDS does not support uncompressed oops
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ * @requires vm.cds
  * @library /test/lib
  * @modules java.base/jdk.internal.misc
  *          jdk.jartool/sun.tools.jar
@@ -72,13 +71,14 @@
         if (contents == null) {
             throw new java.lang.RuntimeException("No input for writing to file" + file);
         }
-        FileOutputStream fos = new FileOutputStream(file);
-        PrintStream ps = new PrintStream(fos);
-        for (String str : contents) {
-            ps.println(str);
+        try (
+             FileOutputStream fos = new FileOutputStream(file);
+             PrintStream ps = new PrintStream(fos)
+        ) {
+            for (String str : contents) {
+                ps.println(str);
+            }
         }
-        ps.close();
-        fos.close();
     }
 
     /* version.jar entries and files:
--- a/test/hotspot/jtreg/runtime/appcds/OldClassTest.java	Wed Dec 20 09:14:52 2017 -0800
+++ b/test/hotspot/jtreg/runtime/appcds/OldClassTest.java	Thu Dec 21 00:07:38 2017 +0100
@@ -25,8 +25,7 @@
 /*
  * @test
  * @summary classes with major version < JDK_1.5 (48) should not be included in CDS
- * AppCDS does not support uncompressed oops
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ * @requires vm.cds
  * @library /test/lib
  * @modules java.base/jdk.internal.org.objectweb.asm
  *          java.base/jdk.internal.misc
--- a/test/hotspot/jtreg/runtime/appcds/PackageSealing.java	Wed Dec 20 09:14:52 2017 -0800
+++ b/test/hotspot/jtreg/runtime/appcds/PackageSealing.java	Thu Dec 21 00:07:38 2017 +0100
@@ -25,8 +25,7 @@
 /*
  * @test
  * @summary AppCDS handling of package.
- * AppCDS does not support uncompressed oops
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ * @requires vm.cds
  * @library /test/lib
  * @modules java.base/jdk.internal.misc
  *          java.management
--- a/test/hotspot/jtreg/runtime/appcds/ParallelLoad2.java	Wed Dec 20 09:14:52 2017 -0800
+++ b/test/hotspot/jtreg/runtime/appcds/ParallelLoad2.java	Thu Dec 21 00:07:38 2017 +0100
@@ -25,8 +25,7 @@
 /*
  * @test
  * @summary Load app classes from CDS archive in parallel threads. Similar to ParallelLoad.java, but each class in its own JAR
- * AppCDS does not support uncompressed oops
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ * @requires vm.cds
  * @library /test/lib
  * @modules java.base/jdk.internal.misc
  *          java.management
--- a/test/hotspot/jtreg/runtime/appcds/ParallelLoadTest.java	Wed Dec 20 09:14:52 2017 -0800
+++ b/test/hotspot/jtreg/runtime/appcds/ParallelLoadTest.java	Thu Dec 21 00:07:38 2017 +0100
@@ -25,9 +25,8 @@
 /*
  * @test
  * @summary Load app classes from CDS archive in parallel threads
- * AppCDS does not support uncompressed oops
  * @library /test/lib
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ * @requires vm.cds
  * @modules java.base/jdk.internal.misc
  *          java.management
  *          jdk.jartool/sun.tools.jar
--- a/test/hotspot/jtreg/runtime/appcds/PrintSharedArchiveAndExit.java	Wed Dec 20 09:14:52 2017 -0800
+++ b/test/hotspot/jtreg/runtime/appcds/PrintSharedArchiveAndExit.java	Thu Dec 21 00:07:38 2017 +0100
@@ -25,8 +25,7 @@
 /*
  * @test
  * @summary test the -XX:+PrintSharedArchiveAndExit flag
- * AppCDS does not support uncompressed oops
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ * @requires vm.cds
  * @library /test/lib
  * @modules java.base/jdk.internal.misc
  *          java.management
--- a/test/hotspot/jtreg/runtime/appcds/ProhibitedPackage.java	Wed Dec 20 09:14:52 2017 -0800
+++ b/test/hotspot/jtreg/runtime/appcds/ProhibitedPackage.java	Thu Dec 21 00:07:38 2017 +0100
@@ -25,8 +25,7 @@
 /*
  * @test
  * @summary AppCDS handling of prohibited package.
- * AppCDS does not support uncompressed oops
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ * @requires vm.cds
  * @requires vm.cds
  * @library /test/lib
  * @modules java.base/jdk.internal.misc
--- a/test/hotspot/jtreg/runtime/appcds/ProtectionDomain.java	Wed Dec 20 09:14:52 2017 -0800
+++ b/test/hotspot/jtreg/runtime/appcds/ProtectionDomain.java	Thu Dec 21 00:07:38 2017 +0100
@@ -25,8 +25,7 @@
 /*
  * @test
  * @summary AppCDS handling of protection domain.
- * AppCDS does not support uncompressed oops
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ * @requires vm.cds
  * @library /test/lib
  * @modules java.base/jdk.internal.misc
  *          java.management
--- a/test/hotspot/jtreg/runtime/appcds/RewriteBytecodesTest.java	Wed Dec 20 09:14:52 2017 -0800
+++ b/test/hotspot/jtreg/runtime/appcds/RewriteBytecodesTest.java	Thu Dec 21 00:07:38 2017 +0100
@@ -26,8 +26,7 @@
  * @test
  * @summary Use ClassLoader.defineClass() to load a class with rewritten bytecode. Make sure
  *          the archived class with the same name is not loaded.
- * AppCDS does not support uncompressed oops
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ * @requires vm.cds
  * @library /test/lib
  * @modules java.base/jdk.internal.misc
  *          java.management
--- a/test/hotspot/jtreg/runtime/appcds/SharedArchiveConsistency.java	Wed Dec 20 09:14:52 2017 -0800
+++ b/test/hotspot/jtreg/runtime/appcds/SharedArchiveConsistency.java	Thu Dec 21 00:07:38 2017 +0100
@@ -23,20 +23,19 @@
  */
 
 /*
- *  @test
- *  @summary SharedArchiveConsistency
- *   AppCDS does not support uncompressed oops
- *  @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
- *  @library /test/lib
- *  @modules java.base/jdk.internal.misc
- *           java.compiler
- *           java.management
- *           jdk.jartool/sun.tools.jar
- *           jdk.internal.jvmstat/sun.jvmstat.monitor
- *  @build sun.hotspot.WhiteBox
- *  @compile test-classes/Hello.java
- *  @run main ClassFileInstaller sun.hotspot.WhiteBox
- *  @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI SharedArchiveConsistency
+ * @test
+ * @summary SharedArchiveConsistency
+ * @requires vm.cds
+ * @library /test/lib
+ * @modules java.base/jdk.internal.misc
+ *          java.compiler
+ *          java.management
+ *          jdk.jartool/sun.tools.jar
+ *          jdk.internal.jvmstat/sun.jvmstat.monitor
+ * @build sun.hotspot.WhiteBox
+ * @compile test-classes/Hello.java
+ * @run main ClassFileInstaller sun.hotspot.WhiteBox
+ * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI SharedArchiveConsistency
  */
 import jdk.test.lib.process.OutputAnalyzer;
 import jdk.test.lib.Utils;
@@ -245,11 +244,10 @@
     // Copy file with bytes deleted or inserted
     // del -- true, deleted, false, inserted
     public static void copyFile(File from, File to, boolean del) throws Exception {
-        FileChannel inputChannel = null;
-        FileChannel outputChannel = null;
-        try {
-            inputChannel = new FileInputStream(from).getChannel();
-            outputChannel = new FileOutputStream(to).getChannel();
+        try (
+            FileChannel inputChannel = new FileInputStream(from).getChannel();
+            FileChannel outputChannel = new FileOutputStream(to).getChannel()
+        ) {
             long size = inputChannel.size();
             int init_size = getFileHeaderSize(inputChannel);
             outputChannel.transferFrom(inputChannel, 0, init_size);
@@ -264,9 +262,6 @@
                 outputChannel.write(ByteBuffer.wrap(new byte[n]));
                 outputChannel.transferFrom(inputChannel, init_size + n , size - init_size);
             }
-        } finally {
-            inputChannel.close();
-            outputChannel.close();
         }
     }
 
--- a/test/hotspot/jtreg/runtime/appcds/SharedArchiveFile.java	Wed Dec 20 09:14:52 2017 -0800
+++ b/test/hotspot/jtreg/runtime/appcds/SharedArchiveFile.java	Thu Dec 21 00:07:38 2017 +0100
@@ -24,8 +24,7 @@
 /*
  * @test
  * @summary The diagnostic option, -XX:SharedArchiveFile can be unlocked using -XX:+UseAppCDS
- * AppCDS does not support uncompressed oops
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ * @requires vm.cds
  * @library /test/lib
  * @modules java.base/jdk.internal.misc
  *          java.management
--- a/test/hotspot/jtreg/runtime/appcds/SharedBaseAddress.java	Wed Dec 20 09:14:52 2017 -0800
+++ b/test/hotspot/jtreg/runtime/appcds/SharedBaseAddress.java	Thu Dec 21 00:07:38 2017 +0100
@@ -27,8 +27,7 @@
  * @summary Test variety of values for SharedBaseAddress, in AppCDS mode,
  *          making sure VM handles normal values as well as edge values
  *          w/o a crash.
- * AppCDS does not support uncompressed oops
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ * @requires vm.cds
  * @library /test/lib
  * @modules java.base/jdk.internal.misc
  *          java.management
--- a/test/hotspot/jtreg/runtime/appcds/SharedPackages.java	Wed Dec 20 09:14:52 2017 -0800
+++ b/test/hotspot/jtreg/runtime/appcds/SharedPackages.java	Thu Dec 21 00:07:38 2017 +0100
@@ -25,8 +25,7 @@
 /*
  * @test
  * @summary AppCDS handling of package.
- * AppCDS does not support uncompressed oops
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ * @requires vm.cds
  * @library /test/lib
  * @modules java.base/jdk.internal.misc
  *          java.management
--- a/test/hotspot/jtreg/runtime/appcds/SignedJar.java	Wed Dec 20 09:14:52 2017 -0800
+++ b/test/hotspot/jtreg/runtime/appcds/SignedJar.java	Thu Dec 21 00:07:38 2017 +0100
@@ -25,8 +25,7 @@
 /*
  * @test
  * @summary AppCDS handling of signed JAR.
- * AppCDS does not support uncompressed oops
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ * @requires vm.cds
  * @library /test/lib
  * @modules java.base/jdk.internal.misc
  *          java.management
--- a/test/hotspot/jtreg/runtime/appcds/SpecifySysLoaderProp.java	Wed Dec 20 09:14:52 2017 -0800
+++ b/test/hotspot/jtreg/runtime/appcds/SpecifySysLoaderProp.java	Thu Dec 21 00:07:38 2017 +0100
@@ -23,17 +23,16 @@
  */
 
 /*
- *  @test
- *  @summary If -Djava.system.class.loader=xxx is specified in command-line, disable UseAppCDS
- *  AppCDS does not support uncompressed oops
- *  @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
- *  @library /test/lib
- *  @modules java.base/jdk.internal.misc
+ * @test
+ * @summary If -Djava.system.class.loader=xxx is specified in command-line, disable UseAppCDS
+ * @requires vm.cds
+ * @library /test/lib
+ * @modules java.base/jdk.internal.misc
  *      jdk.jartool/sun.tools.jar
- *  @compile test-classes/TestClassLoader.java
- *  @compile test-classes/ReportMyLoader.java
- *  @compile test-classes/TrySwitchMyLoader.java
- *  @run main SpecifySysLoaderProp
+ * @compile test-classes/TestClassLoader.java
+ * @compile test-classes/ReportMyLoader.java
+ * @compile test-classes/TrySwitchMyLoader.java
+ * @run main SpecifySysLoaderProp
  */
 
 import java.io.*;
--- a/test/hotspot/jtreg/runtime/appcds/TraceLongClasspath.java	Wed Dec 20 09:14:52 2017 -0800
+++ b/test/hotspot/jtreg/runtime/appcds/TraceLongClasspath.java	Thu Dec 21 00:07:38 2017 +0100
@@ -25,8 +25,7 @@
 /*
  * @test
  * @summary ensure -XX:+TraceClassPaths showing entire expecting app classpath
- * AppCDS does not support uncompressed oops
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ * @requires vm.cds
  * @library /test/lib
  * @modules java.base/jdk.internal.misc
  *          java.management
--- a/test/hotspot/jtreg/runtime/appcds/UseAppCDS.java	Wed Dec 20 09:14:52 2017 -0800
+++ b/test/hotspot/jtreg/runtime/appcds/UseAppCDS.java	Thu Dec 21 00:07:38 2017 +0100
@@ -25,8 +25,7 @@
 /*
  * @test
  * @summary Testing use of UseAppCDS flag
- * AppCDS does not support uncompressed oops
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ * @requires vm.cds
  * @library /test/lib
  * @modules java.base/jdk.internal.misc
  *          java.management
@@ -108,12 +107,14 @@
 
     public static List<String> toClassNames(String filename) throws IOException {
         ArrayList<String> classes = new ArrayList<>();
-        BufferedReader br = new BufferedReader(new InputStreamReader(new FileInputStream(filename)));
-        for (; ; ) {
-            String line = br.readLine();
-            if (line == null)
-                break;
-            classes.add(line.replaceAll("/", "."));
+        try (BufferedReader br = new BufferedReader(new InputStreamReader(new FileInputStream(filename)))) {
+            for (; ; ) {
+                String line = br.readLine();
+                if (line == null) {
+                    break;
+                }
+                classes.add(line.replaceAll("/", "."));
+            }
         }
         return classes;
     }
--- a/test/hotspot/jtreg/runtime/appcds/VerifierTest_0.java	Wed Dec 20 09:14:52 2017 -0800
+++ b/test/hotspot/jtreg/runtime/appcds/VerifierTest_0.java	Thu Dec 21 00:07:38 2017 +0100
@@ -25,8 +25,7 @@
 /*
  * @test
  * @summary Unverfiable app classes should not be archived.
- * AppCDS does not support uncompressed oops
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ * @requires vm.cds
  * @library /test/lib
  * @modules java.base/jdk.internal.misc
  * @modules jdk.jartool/sun.tools.jar
--- a/test/hotspot/jtreg/runtime/appcds/VerifierTest_1A.java	Wed Dec 20 09:14:52 2017 -0800
+++ b/test/hotspot/jtreg/runtime/appcds/VerifierTest_1A.java	Thu Dec 21 00:07:38 2017 +0100
@@ -25,8 +25,7 @@
 /*
  * @test
  * @summary Unverfiable app classes should not be archived.
- * AppCDS does not support uncompressed oops
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ * @requires vm.cds
  * @library /test/lib
  * @modules java.base/jdk.internal.misc
  * @modules jdk.jartool/sun.tools.jar
--- a/test/hotspot/jtreg/runtime/appcds/VerifierTest_1B.java	Wed Dec 20 09:14:52 2017 -0800
+++ b/test/hotspot/jtreg/runtime/appcds/VerifierTest_1B.java	Thu Dec 21 00:07:38 2017 +0100
@@ -25,8 +25,7 @@
 /*
  * @test
  * @summary Unverfiable app classes should not be archived.
- * AppCDS does not support uncompressed oops
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ * @requires vm.cds
  * @library /test/lib
  * @modules java.base/jdk.internal.misc
  * @modules jdk.jartool/sun.tools.jar
--- a/test/hotspot/jtreg/runtime/appcds/VerifierTest_2.java	Wed Dec 20 09:14:52 2017 -0800
+++ b/test/hotspot/jtreg/runtime/appcds/VerifierTest_2.java	Thu Dec 21 00:07:38 2017 +0100
@@ -25,8 +25,7 @@
 /*
  * @test
  * @summary Unverfiable app classes should not be archived.
- * AppCDS does not support uncompressed oops
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ * @requires vm.cds
  * @library /test/lib
  * @modules java.base/jdk.internal.misc
  * @modules jdk.jartool/sun.tools.jar
--- a/test/hotspot/jtreg/runtime/appcds/WideIloadTest.java	Wed Dec 20 09:14:52 2017 -0800
+++ b/test/hotspot/jtreg/runtime/appcds/WideIloadTest.java	Thu Dec 21 00:07:38 2017 +0100
@@ -25,7 +25,7 @@
 /**
  * @test
  * @summary Test 'iload_w' bytecode in shared class
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ * @requires vm.cds
  * @library /test/lib
  * @modules java.base/jdk.internal.misc
  *          java.management
--- a/test/hotspot/jtreg/runtime/appcds/WrongClasspath.java	Wed Dec 20 09:14:52 2017 -0800
+++ b/test/hotspot/jtreg/runtime/appcds/WrongClasspath.java	Thu Dec 21 00:07:38 2017 +0100
@@ -25,8 +25,7 @@
 /*
  * @test
  * @summary classpath mismatch between dump time and execution time
- * AppCDS does not support uncompressed oops
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ * @requires vm.cds
  * @library /test/lib
  * @modules java.base/jdk.internal.misc
  *          java.management
--- a/test/hotspot/jtreg/runtime/appcds/XShareAutoWithChangedJar.java	Wed Dec 20 09:14:52 2017 -0800
+++ b/test/hotspot/jtreg/runtime/appcds/XShareAutoWithChangedJar.java	Thu Dec 21 00:07:38 2017 +0100
@@ -25,8 +25,7 @@
 /*
  * @test
  * @summary Test -Xshare:auto for AppCDS
- * AppCDS does not support uncompressed oops
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ * @requires vm.cds
  * @library /test/lib
  * @modules java.base/jdk.internal.misc
  *          java.management
--- a/test/hotspot/jtreg/runtime/appcds/cacheObject/CheckCachedResolvedReferences.java	Wed Dec 20 09:14:52 2017 -0800
+++ b/test/hotspot/jtreg/runtime/appcds/cacheObject/CheckCachedResolvedReferences.java	Thu Dec 21 00:07:38 2017 +0100
@@ -25,7 +25,7 @@
 /*
  * @test
  * @summary Test resolved_references
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ * @requires vm.cds
  * @requires vm.cds.custom.loaders
  * @requires (vm.gc=="null")
  * @library /test/lib /test/hotspot/jtreg/runtime/appcds
--- a/test/hotspot/jtreg/runtime/appcds/cacheObject/DumpTimeVerifyFailure.java	Wed Dec 20 09:14:52 2017 -0800
+++ b/test/hotspot/jtreg/runtime/appcds/cacheObject/DumpTimeVerifyFailure.java	Thu Dec 21 00:07:38 2017 +0100
@@ -26,7 +26,7 @@
  * @test
  * @summary Dump time should not crash if any class with shared strings fails verification due to missing dependencies.
  * @bug 8186789
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ * @requires vm.cds
  * @requires (sun.arch.data.model != "32") & (os.family != "windows")
  * @requires (vm.gc=="null")
  * @library /test/lib /test/hotspot/jtreg/runtime/appcds
--- a/test/hotspot/jtreg/runtime/appcds/cacheObject/GCStressTest.java	Wed Dec 20 09:14:52 2017 -0800
+++ b/test/hotspot/jtreg/runtime/appcds/cacheObject/GCStressTest.java	Thu Dec 21 00:07:38 2017 +0100
@@ -25,7 +25,7 @@
 /*
  * @test
  * @summary
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ * @requires vm.cds
  * @requires (sun.arch.data.model != "32") & (os.family != "windows")
  * @requires (vm.gc=="null")
  * @library /test/lib /test/hotspot/jtreg/runtime/appcds
--- a/test/hotspot/jtreg/runtime/appcds/cacheObject/OpenArchiveRegion.java	Wed Dec 20 09:14:52 2017 -0800
+++ b/test/hotspot/jtreg/runtime/appcds/cacheObject/OpenArchiveRegion.java	Thu Dec 21 00:07:38 2017 +0100
@@ -25,7 +25,7 @@
 /*
  * @test
  * @summary Test open archive heap regions
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ * @requires vm.cds
  * @requires (sun.arch.data.model != "32") & (os.family != "windows")
  * @requires (vm.gc=="null")
  * @library /test/lib /test/hotspot/jtreg/runtime/appcds
--- a/test/hotspot/jtreg/runtime/appcds/cacheObject/RangeNotWithinHeap.java	Wed Dec 20 09:14:52 2017 -0800
+++ b/test/hotspot/jtreg/runtime/appcds/cacheObject/RangeNotWithinHeap.java	Thu Dec 21 00:07:38 2017 +0100
@@ -28,7 +28,7 @@
  *          mapped due to out of range, and -Xshare:on should not fail. Test on
  *          linux 64-bit only since the HeapBaseMinAddress value is platform specific.
  *          The value used in the test may cause different behavior on other platforms.
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ * @requires vm.cds
  * @requires (os.family == "linux") & (os.arch == "amd64") & (sun.arch.data.model == "64")
  * @requires (vm.gc=="null")
  * @library /test/lib /test/hotspot/jtreg/runtime/appcds
--- a/test/hotspot/jtreg/runtime/appcds/cacheObject/RedefineClassTest.java	Wed Dec 20 09:14:52 2017 -0800
+++ b/test/hotspot/jtreg/runtime/appcds/cacheObject/RedefineClassTest.java	Thu Dec 21 00:07:38 2017 +0100
@@ -26,7 +26,7 @@
  * @test
  * @summary Redefine shared class. GC should not cause crash with cached resolved_references.
  * @library /test/lib /test/hotspot/jtreg/runtime/appcds /test/hotspot/jtreg/runtime/appcds/test-classes /test/hotspot/jtreg/runtime/appcds/jvmti
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ * @requires vm.cds
  * @requires vm.gc.G1
  * @requires vm.flavor != "minimal"
  * @requires (sun.arch.data.model != "32") & (os.family != "windows")
@@ -43,7 +43,6 @@
 import com.sun.tools.attach.VirtualMachine;
 import com.sun.tools.attach.VirtualMachineDescriptor;
 import java.io.File;
-import java.io.FileOutputStream;
 import java.util.List;
 import jdk.test.lib.Asserts;
 import jdk.test.lib.cds.CDSOptions;
--- a/test/hotspot/jtreg/runtime/appcds/customLoader/ClassListFormatA.java	Wed Dec 20 09:14:52 2017 -0800
+++ b/test/hotspot/jtreg/runtime/appcds/customLoader/ClassListFormatA.java	Thu Dec 21 00:07:38 2017 +0100
@@ -26,8 +26,7 @@
  * @test
  * @summary Tests the format checking of class list format.
  *
- * (NOTE: AppCDS does not support uncompressed oops)
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ * @requires vm.cds
  * @requires vm.cds.custom.loaders
  * @library /test/lib /test/hotspot/jtreg/runtime/appcds
  * @modules java.base/jdk.internal.misc
--- a/test/hotspot/jtreg/runtime/appcds/customLoader/ClassListFormatB.java	Wed Dec 20 09:14:52 2017 -0800
+++ b/test/hotspot/jtreg/runtime/appcds/customLoader/ClassListFormatB.java	Thu Dec 21 00:07:38 2017 +0100
@@ -26,8 +26,7 @@
  * @test
  * @summary Tests the format checking of hotspot/src/closed/share/vm/classfile/classListParser.cpp.
  *
- * (NOTE: AppCDS does not support uncompressed oops)
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ * @requires vm.cds
  * @requires vm.cds.custom.loaders
  * @library /test/lib /test/hotspot/jtreg/runtime/appcds
  * @modules java.base/jdk.internal.misc
--- a/test/hotspot/jtreg/runtime/appcds/customLoader/ClassListFormatC.java	Wed Dec 20 09:14:52 2017 -0800
+++ b/test/hotspot/jtreg/runtime/appcds/customLoader/ClassListFormatC.java	Thu Dec 21 00:07:38 2017 +0100
@@ -26,8 +26,7 @@
  * @test
  * @summary Tests the format checking of hotspot/src/closed/share/vm/classfile/classListParser.cpp.
  *
- * (NOTE: AppCDS does not support uncompressed oops)
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ * @requires vm.cds
  * @requires vm.cds.custom.loaders
  * @library /test/lib /test/hotspot/jtreg/runtime/appcds
  * @modules java.base/jdk.internal.misc
--- a/test/hotspot/jtreg/runtime/appcds/customLoader/ClassListFormatD.java	Wed Dec 20 09:14:52 2017 -0800
+++ b/test/hotspot/jtreg/runtime/appcds/customLoader/ClassListFormatD.java	Thu Dec 21 00:07:38 2017 +0100
@@ -26,8 +26,7 @@
  * @test
  * @summary Tests the format checking of hotspot/src/closed/share/vm/classfile/classListParser.cpp.
  *
- * (NOTE: AppCDS does not support uncompressed oops)
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ * @requires vm.cds
  * @requires vm.cds.custom.loaders
  * @library /test/lib /test/hotspot/jtreg/runtime/appcds
  * @modules java.base/jdk.internal.misc
--- a/test/hotspot/jtreg/runtime/appcds/customLoader/ClassListFormatE.java	Wed Dec 20 09:14:52 2017 -0800
+++ b/test/hotspot/jtreg/runtime/appcds/customLoader/ClassListFormatE.java	Thu Dec 21 00:07:38 2017 +0100
@@ -26,8 +26,7 @@
  * @test
  * @summary Tests the format checking of hotspot/src/closed/share/vm/classfile/classListParser.cpp.
  *
- * (NOTE: AppCDS does not support uncompressed oops)
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ * @requires vm.cds
  * @requires vm.cds.custom.loaders
  * @library /test/lib /test/hotspot/jtreg/runtime/appcds
  * @modules java.base/jdk.internal.misc
--- a/test/hotspot/jtreg/runtime/appcds/customLoader/HelloCustom.java	Wed Dec 20 09:14:52 2017 -0800
+++ b/test/hotspot/jtreg/runtime/appcds/customLoader/HelloCustom.java	Thu Dec 21 00:07:38 2017 +0100
@@ -25,8 +25,7 @@
 /*
  * @test
  * @summary Hello World test for AppCDS custom loader support
- * (NOTE: AppCDS does not support uncompressed oops)
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ * @requires vm.cds
  * @requires vm.cds.custom.loaders
  * @library /test/lib /test/hotspot/jtreg/runtime/appcds
  * @modules java.base/jdk.internal.misc
--- a/test/hotspot/jtreg/runtime/appcds/customLoader/LoaderSegregationTest.java	Wed Dec 20 09:14:52 2017 -0800
+++ b/test/hotspot/jtreg/runtime/appcds/customLoader/LoaderSegregationTest.java	Thu Dec 21 00:07:38 2017 +0100
@@ -26,8 +26,7 @@
  * @test
  * @summary Check that during dumping, the classes for BOOT/EXT/APP loaders are segregated from the
  *          custom loader classes.
- * (NOTE: AppCDS does not support uncompressed oops)
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ * @requires vm.cds
  * @requires vm.cds.custom.loaders
  * @library /test/lib /test/hotspot/jtreg/runtime/appcds
  * @modules java.base/jdk.internal.misc
--- a/test/hotspot/jtreg/runtime/appcds/customLoader/ParallelTestMultiFP.java	Wed Dec 20 09:14:52 2017 -0800
+++ b/test/hotspot/jtreg/runtime/appcds/customLoader/ParallelTestMultiFP.java	Thu Dec 21 00:07:38 2017 +0100
@@ -25,8 +25,7 @@
 /*
  * @test
  * @summary Load classes from CDS archive into multiple custom loader using parallel threads
- * (NOTE: AppCDS does not support uncompressed oops)
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ * @requires vm.cds
  * @requires vm.cds.custom.loaders
  * @library /test/lib /test/hotspot/jtreg/runtime/appcds
  * @modules java.base/jdk.internal.misc
--- a/test/hotspot/jtreg/runtime/appcds/customLoader/ParallelTestSingleFP.java	Wed Dec 20 09:14:52 2017 -0800
+++ b/test/hotspot/jtreg/runtime/appcds/customLoader/ParallelTestSingleFP.java	Thu Dec 21 00:07:38 2017 +0100
@@ -25,8 +25,7 @@
 /*
  * @test
  * @summary Load classes from CDS archive into a single custom loader using parallel threads (finger print)
- * (NOTE: AppCDS does not support uncompressed oops)
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ * @requires vm.cds
  * @requires vm.cds.custom.loaders
  * @library /test/lib /test/hotspot/jtreg/runtime/appcds
  * @modules java.base/jdk.internal.misc
--- a/test/hotspot/jtreg/runtime/appcds/customLoader/ProhibitedPackageNamesTest.java	Wed Dec 20 09:14:52 2017 -0800
+++ b/test/hotspot/jtreg/runtime/appcds/customLoader/ProhibitedPackageNamesTest.java	Thu Dec 21 00:07:38 2017 +0100
@@ -25,8 +25,7 @@
 /*
  * @test
  * @summary Make sure prohibited packages cannot be stored into archive for custom loaders.
- * (NOTE: AppCDS does not support uncompressed oops)
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ * @requires vm.cds
  * @requires vm.cds.custom.loaders
  * @library /test/lib /test/hotspot/jtreg/runtime/appcds
  * @modules java.base/jdk.internal.misc
--- a/test/hotspot/jtreg/runtime/appcds/customLoader/ProtectionDomain.java	Wed Dec 20 09:14:52 2017 -0800
+++ b/test/hotspot/jtreg/runtime/appcds/customLoader/ProtectionDomain.java	Thu Dec 21 00:07:38 2017 +0100
@@ -26,8 +26,7 @@
  * @test
  * @summary AppCDS handling of protection domain in custom loaders.
  *
- * AppCDS does not support uncompressed oops
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ * @requires vm.cds
  * @requires vm.cds.custom.loaders
  *
  * @library /test/lib /test/hotspot/jtreg/runtime/appcds
--- a/test/hotspot/jtreg/runtime/appcds/customLoader/SameNameInTwoLoadersTest.java	Wed Dec 20 09:14:52 2017 -0800
+++ b/test/hotspot/jtreg/runtime/appcds/customLoader/SameNameInTwoLoadersTest.java	Thu Dec 21 00:07:38 2017 +0100
@@ -26,8 +26,7 @@
  * @test
  * @summary Testing the loading of a class with the same name in two different class loaders.
  *
- * (NOTE: AppCDS does not support uncompressed oops)
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ * @requires vm.cds
  * @requires vm.cds.custom.loaders
  *
  * @library /test/lib /test/hotspot/jtreg/runtime/appcds
--- a/test/hotspot/jtreg/runtime/appcds/customLoader/UnintendedLoadersTest.java	Wed Dec 20 09:14:52 2017 -0800
+++ b/test/hotspot/jtreg/runtime/appcds/customLoader/UnintendedLoadersTest.java	Thu Dec 21 00:07:38 2017 +0100
@@ -25,8 +25,7 @@
 /*
  * @test
  * @summary Make sure classes intended for custom loaders cannot be loaded by BOOT/EXT/APP loaders
- * (NOTE: AppCDS does not support uncompressed oops)
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ * @requires vm.cds
  * @requires vm.cds.custom.loaders
  * @library /test/lib /test/hotspot/jtreg/runtime/appcds
  * @modules java.base/jdk.internal.misc
--- a/test/hotspot/jtreg/runtime/appcds/customLoader/UnloadUnregisteredLoaderTest.java	Wed Dec 20 09:14:52 2017 -0800
+++ b/test/hotspot/jtreg/runtime/appcds/customLoader/UnloadUnregisteredLoaderTest.java	Thu Dec 21 00:07:38 2017 +0100
@@ -26,8 +26,7 @@
  * @test
  * @summary Test the behavior when shared classes loaded by custom loaders are
  *          unloaded.
- * (NOTE: AppCDS does not support uncompressed oops)
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ * @requires vm.cds
  * @requires vm.cds.custom.loaders
  * @library /test/lib /test/hotspot/jtreg/runtime/appcds /test/hotspot/jtreg/runtime/testlibrary
  * @modules java.base/jdk.internal.misc
--- a/test/hotspot/jtreg/runtime/appcds/customLoader/UnsupportedPlatforms.java	Wed Dec 20 09:14:52 2017 -0800
+++ b/test/hotspot/jtreg/runtime/appcds/customLoader/UnsupportedPlatforms.java	Thu Dec 21 00:07:38 2017 +0100
@@ -25,8 +25,6 @@
 /*
  * @test
  * @summary Ensure that support for AppCDS custom class loaders are not enabled on unsupported platforms.
- * (NOTE: AppCDS does not support uncompressed oops)
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
  * @requires vm.cds
  * @library /test/lib /test/hotspot/jtreg/runtime/appcds
  * @modules java.base/jdk.internal.misc
--- a/test/hotspot/jtreg/runtime/appcds/javaldr/ArrayTest.java	Wed Dec 20 09:14:52 2017 -0800
+++ b/test/hotspot/jtreg/runtime/appcds/javaldr/ArrayTest.java	Thu Dec 21 00:07:38 2017 +0100
@@ -25,8 +25,7 @@
 /*
  * @test
  * @summary test the ability to archive array classes and load them from the archive
- * AppCDS does not support uncompressed oops
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ * @requires vm.cds
  * @library /test/lib /test/hotspot/jtreg/runtime/appcds
  * @modules jdk.jartool/sun.tools.jar
  * @compile ArrayTestHelper.java
@@ -44,7 +43,9 @@
     static String arrayClasses[] = {
         "ArrayTestHelper",
         "[Ljava/lang/Comparable;",
-        "[I"
+        "[I",
+        "[[[Ljava/lang/Object;",
+        "[[B"
     };
 
     public static void main(String[] args) throws Exception {
@@ -56,7 +57,12 @@
         String bootClassPath = "-Xbootclasspath/a:" + whiteBoxJar;
 
         // create an archive containing array classes
-        TestCommon.dump(appJar, TestCommon.list(arrayClasses), bootClassPath, "-verbose:class");
+        OutputAnalyzer output = TestCommon.dump(appJar, TestCommon.list(arrayClasses), bootClassPath, "-verbose:class");
+        // we currently don't support array classes during CDS dump
+        output.shouldContain("Preload Warning: Cannot find [Ljava/lang/Comparable;")
+              .shouldContain("Preload Warning: Cannot find [I")
+              .shouldContain("Preload Warning: Cannot find [[[Ljava/lang/Object;")
+              .shouldContain("Preload Warning: Cannot find [[B");
 
         List<String> argsList = new ArrayList<String>();
         argsList.add("-XX:+UnlockDiagnosticVMOptions");
@@ -67,12 +73,13 @@
         argsList.add("-verbose:class");
         argsList.add("ArrayTestHelper");
         // the following are input args to the ArrayTestHelper.
-        for (int i = 0; i < arrayClasses.length; i++) {
+        // skip checking array classes during run time
+        for (int i = 0; i < 1; i++) {
             argsList.add(arrayClasses[i]);
         }
         String[] opts = new String[argsList.size()];
         opts = argsList.toArray(opts);
-        OutputAnalyzer output = TestCommon.execCommon(opts);
+        output = TestCommon.execCommon(opts);
         TestCommon.checkExec(output);
     }
 }
--- a/test/hotspot/jtreg/runtime/appcds/javaldr/CheckAnonymousClass.java	Wed Dec 20 09:14:52 2017 -0800
+++ b/test/hotspot/jtreg/runtime/appcds/javaldr/CheckAnonymousClass.java	Thu Dec 21 00:07:38 2017 +0100
@@ -25,8 +25,7 @@
 /*
  * @test
  * @summary ensure no anonymous class is being dumped into the CDS archive
- * AppCDS does not support uncompressed oops
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ * @requires vm.cds
  * @library /test/lib /test/hotspot/jtreg/runtime/appcds
  * @modules jdk.jartool/sun.tools.jar
  * @compile ../test-classes/Hello.java
--- a/test/hotspot/jtreg/runtime/appcds/javaldr/GCDuringDump.java	Wed Dec 20 09:14:52 2017 -0800
+++ b/test/hotspot/jtreg/runtime/appcds/javaldr/GCDuringDump.java	Thu Dec 21 00:07:38 2017 +0100
@@ -26,7 +26,7 @@
  * @test
  * @summary When dumping the CDS archive, try to cause garbage collection while classes are being loaded.
  * @library /test/lib /test/hotspot/jtreg/runtime/appcds /test/hotspot/jtreg/runtime/appcds/test-classes
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ * @requires vm.cds
  * @requires vm.flavor != "minimal"
  * @modules java.base/jdk.internal.misc
  *          jdk.jartool/sun.tools.jar
--- a/test/hotspot/jtreg/runtime/appcds/javaldr/GCSharedStringsDuringDump.java	Wed Dec 20 09:14:52 2017 -0800
+++ b/test/hotspot/jtreg/runtime/appcds/javaldr/GCSharedStringsDuringDump.java	Thu Dec 21 00:07:38 2017 +0100
@@ -28,7 +28,7 @@
  *          option for testing the interaction with GC and shared strings.
  * @library /test/lib /test/hotspot/jtreg/runtime/appcds /test/hotspot/jtreg/runtime/appcds/test-classes
  * @requires (sun.arch.data.model != "32") & (os.family != "windows")
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ * @requires vm.cds
  * @requires vm.flavor != "minimal"
  * @requires vm.gc.G1
  * @modules java.base/jdk.internal.misc
--- a/test/hotspot/jtreg/runtime/appcds/jigsaw/CheckUnsupportedDumpingOptions.java	Wed Dec 20 09:14:52 2017 -0800
+++ b/test/hotspot/jtreg/runtime/appcds/jigsaw/CheckUnsupportedDumpingOptions.java	Thu Dec 21 00:07:38 2017 +0100
@@ -25,8 +25,7 @@
 /*
  * @test
  * @summary Abort dumping if any of the new jigsaw vm options is specified.
- * AppCDS does not support uncompressed oops
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ * @requires vm.cds
  * @library /test/lib ..
  * @modules java.base/jdk.internal.misc
  *          java.management
--- a/test/hotspot/jtreg/runtime/appcds/jigsaw/JigsawOptionsCombo.java	Wed Dec 20 09:14:52 2017 -0800
+++ b/test/hotspot/jtreg/runtime/appcds/jigsaw/JigsawOptionsCombo.java	Thu Dec 21 00:07:38 2017 +0100
@@ -26,8 +26,7 @@
  * @test
  * @summary Test combinations of jigsaw options that affect the use of AppCDS
  *
- * AppCDS does not support uncompressed oops
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ * @requires vm.cds & !vm.graal.enabled
  * @library /test/lib ..
  * @modules java.base/jdk.internal.misc
  *          java.management
--- a/test/hotspot/jtreg/runtime/appcds/jigsaw/PatchModule/AppClassInCP.java	Wed Dec 20 09:14:52 2017 -0800
+++ b/test/hotspot/jtreg/runtime/appcds/jigsaw/PatchModule/AppClassInCP.java	Thu Dec 21 00:07:38 2017 +0100
@@ -24,7 +24,7 @@
 
 /*
  * @test
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ * @requires vm.cds
  * @summary a test to demonstrate that an application class in the -cp
  *          will be archived although --patch-module is specified. The class in
  *          the -cp has no dependencies on the class in the --patch-module.
--- a/test/hotspot/jtreg/runtime/appcds/jigsaw/PatchModule/CustomPackage.java	Wed Dec 20 09:14:52 2017 -0800
+++ b/test/hotspot/jtreg/runtime/appcds/jigsaw/PatchModule/CustomPackage.java	Thu Dec 21 00:07:38 2017 +0100
@@ -24,7 +24,7 @@
 
 /*
  * @test
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ * @requires vm.cds
  * @summary if a class is defined to a package which is not defined to any
  *          module in the jimage, the class will not be found during dump
  *          time but it will be used during run time.
--- a/test/hotspot/jtreg/runtime/appcds/jigsaw/PatchModule/MismatchedPatchModule.java	Wed Dec 20 09:14:52 2017 -0800
+++ b/test/hotspot/jtreg/runtime/appcds/jigsaw/PatchModule/MismatchedPatchModule.java	Thu Dec 21 00:07:38 2017 +0100
@@ -24,7 +24,7 @@
 
 /*
  * @test
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ * @requires vm.cds
  * @summary different settings of --patch-module at dump time and runtime are
  *          acceptable. The class found in runtime --patch-module entry should
  *          be used.
--- a/test/hotspot/jtreg/runtime/appcds/jigsaw/PatchModule/PatchDir.java	Wed Dec 20 09:14:52 2017 -0800
+++ b/test/hotspot/jtreg/runtime/appcds/jigsaw/PatchModule/PatchDir.java	Thu Dec 21 00:07:38 2017 +0100
@@ -24,7 +24,7 @@
 
 /*
  * @test
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ * @requires vm.cds
  * @summary a simple test to ensure that a directory in the --patch-module
  *          option does not affect dump process
  * @library ../..
--- a/test/hotspot/jtreg/runtime/appcds/jigsaw/PatchModule/PatchJavaBase.java	Wed Dec 20 09:14:52 2017 -0800
+++ b/test/hotspot/jtreg/runtime/appcds/jigsaw/PatchModule/PatchJavaBase.java	Thu Dec 21 00:07:38 2017 +0100
@@ -24,7 +24,7 @@
 
 /*
  * @test
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ * @requires vm.cds
  * @summary sharing is disabled if java.base is patch at runtime
  * @library ../..
  * @library /test/hotspot/jtreg/testlibrary
--- a/test/hotspot/jtreg/runtime/appcds/jigsaw/PatchModule/Simple.java	Wed Dec 20 09:14:52 2017 -0800
+++ b/test/hotspot/jtreg/runtime/appcds/jigsaw/PatchModule/Simple.java	Thu Dec 21 00:07:38 2017 +0100
@@ -24,7 +24,7 @@
 
 /*
  * @test
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ * @requires vm.cds
  * @summary a simple test to ensure that class is loaded from jar file in --patch-module at runtime
  * @library ../..
  * @library /test/hotspot/jtreg/testlibrary
--- a/test/hotspot/jtreg/runtime/appcds/jigsaw/PatchModule/SubClassOfPatchedClass.java	Wed Dec 20 09:14:52 2017 -0800
+++ b/test/hotspot/jtreg/runtime/appcds/jigsaw/PatchModule/SubClassOfPatchedClass.java	Thu Dec 21 00:07:38 2017 +0100
@@ -24,7 +24,7 @@
 
 /*
  * @test
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ * @requires vm.cds
  * @summary the class in the -cp is a subclass of the class in --patch-module. The
  *          patched class should be used at runtime.
  * @library ../..
--- a/test/hotspot/jtreg/runtime/appcds/jigsaw/PatchModule/TwoJars.java	Wed Dec 20 09:14:52 2017 -0800
+++ b/test/hotspot/jtreg/runtime/appcds/jigsaw/PatchModule/TwoJars.java	Thu Dec 21 00:07:38 2017 +0100
@@ -24,7 +24,7 @@
 
 /*
  * @test
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ * @requires vm.cds
  * @summary a patched class found in --patch-module should be used at runtime
  * @library ../..
  * @library /test/hotspot/jtreg/testlibrary
--- a/test/hotspot/jtreg/runtime/appcds/jigsaw/classpathtests/BootAppendTests.java	Wed Dec 20 09:14:52 2017 -0800
+++ b/test/hotspot/jtreg/runtime/appcds/jigsaw/classpathtests/BootAppendTests.java	Thu Dec 21 00:07:38 2017 +0100
@@ -25,7 +25,7 @@
 /**
  * @test
  * @summary AppCDS tests for testing -Xbootclasspath/a
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ * @requires vm.cds & !vm.graal.enabled
  * @library /test/lib /test/hotspot/jtreg/runtime/appcds
  * @modules java.base/jdk.internal.misc
  *          java.management
--- a/test/hotspot/jtreg/runtime/appcds/jigsaw/classpathtests/ClassPathTests.java	Wed Dec 20 09:14:52 2017 -0800
+++ b/test/hotspot/jtreg/runtime/appcds/jigsaw/classpathtests/ClassPathTests.java	Thu Dec 21 00:07:38 2017 +0100
@@ -24,7 +24,7 @@
 
 /**
  * @test
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ * @requires vm.cds & !vm.graal.enabled
  * @library ../..
  * @library /test/lib
  * @modules java.base/jdk.internal.misc
--- a/test/hotspot/jtreg/runtime/appcds/jigsaw/classpathtests/DummyClassesInBootClassPath.java	Wed Dec 20 09:14:52 2017 -0800
+++ b/test/hotspot/jtreg/runtime/appcds/jigsaw/classpathtests/DummyClassesInBootClassPath.java	Thu Dec 21 00:07:38 2017 +0100
@@ -25,8 +25,7 @@
 /*
  * @test
  * @summary Ensure that classes found in jimage takes precedence over classes found in -Xbootclasspath/a.
- * AppCDS does not support uncompressed oops
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ * @requires vm.cds
  * @library /test/lib /test/hotspot/jtreg/runtime/appcds
  * @modules java.activation
  *          jdk.jartool/sun.tools.jar
--- a/test/hotspot/jtreg/runtime/appcds/jigsaw/classpathtests/EmptyClassInBootClassPath.java	Wed Dec 20 09:14:52 2017 -0800
+++ b/test/hotspot/jtreg/runtime/appcds/jigsaw/classpathtests/EmptyClassInBootClassPath.java	Thu Dec 21 00:07:38 2017 +0100
@@ -29,7 +29,7 @@
  *     2) app loader will load the class from the jimage by default;
  *        app loader will load the class from the bootclasspath if the
  *        "--limit-modules java.base" option is specified
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ * @requires vm.cds & !vm.graal.enabled
  * @library /test/lib /test/hotspot/jtreg/runtime/appcds
  * @modules java.base/jdk.internal.misc
  *          java.management
--- a/test/hotspot/jtreg/runtime/appcds/jigsaw/limitmods/LimitModsTests.java	Wed Dec 20 09:14:52 2017 -0800
+++ b/test/hotspot/jtreg/runtime/appcds/jigsaw/limitmods/LimitModsTests.java	Thu Dec 21 00:07:38 2017 +0100
@@ -24,7 +24,7 @@
 
 /**
  * @test
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ * @requires vm.cds & !vm.graal.enabled
  * @library ../..
  * @library /test/lib
  * @modules java.base/jdk.internal.misc
--- a/test/hotspot/jtreg/runtime/appcds/jigsaw/overridetests/OverrideTests.java	Wed Dec 20 09:14:52 2017 -0800
+++ b/test/hotspot/jtreg/runtime/appcds/jigsaw/overridetests/OverrideTests.java	Thu Dec 21 00:07:38 2017 +0100
@@ -24,7 +24,7 @@
 
 /**
  * @test
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ * @requires vm.cds
  * @modules java.base/jdk.internal.misc
  * @library ../..
  * @library /test/lib
--- a/test/hotspot/jtreg/runtime/appcds/jvmti/ClassFileLoadHookTest.java	Wed Dec 20 09:14:52 2017 -0800
+++ b/test/hotspot/jtreg/runtime/appcds/jvmti/ClassFileLoadHookTest.java	Thu Dec 21 00:07:38 2017 +0100
@@ -26,7 +26,7 @@
  * @test
  * @summary Test jvmti class file loader hook interaction with AppCDS
  * @library /test/lib /test/hotspot/jtreg/runtime/appcds
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ * @requires vm.cds
  * @modules java.base/jdk.internal.misc
  *          jdk.jartool/sun.tools.jar
  *          java.management
--- a/test/hotspot/jtreg/runtime/appcds/jvmti/InstrumentationTest.java	Wed Dec 20 09:14:52 2017 -0800
+++ b/test/hotspot/jtreg/runtime/appcds/jvmti/InstrumentationTest.java	Thu Dec 21 00:07:38 2017 +0100
@@ -27,7 +27,7 @@
  * @summary Exercise the java.lang.instrument.Instrumentation APIs on classes archived
  *          using CDS/AppCDSv1/AppCDSv2.
  * @library /test/lib /test/hotspot/jtreg/runtime/appcds /test/hotspot/jtreg/runtime/appcds/test-classes
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ * @requires vm.cds
  * @requires vm.flavor != "minimal"
  * @modules java.base/jdk.internal.misc
  *          jdk.jartool/sun.tools.jar
@@ -182,9 +182,9 @@
         // We use the flagFile to prevent the child process to make progress, until we have
         // attached to it.
         File f = new File(flagFile);
-        FileOutputStream o = new FileOutputStream(f);
-        o.write(1);
-        o.close();
+        try (FileOutputStream o = new FileOutputStream(f)) {
+            o.write(1);
+        }
         if (!f.exists()) {
             throw new RuntimeException("Failed to create " + f);
         }
--- a/test/hotspot/jtreg/runtime/appcds/jvmti/parallelLoad/ParallelLoadAndTransformTest.java	Wed Dec 20 09:14:52 2017 -0800
+++ b/test/hotspot/jtreg/runtime/appcds/jvmti/parallelLoad/ParallelLoadAndTransformTest.java	Thu Dec 21 00:07:38 2017 +0100
@@ -29,7 +29,7 @@
  * @library /test/lib /test/hotspot/jtreg/runtime/appcds
  *     /test/hotspot/jtreg/runtime/appcds/test-classes /test/hotspot/jtreg/runtime/appcds/jvmti
  *     /test/hotspot/jtreg/testlibrary/jvmti
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ * @requires vm.cds
  * @modules java.base/jdk.internal.misc
  *          java.management
  *          jdk.jartool/sun.tools.jar
--- a/test/hotspot/jtreg/runtime/appcds/jvmti/transformRelatedClasses/TransformInterfaceImplementorAppCDS.java	Wed Dec 20 09:14:52 2017 -0800
+++ b/test/hotspot/jtreg/runtime/appcds/jvmti/transformRelatedClasses/TransformInterfaceImplementorAppCDS.java	Thu Dec 21 00:07:38 2017 +0100
@@ -32,7 +32,7 @@
  *     /test/hotspot/jtreg/runtime/SharedArchiveFile /test/hotspot/jtreg/testlibrary/jvmti
  *     /test/hotspot/jtreg/runtime/appcds/customLoader
  *     /test/hotspot/jtreg/runtime/appcds/customLoader/test-classes
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ * @requires vm.cds
  * @requires vm.flavor != "minimal"
  * @modules java.base/jdk.internal.misc
  *          jdk.jartool/sun.tools.jar
--- a/test/hotspot/jtreg/runtime/appcds/jvmti/transformRelatedClasses/TransformSuperSubAppCDS.java	Wed Dec 20 09:14:52 2017 -0800
+++ b/test/hotspot/jtreg/runtime/appcds/jvmti/transformRelatedClasses/TransformSuperSubAppCDS.java	Thu Dec 21 00:07:38 2017 +0100
@@ -32,7 +32,7 @@
  *     /test/hotspot/jtreg/runtime/SharedArchiveFile /test/hotspot/jtreg/testlibrary/jvmti
  *     /test/hotspot/jtreg/runtime/appcds/customLoader
  *     /test/hotspot/jtreg/runtime/appcds/customLoader/test-classes
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ * @requires vm.cds
  * @requires vm.flavor != "minimal"
  * @modules java.base/jdk.internal.misc
  *          jdk.jartool/sun.tools.jar
--- a/test/hotspot/jtreg/runtime/appcds/redefineClass/RedefineBasicTest.java	Wed Dec 20 09:14:52 2017 -0800
+++ b/test/hotspot/jtreg/runtime/appcds/redefineClass/RedefineBasicTest.java	Thu Dec 21 00:07:38 2017 +0100
@@ -26,8 +26,7 @@
  * @test
  * @summary Run /runtime/RedefineTests/RedefineRunningMethods in AppCDS mode to
  *          make sure class redefinition works with CDS.
- *          (Note: AppCDS does not support uncompressed oops)
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ * @requires vm.cds
  * @library /test/lib /test/hotspot/jtreg/runtime/RedefineTests /test/hotspot/jtreg/runtime/appcds
  * @modules java.compiler
  *          java.instrument
--- a/test/hotspot/jtreg/runtime/appcds/redefineClass/RedefineRunningMethods_Shared.java	Wed Dec 20 09:14:52 2017 -0800
+++ b/test/hotspot/jtreg/runtime/appcds/redefineClass/RedefineRunningMethods_Shared.java	Thu Dec 21 00:07:38 2017 +0100
@@ -26,8 +26,7 @@
  * @test
  * @summary Run /runtime/RedefineTests/RedefineRunningMethods in AppCDS mode to
  *          make sure class redefinition works with CDS.
- *          (Note: AppCDS does not support uncompressed oops)
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ * @requires vm.cds
  * @library /test/lib /test/hotspot/jtreg/runtime/RedefineTests /test/hotspot/jtreg/runtime/appcds
  * @modules java.base/jdk.internal.misc
  * @modules java.compiler
--- a/test/hotspot/jtreg/runtime/appcds/sharedStrings/ExerciseGC.java	Wed Dec 20 09:14:52 2017 -0800
+++ b/test/hotspot/jtreg/runtime/appcds/sharedStrings/ExerciseGC.java	Thu Dec 21 00:07:38 2017 +0100
@@ -25,7 +25,7 @@
 /*
  * @test
  * @summary Exercise GC with shared strings
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ * @requires vm.cds
  * @requires vm.gc.G1
  * @requires (sun.arch.data.model != "32") & (os.family != "windows")
  * @library /test/hotspot/jtreg/runtime/appcds /test/lib
--- a/test/hotspot/jtreg/runtime/appcds/sharedStrings/FlagCombo.java	Wed Dec 20 09:14:52 2017 -0800
+++ b/test/hotspot/jtreg/runtime/appcds/sharedStrings/FlagCombo.java	Thu Dec 21 00:07:38 2017 +0100
@@ -25,7 +25,7 @@
 /*
  * @test
  * @summary Test relevant combinations of command line flags with shared strings
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ * @requires vm.cds
  * @requires (sun.arch.data.model != "32") & (os.family != "windows")
  * @requires (vm.gc=="null")
  * @library /test/lib /test/hotspot/jtreg/runtime/appcds
--- a/test/hotspot/jtreg/runtime/appcds/sharedStrings/IncompatibleOptions.java	Wed Dec 20 09:14:52 2017 -0800
+++ b/test/hotspot/jtreg/runtime/appcds/sharedStrings/IncompatibleOptions.java	Thu Dec 21 00:07:38 2017 +0100
@@ -28,7 +28,7 @@
  *          Also test mismatch in oops encoding between dump time and run time
  * Feature support: G1GC only, compressed oops/kptrs, 64-bit os, not on windows
  * @requires (sun.arch.data.model != "32") & (os.family != "windows")
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ * @requires vm.cds
  * @requires (vm.gc=="null")
  * @library /test/lib /test/hotspot/jtreg/runtime/appcds
  * @modules java.base/jdk.internal.misc
--- a/test/hotspot/jtreg/runtime/appcds/sharedStrings/InternSharedString.java	Wed Dec 20 09:14:52 2017 -0800
+++ b/test/hotspot/jtreg/runtime/appcds/sharedStrings/InternSharedString.java	Thu Dec 21 00:07:38 2017 +0100
@@ -27,7 +27,7 @@
  * @summary Test shared strings together with string intern operation
  * Feature support: G1GC only, compressed oops/kptrs, 64-bit os, not on windows
  * @requires (sun.arch.data.model != "32") & (os.family != "windows")
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ * @requires vm.cds
  * @requires vm.gc.G1
  * @library /test/hotspot/jtreg/runtime/appcds /test/lib
  * @modules java.base/jdk.internal.misc
--- a/test/hotspot/jtreg/runtime/appcds/sharedStrings/InvalidFileFormat.java	Wed Dec 20 09:14:52 2017 -0800
+++ b/test/hotspot/jtreg/runtime/appcds/sharedStrings/InvalidFileFormat.java	Thu Dec 21 00:07:38 2017 +0100
@@ -27,7 +27,7 @@
  * @summary Check most common errors in file format
  * Feature support: G1GC only, compressed oops/kptrs, 64-bit os, not on windows
  * @requires (sun.arch.data.model != "32") & (os.family != "windows")
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ * @requires vm.cds
  * @requires vm.gc.G1
  * @library /test/lib /test/hotspot/jtreg/runtime/appcds
  * @modules java.base/jdk.internal.misc
--- a/test/hotspot/jtreg/runtime/appcds/sharedStrings/LargePages.java	Wed Dec 20 09:14:52 2017 -0800
+++ b/test/hotspot/jtreg/runtime/appcds/sharedStrings/LargePages.java	Thu Dec 21 00:07:38 2017 +0100
@@ -27,7 +27,7 @@
  * @summary Basic shared string test with large pages
  * Feature support: G1GC only, compressed oops/kptrs, 64-bit os, not on windows
  * @requires (sun.arch.data.model != "32") & (os.family != "windows")
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ * @requires vm.cds
  * @requires vm.gc.G1
  * @library /test/lib /test/hotspot/jtreg/runtime/appcds
  * @modules java.base/jdk.internal.misc
--- a/test/hotspot/jtreg/runtime/appcds/sharedStrings/LockSharedStrings.java	Wed Dec 20 09:14:52 2017 -0800
+++ b/test/hotspot/jtreg/runtime/appcds/sharedStrings/LockSharedStrings.java	Thu Dec 21 00:07:38 2017 +0100
@@ -27,7 +27,7 @@
  * @summary Test locking on shared strings
  * Feature support: G1GC only, compressed oops/kptrs, 64-bit os, not on windows
  * @requires (sun.arch.data.model != "32") & (os.family != "windows")
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ * @requires vm.cds
  * @requires vm.gc.G1
  * @library /test/hotspot/jtreg/runtime/appcds /test/lib
  * @modules java.base/jdk.internal.misc
--- a/test/hotspot/jtreg/runtime/appcds/sharedStrings/SharedStringsBasic.java	Wed Dec 20 09:14:52 2017 -0800
+++ b/test/hotspot/jtreg/runtime/appcds/sharedStrings/SharedStringsBasic.java	Thu Dec 21 00:07:38 2017 +0100
@@ -27,7 +27,7 @@
  * @summary Basic test for shared strings
  * Feature support: G1GC only, compressed oops/kptrs, 64-bit os, not on windows
  * @requires (sun.arch.data.model != "32") & (os.family != "windows")
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ * @requires vm.cds
  * @requires vm.gc.G1
  * @library /test/hotspot/jtreg/runtime/appcds /test/lib
  * @modules java.base/jdk.internal.misc
--- a/test/hotspot/jtreg/runtime/appcds/sharedStrings/SharedStringsBasicPlus.java	Wed Dec 20 09:14:52 2017 -0800
+++ b/test/hotspot/jtreg/runtime/appcds/sharedStrings/SharedStringsBasicPlus.java	Thu Dec 21 00:07:38 2017 +0100
@@ -27,7 +27,7 @@
  * @summary Basic plus test for shared strings
  * Feature support: G1GC only, compressed oops/kptrs, 64-bit os, not on windows
  * @requires (sun.arch.data.model != "32") & (os.family != "windows")
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ * @requires vm.cds
  * @requires vm.gc.G1
  * @library /test/hotspot/jtreg/runtime/appcds /test/lib
  * @modules java.base/jdk.internal.misc
--- a/test/hotspot/jtreg/runtime/appcds/sharedStrings/SharedStringsStress.java	Wed Dec 20 09:14:52 2017 -0800
+++ b/test/hotspot/jtreg/runtime/appcds/sharedStrings/SharedStringsStress.java	Thu Dec 21 00:07:38 2017 +0100
@@ -27,7 +27,7 @@
  * @summary Write a lots of shared strings.
  * Feature support: G1GC only, compressed oops/kptrs, 64-bit os, not on windows
  * @requires (sun.arch.data.model != "32") & (os.family != "windows")
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ * @requires vm.cds
  * @requires vm.gc.G1
  * @library /test/hotspot/jtreg/runtime/appcds /test/lib
  * @modules jdk.jartool/sun.tools.jar
--- a/test/hotspot/jtreg/runtime/appcds/sharedStrings/SharedStringsWbTest.java	Wed Dec 20 09:14:52 2017 -0800
+++ b/test/hotspot/jtreg/runtime/appcds/sharedStrings/SharedStringsWbTest.java	Thu Dec 21 00:07:38 2017 +0100
@@ -27,7 +27,7 @@
  * @summary White box test for shared strings
  * Feature support: G1GC only, compressed oops/kptrs, 64-bit os, not on windows
  * @requires (sun.arch.data.model != "32") & (os.family != "windows")
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ * @requires vm.cds
  * @requires vm.gc.G1
  * @library /test/lib /test/hotspot/jtreg/runtime/appcds
  * @modules java.base/jdk.internal.misc
--- a/test/hotspot/jtreg/runtime/appcds/sharedStrings/SysDictCrash.java	Wed Dec 20 09:14:52 2017 -0800
+++ b/test/hotspot/jtreg/runtime/appcds/sharedStrings/SysDictCrash.java	Thu Dec 21 00:07:38 2017 +0100
@@ -26,7 +26,7 @@
  * @test
  * @summary Regression test for JDK-8098821
  * @bug 8098821
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ * @requires vm.cds
  * @requires vm.gc.G1
  * @library /test/lib /test/hotspot/jtreg/runtime/appcds
  * @modules java.base/jdk.internal.misc
--- a/test/hotspot/jtreg/runtime/appcds/test-classes/Util.java	Wed Dec 20 09:14:52 2017 -0800
+++ b/test/hotspot/jtreg/runtime/appcds/test-classes/Util.java	Thu Dec 21 00:07:38 2017 +0100
@@ -39,7 +39,7 @@
         throws FileNotFoundException, IOException, NoSuchMethodException, IllegalAccessException,
                InvocationTargetException
     {
-        DataInputStream dis = new DataInputStream(new FileInputStream(clsFile));
+      try (DataInputStream dis = new DataInputStream(new FileInputStream(clsFile))) {
         byte[] buff = new byte[(int)clsFile.length()];
         dis.readFully(buff);
         replace(buff, fromString, toString);
@@ -57,6 +57,7 @@
         System.out.println("Loaded : " + cls);
 
         return cls;
+      }
     }
 
     /**
@@ -146,11 +147,10 @@
         JarFile jf = new JarFile(jarFile);
         JarEntry ent = jf.getJarEntry(className.replace('.', '/') + ".class");
 
-        DataInputStream dis = new DataInputStream(jf.getInputStream(ent));
-        byte[] buff = new byte[(int)ent.getSize()];
-        dis.readFully(buff);
-        dis.close();
-
-        return buff;
+        try (DataInputStream dis = new DataInputStream(jf.getInputStream(ent))) {
+            byte[] buff = new byte[(int)ent.getSize()];
+            dis.readFully(buff);
+            return buff;
+        }
     }
 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/runtime/clone/AbstractClone.java	Thu Dec 21 00:07:38 2017 +0100
@@ -0,0 +1,55 @@
+/*
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+
+/*
+ * @test
+ * @bug 8154587
+ * @summary Check that invokeinterface of clone() works properly where clone() is
+ *          an abstract method in a superinterface and also overridden locally.
+ * @run main AbstractClone
+ */
+
+public class AbstractClone {
+
+    interface I1 {
+        Object clone();
+    }
+
+    interface I2 extends I1 { }
+
+    static class C implements I2 {
+        public Object clone() {
+            return "In C's clone()";
+        }
+    }
+
+    static Object test(I2 i) { return i.clone(); }
+
+    public static void main(String[] args) {
+        String s = (String)test(new C());
+        if (!s.equals("In C's clone()")) {
+            throw new RuntimeException("Wrong clone() called");
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/runtime/clone/AbstractNoClones.jasm	Thu Dec 21 00:07:38 2017 +0100
@@ -0,0 +1,142 @@
+/*
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+
+/*
+ * @test
+ * @bug 8154587
+ * @summary Check that invokeinterface of clone() works properly where clone() is
+ *          an abstract method in a superinterface and not overridden locally.
+ * @compile AbstractNoClones.jasm
+ * @run main AbstractNoClones
+ */
+
+// The below .jasm code implements the following java code:
+//
+// public class AbstractNoClones {
+//
+//     interface I1 {
+//         Object clone();
+//     }
+//
+//     interface I2 extends I1 { }
+//
+//     static class C implements I2 { }
+//
+//     static Object test(I2 i) { return i.clone(); }
+//
+//     public static void main(String[] args) {
+//         try {
+//             String s = (String)test(new C());
+//             throw new RuntimeException("Expected IAE not thrown");
+//         } catch (java.lang.IllegalAccessError e) {
+//             if (!e.toString().contains("C.clone")) {
+//                 throw new RuntimeException("Wrong IllegalAccessError exception thrown");
+//             }
+//         }
+//     }
+// }
+
+
+interface  AbstractNoClones$I1 version 53:0 {
+
+    public abstract Method clone:"()Ljava/lang/Object;";
+
+    static abstract interface InnerClass I1=class AbstractNoClones$I1 of class AbstractNoClones;
+
+} // end Class AbstractNoClones$I1
+
+
+interface  AbstractNoClones$I2 implements AbstractNoClones$I1 version 53:0 {
+
+    static abstract interface InnerClass I2=class AbstractNoClones$I2 of class AbstractNoClones;
+    static abstract interface InnerClass I1=class AbstractNoClones$I1 of class AbstractNoClones;
+
+} // end Class AbstractNoClones$I2
+
+
+super class AbstractNoClones$C implements AbstractNoClones$I2 version 53:0 {
+
+    Method "<init>":"()V" stack 1 locals 1 {
+        aload_0;
+        invokespecial    Method java/lang/Object."<init>":"()V";
+        return;
+    }
+
+    static InnerClass C=class AbstractNoClones$C of class AbstractNoClones;
+    static abstract interface InnerClass I2=class AbstractNoClones$I2 of class AbstractNoClones;
+
+} // end Class AbstractNoClones$C
+
+
+super public class AbstractNoClones version 53:0 {
+
+    public Method "<init>":"()V" stack 1 locals 1 {
+        aload_0;
+        invokespecial    Method java/lang/Object."<init>":"()V";
+        return;
+    }
+
+    static Method test:"(LAbstractNoClones$I2;)Ljava/lang/Object;" stack 1 locals 1 {
+        aload_0;
+        invokeinterface    InterfaceMethod AbstractNoClones$I2.clone:"()Ljava/lang/Object;",  1;
+        areturn;
+    }
+
+    public static Method main:"([Ljava/lang/String;)V" stack 3 locals 2 {
+        try t0;
+        new    class AbstractNoClones$C;
+        dup;
+        invokespecial    Method AbstractNoClones$C."<init>":"()V";
+        invokestatic    Method test:"(LAbstractNoClones$I2;)Ljava/lang/Object;";
+        checkcast    class java/lang/String;
+        astore_1;
+        new    class java/lang/RuntimeException;
+        dup;
+        ldc    String "Expected IAE not thrown";
+        invokespecial    Method java/lang/RuntimeException."<init>":"(Ljava/lang/String;)V";
+        athrow;
+        endtry t0;
+        catch t0 java/lang/IllegalAccessError;
+        stack_frame_type stack1;
+        stack_map class java/lang/IllegalAccessError;
+        astore_1;
+        aload_1;
+        invokevirtual    Method java/lang/IllegalAccessError.toString:"()Ljava/lang/String;";
+        ldc    String "C.clone";
+        invokevirtual    Method java/lang/String.contains:"(Ljava/lang/CharSequence;)Z";
+        ifne    L47;
+        new    class java/lang/RuntimeException;
+        dup;
+        ldc    String "Wrong IllegalAccessError exception thrown";
+        invokespecial    Method java/lang/RuntimeException."<init>":"(Ljava/lang/String;)V";
+        athrow;
+      L47:    stack_frame_type same;
+        return;
+    }
+
+    static InnerClass C=class AbstractNoClones$C of class AbstractNoClones;
+    static abstract interface InnerClass I2=class AbstractNoClones$I2 of class AbstractNoClones;
+    static abstract interface InnerClass I1=class AbstractNoClones$I1 of class AbstractNoClones;
+
+} // end Class AbstractNoClones
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/runtime/clone/DefaultClone.jasm	Thu Dec 21 00:07:38 2017 +0100
@@ -0,0 +1,145 @@
+/*
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+
+/*
+ * @test
+ * @bug 8154587
+ * @summary Check that a default method named clone() does not get masked by
+ *          java.lang.Object.clone() during resolution.
+ * @compile DefaultClone.jasm
+ * @run main DefaultClone
+ */
+
+// The below .jasm code implements the following java code:
+//
+// public class DefaultClone {
+//
+//     interface I1 {
+//         default Object clone() {
+//             return "In I1's clone()";
+//         }
+//     }
+// 
+//
+//     interface I2 extends I1 { }
+// 
+//
+//     static class C implements I2 {
+//         public Object clone() {
+//             return "In C's clone()";
+//         }
+//     }
+// 
+// 
+//     static Object test(I2 i) { return i.clone(); }
+//
+//     public static void main(String[] args) {
+//         String s = (String)test(new C());
+//         if (!s.equals("In C's clone()")) {
+//             throw new RuntimeException("Wrong clone() called");
+//         }
+//     }
+// }
+
+
+interface  DefaultClone$I1 version 53:0 {
+
+    public Method clone:"()Ljava/lang/Object;" stack 1 locals 1 {
+        ldc    String "In I1\'s clone()";
+        areturn;
+    }
+
+    static abstract interface InnerClass I1=class DefaultClone$I1 of class DefaultClone;
+
+} // end Class DefaultClone$I1
+
+
+
+interface  DefaultClone$I2 implements DefaultClone$I1 version 53:0 {
+
+    static abstract interface InnerClass I2=class DefaultClone$I2 of class DefaultClone;
+    static abstract interface InnerClass I1=class DefaultClone$I1 of class DefaultClone;
+
+} // end Class DefaultClone$I2
+
+
+super class DefaultClone$C implements DefaultClone$I2 version 53:0 {
+
+    Method "<init>":"()V" stack 1 locals 1 {
+        aload_0;
+        invokespecial    Method java/lang/Object."<init>":"()V";
+        return;
+    }
+
+    public Method clone:"()Ljava/lang/Object;" stack 1 locals 1 {
+        ldc    String "In C\'s clone()";
+        areturn;
+    }
+
+    static InnerClass C=class DefaultClone$C of class DefaultClone;
+    static abstract interface InnerClass I2=class DefaultClone$I2 of class DefaultClone;
+
+} // end Class DefaultClone$C
+
+
+super public class DefaultClone version 53:0 {
+
+    public Method "<init>":"()V" stack 1 locals 1 {
+        aload_0;
+        invokespecial    Method java/lang/Object."<init>":"()V";
+        return;
+    }
+
+    static Method test:"(LDefaultClone$I2;)Ljava/lang/Object;" stack 1 locals 1 {
+        aload_0;
+        invokeinterface    InterfaceMethod DefaultClone$I2.clone:"()Ljava/lang/Object;",  1;
+        areturn;
+    }
+
+    public static Method main:"([Ljava/lang/String;)V" stack 3 locals 2 {
+        new    class DefaultClone$C;
+        dup;
+        invokespecial    Method DefaultClone$C."<init>":"()V";
+        invokestatic    Method test:"(LDefaultClone$I2;)Ljava/lang/Object;";
+        checkcast    class java/lang/String;
+        astore_1;
+        aload_1;
+        ldc    String "In C\'s clone()";
+        invokevirtual    Method java/lang/String.equals:"(Ljava/lang/Object;)Z";
+        ifne    L33;
+        new    class java/lang/RuntimeException;
+        dup;
+        ldc    String "Wrong clone() called";
+        invokespecial    Method java/lang/RuntimeException."<init>":"(Ljava/lang/String;)V";
+        athrow;
+    L33:    stack_frame_type append;
+        locals_map class java/lang/String;
+        return;
+    }
+
+    static InnerClass C=class DefaultClone$C of class DefaultClone;
+    static abstract interface InnerClass I2=class DefaultClone$I2 of class DefaultClone;
+    static abstract interface InnerClass I1=class DefaultClone$I1 of class DefaultClone;
+
+} // end Class DefaultClone
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/runtime/clone/DefaultFinalize.jasm	Thu Dec 21 00:07:38 2017 +0100
@@ -0,0 +1,144 @@
+/*
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+
+/*
+ * @test
+ * @bug 8154587
+ * @summary Check that a default method named finalize() does not get masked by
+ *          java.lang.Object.finalize() during resolution.
+ * @compile DefaultFinalize.jasm
+ * @run main DefaultFinalize
+ */
+
+// The below .jasm code implements the following java code:
+//
+// public class DefaultFinalize {
+//
+//     static String res;
+//
+//     interface I1 {
+//         default void finalize() {
+//             res = "In I1's finalize()";
+//         }
+//     }
+//
+//     interface I2 extends I1 { }
+//
+//     static class C implements I2 {
+//         public void finalize() {
+//             res = "In C's finalize()";
+//         }
+//     }
+//
+//     static void test(I2 i) { i.finalize(); }
+//
+//     public static void main(String[] args) {
+//         test(new C());
+//         if (!res.equals("In C's finalize()")) {
+//             throw new RuntimeException("Wrong finalize() method called");
+//         }
+//     }
+// }
+
+
+interface  DefaultFinalize$I1 version 54:0 {
+
+    public Method finalize:"()V" stack 1 locals 1 {
+        ldc    String "In I1\'s finalize()";
+        putstatic    Field DefaultFinalize.res:"Ljava/lang/String;";
+        return;
+    }
+
+    static abstract interface InnerClass I1=class DefaultFinalize$I1 of class DefaultFinalize;
+
+} // end Class DefaultFinalize$I1
+
+
+interface  DefaultFinalize$I2 implements DefaultFinalize$I1 version 54:0 {
+
+    static abstract interface InnerClass I2=class DefaultFinalize$I2 of class DefaultFinalize;
+    static abstract interface InnerClass I1=class DefaultFinalize$I1 of class DefaultFinalize;
+
+} // end Class DefaultFinalize$I2
+
+
+super class DefaultFinalize$C implements DefaultFinalize$I2 version 54:0 {
+
+    Method "<init>":"()V" stack 1 locals 1 {
+        aload_0;
+        invokespecial    Method java/lang/Object."<init>":"()V";
+        return;
+    }
+
+    public Method finalize:"()V" stack 1 locals 1 {
+        ldc    String "In C\'s finalize()";
+        putstatic    Field DefaultFinalize.res:"Ljava/lang/String;";
+        return;
+    }
+
+    static InnerClass C=class DefaultFinalize$C of class DefaultFinalize;
+    static abstract interface InnerClass I2=class DefaultFinalize$I2 of class DefaultFinalize;
+
+} // end Class DefaultFinalize$C
+
+
+super public class DefaultFinalize version 54:0 {
+
+    static Field res:"Ljava/lang/String;";
+
+    public Method "<init>":"()V" stack 1 locals 1 {
+        aload_0;
+        invokespecial    Method java/lang/Object."<init>":"()V";
+        return;
+    }
+
+    static Method test:"(LDefaultFinalize$I2;)V" stack 1 locals 1 {
+        aload_0;
+        invokeinterface    InterfaceMethod DefaultFinalize$I2.finalize:"()V",  1;
+        return;
+    }
+
+    public static Method main:"([Ljava/lang/String;)V" stack 3 locals 1 {
+        new    class DefaultFinalize$C;
+        dup;
+        invokespecial   Method DefaultFinalize$C."<init>":"()V";
+        invokestatic    Method test:"(LDefaultFinalize$I2;)V";
+        getstatic       Field res:"Ljava/lang/String;";
+        ldc    String "In C\'s finalize()";
+        invokevirtual   Method java/lang/String.equals:"(Ljava/lang/Object;)Z";
+        ifne    L31;
+        new    class java/lang/RuntimeException;
+        dup;
+        ldc    String "Wrong finalize() method called";
+        invokespecial    Method java/lang/RuntimeException."<init>":"(Ljava/lang/String;)V";
+        athrow;
+      L31:    stack_frame_type same;
+        return;
+    }
+
+    static InnerClass C=class DefaultFinalize$C of class DefaultFinalize;
+    static abstract interface InnerClass I2=class DefaultFinalize$I2 of class DefaultFinalize;
+    static abstract interface InnerClass I1=class DefaultFinalize$I1 of class DefaultFinalize;
+
+} // end Class DefaultFinalize
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/runtime/clone/DefaultHashCode.jasm	Thu Dec 21 00:07:38 2017 +0100
@@ -0,0 +1,126 @@
+/*
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+
+/*
+ * @test
+ * @bug 8154587
+ * @summary Check that invokeinterface calls the right hashCode() method when
+ *          there is both a local method named hashCode() and a default method
+ *          named hashCode().
+ * @compile DefaultHashCode.jasm
+ * @run main DefaultHashCode
+ */
+
+// The below .jasm code implements the following java code:
+//
+// public class DefaultHashCode {
+//
+//     interface I2 {
+//         default int hashCode() {
+//             return 5;
+//         }
+//     }
+//
+//     static class C implements I2 {
+//         public int hashCode() {
+//             return 4;
+//         }
+//     }
+//
+//     static int test(I2 i) { return i.hashCode(); }
+//
+//     public static void main(String[] args) {
+//         if (test(new C()) != 4) {
+//             throw new RuntimeException("Wrong hashCode() function called");
+//         }
+//     }
+// }
+
+
+interface  DefaultHashCode$I2 version 53:0 {
+
+    public Method hashCode:"()I" stack 1 locals 1 {
+        iconst_5;
+        ireturn;
+    }
+
+    static abstract interface InnerClass I2=class DefaultHashCode$I2 of class DefaultHashCode;
+
+} // end Class DefaultHashCode$I2
+
+
+super class DefaultHashCode$C implements DefaultHashCode$I2 version 53:0 {
+
+    Method "<init>":"()V" stack 1 locals 1 {
+        aload_0;
+        invokespecial    Method java/lang/Object."<init>":"()V";
+        return;
+    }
+
+    public Method hashCode:"()I" stack 1 locals 1 {
+        iconst_4;
+        ireturn;
+    }
+
+    static InnerClass C=class DefaultHashCode$C of class DefaultHashCode;
+    static abstract interface InnerClass I2=class DefaultHashCode$I2 of class DefaultHashCode;
+
+} // end Class DefaultHashCode$C
+
+
+super public class DefaultHashCode version 53:0 {
+
+    public Method "<init>":"()V" stack 1 locals 1 {
+        aload_0;
+        invokespecial    Method java/lang/Object."<init>":"()V";
+        return;
+    }
+
+    static Method test:"(LDefaultHashCode$I2;)I" stack 1 locals 1 {
+        aload_0;
+        invokeinterface InterfaceMethod DefaultHashCode$I2.hashCode:"()I",  1;
+        ireturn;
+    }
+
+    public static Method main:"([Ljava/lang/String;)V" stack 3 locals 1 {
+        new    class DefaultHashCode$C;
+        dup;
+        invokespecial    Method DefaultHashCode$C."<init>":"()V";
+        invokestatic    Method test:"(LDefaultHashCode$I2;)I";
+        iconst_4;
+        if_icmpeq    L24;
+        new    class java/lang/RuntimeException;
+        dup;
+        ldc    String "Wrong hashCode() function called";
+        invokespecial    Method java/lang/RuntimeException."<init>":"(Ljava/lang/String;)V";
+        athrow;
+      L24:    stack_frame_type same;
+        return;
+    }
+
+    static InnerClass C=class DefaultHashCode$C of class DefaultHashCode;
+    static abstract interface InnerClass I2=class DefaultHashCode$I2 of class DefaultHashCode;
+
+} // end Class DefaultHashCode
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/runtime/clone/DefaultNoCloneInC.jasm	Thu Dec 21 00:07:38 2017 +0100
@@ -0,0 +1,151 @@
+/*
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+
+/*
+ * @test
+ * @bug 8154587
+ * @summary Check that calling clone() with an invokeinterface opcode throws an IAE
+ *          even if there is a default method named clone() in a super interface.
+ * @compile DefaultNoCloneInC.jasm
+ * @run main DefaultNoCloneInC
+ */
+
+// The below .jasm code implements the following java code:
+//
+// public class DefaultNoCloneInC {
+//
+//     interface I1 {
+//         default Object clone() {
+//             return "In I1's clone()";
+//         }
+//     }
+//
+//
+//     interface I2 extends I1 { }
+//
+//
+//     static class C implements I2 { }
+//
+//
+//     static Object test(I2 i) { return i.clone(); }
+//
+//     public static void main(String[] args) {
+//         try {
+//             String s = (String)test(new C());
+//             throw new RuntimeException("Expected IAE not thrown");
+//         } catch (java.lang.IllegalAccessError e) {
+//             if (!e.toString().contains("C.clone")) {
+//                 throw new RuntimeException("Wrong IllegalAccessError exception thrown");
+//             }
+//        }
+//     }
+// }
+
+
+interface  DefaultNoCloneInC$I1 version 53:0 {
+
+    public Method clone:"()Ljava/lang/Object;" stack 1 locals 1 {
+        ldc     String "In I1\'s clone()";
+        areturn;
+    }
+
+    static abstract interface InnerClass I1=class DefaultNoCloneInC$I1 of class DefaultNoCloneInC;
+
+} // end Class DefaultNoCloneInC$I1
+
+
+interface  DefaultNoCloneInC$I2 implements DefaultNoCloneInC$I1 version 53:0 {
+
+    static abstract interface InnerClass I2=class DefaultNoCloneInC$I2 of class DefaultNoCloneInC;
+    static abstract interface InnerClass I1=class DefaultNoCloneInC$I1 of class DefaultNoCloneInC;
+
+} // end Class DefaultNoCloneInC$I2
+
+
+super class DefaultNoCloneInC$C implements DefaultNoCloneInC$I2 version 53:0 {
+
+
+    Method "<init>":"()V" stack 1 locals 1 {
+        aload_0;
+        invokespecial    Method java/lang/Object."<init>":"()V";
+        return;
+    }
+
+    static InnerClass C=class DefaultNoCloneInC$C of class DefaultNoCloneInC;
+    static abstract interface InnerClass I2=class DefaultNoCloneInC$I2 of class DefaultNoCloneInC;
+
+} // end Class DefaultNoCloneInC$C
+
+
+super public class DefaultNoCloneInC version 53:0 {
+
+    public Method "<init>":"()V" stack 1 locals 1 {
+        aload_0;
+        invokespecial   Method java/lang/Object."<init>":"()V";
+        return;
+    }
+
+    static Method test:"(LDefaultNoCloneInC$I2;)Ljava/lang/Object;" stack 1 locals 1 {
+        aload_0;
+        invokeinterface InterfaceMethod DefaultNoCloneInC$I2.clone:"()Ljava/lang/Object;",  1;
+        areturn;
+    }
+
+    public static Method main:"([Ljava/lang/String;)V" stack 3 locals 2 {
+        try t0;
+        new     class DefaultNoCloneInC$C;
+        dup;
+        invokespecial   Method DefaultNoCloneInC$C."<init>":"()V";
+        invokestatic    Method test:"(LDefaultNoCloneInC$I2;)Ljava/lang/Object;";
+        checkcast       class java/lang/String;
+        astore_1;
+        new     class java/lang/RuntimeException;
+        dup;
+        ldc     String "Expected IAE not thrown";
+        invokespecial   Method java/lang/RuntimeException."<init>":"(Ljava/lang/String;)V";
+        athrow;
+        endtry t0;
+        catch t0 java/lang/IllegalAccessError;
+        stack_frame_type stack1;
+        stack_map class java/lang/IllegalAccessError;
+        astore_1;
+        aload_1;
+        invokevirtual   Method java/lang/IllegalAccessError.toString:"()Ljava/lang/String;";
+        ldc     String "C.clone";
+        invokevirtual   Method java/lang/String.contains:"(Ljava/lang/CharSequence;)Z";
+        ifne    L47;
+        new     class java/lang/RuntimeException;
+        dup;
+        ldc     String "Wrong IllegalAccessError exception thrown";
+        invokespecial   Method java/lang/RuntimeException."<init>":"(Ljava/lang/String;)V";
+        athrow;
+      L47:    stack_frame_type same;
+        return;
+    }
+
+    static InnerClass C=class DefaultNoCloneInC$C of class DefaultNoCloneInC;
+    static abstract interface InnerClass I2=class DefaultNoCloneInC$I2 of class DefaultNoCloneInC;
+    static abstract interface InnerClass I1=class DefaultNoCloneInC$I1 of class DefaultNoCloneInC;
+
+} // end Class DefaultNoCloneInC
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/runtime/clone/LocalClone.jasm	Thu Dec 21 00:07:38 2017 +0100
@@ -0,0 +1,144 @@
+/*
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+
+/*
+ * @test
+ * @bug 8154587
+ * @summary Check that method resolution for invokeinterface of clone() fails
+ *          if it cannot find a public method named clone().
+ * @compile LocalClone.jasm
+ * @run main LocalClone
+ */
+
+// The below .jasm code implements the following java code:
+//
+// interface I1 { }
+//
+//
+// public class LocalClone {
+//
+//    interface I2 extends I1 { }
+//
+//
+//    static class C implements I2 {
+//        public Object clone() {
+//            return "In C's clone()";
+//        }
+//    }
+//
+//    static Object test(I2 i) { return i.clone(); }
+//
+//    public static void main(String[] args) {
+//        try {
+//            String s = (String)test(new C());
+//            throw new RuntimeException("Expected NSME not thrown");
+//        } catch (java.lang.NoSuchMethodError e) {
+//            if (!e.toString().contains("I2.clone")) {
+//                throw new RuntimeException("Wrong NoSuchMethodError exception thrown");
+//            }
+//        }
+//    }
+// }
+
+
+interface I1 version 53:0 { } // end Class I1
+
+
+interface  LocalClone$I2 implements I1 version 53:0 {
+
+    static abstract interface InnerClass I2=class LocalClone$I2 of class LocalClone;
+
+} // end Class LocalClone$I2
+
+
+super class LocalClone$C implements LocalClone$I2 version 53:0 {
+
+    Method "<init>":"()V" stack 1 locals 1 {
+        aload_0;
+        invokespecial    Method java/lang/Object."<init>":"()V";
+        return;
+    }
+
+    public Method clone:"()Ljava/lang/Object;" stack 1 locals 1 {
+        ldc    String "In C\'s clone()";
+        areturn;
+    }
+
+    static InnerClass C=class LocalClone$C of class LocalClone;
+    static abstract interface InnerClass I2=class LocalClone$I2 of class LocalClone;
+
+} // end Class LocalClone$C
+
+
+super public class LocalClone version 53:0 {
+
+    public Method "<init>":"()V" stack 1 locals 1 {
+        aload_0;
+        invokespecial    Method java/lang/Object."<init>":"()V";
+        return;
+    }
+
+    static Method test:"(LLocalClone$I2;)Ljava/lang/Object;" stack 1 locals 1 {
+        aload_0;
+        invokeinterface    InterfaceMethod LocalClone$I2.clone:"()Ljava/lang/Object;",  1;
+        areturn;
+    }
+
+    public static Method main:"([Ljava/lang/String;)V" stack 3 locals 2 {
+        try t0;
+        new    class LocalClone$C;
+        dup;
+        invokespecial    Method LocalClone$C."<init>":"()V";
+        invokestatic    Method test:"(LLocalClone$I2;)Ljava/lang/Object;";
+        checkcast    class java/lang/String;
+        astore_1;
+        new    class java/lang/RuntimeException;
+        dup;
+        ldc    String "Expected NSME not thrown";
+        invokespecial    Method java/lang/RuntimeException."<init>":"(Ljava/lang/String;)V";
+        athrow;
+        endtry t0;
+        catch t0 java/lang/NoSuchMethodError;
+        stack_frame_type stack1;
+        stack_map class java/lang/NoSuchMethodError;
+        astore_1;
+        aload_1;
+        invokevirtual    Method java/lang/NoSuchMethodError.toString:"()Ljava/lang/String;";
+        ldc    String "I2.clone";
+        invokevirtual    Method java/lang/String.contains:"(Ljava/lang/CharSequence;)Z";
+        ifne    L47;
+        new    class java/lang/RuntimeException;
+        dup;
+        ldc    String "Wrong NoSuchMethodError exception thrown";
+        invokespecial    Method java/lang/RuntimeException."<init>":"(Ljava/lang/String;)V";
+        athrow;
+      L47:  stack_frame_type same;
+        return;
+    }
+
+    static InnerClass C=class LocalClone$C of class LocalClone;
+    static abstract interface InnerClass I2=class LocalClone$I2 of class LocalClone;
+
+} // end Class LocalClone
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/runtime/clone/NoClones.jasm	Thu Dec 21 00:07:38 2017 +0100
@@ -0,0 +1,133 @@
+/*
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+
+/*
+ * @test
+ * @bug 8154587
+ * @summary Check that a NoSuchMethodError exception gets thrown if invokeinterface
+ *          calls clone() and there is no public implementation of clone().
+ * @compile NoClones.jasm
+ * @run main NoClones
+ */
+
+// The below .jasm code implements the following java code:
+//
+// interface I1 { }
+//
+//
+// public class NoClones {
+//
+//    interface I2 extends I1 { }
+//
+//    static class C implements I2 { }
+//
+//    static Object test(I2 i) { return i.clone(); }
+//
+//    public static void main(String[] args) {
+//        try {
+//            String s = (String)test(new C());
+//            throw new RuntimeException("Expected NSME not thrown");
+//        } catch (java.lang.NoSuchMethodError e) {
+//            if (!e.toString().contains("I2.clone")) {
+//                throw new RuntimeException("Wrong NoSuchMethodError exception thrown");
+//            }
+//        }
+//    }
+// }
+
+
+interface I1 version 53:0 { } // end Class I1
+
+
+interface  NoClones$I2 implements I1 version 53:0 {
+
+    static abstract interface InnerClass I2=class NoClones$I2 of class NoClones;
+
+} // end Class NoClones$I2
+
+
+super class NoClones$C implements NoClones$I2 version 53:0 {
+
+    Method "<init>":"()V" stack 1 locals 1 {
+        aload_0;
+        invokespecial    Method java/lang/Object."<init>":"()V";
+        return;
+    }
+
+    static InnerClass C=class NoClones$C of class NoClones;
+    static abstract interface InnerClass I2=class NoClones$I2 of class NoClones;
+
+} // end Class NoClones$C
+
+
+super public class NoClones version 53:0 {
+
+    public Method "<init>":"()V" stack 1 locals 1 {
+        aload_0;
+        invokespecial    Method java/lang/Object."<init>":"()V";
+        return;
+    }
+
+    static Method test:"(LNoClones$I2;)Ljava/lang/Object;" stack 1 locals 1 {
+        aload_0;
+        invokeinterface    InterfaceMethod NoClones$I2.clone:"()Ljava/lang/Object;",  1;
+        areturn;
+    }
+
+    public static Method main:"([Ljava/lang/String;)V" stack 3 locals 2 {
+        try t0;
+        new    class NoClones$C;
+        dup;
+        invokespecial    Method NoClones$C."<init>":"()V";
+        invokestatic    Method test:"(LNoClones$I2;)Ljava/lang/Object;";
+        checkcast    class java/lang/String;
+        astore_1;
+        new    class java/lang/RuntimeException;
+        dup;
+        ldc    String "Expected NSME not thrown";
+        invokespecial    Method java/lang/RuntimeException."<init>":"(Ljava/lang/String;)V";
+        athrow;
+        endtry t0;
+        catch t0 java/lang/NoSuchMethodError;
+        stack_frame_type stack1;
+        stack_map class java/lang/NoSuchMethodError;
+        astore_1;
+        aload_1;
+        invokevirtual    Method java/lang/NoSuchMethodError.toString:"()Ljava/lang/String;";
+        ldc    String "I2.clone";
+        invokevirtual    Method java/lang/String.contains:"(Ljava/lang/CharSequence;)Z";
+        ifne    L47;
+        new    class java/lang/RuntimeException;
+        dup;
+        ldc    String "Wrong NoSuchMethodError exception thrown";
+        invokespecial    Method java/lang/RuntimeException."<init>":"(Ljava/lang/String;)V";
+        athrow;
+      L47:  stack_frame_type same;
+        return;
+    }
+
+    static InnerClass C=class NoClones$C of class NoClones;
+    static abstract interface InnerClass I2=class NoClones$I2 of class NoClones;
+
+} // end Class NoClones
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/runtime/clone/invokevirtual/DefMethClone.jasm	Thu Dec 21 00:07:38 2017 +0100
@@ -0,0 +1,32 @@
+/*
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+
+interface DefMethClone version 54:0 {
+
+    public Method clone:"()Ljava/lang/Object;" stack 1 locals 1 {
+        ldc String "In DefMethClone\'s clone()";
+        areturn;
+    }
+
+} // end Class DefMethClone
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/runtime/clone/invokevirtual/HasLocalClone.jasm	Thu Dec 21 00:07:38 2017 +0100
@@ -0,0 +1,96 @@
+/*
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+
+/*
+ * @test
+ * @bug 8154587
+ * @summary Check that invokevirtual of clone() finds the clone() method that
+ *          is local to the calling class.
+ * @compile DefMethClone.jasm SuperClass.jasm I1.java HasLocalClone.jasm
+ * @run main/othervm -noverify HasLocalClone
+ */
+
+// The below .jasm code implements the following java code:
+//
+// public class HasLocalClone extends SuperClass implements I1 {
+//
+//     public Object clone() {
+//         return "In HasLocalClone's clone()";
+//     }
+//
+//     static Object test(SuperClass a) { return a.clone(); }
+//
+//     public static void main(String[] args) {
+//         String s = (String)test(new HasLocalClone());
+//         if (!s.equals("In HasLocalCloneC's clone()")) {
+//             throw new RuntimeException("Wrong clone() called: " + s);
+//         }
+//     }
+// }
+
+
+super public class HasLocalClone extends SuperClass implements I1 version 54:0 {
+
+    public Method "<init>":"()V" stack 1 locals 1 {
+        aload_0;
+        invokespecial    Method SuperClass."<init>":"()V";
+        return;
+    }
+
+    public Method clone:"()Ljava/lang/Object;" stack 1 locals 1 {
+        ldc    String "In HasLocalClone\'s clone()";
+        areturn;
+    }
+
+    static Method test:"(LSuperClass;)Ljava/lang/Object;" stack 1 locals 1 {
+        aload_0;
+        invokevirtual    Method SuperClass.clone:"()Ljava/lang/Object;";
+        areturn;
+    }
+
+    public static Method main:"([Ljava/lang/String;)V" stack 3 locals 2 {
+        new    class HasLocalClone;
+        dup;
+        invokespecial    Method "<init>":"()V";
+        invokestatic    Method test:"(LSuperClass;)Ljava/lang/Object;";
+        checkcast    class java/lang/String;
+        astore_1;
+        aload_1;
+        ldc    String "In HasLocalClone\'s clone()";
+        invokevirtual    Method java/lang/String.equals:"(Ljava/lang/Object;)Z";
+        ifne    L37;
+        new    class java/lang/RuntimeException;
+        dup;
+        aload_1;
+        invokedynamic    InvokeDynamic REF_invokeStatic:java/lang/invoke/StringConcatFactory.makeConcatWithConstants:"(Ljava/lang/invoke/MethodHandles$Lookup;Ljava/lang/String;Ljava/lang/invoke/MethodType;Ljava/lang/String;[Ljava/lang/Object;)Ljava/lang/invoke/CallSite;":makeConcatWithConstants:"(Ljava/lang/String;)Ljava/lang/String;" String "Wrong clone() called: ";
+        invokespecial    Method java/lang/RuntimeException."<init>":"(Ljava/lang/String;)V";
+        athrow;
+      L37:    stack_frame_type append;
+        locals_map class java/lang/String;
+        return;
+    }
+
+    public static final InnerClass Lookup=class java/lang/invoke/MethodHandles$Lookup of class java/lang/invoke/MethodHandles;
+
+} // end Class HasLocalClone
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/runtime/clone/invokevirtual/I1.java	Thu Dec 21 00:07:38 2017 +0100
@@ -0,0 +1,25 @@
+/*
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+
+interface I1 extends DefMethClone { }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/runtime/clone/invokevirtual/I1Abstr.java	Thu Dec 21 00:07:38 2017 +0100
@@ -0,0 +1,27 @@
+/*
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+
+interface I1Abstr extends DefMethClone {
+    Object clone();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/runtime/clone/invokevirtual/NoLocalClone.jasm	Thu Dec 21 00:07:38 2017 +0100
@@ -0,0 +1,81 @@
+/*
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+
+/*
+ * @test
+ * @bug 8154587
+ * @summary Check that invokevirtual of clone() calls java.lang.Object.clone()
+ *          even if a superinterface has a default method named clone().
+ * @compile DefMethClone.jasm SuperClass.jasm I1.java NoLocalClone.jasm
+ * @run main/othervm -noverify NoLocalClone
+ */
+
+// The below .jasm code implements the following java code:
+//
+// public class NoLocalClone extends SuperClass implements Cloneable,I1 {
+//
+//     static Object test(SuperClass a) { return a.clone(); }
+//
+//     public static void main(String[] args) {
+//         Object obj = test(new NoLocalClone());
+//         if (!(obj instanceof NoLocalClone)) {
+//             throw new RuntimeException("Wrong clone() called.");
+//         }
+//     }
+// }
+
+super public class NoLocalClone extends SuperClass implements java/lang/Cloneable, I1 version 54:0 {
+
+    public Method "<init>":"()V" stack 1 locals 1 {
+        aload_0;
+        invokespecial    Method SuperClass."<init>":"()V";
+        return;
+    }
+
+    static Method test:"(LSuperClass;)Ljava/lang/Object;" stack 1 locals 1 {
+        aload_0;
+        invokevirtual    Method SuperClass.clone:"()Ljava/lang/Object;";
+        areturn;
+    }
+
+    public static Method main:"([Ljava/lang/String;)V" stack 3 locals 2 {
+        new    class NoLocalClone;
+        dup;
+        invokespecial Method "<init>":"()V";
+        invokestatic Method test:"(LSuperClass;)Ljava/lang/Object;";
+        astore_1;
+        aload_1;
+        instanceof  class NoLocalClone;
+        ifne    L31;
+        new    class java/lang/RuntimeException;
+        dup;
+        ldc    String "Wrong clone() called.";
+        invokespecial Method java/lang/RuntimeException."<init>":"(Ljava/lang/String;)V";
+        athrow;
+      L31:    stack_frame_type append;
+        locals_map class java/lang/Object;
+        return;
+    }
+
+} // end Class NoLocalClone
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/runtime/clone/invokevirtual/NoLocalCloneAbstr.jasm	Thu Dec 21 00:07:38 2017 +0100
@@ -0,0 +1,81 @@
+/*
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+
+/*
+ * @test
+ * @bug 8154587
+ * @summary Check that invokevirtual of clone() calls java.lang.Object.clone()
+ *          even if a superinterface has an abstract method named clone().
+ * @compile DefMethClone.jasm SuperClass.jasm I1Abstr.java NoLocalCloneAbstr.jasm
+ * @run main/othervm -noverify NoLocalCloneAbstr
+ */
+
+// The below .jasm code implements the following java code:
+//
+// public class NoLocalCloneAbstr extends SuperClass implements Cloneable,I1Abstr {
+//
+//     static Object test(SuperClass a) { return a.clone(); }
+//
+//     public static void main(String[] args) {
+//         Object obj = test(new NoLocalCloneAbstr());
+//         if (!(obj instanceof NoLocalCloneAbstr)) {
+//             throw new RuntimeException("Wrong clone() called.");
+//         }
+//     }
+// }
+
+super public class NoLocalCloneAbstr extends SuperClass implements java/lang/Cloneable, I1Abstr version 54:0 {
+
+    public Method "<init>":"()V" stack 1 locals 1 {
+        aload_0;
+        invokespecial    Method SuperClass."<init>":"()V";
+        return;
+    }
+
+    static Method test:"(LSuperClass;)Ljava/lang/Object;" stack 1 locals 1 {
+        aload_0;
+        invokevirtual    Method SuperClass.clone:"()Ljava/lang/Object;";
+        areturn;
+    }
+
+    public static Method main:"([Ljava/lang/String;)V" stack 3 locals 2 {
+        new    class NoLocalCloneAbstr;
+        dup;
+        invokespecial Method "<init>":"()V";
+        invokestatic Method test:"(LSuperClass;)Ljava/lang/Object;";
+        astore_1;
+        aload_1;
+        instanceof  class NoLocalCloneAbstr;
+        ifne    L31;
+        new    class java/lang/RuntimeException;
+        dup;
+        ldc    String "Wrong clone() called.";
+        invokespecial Method java/lang/RuntimeException."<init>":"(Ljava/lang/String;)V";
+        athrow;
+      L31:    stack_frame_type append;
+        locals_map class java/lang/Object;
+        return;
+    }
+
+} // end Class NoLocalCloneAbstr
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/runtime/clone/invokevirtual/SuperClass.jasm	Thu Dec 21 00:07:38 2017 +0100
@@ -0,0 +1,33 @@
+/*
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+
+super public class SuperClass implements DefMethClone version 54:0 {
+
+    public Method "<init>":"()V" stack 1 locals 1 {
+        aload_0;
+        invokespecial   Method java/lang/Object."<init>":"()V";
+        return;
+    }
+
+} // end Class SuperClass
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/runtime/jni/checked/TestCheckedEnsureLocalCapacity.java	Thu Dec 21 00:07:38 2017 +0100
@@ -0,0 +1,85 @@
+/*
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/* @test
+ * @bug 8193222
+ * @summary Check EnsureLocalCapacity doesn't shrink unexpectedly
+ * @library /test/lib
+ * @run main/othervm/native TestCheckedEnsureLocalCapacity launch
+ */
+import jdk.test.lib.process.ProcessTools;
+import jdk.test.lib.process.OutputAnalyzer;
+
+public class TestCheckedEnsureLocalCapacity {
+
+    static {
+        System.loadLibrary("TestCheckedEnsureLocalCapacity");
+    }
+
+    // Calls EnsureLocalCapacity(capacity) and then creates "copies" number
+    // of LocalRefs to "o".
+    // If capacity > copies no warning should ensue (with the bug fixed).
+    // If copies > capacity + warning-threshold then we still get a warning.
+    private static native void ensureCapacity(Object o, int capacity, int copies);
+
+    private static int[][] testArgs = {
+        { 60, 45 }, // good: capacity > copies
+        { 1, 45 }   // bad: copies >> capacity
+    };
+
+    private static final String EXCEED_WARNING =
+        "^WARNING: JNI local refs: \\d++, exceeds capacity:";
+
+    private static final String WARNING = "^WARNING: ";
+
+    public static void main(String[] args) throws Throwable {
+        if (args.length == 2) {
+            ensureCapacity(new Object(),
+                           Integer.parseInt(args[0]),
+                           Integer.parseInt(args[1]));
+            return;
+        }
+
+        // No warning
+        ProcessTools.executeTestJvm("-Xcheck:jni",
+                                    "TestCheckedEnsureLocalCapacity",
+                                    Integer.toString(testArgs[0][0]),
+                                    Integer.toString(testArgs[0][1])).
+            shouldHaveExitValue(0).
+            // check no capacity warning
+            stdoutShouldNotMatch(EXCEED_WARNING).
+            // check no other warning
+            stdoutShouldNotMatch(WARNING).
+            reportDiagnosticSummary();
+
+        // Warning
+        ProcessTools.executeTestJvm("-Xcheck:jni",
+                                    "TestCheckedEnsureLocalCapacity",
+                                    Integer.toString(testArgs[1][0]),
+                                    Integer.toString(testArgs[1][1])).
+            shouldHaveExitValue(0).
+            // check for capacity warning
+            stdoutShouldMatch(EXCEED_WARNING).
+            reportDiagnosticSummary();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/runtime/jni/checked/libTestCheckedEnsureLocalCapacity.c	Thu Dec 21 00:07:38 2017 +0100
@@ -0,0 +1,49 @@
+/*
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+#include <jni.h>
+#include <stdio.h>
+
+void reduceLocalCapacity(JNIEnv* env) {
+    puts("reduceLocalCapacity: setting to 1");
+    (*env)->EnsureLocalCapacity(env,1);
+}
+
+JNIEXPORT void JNICALL
+Java_TestCheckedEnsureLocalCapacity_ensureCapacity(JNIEnv *env,
+                                                   jobject unused,
+                                                   jobject target,
+                                                   jint capacity,
+                                                   jint copies) {
+  int i;
+  printf("ensureCapacity: setting to %d\n", capacity);
+  (*env)->EnsureLocalCapacity(env, capacity); // set high
+  reduceLocalCapacity(env);     // sets low
+
+  printf("ensureCapacity: creating %d LocalRefs\n", copies);
+  for (i = 0; i < copies; i++) {
+    target = (*env)->NewLocalRef(env, target);
+  }
+
+  puts("ensureCapacity: done");
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/runtime/os/TestUseCpuAllocPath.java	Thu Dec 21 00:07:38 2017 +0100
@@ -0,0 +1,53 @@
+/*
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import jdk.test.lib.process.ProcessTools;
+import jdk.test.lib.process.OutputAnalyzer;
+
+/**
+ * @test
+ * @summary If #processors > 1024 os_linux.cpp uses special coding.
+ *   Excercise this by forcing usage of this coding. If this fails, this
+ *   VM was either compiled on a platform which does not define CPU_ALLOC,
+ *   or it is executed on a platform that does not support it.
+ * @requires os.family == "linux"
+ * @modules java.base/jdk.internal.misc
+ * @library /test/lib
+ * @run driver TestUseCpuAllocPath
+ */
+public class TestUseCpuAllocPath {
+
+    static final String SUCCESS_STRING = "active_processor_count: using dynamic path (forced)";
+
+    public static void main(String[] args) throws Exception {
+        ProcessBuilder pb =
+            ProcessTools.createJavaProcessBuilder(false,
+                                                  "-Xlog:os=trace",
+                                                  "-XX:+UnlockDiagnosticVMOptions",
+                                                  "-XX:+UseCpuAllocPath",
+                                                  "-version");
+
+        OutputAnalyzer output = new OutputAnalyzer(pb.start());
+        output.shouldContain(SUCCESS_STRING);
+    }
+}
--- a/test/hotspot/jtreg/serviceability/jvmti/GetOwnedMonitorInfo/libGetOwnedMonitorInfoTest.c	Wed Dec 20 09:14:52 2017 -0800
+++ b/test/hotspot/jtreg/serviceability/jvmti/GetOwnedMonitorInfo/libGetOwnedMonitorInfoTest.c	Thu Dec 21 00:07:38 2017 +0100
@@ -49,6 +49,7 @@
 
 static volatile jboolean event_has_posted = JNI_FALSE;
 static volatile jint status = PASSED;
+static volatile jclass testClass = NULL;
 
 static jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved);
 
@@ -66,16 +67,10 @@
 }
 
 static jboolean CheckLockObject(JNIEnv *env, jobject monitor) {
-    jclass testClass;
-
-    testClass = (*env)->FindClass(env, TEST_CLASS);
     if (testClass == NULL) {
-        fprintf(stderr, "MonitorContendedEnter: " TEST_CLASS " not found\n");
-        status = FAILED;
-        event_has_posted = JNI_TRUE;
+        // JNI_OnLoad has not been called yet, so can't possibly be an instance of TEST_CLASS.
         return JNI_FALSE;
     }
-
     return (*env)->IsInstanceOf(env, monitor, testClass);
 }
 
@@ -171,7 +166,26 @@
 
 JNIEXPORT jint JNICALL
 JNI_OnLoad(JavaVM *jvm, void *reserved) {
-    return JNI_VERSION_1_8;
+    jint res;
+    JNIEnv *env;
+
+    res = JNI_ENV_PTR(jvm)->GetEnv(JNI_ENV_ARG(jvm, (void **) &env),
+                                   JNI_VERSION_9);
+    if (res != JNI_OK || env == NULL) {
+        fprintf(stderr, "Error: GetEnv call failed(%d)!\n", res);
+        return JNI_ERR;
+    }
+
+    testClass = (*env)->FindClass(env, TEST_CLASS);
+    if (testClass != NULL) {
+      testClass = (*env)->NewGlobalRef(env, testClass);
+    }
+    if (testClass == NULL) {
+        fprintf(stderr, "Error: Could not load class %s!\n", TEST_CLASS);
+        return JNI_ERR;
+    }
+
+    return JNI_VERSION_9;
 }
 
 static
@@ -185,7 +199,7 @@
     printf("Agent_OnLoad started\n");
 
     res = JNI_ENV_PTR(jvm)->GetEnv(JNI_ENV_ARG(jvm, (void **) &jvmti),
-                                   JVMTI_VERSION_1);
+                                   JVMTI_VERSION_9);
     if (res != JNI_OK || jvmti == NULL) {
         fprintf(stderr, "Error: wrong result of a valid call to GetEnv!\n");
         return JNI_ERR;
@@ -221,6 +235,7 @@
         return JNI_ERR;
     }
 
+    memset(&callbacks, 0, sizeof(callbacks));
     callbacks.MonitorContendedEnter   = &MonitorContendedEnter;
     callbacks.MonitorContendedEntered = &MonitorContendedEntered;
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/serviceability/sa/ClhsdbFindPC.java	Thu Dec 21 00:07:38 2017 +0100
@@ -0,0 +1,108 @@
+/*
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.ArrayList;
+
+import jdk.test.lib.apps.LingeredApp;
+
+/*
+ * @test
+ * @bug 8193124
+ * @summary Test the clhsdb 'findpc' command
+ * @library /test/lib
+ * @run main/othervm ClhsdbFindPC
+ */
+
+public class ClhsdbFindPC {
+
+    private static void testFindPC(boolean withXcomp) throws Exception {
+        LingeredApp theApp = null;
+        try {
+            ClhsdbLauncher test = new ClhsdbLauncher();
+            theApp = withXcomp ? LingeredApp.startApp(List.of("-Xcomp"))
+                               : LingeredApp.startApp(List.of("-Xint"));
+            System.out.print("Started LingeredApp ");
+            if (withXcomp) {
+                System.out.print("(-Xcomp) ");
+            } else {
+                System.out.print("(-Xint) ");
+            }
+            System.out.println("with pid " + theApp.getPid());
+
+            // Run 'jstack -v' command to get the pc
+            List<String> cmds = List.of("jstack -v");
+            String output = test.run(theApp.getPid(), cmds, null, null);
+
+            // Test the 'findpc' command passing in the pc obtained from
+            // the 'jstack -v' command
+            cmds = new ArrayList<String>();
+
+            // Output could be null if the test was skipped due to
+            // attach permission issues.
+            if (output != null) {
+                String cmdStr = null;
+                String[] parts = output.split("LingeredApp.main");
+                String[] tokens = parts[1].split(" ");
+                for (String token : tokens) {
+                    if (token.contains("pc")) {
+                        String[] address = token.split("=");
+                        // address[1] represents the address of the Method
+                        cmdStr = "findpc " + address[1].replace(",","");
+                        cmds.add(cmdStr);
+                        break;
+                    }
+                }
+
+                Map<String, List<String>> expStrMap = new HashMap<>();
+                if (withXcomp) {
+                    expStrMap.put(cmdStr, List.of(
+                            "In code in NMethod for jdk/test/lib/apps/LingeredApp.main",
+                            "content:",
+                            "oops:",
+                            "frame size:"));
+                } else {
+                    expStrMap.put(cmdStr, List.of(
+                            "In interpreter codelet",
+                            "invoke return entry points"));
+                }
+
+                test.run(theApp.getPid(), cmds, expStrMap, null);
+            }
+        } catch (Exception ex) {
+            throw new RuntimeException("Test ERROR " + ex, ex);
+        } finally {
+            LingeredApp.stopApp(theApp);
+        }
+    }
+
+    public static void main(String[] args) throws Exception {
+        System.out.println("Starting the ClhsdbFindPC test");
+        testFindPC(true);
+        testFindPC(false);
+        System.out.println("Test PASSED");
+    }
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/serviceability/sa/ClhsdbInspect.java	Thu Dec 21 00:07:38 2017 +0100
@@ -0,0 +1,98 @@
+/*
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.ArrayList;
+import jdk.test.lib.apps.LingeredApp;
+
+/*
+ * @test
+ * @bug 8192985
+ * @summary Test the clhsdb 'inspect' command
+ * @library /test/lib
+ * @run main/othervm ClhsdbInspect
+ */
+
+public class ClhsdbInspect {
+
+    public static void main(String[] args) throws Exception {
+        System.out.println("Starting the ClhsdbInspect test");
+
+        LingeredAppWithLock theApp = null;
+        try {
+            ClhsdbLauncher test = new ClhsdbLauncher();
+
+            theApp = new LingeredAppWithLock();
+            LingeredApp.startApp(null, theApp);
+            System.out.println("Started LingeredApp with pid " + theApp.getPid());
+
+            // Run the 'jstack -v' command to get the address of a Method*
+            // and the oop address of a java.lang.ref.ReferenceQueue$Lock
+            // object
+            List<String> cmds = List.of("jstack -v");
+
+            String jstackOutput = test.run(theApp.getPid(), cmds, null, null);
+
+            if (jstackOutput == null) {
+                // Output could be null due to attach permission issues
+                // and if we are skipping this.
+                LingeredApp.stopApp(theApp);
+                return;
+            }
+
+            String addressString = null;
+            Map<String, String> tokensMap = new HashMap<>();
+            tokensMap.put("waiting to lock",
+                          "instance of Oop for java/lang/Class");
+            tokensMap.put("Method\\*=", "Type is Method");
+            tokensMap.put("waiting to re-lock in wait",
+                          "instance of Oop for java/lang/ref/ReferenceQueue$Lock");
+
+            for (String key: tokensMap.keySet()) {
+                cmds = new ArrayList<String>();
+                Map<String, List<String>> expStrMap = new HashMap<>();
+
+                String[] snippets = jstackOutput.split(key);
+                String[] tokens = snippets[1].split(" ");
+                for (String token: tokens) {
+                    if (token.contains("0x")) {
+                        addressString = token.replace("<", "").replace(">", "");
+                        break;
+                    }
+                }
+
+                String cmd = "inspect " + addressString;
+                cmds.add(cmd);
+                expStrMap.put(cmd, List.of(tokensMap.get(key)));
+                test.run(theApp.getPid(), cmds, expStrMap, null);
+            }
+        } catch (Exception ex) {
+            throw new RuntimeException("Test ERROR " + ex, ex);
+        } finally {
+            LingeredApp.stopApp(theApp);
+        }
+        System.out.println("Test PASSED");
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/serviceability/sa/ClhsdbJdis.java	Thu Dec 21 00:07:38 2017 +0100
@@ -0,0 +1,95 @@
+/*
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.ArrayList;
+
+import jdk.test.lib.apps.LingeredApp;
+
+/*
+ * @test
+ * @bug 8193124
+ * @summary Test the clhsdb 'jdis' command
+ * @library /test/lib
+ * @run main/othervm ClhsdbJdis
+ */
+
+public class ClhsdbJdis {
+
+    public static void main(String[] args) throws Exception {
+        LingeredApp theApp = null;
+        System.out.println("Starting the ClhsdbJdis test");
+
+        try {
+            ClhsdbLauncher test = new ClhsdbLauncher();
+            theApp = LingeredApp.startApp();
+            System.out.println("Started LingeredApp with pid " + theApp.getPid());
+
+            // Run 'jstack -v' command to get the Method Address
+            List<String> cmds = List.of("jstack -v");
+            String output = test.run(theApp.getPid(), cmds, null, null);
+
+            // Test the 'jdis' command passing in the address obtained from
+            // the 'jstack -v' command
+            cmds = new ArrayList<String>();
+
+            // Output could be null if the test was skipped due to
+            // attach permission issues.
+            if (output != null) {
+                String cmdStr = null;
+                String[] parts = output.split("LingeredApp.main");
+                String[] tokens = parts[1].split(" ");
+                for (String token : tokens) {
+                    if (token.contains("Method")) {
+                        String[] address = token.split("=");
+                        // address[1] represents the address of the Method
+                        cmdStr = "jdis " + address[1];
+                        cmds.add(cmdStr);
+                        break;
+                    }
+                }
+
+                Map<String, List<String>> expStrMap = new HashMap<>();
+                expStrMap.put(cmdStr, List.of(
+                        "public static void main(java.lang.String[])",
+                        "Holder Class",
+                        "public class jdk.test.lib.apps.LingeredApp @",
+                        "Bytecode",
+                        "line bci   bytecode",
+                        "Exception Table",
+                        "start bci end bci handler bci catch type",
+                        "Constant Pool of [public class jdk.test.lib.apps.LingeredApp @"));
+
+                test.run(theApp.getPid(), cmds, expStrMap, null);
+            }
+        } catch (Exception ex) {
+            throw new RuntimeException("Test ERROR " + ex, ex);
+        } finally {
+            LingeredApp.stopApp(theApp);
+        }
+        System.out.println("Test PASSED");
+    }
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/serviceability/sa/ClhsdbPrintAs.java	Thu Dec 21 00:07:38 2017 +0100
@@ -0,0 +1,127 @@
+/*
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.ArrayList;
+import jdk.test.lib.apps.LingeredApp;
+
+/*
+ * @test
+ * @bug 8192985
+ * @summary Test the clhsdb 'printas' command
+ * @library /test/lib
+ * @run main/othervm ClhsdbPrintAs
+ */
+
+public class ClhsdbPrintAs {
+
+    public static void main(String[] args) throws Exception {
+        System.out.println("Starting the ClhsdbPrintAs test");
+
+        LingeredApp theApp = null;
+        try {
+            ClhsdbLauncher test = new ClhsdbLauncher();
+            theApp = LingeredApp.startApp();
+            System.out.println("Started LingeredApp with pid " + theApp.getPid());
+
+            // Run the 'jstack -v' command to get the address of a the Method*
+            // representing LingeredApp.main
+            List<String> cmds = List.of("jstack -v");
+            Map<String, List<String>> expStrMap;
+
+            String jstackOutput = test.run(theApp.getPid(), cmds, null, null);
+
+            if (jstackOutput == null) {
+                // Output could be null due to attach permission issues
+                // and if we are skipping this.
+                LingeredApp.stopApp(theApp);
+                return;
+            }
+
+            String[] snippets = jstackOutput.split("LingeredApp.main");
+            String addressString = null;
+
+            String[] tokens = snippets[1].split("Method\\*=");
+            String[] words = tokens[1].split(" ");
+            addressString = words[0];
+
+            cmds = new ArrayList<String>();
+            expStrMap = new HashMap<>();
+
+            String cmd = "printas Method " + addressString;
+            cmds.add(cmd);
+            expStrMap.put(cmd, List.of
+                ("ConstMethod", "MethodCounters", "Method::_access_flags"));
+
+            // Run the printas Method <addr> command to obtain the address
+            // of ConstMethod*
+            String methodDetailsOutput = test.run(theApp.getPid(), cmds, expStrMap, null);
+            snippets = methodDetailsOutput.split("ConstMethod*");
+
+            tokens = snippets[1].split(" ");
+            for (String token : tokens) {
+                if (token.contains("0x")) {
+                    addressString = token.replace("\n", "");
+                    break;
+                }
+            }
+
+            cmds = new ArrayList<String>();
+            expStrMap = new HashMap<>();
+
+            cmd = "printas ConstMethod " + addressString;
+            cmds.add(cmd);
+            expStrMap.put(cmd, List.of
+                ("ConstantPool", "_max_locals", "_flags"));
+
+            // Run the printas constMethod <addr> command to obtain the address
+            // of ConstantPool*
+            String constMethodDetailsOutput = test.run(theApp.getPid(), cmds, expStrMap, null);
+            snippets = constMethodDetailsOutput.split("ConstantPool*");
+
+            tokens = snippets[1].split(" ");
+            for (String token : tokens) {
+                if (token.contains("0x")) {
+                    addressString = token.replace("\n", "");
+                    break;
+                }
+            }
+
+            cmds = new ArrayList<String>();
+            expStrMap = new HashMap<>();
+
+            cmd = "printas ConstantPool " + addressString;
+            cmds.add(cmd);
+            expStrMap.put(cmd, List.of
+                ("ConstantPoolCache", "_pool_holder", "InstanceKlass*"));
+            test.run(theApp.getPid(), cmds, expStrMap, null);
+        } catch (Exception ex) {
+            throw new RuntimeException("Test ERROR " + ex, ex);
+        } finally {
+            LingeredApp.stopApp(theApp);
+        }
+        System.out.println("Test PASSED");
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/serviceability/sa/ClhsdbScanOops.java	Thu Dec 21 00:07:38 2017 +0100
@@ -0,0 +1,116 @@
+/*
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.ArrayList;
+import jdk.test.lib.Utils;
+import jdk.test.lib.apps.LingeredApp;
+
+/*
+ * @test
+ * @bug 8192985
+ * @summary Test the clhsdb 'scanoops' command
+ * @library /test/lib
+ * @run main/othervm/timeout=1200 ClhsdbScanOops
+ */
+
+public class ClhsdbScanOops {
+
+    private static void testWithGcType(String gc) throws Exception {
+
+        LingeredApp theApp = null;
+
+        try {
+            ClhsdbLauncher test = new ClhsdbLauncher();
+            List<String> vmArgs = new ArrayList<String>();
+            vmArgs.add(gc);
+            theApp = LingeredApp.startApp(vmArgs);
+
+            System.out.println ("Started LingeredApp with the GC option " + gc +
+                                " and pid " + theApp.getPid());
+
+            // Run the 'universe' command to get the address ranges
+            List<String> cmds = List.of("universe");
+
+            String universeOutput = test.run(theApp.getPid(), cmds, null, null);
+
+            if (universeOutput == null) {
+                // Output could be null due to attach permission issues
+                // and if we are skipping this.
+                LingeredApp.stopApp(theApp);
+                return;
+            }
+
+            cmds = new ArrayList<String>();
+            Map<String, List<String>> expStrMap = new HashMap<>();
+            Map<String, List<String>> unExpStrMap = new HashMap<>();
+
+            String startAddress = null;
+            String endAddress = null;
+            String[] snippets = null;
+
+            if (gc.contains("UseParallelGC")) {
+                snippets = universeOutput.split("eden =  ");
+            } else {
+                snippets = universeOutput.split("eden \\[");
+            }
+            String[] words = snippets[1].split(",");
+            // Get the addresses from Eden
+            startAddress = words[0].replace("[", "");
+            endAddress = words[1];
+            String cmd = "scanoops " + startAddress + " " + endAddress;
+            cmds.add(cmd);
+
+            expStrMap.put(cmd, List.of
+                ("java/lang/Object", "java/lang/Class", "java/lang/Thread",
+                 "java/lang/String", "[B", "[I"));
+
+            // Test the 'type' option also
+            // scanoops <start addr> <end addr> java/lang/String
+            // Ensure that only the java/lang/String oops are printed.
+            cmd = cmd + " java/lang/String";
+            cmds.add(cmd);
+            expStrMap.put(cmd, List.of("java/lang/String"));
+            unExpStrMap.put(cmd, List.of("java/lang/Thread"));
+
+            test.run(theApp.getPid(), cmds, expStrMap, unExpStrMap);
+        } catch (Exception ex) {
+            throw new RuntimeException("Test ERROR " + ex, ex);
+        } finally {
+            LingeredApp.stopApp(theApp);
+        }
+    }
+
+    public static void main(String[] args) throws Exception {
+        System.out.println("Starting the ClhsdbScanOops test");
+        try {
+            testWithGcType("-XX:+UseParallelGC");
+            testWithGcType("-XX:+UseSerialGC");
+        } catch (Exception e) {
+            throw new Error("Test failed with " + e);
+        }
+        System.out.println("Test PASSED");
+    }
+}
--- a/test/jdk/TEST.ROOT	Wed Dec 20 09:14:52 2017 -0800
+++ b/test/jdk/TEST.ROOT	Thu Dec 21 00:07:38 2017 +0100
@@ -36,6 +36,7 @@
 requires.properties= \
     sun.arch.data.model \
     java.runtime.name \
+    vm.graal.enabled \
     vm.cds
 
 # Minimum jtreg version
--- a/test/jdk/com/sun/tools/attach/modules/Driver.java	Wed Dec 20 09:14:52 2017 -0800
+++ b/test/jdk/com/sun/tools/attach/modules/Driver.java	Thu Dec 21 00:07:38 2017 +0100
@@ -23,6 +23,7 @@
 
 /**
  * @test
+ * @requires !vm.graal.enabled
  * @modules jdk.attach
  * @build m/* Agent
  * @run main/othervm -Djdk.attach.allowAttachSelf m/p.Main jmx javaagent
--- a/test/jdk/java/lang/String/concat/WithSecurityManager.java	Wed Dec 20 09:14:52 2017 -0800
+++ b/test/jdk/java/lang/String/concat/WithSecurityManager.java	Thu Dec 21 00:07:38 2017 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -27,6 +27,7 @@
  * @test
  * @summary String concatenation fails with a custom SecurityManager that uses concatenation
  * @bug 8155090 8158851
+ * @requires !vm.graal.enabled
  *
  * @compile WithSecurityManager.java
  *
--- a/test/jdk/java/lang/System/LoggerFinder/LoggerFinderAPI/LoggerFinderAPI.java	Wed Dec 20 09:14:52 2017 -0800
+++ b/test/jdk/java/lang/System/LoggerFinder/LoggerFinderAPI/LoggerFinderAPI.java	Thu Dec 21 00:07:38 2017 +0100
@@ -46,6 +46,7 @@
  *          throwing NullPointerException. The test uses --limit-module
  *          to force the selection of one or the other.
  * @author danielfuchs
+ * @requires !vm.graal.enabled
  * @build LoggerFinderAPI
  * @run main/othervm --limit-modules java.base,java.logging
  *          -Djava.util.logging.SimpleFormatter.format=LOG-%4$s:-[%2$s]-%5$s%6$s%n
--- a/test/jdk/java/lang/instrument/TestAgentWithLimitMods.java	Wed Dec 20 09:14:52 2017 -0800
+++ b/test/jdk/java/lang/instrument/TestAgentWithLimitMods.java	Thu Dec 21 00:07:38 2017 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -24,6 +24,7 @@
 /**
  *
  * @test
+ * @requires !vm.graal.enabled
  * @summary Tests that the -javaagent option adds the java.instrument into
  * the module graph
  *
--- a/test/jdk/java/lang/management/ManagementFactory/DefaultManagementProviderTest.java	Wed Dec 20 09:14:52 2017 -0800
+++ b/test/jdk/java/lang/management/ManagementFactory/DefaultManagementProviderTest.java	Thu Dec 21 00:07:38 2017 +0100
@@ -26,6 +26,7 @@
  * @bug 8151099
  * @summary Verify platform MXBeans initialized properly with java.management
  *          module only. No other management provider
+ * @requires !vm.graal.enabled
  * @modules java.management
  * @run main/othervm --limit-modules=java.management DefaultManagementProviderTest
  */
--- a/test/jdk/java/net/SocketOption/OptionsTest.java	Wed Dec 20 09:14:52 2017 -0800
+++ b/test/jdk/java/net/SocketOption/OptionsTest.java	Thu Dec 21 00:07:38 2017 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -24,6 +24,7 @@
 /*
  * @test
  * @bug 8036979 8072384 8044773
+ * @requires !vm.graal.enabled
  * @run main/othervm -Xcheck:jni OptionsTest
  * @run main/othervm -Xcheck:jni -Djava.net.preferIPv4Stack=true OptionsTest
  * @run main/othervm --limit-modules=java.base OptionsTest
--- a/test/jdk/java/net/SocketOption/UnsupportedOptionsTest.java	Wed Dec 20 09:14:52 2017 -0800
+++ b/test/jdk/java/net/SocketOption/UnsupportedOptionsTest.java	Thu Dec 21 00:07:38 2017 +0100
@@ -32,6 +32,7 @@
  * @bug 8143554 8044773
  * @summary Test checks that UnsupportedOperationException for unsupported
  * SOCKET_OPTIONS is thrown by both getOption() and setOption() methods.
+ * @requires !vm.graal.enabled
  * @run main UnsupportedOptionsTest
  * @run main/othervm --limit-modules=java.base UnsupportedOptionsTest
  */
--- a/test/jdk/java/nio/channels/DatagramChannel/SocketOptionTests.java	Wed Dec 20 09:14:52 2017 -0800
+++ b/test/jdk/java/nio/channels/DatagramChannel/SocketOptionTests.java	Thu Dec 21 00:07:38 2017 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2007, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -24,6 +24,7 @@
 /* @test
  * @bug 4640544 8044773
  * @summary Unit test for setOption/getOption/options methods
+ * @requires !vm.graal.enabled
  * @run main SocketOptionTests
  * @run main/othervm --limit-modules=java.base SocketOptionTests
  */
--- a/test/jdk/java/nio/channels/ServerSocketChannel/SocketOptionTests.java	Wed Dec 20 09:14:52 2017 -0800
+++ b/test/jdk/java/nio/channels/ServerSocketChannel/SocketOptionTests.java	Thu Dec 21 00:07:38 2017 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2007, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -25,6 +25,7 @@
  * @bug 4640544 8044773
  * @summary Unit test for ServerSocketChannel setOption/getOption/options
  *          methods.
+ * @requires !vm.graal.enabled
  * @run main SocketOptionTests
  * @run main/othervm --limit-modules=java.base SocketOptionTests
  */
--- a/test/jdk/java/nio/channels/SocketChannel/SocketOptionTests.java	Wed Dec 20 09:14:52 2017 -0800
+++ b/test/jdk/java/nio/channels/SocketChannel/SocketOptionTests.java	Thu Dec 21 00:07:38 2017 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2007, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -25,6 +25,7 @@
  * @bug 4640544 8044773
  * @summary Unit test to check SocketChannel setOption/getOption/options
  *          methods.
+ * @requires !vm.graal.enabled
  * @run main SocketOptionTests
  * @run main/othervm --limit-modules=java.base SocketOptionTests
  */
--- a/test/jdk/tools/launcher/modules/limitmods/LimitModsTest.java	Wed Dec 20 09:14:52 2017 -0800
+++ b/test/jdk/tools/launcher/modules/limitmods/LimitModsTest.java	Thu Dec 21 00:07:38 2017 +0100
@@ -23,6 +23,7 @@
 
 /**
  * @test
+ * @requires !vm.graal.enabled
  * @library /lib/testlibrary /test/lib
  * @modules java.desktop java.logging jdk.compiler
  * @build LimitModsTest jdk.test.lib.compiler.CompilerUtils jdk.testlibrary.*
--- a/test/jdk/tools/launcher/modules/listmods/ListModsTest.java	Wed Dec 20 09:14:52 2017 -0800
+++ b/test/jdk/tools/launcher/modules/listmods/ListModsTest.java	Thu Dec 21 00:07:38 2017 +0100
@@ -23,6 +23,7 @@
 
 /**
  * @test
+ * @requires !vm.graal.enabled
  * @library /lib/testlibrary /test/lib
  * @modules java.se
  * @build ListModsTest jdk.test.lib.compiler.CompilerUtils jdk.testlibrary.*
--- a/test/jdk/tools/launcher/modules/showmoduleresolution/ShowModuleResolutionTest.java	Wed Dec 20 09:14:52 2017 -0800
+++ b/test/jdk/tools/launcher/modules/showmoduleresolution/ShowModuleResolutionTest.java	Thu Dec 21 00:07:38 2017 +0100
@@ -23,6 +23,7 @@
 
 /**
  * @test
+ * @requires !vm.graal.enabled
  * @modules jdk.jdeps jdk.zipfs
  * @library /lib/testlibrary
  * @build ShowModuleResolutionTest jdk.testlibrary.*