merge default -> JEP-230 JEP-230-microbenchmarks-branch
authorredestad
Thu, 04 Oct 2018 16:01:19 +0200
branchJEP-230-microbenchmarks-branch
changeset 56925 6dd05d35378e
parent 56922 4219852032ba (current diff)
parent 52013 92383597fa21 (diff)
child 56926 d86dd5847e6d
merge default -> JEP-230
--- a/.hgtags	Wed Oct 03 16:07:40 2018 +0200
+++ b/.hgtags	Thu Oct 04 16:01:19 2018 +0200
@@ -514,3 +514,6 @@
 f0f5d23449d31f1b3580c8a73313918cafeaefd7 jdk-12+11
 15094d12a632f452a2064318a4e416d0c7a9ce0c jdk-12+12
 511a9946f83e3e3c7b9dbe1840367063fb39b4e1 jdk-12+13
+8897e41b327c0a5601c6ba2bba5d07f15a3ffc91 jdk-12+14
+8897e41b327c0a5601c6ba2bba5d07f15a3ffc91 jdk-12+14
+6f04692c7d5137ee34a6bd94c0c8a6c9219cb127 jdk-12+14
--- a/src/hotspot/cpu/x86/macroAssembler_x86.cpp	Wed Oct 03 16:07:40 2018 +0200
+++ b/src/hotspot/cpu/x86/macroAssembler_x86.cpp	Thu Oct 04 16:01:19 2018 +0200
@@ -3242,8 +3242,9 @@
   }
 }
 
+#ifdef COMPILER2
 void MacroAssembler::setvectmask(Register dst, Register src) {
-  guarantee(PostLoopMultiversioning == true, "must be");
+  guarantee(PostLoopMultiversioning, "must be");
   Assembler::movl(dst, 1);
   Assembler::shlxl(dst, dst, src);
   Assembler::decl(dst);
@@ -3252,9 +3253,10 @@
 }
 
 void MacroAssembler::restorevectmask() {
-  guarantee(PostLoopMultiversioning == true, "must be");
+  guarantee(PostLoopMultiversioning, "must be");
   Assembler::knotwl(k1, k0);
 }
