Merge
authorjwilhelm
Thu, 23 Apr 2015 16:09:21 +0200
changeset 30280 b9efc9156778
parent 30279 c3b8486760aa (current diff)
parent 30254 224dcf3ebade (diff)
child 30283 41051ea58839
Merge
hotspot/src/cpu/sparc/vm/macroAssembler_sparc.cpp
hotspot/src/share/vm/runtime/arguments.cpp
hotspot/src/share/vm/runtime/globals.hpp
hotspot/test/Makefile
hotspot/test/sanity/WhiteBox.java
--- a/hotspot/agent/src/share/classes/com/sun/java/swing/ui/CommonToolBar.java	Wed Apr 22 14:06:49 2015 -0400
+++ b/hotspot/agent/src/share/classes/com/sun/java/swing/ui/CommonToolBar.java	Thu Apr 23 16:09:21 2015 +0200
@@ -46,7 +46,7 @@
     {
         this.manager = manager;
         statusBar = status;
-        buttonSize = new Dimension(CommonUI.buttconPrefSize);
+        buttonSize = new Dimension(CommonUI.getButtconPrefSize());
         buttonInsets = new Insets(0, 0, 0, 0);
         addComponents();
     }
--- a/hotspot/agent/src/share/classes/com/sun/java/swing/ui/CommonUI.java	Wed Apr 22 14:06:49 2015 -0400
+++ b/hotspot/agent/src/share/classes/com/sun/java/swing/ui/CommonUI.java	Thu Apr 23 16:09:21 2015 +0200
@@ -373,20 +373,25 @@
         comp.setCursor(Cursor.getPredefinedCursor(0));
     }
 
-    public static final int BUTTON_WIDTH = 100;
-    public static final int BUTTON_HEIGHT = 26;
-    public static final int BUTTCON_WIDTH = 28;
-    public static final int BUTTCON_HEIGHT = 28;
-    public static final int SM_BUTTON_WIDTH = 72;
-    public static final int SM_BUTTON_HEIGHT = 26;
-    public static final int LABEL_WIDTH = 100;
-    public static final int LABEL_HEIGHT = 20;
-    public static final int TEXT_WIDTH = 150;
-    public static final int TEXT_HEIGHT = 20;
-    public static Dimension buttonPrefSize = new Dimension(100, 26);
-    public static Dimension buttconPrefSize = new Dimension(28, 28);
-    public static Dimension smbuttonPrefSize = new Dimension(72, 26);
-    public static Dimension labelPrefSize = new Dimension(100, 20);
-    public static Dimension textPrefSize = new Dimension(150, 20);
+    public static Dimension getButtconPrefSize()
+    {
+        return buttconPrefSize;
+    }
+
+    private static final int BUTTON_WIDTH = 100;
+    private static final int BUTTON_HEIGHT = 26;
+    private static final int BUTTCON_WIDTH = 28;
+    private static final int BUTTCON_HEIGHT = 28;
+    private static final int SM_BUTTON_WIDTH = 72;
+    private static final int SM_BUTTON_HEIGHT = 26;
+    private static final int LABEL_WIDTH = 100;
+    private static final int LABEL_HEIGHT = 20;
+    private static final int TEXT_WIDTH = 150;
+    private static final int TEXT_HEIGHT = 20;
+    private static final Dimension buttonPrefSize = new Dimension(100, 26);
+    private static final Dimension buttconPrefSize = new Dimension(28, 28);
+    private static final Dimension smbuttonPrefSize = new Dimension(72, 26);
+    private static final Dimension labelPrefSize = new Dimension(100, 20);
+    private static final Dimension textPrefSize = new Dimension(150, 20);
 
 }
--- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/utilities/HeapHprofBinWriter.java	Wed Apr 22 14:06:49 2015 -0400
+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/utilities/HeapHprofBinWriter.java	Thu Apr 23 16:09:21 2015 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2004, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2004, 2015, 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
@@ -799,6 +799,18 @@
         writeObjectID(klass.getJavaMirror());
 
         ClassData cd = (ClassData) classDataCache.get(klass);
+        if (cd == null) {
+            // The class is not present in the system dictionary, probably Lambda.
+            // Add it to cache here
+            if (klass instanceof InstanceKlass) {
+                InstanceKlass ik = (InstanceKlass) klass;
+                List fields = getInstanceFields(ik);
+                int instSize = getSizeForFields(fields);
+                cd = new ClassData(instSize, fields);
+                classDataCache.put(ik, cd);
+            }
+        }
+
         if (Assert.ASSERTS_ENABLED) {
             Assert.that(cd != null, "can not get class data for " + klass.getName().asString() + klass.getAddress());
         }
--- a/hotspot/make/bsd/makefiles/gcc.make	Wed Apr 22 14:06:49 2015 -0400
+++ b/hotspot/make/bsd/makefiles/gcc.make	Thu Apr 23 16:09:21 2015 +0200
@@ -313,22 +313,13 @@
 
 # Work around some compiler bugs.
 ifeq ($(USE_CLANG), true)
-  # Clang 4.2
-  ifeq ($(shell expr $(CC_VER_MAJOR) = 4 \& $(CC_VER_MINOR) = 2), 1)
-    OPT_CFLAGS/loopTransform.o += $(OPT_CFLAGS/NOOPT)
-    OPT_CFLAGS/unsafe.o += -O1
-  # Clang 5.0
-  else ifeq ($(shell expr $(CC_VER_MAJOR) = 5 \& $(CC_VER_MINOR) = 0), 1)
+  # Clang <= 6.1
+  ifeq ($(shell expr \
+      $(CC_VER_MAJOR) \< 6 \| \
+      \( $(CC_VER_MAJOR) = 6 \& $(CC_VER_MINOR) \<= 1 \) \
+    ), 1)
     OPT_CFLAGS/loopTransform.o += $(OPT_CFLAGS/NOOPT)
     OPT_CFLAGS/unsafe.o += -O1
-  # Clang 5.1
-  else ifeq ($(shell expr $(CC_VER_MAJOR) = 5 \& $(CC_VER_MINOR) = 1), 1)
-    OPT_CFLAGS/loopTransform.o += $(OPT_CFLAGS/NOOPT)
-    OPT_CFLAGS/unsafe.o += -O1
-  # Clang 6.0 
-  else ifeq ($(shell expr $(CC_VER_MAJOR) = 6 \& $(CC_VER_MINOR) = 0), 1) 
-    OPT_CFLAGS/loopTransform.o += $(OPT_CFLAGS/NOOPT) 
-    OPT_CFLAGS/unsafe.o += -O1 
   else
     $(error "Update compiler workarounds for Clang $(CC_VER_MAJOR).$(CC_VER_MINOR)")
   endif
@@ -336,7 +327,7 @@
   # 6835796. Problem in GCC 4.3.0 with mulnode.o optimized compilation.
   ifeq ($(shell expr $(CC_VER_MAJOR) = 4 \& $(CC_VER_MINOR) = 3), 1)
     OPT_CFLAGS/mulnode.o += $(OPT_CFLAGS/NOOPT)
-  endif
+  endif 
 endif
 
 # Flags for generating make dependency flags.
--- a/hotspot/src/cpu/sparc/vm/macroAssembler_sparc.cpp	Wed Apr 22 14:06:49 2015 -0400
+++ b/hotspot/src/cpu/sparc/vm/macroAssembler_sparc.cpp	Thu Apr 23 16:09:21 2015 +0200
@@ -3019,44 +3019,107 @@
    // past the store that releases the lock.  But TSO is a strong memory model
    // and that particular flavor of barrier is a noop, so we can safely elide it.
    // Note that we use 1-0 locking by default for the inflated case.  We
-   // close the resultant (and rare) race by having contented threads in
+   // close the resultant (and rare) race by having contended threads in
    // monitorenter periodically poll _owner.
-   ld_ptr(Rmark, OM_OFFSET_NO_MONITOR_VALUE_TAG(owner), Rscratch);
-   ld_ptr(Rmark, OM_OFFSET_NO_MONITOR_VALUE_TAG(recursions), Rbox);
-   xor3(Rscratch, G2_thread, Rscratch);
-   orcc(Rbox, Rscratch, Rbox);
-   brx(Assembler::notZero, false, Assembler::pn, done);
-   delayed()->
-   ld_ptr(Rmark, OM_OFFSET_NO_MONITOR_VALUE_TAG(EntryList), Rscratch);
-   ld_ptr(Rmark, OM_OFFSET_NO_MONITOR_VALUE_TAG(cxq), Rbox);
-   orcc(Rbox, Rscratch, G0);
-   if (EmitSync & 65536) {
-      Label LSucc ;
-      brx(Assembler::notZero, false, Assembler::pn, LSucc);
-      delayed()->nop();
-      ba(done);
-      delayed()->st_ptr(G0, Rmark, OM_OFFSET_NO_MONITOR_VALUE_TAG(owner));
-
-      bind(LSucc);
-      st_ptr(G0, Rmark, OM_OFFSET_NO_MONITOR_VALUE_TAG(owner));
-      if (os::is_MP()) { membar (StoreLoad); }
-      ld_ptr(Rmark, OM_OFFSET_NO_MONITOR_VALUE_TAG(succ), Rscratch);
-      andcc(Rscratch, Rscratch, G0);
-      brx(Assembler::notZero, false, Assembler::pt, done);
-      delayed()->andcc(G0, G0, G0);
-      add(Rmark, OM_OFFSET_NO_MONITOR_VALUE_TAG(owner), Rmark);
-      mov(G2_thread, Rscratch);
-      cas_ptr(Rmark, G0, Rscratch);
-      // invert icc.zf and goto done
-      br_notnull(Rscratch, false, Assembler::pt, done);
-      delayed()->cmp(G0, G0);
-      ba(done);
-      delayed()->cmp(G0, 1);
+
+   if (EmitSync & 1024) {
+     // Emit code to check that _owner == Self
+     // We could fold the _owner test into subsequent code more efficiently
+     // than using a stand-alone check, but since _owner checking is off by
+     // default we don't bother. We also might consider predicating the
+     // _owner==Self check on Xcheck:jni or running on a debug build.
+     ld_ptr(Address(Rmark, OM_OFFSET_NO_MONITOR_VALUE_TAG(owner)), Rscratch);
+     orcc(Rscratch, G0, G0);
+     brx(Assembler::notZero, false, Assembler::pn, done);
+     delayed()->nop();
+   }
+
+   if (EmitSync & 512) {
+     // classic lock release code absent 1-0 locking
+     //   m->Owner = null;
+     //   membar #storeload
+     //   if (m->cxq|m->EntryList) == null goto Success
+     //   if (m->succ != null) goto Success
+     //   if CAS (&m->Owner,0,Self) != 0 goto Success
+     //   goto SlowPath
+     ld_ptr(Address(Rmark, OM_OFFSET_NO_MONITOR_VALUE_TAG(recursions)), Rbox);
+     orcc(Rbox, G0, G0);
+     brx(Assembler::notZero, false, Assembler::pn, done);
+     delayed()->nop();
+     st_ptr(G0, Address(Rmark, OM_OFFSET_NO_MONITOR_VALUE_TAG(owner)));
+     if (os::is_MP()) { membar(StoreLoad); }
+     ld_ptr(Address(Rmark, OM_OFFSET_NO_MONITOR_VALUE_TAG(EntryList)), Rscratch);
+     ld_ptr(Address(Rmark, OM_OFFSET_NO_MONITOR_VALUE_TAG(cxq)), Rbox);
+     orcc(Rbox, Rscratch, G0);
+     brx(Assembler::zero, false, Assembler::pt, done);
+     delayed()->
+     ld_ptr(Address(Rmark, OM_OFFSET_NO_MONITOR_VALUE_TAG(succ)), Rscratch);
+     andcc(Rscratch, Rscratch, G0);
+     brx(Assembler::notZero, false, Assembler::pt, done);
+     delayed()->andcc(G0, G0, G0);
+     add(Rmark, OM_OFFSET_NO_MONITOR_VALUE_TAG(owner), Rmark);
+     mov(G2_thread, Rscratch);
+     cas_ptr(Rmark, G0, Rscratch);
+     cmp(Rscratch, G0);
+     // invert icc.zf and goto done
+     brx(Assembler::notZero, false, Assembler::pt, done);
+     delayed()->cmp(G0, G0);
+     br(Assembler::always, false, Assembler::pt, done);
+     delayed()->cmp(G0, 1);
    } else {
-      brx(Assembler::notZero, false, Assembler::pn, done);
-      delayed()->nop();
-      ba(done);
-      delayed()->st_ptr(G0, Rmark, OM_OFFSET_NO_MONITOR_VALUE_TAG(owner));
+     // 1-0 form : avoids CAS and MEMBAR in the common case
+     // Do not bother to ratify that m->Owner == Self.
+     ld_ptr(Address(Rmark, OM_OFFSET_NO_MONITOR_VALUE_TAG(recursions)), Rbox);
+     orcc(Rbox, G0, G0);
+     brx(Assembler::notZero, false, Assembler::pn, done);
+     delayed()->
+     ld_ptr(Address(Rmark, OM_OFFSET_NO_MONITOR_VALUE_TAG(EntryList)), Rscratch);
+     ld_ptr(Address(Rmark, OM_OFFSET_NO_MONITOR_VALUE_TAG(cxq)), Rbox);
+     orcc(Rbox, Rscratch, G0);
+     if (EmitSync & 16384) {
+       // As an optional optimization, if (EntryList|cxq) != null and _succ is null then
+       // we should transfer control directly to the slow-path.
+       // This test makes the reacquire operation below very infrequent.
+       // The logic is equivalent to :
+       //   if (cxq|EntryList) == null : Owner=null; goto Success
+       //   if succ == null : goto SlowPath
+       //   Owner=null; membar #storeload
+       //   if succ != null : goto Success
+       //   if CAS(&Owner,null,Self) != null goto Success
+       //   goto SlowPath
+       brx(Assembler::zero, true, Assembler::pt, done);
+       delayed()->
+       st_ptr(G0, Address(Rmark, OM_OFFSET_NO_MONITOR_VALUE_TAG(owner)));
+       ld_ptr(Address(Rmark, OM_OFFSET_NO_MONITOR_VALUE_TAG(succ)), Rscratch);
+       andcc(Rscratch, Rscratch, G0) ;
+       brx(Assembler::zero, false, Assembler::pt, done);
+       delayed()->orcc(G0, 1, G0);
+       st_ptr(G0, Address(Rmark, OM_OFFSET_NO_MONITOR_VALUE_TAG(owner)));
+     } else {
+       brx(Assembler::zero, false, Assembler::pt, done);
+       delayed()->
+       st_ptr(G0, Address(Rmark, OM_OFFSET_NO_MONITOR_VALUE_TAG(owner)));
+     }
+     if (os::is_MP()) { membar(StoreLoad); }
+     // Check that _succ is (or remains) non-zero
+     ld_ptr(Address(Rmark, OM_OFFSET_NO_MONITOR_VALUE_TAG(succ)), Rscratch);
+     andcc(Rscratch, Rscratch, G0);
+     brx(Assembler::notZero, false, Assembler::pt, done);
+     delayed()->andcc(G0, G0, G0);
+     add(Rmark, OM_OFFSET_NO_MONITOR_VALUE_TAG(owner), Rmark);
+     mov(G2_thread, Rscratch);
+     cas_ptr(Rmark, G0, Rscratch);
+     cmp(Rscratch, G0);
+     // invert icc.zf and goto done
+     // A slightly better v8+/v9 idiom would be the following:
+     //   movrnz Rscratch,1,Rscratch
+     //   ba done
+     //   xorcc Rscratch,1,G0
+     // In v8+ mode the idiom would be valid IFF Rscratch was a G or O register
+     brx(Assembler::notZero, false, Assembler::pt, done);
+     delayed()->cmp(G0, G0);
+     br(Assembler::always, false, Assembler::pt, done);
+     delayed()->cmp(G0, 1);
    }
 
    bind   (LStacked);
--- a/hotspot/src/cpu/sparc/vm/sharedRuntime_sparc.cpp	Wed Apr 22 14:06:49 2015 -0400
+++ b/hotspot/src/cpu/sparc/vm/sharedRuntime_sparc.cpp	Thu Apr 23 16:09:21 2015 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2015, 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
@@ -2664,6 +2664,9 @@
     // disallows any pending_exception.
     __ mov(L3_box, O1);
 
+    // Pass in current thread pointer
+    __ mov(G2_thread, O2);
+
     __ call(CAST_FROM_FN_PTR(address, SharedRuntime::complete_monitor_unlocking_C), relocInfo::runtime_call_type);
     __ delayed()->mov(L4, O0);              // Need oop in O0
 
--- a/hotspot/src/cpu/x86/vm/globals_x86.hpp	Wed Apr 22 14:06:49 2015 -0400
+++ b/hotspot/src/cpu/x86/vm/globals_x86.hpp	Thu Apr 23 16:09:21 2015 +0200
@@ -87,9 +87,6 @@
   develop(bool, IEEEPrecision, true,                                        \
           "Enables IEEE precision (for INTEL only)")                        \
                                                                             \
-  product(intx, FenceInstruction, 0,                                        \
-          "(Unsafe,Unstable) Experimental")                                 \
-                                                                            \
   product(bool, UseStoreImmI16, true,                                       \
           "Use store immediate 16-bits value instruction on x86")           \
                                                                             \
--- a/hotspot/src/cpu/x86/vm/macroAssembler_x86.cpp	Wed Apr 22 14:06:49 2015 -0400
+++ b/hotspot/src/cpu/x86/vm/macroAssembler_x86.cpp	Thu Apr 23 16:09:21 2015 +0200
@@ -1958,6 +1958,11 @@
 // Programmer's Guide and Specification" claims that an object locked by jni_monitorenter
 // should not be unlocked by "normal" java-level locking and vice-versa.  The specification
 // doesn't specify what will occur if a program engages in such mixed-mode locking, however.
+// Arguably given that the spec legislates the JNI case as undefined our implementation
+// could reasonably *avoid* checking owner in Fast_Unlock().
+// In the interest of performance we elide m->Owner==Self check in unlock.
+// A perfectly viable alternative is to elide the owner check except when
+// Xcheck:jni is enabled.
 
 void MacroAssembler::fast_unlock(Register objReg, Register boxReg, Register tmpReg, bool use_rtm) {
   assert(boxReg == rax, "");
@@ -1966,24 +1971,6 @@
   if (EmitSync & 4) {
     // Disable - inhibit all inlining.  Force control through the slow-path
     cmpptr (rsp, 0);
-  } else
-  if (EmitSync & 8) {
-    Label DONE_LABEL;
-    if (UseBiasedLocking) {
-       biased_locking_exit(objReg, tmpReg, DONE_LABEL);
-    }
-    // Classic stack-locking code ...
-    // Check whether the displaced header is 0
-    //(=> recursive unlock)
-    movptr(tmpReg, Address(boxReg, 0));
-    testptr(tmpReg, tmpReg);
-    jccb(Assembler::zero, DONE_LABEL);
-    // If not recursive lock, reset the header to displaced header
-    if (os::is_MP()) {
-      lock();
-    }
-    cmpxchgptr(tmpReg, Address(objReg, 0));   // Uses RAX which is box
-    bind(DONE_LABEL);
   } else {
     Label DONE_LABEL, Stacked, CheckSucc;
 
@@ -2060,9 +2047,9 @@
     // the number of loads below (currently 4) to just 2 or 3.
     // Refer to the comments in synchronizer.cpp.
     // In practice the chain of fetches doesn't seem to impact performance, however.
+    xorptr(boxReg, boxReg);
     if ((EmitSync & 65536) == 0 && (EmitSync & 256)) {
        // Attempt to reduce branch density - AMD's branch predictor.
-       xorptr(boxReg, Address(tmpReg, OM_OFFSET_NO_MONITOR_VALUE_TAG(owner)));
        orptr(boxReg, Address(tmpReg, OM_OFFSET_NO_MONITOR_VALUE_TAG(recursions)));
        orptr(boxReg, Address(tmpReg, OM_OFFSET_NO_MONITOR_VALUE_TAG(EntryList)));
        orptr(boxReg, Address(tmpReg, OM_OFFSET_NO_MONITOR_VALUE_TAG(cxq)));
@@ -2070,7 +2057,6 @@
        movptr(Address(tmpReg, OM_OFFSET_NO_MONITOR_VALUE_TAG(owner)), NULL_WORD);
        jmpb  (DONE_LABEL);
     } else {
-       xorptr(boxReg, Address(tmpReg, OM_OFFSET_NO_MONITOR_VALUE_TAG(owner)));
        orptr(boxReg, Address(tmpReg, OM_OFFSET_NO_MONITOR_VALUE_TAG(recursions)));
        jccb  (Assembler::notZero, DONE_LABEL);
        movptr(boxReg, Address(tmpReg, OM_OFFSET_NO_MONITOR_VALUE_TAG(EntryList)));
@@ -2093,10 +2079,8 @@
        bind  (CheckSucc);
 
        // Optional pre-test ... it's safe to elide this
-       if ((EmitSync & 16) == 0) {
-          cmpptr(Address(tmpReg, OM_OFFSET_NO_MONITOR_VALUE_TAG(succ)), (int32_t)NULL_WORD);
-          jccb  (Assembler::zero, LGoSlowPath);
-       }
+       cmpptr(Address(tmpReg, OM_OFFSET_NO_MONITOR_VALUE_TAG(succ)), (int32_t)NULL_WORD);
+       jccb(Assembler::zero, LGoSlowPath);
 
        // We have a classic Dekker-style idiom:
        //    ST m->_owner = 0 ; MEMBAR; LD m->_succ
@@ -2109,7 +2093,8 @@
        //     In older IA32 processors MFENCE is slower than lock:add or xchg
        //     particularly if the write-buffer is full as might be the case if
        //     if stores closely precede the fence or fence-equivalent instruction.
-       //     In more modern implementations MFENCE appears faster, however.
+       //     See https://blogs.oracle.com/dave/entry/instruction_selection_for_volatile_fences
+       //     as the situation has changed with Nehalem and Shanghai.
        // (3) In lieu of an explicit fence, use lock:addl to the top-of-stack
        //     The $lines underlying the top-of-stack should be in M-state.
        //     The locked add instruction is serializing, of course.
@@ -2126,11 +2111,7 @@
 
        movptr(Address(tmpReg, OM_OFFSET_NO_MONITOR_VALUE_TAG(owner)), NULL_WORD);
        if (os::is_MP()) {
-          if (VM_Version::supports_sse2() && 1 == FenceInstruction) {
-            mfence();
-          } else {
-            lock (); addptr(Address(rsp, 0), 0);
-          }
+         lock(); addptr(Address(rsp, 0), 0);
        }
        // Ratify _succ remains non-null
        cmpptr(Address(tmpReg, OM_OFFSET_NO_MONITOR_VALUE_TAG(succ)), 0);
@@ -2179,8 +2160,17 @@
     }
 #else // _LP64
     // It's inflated
-    movptr(boxReg, Address(tmpReg, OM_OFFSET_NO_MONITOR_VALUE_TAG(owner)));
-    xorptr(boxReg, r15_thread);
+    if (EmitSync & 1024) {
+      // Emit code to check that _owner == Self
+      // We could fold the _owner test into subsequent code more efficiently
+      // than using a stand-alone check, but since _owner checking is off by
+      // default we don't bother. We also might consider predicating the
+      // _owner==Self check on Xcheck:jni or running on a debug build.
+      movptr(boxReg, Address(tmpReg, OM_OFFSET_NO_MONITOR_VALUE_TAG(owner)));
+      xorptr(boxReg, r15_thread);
+    } else {
+      xorptr(boxReg, boxReg);
+    }
     orptr(boxReg, Address(tmpReg, OM_OFFSET_NO_MONITOR_VALUE_TAG(recursions)));
     jccb  (Assembler::notZero, DONE_LABEL);
     movptr(boxReg, Address(tmpReg, OM_OFFSET_NO_MONITOR_VALUE_TAG(cxq)));
@@ -2190,23 +2180,51 @@
     jmpb  (DONE_LABEL);
 
     if ((EmitSync & 65536) == 0) {
+      // Try to avoid passing control into the slow_path ...
       Label LSuccess, LGoSlowPath ;
       bind  (CheckSucc);
+
+      // The following optional optimization can be elided if necessary
+      // Effectively: if (succ == null) goto SlowPath
+      // The code reduces the window for a race, however,
+      // and thus benefits performance.
       cmpptr(Address(tmpReg, OM_OFFSET_NO_MONITOR_VALUE_TAG(succ)), (int32_t)NULL_WORD);
       jccb  (Assembler::zero, LGoSlowPath);
 
-      // I'd much rather use lock:andl m->_owner, 0 as it's faster than the
-      // the explicit ST;MEMBAR combination, but masm doesn't currently support
-      // "ANDQ M,IMM".  Don't use MFENCE here.  lock:add to TOS, xchg, etc
-      // are all faster when the write buffer is populated.
-      movptr(Address(tmpReg, OM_OFFSET_NO_MONITOR_VALUE_TAG(owner)), (int32_t)NULL_WORD);
-      if (os::is_MP()) {
-         lock (); addl (Address(rsp, 0), 0);
+      if ((EmitSync & 16) && os::is_MP()) {
+        orptr(boxReg, boxReg);
+        xchgptr(boxReg, Address(tmpReg, OM_OFFSET_NO_MONITOR_VALUE_TAG(owner)));
+      } else {
+        movptr(Address(tmpReg, OM_OFFSET_NO_MONITOR_VALUE_TAG(owner)), (int32_t)NULL_WORD);
+        if (os::is_MP()) {
+          // Memory barrier/fence
+          // Dekker pivot point -- fulcrum : ST Owner; MEMBAR; LD Succ
+          // Instead of MFENCE we use a dummy locked add of 0 to the top-of-stack.
+          // This is faster on Nehalem and AMD Shanghai/Barcelona.
+          // See https://blogs.oracle.com/dave/entry/instruction_selection_for_volatile_fences
+          // We might also restructure (ST Owner=0;barrier;LD _Succ) to
+          // (mov box,0; xchgq box, &m->Owner; LD _succ) .
+          lock(); addl(Address(rsp, 0), 0);
+        }
       }
       cmpptr(Address(tmpReg, OM_OFFSET_NO_MONITOR_VALUE_TAG(succ)), (int32_t)NULL_WORD);
       jccb  (Assembler::notZero, LSuccess);
 
-      movptr (boxReg, (int32_t)NULL_WORD);                   // box is really EAX
+      // Rare inopportune interleaving - race.
+      // The successor vanished in the small window above.
+      // The lock is contended -- (cxq|EntryList) != null -- and there's no apparent successor.
+      // We need to ensure progress and succession.
+      // Try to reacquire the lock.
+      // If that fails then the new owner is responsible for succession and this
+      // thread needs to take no further action and can exit via the fast path (success).
+      // If the re-acquire succeeds then pass control into the slow path.
+      // As implemented, this latter mode is horrible because we generated more
+      // coherence traffic on the lock *and* artifically extended the critical section
+      // length while by virtue of passing control into the slow path.
+
+      // box is really RAX -- the following CMPXCHG depends on that binding
+      // cmpxchg R,[M] is equivalent to rax = CAS(M,rax,R)
+      movptr(boxReg, (int32_t)NULL_WORD);
       if (os::is_MP()) { lock(); }
       cmpxchgptr(r15_thread, Address(tmpReg, OM_OFFSET_NO_MONITOR_VALUE_TAG(owner)));
       jccb  (Assembler::notEqual, LSuccess);
@@ -2231,10 +2249,6 @@
     }
 #endif
     bind(DONE_LABEL);
-    // Avoid branch to branch on AMD processors
-    if (EmitSync & 32768) {
-       nop();
-    }
   }
 }
 #endif // COMPILER2
--- a/hotspot/src/cpu/x86/vm/sharedRuntime_x86_32.cpp	Wed Apr 22 14:06:49 2015 -0400
+++ b/hotspot/src/cpu/x86/vm/sharedRuntime_x86_32.cpp	Thu Apr 23 16:09:21 2015 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2015, 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
@@ -2343,12 +2343,14 @@
 
     // should be a peal
     // +wordSize because of the push above
+    // args are (oop obj, BasicLock* lock, JavaThread* thread)
+    __ push(thread);
     __ lea(rax, Address(rbp, lock_slot_rbp_offset));
     __ push(rax);
 
     __ push(obj_reg);
     __ call(RuntimeAddress(CAST_FROM_FN_PTR(address, SharedRuntime::complete_monitor_unlocking_C)));
-    __ addptr(rsp, 2*wordSize);
+    __ addptr(rsp, 3*wordSize);
 #ifdef ASSERT
     {
       Label L;
--- a/hotspot/src/cpu/x86/vm/sharedRuntime_x86_64.cpp	Wed Apr 22 14:06:49 2015 -0400
+++ b/hotspot/src/cpu/x86/vm/sharedRuntime_x86_64.cpp	Thu Apr 23 16:09:21 2015 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2015, 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
@@ -2581,6 +2581,7 @@
     __ lea(c_rarg1, Address(rsp, lock_slot_offset * VMRegImpl::stack_slot_size));
 
     __ mov(c_rarg0, obj_reg);
+    __ mov(c_rarg2, r15_thread);
     __ mov(r12, rsp); // remember sp
     __ subptr(rsp, frame::arg_reg_save_area_bytes); // windows
     __ andptr(rsp, -16); // align stack as required by ABI
@@ -2590,6 +2591,7 @@
     __ movptr(rbx, Address(r15_thread, in_bytes(Thread::pending_exception_offset())));
     __ movptr(Address(r15_thread, in_bytes(Thread::pending_exception_offset())), (int32_t)NULL_WORD);
 
+    // args are (oop obj, BasicLock* lock, JavaThread* thread)
     __ call(RuntimeAddress(CAST_FROM_FN_PTR(address, SharedRuntime::complete_monitor_unlocking_C)));
     __ mov(rsp, r12); // restore sp
     __ reinit_heapbase();
--- a/hotspot/src/os/aix/vm/os_aix.cpp	Wed Apr 22 14:06:49 2015 -0400
+++ b/hotspot/src/os/aix/vm/os_aix.cpp	Thu Apr 23 16:09:21 2015 +0200
@@ -1268,6 +1268,10 @@
 // called from signal handler. Before adding something to os::abort(), make
 // sure it is async-safe and can handle partially initialized VM.
 void os::abort(bool dump_core) {
+  abort(dump_core, NULL, NULL);
+}
+
+void os::abort(bool dump_core, void* siginfo, void* context) {
   os::shutdown();
   if (dump_core) {
 #ifndef PRODUCT
@@ -2474,7 +2478,7 @@
   //
   if (!os::Aix::xpg_sus_mode()) {
 
-    if (StubRoutines::SafeFetch32_stub()) {
+    if (CanUseSafeFetch32()) {
 
       const bool read_protected =
         (SafeFetch32((int*)addr, 0x12345678) == 0x12345678 &&
--- a/hotspot/src/os/bsd/vm/os_bsd.cpp	Wed Apr 22 14:06:49 2015 -0400
+++ b/hotspot/src/os/bsd/vm/os_bsd.cpp	Thu Apr 23 16:09:21 2015 +0200
@@ -1132,6 +1132,10 @@
 // called from signal handler. Before adding something to os::abort(), make
 // sure it is async-safe and can handle partially initialized VM.
 void os::abort(bool dump_core) {
+  abort(dump_core, NULL, NULL);
+}
+
+void os::abort(bool dump_core, void* siginfo, void* context) {
   os::shutdown();
   if (dump_core) {
 #ifndef PRODUCT
@@ -1181,12 +1185,18 @@
   guarantee(retval != 0, "just checking");
   return retval;
 
-#elif __FreeBSD__
+#else
+  #ifdef __FreeBSD__
   retval = syscall(SYS_thr_self);
-#elif __OpenBSD__
+  #else
+    #ifdef __OpenBSD__
   retval = syscall(SYS_getthrid);
-#elif __NetBSD__
+    #else
+      #ifdef __NetBSD__
   retval = (pid_t) syscall(SYS__lwp_self);
+      #endif
+    #endif
+  #endif
 #endif
 
   if (retval == -1) {
--- a/hotspot/src/os/linux/vm/os_linux.cpp	Wed Apr 22 14:06:49 2015 -0400
+++ b/hotspot/src/os/linux/vm/os_linux.cpp	Thu Apr 23 16:09:21 2015 +0200
@@ -198,14 +198,20 @@
 // i386: 224, ia64: 1105, amd64: 186, sparc 143
   #ifdef __ia64__
     #define SYS_gettid 1105
-  #elif __i386__
-    #define SYS_gettid 224
-  #elif __amd64__
-    #define SYS_gettid 186
-  #elif __sparc__
-    #define SYS_gettid 143
   #else
-    #error define gettid for the arch
+    #ifdef __i386__
+      #define SYS_gettid 224
+    #else
+      #ifdef __amd64__
+        #define SYS_gettid 186
+      #else
+        #ifdef __sparc__
+          #define SYS_gettid 143
+        #else
+          #error define gettid for the arch
+        #endif
+      #endif
+    #endif
   #endif
 #endif
 
@@ -1473,6 +1479,10 @@
 // called from signal handler. Before adding something to os::abort(), make
 // sure it is async-safe and can handle partially initialized VM.
 void os::abort(bool dump_core) {
+  abort(dump_core, NULL, NULL);
+}
+
+void os::abort(bool dump_core, void* siginfo, void* context) {
   os::shutdown();
   if (dump_core) {
 #ifndef PRODUCT
--- a/hotspot/src/os/posix/vm/os_posix.cpp	Wed Apr 22 14:06:49 2015 -0400
+++ b/hotspot/src/os/posix/vm/os_posix.cpp	Thu Apr 23 16:09:21 2015 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2015, 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
@@ -46,7 +46,7 @@
 #define IS_VALID_PID(p) (p > 0 && p < MAX_PID)
 
 // Check core dump limit and report possible place where core can be found
-void os::check_or_create_dump(void* exceptionRecord, void* contextRecord, char* buffer, size_t bufferSize) {
+void os::check_dump_limit(char* buffer, size_t bufferSize) {
   int n;
   struct rlimit rlim;
   bool success;
@@ -82,7 +82,7 @@
     }
   }
 
-  VMError::report_coredump_status(buffer, success);
+  VMError::record_coredump_status(buffer, success);
 }
 
 int os::get_native_stack(address* stack, int frames, int toSkip) {
--- a/hotspot/src/os/solaris/vm/os_solaris.cpp	Wed Apr 22 14:06:49 2015 -0400
+++ b/hotspot/src/os/solaris/vm/os_solaris.cpp	Thu Apr 23 16:09:21 2015 +0200
@@ -1521,6 +1521,10 @@
 // called from signal handler. Before adding something to os::abort(), make
 // sure it is async-safe and can handle partially initialized VM.
 void os::abort(bool dump_core) {
+  abort(dump_core, NULL, NULL);
+}
+
+void os::abort(bool dump_core, void* siginfo, void* context) {
   os::shutdown();
   if (dump_core) {
 #ifndef PRODUCT
--- a/hotspot/src/os/windows/vm/os_windows.cpp	Wed Apr 22 14:06:49 2015 -0400
+++ b/hotspot/src/os/windows/vm/os_windows.cpp	Thu Apr 23 16:09:21 2015 +0200
@@ -114,10 +114,12 @@
 
 #ifdef _M_IA64
   #define __CPU__ ia64
-#elif _M_AMD64
-  #define __CPU__ amd64
 #else
-  #define __CPU__ i486
+  #ifdef _M_AMD64
+    #define __CPU__ amd64
+  #else
+    #define __CPU__ i486
+  #endif
 #endif
 
 // save DLL module handle, used by GetModuleFileName
@@ -987,7 +989,34 @@
                                          PMINIDUMP_USER_STREAM_INFORMATION,
                                          PMINIDUMP_CALLBACK_INFORMATION);
 
-void os::check_or_create_dump(void* exceptionRecord, void* contextRecord, char* buffer, size_t bufferSize) {
+static HANDLE dumpFile = NULL;
+
+// Check if dump file can be created.
+void os::check_dump_limit(char* buffer, size_t buffsz) {
+  bool status = true;
+  if (!FLAG_IS_DEFAULT(CreateCoredumpOnCrash) && !CreateCoredumpOnCrash) {
+    jio_snprintf(buffer, buffsz, "CreateCoredumpOnCrash is disabled from command line");
+    status = false;
+  } else {
+    const char* cwd = get_current_directory(NULL, 0);
+    int pid = current_process_id();
+    if (cwd != NULL) {
+      jio_snprintf(buffer, buffsz, "%s\\hs_err_pid%u.mdmp", cwd, pid);
+    } else {
+      jio_snprintf(buffer, buffsz, ".\\hs_err_pid%u.mdmp", pid);
+    }
+
+    if (dumpFile == NULL &&
+       (dumpFile = CreateFile(buffer, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL))
+                 == INVALID_HANDLE_VALUE) {
+      jio_snprintf(buffer, buffsz, "Failed to create minidump file (0x%x).", GetLastError());
+      status = false;
+    }
+  }
+  VMError::record_coredump_status(buffer, status);
+}
+
+void os::abort(bool dump_core, void* siginfo, void* context) {
   HINSTANCE dbghelp;
   EXCEPTION_POINTERS ep;
   MINIDUMP_EXCEPTION_INFORMATION mei;
@@ -995,33 +1024,22 @@
 
   HANDLE hProcess = GetCurrentProcess();
   DWORD processId = GetCurrentProcessId();
-  HANDLE dumpFile;
   MINIDUMP_TYPE dumpType;
-  static const char* cwd;
-
-// Default is to always create dump for debug builds, on product builds only dump on server versions of Windows.
-#ifndef ASSERT
-  // If running on a client version of Windows and user has not explicitly enabled dumping
-  if (!os::win32::is_windows_server() && !CreateMinidumpOnCrash) {
-    VMError::report_coredump_status("Minidumps are not enabled by default on client versions of Windows", false);
-    return;
-    // If running on a server version of Windows and user has explictly disabled dumping
-  } else if (os::win32::is_windows_server() && !FLAG_IS_DEFAULT(CreateMinidumpOnCrash) && !CreateMinidumpOnCrash) {
-    VMError::report_coredump_status("Minidump has been disabled from the command line", false);
-    return;
-  }
-#else
-  if (!FLAG_IS_DEFAULT(CreateMinidumpOnCrash) && !CreateMinidumpOnCrash) {
-    VMError::report_coredump_status("Minidump has been disabled from the command line", false);
-    return;
-  }
-#endif
+
+  shutdown();
+  if (!dump_core || dumpFile == NULL) {
+    if (dumpFile != NULL) {
+      CloseHandle(dumpFile);
+    }
+    win32::exit_process_or_thread(win32::EPT_PROCESS, 1);
+  }
 
   dbghelp = os::win32::load_Windows_dll("DBGHELP.DLL", NULL, 0);
 
   if (dbghelp == NULL) {
-    VMError::report_coredump_status("Failed to load dbghelp.dll", false);
-    return;
+    jio_fprintf(stderr, "Failed to load dbghelp.dll\n");
+    CloseHandle(dumpFile);
+    win32::exit_process_or_thread(win32::EPT_PROCESS, 1);
   }
 
   _MiniDumpWriteDump =
@@ -1033,30 +1051,23 @@
                                     "MiniDumpWriteDump"));
 
   if (_MiniDumpWriteDump == NULL) {
-    VMError::report_coredump_status("Failed to find MiniDumpWriteDump() in module dbghelp.dll", false);
-    return;
+    jio_fprintf(stderr, "Failed to find MiniDumpWriteDump() in module dbghelp.dll.\n");
+    CloseHandle(dumpFile);
+    win32::exit_process_or_thread(win32::EPT_PROCESS, 1);
   }
 
   dumpType = (MINIDUMP_TYPE)(MiniDumpWithFullMemory | MiniDumpWithHandleData);
 
-// Older versions of dbghelp.h doesn't contain all the dumptypes we want, dbghelp.h with
-// API_VERSION_NUMBER 11 or higher contains the ones we want though
+  // Older versions of dbghelp.h do not contain all the dumptypes we want, dbghelp.h with
+  // API_VERSION_NUMBER 11 or higher contains the ones we want though
 #if API_VERSION_NUMBER >= 11
   dumpType = (MINIDUMP_TYPE)(dumpType | MiniDumpWithFullMemoryInfo | MiniDumpWithThreadInfo |
                              MiniDumpWithUnloadedModules);
 #endif
 
-  cwd = get_current_directory(NULL, 0);
-  jio_snprintf(buffer, bufferSize, "%s\\hs_err_pid%u.mdmp", cwd, current_process_id());
-  dumpFile = CreateFile(buffer, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
-
-  if (dumpFile == INVALID_HANDLE_VALUE) {
-    VMError::report_coredump_status("Failed to create file for dumping", false);
-    return;
-  }
-  if (exceptionRecord != NULL && contextRecord != NULL) {
-    ep.ContextRecord = (PCONTEXT) contextRecord;
-    ep.ExceptionRecord = (PEXCEPTION_RECORD) exceptionRecord;
+  if (siginfo != NULL && context != NULL) {
+    ep.ContextRecord = (PCONTEXT) context;
+    ep.ExceptionRecord = (PEXCEPTION_RECORD) siginfo;
 
     mei.ThreadId = GetCurrentThreadId();
     mei.ExceptionPointers = &ep;
@@ -1065,38 +1076,18 @@
     pmei = NULL;
   }
 
-
   // Older versions of dbghelp.dll (the one shipped with Win2003 for example) may not support all
   // the dump types we really want. If first call fails, lets fall back to just use MiniDumpWithFullMemory then.
   if (_MiniDumpWriteDump(hProcess, processId, dumpFile, dumpType, pmei, NULL, NULL) == false &&
       _MiniDumpWriteDump(hProcess, processId, dumpFile, (MINIDUMP_TYPE)MiniDumpWithFullMemory, pmei, NULL, NULL) == false) {
-    DWORD error = GetLastError();
-    LPTSTR msgbuf = NULL;
-
-    if (FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER |
-                      FORMAT_MESSAGE_FROM_SYSTEM |
-                      FORMAT_MESSAGE_IGNORE_INSERTS,
-                      NULL, error, 0, (LPTSTR)&msgbuf, 0, NULL) != 0) {
-
-      jio_snprintf(buffer, bufferSize, "Call to MiniDumpWriteDump() failed (Error 0x%x: %s)", error, msgbuf);
-      LocalFree(msgbuf);
-    } else {
-      // Call to FormatMessage failed, just include the result from GetLastError
-      jio_snprintf(buffer, bufferSize, "Call to MiniDumpWriteDump() failed (Error 0x%x)", error);
-    }
-    VMError::report_coredump_status(buffer, false);
-  } else {
-    VMError::report_coredump_status(buffer, true);
-  }
-
+    jio_fprintf(stderr, "Call to MiniDumpWriteDump() failed (Error 0x%x)\n", GetLastError());
+  }
   CloseHandle(dumpFile);
-}
-
+  win32::exit_process_or_thread(win32::EPT_PROCESS, 1);
+}
 
 void os::abort(bool dump_core) {
-  os::shutdown();
-  // no core dump on Windows
-  win32::exit_process_or_thread(win32::EPT_PROCESS, 1);
+  abort(dump_core, NULL, NULL);
 }
 
 // Die immediately, no exit hook, no abort hook, no cleanup.
@@ -2101,20 +2092,22 @@
   // at the beginning of the target bundle.
   exceptionInfo->ContextRecord->StIPSR &= 0xFFFFF9FFFFFFFFFF;
   assert(((DWORD64)handler & 0xF) == 0, "Target address must point to the beginning of a bundle!");
-#elif _M_AMD64
+#else
+  #ifdef _M_AMD64
   // Do not blow up if no thread info available.
   if (thread) {
     thread->set_saved_exception_pc((address)(DWORD_PTR)exceptionInfo->ContextRecord->Rip);
   }
   // Set pc to handler
   exceptionInfo->ContextRecord->Rip = (DWORD64)handler;
-#else
+  #else
   // Do not blow up if no thread info available.
   if (thread) {
     thread->set_saved_exception_pc((address)(DWORD_PTR)exceptionInfo->ContextRecord->Eip);
   }
   // Set pc to handler
   exceptionInfo->ContextRecord->Eip = (DWORD)(DWORD_PTR)handler;
+  #endif
 #endif
 
   // Continue the execution
@@ -2213,7 +2206,8 @@
   // (division by zero is handled explicitly)
 #ifdef _M_IA64
   assert(0, "Fix Handle_IDiv_Exception");
-#elif _M_AMD64
+#else
+  #ifdef  _M_AMD64
   PCONTEXT ctx = exceptionInfo->ContextRecord;
   address pc = (address)ctx->Rip;
   assert(pc[0] == 0xF7, "not an idiv opcode");
@@ -2224,7 +2218,7 @@
   ctx->Rax = (DWORD)min_jint;      // result
   ctx->Rdx = (DWORD)0;             // remainder
   // Continue the execution
-#else
+  #else
   PCONTEXT ctx = exceptionInfo->ContextRecord;
   address pc = (address)ctx->Eip;
   assert(pc[0] == 0xF7, "not an idiv opcode");
@@ -2235,6 +2229,7 @@
   ctx->Eax = (DWORD)min_jint;      // result
   ctx->Edx = (DWORD)0;             // remainder
   // Continue the execution
+  #endif
 #endif
   return EXCEPTION_CONTINUE_EXECUTION;
 }
@@ -2307,10 +2302,12 @@
   // This is needed for IA64 because "relocation" / "implicit null check" / "poll instruction"
   // information is saved in the Unix format.
   address pc_unix_format = (address) ((((uint64_t)pc) & 0xFFFFFFFFFFFFFFF0) | ((((uint64_t)pc) & 0xF) >> 2));
-#elif _M_AMD64
+#else
+  #ifdef _M_AMD64
   address pc = (address) exceptionInfo->ContextRecord->Rip;
-#else
+  #else
   address pc = (address) exceptionInfo->ContextRecord->Eip;
+  #endif
 #endif
   Thread* t = ThreadLocalStorage::get_thread_slow();          // slow & steady
 
--- a/hotspot/src/share/vm/adlc/formssel.cpp	Wed Apr 22 14:06:49 2015 -0400
+++ b/hotspot/src/share/vm/adlc/formssel.cpp	Thu Apr 23 16:09:21 2015 +0200
@@ -3392,7 +3392,7 @@
 // Count occurrences of operands names in the leaves of the instruction
 // match rule.
 void MatchNode::count_instr_names( Dict &names ) {
-  if( !this ) return;
+  if( this == NULL ) return;
   if( _lChild ) _lChild->count_instr_names(names);
   if( _rChild ) _rChild->count_instr_names(names);
   if( !_lChild && !_rChild ) {
--- a/hotspot/src/share/vm/classfile/javaClasses.cpp	Wed Apr 22 14:06:49 2015 -0400
+++ b/hotspot/src/share/vm/classfile/javaClasses.cpp	Thu Apr 23 16:09:21 2015 +0200
@@ -126,7 +126,7 @@
       tty->print_cr("  name: %s, sig: %s, flags: %08x", fs.name()->as_C_string(), fs.signature()->as_C_string(), fs.access_flags().as_int());
     }
 #endif //PRODUCT
-    fatal("Invalid layout of preloaded class");
+    vm_exit_during_initialization("Invalid layout of preloaded class: use -XX:+TraceClassLoading to see the origin of the problem class");
   }
   dest_offset = fd.offset();
 }
@@ -3626,7 +3626,7 @@
     tty->print_cr("  name: %s, sig: %s, flags: %08x", fs.name()->as_C_string(), fs.signature()->as_C_string(), fs.access_flags().as_int());
   }
 #endif //PRODUCT
-  fatal("Invalid layout of preloaded class");
+  vm_exit_during_initialization("Invalid layout of preloaded class: use -XX:+TraceClassLoading to see the origin of the problem class");
   return -1;
 }
 
--- a/hotspot/src/share/vm/classfile/vmSymbols.hpp	Wed Apr 22 14:06:49 2015 -0400
+++ b/hotspot/src/share/vm/classfile/vmSymbols.hpp	Thu Apr 23 16:09:21 2015 +0200
@@ -531,18 +531,17 @@
   template(java_lang_management_ThreadState,           "java/lang/management/ThreadState")                        \
   template(java_lang_management_MemoryUsage,           "java/lang/management/MemoryUsage")                        \
   template(java_lang_management_ThreadInfo,            "java/lang/management/ThreadInfo")                         \
-  template(sun_management_ManagementFactory,           "sun/management/ManagementFactory")                        \
   template(sun_management_Sensor,                      "sun/management/Sensor")                                   \
   template(sun_management_Agent,                       "sun/management/Agent")                                    \
-  template(sun_management_DiagnosticCommandImpl,       "sun/management/DiagnosticCommandImpl")                    \
-  template(sun_management_GarbageCollectorImpl,        "sun/management/GarbageCollectorImpl")                     \
+  template(com_sun_management_internal_DiagnosticCommandImpl,  "com/sun/management/internal/DiagnosticCommandImpl")     \
+  template(com_sun_management_internal_GarbageCollectorExtImpl,"com/sun/management/internal/GarbageCollectorExtImpl")   \
   template(sun_management_ManagementFactoryHelper,     "sun/management/ManagementFactoryHelper")                  \
   template(getDiagnosticCommandMBean_name,             "getDiagnosticCommandMBean")                               \
   template(getDiagnosticCommandMBean_signature,        "()Lcom/sun/management/DiagnosticCommandMBean;")           \
   template(getGcInfoBuilder_name,                      "getGcInfoBuilder")                                        \
-  template(getGcInfoBuilder_signature,                 "()Lsun/management/GcInfoBuilder;")                        \
+  template(getGcInfoBuilder_signature,                 "()Lcom/sun/management/internal/GcInfoBuilder;")           \
   template(com_sun_management_GcInfo,                  "com/sun/management/GcInfo")                               \
-  template(com_sun_management_GcInfo_constructor_signature, "(Lsun/management/GcInfoBuilder;JJJ[Ljava/lang/management/MemoryUsage;[Ljava/lang/management/MemoryUsage;[Ljava/lang/Object;)V") \
+  template(com_sun_management_GcInfo_constructor_signature, "(Lcom/sun/management/internal/GcInfoBuilder;JJJ[Ljava/lang/management/MemoryUsage;[Ljava/lang/management/MemoryUsage;[Ljava/lang/Object;)V") \
   template(createGCNotification_name,                  "createGCNotification")                                    \
   template(createGCNotification_signature,             "(JLjava/lang/String;Ljava/lang/String;Ljava/lang/String;Lcom/sun/management/GcInfo;)V") \
   template(createDiagnosticFrameworkNotification_name, "createDiagnosticFrameworkNotification")                   \
--- a/hotspot/src/share/vm/libadt/set.cpp	Wed Apr 22 14:06:49 2015 -0400
+++ b/hotspot/src/share/vm/libadt/set.cpp	Thu Apr 23 16:09:21 2015 +0200
@@ -57,7 +57,7 @@
 // The caller must deallocate the string.
 char *Set::setstr() const
 {
-  if( !this ) return os::strdup("{no set}");
+  if( this == NULL ) return os::strdup("{no set}");
   Set &set = clone();           // Virtually copy the basic set.
   set.Sort();                   // Sort elements for in-order retrieval
 
--- a/hotspot/src/share/vm/opto/chaitin.cpp	Wed Apr 22 14:06:49 2015 -0400
+++ b/hotspot/src/share/vm/opto/chaitin.cpp	Thu Apr 23 16:09:21 2015 +0200
@@ -2095,7 +2095,7 @@
 // Dump a register name into a buffer.  Be intelligent if we get called
 // before allocation is complete.
 char *PhaseChaitin::dump_register( const Node *n, char *buf  ) const {
-  if( !this ) {                 // Not got anything?
+  if( this == NULL ) {          // Not got anything?
     sprintf(buf,"N%d",n->_idx); // Then use Node index
   } else if( _node_regs ) {
     // Post allocation, use direct mappings, no LRG info available
--- a/hotspot/src/share/vm/opto/macro.cpp	Wed Apr 22 14:06:49 2015 -0400
+++ b/hotspot/src/share/vm/opto/macro.cpp	Thu Apr 23 16:09:21 2015 +0200
@@ -144,7 +144,9 @@
 }
 
 //------------------------------make_slow_call---------------------------------
-CallNode* PhaseMacroExpand::make_slow_call(CallNode *oldcall, const TypeFunc* slow_call_type, address slow_call, const char* leaf_name, Node* slow_path, Node* parm0, Node* parm1) {
+CallNode* PhaseMacroExpand::make_slow_call(CallNode *oldcall, const TypeFunc* slow_call_type,
+                                           address slow_call, const char* leaf_name, Node* slow_path,
+                                           Node* parm0, Node* parm1, Node* parm2) {
 
   // Slow-path call
  CallNode *call = leaf_name
@@ -155,6 +157,7 @@
   copy_predefined_input_for_runtime_call(slow_path, oldcall, call );
   if (parm0 != NULL)  call->init_req(TypeFunc::Parms+0, parm0);
   if (parm1 != NULL)  call->init_req(TypeFunc::Parms+1, parm1);
+  if (parm2 != NULL)  call->init_req(TypeFunc::Parms+2, parm2);
   copy_call_debug_info(oldcall, call);
   call->set_cnt(PROB_UNLIKELY_MAG(4));  // Same effect as RC_UNCOMMON.
   _igvn.replace_node(oldcall, call);
@@ -2328,7 +2331,9 @@
   }
 
   // Make slow path call
-  CallNode *call = make_slow_call( (CallNode *) lock, OptoRuntime::complete_monitor_enter_Type(), OptoRuntime::complete_monitor_locking_Java(), NULL, slow_path, obj, box );
+  CallNode *call = make_slow_call((CallNode *) lock, OptoRuntime::complete_monitor_enter_Type(),
+                                  OptoRuntime::complete_monitor_locking_Java(), NULL, slow_path,
+                                  obj, box, NULL);
 
   extract_call_projections(call);
 
@@ -2395,8 +2400,11 @@
   funlock = transform_later( funlock )->as_FastUnlock();
   // Optimize test; set region slot 2
   Node *slow_path = opt_bits_test(ctrl, region, 2, funlock, 0, 0);
+  Node *thread = transform_later(new ThreadLocalNode());
 
-  CallNode *call = make_slow_call( (CallNode *) unlock, OptoRuntime::complete_monitor_exit_Type(), CAST_FROM_FN_PTR(address, SharedRuntime::complete_monitor_unlocking_C), "complete_monitor_unlocking_C", slow_path, obj, box );
+  CallNode *call = make_slow_call((CallNode *) unlock, OptoRuntime::complete_monitor_exit_Type(),
+                                  CAST_FROM_FN_PTR(address, SharedRuntime::complete_monitor_unlocking_C),
+                                  "complete_monitor_unlocking_C", slow_path, obj, box, thread);
 
   extract_call_projections(call);
 
--- a/hotspot/src/share/vm/opto/macro.hpp	Wed Apr 22 14:06:49 2015 -0400
+++ b/hotspot/src/share/vm/opto/macro.hpp	Thu Apr 23 16:09:21 2015 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2015, 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
@@ -186,7 +186,8 @@
   Node* opt_bits_test(Node* ctrl, Node* region, int edge, Node* word, int mask, int bits, bool return_fast_path = false);
   void copy_predefined_input_for_runtime_call(Node * ctrl, CallNode* oldcall, CallNode* call);
   CallNode* make_slow_call(CallNode *oldcall, const TypeFunc* slow_call_type, address slow_call,
-                       const char* leaf_name, Node* slow_path, Node* parm0, Node* parm1);
+                           const char* leaf_name, Node* slow_path, Node* parm0, Node* parm1,
+                           Node* parm2);
   void extract_call_projections(CallNode *call);
 
   Node* initialize_object(AllocateNode* alloc,
--- a/hotspot/src/share/vm/opto/runtime.cpp	Wed Apr 22 14:06:49 2015 -0400
+++ b/hotspot/src/share/vm/opto/runtime.cpp	Thu Apr 23 16:09:21 2015 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2015, 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
@@ -600,10 +600,11 @@
 //-----------------------------------------------------------------------------
 const TypeFunc *OptoRuntime::complete_monitor_exit_Type() {
   // create input type (domain)
-  const Type **fields = TypeTuple::fields(2);
+  const Type **fields = TypeTuple::fields(3);
   fields[TypeFunc::Parms+0] = TypeInstPtr::NOTNULL;  // Object to be Locked
-  fields[TypeFunc::Parms+1] = TypeRawPtr::BOTTOM;   // Address of stack location for lock
-  const TypeTuple *domain = TypeTuple::make(TypeFunc::Parms+2,fields);
+  fields[TypeFunc::Parms+1] = TypeRawPtr::BOTTOM;    // Address of stack location for lock - BasicLock
+  fields[TypeFunc::Parms+2] = TypeRawPtr::BOTTOM;    // Thread pointer (Self)
+  const TypeTuple *domain = TypeTuple::make(TypeFunc::Parms+3,fields);
 
   // create result type (range)
   fields = TypeTuple::fields(0);
--- a/hotspot/src/share/vm/opto/runtime.hpp	Wed Apr 22 14:06:49 2015 -0400
+++ b/hotspot/src/share/vm/opto/runtime.hpp	Thu Apr 23 16:09:21 2015 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2015, 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
@@ -184,7 +184,7 @@
 public:
   // Slow-path Locking and Unlocking
   static void complete_monitor_locking_C(oopDesc* obj, BasicLock* lock, JavaThread* thread);
-  static void complete_monitor_unlocking_C(oopDesc* obj, BasicLock* lock);
+  static void complete_monitor_unlocking_C(oopDesc* obj, BasicLock* lock, JavaThread* thread);
 
 private:
 
--- a/hotspot/src/share/vm/prims/jvmtiRedefineClasses.cpp	Wed Apr 22 14:06:49 2015 -0400
+++ b/hotspot/src/share/vm/prims/jvmtiRedefineClasses.cpp	Thu Apr 23 16:09:21 2015 +0200
@@ -3992,14 +3992,13 @@
     // the_class doesn't have a cache yet so copy it
     the_class->set_cached_class_file(scratch_class->get_cached_class_file());
   }
-#ifndef PRODUCT
-  else {
-    assert(the_class->get_cached_class_file_bytes() ==
-      scratch_class->get_cached_class_file_bytes(), "cache ptrs must match");
-    assert(the_class->get_cached_class_file_len() ==
-      scratch_class->get_cached_class_file_len(), "cache lens must match");
+  else if (scratch_class->get_cached_class_file_bytes() !=
+           the_class->get_cached_class_file_bytes()) {
+    // The same class can be present twice in the scratch classes list or there
+    // are multiple concurrent RetransformClasses calls on different threads.
+    // In such cases we have to deallocate scratch_class cached_class_file_bytes.
+    os::free(scratch_class->get_cached_class_file_bytes());
   }
-#endif
 
   // NULL out in scratch class to not delete twice.  The class to be redefined
   // always owns these bytes.
--- a/hotspot/src/share/vm/prims/whitebox.cpp	Wed Apr 22 14:06:49 2015 -0400
+++ b/hotspot/src/share/vm/prims/whitebox.cpp	Thu Apr 23 16:09:21 2015 +0200
@@ -1201,7 +1201,7 @@
   if (res == NULL) {
     tty->print_cr("Invalid layout of %s at %s", ik->external_name(),
         name_symbol->as_C_string());
-    fatal("Invalid layout of preloaded class");
+    vm_exit_during_initialization("Invalid layout of preloaded class: use -XX:+TraceClassLoading to see the origin of the problem class");
   }
 
   //fetch the field at the offset we've found
--- a/hotspot/src/share/vm/runtime/arguments.cpp	Wed Apr 22 14:06:49 2015 -0400
+++ b/hotspot/src/share/vm/runtime/arguments.cpp	Thu Apr 23 16:09:21 2015 +0200
@@ -288,11 +288,8 @@
     // <flag>=xxx form
     // [-|+]<flag> form
     size_t len = strlen(flag_status.name);
-    if (((strncmp(flag_status.name, s, len) == 0) &&
-         (strlen(s) == len)) ||
-        ((s[0] == '+' || s[0] == '-') &&
-         (strncmp(flag_status.name, &s[1], len) == 0) &&
-         (strlen(&s[1]) == len))) {
+    if ((strncmp(flag_status.name, s, len) == 0) &&
+        (strlen(s) == len)){
       if (JDK_Version::current().compare(flag_status.accept_until) == -1) {
           *version = flag_status.obsoleted_in;
           return true;
@@ -808,17 +805,9 @@
     return true;
   }
 
+  // Determine if the flag has '+', '-', or '=' characters.
   bool has_plus_minus = (*arg == '+' || *arg == '-');
   const char* const argname = has_plus_minus ? arg + 1 : arg;
-  if (is_newly_obsolete(arg, &since)) {
-    char version[256];
-    since.to_string(version, sizeof(version));
-    warning("ignoring option %s; support was removed in %s", argname, version);
-    return true;
-  }
-
-  // For locked flags, report a custom error message if available.
-  // Otherwise, report the standard unrecognized VM option.
 
   size_t arg_len;
   const char* equal_sign = strchr(argname, '=');
@@ -828,6 +817,20 @@
     arg_len = equal_sign - argname;
   }
 
+  // Construct a string which consists only of the argument name without '+', '-', or '='.
+  char stripped_argname[256];
+  strncpy(stripped_argname, argname, arg_len);
+  stripped_argname[arg_len] = '\0'; //strncpy doesn't null terminate.
+
+  if (is_newly_obsolete(stripped_argname, &since)) {
+    char version[256];
+    since.to_string(version, sizeof(version));
+    warning("ignoring option %s; support was removed in %s", stripped_argname, version);
+    return true;
+  }
+
+  // For locked flags, report a custom error message if available.
+  // Otherwise, report the standard unrecognized VM option.
   Flag* found_flag = Flag::find_flag((const char*)argname, arg_len, true, true);
   if (found_flag != NULL) {
     char locked_message_buf[BUFLEN];
@@ -856,16 +859,8 @@
                   (fuzzy_matched->is_bool()) ? "(+/-)" : "",
                   fuzzy_matched->_name,
                   (fuzzy_matched->is_bool()) ? "" : "=<value>");
-      if (is_newly_obsolete(fuzzy_matched->_name, &since)) {
-        char version[256];
-        since.to_string(version, sizeof(version));
-        jio_fprintf(defaultStream::error_stream(),
-                    "Warning: support for %s was removed in %s\n",
-                    fuzzy_matched->_name,
-                    version);
     }
   }
-  }
 
   // allow for commandline "commenting out" options like -XX:#+Verbose
   return arg[0] == '#';
@@ -3026,8 +3021,7 @@
     } else if (match_option(option, "-Xnoagent")) {
       // For compatibility with classic. HotSpot refuses to load the old style agent.dll.
     } else if (match_option(option, "-Xboundthreads")) {
-      // Bind user level threads to kernel threads (Solaris only)
-      FLAG_SET_CMDLINE(bool, UseBoundThreads, true);
+      // Ignore silently for compatibility
     } else if (match_option(option, "-Xloggc:", &tail)) {
       // Redirect GC output to the file. -Xloggc:<filename>
       // ostream_init_log(), when called will use this filename
@@ -3257,6 +3251,15 @@
           "ManagementServer is not supported in this VM.\n");
         return JNI_ERR;
 #endif // INCLUDE_MANAGEMENT
+    // CreateMinidumpOnCrash is removed, and replaced by CreateCoredumpOnCrash
+    } else if (match_option(option, "-XX:+CreateMinidumpOnCrash")) {
+      FLAG_SET_CMDLINE(bool, CreateCoredumpOnCrash, true);
+      jio_fprintf(defaultStream::output_stream(),
+          "CreateMinidumpOnCrash is replaced by CreateCoredumpOnCrash: CreateCoredumpOnCrash is on\n");
+    } else if (match_option(option, "-XX:-CreateMinidumpOnCrash")) {
+      FLAG_SET_CMDLINE(bool, CreateCoredumpOnCrash, false);
+      jio_fprintf(defaultStream::output_stream(),
+          "CreateMinidumpOnCrash is replaced by CreateCoredumpOnCrash: CreateCoredumpOnCrash is off\n");
     } else if (match_option(option, "-XX:", &tail)) { // -XX:xxxx
       // Skip -XX:Flags= since that case has already been handled
       if (strncmp(tail, "Flags=", strlen("Flags=")) != 0) {
@@ -3730,8 +3733,8 @@
       CommandLineFlags::printFlags(tty, false);
       vm_exit(0);
     }
+    if (match_option(option, "-XX:NativeMemoryTracking", &tail)) {
 #if INCLUDE_NMT
-    if (match_option(option, "-XX:NativeMemoryTracking", &tail)) {
       // The launcher did not setup nmt environment variable properly.
       if (!MemTracker::check_launcher_nmt_support(tail)) {
         warning("Native Memory Tracking did not setup properly, using wrong launcher?");
@@ -3747,9 +3750,12 @@
         vm_exit_during_initialization("Syntax error, expecting -XX:NativeMemoryTracking=[off|summary|detail]", NULL);
       }
       continue;
-    }
+#else
+      jio_fprintf(defaultStream::error_stream(),
+        "Native Memory Tracking is not supported in this VM\n");
+      return JNI_ERR;
 #endif
-
+    }
 
 #ifndef PRODUCT
     if (match_option(option, "-XX:+PrintFlagsWithComments")) {
--- a/hotspot/src/share/vm/runtime/globals.hpp	Wed Apr 22 14:06:49 2015 -0400
+++ b/hotspot/src/share/vm/runtime/globals.hpp	Thu Apr 23 16:09:21 2015 +0200
@@ -677,9 +677,6 @@
   product(bool, PrintVMQWaitTime, false,                                    \
           "Print out the waiting time in VM operation queue")               \
                                                                             \
-  develop(bool, NoYieldsInMicrolock, false,                                 \
-          "Disable yields in microlock")                                    \
-                                                                            \
   develop(bool, TraceOopMapGeneration, false,                               \
           "Show OopMapGeneration")                                          \
                                                                             \
@@ -936,8 +933,8 @@
   product(bool, ShowMessageBoxOnError, false,                               \
           "Keep process alive on VM fatal error")                           \
                                                                             \
-  product(bool, CreateMinidumpOnCrash, false,                               \
-          "Create minidump on VM fatal error")                              \
+  product(bool, CreateCoredumpOnCrash, true,                                \
+          "Create core/mini dump on VM fatal error")                        \
                                                                             \
   product_pd(bool, UseOSErrorReporting,                                     \
           "Let VM fatal error propagate to the OS (ie. WER on Windows)")    \
@@ -1157,9 +1154,6 @@
           "Convert yield to a sleep of MinSleepInterval to simulate Win32 " \
           "behavior")                                                       \
                                                                             \
-  product(bool, UseBoundThreads, true,                                      \
-          "Bind user level threads to kernel threads (for Solaris only)")   \
-                                                                            \
   develop(bool, UseDetachedThreads, true,                                   \
           "Use detached threads that are recycled upon termination "        \
           "(for Solaris only)")                                             \
@@ -3441,10 +3435,6 @@
   product(bool, ThreadPriorityVerbose, false,                               \
           "Print priority changes")                                         \
                                                                             \
-  product(intx, DefaultThreadPriority, -1,                                  \
-          "The native priority at which threads run if not elsewhere "      \
-          "specified (-1 means no change)")                                 \
-                                                                            \
   product(intx, CompilerThreadPriority, -1,                                 \
           "The native priority at which compiler threads should run "       \
           "(-1 means no change)")                                           \
--- a/hotspot/src/share/vm/runtime/os.hpp	Wed Apr 22 14:06:49 2015 -0400
+++ b/hotspot/src/share/vm/runtime/os.hpp	Thu Apr 23 16:09:21 2015 +0200
@@ -492,6 +492,7 @@
 
   // Terminate with an error.  Default is to generate a core file on platforms
   // that support such things.  This calls shutdown() and then aborts.
+  static void abort(bool dump_core, void *siginfo, void *context);
   static void abort(bool dump_core = true);
 
   // Die immediately, no exit hook, no abort hook, no cleanup.
@@ -716,8 +717,13 @@
   // Structured OS Exception support
   static void os_exception_wrapper(java_call_t f, JavaValue* value, methodHandle* method, JavaCallArguments* args, Thread* thread);
 
-  // On Windows this will create an actual minidump, on Linux/Solaris it will simply check core dump limits
-  static void check_or_create_dump(void* exceptionRecord, void* contextRecord, char* buffer, size_t bufferSize);
+  // On Posix compatible OS it will simply check core dump limits while on Windows
+  // it will check if dump file can be created. Check or prepare a core dump to be
+  // taken at a later point in the same thread in os::abort(). Use the caller
+  // provided buffer as a scratch buffer. The status message which will be written
+  // into the error log either is file location or a short error message, depending
+  // on the checking result.
+  static void check_dump_limit(char* buffer, size_t bufferSize);
 
   // Get the default path to the core file
   // Returns the length of the string
--- a/hotspot/src/share/vm/runtime/sharedRuntime.cpp	Wed Apr 22 14:06:49 2015 -0400
+++ b/hotspot/src/share/vm/runtime/sharedRuntime.cpp	Thu Apr 23 16:09:21 2015 +0200
@@ -1819,9 +1819,9 @@
 JRT_END
 
 // Handles the uncommon cases of monitor unlocking in compiled code
-JRT_LEAF(void, SharedRuntime::complete_monitor_unlocking_C(oopDesc* _obj, BasicLock* lock))
+JRT_LEAF(void, SharedRuntime::complete_monitor_unlocking_C(oopDesc* _obj, BasicLock* lock, JavaThread * THREAD))
    oop obj(_obj);
-  Thread* THREAD = JavaThread::current();
+  assert(JavaThread::current() == THREAD, "invariant");
   // I'm not convinced we need the code contained by MIGHT_HAVE_PENDING anymore
   // testing was unable to ever fire the assert that guarded it so I have removed it.
   assert(!HAS_PENDING_EXCEPTION, "Do we need code below anymore?");
--- a/hotspot/src/share/vm/runtime/sharedRuntime.hpp	Wed Apr 22 14:06:49 2015 -0400
+++ b/hotspot/src/share/vm/runtime/sharedRuntime.hpp	Thu Apr 23 16:09:21 2015 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2015, 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
@@ -472,7 +472,7 @@
 
   // Slow-path Locking and Unlocking
   static void complete_monitor_locking_C(oopDesc* obj, BasicLock* lock, JavaThread* thread);
-  static void complete_monitor_unlocking_C(oopDesc* obj, BasicLock* lock);
+  static void complete_monitor_unlocking_C(oopDesc* obj, BasicLock* lock, JavaThread* thread);
 
   // Resolving of calls
   static address resolve_static_call_C     (JavaThread *thread);
--- a/hotspot/src/share/vm/runtime/synchronizer.cpp	Wed Apr 22 14:06:49 2015 -0400
+++ b/hotspot/src/share/vm/runtime/synchronizer.cpp	Thu Apr 23 16:09:21 2015 +0200
@@ -109,17 +109,24 @@
 }
 
 #define NINFLATIONLOCKS 256
-static volatile intptr_t InflationLocks[NINFLATIONLOCKS];
+static volatile intptr_t gInflationLocks[NINFLATIONLOCKS];
 
+// global list of blocks of monitors
 // gBlockList is really PaddedEnd<ObjectMonitor> *, but we don't
 // want to expose the PaddedEnd template more than necessary.
 ObjectMonitor * ObjectSynchronizer::gBlockList = NULL;
+// global monitor free list
 ObjectMonitor * volatile ObjectSynchronizer::gFreeList  = NULL;
+// global monitor in-use list, for moribund threads,
+// monitors they inflated need to be scanned for deflation
 ObjectMonitor * volatile ObjectSynchronizer::gOmInUseList  = NULL;
+// count of entries in gOmInUseList
 int ObjectSynchronizer::gOmInUseCount = 0;
-static volatile intptr_t ListLock = 0;      // protects global monitor free-list cache
-static volatile int MonitorFreeCount  = 0;  // # on gFreeList
-static volatile int MonitorPopulation = 0;  // # Extant -- in circulation
+
+static volatile intptr_t gListLock = 0;      // protects global monitor lists
+static volatile int gMonitorFreeCount  = 0;  // # on gFreeList
+static volatile int gMonitorPopulation = 0;  // # Extant -- in circulation
+
 #define CHAINMARKER (cast_to_oop<intptr_t>(-1))
 
 
@@ -528,7 +535,7 @@
         int YieldThenBlock = 0;
         assert(ix >= 0 && ix < NINFLATIONLOCKS, "invariant");
         assert((NINFLATIONLOCKS & (NINFLATIONLOCKS-1)) == 0, "invariant");
-        Thread::muxAcquire(InflationLocks + ix, "InflationLock");
+        Thread::muxAcquire(gInflationLocks + ix, "gInflationLock");
         while (obj->mark() == markOopDesc::INFLATING()) {
           // Beware: NakedYield() is advisory and has almost no effect on some platforms
           // so we periodically call Self->_ParkEvent->park(1).
@@ -539,7 +546,7 @@
             os::naked_yield();
           }
         }
-        Thread::muxRelease(InflationLocks + ix);
+        Thread::muxRelease(gInflationLocks + ix);
         TEVENT(Inflate: INFLATING - yield/park);
       }
     } else {
@@ -882,7 +889,7 @@
 // STW-time -- disassociates idle monitors from objects.  Such
 // scavenged monitors are returned to the gFreeList.
 //
-// The global list is protected by ListLock.  All the critical sections
+// The global list is protected by gListLock.  All the critical sections
 // are short and operate in constant-time.
 //
 // ObjectMonitors reside in type-stable memory (TSM) and are immortal.
@@ -937,17 +944,17 @@
 
 void ObjectSynchronizer::verifyInUse(Thread *Self) {
   ObjectMonitor* mid;
-  int inusetally = 0;
+  int in_use_tally = 0;
   for (mid = Self->omInUseList; mid != NULL; mid = mid->FreeNext) {
-    inusetally++;
+    in_use_tally++;
   }
-  assert(inusetally == Self->omInUseCount, "inuse count off");
+  assert(in_use_tally == Self->omInUseCount, "in-use count off");
 
-  int freetally = 0;
+  int free_tally = 0;
   for (mid = Self->omFreeList; mid != NULL; mid = mid->FreeNext) {
-    freetally++;
+    free_tally++;
   }
-  assert(freetally == Self->omFreeCount, "free count off");
+  assert(free_tally == Self->omFreeCount, "free count off");
 }
 
 ObjectMonitor * NOINLINE ObjectSynchronizer::omAlloc(Thread * Self) {
@@ -964,7 +971,7 @@
     // Threads will attempt to allocate first from their local list, then
     // from the global list, and only after those attempts fail will the thread
     // attempt to instantiate new monitors.   Thread-local free lists take
-    // heat off the ListLock and improve allocation latency, as well as reducing
+    // heat off the gListLock and improve allocation latency, as well as reducing
     // coherency traffic on the shared global list.
     m = Self->omFreeList;
     if (m != NULL) {
@@ -994,9 +1001,9 @@
       // Reprovision the thread's omFreeList.
       // Use bulk transfers to reduce the allocation rate and heat
       // on various locks.
-      Thread::muxAcquire(&ListLock, "omAlloc");
+      Thread::muxAcquire(&gListLock, "omAlloc");
       for (int i = Self->omFreeProvision; --i >= 0 && gFreeList != NULL;) {
-        MonitorFreeCount--;
+        gMonitorFreeCount--;
         ObjectMonitor * take = gFreeList;
         gFreeList = take->FreeNext;
         guarantee(take->object() == NULL, "invariant");
@@ -1004,13 +1011,13 @@
         take->Recycle();
         omRelease(Self, take, false);
       }
-      Thread::muxRelease(&ListLock);
+      Thread::muxRelease(&gListLock);
       Self->omFreeProvision += 1 + (Self->omFreeProvision/2);
       if (Self->omFreeProvision > MAXPRIVATE) Self->omFreeProvision = MAXPRIVATE;
       TEVENT(omFirst - reprovision);
 
       const int mx = MonitorBound;
-      if (mx > 0 && (MonitorPopulation-MonitorFreeCount) > mx) {
+      if (mx > 0 && (gMonitorPopulation-gMonitorFreeCount) > mx) {
         // We can't safely induce a STW safepoint from omAlloc() as our thread
         // state may not be appropriate for such activities and callers may hold
         // naked oops, so instead we defer the action.
@@ -1068,11 +1075,11 @@
     // block in hand.  This avoids some lock traffic and redundant
     // list activity.
 
-    // Acquire the ListLock to manipulate BlockList and FreeList.
+    // Acquire the gListLock to manipulate gBlockList and gFreeList.
     // An Oyama-Taura-Yonezawa scheme might be more efficient.
-    Thread::muxAcquire(&ListLock, "omAlloc [2]");
-    MonitorPopulation += _BLOCKSIZE-1;
-    MonitorFreeCount += _BLOCKSIZE-1;
+    Thread::muxAcquire(&gListLock, "omAlloc [2]");
+    gMonitorPopulation += _BLOCKSIZE-1;
+    gMonitorFreeCount += _BLOCKSIZE-1;
 
     // Add the new block to the list of extant blocks (gBlockList).
     // The very first objectMonitor in a block is reserved and dedicated.
@@ -1083,7 +1090,7 @@
     // Add the new string of objectMonitors to the global free list
     temp[_BLOCKSIZE - 1].FreeNext = gFreeList;
     gFreeList = temp + 1;
-    Thread::muxRelease(&ListLock);
+    Thread::muxRelease(&gListLock);
     TEVENT(Allocate block of monitors);
   }
 }
@@ -1094,32 +1101,36 @@
 // omRelease is to return a monitor to the free list after a CAS
 // attempt failed.  This doesn't allow unbounded #s of monitors to
 // accumulate on a thread's free list.
+//
+// Key constraint: all ObjectMonitors on a thread's free list and the global
+// free list must have their object field set to null. This prevents the
+// scavenger -- deflate_idle_monitors -- from reclaiming them.
 
 void ObjectSynchronizer::omRelease(Thread * Self, ObjectMonitor * m,
                                    bool fromPerThreadAlloc) {
   guarantee(m->object() == NULL, "invariant");
-
+  guarantee(((m->is_busy()|m->_recursions) == 0), "freeing in-use monitor");
   // Remove from omInUseList
   if (MonitorInUseLists && fromPerThreadAlloc) {
-    ObjectMonitor* curmidinuse = NULL;
-    for (ObjectMonitor* mid = Self->omInUseList; mid != NULL;) {
+    ObjectMonitor* cur_mid_in_use = NULL;
+    bool extracted = false;
+    for (ObjectMonitor* mid = Self->omInUseList; mid != NULL; cur_mid_in_use = mid, mid = mid->FreeNext) {
       if (m == mid) {
-        // extract from per-thread in-use-list
+        // extract from per-thread in-use list
         if (mid == Self->omInUseList) {
           Self->omInUseList = mid->FreeNext;
-        } else if (curmidinuse != NULL) {
-          curmidinuse->FreeNext = mid->FreeNext; // maintain the current thread inuselist
+        } else if (cur_mid_in_use != NULL) {
+          cur_mid_in_use->FreeNext = mid->FreeNext; // maintain the current thread in-use list
         }
+        extracted = true;
         Self->omInUseCount--;
         if (ObjectMonitor::Knob_VerifyInUse) {
           verifyInUse(Self);
         }
         break;
-      } else {
-        curmidinuse = mid;
-        mid = mid->FreeNext;
       }
     }
+    assert(extracted, "Should have extracted from in-use list");
   }
 
   // FreeNext is used for both omInUseList and omFreeList, so clear old before setting new
@@ -1149,52 +1160,60 @@
 // operator.
 
 void ObjectSynchronizer::omFlush(Thread * Self) {
-  ObjectMonitor * List = Self->omFreeList;  // Null-terminated SLL
+  ObjectMonitor * list = Self->omFreeList;  // Null-terminated SLL
   Self->omFreeList = NULL;
-  ObjectMonitor * Tail = NULL;
-  int Tally = 0;
-  if (List != NULL) {
+  ObjectMonitor * tail = NULL;
+  int tally = 0;
+  if (list != NULL) {
     ObjectMonitor * s;
-    for (s = List; s != NULL; s = s->FreeNext) {
-      Tally++;
-      Tail = s;
+    // The thread is going away, the per-thread free monitors
+    // are freed via set_owner(NULL)
+    // Link them to tail, which will be linked into the global free list
+    // gFreeList below, under the gListLock
+    for (s = list; s != NULL; s = s->FreeNext) {
+      tally++;
+      tail = s;
       guarantee(s->object() == NULL, "invariant");
       guarantee(!s->is_busy(), "invariant");
       s->set_owner(NULL);   // redundant but good hygiene
       TEVENT(omFlush - Move one);
     }
-    guarantee(Tail != NULL && List != NULL, "invariant");
+    guarantee(tail != NULL && list != NULL, "invariant");
   }
 
-  ObjectMonitor * InUseList = Self->omInUseList;
-  ObjectMonitor * InUseTail = NULL;
-  int InUseTally = 0;
-  if (InUseList != NULL) {
+  ObjectMonitor * inUseList = Self->omInUseList;
+  ObjectMonitor * inUseTail = NULL;
+  int inUseTally = 0;
+  if (inUseList != NULL) {
     Self->omInUseList = NULL;
-    ObjectMonitor *curom;
-    for (curom = InUseList; curom != NULL; curom = curom->FreeNext) {
-      InUseTail = curom;
-      InUseTally++;
+    ObjectMonitor *cur_om;
+    // The thread is going away, however the omInUseList inflated
+    // monitors may still be in-use by other threads.
+    // Link them to inUseTail, which will be linked into the global in-use list
+    // gOmInUseList below, under the gListLock
+    for (cur_om = inUseList; cur_om != NULL; cur_om = cur_om->FreeNext) {
+      inUseTail = cur_om;
+      inUseTally++;
     }
-    assert(Self->omInUseCount == InUseTally, "inuse count off");
+    assert(Self->omInUseCount == inUseTally, "in-use count off");
     Self->omInUseCount = 0;
-    guarantee(InUseTail != NULL && InUseList != NULL, "invariant");
+    guarantee(inUseTail != NULL && inUseList != NULL, "invariant");
   }
 
-  Thread::muxAcquire(&ListLock, "omFlush");
-  if (Tail != NULL) {
-    Tail->FreeNext = gFreeList;
-    gFreeList = List;
-    MonitorFreeCount += Tally;
+  Thread::muxAcquire(&gListLock, "omFlush");
+  if (tail != NULL) {
+    tail->FreeNext = gFreeList;
+    gFreeList = list;
+    gMonitorFreeCount += tally;
   }
 
-  if (InUseTail != NULL) {
-    InUseTail->FreeNext = gOmInUseList;
-    gOmInUseList = InUseList;
-    gOmInUseCount += InUseTally;
+  if (inUseTail != NULL) {
+    inUseTail->FreeNext = gOmInUseList;
+    gOmInUseList = inUseList;
+    gOmInUseCount += inUseTally;
   }
 
-  Thread::muxRelease(&ListLock);
+  Thread::muxRelease(&gListLock);
   TEVENT(omFlush);
 }
 
@@ -1411,14 +1430,14 @@
 //
 // We have added a flag, MonitorInUseLists, which creates a list
 // of active monitors for each thread. deflate_idle_monitors()
-// only scans the per-thread inuse lists. omAlloc() puts all
+// 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 inuse list. The
+// 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().
 //
@@ -1432,8 +1451,8 @@
   MaximumRecheckInterval  = 1000
 };
 
-// Deflate a single monitor if not in use
-// Return true if deflated, false if in use
+// Deflate a single monitor if not in-use
+// Return true if deflated, false if in-use
 bool ObjectSynchronizer::deflate_monitor(ObjectMonitor* mid, oop obj,
                                          ObjectMonitor** freeHeadp,
                                          ObjectMonitor** freeTailp) {
@@ -1465,11 +1484,11 @@
 
     assert(mid->object() == NULL, "invariant");
 
-    // Move the object to the working free list defined by FreeHead,FreeTail.
+    // Move the object to the working free list defined by freeHeadp, freeTailp
     if (*freeHeadp == NULL) *freeHeadp = mid;
     if (*freeTailp != NULL) {
       ObjectMonitor * prevtail = *freeTailp;
-      assert(prevtail->FreeNext == NULL, "cleaned up deflated?"); // TODO KK
+      assert(prevtail->FreeNext == NULL, "cleaned up deflated?");
       prevtail->FreeNext = mid;
     }
     *freeTailp = mid;
@@ -1478,38 +1497,37 @@
   return deflated;
 }
 
-// Caller acquires ListLock
-int ObjectSynchronizer::walk_monitor_list(ObjectMonitor** listheadp,
-                                          ObjectMonitor** freeHeadp,
-                                          ObjectMonitor** freeTailp) {
+// Walk a given monitor list, and deflate idle monitors
+// The given list could be a per-thread list or a global list
+// Caller acquires gListLock
+int ObjectSynchronizer::deflate_monitor_list(ObjectMonitor** listHeadp,
+                                             ObjectMonitor** freeHeadp,
+                                             ObjectMonitor** freeTailp) {
   ObjectMonitor* mid;
   ObjectMonitor* next;
-  ObjectMonitor* curmidinuse = NULL;
-  int deflatedcount = 0;
+  ObjectMonitor* cur_mid_in_use = NULL;
+  int deflated_count = 0;
 
-  for (mid = *listheadp; mid != NULL;) {
+  for (mid = *listHeadp; mid != NULL;) {
     oop obj = (oop) mid->object();
-    bool deflated = false;
-    if (obj != NULL) {
-      deflated = deflate_monitor(mid, obj, freeHeadp, freeTailp);
-    }
-    if (deflated) {
-      // extract from per-thread in-use-list
-      if (mid == *listheadp) {
-        *listheadp = mid->FreeNext;
-      } else if (curmidinuse != NULL) {
-        curmidinuse->FreeNext = mid->FreeNext; // maintain the current thread inuselist
+    if (obj != NULL && deflate_monitor(mid, obj, freeHeadp, freeTailp)) {
+      // if deflate_monitor succeeded,
+      // extract from per-thread in-use list
+      if (mid == *listHeadp) {
+        *listHeadp = mid->FreeNext;
+      } else if (cur_mid_in_use != NULL) {
+        cur_mid_in_use->FreeNext = mid->FreeNext; // maintain the current thread in-use list
       }
       next = mid->FreeNext;
-      mid->FreeNext = NULL;  // This mid is current tail in the FreeHead list
+      mid->FreeNext = NULL;  // This mid is current tail in the freeHeadp list
       mid = next;
-      deflatedcount++;
+      deflated_count++;
     } else {
-      curmidinuse = mid;
+      cur_mid_in_use = mid;
       mid = mid->FreeNext;
     }
   }
-  return deflatedcount;
+  return deflated_count;
 }
 
 void ObjectSynchronizer::deflate_idle_monitors() {
@@ -1519,34 +1537,34 @@
   int nScavenged = 0;          // reclaimed
   bool deflated = false;
 
-  ObjectMonitor * FreeHead = NULL;  // Local SLL of scavenged monitors
-  ObjectMonitor * FreeTail = NULL;
+  ObjectMonitor * freeHeadp = NULL;  // Local SLL of scavenged monitors
+  ObjectMonitor * freeTailp = NULL;
 
   TEVENT(deflate_idle_monitors);
   // Prevent omFlush from changing mids in Thread dtor's during deflation
   // And in case the vm thread is acquiring a lock during a safepoint
   // See e.g. 6320749
-  Thread::muxAcquire(&ListLock, "scavenge - return");
+  Thread::muxAcquire(&gListLock, "scavenge - return");
 
   if (MonitorInUseLists) {
     int inUse = 0;
     for (JavaThread* cur = Threads::first(); cur != NULL; cur = cur->next()) {
       nInCirculation+= cur->omInUseCount;
-      int deflatedcount = walk_monitor_list(cur->omInUseList_addr(), &FreeHead, &FreeTail);
-      cur->omInUseCount-= deflatedcount;
+      int deflated_count = deflate_monitor_list(cur->omInUseList_addr(), &freeHeadp, &freeTailp);
+      cur->omInUseCount-= deflated_count;
       if (ObjectMonitor::Knob_VerifyInUse) {
         verifyInUse(cur);
       }
-      nScavenged += deflatedcount;
+      nScavenged += deflated_count;
       nInuse += cur->omInUseCount;
     }
 
     // For moribund threads, scan gOmInUseList
     if (gOmInUseList) {
       nInCirculation += gOmInUseCount;
-      int deflatedcount = walk_monitor_list((ObjectMonitor **)&gOmInUseList, &FreeHead, &FreeTail);
-      gOmInUseCount-= deflatedcount;
-      nScavenged += deflatedcount;
+      int deflated_count = deflate_monitor_list((ObjectMonitor **)&gOmInUseList, &freeHeadp, &freeTailp);
+      gOmInUseCount-= deflated_count;
+      nScavenged += deflated_count;
       nInuse += gOmInUseCount;
     }
 
@@ -1568,7 +1586,7 @@
         guarantee(!mid->is_busy(), "invariant");
         continue;
       }
-      deflated = deflate_monitor(mid, obj, &FreeHead, &FreeTail);
+      deflated = deflate_monitor(mid, obj, &freeHeadp, &freeTailp);
 
       if (deflated) {
         mid->FreeNext = NULL;
@@ -1579,28 +1597,28 @@
     }
   }
 
-  MonitorFreeCount += nScavenged;
+  gMonitorFreeCount += nScavenged;
 
-  // Consider: audit gFreeList to ensure that MonitorFreeCount and list agree.
+  // Consider: audit gFreeList to ensure that gMonitorFreeCount and list agree.
 
   if (ObjectMonitor::Knob_Verbose) {
     ::printf("Deflate: InCirc=%d InUse=%d Scavenged=%d ForceMonitorScavenge=%d : pop=%d free=%d\n",
              nInCirculation, nInuse, nScavenged, ForceMonitorScavenge,
-             MonitorPopulation, MonitorFreeCount);
+             gMonitorPopulation, gMonitorFreeCount);
     ::fflush(stdout);
   }
 
   ForceMonitorScavenge = 0;    // Reset
 
   // Move the scavenged monitors back to the global free list.
-  if (FreeHead != NULL) {
-    guarantee(FreeTail != NULL && nScavenged > 0, "invariant");
-    assert(FreeTail->FreeNext == NULL, "invariant");
+  if (freeHeadp != NULL) {
+    guarantee(freeTailp != NULL && nScavenged > 0, "invariant");
+    assert(freeTailp->FreeNext == NULL, "invariant");
     // constant-time list splice - prepend scavenged segment to gFreeList
-    FreeTail->FreeNext = gFreeList;
-    gFreeList = FreeHead;
+    freeTailp->FreeNext = gFreeList;
+    gFreeList = freeHeadp;
   }
-  Thread::muxRelease(&ListLock);
+  Thread::muxRelease(&gListLock);
 
   if (ObjectMonitor::_sync_Deflations != NULL) ObjectMonitor::_sync_Deflations->inc(nScavenged);
   if (ObjectMonitor::_sync_MonExtant  != NULL) ObjectMonitor::_sync_MonExtant ->set_value(nInCirculation);
@@ -1648,9 +1666,9 @@
   assert(THREAD == JavaThread::current(), "must be current Java thread");
   No_Safepoint_Verifier nsv;
   ReleaseJavaMonitorsClosure rjmc(THREAD);
-  Thread::muxAcquire(&ListLock, "release_monitors_owned_by_thread");
+  Thread::muxAcquire(&gListLock, "release_monitors_owned_by_thread");
   ObjectSynchronizer::monitors_iterate(&rjmc);
-  Thread::muxRelease(&ListLock);
+  Thread::muxRelease(&gListLock);
   THREAD->clear_pending_exception();
 }
 
--- a/hotspot/src/share/vm/runtime/synchronizer.hpp	Wed Apr 22 14:06:49 2015 -0400
+++ b/hotspot/src/share/vm/runtime/synchronizer.hpp	Thu Apr 23 16:09:21 2015 +0200
@@ -116,9 +116,10 @@
   // Basically we deflate all monitors that are not busy.
   // An adaptive profile-based deflation policy could be used if needed
   static void deflate_idle_monitors();
-  static int walk_monitor_list(ObjectMonitor** listheadp,
-                               ObjectMonitor** freeHeadp,
-                               ObjectMonitor** freeTailp);
+  // For a given monitor list: global or per-thread, deflate idle monitors
+  static int deflate_monitor_list(ObjectMonitor** listheadp,
+                                  ObjectMonitor** freeHeadp,
+                                  ObjectMonitor** freeTailp);
   static bool deflate_monitor(ObjectMonitor* mid, oop obj,
                               ObjectMonitor** freeHeadp,
                               ObjectMonitor** freeTailp);
@@ -135,16 +136,17 @@
 
  private:
   enum { _BLOCKSIZE = 128 };
+  // global list of blocks of monitors
   // gBlockList is really PaddedEnd<ObjectMonitor> *, but we don't
   // want to expose the PaddedEnd template more than necessary.
-  static ObjectMonitor* gBlockList;
+  static ObjectMonitor * gBlockList;
+  // global monitor free list
   static ObjectMonitor * volatile gFreeList;
-  // global monitor in use list, for moribund threads,
+  // global monitor in-use list, for moribund threads,
   // monitors they inflated need to be scanned for deflation
   static ObjectMonitor * volatile gOmInUseList;
   // count of entries in gOmInUseList
   static int gOmInUseCount;
-
 };
 
 // ObjectLocker enforced balanced locking and can never thrown an
--- a/hotspot/src/share/vm/services/diagnosticFramework.cpp	Wed Apr 22 14:06:49 2015 -0400
+++ b/hotspot/src/share/vm/services/diagnosticFramework.cpp	Thu Apr 23 16:09:21 2015 +0200
@@ -455,12 +455,12 @@
   }
   if (notif) {
 
-    Klass* k = Management::sun_management_ManagementFactoryHelper_klass(CHECK);
-    instanceKlassHandle mgmt_factory_helper_klass(THREAD, k);
+    Klass* k = Management::com_sun_management_internal_DiagnosticCommandImpl_klass(CHECK);
+    instanceKlassHandle dcmd_mbean_klass(THREAD, k);
 
     JavaValue result(T_OBJECT);
     JavaCalls::call_static(&result,
-            mgmt_factory_helper_klass,
+            dcmd_mbean_klass,
             vmSymbols::getDiagnosticCommandMBean_name(),
             vmSymbols::getDiagnosticCommandMBean_signature(),
             CHECK);
@@ -468,12 +468,9 @@
     instanceOop m = (instanceOop) result.get_jobject();
     instanceHandle dcmd_mbean_h(THREAD, m);
 
-    Klass* k2 = Management::sun_management_DiagnosticCommandImpl_klass(CHECK);
-    instanceKlassHandle dcmd_mbean_klass(THREAD, k2);
-
-    if (!dcmd_mbean_h->is_a(k2)) {
+    if (!dcmd_mbean_h->is_a(k)) {
       THROW_MSG(vmSymbols::java_lang_IllegalArgumentException(),
-              "ManagementFactory.getDiagnosticCommandMBean didn't return a DiagnosticCommandMBean instance");
+              "DiagnosticCommandImpl.getDiagnosticCommandMBean didn't return a DiagnosticCommandMBean instance");
     }
 
     JavaValue result2(T_VOID);
--- a/hotspot/src/share/vm/services/gcNotifier.cpp	Wed Apr 22 14:06:49 2015 -0400
+++ b/hotspot/src/share/vm/services/gcNotifier.cpp	Thu Apr 23 16:09:21 2015 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2015, 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
@@ -77,7 +77,7 @@
 
 static Handle getGcInfoBuilder(GCMemoryManager *gcManager,TRAPS) {
 
-  Klass* k = Management::sun_management_GarbageCollectorImpl_klass(CHECK_NH);
+  Klass* k = Management::com_sun_management_internal_GarbageCollectorExtImpl_klass(CHECK_NH);
   instanceKlassHandle gcMBeanKlass (THREAD, k);
 
   instanceOop i = gcManager->get_memory_manager_instance(THREAD);
@@ -214,8 +214,8 @@
     Handle objName = java_lang_String::create_from_str(request->gcManager->name(), CHECK);
     Handle objAction = java_lang_String::create_from_str(request->gcAction, CHECK);
     Handle objCause = java_lang_String::create_from_str(request->gcCause, CHECK);
+    Klass* k = Management::com_sun_management_internal_GarbageCollectorExtImpl_klass(CHECK);
 
-    Klass* k = Management::sun_management_GarbageCollectorImpl_klass(CHECK);
     instanceKlassHandle gc_mbean_klass(THREAD, k);
 
     instanceOop gc_mbean = request->gcManager->get_memory_manager_instance(THREAD);
--- a/hotspot/src/share/vm/services/management.cpp	Wed Apr 22 14:06:49 2015 -0400
+++ b/hotspot/src/share/vm/services/management.cpp	Thu Apr 23 16:09:21 2015 +0200
@@ -64,18 +64,16 @@
 PerfVariable* Management::_end_vm_creation_time = NULL;
 PerfVariable* Management::_vm_init_done_time = NULL;
 
+Klass* Management::_diagnosticCommandImpl_klass = NULL;
+Klass* Management::_garbageCollectorExtImpl_klass = NULL;
+Klass* Management::_garbageCollectorMXBean_klass = NULL;
+Klass* Management::_gcInfo_klass = NULL;
+Klass* Management::_managementFactoryHelper_klass = NULL;
+Klass* Management::_memoryManagerMXBean_klass = NULL;
+Klass* Management::_memoryPoolMXBean_klass = NULL;
+Klass* Management::_memoryUsage_klass = NULL;
 Klass* Management::_sensor_klass = NULL;
 Klass* Management::_threadInfo_klass = NULL;
-Klass* Management::_memoryUsage_klass = NULL;
-Klass* Management::_memoryPoolMXBean_klass = NULL;
-Klass* Management::_memoryManagerMXBean_klass = NULL;
-Klass* Management::_garbageCollectorMXBean_klass = NULL;
-Klass* Management::_managementFactory_klass = NULL;
-Klass* Management::_garbageCollectorImpl_klass = NULL;
-Klass* Management::_gcInfo_klass = NULL;
-Klass* Management::_diagnosticCommandImpl_klass = NULL;
-Klass* Management::_managementFactoryHelper_klass = NULL;
-
 
 jmmOptionalSupport Management::_optional_support = {0};
 TimeStamp Management::_stamp;
@@ -255,18 +253,18 @@
   return _sensor_klass;
 }
 
-Klass* Management::sun_management_ManagementFactory_klass(TRAPS) {
-  if (_managementFactory_klass == NULL) {
-    _managementFactory_klass = load_and_initialize_klass(vmSymbols::sun_management_ManagementFactory(), CHECK_NULL);
+Klass* Management::sun_management_ManagementFactoryHelper_klass(TRAPS) {
+  if (_managementFactoryHelper_klass == NULL) {
+    _managementFactoryHelper_klass = load_and_initialize_klass(vmSymbols::sun_management_ManagementFactoryHelper(), CHECK_NULL);
   }
-  return _managementFactory_klass;
+  return _managementFactoryHelper_klass;
 }
 
-Klass* Management::sun_management_GarbageCollectorImpl_klass(TRAPS) {
-  if (_garbageCollectorImpl_klass == NULL) {
-    _garbageCollectorImpl_klass = load_and_initialize_klass(vmSymbols::sun_management_GarbageCollectorImpl(), CHECK_NULL);
+Klass* Management::com_sun_management_internal_GarbageCollectorExtImpl_klass(TRAPS) {
+  if (_garbageCollectorExtImpl_klass == NULL) {
+    _garbageCollectorExtImpl_klass = load_and_initialize_klass(vmSymbols::com_sun_management_internal_GarbageCollectorExtImpl(), CHECK_NULL);
   }
-  return _garbageCollectorImpl_klass;
+  return _garbageCollectorExtImpl_klass;
 }
 
 Klass* Management::com_sun_management_GcInfo_klass(TRAPS) {
@@ -276,20 +274,13 @@
   return _gcInfo_klass;
 }
 
-Klass* Management::sun_management_DiagnosticCommandImpl_klass(TRAPS) {
+Klass* Management::com_sun_management_internal_DiagnosticCommandImpl_klass(TRAPS) {
   if (_diagnosticCommandImpl_klass == NULL) {
-    _diagnosticCommandImpl_klass = load_and_initialize_klass(vmSymbols::sun_management_DiagnosticCommandImpl(), CHECK_NULL);
+    _diagnosticCommandImpl_klass = load_and_initialize_klass(vmSymbols::com_sun_management_internal_DiagnosticCommandImpl(), CHECK_NULL);
   }
   return _diagnosticCommandImpl_klass;
 }
 
-Klass* Management::sun_management_ManagementFactoryHelper_klass(TRAPS) {
-  if (_managementFactoryHelper_klass == NULL) {
-    _managementFactoryHelper_klass = load_and_initialize_klass(vmSymbols::sun_management_ManagementFactoryHelper(), CHECK_NULL);
-  }
-  return _managementFactoryHelper_klass;
-}
-
 static void initialize_ThreadInfo_constructor_arguments(JavaCallArguments* args, ThreadSnapshot* snapshot, TRAPS) {
   Handle snapshot_thread(THREAD, snapshot->threadObj());
 
@@ -1109,6 +1100,8 @@
                            bool with_locked_monitors,
                            bool with_locked_synchronizers,
                            TRAPS) {
+  // no need to actually perform thread dump if no TIDs are specified
+  if (num_threads == 0) return;
 
   // First get an array of threadObj handles.
   // A JavaThread may terminate before we get the stack trace.
--- a/hotspot/src/share/vm/services/management.hpp	Wed Apr 22 14:06:49 2015 -0400
+++ b/hotspot/src/share/vm/services/management.hpp	Thu Apr 23 16:09:21 2015 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2015, 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,18 +42,16 @@
   static TimeStamp          _stamp; // Timestamp since vm init done time
 
   // Management klasses
+  static Klass*             _diagnosticCommandImpl_klass;
+  static Klass*             _garbageCollectorExtImpl_klass;
+  static Klass*             _garbageCollectorMXBean_klass;
+  static Klass*             _gcInfo_klass;
+  static Klass*             _managementFactoryHelper_klass;
+  static Klass*             _memoryManagerMXBean_klass;
+  static Klass*             _memoryPoolMXBean_klass;
+  static Klass*             _memoryUsage_klass;
   static Klass*             _sensor_klass;
   static Klass*             _threadInfo_klass;
-  static Klass*             _memoryUsage_klass;
-  static Klass*             _memoryPoolMXBean_klass;
-  static Klass*             _memoryManagerMXBean_klass;
-  static Klass*             _garbageCollectorMXBean_klass;
-  static Klass*             _managementFactory_klass;
-  static Klass*             _garbageCollectorImpl_klass;
-  static Klass*             _diagnosticCommandImpl_klass;
-  static Klass*             _managementFactoryHelper_klass;
-  static Klass*             _gcInfo_klass;
-
   static Klass* load_and_initialize_klass(Symbol* sh, TRAPS);
 
 public:
@@ -93,17 +91,15 @@
   static Klass* java_lang_management_MemoryPoolMXBean_klass(TRAPS);
   static Klass* java_lang_management_MemoryManagerMXBean_klass(TRAPS);
   static Klass* java_lang_management_GarbageCollectorMXBean_klass(TRAPS);
+  static Klass* sun_management_ManagementFactoryHelper_klass(TRAPS)
+      NOT_MANAGEMENT_RETURN_(NULL);
   static Klass* sun_management_Sensor_klass(TRAPS)
       NOT_MANAGEMENT_RETURN_(NULL);
-  static Klass* sun_management_ManagementFactory_klass(TRAPS)
-      NOT_MANAGEMENT_RETURN_(NULL);
-  static Klass* sun_management_GarbageCollectorImpl_klass(TRAPS)
+  static Klass* com_sun_management_internal_GarbageCollectorExtImpl_klass(TRAPS)
       NOT_MANAGEMENT_RETURN_(NULL);
   static Klass* com_sun_management_GcInfo_klass(TRAPS)
       NOT_MANAGEMENT_RETURN_(NULL);
-  static Klass* sun_management_DiagnosticCommandImpl_klass(TRAPS)
-      NOT_MANAGEMENT_RETURN_(NULL);
-  static Klass* sun_management_ManagementFactoryHelper_klass(TRAPS)
+  static Klass* com_sun_management_internal_DiagnosticCommandImpl_klass(TRAPS)
       NOT_MANAGEMENT_RETURN_(NULL);
 
   static instanceOop create_thread_info_instance(ThreadSnapshot* snapshot, TRAPS);
--- a/hotspot/src/share/vm/services/memoryManager.cpp	Wed Apr 22 14:06:49 2015 -0400
+++ b/hotspot/src/share/vm/services/memoryManager.cpp	Thu Apr 23 16:09:21 2015 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2015, 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
@@ -98,8 +98,7 @@
   if (mgr_obj == NULL) {
     // It's ok for more than one thread to execute the code up to the locked region.
     // Extra manager instances will just be gc'ed.
-    Klass* k = Management::sun_management_ManagementFactory_klass(CHECK_0);
-    instanceKlassHandle ik(THREAD, k);
+    Klass* k = Management::sun_management_ManagementFactoryHelper_klass(CHECK_0);
 
     Handle mgr_name = java_lang_String::create_from_str(name(), CHECK_0);
 
@@ -110,7 +109,14 @@
     Symbol* method_name = NULL;
     Symbol* signature = NULL;
     if (is_gc_memory_manager()) {
+      Klass* extKlass = Management::com_sun_management_internal_GarbageCollectorExtImpl_klass(CHECK_0);
+      // com.sun.management.GarbageCollectorMXBean is in jdk.management module which may not be present.
+      if (extKlass != NULL) {
+        k = extKlass;
+      }
+
       method_name = vmSymbols::createGarbageCollector_name();
+
       signature = vmSymbols::createGarbageCollector_signature();
       args.push_oop(Handle());      // Argument 2 (for future extension)
     } else {
@@ -118,6 +124,8 @@
       signature = vmSymbols::createMemoryManager_signature();
     }
 
+    instanceKlassHandle ik(THREAD, k);
+
     JavaCalls::call_static(&result,
                            ik,
                            method_name,
--- a/hotspot/src/share/vm/services/memoryPool.cpp	Wed Apr 22 14:06:49 2015 -0400
+++ b/hotspot/src/share/vm/services/memoryPool.cpp	Thu Apr 23 16:09:21 2015 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2015, 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
@@ -86,7 +86,7 @@
   if (pool_obj == NULL) {
     // It's ok for more than one thread to execute the code up to the locked region.
     // Extra pool instances will just be gc'ed.
-    Klass* k = Management::sun_management_ManagementFactory_klass(CHECK_NULL);
+    Klass* k = Management::sun_management_ManagementFactoryHelper_klass(CHECK_NULL);
     instanceKlassHandle ik(THREAD, k);
 
     Handle pool_name = java_lang_String::create_from_str(_name, CHECK_NULL);
--- a/hotspot/src/share/vm/utilities/ostream.cpp	Wed Apr 22 14:06:49 2015 -0400
+++ b/hotspot/src/share/vm/utilities/ostream.cpp	Thu Apr 23 16:09:21 2015 +0200
@@ -978,8 +978,13 @@
       xs->head("properties");
       // Print it as a java-style property list.
       // System properties don't generally contain newlines, so don't bother with unparsing.
+      outputStream *text = xs->text();
       for (SystemProperty* p = Arguments::system_properties(); p != NULL; p = p->next()) {
-        xs->text()->print_cr("%s=%s", p->key(), p->value());
+        // Print in two stages to avoid problems with long
+        // keys/values.
+        text->print_raw(p->key());
+        text->put('=');
+        text->print_raw_cr(p->value());
       }
       xs->tail("properties");
     }
--- a/hotspot/src/share/vm/utilities/vmError.cpp	Wed Apr 22 14:06:49 2015 -0400
+++ b/hotspot/src/share/vm/utilities/vmError.cpp	Thu Apr 23 16:09:21 2015 +0200
@@ -217,7 +217,7 @@
 bool VMError::coredump_status;
 char VMError::coredump_message[O_BUFLEN];
 
-void VMError::report_coredump_status(const char* message, bool status) {
+void VMError::record_coredump_status(const char* message, bool status) {
   coredump_status = status;
   strncpy(coredump_message, message, sizeof(coredump_message));
   coredump_message[sizeof(coredump_message)-1] = 0;
@@ -231,7 +231,7 @@
 
   if (signame) {
     jio_snprintf(buf, buflen,
-                 "%s (0x%x) at pc=" PTR_FORMAT ", pid=%d, tid=" UINTX_FORMAT,
+                 "%s (0x%x) at pc=" PTR_FORMAT ", pid=%d, tid=" INTPTR_FORMAT,
                  signame, _id, _pc,
                  os::current_process_id(), os::current_thread_id());
   } else if (_filename != NULL && _lineno > 0) {
@@ -239,7 +239,7 @@
     char separator = os::file_separator()[0];
     const char *p = strrchr(_filename, separator);
     int n = jio_snprintf(buf, buflen,
-                         "Internal Error at %s:%d, pid=%d, tid=" UINTX_FORMAT,
+                         "Internal Error at %s:%d, pid=%d, tid=" INTPTR_FORMAT,
                          p ? p + 1 : _filename, _lineno,
                          os::current_process_id(), os::current_thread_id());
     if (n >= 0 && n < buflen && _message) {
@@ -253,7 +253,7 @@
     }
   } else {
     jio_snprintf(buf, buflen,
-                 "Internal Error (0x%x), pid=%d, tid=" UINTX_FORMAT,
+                 "Internal Error (0x%x), pid=%d, tid=" INTPTR_FORMAT,
                  _id, os::current_process_id(), os::current_thread_id());
   }
 
@@ -480,7 +480,7 @@
 
      // process id, thread id
      st->print(", pid=%d", os::current_process_id());
-     st->print(", tid=" UINTX_FORMAT, os::current_thread_id());
+     st->print(", tid=" INTPTR_FORMAT, os::current_thread_id());
      st->cr();
 
   STEP(40, "(printing error message)")
@@ -525,10 +525,14 @@
      }
   STEP(63, "(printing core file information)")
     st->print("# ");
-    if (coredump_status) {
-      st->print("Core dump written. Default location: %s", coredump_message);
+    if (CreateCoredumpOnCrash) {
+      if (coredump_status) {
+        st->print("Core dump will be written. %s", coredump_message);
+      } else {
+        st->print("No core dump will be written. %s", coredump_message);
+      }
     } else {
-      st->print("Failed to write core dump. %s", coredump_message);
+      st->print("CreateCoredumpOnCrash turned off, no core file dumped");
     }
     st->cr();
     st->print_cr("#");
@@ -918,7 +922,7 @@
   static bool transmit_report_done = false; // done error reporting
 
   if (SuppressFatalErrorMessage) {
-      os::abort();
+      os::abort(CreateCoredumpOnCrash);
   }
   jlong mytid = os::current_thread_id();
   if (first_error == NULL &&
@@ -936,8 +940,7 @@
       ShowMessageBoxOnError = false;
     }
 
-    // Write a minidump on Windows, check core dump limits on Linux/Solaris
-    os::check_or_create_dump(_siginfo, _context, buffer, sizeof(buffer));
+    os::check_dump_limit(buffer, sizeof(buffer));
 
     // reset signal handlers or exception filter; make sure recursive crashes
     // are handled properly.
@@ -1108,7 +1111,7 @@
     if (!skip_os_abort) {
       skip_os_abort = true;
       bool dump_core = should_report_bug(first_error->_id);
-      os::abort(dump_core);
+      os::abort(dump_core && CreateCoredumpOnCrash, _siginfo, _context);
     }
 
     // if os::abort() doesn't abort, try os::die();
--- a/hotspot/src/share/vm/utilities/vmError.hpp	Wed Apr 22 14:06:49 2015 -0400
+++ b/hotspot/src/share/vm/utilities/vmError.hpp	Thu Apr 23 16:09:21 2015 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2015, 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
@@ -117,8 +117,8 @@
   // return a string to describe the error
   char *error_string(char* buf, int buflen);
 
-  // Report status of core/minidump
-  static void report_coredump_status(const char* message, bool status);
+  // Record status of core/minidump
+  static void record_coredump_status(const char* message, bool status);
 
   // main error reporting function
   void report_and_die();
--- a/hotspot/test/Makefile	Wed Apr 22 14:06:49 2015 -0400
+++ b/hotspot/test/Makefile	Thu Apr 23 16:09:21 2015 +0200
@@ -279,6 +279,8 @@
 # Default JTREG to run
 JTREG = $(JT_HOME)/bin/jtreg
 
+# Use agent mode
+JTREG_BASIC_OPTIONS += -agentvm
 # Only run automatic tests
 JTREG_BASIC_OPTIONS += -a
 # Report details on all failed or error tests, times too
--- a/hotspot/test/compiler/jsr292/RedefineMethodUsedByMultipleMethodHandles.java	Wed Apr 22 14:06:49 2015 -0400
+++ b/hotspot/test/compiler/jsr292/RedefineMethodUsedByMultipleMethodHandles.java	Thu Apr 23 16:09:21 2015 +0200
@@ -30,7 +30,7 @@
  *          java.instrument
  *          java.management
  * @compile -XDignore.symbol.file RedefineMethodUsedByMultipleMethodHandles.java
- * @run main RedefineMethodUsedByMultipleMethodHandles
+ * @run main/othervm RedefineMethodUsedByMultipleMethodHandles
  */
 
 import java.io.*;
--- a/hotspot/test/compiler/uncommontrap/TestUnstableIfTrap.java	Wed Apr 22 14:06:49 2015 -0400
+++ b/hotspot/test/compiler/uncommontrap/TestUnstableIfTrap.java	Thu Apr 23 16:09:21 2015 +0200
@@ -69,7 +69,7 @@
  *                   -XX:CompileCommand=compileonly,UnstableIfExecutable.test
  *                   -XX:LogFile=never_taken_fired.xml
  *                   TestUnstableIfTrap NEVER_TAKEN true
- * @run main uncommontrap.Verifier always_taken_not_fired.xml
+ * @run main/othervm uncommontrap.Verifier always_taken_not_fired.xml
  *                                 always_taken_fired.xml
  *                                 never_taken_not_fired.xml
  *                                 never_taken_fired.xml
--- a/hotspot/test/gc/TestSmallHeap.java	Wed Apr 22 14:06:49 2015 -0400
+++ b/hotspot/test/gc/TestSmallHeap.java	Thu Apr 23 16:09:21 2015 +0200
@@ -58,9 +58,11 @@
  */
 
 import com.oracle.java.testlibrary.*;
+import com.sun.management.HotSpotDiagnosticMXBean;
+import java.lang.management.ManagementFactory;
 import static com.oracle.java.testlibrary.Asserts.*;
+
 import sun.hotspot.WhiteBox;
-import sun.management.ManagementFactoryHelper;
 
 public class TestSmallHeap {
 
@@ -69,7 +71,9 @@
         int pageSize = wb.getVMPageSize();
         int heapBytesPerCard = 512;
         long expectedMaxHeap = pageSize * heapBytesPerCard;
-        String maxHeap = ManagementFactoryHelper.getDiagnosticMXBean().getVMOption("MaxHeapSize").getValue();
+        String maxHeap
+            = ManagementFactory.getPlatformMXBean(HotSpotDiagnosticMXBean.class)
+                .getVMOption("MaxHeapSize").getValue();
         assertEQ(Long.parseLong(maxHeap), expectedMaxHeap);
     }
 }
--- a/hotspot/test/gc/arguments/TestG1HeapRegionSize.java	Wed Apr 22 14:06:49 2015 -0400
+++ b/hotspot/test/gc/arguments/TestG1HeapRegionSize.java	Thu Apr 23 16:09:21 2015 +0200
@@ -33,14 +33,15 @@
  * @run main/othervm -XX:G1HeapRegionSize=64m -Xmx256m TestG1HeapRegionSize 33554432
  */
 
-import sun.management.ManagementFactoryHelper;
 import com.sun.management.HotSpotDiagnosticMXBean;
 import com.sun.management.VMOption;
+import java.lang.management.ManagementFactory;
 
 public class TestG1HeapRegionSize {
 
   public static void main(String[] args) {
-    HotSpotDiagnosticMXBean diagnostic = ManagementFactoryHelper.getDiagnosticMXBean();
+    HotSpotDiagnosticMXBean diagnostic =
+        ManagementFactory.getPlatformMXBean(HotSpotDiagnosticMXBean.class);
 
     String expectedValue = getExpectedValue(args);
     VMOption option = diagnostic.getVMOption("UseG1GC");
--- a/hotspot/test/gc/arguments/TestUseCompressedOopsErgoTools.java	Wed Apr 22 14:06:49 2015 -0400
+++ b/hotspot/test/gc/arguments/TestUseCompressedOopsErgoTools.java	Thu Apr 23 16:09:21 2015 +0200
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+* Copyright (c) 2013, 2015,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
@@ -21,7 +21,6 @@
 * questions.
 */
 
-import sun.management.ManagementFactoryHelper;
 import com.sun.management.HotSpotDiagnosticMXBean;
 import com.sun.management.VMOption;
 
@@ -31,6 +30,7 @@
 import java.util.Arrays;
 
 import com.oracle.java.testlibrary.*;
+import java.lang.management.ManagementFactory;
 import sun.hotspot.WhiteBox;
 
 class DetermineMaxHeapForCompressedOops {
@@ -43,7 +43,8 @@
 class TestUseCompressedOopsErgoTools {
 
   private static long getCompressedClassSpaceSize() {
-    HotSpotDiagnosticMXBean diagnostic = ManagementFactoryHelper.getDiagnosticMXBean();
+    HotSpotDiagnosticMXBean diagnostic =
+        ManagementFactory.getPlatformMXBean(HotSpotDiagnosticMXBean.class);
 
     VMOption option = diagnostic.getVMOption("CompressedClassSpaceSize");
     return Long.parseLong(option.getValue());
@@ -174,4 +175,3 @@
     return expect(flags, false, false, 0);
   }
 }
-
--- a/hotspot/test/gc/g1/TestGreyReclaimedHumongousObjects.java	Wed Apr 22 14:06:49 2015 -0400
+++ b/hotspot/test/gc/g1/TestGreyReclaimedHumongousObjects.java	Thu Apr 23 16:09:21 2015 +0200
@@ -82,9 +82,8 @@
 import java.util.concurrent.Executors;
 import java.util.concurrent.ThreadFactory;
 import java.util.concurrent.TimeUnit;
-import sun.management.ManagementFactoryHelper;
 import com.sun.management.HotSpotDiagnosticMXBean;
-import com.sun.management.VMOption;
+import java.lang.management.ManagementFactory;
 
 public class TestGreyReclaimedHumongousObjects {
 
@@ -130,7 +129,8 @@
     }
 
     public static void main(String[] args) throws Exception {
-        HotSpotDiagnosticMXBean diagnostic = ManagementFactoryHelper.getDiagnosticMXBean();
+        HotSpotDiagnosticMXBean diagnostic =
+                ManagementFactory.getPlatformMXBean(HotSpotDiagnosticMXBean.class);
 
         System.out.println("Max memory= " + MAX_MEMORY + " bytes");
 
@@ -173,4 +173,3 @@
     private static final int THREAD_COUNT = 12;
     private static final String THREAD_NAME = "TestGreyRH-";
 }
-
--- a/hotspot/test/gc/g1/TestHumongousShrinkHeap.java	Wed Apr 22 14:06:49 2015 -0400
+++ b/hotspot/test/gc/g1/TestHumongousShrinkHeap.java	Thu Apr 23 16:09:21 2015 +0200
@@ -34,11 +34,11 @@
  * TestHumongousShrinkHeap
  */
 
+import com.sun.management.HotSpotDiagnosticMXBean;
 import java.lang.management.ManagementFactory;
 import java.lang.management.MemoryUsage;
 import java.util.ArrayList;
 import java.util.List;
-import sun.management.ManagementFactoryHelper;
 import static com.oracle.java.testlibrary.Asserts.*;
 
 public class TestHumongousShrinkHeap {
@@ -83,9 +83,11 @@
                 "committed free heap size is not less than committed full heap size, heap hasn't been shrunk?%n"
                 + "%s = %s%n%s = %s",
                 MIN_FREE_RATIO_FLAG_NAME,
-                ManagementFactoryHelper.getDiagnosticMXBean().getVMOption(MIN_FREE_RATIO_FLAG_NAME).getValue(),
+                ManagementFactory.getPlatformMXBean(HotSpotDiagnosticMXBean.class)
+                    .getVMOption(MIN_FREE_RATIO_FLAG_NAME).getValue(),
                 MAX_FREE_RATIO_FLAG_NAME,
-                ManagementFactoryHelper.getDiagnosticMXBean().getVMOption(MAX_FREE_RATIO_FLAG_NAME).getValue()
+                ManagementFactory.getPlatformMXBean(HotSpotDiagnosticMXBean.class)
+                    .getVMOption(MAX_FREE_RATIO_FLAG_NAME).getValue()
         ));
     }
 
--- a/hotspot/test/gc/g1/TestShrinkDefragmentedHeap.java	Wed Apr 22 14:06:49 2015 -0400
+++ b/hotspot/test/gc/g1/TestShrinkDefragmentedHeap.java	Thu Apr 23 16:09:21 2015 +0200
@@ -39,10 +39,10 @@
 import java.lang.management.MemoryUsage;
 import java.util.ArrayList;
 import java.util.List;
-import sun.management.ManagementFactoryHelper;
 import static com.oracle.java.testlibrary.Asserts.*;
 import com.oracle.java.testlibrary.ProcessTools;
 import com.oracle.java.testlibrary.OutputAnalyzer;
+import com.sun.management.HotSpotDiagnosticMXBean;
 
 public class TestShrinkDefragmentedHeap {
     // Since we store all the small objects, they become old and old regions are also allocated at the bottom of the heap
@@ -144,9 +144,11 @@
                     "committed free heap size is not less than committed full heap size, heap hasn't been shrunk?%n"
                     + "%s = %s%n%s = %s",
                     MIN_FREE_RATIO_FLAG_NAME,
-                    ManagementFactoryHelper.getDiagnosticMXBean().getVMOption(MIN_FREE_RATIO_FLAG_NAME).getValue(),
+                    ManagementFactory.getPlatformMXBean(HotSpotDiagnosticMXBean.class)
+                        .getVMOption(MIN_FREE_RATIO_FLAG_NAME).getValue(),
                     MAX_FREE_RATIO_FLAG_NAME,
-                    ManagementFactoryHelper.getDiagnosticMXBean().getVMOption(MAX_FREE_RATIO_FLAG_NAME).getValue()
+                    ManagementFactory.getPlatformMXBean(HotSpotDiagnosticMXBean.class)
+                        .getVMOption(MAX_FREE_RATIO_FLAG_NAME).getValue()
             );
         }
 
--- a/hotspot/test/gc/g1/TestSummarizeRSetStatsTools.java	Wed Apr 22 14:06:49 2015 -0400
+++ b/hotspot/test/gc/g1/TestSummarizeRSetStatsTools.java	Thu Apr 23 16:09:21 2015 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2015, 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,14 +25,11 @@
  * Common helpers for TestSummarizeRSetStats* tests
  */
 
-import sun.management.ManagementFactoryHelper;
 import com.sun.management.HotSpotDiagnosticMXBean;
 import com.sun.management.VMOption;
 
 import com.oracle.java.testlibrary.*;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-import java.lang.Thread;
+import java.lang.management.ManagementFactory;
 import java.util.ArrayList;
 import java.util.Arrays;
 
@@ -74,7 +71,8 @@
 
     // the VM is currently run using G1GC, i.e. trying to test G1 functionality.
     public static boolean testingG1GC() {
-        HotSpotDiagnosticMXBean diagnostic = ManagementFactoryHelper.getDiagnosticMXBean();
+        HotSpotDiagnosticMXBean diagnostic =
+            ManagementFactory.getPlatformMXBean(HotSpotDiagnosticMXBean.class);
 
         VMOption option = diagnostic.getVMOption("UseG1GC");
         if (option.getValue().equals("false")) {
@@ -150,4 +148,3 @@
         }
     }
 }
-
--- a/hotspot/test/gc/parallelScavenge/TestDynShrinkHeap.java	Wed Apr 22 14:06:49 2015 -0400
+++ b/hotspot/test/gc/parallelScavenge/TestDynShrinkHeap.java	Thu Apr 23 16:09:21 2015 +0200
@@ -33,8 +33,8 @@
 import java.lang.management.ManagementFactory;
 import java.lang.management.MemoryUsage;
 import java.util.ArrayList;
-import sun.management.ManagementFactoryHelper;
 import static com.oracle.java.testlibrary.Asserts.assertLessThan;
+import com.sun.management.HotSpotDiagnosticMXBean;
 
 public class TestDynShrinkHeap {
 
@@ -63,9 +63,11 @@
                 "committed free heap size is not less than committed full heap size, heap hasn't been shrunk?%n"
                 + "%s = %s%n%s = %s",
                 MIN_FREE_RATIO_FLAG_NAME,
-                ManagementFactoryHelper.getDiagnosticMXBean().getVMOption(MIN_FREE_RATIO_FLAG_NAME).getValue(),
+                ManagementFactory.getPlatformMXBean(HotSpotDiagnosticMXBean.class)
+                    .getVMOption(MIN_FREE_RATIO_FLAG_NAME).getValue(),
                 MAX_FREE_RATIO_FLAG_NAME,
-                ManagementFactoryHelper.getDiagnosticMXBean().getVMOption(MAX_FREE_RATIO_FLAG_NAME).getValue()
+                ManagementFactory.getPlatformMXBean(HotSpotDiagnosticMXBean.class)
+                    .getVMOption(MAX_FREE_RATIO_FLAG_NAME).getValue()
         ));
     }
 
--- a/hotspot/test/runtime/CommandLine/ObsoleteFlagErrorMessage.java	Wed Apr 22 14:06:49 2015 -0400
+++ b/hotspot/test/runtime/CommandLine/ObsoleteFlagErrorMessage.java	Thu Apr 23 16:09:21 2015 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2015 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
@@ -23,24 +23,30 @@
 
 /*
  * @test
- * @bug 8060449
+ * @bug 8060449 8073989
  * @summary Newly obsolete command line options should still give useful error messages when used improperly.
  * @library /testlibrary
- * @modules java.base/sun.misc
- *          java.management
  */
 
 import com.oracle.java.testlibrary.*;
 
 public class ObsoleteFlagErrorMessage {
   public static void main(String[] args) throws Exception {
+
+    // Case 1: Newly obsolete flags with extra junk appended should not be treated as newly obsolete (8060449)
     ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(
-        "-XX:UseBoundThreadsPlusJunk", "-version");
+        "-XX:UseOldInliningPlusJunk", "-version");
 
     OutputAnalyzer output = new OutputAnalyzer(pb.start());
-    output.shouldContain("Unrecognized VM option 'UseBoundThreadsPlusJunk'"); // Must identify bad option.
-    output.shouldContain("UseBoundThreads"); // Should apply fuzzy matching to find correct option.
-    output.shouldContain("support").shouldContain("removed"); // Should warn user that the option they are trying to use is no longer supported.
+    output.shouldContain("Unrecognized VM option 'UseOldInliningPlusJunk'"); // Must identify bad option.
     output.shouldHaveExitValue(1);
+
+    // Case 2: Newly obsolete integer-valued flags should be recognized as newly obsolete (8073989)
+    ProcessBuilder pb2 = ProcessTools.createJavaProcessBuilder(
+        "-XX:NmethodSweepFraction=10", "-version");
+
+    OutputAnalyzer output2 = new OutputAnalyzer(pb2.start());
+    output2.shouldContain("ignoring option").shouldContain("support was removed");
+    output2.shouldContain("NmethodSweepFraction");
   }
 }
--- a/hotspot/test/runtime/ErrorHandling/ProblematicFrameTest.java	Wed Apr 22 14:06:49 2015 -0400
+++ b/hotspot/test/runtime/ErrorHandling/ProblematicFrameTest.java	Thu Apr 23 16:09:21 2015 +0200
@@ -48,7 +48,7 @@
 
     public static void main(String[] args) throws Exception {
         ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(
-            "-Xmx64m", "-XX:-TransmitErrorReport", "-XX:-CreateMinidumpOnCrash", Crasher.class.getName());
+            "-Xmx64m", "-XX:-TransmitErrorReport", "-XX:-CreateCoredumpOnCrash", Crasher.class.getName());
         OutputAnalyzer output = new OutputAnalyzer(pb.start());
         output.shouldNotMatch("error occurred during error reporting \\(printing problematic frame\\)");
     }
--- a/hotspot/test/runtime/ErrorHandling/SafeFetchInErrorHandlingTest.java	Wed Apr 22 14:06:49 2015 -0400
+++ b/hotspot/test/runtime/ErrorHandling/SafeFetchInErrorHandlingTest.java	Thu Apr 23 16:09:21 2015 +0200
@@ -53,6 +53,7 @@
         "-Xmx100M",
         "-XX:ErrorHandlerTest=14",
         "-XX:+TestSafeFetchInErrorHandler",
+        "-XX:-CreateCoredumpOnCrash",
         "-version");
 
     OutputAnalyzer output_detail = new OutputAnalyzer(pb.start());
--- a/hotspot/test/runtime/ErrorHandling/SecondaryErrorTest.java	Wed Apr 22 14:06:49 2015 -0400
+++ b/hotspot/test/runtime/ErrorHandling/SecondaryErrorTest.java	Thu Apr 23 16:09:21 2015 +0200
@@ -1,12 +1,26 @@
-import java.io.BufferedReader;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.InputStreamReader;
-import java.util.regex.Pattern;
+/*
+ * Copyright (c) 2013, 2015, 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 com.oracle.java.testlibrary.OutputAnalyzer;
-import com.oracle.java.testlibrary.Platform;
-import com.oracle.java.testlibrary.ProcessTools;
 
 /*
  * @test
@@ -18,6 +32,16 @@
  *          java.management
  */
 
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.InputStreamReader;
+import java.util.regex.Pattern;
+
+import com.oracle.java.testlibrary.OutputAnalyzer;
+import com.oracle.java.testlibrary.Platform;
+import com.oracle.java.testlibrary.ProcessTools;
+
 public class SecondaryErrorTest {
 
 
@@ -35,6 +59,7 @@
     ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(
         "-XX:+UnlockDiagnosticVMOptions",
         "-Xmx100M",
+        "-XX:-CreateCoredumpOnCrash",
         "-XX:ErrorHandlerTest=15",
         "-XX:TestCrashInErrorHandler=14",
         "-version");
--- a/hotspot/test/runtime/NMT/JcmdDetailDiff.java	Wed Apr 22 14:06:49 2015 -0400
+++ b/hotspot/test/runtime/NMT/JcmdDetailDiff.java	Thu Apr 23 16:09:21 2015 +0200
@@ -28,7 +28,6 @@
  * @library /testlibrary /../../test/lib
  * @modules java.base/sun.misc
  *          java.management
- * @ignore
  * @build JcmdDetailDiff
  * @run main ClassFileInstaller sun.hotspot.WhiteBox
  * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -XX:NativeMemoryTracking=detail JcmdDetailDiff
--- a/hotspot/test/runtime/Safepoint/AssertSafepointCheckConsistency1.java	Wed Apr 22 14:06:49 2015 -0400
+++ b/hotspot/test/runtime/Safepoint/AssertSafepointCheckConsistency1.java	Thu Apr 23 16:09:21 2015 +0200
@@ -49,7 +49,7 @@
                   "-XX:+UnlockDiagnosticVMOptions",
                   "-XX:+WhiteBoxAPI",
                   "-XX:-TransmitErrorReport",
-                  "-XX:-CreateMinidumpOnCrash",
+                  "-XX:-CreateCoredumpOnCrash",
                   "-Xmx32m",
                   "AssertSafepointCheckConsistency1",
                   "test");
--- a/hotspot/test/runtime/Safepoint/AssertSafepointCheckConsistency2.java	Wed Apr 22 14:06:49 2015 -0400
+++ b/hotspot/test/runtime/Safepoint/AssertSafepointCheckConsistency2.java	Thu Apr 23 16:09:21 2015 +0200
@@ -49,7 +49,7 @@
                   "-XX:+UnlockDiagnosticVMOptions",
                   "-XX:+WhiteBoxAPI",
                   "-XX:-TransmitErrorReport",
-                  "-XX:-CreateMinidumpOnCrash",
+                  "-XX:-CreateCoredumpOnCrash",
                   "-Xmx32m",
                   "AssertSafepointCheckConsistency2",
                   "test");
--- a/hotspot/test/runtime/Safepoint/AssertSafepointCheckConsistency3.java	Wed Apr 22 14:06:49 2015 -0400
+++ b/hotspot/test/runtime/Safepoint/AssertSafepointCheckConsistency3.java	Thu Apr 23 16:09:21 2015 +0200
@@ -49,7 +49,7 @@
                   "-XX:+UnlockDiagnosticVMOptions",
                   "-XX:+WhiteBoxAPI",
                   "-XX:-TransmitErrorReport",
-                  "-XX:-CreateMinidumpOnCrash",
+                  "-XX:-CreateCoredumpOnCrash",
                   "-Xmx32m",
                   "AssertSafepointCheckConsistency3",
                   "test");
--- a/hotspot/test/runtime/Safepoint/AssertSafepointCheckConsistency4.java	Wed Apr 22 14:06:49 2015 -0400
+++ b/hotspot/test/runtime/Safepoint/AssertSafepointCheckConsistency4.java	Thu Apr 23 16:09:21 2015 +0200
@@ -49,7 +49,7 @@
                "-XX:+UnlockDiagnosticVMOptions",
                "-XX:+WhiteBoxAPI",
                "-XX:-TransmitErrorReport",
-               "-XX:-CreateMinidumpOnCrash",
+               "-XX:-CreateCoredumpOnCrash",
                "-Xmx32m",
                "AssertSafepointCheckConsistency4",
                "test");
--- a/hotspot/test/runtime/Unsafe/RangeCheck.java	Wed Apr 22 14:06:49 2015 -0400
+++ b/hotspot/test/runtime/Unsafe/RangeCheck.java	Thu Apr 23 16:09:21 2015 +0200
@@ -45,6 +45,7 @@
                 true,
                 "-Xmx32m",
                 "-XX:-TransmitErrorReport",
+                "-XX:-CreateCoredumpOnCrash",
                 "-XX:-InlineUnsafeOps", // The compiler intrinsics doesn't have the assert
                 DummyClassWithMainRangeCheck.class.getName());
 
--- a/hotspot/test/runtime/memory/ReadFromNoaccessArea.java	Wed Apr 22 14:06:49 2015 -0400
+++ b/hotspot/test/runtime/memory/ReadFromNoaccessArea.java	Thu Apr 23 16:09:21 2015 +0200
@@ -50,6 +50,7 @@
           "-XX:+WhiteBoxAPI",
           "-XX:+UseCompressedOops",
           "-XX:HeapBaseMinAddress=33G",
+          "-XX:-CreateCoredumpOnCrash",
           "-Xmx32m",
           DummyClassWithMainTryingToReadFromNoaccessArea.class.getName());
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/sanity/MismatchedWhiteBox/WhiteBox.java	Thu Apr 23 16:09:21 2015 +0200
@@ -0,0 +1,57 @@
+/*
+ * Copyright (c) 2013, 2014, 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 WhiteBox
+ * @bug 8011675
+ * @summary verify that whitebox can be used even if not all functions are declared in java-part
+ * @author igor.ignatyev@oracle.com
+ * @library /testlibrary
+ * @compile WhiteBox.java
+ * @run main ClassFileInstaller sun.hotspot.WhiteBox
+ * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI sun.hotspot.WhiteBox
+ */
+
+package sun.hotspot;
+
+public class WhiteBox {
+    private static native void registerNatives();
+    static { registerNatives(); }
+    public native int notExistedMethod();
+    public native int getHeapOopSize();
+    public static void main(String[] args) {
+        WhiteBox wb = new WhiteBox();
+        if (wb.getHeapOopSize() < 0) {
+            throw new Error("wb.getHeapOopSize() < 0");
+        }
+        boolean catched = false;
+        try {
+            wb.notExistedMethod();
+        } catch (UnsatisfiedLinkError e) {
+            catched = true;
+        }
+        if (!catched) {
+            throw new Error("wb.notExistedMethod() was invoked");
+        }
+    }
+}
--- a/hotspot/test/sanity/WhiteBox.java	Wed Apr 22 14:06:49 2015 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,58 +0,0 @@
-/*
- * Copyright (c) 2013, 2014, 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 WhiteBox
- * @bug 8011675
- * @summary verify that whitebox can be used even if not all functions are declared in java-part
- * @author igor.ignatyev@oracle.com
- * @library /testlibrary
- * @compile WhiteBox.java
- * @run main ClassFileInstaller sun.hotspot.WhiteBox
- * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI sun.hotspot.WhiteBox
- * @clean sun.hotspot.WhiteBox
- */
-
-package sun.hotspot;
-
-public class WhiteBox {
-    private static native void registerNatives();
-    static { registerNatives(); }
-    public native int notExistedMethod();
-    public native int getHeapOopSize();
-    public static void main(String[] args) {
-        WhiteBox wb = new WhiteBox();
-        if (wb.getHeapOopSize() < 0) {
-            throw new Error("wb.getHeapOopSize() < 0");
-        }
-        boolean catched = false;
-        try {
-            wb.notExistedMethod();
-        } catch (UnsatisfiedLinkError e) {
-            catched = true;
-        }
-        if (!catched) {
-            throw new Error("wb.notExistedMethod() was invoked");
-        }
-    }
-}
--- a/hotspot/test/serviceability/sa/jmap-hashcode/Test8028623.java	Wed Apr 22 14:06:49 2015 -0400
+++ b/hotspot/test/serviceability/sa/jmap-hashcode/Test8028623.java	Thu Apr 23 16:09:21 2015 +0200
@@ -30,7 +30,6 @@
  *          java.compiler
  *          java.management
  *          jdk.jvmstat/sun.jvmstat.monitor
- * @ignore 8044416
  * @build com.oracle.java.testlibrary.*
  * @compile -encoding utf8 Test8028623.java
  * @run main Test8028623
--- a/hotspot/test/testlibrary/com/oracle/java/testlibrary/ProcessTools.java	Wed Apr 22 14:06:49 2015 -0400
+++ b/hotspot/test/testlibrary/com/oracle/java/testlibrary/ProcessTools.java	Thu Apr 23 16:09:21 2015 +0200
@@ -139,6 +139,9 @@
     args.add(javapath);
     Collections.addAll(args, getPlatformSpecificVMArgs());
 
+    args.add("-cp");
+    args.add(System.getProperty("java.class.path"));
+
     if (addTestVmAndJavaOptions) {
       Collections.addAll(args, Utils.getTestJavaOpts());
     }
--- a/hotspot/test/testlibrary_tests/whitebox/vm_flags/VmFlagTest.java	Wed Apr 22 14:06:49 2015 -0400
+++ b/hotspot/test/testlibrary_tests/whitebox/vm_flags/VmFlagTest.java	Thu Apr 23 16:09:21 2015 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2015, 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
@@ -21,13 +21,13 @@
  * questions.
  */
 
-import java.util.Objects;
 import java.util.function.BiConsumer;
 import java.util.function.Function;
 import sun.hotspot.WhiteBox;
 import sun.management.*;
 import com.sun.management.*;
 import com.oracle.java.testlibrary.*;
+import java.lang.management.ManagementFactory;
 
 public final class VmFlagTest<T> {
     public static final WhiteBox WHITE_BOX = WhiteBox.getWhiteBox();
@@ -96,7 +96,7 @@
           return asString(getValue());
         }
         HotSpotDiagnosticMXBean diagnostic
-                = ManagementFactoryHelper.getDiagnosticMXBean();
+                = ManagementFactory.getPlatformMXBean(HotSpotDiagnosticMXBean.class);
         VMOption tmp;
         try {
             tmp = diagnostic.getVMOption(flagName);