+#endif // COMPILER2
 
 void MacroAssembler::movdbl(XMMRegister dst, AddressLiteral src) {
   if (reachable(src)) {
@@ -5004,12 +5006,15 @@
   // Clear upper bits of YMM registers to avoid SSE <-> AVX transition penalty.
   vzeroupper();
   // Reset k1 to 0xffff.
+
+#ifdef COMPILER2
   if (PostLoopMultiversioning && VM_Version::supports_evex()) {
     push(rcx);
     movl(rcx, 0xffff);
     kmovwl(k1, rcx);
     pop(rcx);
   }
+#endif // COMPILER2
 
 #ifndef _LP64
   // Either restore the x87 floating pointer control word after returning
--- a/src/hotspot/cpu/x86/macroAssembler_x86.hpp	Wed Oct 03 16:07:40 2018 +0200
+++ b/src/hotspot/cpu/x86/macroAssembler_x86.hpp	Thu Oct 04 16:01:19 2018 +0200
@@ -156,9 +156,11 @@
   void incrementq(Register reg, int value = 1);
   void incrementq(Address dst, int value = 1);
 
+#ifdef COMPILER2
   // special instructions for EVEX
   void setvectmask(Register dst, Register src);
   void restorevectmask();
+#endif
 
   // Support optimal SSE move instructions.
   void movflt(XMMRegister dst, XMMRegister src) {
--- a/src/hotspot/cpu/x86/vm_version_x86.hpp	Wed Oct 03 16:07:40 2018 +0200
+++ b/src/hotspot/cpu/x86/vm_version_x86.hpp	Thu Oct 04 16:01:19 2018 +0200
@@ -608,10 +608,10 @@
 
   static bool os_supports_avx_vectors() {
     bool retVal = false;
+    int nreg = 2 LP64_ONLY(+2);
     if (supports_evex()) {
       // Verify that OS save/restore all bits of EVEX registers
       // during signal processing.
-      int nreg = 2 LP64_ONLY(+2);
       retVal = true;
       for (int i = 0; i < 16 * nreg; i++) { // 64 bytes per zmm register
         if (_cpuid_info.zmm_save[i] != ymm_test_value()) {
@@ -622,7 +622,6 @@
     } else if (supports_avx()) {
       // Verify that OS save/restore all bits of AVX registers
       // during signal processing.
-      int nreg = 2 LP64_ONLY(+2);
       retVal = true;
       for (int i = 0; i < 8 * nreg; i++) { // 32 bytes per ymm register
         if (_cpuid_info.ymm_save[i] != ymm_test_value()) {
@@ -634,7 +633,6 @@
       if (retVal == false) {
         // Verify that OS save/restore all bits of EVEX registers
         // during signal processing.
-        int nreg = 2 LP64_ONLY(+2);
         retVal = true;
         for (int i = 0; i < 16 * nreg; i++) { // 64 bytes per zmm register
           if (_cpuid_info.zmm_save[i] != ymm_test_value()) {
--- a/src/hotspot/share/gc/cms/jvmFlagConstraintsCMS.cpp	Wed Oct 03 16:07:40 2018 +0200
+++ b/src/hotspot/share/gc/cms/jvmFlagConstraintsCMS.cpp	Thu Oct 04 16:01:19 2018 +0200
@@ -136,7 +136,6 @@
       return JVMFlag::VIOLATES_CONSTRAINT;
     }
   }
-
   return JVMFlag::SUCCESS;
 }
 
@@ -151,12 +150,11 @@
     if (value % HeapWordSize != 0) {
       JVMFlag::printError(verbose,
                           "CMSRescanMultiple (" SIZE_FORMAT ") must be "
-                          "a multiple of " SIZE_FORMAT "\n",
+                          "a multiple of %d\n",
                           value, HeapWordSize);
       status = JVMFlag::VIOLATES_CONSTRAINT;
     }
   }
-
   return status;
 }
 
--- a/src/hotspot/share/gc/g1/g1CollectedHeap.cpp	Wed Oct 03 16:07:40 2018 +0200
+++ b/src/hotspot/share/gc/g1/g1CollectedHeap.cpp	Thu Oct 04 16:01:19 2018 +0200
@@ -1049,6 +1049,9 @@
   // Rebuild the strong code root lists for each region
   rebuild_strong_code_roots();
 
+  // Purge code root memory
+  purge_code_root_memory();
+
   // Start a new incremental collection set for the next pause
   start_new_collection_set();
 
--- a/src/hotspot/share/runtime/arguments.cpp	Wed Oct 03 16:07:40 2018 +0200
+++ b/src/hotspot/share/runtime/arguments.cpp	Thu Oct 04 16:01:19 2018 +0200
@@ -526,7 +526,6 @@
   // --- Non-alias flags - sorted by obsolete_in then expired_in:
   { "MaxGCMinorPauseMillis",        JDK_Version::jdk(8), JDK_Version::undefined(), JDK_Version::undefined() },
   { "UseConcMarkSweepGC",           JDK_Version::jdk(9), JDK_Version::undefined(), JDK_Version::undefined() },
-  { "MonitorInUseLists",            JDK_Version::jdk(10),JDK_Version::undefined(), JDK_Version::undefined() },
   { "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() },
@@ -560,6 +559,7 @@
   { "SyncVerbose",                   JDK_Version::undefined(), JDK_Version::jdk(12), JDK_Version::jdk(13) },
   { "SyncFlags",                     JDK_Version::undefined(), JDK_Version::jdk(12), JDK_Version::jdk(13) },
   { "SyncKnobs",                     JDK_Version::undefined(), JDK_Version::jdk(12), JDK_Version::jdk(13) },
+  { "MonitorInUseLists",             JDK_Version::jdk(10),     JDK_Version::jdk(12), JDK_Version::jdk(13) },
 
 #ifdef TEST_VERIFY_SPECIAL_JVM_FLAGS
   { "dep > obs",                    JDK_Version::jdk(9), JDK_Version::jdk(8), JDK_Version::undefined() },
--- a/src/hotspot/share/runtime/flags/jvmFlag.hpp	Wed Oct 03 16:07:40 2018 +0200
+++ b/src/hotspot/share/runtime/flags/jvmFlag.hpp	Thu Oct 04 16:01:19 2018 +0200
@@ -272,7 +272,7 @@
 
   // printRanges will print out flags type, name and range values as expected by -XX:+PrintFlagsRanges
   static void printFlags(outputStream* out, bool withComments, bool printRanges = false, bool skipDefaults = false);
-  static void printError(bool verbose, const char* msg, ...);
+  static void printError(bool verbose, const char* msg, ...) ATTRIBUTE_PRINTF(2, 3);
 
   static void verify() PRODUCT_RETURN;
 };
--- a/src/hotspot/share/runtime/flags/jvmFlagConstraintsCompiler.cpp	Wed Oct 03 16:07:40 2018 +0200
+++ b/src/hotspot/share/runtime/flags/jvmFlagConstraintsCompiler.cpp	Thu Oct 04 16:01:19 2018 +0200
@@ -94,7 +94,7 @@
   if (value < 0 || value > 512) {
     JVMFlag::printError(verbose,
                         "AllocatePrefetchDistance (" INTX_FORMAT ") must be "
-                        "between 0 and " INTX_FORMAT "\n",
+                        "between 0 and %d\n",
                         AllocatePrefetchDistance, 512);
     return JVMFlag::VIOLATES_CONSTRAINT;
   }
@@ -162,7 +162,7 @@
       JVMFlag::printError(verbose,
                           "CompileThreshold * (InterpreterProfilePercentage - OnStackReplacePercentage) / 100 = "
                           INTX_FORMAT " "
-                          "must be between 0 and " INTX_FORMAT ", try changing "
+                          "must be between 0 and %d, try changing "
                           "CompileThreshold, InterpreterProfilePercentage, and/or OnStackReplacePercentage\n",
                           (CompileThreshold * (OnStackReplacePercentage - InterpreterProfilePercentage)) / 100,
                           INT_MAX >> InvocationCounter::count_shift);
@@ -182,7 +182,7 @@
     if (backward_branch_limit < 0) {
       JVMFlag::printError(verbose,
                           "CompileThreshold * OnStackReplacePercentage / 100 = " INTX_FORMAT " "
-                          "must be between 0 and " INTX_FORMAT ", try changing "
+                          "must be between 0 and %d, try changing "
                           "CompileThreshold and/or OnStackReplacePercentage\n",
                           (CompileThreshold * OnStackReplacePercentage) / 100,
                           INT_MAX >> InvocationCounter::count_shift);
@@ -395,8 +395,8 @@
 #if INCLUDE_RTM_OPT
   if (UseRTMLocking && !is_power_of_2(RTMTotalCountIncrRate)) {
     JVMFlag::printError(verbose,
-                        "RTMTotalCountIncrRate (" INTX_FORMAT
-                        ") must be a power of 2, resetting it to 64\n",
+                        "RTMTotalCountIncrRate (%d) must be "
+                        "a power of 2, resetting it to 64\n",
                         RTMTotalCountIncrRate);
     FLAG_SET_DEFAULT(RTMTotalCountIncrRate, 64);
   }
--- a/src/hotspot/share/runtime/flags/jvmFlagConstraintsRuntime.cpp	Wed Oct 03 16:07:40 2018 +0200
+++ b/src/hotspot/share/runtime/flags/jvmFlagConstraintsRuntime.cpp	Thu Oct 04 16:01:19 2018 +0200
@@ -42,8 +42,8 @@
   if (value >= (intx)os::vm_page_size()) {
     JVMFlag::printError(verbose,
                         "ObjectAlignmentInBytes (" INTX_FORMAT ") must be "
-                        "less than page size (" INTX_FORMAT ")\n",
-                        value, (intx)os::vm_page_size());
+                        "less than page size (%d)\n",
+                        value, os::vm_page_size());
     return JVMFlag::VIOLATES_CONSTRAINT;
   }
   return JVMFlag::SUCCESS;
@@ -79,7 +79,7 @@
   if ((value % PeriodicTask::interval_gran) != 0) {
     JVMFlag::printError(verbose,
                         "BiasedLockingStartupDelay (" INTX_FORMAT ") must be "
-                        "evenly divisible by PeriodicTask::interval_gran (" INTX_FORMAT ")\n",
+                        "evenly divisible by PeriodicTask::interval_gran (%d)\n",
                         value, PeriodicTask::interval_gran);
     return JVMFlag::VIOLATES_CONSTRAINT;
   } else {
@@ -123,7 +123,7 @@
   if ((value % PeriodicTask::interval_gran != 0)) {
     JVMFlag::printError(verbose,
                         "PerfDataSamplingInterval (" INTX_FORMAT ") must be "
-                        "evenly divisible by PeriodicTask::interval_gran (" INTX_FORMAT ")\n",
+                        "evenly divisible by PeriodicTask::interval_gran (%d)\n",
                         value, PeriodicTask::interval_gran);
     return JVMFlag::VIOLATES_CONSTRAINT;
   } else {
--- a/src/hotspot/share/runtime/globals.hpp	Wed Oct 03 16:07:40 2018 +0200
+++ b/src/hotspot/share/runtime/globals.hpp	Thu Oct 04 16:01:19 2018 +0200
@@ -827,8 +827,6 @@
   product(intx, MonitorBound, 0, "Bound Monitor population")                \
           range(0, max_jint)                                                \
                                                                             \
-  product(bool, MonitorInUseLists, true, "Track Monitors for Deflation")    \
-                                                                            \
   experimental(intx, MonitorUsedDeflationThreshold, 90,                     \
                 "Percentage of used monitors before triggering cleanup "    \
                 "safepoint which deflates monitors (0 is off). "            \
--- a/src/hotspot/share/runtime/handshake.cpp	Wed Oct 03 16:07:40 2018 +0200
+++ b/src/hotspot/share/runtime/handshake.cpp	Thu Oct 04 16:01:19 2018 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2017, 2018, 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
@@ -347,6 +347,27 @@
          target->is_ext_suspended();
 }
 
+static bool possibly_vmthread_can_process_handshake(JavaThread* target) {
+  // An externally suspended thread cannot be resumed while the
+  // Threads_lock is held so it is safe.
+  // Note that this method is allowed to produce false positives.
+  assert(Threads_lock->owned_by_self(), "Not holding Threads_lock.");
+  if (target->is_ext_suspended()) {
+    return true;
+  }
+  switch (target->thread_state()) {
+  case _thread_in_native:
+    // native threads are safe if they have no java stack or have walkable stack
+    return !target->has_last_Java_frame() || target->frame_anchor()->walkable();
+
+  case _thread_blocked:
+    return true;
+
+  default:
+    return false;
+  }
+}
+
 bool HandshakeState::claim_handshake_for_vmthread() {
   if (!_semaphore.trywait()) {
     return false;
@@ -366,7 +387,7 @@
     return;
   }
 
-  if (!vmthread_can_process_handshake(target)) {
+  if (!possibly_vmthread_can_process_handshake(target)) {
     // JT is observed in an unsafe state, it must notice the handshake itself
     return;
   }
--- a/src/hotspot/share/runtime/synchronizer.cpp	Wed Oct 03 16:07:40 2018 +0200
+++ b/src/hotspot/share/runtime/synchronizer.cpp	Thu Oct 04 16:01:19 2018 +0200
@@ -961,28 +961,9 @@
 }
 
 void ObjectSynchronizer::oops_do(OopClosure* f) {
-  if (MonitorInUseLists) {
-    // When using thread local monitor lists, we only scan the
-    // global used list here (for moribund threads), and
-    // the thread-local monitors in Thread::oops_do().
-    global_used_oops_do(f);
-  } else {
-    global_oops_do(f);
-  }
-}
-
-void ObjectSynchronizer::global_oops_do(OopClosure* f) {
-  assert(SafepointSynchronize::is_at_safepoint(), "must be at safepoint");
-  PaddedEnd<ObjectMonitor> * block = OrderAccess::load_acquire(&gBlockList);
-  for (; block != NULL; block = next(block)) {
-    assert(block->object() == CHAINMARKER, "must be a block header");
-    for (int i = 1; i < _BLOCKSIZE; i++) {
-      ObjectMonitor* mid = (ObjectMonitor *)&block[i];
-      if (mid->object() != NULL) {
-        f->do_oop((oop*)mid->object_addr());
-      }
-    }
-  }
+  // We only scan the global used list here (for moribund threads), and
+  // the thread-local monitors in Thread::oops_do().
+  global_used_oops_do(f);
 }
 
 void ObjectSynchronizer::global_used_oops_do(OopClosure* f) {
@@ -1078,15 +1059,10 @@
     if (m != NULL) {
       Self->omFreeList = m->FreeNext;
       Self->omFreeCount--;
-      // CONSIDER: set m->FreeNext = BAD -- diagnostic hygiene
       guarantee(m->object() == NULL, "invariant");
-      if (MonitorInUseLists) {
-        m->FreeNext = Self->omInUseList;
-        Self->omInUseList = m;
-        Self->omInUseCount++;
-      } else {
-        m->FreeNext = NULL;
-      }
+      m->FreeNext = Self->omInUseList;
+      Self->omInUseList = m;
+      Self->omInUseCount++;
       return m;
     }
 
@@ -1208,7 +1184,7 @@
   guarantee(m->object() == NULL, "invariant");
   guarantee(((m->is_busy()|m->_recursions) == 0), "freeing in-use monitor");
   // Remove from omInUseList
-  if (MonitorInUseLists && fromPerThreadAlloc) {
+  if (fromPerThreadAlloc) {
     ObjectMonitor* cur_mid_in_use = NULL;
     bool extracted = false;
     for (ObjectMonitor* mid = Self->omInUseList; mid != NULL; cur_mid_in_use = mid, mid = mid->FreeNext) {
@@ -1531,28 +1507,21 @@
 }
 
 
-// Deflate_idle_monitors() is called at all safepoints, immediately
-// after all mutators are stopped, but before any objects have moved.
-// It traverses the list of known monitors, deflating where possible.
-// The scavenged monitor are returned to the monitor free list.
+// We create a list of in-use monitors for each thread.
 //
-// Beware that we scavenge at *every* stop-the-world point.
-// Having a large number of monitors in-circulation negatively
-// impacts the performance of some applications (e.g., PointBase).
-// Broadly, we want to minimize the # of monitors in circulation.
+// deflate_thread_local_monitors() scans a single thread's in-use list, while
+// deflate_idle_monitors() scans only a global list of in-use monitors which
+// is populated only as a thread dies (see omFlush()).
 //
-// We have added a flag, MonitorInUseLists, which creates a list
-// of active monitors for each thread. deflate_idle_monitors()
-// only scans the per-thread in-use lists. omAlloc() puts all
-// assigned monitors on the per-thread list. deflate_idle_monitors()
-// returns the non-busy monitors to the global free list.
-// When a thread dies, omFlush() adds the list of active monitors for
-// that thread to a global gOmInUseList acquiring the
-// global list lock. deflate_idle_monitors() acquires the global
-// list lock to scan for non-busy monitors to the global free list.
-// An alternative could have used a single global in-use list. The
-// downside would have been the additional cost of acquiring the global list lock
-// for every omAlloc().
+// These operations are called at all safepoints, immediately after mutators
+// are stopped, but before any objects have moved. Collectively they traverse
+// the population of in-use monitors, deflating where possible. The scavenged
+// monitors are returned to the monitor free list.
+//
+// Beware that we scavenge at *every* stop-the-world point. Having a large
+// number of monitors in-use could negatively impact performance. We also want
+// to minimize the total # of monitors in circulation, as they incur a small
+// footprint penalty.
 //
 // Perversely, the heap size -- and thus the STW safepoint rate --
 // typically drives the scavenge rate.  Large heaps can mean infrequent GC,
@@ -1671,47 +1640,16 @@
   // See e.g. 6320749
   Thread::muxAcquire(&gListLock, "scavenge - return");
 
-  if (MonitorInUseLists) {
-    // Note: the thread-local monitors lists get deflated in
-    // a separate pass. See deflate_thread_local_monitors().
-
-    // For moribund threads, scan gOmInUseList
-    if (gOmInUseList) {
-      counters->nInCirculation += gOmInUseCount;
-      int deflated_count = deflate_monitor_list((ObjectMonitor **)&gOmInUseList, &freeHeadp, &freeTailp);
-      gOmInUseCount -= deflated_count;
-      counters->nScavenged += deflated_count;
-      counters->nInuse += gOmInUseCount;
-    }
+  // Note: the thread-local monitors lists get deflated in
+  // a separate pass. See deflate_thread_local_monitors().
 
-  } else {
-    PaddedEnd<ObjectMonitor> * block = OrderAccess::load_acquire(&gBlockList);
-    for (; block != NULL; block = next(block)) {
-      // Iterate over all extant monitors - Scavenge all idle monitors.
-      assert(block->object() == CHAINMARKER, "must be a block header");
-      counters->nInCirculation += _BLOCKSIZE;
-      for (int i = 1; i < _BLOCKSIZE; i++) {
-        ObjectMonitor* mid = (ObjectMonitor*)&block[i];
-        oop obj = (oop)mid->object();
-
-        if (obj == NULL) {
-          // The monitor is not associated with an object.
-          // The monitor should either be a thread-specific private
-          // free list or the global free list.
-          // obj == NULL IMPLIES mid->is_busy() == 0
-          guarantee(!mid->is_busy(), "invariant");
-          continue;
-        }
-        deflated = deflate_monitor(mid, obj, &freeHeadp, &freeTailp);
-
-        if (deflated) {
-          mid->FreeNext = NULL;
-          counters->nScavenged++;
-        } else {
-          counters->nInuse++;
-        }
-      }
-    }
+  // For moribund threads, scan gOmInUseList
+  if (gOmInUseList) {
+    counters->nInCirculation += gOmInUseCount;
+    int deflated_count = deflate_monitor_list((ObjectMonitor **)&gOmInUseList, &freeHeadp, &freeTailp);
+    gOmInUseCount -= deflated_count;
+    counters->nScavenged += deflated_count;
+    counters->nInuse += gOmInUseCount;
   }
 
   // Move the scavenged monitors back to the global free list.
@@ -1744,7 +1682,6 @@
 
 void ObjectSynchronizer::deflate_thread_local_monitors(Thread* thread, DeflateMonitorCounters* counters) {
   assert(SafepointSynchronize::is_at_safepoint(), "must be at safepoint");
-  if (!MonitorInUseLists) return;
 
   ObjectMonitor * freeHeadp = NULL;  // Local SLL of scavenged monitors
   ObjectMonitor * freeTailp = NULL;
--- a/src/hotspot/share/runtime/synchronizer.hpp	Wed Oct 03 16:07:40 2018 +0200
+++ b/src/hotspot/share/runtime/synchronizer.hpp	Thu Oct 04 16:01:19 2018 +0200
@@ -168,8 +168,6 @@
   // count of entries in gOmInUseList
   static int gOmInUseCount;
 
-  // Process oops in all monitors
-  static void global_oops_do(OopClosure* f);
   // Process oops in all global used monitors (i.e. moribund thread's monitors)
   static void global_used_oops_do(OopClosure* f);
   // Process oops in monitors on the given list
--- a/src/hotspot/share/runtime/thread.cpp	Wed Oct 03 16:07:40 2018 +0200
+++ b/src/hotspot/share/runtime/thread.cpp	Thu Oct 04 16:01:19 2018 +0200
@@ -851,11 +851,9 @@
   f->do_oop((oop*)&_pending_exception);
   handle_area()->oops_do(f);
 
-  if (MonitorInUseLists) {
-    // When using thread local monitor lists, we scan them here,
-    // and the remaining global monitors in ObjectSynchronizer::oops_do().
-    ObjectSynchronizer::thread_local_used_oops_do(this, f);
-  }
+  // We scan thread local monitor lists here, and the remaining global
+  // monitors in ObjectSynchronizer::oops_do().
+  ObjectSynchronizer::thread_local_used_oops_do(this, f);
 }
 
 void Thread::metadata_handles_do(void f(Metadata*)) {
--- a/src/java.base/share/classes/java/time/format/DateTimeFormatter.java	Wed Oct 03 16:07:40 2018 +0200
+++ b/src/java.base/share/classes/java/time/format/DateTimeFormatter.java	Thu Oct 04 16:01:19 2018 +0200
@@ -1138,9 +1138,12 @@
      * <p>
      * This returns an immutable formatter capable of formatting and parsing
      * the ISO-8601 instant format.
-     * When formatting, the second-of-minute is always output.
+     * When formatting, the instant will always be suffixed by 'Z' to indicate UTC.
+     * The second-of-minute is always output.
      * The nano-of-second outputs zero, three, six or nine digits as necessary.
-     * When parsing, time to at least the seconds field is required.
+     * When parsing, the behaviour of {@link DateTimeFormatterBuilder#appendOffsetId()}
+     * will be used to parse the offset, converting the instant to UTC as necessary.
+     * The time to at least the seconds field is required.
      * Fractional seconds from zero to nine are parsed.
      * The localized decimal style is not used.
      * <p>
--- a/src/java.base/share/classes/java/time/format/DateTimeFormatterBuilder.java	Wed Oct 03 16:07:40 2018 +0200
+++ b/src/java.base/share/classes/java/time/format/DateTimeFormatterBuilder.java	Thu Oct 04 16:01:19 2018 +0200
@@ -837,6 +837,10 @@
      * The leap-second time of '23:59:59' is handled to some degree, see
      * {@link DateTimeFormatter#parsedLeapSecond()} for full details.
      * <p>
+     * When formatting, the instant will always be suffixed by 'Z' to indicate UTC.
+     * When parsing, the behaviour of {@link DateTimeFormatterBuilder#appendOffsetId()}
+     * will be used to parse the offset, converting the instant to UTC as necessary.
+     * <p>
      * An alternative to this method is to format/parse the instant as a single
      * epoch-seconds value. That is achieved using {@code appendValue(INSTANT_SECONDS)}.
      *
@@ -3468,7 +3472,7 @@
                     .appendValue(MINUTE_OF_HOUR, 2).appendLiteral(':')
                     .appendValue(SECOND_OF_MINUTE, 2)
                     .appendFraction(NANO_OF_SECOND, minDigits, maxDigits, true)
-                    .appendLiteral('Z')
+                    .appendOffsetId()
                     .toFormatter().toPrinterParser(false);
             DateTimeParseContext newContext = context.copy();
             int pos = parser.parse(newContext, text, position);
@@ -3486,6 +3490,7 @@
             Long nanoVal = newContext.getParsed(NANO_OF_SECOND);
             int sec = (secVal != null ? secVal.intValue() : 0);
             int nano = (nanoVal != null ? nanoVal.intValue() : 0);
+            int offset = newContext.getParsed(OFFSET_SECONDS).intValue();
             int days = 0;
             if (hour == 24 && min == 0 && sec == 0 && nano == 0) {
                 hour = 0;
@@ -3498,7 +3503,7 @@
             long instantSecs;
             try {
                 LocalDateTime ldt = LocalDateTime.of(year, month, day, hour, min, sec, 0).plusDays(days);
-                instantSecs = ldt.toEpochSecond(ZoneOffset.UTC);
+                instantSecs = ldt.toEpochSecond(ZoneOffset.ofTotalSeconds(offset));
                 instantSecs += Math.multiplyExact(yearParsed / 10_000L, SECONDS_PER_10000_YEARS);
             } catch (RuntimeException ex) {
                 return ~position;
--- a/src/java.base/unix/native/libjava/Console_md.c	Wed Oct 03 16:07:40 2018 +0200
+++ b/src/java.base/unix/native/libjava/Console_md.c	Thu Oct 04 16:01:19 2018 +0200
@@ -56,7 +56,7 @@
         JNU_ThrowIOExceptionWithLastError(env, "tcgetattr failed");
         return !on;
     }
-    old = (tio.c_lflag & ECHO);
+    old = (tio.c_lflag & ECHO) != 0;
     if (on) {
         tio.c_lflag |= ECHO;
     } else {
--- a/src/jdk.jdi/share/classes/com/sun/tools/example/debug/tty/MessageOutput.java	Wed Oct 03 16:07:40 2018 +0200
+++ b/src/jdk.jdi/share/classes/com/sun/tools/example/debug/tty/MessageOutput.java	Thu Oct 04 16:01:19 2018 +0200
@@ -189,8 +189,12 @@
     }
 
     static void printPrompt() {
+        printPrompt(false);
+    }
+
+    static void printPrompt(boolean simple) {
         ThreadInfo threadInfo = ThreadInfo.getCurrentThreadInfo();
-        if (threadInfo == null) {
+        if (simple || threadInfo == null) {
             System.out.print
                 (MessageOutput.format("jdb prompt with no current thread"));
         } else {
--- a/src/jdk.jdi/share/classes/com/sun/tools/example/debug/tty/TTY.java	Wed Oct 03 16:07:40 2018 +0200
+++ b/src/jdk.jdi/share/classes/com/sun/tools/example/debug/tty/TTY.java	Thu Oct 04 16:01:19 2018 +0200
@@ -464,6 +464,8 @@
                         } else if (cmd.equals("resume")) {
                             evaluator.commandResume(t);
                         } else if (cmd.equals("cont")) {
+                            MessageOutput.printPrompt(true);
+                            showPrompt = false;
                             evaluator.commandCont();
                         } else if (cmd.equals("threadgroups")) {
                             evaluator.commandThreadGroups();
@@ -474,10 +476,16 @@
                         } else if (cmd.equals("ignore")) {
                             evaluator.commandIgnoreException(t);
                         } else if (cmd.equals("step")) {
+                            MessageOutput.printPrompt(true);
+                            showPrompt = false;
                             evaluator.commandStep(t);
                         } else if (cmd.equals("stepi")) {
+                            MessageOutput.printPrompt(true);
+                            showPrompt = false;
                             evaluator.commandStepi();
                         } else if (cmd.equals("next")) {
+                            MessageOutput.printPrompt(true);
+                            showPrompt = false;
                             evaluator.commandNext();
                         } else if (cmd.equals("kill")) {
                             evaluator.commandKill(t);
--- a/src/jdk.zipfs/share/classes/jdk/nio/zipfs/ZipDirectoryStream.java	Wed Oct 03 16:07:40 2018 +0200
+++ b/src/jdk.zipfs/share/classes/jdk/nio/zipfs/ZipDirectoryStream.java	Thu Oct 04 16:01:19 2018 +0200
@@ -41,21 +41,21 @@
 class ZipDirectoryStream implements DirectoryStream<Path> {
 
     private final ZipFileSystem zipfs;
-    private final byte[] path;
+    private final ZipPath dir;
     private final DirectoryStream.Filter<? super Path> filter;
     private volatile boolean isClosed;
     private volatile Iterator<Path> itr;
 
-    ZipDirectoryStream(ZipPath zipPath,
+    ZipDirectoryStream(ZipPath dir,
                        DirectoryStream.Filter<? super java.nio.file.Path> filter)
         throws IOException
     {
-        this.zipfs = zipPath.getFileSystem();
-        this.path = zipPath.getResolvedPath();
+        this.zipfs = dir.getFileSystem();
+        this.dir = dir;
         this.filter = filter;
         // sanity check
-        if (!zipfs.isDirectory(path))
-            throw new NotDirectoryException(zipPath.toString());
+        if (!zipfs.isDirectory(dir.getResolvedPath()))
+            throw new NotDirectoryException(dir.toString());
     }
 
     @Override
@@ -66,7 +66,7 @@
             throw new IllegalStateException("Iterator has already been returned");
 
         try {
-            itr = zipfs.iteratorOf(path, filter);
+            itr = zipfs.iteratorOf(dir, filter);
         } catch (IOException e) {
             throw new IllegalStateException(e);
         }
@@ -98,5 +98,4 @@
         isClosed = true;
     }
 
-
 }
--- a/src/jdk.zipfs/share/classes/jdk/nio/zipfs/ZipFileSystem.java	Wed Oct 03 16:07:40 2018 +0200
+++ b/src/jdk.zipfs/share/classes/jdk/nio/zipfs/ZipFileSystem.java	Thu Oct 04 16:01:19 2018 +0200
@@ -399,23 +399,32 @@
     }
 
     // returns the list of child paths of "path"
-    Iterator<Path> iteratorOf(byte[] path,
+    Iterator<Path> iteratorOf(ZipPath dir,
                               DirectoryStream.Filter<? super Path> filter)
         throws IOException
     {
         beginWrite();    // iteration of inodes needs exclusive lock
         try {
             ensureOpen();
+            byte[] path = dir.getResolvedPath();
             IndexNode inode = getInode(path);
             if (inode == null)
                 throw new NotDirectoryException(getString(path));
             List<Path> list = new ArrayList<>();
             IndexNode child = inode.child;
             while (child != null) {
-                // assume all path from zip file itself is "normalized"
-                ZipPath zp = new ZipPath(this, child.name, true);
-                if (filter == null || filter.accept(zp))
-                    list.add(zp);
+                // (1) assume all path from zip file itself is "normalized"
+                // (2) IndexNode.name is absolute. see IndexNode(byte[],int,int)
+                // (3) if parent "dir" is relative when ZipDirectoryStream
+                //     is created, the returned child path needs to be relative
+                //     as well.
+                byte[] cname = child.name;
+                if (!dir.isAbsolute()) {
+                    cname = Arrays.copyOfRange(cname, 1, cname.length);
+                }
+                ZipPath zpath = new ZipPath(this, cname, true);
+                if (filter == null || filter.accept(zpath))
+                    list.add(zpath);
                 child = child.sibling;
             }
             return list.iterator();
--- a/test/hotspot/jtreg/TEST.groups	Wed Oct 03 16:07:40 2018 +0200
+++ b/test/hotspot/jtreg/TEST.groups	Thu Oct 04 16:01:19 2018 +0200
@@ -139,7 +139,8 @@
   -compiler/runtime/Test6826736.java
 
 tier1_compiler_not_xcomp = \
-  compiler/aot
+  compiler/aot \
+  compiler/profiling
 
 tier1_compiler_not_cms = \
   compiler/aot \
--- a/test/hotspot/jtreg/compiler/profiling/TestSpecTrapClassUnloading.java	Wed Oct 03 16:07:40 2018 +0200
+++ b/test/hotspot/jtreg/compiler/profiling/TestSpecTrapClassUnloading.java	Thu Oct 04 16:01:19 2018 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2018, 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,6 +28,7 @@
  *
  * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:-TieredCompilation
  *                   -XX:-UseOnStackReplacement -XX:-BackgroundCompilation
+ *                   -XX:CompileThreshold=10000
  *                   -XX:+UseTypeSpeculation -XX:TypeProfileLevel=222
  *                   -XX:CompileCommand=exclude,java.lang.reflect.Method::invoke
  *                   -XX:CompileCommand=exclude,sun.reflect.DelegatingMethodAccessorImpl::invoke
--- a/test/hotspot/jtreg/compiler/profiling/TestTypeProfiling.java	Wed Oct 03 16:07:40 2018 +0200
+++ b/test/hotspot/jtreg/compiler/profiling/TestTypeProfiling.java	Thu Oct 04 16:01:19 2018 +0200
@@ -31,10 +31,12 @@
   * @run driver ClassFileInstaller sun.hotspot.WhiteBox sun.hotspot.WhiteBox$WhiteBoxPermission
   * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI
   *                   -XX:-BackgroundCompilation -XX:-UseOnStackReplacement
+  *                   -XX:CompileThreshold=10000
   *                   -server -XX:-TieredCompilation -XX:TypeProfileLevel=020
   *                    compiler.profiling.TestTypeProfiling
   * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI
   *                   -XX:-BackgroundCompilation -XX:-UseOnStackReplacement
+  *                   -XX:CompileThreshold=10000
   *                   -server -XX:-TieredCompilation -XX:TypeProfileLevel=200
   *                    compiler.profiling.TestTypeProfiling
   */
--- a/test/hotspot/jtreg/compiler/profiling/spectrapredefineclass/Launcher.java	Wed Oct 03 16:07:40 2018 +0200
+++ b/test/hotspot/jtreg/compiler/profiling/spectrapredefineclass/Launcher.java	Thu Oct 04 16:01:19 2018 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2018, 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
@@ -32,6 +32,7 @@
  * @run driver ClassFileInstaller compiler.profiling.spectrapredefineclass.Agent
  * @run driver compiler.profiling.spectrapredefineclass.Launcher
  * @run main/othervm -XX:-TieredCompilation -XX:-BackgroundCompilation
+ *                   -XX:CompileThreshold=10000
  *                   -XX:-UseOnStackReplacement -XX:TypeProfileLevel=222
  *                   -XX:ReservedCodeCacheSize=3M -Djdk.attach.allowAttachSelf
  *                   compiler.profiling.spectrapredefineclass.Agent
--- a/test/hotspot/jtreg/compiler/profiling/spectrapredefineclass_classloaders/Launcher.java	Wed Oct 03 16:07:40 2018 +0200
+++ b/test/hotspot/jtreg/compiler/profiling/spectrapredefineclass_classloaders/Launcher.java	Thu Oct 04 16:01:19 2018 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2018, 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
@@ -35,6 +35,7 @@
  * @run driver ClassFileInstaller compiler.profiling.spectrapredefineclass_classloaders.Agent
  * @run driver compiler.profiling.spectrapredefineclass_classloaders.Launcher
  * @run main/othervm -XX:-TieredCompilation -XX:-BackgroundCompilation
+ *                   -XX:CompileThreshold=10000
  *                   -XX:-UseOnStackReplacement -XX:TypeProfileLevel=222
  *                   -XX:ReservedCodeCacheSize=3M -Djdk.attach.allowAttachSelf
  *                   compiler.profiling.spectrapredefineclass_classloaders.Agent
--- a/test/hotspot/jtreg/compiler/uncommontrap/TestDeoptOOM.java	Wed Oct 03 16:07:40 2018 +0200
+++ b/test/hotspot/jtreg/compiler/uncommontrap/TestDeoptOOM.java	Thu Oct 04 16:01:19 2018 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2018, 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
@@ -26,6 +26,7 @@
  * @bug 6898462 8198826
  * @summary failed reallocations of scalar replaced objects during deoptimization causes crash
  *
+ * @requires !vm.graal.enabled
  * @run main/othervm -XX:-BackgroundCompilation -Xmx128M -XX:+IgnoreUnrecognizedVMOptions -XX:+VerifyStack
  *      -XX:CompileCommand=exclude,compiler.uncommontrap.TestDeoptOOM::main
  *      -XX:CompileCommand=exclude,compiler.uncommontrap.TestDeoptOOM::m9_1
--- a/test/jdk/java/time/tck/java/time/format/TCKInstantPrinterParser.java	Wed Oct 03 16:07:40 2018 +0200
+++ b/test/jdk/java/time/tck/java/time/format/TCKInstantPrinterParser.java	Thu Oct 04 16:01:19 2018 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2018, 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
@@ -69,12 +69,18 @@
 import java.time.ZoneOffset;
 import java.time.format.DateTimeFormatter;
 import java.time.format.DateTimeFormatterBuilder;
+import java.time.format.DateTimeParseException;
 import java.time.format.ResolverStyle;
 import java.time.temporal.TemporalAccessor;
 
 import org.testng.annotations.DataProvider;
 import org.testng.annotations.Test;
 
+/*
+ * @test
+ * @bug 8166138
+ */
+
 /**
  * Test DateTimeFormatterBuilder.appendInstant().
  */
@@ -200,7 +206,10 @@
                 {0, 0, "1970-01-01T00:00:00Z"},
                 {0, 0, "1970-01-01T00:00:00.0Z"},
                 {0, 0, "1970-01-01T00:00:00.000Z"},
-                {0, 0, "1970-01-01T00:00:00.000000000Z"},
+
+                {0, 0, "1970-01-01T00:00:00+00:00"},
+                {0, 0, "1970-01-01T05:30:00+05:30"},
+                {0, 0, "1970-01-01T01:00:00.0+01:00"},
 
                 {-1, 0, "1969-12-31T23:59:59Z"},
                 {1, 0, "1970-01-01T00:00:01Z"},
@@ -208,16 +217,22 @@
                 {3600, 0, "1970-01-01T01:00:00Z"},
                 {86400, 0, "1970-01-02T00:00:00Z"},
 
+                {-1, 0, "1969-12-31T23:59:59+00:00"},
+                {1, 0, "1970-01-01T05:30:01+05:30"},
+                {60, 0, "1969-12-31T19:01:00-05:00"},
+                {3600, 0, "1970-01-01T06:30:00+05:30"},
+                {86400, 0, "1970-01-01T19:00:00-05:00"},
+
                 {182, 234000000, "1970-01-01T00:03:02.234Z"},
                 {182, 234000000, "1970-01-01T00:03:02.2340Z"},
                 {182, 234000000, "1970-01-01T00:03:02.23400Z"},
                 {182, 234000000, "1970-01-01T00:03:02.234000Z"},
-                {182, 234000000, "1970-01-01T00:03:02.234000000Z"},
 
-                {((23 * 60) + 59) * 60 + 59, 123456789, "1970-01-01T23:59:59.123456789Z"},
+                {182, 234000000, "1970-01-01T00:03:02.234+00:00"},
+                {182, 234000000, "1970-01-01T05:33:02.2340+05:30"},
+                {182, 234000000, "1969-12-31T19:03:02.23400-05:00"},
+                {182, 234000000, "1970-01-01T00:03:02.234000+00:00"},
 
-                {Instant.MAX.getEpochSecond(), 999999999, "+1000000000-12-31T23:59:59.999999999Z"},
-                {Instant.MIN.getEpochSecond(), 0, "-1000000000-01-01T00:00:00.000000000Z"},
         };
     }
 
@@ -230,22 +245,46 @@
         assertEquals(f.parse(input).query(DateTimeFormatter.parsedLeapSecond()), Boolean.FALSE);
     }
 
-    @Test(dataProvider="parseDigits")
+    @DataProvider(name="parseNineDigits")
+    Object[][] data_parse_ninedigits() {
+        return new Object[][] {
+                {0, 0, "1970-01-01T00:00:00.000000000Z"},
+                {0, 0, "1970-01-01T05:30:00.000000000+05:30"},
+
+                {182, 234000000, "1970-01-01T00:03:02.234000000Z"},
+                {182, 234000000, "1970-01-01T01:03:02.234000000+01:00"},
+
+                {((23 * 60) + 59) * 60 + 59, 123456789, "1970-01-01T23:59:59.123456789Z"},
+                {((23 * 60) + 59) * 60 + 59, 123456789, "1970-01-02T05:29:59.123456789+05:30"},
+
+                {Instant.MAX.getEpochSecond(), 999999999, "+1000000000-12-31T23:59:59.999999999Z"},
+                {Instant.MIN.getEpochSecond(), 0, "-1000000000-01-01T00:00:00.000000000Z"},
+                {Instant.MAX.getEpochSecond(), 999999999, "+1000000000-12-31T23:59:59.999999999+00:00"},
+                {Instant.MIN.getEpochSecond(), 0, "-1000000000-01-01T00:00:00.000000000+00:00"},
+        };
+    }
+
+    @Test(dataProvider="parseNineDigits")
     public void test_parse_digitsNine(long instantSecs, int nano, String input) {
         DateTimeFormatter f = new DateTimeFormatterBuilder().appendInstant(9).toFormatter();
-        if (input.charAt(input.length() - 11) == '.') {
-            Instant expected = Instant.ofEpochSecond(instantSecs, nano);
-            assertEquals(f.parse(input, Instant::from), expected);
-            assertEquals(f.parse(input).query(DateTimeFormatter.parsedExcessDays()), Period.ZERO);
-            assertEquals(f.parse(input).query(DateTimeFormatter.parsedLeapSecond()), Boolean.FALSE);
-        } else {
-            try {
-                f.parse(input, Instant::from);
-                fail();
-            } catch (DateTimeException ex) {
-                // expected
-            }
-        }
+        Instant expected = Instant.ofEpochSecond(instantSecs, nano);
+        assertEquals(f.parse(input, Instant::from), expected);
+        assertEquals(f.parse(input).query(DateTimeFormatter.parsedExcessDays()), Period.ZERO);
+        assertEquals(f.parse(input).query(DateTimeFormatter.parsedLeapSecond()), Boolean.FALSE);
+    }
+
+    @DataProvider(name="parseMaxMinInstant")
+    Object[][] data_parse_MaxMinInstant() {
+        return new Object[][] {
+                {"+1000000000-12-31T23:59:59.999999999-01:00"},
+                {"-1000000000-01-01T00:00:00.000000000+01:00"}
+        };
+    }
+
+    @Test(dataProvider="parseMaxMinInstant", expectedExceptions=DateTimeParseException.class)
+    public void test_invalid_Instant(String input) {
+        DateTimeFormatter f = new DateTimeFormatterBuilder().appendInstant(-1).toFormatter();
+        f.parse(input, Instant::from);
     }
 
     @Test
@@ -283,4 +322,12 @@
         new DateTimeFormatterBuilder().appendInstant(10);
     }
 
+    //------------------------------------------------------------------------
+    @Test
+    public void test_equality() {
+        Instant instant1 = Instant.parse("2018-09-12T22:15:51+05:30");
+        Instant instant2 = Instant.parse("2018-09-12T16:45:51Z");
+        assertEquals(instant2, instant1);
+    }
+
 }
--- a/test/jdk/jdk/nio/zipfs/Basic.java	Wed Oct 03 16:07:40 2018 +0200
+++ b/test/jdk/jdk/nio/zipfs/Basic.java	Thu Oct 04 16:01:19 2018 +0200
@@ -43,7 +43,7 @@
 import static java.nio.file.StandardWatchEventKinds.ENTRY_CREATE;
 /**
  * @test
- * @bug 8038500 8040059 8150366 8150496 8147539
+ * @bug 8038500 8040059 8150366 8150496 8147539 8211385
  * @summary Basic test for zip provider
  *
  * @modules jdk.zipfs
@@ -89,16 +89,30 @@
 
         // Test: DirectoryStream
         found = false;
+
         try (DirectoryStream<Path> stream = Files.newDirectoryStream(fs.getPath("/"))) {
             for (Path entry: stream) {
                 found = entry.toString().equals("/META-INF");
                 if (found) break;
             }
         }
-
         if (!found)
             throw new RuntimeException("Expected file not found");
 
+        try (DirectoryStream<Path> stream = Files.newDirectoryStream(fs.getPath("META-INF"))) {
+            for (Path entry: stream) {
+                if (entry.toString().equals("/META-INF/services"))
+                    throw new RuntimeException("child path should be relative");
+            }
+        }
+
+        try (DirectoryStream<Path> stream = Files.newDirectoryStream(fs.getPath("/META-INF"))) {
+            for (Path entry: stream) {
+                if (entry.toString().equals("META-INF/services"))
+                    throw new RuntimeException("child path should be absolute");
+            }
+        }
+
         // Test: copy file from zip file to current (scratch) directory
         Path source = fs.getPath("/META-INF/services/java.nio.file.spi.FileSystemProvider");
         if (Files.exists(source)) {
@@ -133,6 +147,8 @@
         try {
             fs.provider().checkAccess(fs.getPath("/missing"), AccessMode.READ);
         } catch (ClosedFileSystemException x) { }
+
+        Files.deleteIfExists(jarFile);
     }
 
     // FileVisitor that pretty prints a file tree
--- a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/DefaultDriverInstaller.java	Wed Oct 03 16:07:40 2018 +0200
+++ b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/DefaultDriverInstaller.java	Thu Oct 04 16:01:19 2018 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2018, 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,8 @@
  */
 package org.netbeans.jemmy.drivers;
 
+import javax.swing.UIManager;
+
 import org.netbeans.jemmy.ClassReference;
 import org.netbeans.jemmy.JemmyException;
 import org.netbeans.jemmy.JemmyProperties;
@@ -50,6 +52,7 @@
 import org.netbeans.jemmy.drivers.windows.DefaultFrameDriver;
 import org.netbeans.jemmy.drivers.windows.DefaultInternalFrameDriver;
 import org.netbeans.jemmy.drivers.windows.DefaultWindowDriver;
+import org.netbeans.jemmy.drivers.windows.InternalFramePopupMenuDriver;
 
 /**
  * Installs all necessary drivers for Jemmy operators except low-level drivers
@@ -119,9 +122,9 @@
                     new ChoiceDriver(),
                     new DefaultFrameDriver(),
                     new DefaultWindowDriver(),
-                    new DefaultInternalFrameDriver(),
-                    new DefaultInternalFrameDriver(),
-                    new DefaultInternalFrameDriver(),
+                    "Motif".equals(UIManager.getLookAndFeel().getID())? new InternalFramePopupMenuDriver(): new DefaultInternalFrameDriver(),
+                    "Motif".equals(UIManager.getLookAndFeel().getID())? new InternalFramePopupMenuDriver(): new DefaultInternalFrameDriver(),
+                    "Motif".equals(UIManager.getLookAndFeel().getID())? new InternalFramePopupMenuDriver(): new DefaultInternalFrameDriver(),
                     new APIFocusDriver(),
                     new MouseFocusDriver(),
                     (shortcutEvents ? new QueueJMenuDriver() : new DefaultJMenuDriver()),
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/windows/InternalFramePopupMenuDriver.java	Thu Oct 04 16:01:19 2018 +0200
@@ -0,0 +1,87 @@
+/*
+ * Copyright (c) 2018, 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. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * 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.netbeans.jemmy.drivers.windows;
+
+import javax.swing.UIManager;
+
+import org.netbeans.jemmy.operators.ComponentOperator;
+import org.netbeans.jemmy.operators.JInternalFrameOperator;
+import org.netbeans.jemmy.operators.JMenuItemOperator;
+import org.netbeans.jemmy.operators.JPopupMenuOperator;
+
+/**
+ * InternalFrameDriver to do Close, Minimize, Maximize, and Restore actions
+ * using popup menus.
+ */
+public class InternalFramePopupMenuDriver extends DefaultInternalFrameDriver {
+
+    @Override
+    public void requestClose(ComponentOperator oper) {
+        checkSupported(oper);
+        pushMenuItem(oper, UIManager.getString(
+                "InternalFrameTitlePane.closeButtonText"));
+    }
+
+    @Override
+    public void iconify(ComponentOperator oper) {
+        checkSupported(oper);
+        pushMenuItem(oper, UIManager.getString(
+                "InternalFrameTitlePane.minimizeButtonText"));
+    }
+
+    @Override
+    public void maximize(ComponentOperator oper) {
+        checkSupported(oper);
+        if (!((JInternalFrameOperator) oper).isMaximum()) {
+            if (!((JInternalFrameOperator) oper).isSelected()) {
+                activate(oper);
+            }
+            pushMenuItem(oper, UIManager.getString(
+                    "InternalFrameTitlePane.maximizeButtonText"));
+        }
+    }
+
+    @Override
+    public void demaximize(ComponentOperator oper) {
+        checkSupported(oper);
+        if (((JInternalFrameOperator) oper).isMaximum()) {
+            if (!((JInternalFrameOperator) oper).isSelected()) {
+                activate(oper);
+            }
+            pushMenuItem(oper, UIManager.getString(
+                    "InternalFrameTitlePane.restoreButtonText"));
+        }
+    }
+
+    private void pushMenuItem(ComponentOperator oper,
+            String menuText) {
+        ((JInternalFrameOperator) oper).getPopupButton().push();
+        JPopupMenuOperator popupMenu = new JPopupMenuOperator();
+        JMenuItemOperator menuItem =
+                new JMenuItemOperator(popupMenu, menuText);
+        menuItem.push();
+    }
+}
\ No newline at end of file
--- a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/operators/JInternalFrameOperator.java	Wed Oct 03 16:07:40 2018 +0200
+++ b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/operators/JInternalFrameOperator.java	Thu Oct 04 16:01:19 2018 +0200
@@ -170,6 +170,8 @@
      */
     protected JButtonOperator closeOper = null;
 
+    protected JButtonOperator popupButtonOper = null;
+
     /**
      * A title operator.
      */
@@ -202,9 +204,8 @@
      * @param index an index between appropriate ones.
      */
     public JInternalFrameOperator(ContainerOperator<?> cont, ComponentChooser chooser, int index) {
-        this((JInternalFrame) cont.
-                waitSubComponent(new JInternalFrameFinder(chooser),
-                        index));
+        this(waitJInternalFrame((Container)cont.getSource(),
+                chooser, index));
         copyEnvironment(cont);
     }
 
@@ -255,7 +256,7 @@
      *
      */
     public JInternalFrameOperator(ContainerOperator<?> cont, int index) {
-        this((JInternalFrame) waitComponent(cont,
+        this(waitJInternalFrame((Container)cont.getSource(),
                 new JInternalFrameFinder(),
                 index));
         copyEnvironment(cont);
@@ -667,6 +668,11 @@
         return closeOper;
     }
 
+    public JButtonOperator getPopupButton() {
+        initOperators();
+        return popupButtonOper;
+    }
+
     /**
      * Waits for the title pane.
      *
@@ -1413,21 +1419,27 @@
                         return "JInternalFrameOperator.initOperators.ComponentChooser{description = " + getDescription() + '}';
                     }
                 }) != null) {
-                    minOper = new JButtonOperator(titleOperator,
+                    if("Motif".equals(UIManager.getLookAndFeel().getID())) {
+                        popupButtonOper = new JButtonOperator(titleOperator, 0);
+                    } else {
+                        minOper = new JButtonOperator(titleOperator,
                             new JComponentByTipFinder(MINIMIZE_BUTTON_TOOLTIP));
-                    if (((JInternalFrame) getSource()).isMaximizable()) {
-                        maxOper = new JButtonOperator(titleOperator,
+                        if (((JInternalFrame) getSource()).isMaximizable()) {
+                            maxOper = new JButtonOperator(titleOperator,
                                 new JComponentByTipFinder(MAXIMIZE_BUTTON_TOOLTIP));
-                    } else {
-                        maxOper = null;
+                        } else {
+                            maxOper = null;
+                        }
                     }
                 } else {
                     minOper = null;
                     maxOper = null;
                 }
                 if (isClosable()) {
-                    closeOper = new JButtonOperator(titleOperator,
+                    if(!"Motif".equals(UIManager.getLookAndFeel().getID())) {
+                        closeOper = new JButtonOperator(titleOperator,
                             new JComponentByTipFinder(CLOSE_BUTTON_TOOLTIP));
+                    }
                 } else {
                     closeOper = null;
                 }
@@ -1588,23 +1600,24 @@
         }
 
         /**
-         * Creates an operator for the correspondent intenal frame.
+         * Creates an operator for the correspondent internal frame.
          *
          * @return an operator.
          */
         public JInternalFrame getInternalFrame() {
-            return ((JInternalFrame) getEventDispatcher().
-                    invokeExistingMethod("getInternalFrame",
-                            null,
-                            null,
-                            output));
+            return (runMapping(new MapAction<JInternalFrame>("getInternalFrame") {
+                @Override
+                public JInternalFrame map() {
+                    return ((JInternalFrame.JDesktopIcon) getSource()).getInternalFrame();
+                }
+            }));
         }
 
         /**
          * Pushs the deiconifying button.
          */
         public void pushButton() {
-            new JButtonOperator(this).push();
+            this.clickMouse(2);
         }
     }
 
--- a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/version_info	Wed Oct 03 16:07:40 2018 +0200
+++ b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/version_info	Thu Oct 04 16:01:19 2018 +0200
@@ -1,6 +1,6 @@
 Manifest-version: 1.0
 Main-Class: org.netbeans.jemmy.JemmyProperties
 Jemmy-MajorVersion: 3.0
-Jemmy-MinorVersion: 4.0
+Jemmy-MinorVersion: 5.0
 Jemmy-Build: @BUILD_NUMBER@