changeset 9306:5435204da0ec

Merge
author duke
date Wed, 05 Jul 2017 17:42:16 +0200
parents c0c0f0374f67 0c9749d5918d
children f4298bc3f4b6
files jdk/src/share/classes/sun/security/ssl/DefaultSSLContextImpl.java jdk/src/share/native/sun/font/layout/Features.h jdk/test/javax/swing/text/GlyphView/6539700/bug6539700.java
diffstat 474 files changed, 20182 insertions(+), 4743 deletions(-) [+]
line wrap: on
line diff
--- a/.hgtags-top-repo	Mon Apr 25 15:45:49 2011 -0700
+++ b/.hgtags-top-repo	Wed Jul 05 17:42:16 2017 +0200
@@ -113,3 +113,4 @@
 2fe76e73adaa5133ac559f0b3c2c0707eca04580 jdk7-b136
 7654afc6a29e43cb0a1343ce7f1287bf690d5e5f jdk7-b137
 fc47c97bbbd91b1f774d855c48a7e285eb1a351a jdk7-b138
+7ed6d0b9aaa12320832a7ddadb88d6d8d0dda4c1 jdk7-b139
--- a/corba/.hgtags	Mon Apr 25 15:45:49 2011 -0700
+++ b/corba/.hgtags	Wed Jul 05 17:42:16 2017 +0200
@@ -113,3 +113,4 @@
 48ef0c712e7cbf272f47f9224db92a3c6a9e2612 jdk7-b136
 a66c01d8bf895261715955df0b95545c000ed6a8 jdk7-b137
 78d8cf04697e9df54f7f11e195b7da29b8e345a2 jdk7-b138
+60b074ec6fcf5cdf9efce22fdfb02326ed8fa2d3 jdk7-b139
--- a/hotspot/.hgtags	Mon Apr 25 15:45:49 2011 -0700
+++ b/hotspot/.hgtags	Wed Jul 05 17:42:16 2017 +0200
@@ -164,3 +164,5 @@
 2dbcb4a4d8dace5fe78ceb563b134f1fb296cd8f hs21-b07
 0930dc920c185afbf40fed9a655290b8e5b16783 jdk7-b138
 0930dc920c185afbf40fed9a655290b8e5b16783 hs21-b08
+611e19a16519d6fb5deea9ab565336e6e6ee475d jdk7-b139
+611e19a16519d6fb5deea9ab565336e6e6ee475d hs21-b09
--- a/hotspot/make/hotspot_version	Mon Apr 25 15:45:49 2011 -0700
+++ b/hotspot/make/hotspot_version	Wed Jul 05 17:42:16 2017 +0200
@@ -35,7 +35,7 @@
 
 HS_MAJOR_VER=21
 HS_MINOR_VER=0
-HS_BUILD_NUMBER=09
+HS_BUILD_NUMBER=10
 
 JDK_MAJOR_VER=1
 JDK_MINOR_VER=7
--- a/hotspot/src/cpu/sparc/vm/assembler_sparc.cpp	Mon Apr 25 15:45:49 2011 -0700
+++ b/hotspot/src/cpu/sparc/vm/assembler_sparc.cpp	Wed Jul 05 17:42:16 2017 +0200
@@ -4257,34 +4257,14 @@
 ///////////////////////////////////////////////////////////////////////////////////
 #ifndef SERIALGC
 
-static uint num_stores = 0;
-static uint num_null_pre_stores = 0;
-
-static void count_null_pre_vals(void* pre_val) {
-  num_stores++;
-  if (pre_val == NULL) num_null_pre_stores++;
-  if ((num_stores % 1000000) == 0) {
-    tty->print_cr(UINT32_FORMAT " stores, " UINT32_FORMAT " (%5.2f%%) with null pre-vals.",
-                  num_stores, num_null_pre_stores,
-                  100.0*(float)num_null_pre_stores/(float)num_stores);
-  }
-}
-
-static address satb_log_enqueue_with_frame = 0;
-static u_char* satb_log_enqueue_with_frame_end = 0;
-
-static address satb_log_enqueue_frameless = 0;
-static u_char* satb_log_enqueue_frameless_end = 0;
+static address satb_log_enqueue_with_frame = NULL;
+static u_char* satb_log_enqueue_with_frame_end = NULL;
+
+static address satb_log_enqueue_frameless = NULL;
+static u_char* satb_log_enqueue_frameless_end = NULL;
 
 static int EnqueueCodeSize = 128 DEBUG_ONLY( + 256); // Instructions?
 
-// The calls to this don't work.  We'd need to do a fair amount of work to
-// make it work.
-static void check_index(int ind) {
-  assert(0 <= ind && ind <= 64*K && ((ind % oopSize) == 0),
-         "Invariants.");
-}
-
 static void generate_satb_log_enqueue(bool with_frame) {
   BufferBlob* bb = BufferBlob::create("enqueue_with_frame", EnqueueCodeSize);
   CodeBuffer buf(bb);
@@ -4388,13 +4368,27 @@
   }
 }
 
-void MacroAssembler::g1_write_barrier_pre(Register obj, Register index, int offset, Register tmp, bool preserve_o_regs) {
-  assert(offset == 0 || index == noreg, "choose one");
-
-  if (G1DisablePreBarrier) return;
-  // satb_log_barrier(tmp, obj, offset, preserve_o_regs);
+void MacroAssembler::g1_write_barrier_pre(Register obj,
+                                          Register index,
+                                          int offset,
+                                          Register pre_val,
+                                          Register tmp,
+                                          bool preserve_o_regs) {
   Label filtered;
-  // satb_log_barrier_work0(tmp, filtered);
+
+  if (obj == noreg) {
+    // We are not loading the previous value so make
+    // sure that we don't trash the value in pre_val
+    // with the code below.
+    assert_different_registers(pre_val, tmp);
+  } else {
+    // We will be loading the previous value
+    // in this code so...
+    assert(offset == 0 || index == noreg, "choose one");
+    assert(pre_val == noreg, "check this code");
+  }
+
+  // Is marking active?
   if (in_bytes(PtrQueue::byte_width_of_active()) == 4) {
     ld(G2,
        in_bytes(JavaThread::satb_mark_queue_offset() +
@@ -4413,61 +4407,46 @@
   br_on_reg_cond(rc_z, /*annul*/false, Assembler::pt, tmp, filtered);
   delayed() -> nop();
 
-  // satb_log_barrier_work1(tmp, offset);
-  if (index == noreg) {
-    if (Assembler::is_simm13(offset)) {
-      load_heap_oop(obj, offset, tmp);
+  // Do we need to load the previous value?
+  if (obj != noreg) {
+    // Load the previous value...
+    if (index == noreg) {
+      if (Assembler::is_simm13(offset)) {
+        load_heap_oop(obj, offset, tmp);
+      } else {
+        set(offset, tmp);
+        load_heap_oop(obj, tmp, tmp);
+      }
     } else {
-      set(offset, tmp);
-      load_heap_oop(obj, tmp, tmp);
+      load_heap_oop(obj, index, tmp);
     }
-  } else {
-    load_heap_oop(obj, index, tmp);
+    // Previous value has been loaded into tmp
+    pre_val = tmp;
   }
 
-  // satb_log_barrier_work2(obj, tmp, offset);
-
-  // satb_log_barrier_work3(tmp, filtered, preserve_o_regs);
-
-  const Register pre_val = tmp;
-
-  if (G1SATBBarrierPrintNullPreVals) {
-    save_frame(0);
-    mov(pre_val, O0);
-    // Save G-regs that target may use.
-    mov(G1, L1);
-    mov(G2, L2);
-    mov(G3, L3);
-    mov(G4, L4);
-    mov(G5, L5);
-    call(CAST_FROM_FN_PTR(address, &count_null_pre_vals));
-    delayed()->nop();
-    // Restore G-regs that target may have used.
-    mov(L1, G1);
-    mov(L2, G2);
-    mov(L3, G3);
-    mov(L4, G4);
-    mov(L5, G5);
-    restore(G0, G0, G0);
-  }
-
+  assert(pre_val != noreg, "must have a real register");
+
+  // Is the previous value null?
   // Check on whether to annul.
   br_on_reg_cond(rc_z, /*annul*/false, Assembler::pt, pre_val, filtered);
   delayed() -> nop();
 
   // OK, it's not filtered, so we'll need to call enqueue.  In the normal
-  // case, pre_val will be a scratch G-reg, but there's some cases in which
-  // it's an O-reg.  In the first case, do a normal call.  In the latter,
-  // do a save here and call the frameless version.
+  // case, pre_val will be a scratch G-reg, but there are some cases in
+  // which it's an O-reg.  In the first case, do a normal call.  In the
+  // latter, do a save here and call the frameless version.
 
   guarantee(pre_val->is_global() || pre_val->is_out(),
             "Or we need to think harder.");
+
   if (pre_val->is_global() && !preserve_o_regs) {
-    generate_satb_log_enqueue_if_necessary(true); // with frame.
+    generate_satb_log_enqueue_if_necessary(true); // with frame
+
     call(satb_log_enqueue_with_frame);
     delayed()->mov(pre_val, O0);
   } else {
-    generate_satb_log_enqueue_if_necessary(false); // with frameless.
+    generate_satb_log_enqueue_if_necessary(false); // frameless
+
     save_frame(0);
     call(satb_log_enqueue_frameless);
     delayed()->mov(pre_val->after_save(), O0);
@@ -4614,7 +4593,6 @@
   MacroAssembler* post_filter_masm = this;
 
   if (new_val == G0) return;
-  if (G1DisablePostBarrier) return;
 
   G1SATBCardTableModRefBS* bs = (G1SATBCardTableModRefBS*) Universe::heap()->barrier_set();
   assert(bs->kind() == BarrierSet::G1SATBCT ||
@@ -4626,6 +4604,7 @@
 #else
     srl(tmp, HeapRegion::LogOfHRGrainBytes, tmp);
 #endif
+
     if (G1PrintCTFilterStats) {
       guarantee(tmp->is_global(), "Or stats won't work...");
       // This is a sleazy hack: I'm temporarily hijacking G2, which I
--- a/hotspot/src/cpu/sparc/vm/assembler_sparc.hpp	Mon Apr 25 15:45:49 2011 -0700
+++ b/hotspot/src/cpu/sparc/vm/assembler_sparc.hpp	Wed Jul 05 17:42:16 2017 +0200
@@ -2210,15 +2210,11 @@
   void card_write_barrier_post(Register store_addr, Register new_val, Register tmp);
 
 #ifndef SERIALGC
-  // Array store and offset
-  void g1_write_barrier_pre(Register obj, Register index, int offset, Register tmp, bool preserve_o_regs);
-
+  // General G1 pre-barrier generator.
+  void g1_write_barrier_pre(Register obj, Register index, int offset, Register pre_val, Register tmp, bool preserve_o_regs);
+
+  // General G1 post-barrier generator
   void g1_write_barrier_post(Register store_addr, Register new_val, Register tmp);
-
-  // May do filtering, depending on the boolean arguments.
-  void g1_card_table_write(jbyte* byte_map_base,
-                           Register tmp, Register obj, Register new_val,
-                           bool region_filter, bool null_filter);
 #endif // SERIALGC
 
   // pushes double TOS element of FPU stack on CPU stack; pops from FPU stack
--- a/hotspot/src/cpu/sparc/vm/c1_CodeStubs_sparc.cpp	Mon Apr 25 15:45:49 2011 -0700
+++ b/hotspot/src/cpu/sparc/vm/c1_CodeStubs_sparc.cpp	Wed Jul 05 17:42:16 2017 +0200
@@ -408,13 +408,20 @@
 #ifndef SERIALGC
 
 void G1PreBarrierStub::emit_code(LIR_Assembler* ce) {
+  // At this point we know that marking is in progress.
+  // If do_load() is true then we have to emit the
+  // load of the previous value; otherwise it has already
+  // been loaded into _pre_val.
+
   __ bind(_entry);
 
   assert(pre_val()->is_register(), "Precondition.");
-
   Register pre_val_reg = pre_val()->as_register();
 
-  ce->mem2reg(addr(), pre_val(), T_OBJECT, patch_code(), info(), false /*wide*/, false /*unaligned*/);
+  if (do_load()) {
+    ce->mem2reg(addr(), pre_val(), T_OBJECT, patch_code(), info(), false /*wide*/, false /*unaligned*/);
+  }
+
   if (__ is_in_wdisp16_range(_continuation)) {
     __ br_on_reg_cond(Assembler::rc_z, /*annul*/false, Assembler::pt,
                       pre_val_reg, _continuation);
@@ -431,6 +438,96 @@
 
 }
 
+void G1UnsafeGetObjSATBBarrierStub::emit_code(LIR_Assembler* ce) {
+  // At this point we know that offset == referent_offset.
+  //
+  // So we might have to emit:
+  //   if (src == null) goto continuation.
+  //
+  // and we definitely have to emit:
+  //   if (klass(src).reference_type == REF_NONE) goto continuation
+  //   if (!marking_active) goto continuation
+  //   if (pre_val == null) goto continuation
+  //   call pre_barrier(pre_val)
+  //   goto continuation
+  //
+  __ bind(_entry);
+
+  assert(src()->is_register(), "sanity");
+  Register src_reg = src()->as_register();
+
+  if (gen_src_check()) {
+    // The original src operand was not a constant.
+    // Generate src == null?
+    if (__ is_in_wdisp16_range(_continuation)) {
+      __ br_on_reg_cond(Assembler::rc_z, /*annul*/false, Assembler::pt,
+                        src_reg, _continuation);
+    } else {
+      __ cmp(src_reg, G0);
+      __ brx(Assembler::equal, false, Assembler::pt, _continuation);
+    }
+    __ delayed()->nop();
+  }
+
+  // Generate src->_klass->_reference_type() == REF_NONE)?
+  assert(tmp()->is_register(), "sanity");
+  Register tmp_reg = tmp()->as_register();
+
+  __ load_klass(src_reg, tmp_reg);
+
+  Address ref_type_adr(tmp_reg, instanceKlass::reference_type_offset_in_bytes() + sizeof(oopDesc));
+  __ ld(ref_type_adr, tmp_reg);
+
+  if (__ is_in_wdisp16_range(_continuation)) {
+    __ br_on_reg_cond(Assembler::rc_z, /*annul*/false, Assembler::pt,
+                      tmp_reg, _continuation);
+  } else {
+    __ cmp(tmp_reg, G0);
+    __ brx(Assembler::equal, false, Assembler::pt, _continuation);
+  }
+  __ delayed()->nop();
+
+  // Is marking active?
+  assert(thread()->is_register(), "precondition");
+  Register thread_reg = thread()->as_pointer_register();
+
+  Address in_progress(thread_reg, in_bytes(JavaThread::satb_mark_queue_offset() +
+                                       PtrQueue::byte_offset_of_active()));
+
+  if (in_bytes(PtrQueue::byte_width_of_active()) == 4) {
+    __ ld(in_progress, tmp_reg);
+  } else {
+    assert(in_bytes(PtrQueue::byte_width_of_active()) == 1, "Assumption");
+    __ ldsb(in_progress, tmp_reg);
+  }
+  if (__ is_in_wdisp16_range(_continuation)) {
+    __ br_on_reg_cond(Assembler::rc_z, /*annul*/false, Assembler::pt,
+                      tmp_reg, _continuation);
+  } else {
+    __ cmp(tmp_reg, G0);
+    __ brx(Assembler::equal, false, Assembler::pt, _continuation);
+  }
+  __ delayed()->nop();
+
+  // val == null?
+  assert(val()->is_register(), "Precondition.");
+  Register val_reg = val()->as_register();
+
+  if (__ is_in_wdisp16_range(_continuation)) {
+    __ br_on_reg_cond(Assembler::rc_z, /*annul*/false, Assembler::pt,
+                      val_reg, _continuation);
+  } else {
+    __ cmp(val_reg, G0);
+    __ brx(Assembler::equal, false, Assembler::pt, _continuation);
+  }
+  __ delayed()->nop();
+
+  __ call(Runtime1::entry_for(Runtime1::Runtime1::g1_pre_barrier_slow_id));
+  __ delayed()->mov(val_reg, G4);
+  __ br(Assembler::always, false, Assembler::pt, _continuation);
+  __ delayed()->nop();
+}
+
 jbyte* G1PostBarrierStub::_byte_map_base = NULL;
 
 jbyte* G1PostBarrierStub::byte_map_base_slow() {
--- a/hotspot/src/cpu/sparc/vm/c1_LIRGenerator_sparc.cpp	Mon Apr 25 15:45:49 2011 -0700
+++ b/hotspot/src/cpu/sparc/vm/c1_LIRGenerator_sparc.cpp	Wed Jul 05 17:42:16 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2011, 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
@@ -387,7 +387,8 @@
 
   if (obj_store) {
     // Needs GC write barriers.
-    pre_barrier(LIR_OprFact::address(array_addr), false, NULL);
+    pre_barrier(LIR_OprFact::address(array_addr), LIR_OprFact::illegalOpr /* pre_val */,
+                true /* do_load */, false /* patch */, NULL);
   }
   __ move(value.result(), array_addr, null_check_info);
   if (obj_store) {
@@ -687,7 +688,8 @@
   __ add(obj.result(), offset.result(), addr);
 
   if (type == objectType) {  // Write-barrier needed for Object fields.
-    pre_barrier(addr, false, NULL);
+    pre_barrier(addr, LIR_OprFact::illegalOpr /* pre_val */,
+                true /* do_load */, false /* patch */, NULL);
   }
 
   if (type == objectType)
@@ -1187,7 +1189,8 @@
       }
 
       if (is_obj) {
-        pre_barrier(LIR_OprFact::address(addr), false, NULL);
+        pre_barrier(LIR_OprFact::address(addr), LIR_OprFact::illegalOpr /* pre_val */,
+                    true /* do_load */, false /* patch */, NULL);
         // _bs->c1_write_barrier_pre(this, LIR_OprFact::address(addr));
       }
       __ move(data, addr);
--- a/hotspot/src/cpu/sparc/vm/cppInterpreter_sparc.cpp	Mon Apr 25 15:45:49 2011 -0700
+++ b/hotspot/src/cpu/sparc/vm/cppInterpreter_sparc.cpp	Wed Jul 05 17:42:16 2017 +0200
@@ -551,6 +551,26 @@
   return NULL;
 }
 
+address InterpreterGenerator::generate_Reference_get_entry(void) {
+#ifndef SERIALGC
+  if (UseG1GC) {
+    // We need to generate have a routine that generates code to:
+    //   * load the value in the referent field
+    //   * passes that value to the pre-barrier.
+    //
+    // In the case of G1 this will record the value of the
+    // referent in an SATB buffer if marking is active.
+    // This will cause concurrent marking to mark the referent
+    // field as live.
+    Unimplemented();
+  }
+#endif // SERIALGC
+
+  // If G1 is not enabled then attempt to go through the accessor entry point
+  // Reference.get is an accessor
+  return generate_accessor_entry();
+}
+
 //
 // Interpreter stub for calling a native method. (C++ interpreter)
 // This sets up a somewhat different looking stack for calling the native method
--- a/hotspot/src/cpu/sparc/vm/interpreterGenerator_sparc.hpp	Mon Apr 25 15:45:49 2011 -0700
+++ b/hotspot/src/cpu/sparc/vm/interpreterGenerator_sparc.hpp	Wed Jul 05 17:42:16 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2011, 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
@@ -36,6 +36,7 @@
   address generate_math_entry(AbstractInterpreter::MethodKind kind);
   address generate_empty_entry(void);
   address generate_accessor_entry(void);
+  address generate_Reference_get_entry(void);
   void lock_method(void);
   void save_native_result(void);
   void restore_native_result(void);
--- a/hotspot/src/cpu/sparc/vm/interpreter_sparc.cpp	Mon Apr 25 15:45:49 2011 -0700
+++ b/hotspot/src/cpu/sparc/vm/interpreter_sparc.cpp	Wed Jul 05 17:42:16 2017 +0200
@@ -407,6 +407,8 @@
     case Interpreter::java_lang_math_abs     :                                                                             break;
     case Interpreter::java_lang_math_log     :                                                                             break;
     case Interpreter::java_lang_math_log10   :                                                                             break;
+    case Interpreter::java_lang_ref_reference_get
+                                             : entry_point = ((InterpreterGenerator*)this)->generate_Reference_get_entry(); break;
     default                                  : ShouldNotReachHere();                                                       break;
   }
 
--- a/hotspot/src/cpu/sparc/vm/templateInterpreter_sparc.cpp	Mon Apr 25 15:45:49 2011 -0700
+++ b/hotspot/src/cpu/sparc/vm/templateInterpreter_sparc.cpp	Wed Jul 05 17:42:16 2017 +0200
@@ -763,6 +763,87 @@
   return NULL;
 }
 
+// Method entry for java.lang.ref.Reference.get.
+address InterpreterGenerator::generate_Reference_get_entry(void) {
+#ifndef SERIALGC
+  // Code: _aload_0, _getfield, _areturn
+  // parameter size = 1
+  //
+  // The code that gets generated by this routine is split into 2 parts:
+  //    1. The "intrinsified" code for G1 (or any SATB based GC),
+  //    2. The slow path - which is an expansion of the regular method entry.
+  //
+  // Notes:-
+  // * In the G1 code we do not check whether we need to block for
+  //   a safepoint. If G1 is enabled then we must execute the specialized
+  //   code for Reference.get (except when the Reference object is null)
+  //   so that we can log the value in the referent field with an SATB
+  //   update buffer.
+  //   If the code for the getfield template is modified so that the
+  //   G1 pre-barrier code is executed when the current method is
+  //   Reference.get() then going through the normal method entry
+  //   will be fine.
+  // * The G1 code can, however, check the receiver object (the instance
+  //   of java.lang.Reference) and jump to the slow path if null. If the
+  //   Reference object is null then we obviously cannot fetch the referent
+  //   and so we don't need to call the G1 pre-barrier. Thus we can use the
+  //   regular method entry code to generate the NPE.
+  //
+  // This code is based on generate_accessor_enty.
+
+  address entry = __ pc();
+
+  const int referent_offset = java_lang_ref_Reference::referent_offset;
+  guarantee(referent_offset > 0, "referent offset not initialized");
+
+  if (UseG1GC) {
+     Label slow_path;
+
+    // In the G1 code we don't check if we need to reach a safepoint. We
+    // continue and the thread will safepoint at the next bytecode dispatch.
+
+    // Check if local 0 != NULL
+    // If the receiver is null then it is OK to jump to the slow path.
+    __ ld_ptr(Gargs, G0, Otos_i ); // get local 0
+    __ tst(Otos_i);  // check if local 0 == NULL and go the slow path
+    __ brx(Assembler::zero, false, Assembler::pn, slow_path);
+    __ delayed()->nop();
+
+
+    // Load the value of the referent field.
+    if (Assembler::is_simm13(referent_offset)) {
+      __ load_heap_oop(Otos_i, referent_offset, Otos_i);
+    } else {
+      __ set(referent_offset, G3_scratch);
+      __ load_heap_oop(Otos_i, G3_scratch, Otos_i);
+    }
+
+    // Generate the G1 pre-barrier code to log the value of
+    // the referent field in an SATB buffer. Note with
+    // these parameters the pre-barrier does not generate
+    // the load of the previous value
+
+    __ g1_write_barrier_pre(noreg /* obj */, noreg /* index */, 0 /* offset */,
+                            Otos_i /* pre_val */,
+                            G3_scratch /* tmp */,
+                            true /* preserve_o_regs */);
+
+    // _areturn
+    __ retl();                      // return from leaf routine
+    __ delayed()->mov(O5_savedSP, SP);
+
+    // Generate regular method entry
+    __ bind(slow_path);
+    (void) generate_normal_entry(false);
+    return entry;
+  }
+#endif // SERIALGC
+
+  // If G1 is not enabled then attempt to go through the accessor entry point
+  // Reference.get is an accessor
+  return generate_accessor_entry();
+}
+
 //
 // Interpreter stub for calling a native method. (asm interpreter)
 // This sets up a somewhat different looking stack for calling the native method
--- a/hotspot/src/cpu/sparc/vm/templateTable_sparc.cpp	Mon Apr 25 15:45:49 2011 -0700
+++ b/hotspot/src/cpu/sparc/vm/templateTable_sparc.cpp	Wed Jul 05 17:42:16 2017 +0200
@@ -57,7 +57,11 @@
     case BarrierSet::G1SATBCT:
     case BarrierSet::G1SATBCTLogging:
       {
-        __ g1_write_barrier_pre( base, index, offset, tmp, /*preserve_o_regs*/true);
+        // Load and record the previous value.
+        __ g1_write_barrier_pre(base, index, offset,
+                                noreg /* pre_val */,
+                                tmp, true /*preserve_o_regs*/);
+
         if (index == noreg ) {
           assert(Assembler::is_simm13(offset), "fix this code");
           __ store_heap_oop(val, base, offset);
--- a/hotspot/src/cpu/x86/vm/assembler_x86.cpp	Mon Apr 25 15:45:49 2011 -0700
+++ b/hotspot/src/cpu/x86/vm/assembler_x86.cpp	Wed Jul 05 17:42:16 2017 +0200
@@ -6902,26 +6902,39 @@
 #ifndef SERIALGC
 
 void MacroAssembler::g1_write_barrier_pre(Register obj,
-#ifndef _LP64
+                                          Register pre_val,
                                           Register thread,
-#endif
                                           Register tmp,
-                                          Register tmp2,
-                                          bool tosca_live) {
-  LP64_ONLY(Register thread = r15_thread;)
+                                          bool tosca_live,
+                                          bool expand_call) {
+
+  // If expand_call is true then we expand the call_VM_leaf macro
+  // directly to skip generating the check by
+  // InterpreterMacroAssembler::call_VM_leaf_base that checks _last_sp.
+
+#ifdef _LP64
+  assert(thread == r15_thread, "must be");
+#endif // _LP64
+
+  Label done;
+  Label runtime;
+
+  assert(pre_val != noreg, "check this code");
+
+  if (obj != noreg) {
+    assert_different_registers(obj, pre_val, tmp);
+    assert(pre_val != rax, "check this code");
+  }
+
   Address in_progress(thread, in_bytes(JavaThread::satb_mark_queue_offset() +
                                        PtrQueue::byte_offset_of_active()));
-
   Address index(thread, in_bytes(JavaThread::satb_mark_queue_offset() +
                                        PtrQueue::byte_offset_of_index()));
   Address buffer(thread, in_bytes(JavaThread::satb_mark_queue_offset() +
                                        PtrQueue::byte_offset_of_buf()));
 
 
-  Label done;
-  Label runtime;
-
-  // if (!marking_in_progress) goto done;
+  // Is marking active?
   if (in_bytes(PtrQueue::byte_width_of_active()) == 4) {
     cmpl(in_progress, 0);
   } else {
@@ -6930,65 +6943,92 @@
   }
   jcc(Assembler::equal, done);
 
-  // if (x.f == NULL) goto done;
-#ifdef _LP64
-  load_heap_oop(tmp2, Address(obj, 0));
-#else
-  movptr(tmp2, Address(obj, 0));
-#endif
-  cmpptr(tmp2, (int32_t) NULL_WORD);
+  // Do we need to load the previous value?
+  if (obj != noreg) {
+    load_heap_oop(pre_val, Address(obj, 0));
+  }
+
+  // Is the previous value null?
+  cmpptr(pre_val, (int32_t) NULL_WORD);
   jcc(Assembler::equal, done);
 
   // Can we store original value in the thread's buffer?
-
-#ifdef _LP64
-  movslq(tmp, index);
-  cmpq(tmp, 0);
-#else
-  cmpl(index, 0);
-#endif
-  jcc(Assembler::equal, runtime);
-#ifdef _LP64
-  subq(tmp, wordSize);
-  movl(index, tmp);
-  addq(tmp, buffer);
-#else
-  subl(index, wordSize);
-  movl(tmp, buffer);
-  addl(tmp, index);
-#endif
-  movptr(Address(tmp, 0), tmp2);
+  // Is index == 0?
+  // (The index field is typed as size_t.)
+
+  movptr(tmp, index);                   // tmp := *index_adr
+  cmpptr(tmp, 0);                       // tmp == 0?
+  jcc(Assembler::equal, runtime);       // If yes, goto runtime
+
+  subptr(tmp, wordSize);                // tmp := tmp - wordSize
+  movptr(index, tmp);                   // *index_adr := tmp
+  addptr(tmp, buffer);                  // tmp := tmp + *buffer_adr
+
+  // Record the previous value
+  movptr(Address(tmp, 0), pre_val);
   jmp(done);
+
   bind(runtime);
   // save the live input values
   if(tosca_live) push(rax);
-  push(obj);
-#ifdef _LP64
-  call_VM_leaf(CAST_FROM_FN_PTR(address, SharedRuntime::g1_wb_pre), tmp2, r15_thread);
-#else
-  push(thread);
-  call_VM_leaf(CAST_FROM_FN_PTR(address, SharedRuntime::g1_wb_pre), tmp2, thread);
-  pop(thread);
-#endif
-  pop(obj);
+
+  if (obj != noreg && obj != rax)
+    push(obj);
+
+  if (pre_val != rax)
+    push(pre_val);
+
+  // Calling the runtime using the regular call_VM_leaf mechanism generates
+  // code (generated by InterpreterMacroAssember::call_VM_leaf_base)
+  // that checks that the *(ebp+frame::interpreter_frame_last_sp) == NULL.
+  //
+  // If we care generating the pre-barrier without a frame (e.g. in the
+  // intrinsified Reference.get() routine) then ebp might be pointing to
+  // the caller frame and so this check will most likely fail at runtime.
+  //
+  // Expanding the call directly bypasses the generation of the check.
+  // So when we do not have have a full interpreter frame on the stack
+  // expand_call should be passed true.
+
+  NOT_LP64( push(thread); )
+
+  if (expand_call) {
+    LP64_ONLY( assert(pre_val != c_rarg1, "smashed arg"); )
+    pass_arg1(this, thread);
+    pass_arg0(this, pre_val);
+    MacroAssembler::call_VM_leaf_base(CAST_FROM_FN_PTR(address, SharedRuntime::g1_wb_pre), 2);
+  } else {
+    call_VM_leaf(CAST_FROM_FN_PTR(address, SharedRuntime::g1_wb_pre), pre_val, thread);
+  }
+
+  NOT_LP64( pop(thread); )
+
+  // save the live input values
+  if (pre_val != rax)
+    pop(pre_val);
+
+  if (obj != noreg && obj != rax)
+    pop(obj);
+
   if(tosca_live) pop(rax);
+
   bind(done);
-
 }
 
 void MacroAssembler::g1_write_barrier_post(Register store_addr,
                                            Register new_val,
-#ifndef _LP64
                                            Register thread,
-#endif
                                            Register tmp,
                                            Register tmp2) {
-
-  LP64_ONLY(Register thread = r15_thread;)
+#ifdef _LP64
+  assert(thread == r15_thread, "must be");
+#endif // _LP64
+
   Address queue_index(thread, in_bytes(JavaThread::dirty_card_queue_offset() +
                                        PtrQueue::byte_offset_of_index()));
   Address buffer(thread, in_bytes(JavaThread::dirty_card_queue_offset() +
                                        PtrQueue::byte_offset_of_buf()));
+
   BarrierSet* bs = Universe::heap()->barrier_set();
   CardTableModRefBS* ct = (CardTableModRefBS*)bs;
   Label done;
@@ -7067,7 +7107,6 @@
   pop(store_addr);
 
   bind(done);
-
 }
 
 #endif // SERIALGC
--- a/hotspot/src/cpu/x86/vm/assembler_x86.hpp	Mon Apr 25 15:45:49 2011 -0700
+++ b/hotspot/src/cpu/x86/vm/assembler_x86.hpp	Wed Jul 05 17:42:16 2017 +0200
@@ -1453,6 +1453,7 @@
 class MacroAssembler: public Assembler {
   friend class LIR_Assembler;
   friend class Runtime1;      // as_Address()
+
  protected:
 
   Address as_Address(AddressLiteral adr);
@@ -1674,21 +1675,22 @@
   void store_check(Register obj);                // store check for obj - register is destroyed afterwards
   void store_check(Register obj, Address dst);   // same as above, dst is exact store location (reg. is destroyed)
 
+#ifndef SERIALGC
+
   void g1_write_barrier_pre(Register obj,
-#ifndef _LP64
+                            Register pre_val,
                             Register thread,
-#endif
                             Register tmp,
-                            Register tmp2,
-                            bool     tosca_live);
+                            bool tosca_live,
+                            bool expand_call);
+
   void g1_write_barrier_post(Register store_addr,
                              Register new_val,
-#ifndef _LP64
                              Register thread,
-#endif
                              Register tmp,
                              Register tmp2);
 
+#endif // SERIALGC
 
   // split store_check(Register obj) to enhance instruction interleaving
   void store_check_part_1(Register obj);
--- a/hotspot/src/cpu/x86/vm/c1_CodeStubs_x86.cpp	Mon Apr 25 15:45:49 2011 -0700
+++ b/hotspot/src/cpu/x86/vm/c1_CodeStubs_x86.cpp	Wed Jul 05 17:42:16 2017 +0200
@@ -466,15 +466,19 @@
 #ifndef SERIALGC
 
 void G1PreBarrierStub::emit_code(LIR_Assembler* ce) {
-
-  // At this point we know that marking is in progress
+  // At this point we know that marking is in progress.
+  // If do_load() is true then we have to emit the
+  // load of the previous value; otherwise it has already
+  // been loaded into _pre_val.
 
   __ bind(_entry);
   assert(pre_val()->is_register(), "Precondition.");
 
   Register pre_val_reg = pre_val()->as_register();
 
-  ce->mem2reg(addr(), pre_val(), T_OBJECT, patch_code(), info(), false /*wide*/, false /*unaligned*/);
+  if (do_load()) {
+    ce->mem2reg(addr(), pre_val(), T_OBJECT, patch_code(), info(), false /*wide*/, false /*unaligned*/);
+  }
 
   __ cmpptr(pre_val_reg, (int32_t) NULL_WORD);
   __ jcc(Assembler::equal, _continuation);
@@ -484,6 +488,68 @@
 
 }
 
+void G1UnsafeGetObjSATBBarrierStub::emit_code(LIR_Assembler* ce) {
+  // At this point we know that offset == referent_offset.
+  //
+  // So we might have to emit:
+  //   if (src == null) goto continuation.
+  //
+  // and we definitely have to emit:
+  //   if (klass(src).reference_type == REF_NONE) goto continuation
+  //   if (!marking_active) goto continuation
+  //   if (pre_val == null) goto continuation
+  //   call pre_barrier(pre_val)
+  //   goto continuation
+  //
+  __ bind(_entry);
+
+  assert(src()->is_register(), "sanity");
+  Register src_reg = src()->as_register();
+
+  if (gen_src_check()) {
+    // The original src operand was not a constant.
+    // Generate src == null?
+    __ cmpptr(src_reg, (int32_t) NULL_WORD);
+    __ jcc(Assembler::equal, _continuation);
+  }
+
+  // Generate src->_klass->_reference_type == REF_NONE)?
+  assert(tmp()->is_register(), "sanity");
+  Register tmp_reg = tmp()->as_register();
+
+  __ load_klass(tmp_reg, src_reg);
+
+  Address ref_type_adr(tmp_reg, instanceKlass::reference_type_offset_in_bytes() + sizeof(oopDesc));
+  __ cmpl(ref_type_adr, REF_NONE);
+  __ jcc(Assembler::equal, _continuation);
+
+  // Is marking active?
+  assert(thread()->is_register(), "precondition");
+  Register thread_reg = thread()->as_pointer_register();
+
+  Address in_progress(thread_reg, in_bytes(JavaThread::satb_mark_queue_offset() +
+                                       PtrQueue::byte_offset_of_active()));
+
+  if (in_bytes(PtrQueue::byte_width_of_active()) == 4) {
+    __ cmpl(in_progress, 0);
+  } else {
+    assert(in_bytes(PtrQueue::byte_width_of_active()) == 1, "Assumption");
+    __ cmpb(in_progress, 0);
+  }
+  __ jcc(Assembler::equal, _continuation);
+
+  // val == null?
+  assert(val()->is_register(), "Precondition.");
+  Register val_reg = val()->as_register();
+
+  __ cmpptr(val_reg, (int32_t) NULL_WORD);
+  __ jcc(Assembler::equal, _continuation);
+
+  ce->store_parameter(val()->as_register(), 0);
+  __ call(RuntimeAddress(Runtime1::entry_for(Runtime1::g1_pre_barrier_slow_id)));
+  __ jmp(_continuation);
+}
+
 jbyte* G1PostBarrierStub::_byte_map_base = NULL;
 
 jbyte* G1PostBarrierStub::byte_map_base_slow() {
--- a/hotspot/src/cpu/x86/vm/c1_LIRGenerator_x86.cpp	Mon Apr 25 15:45:49 2011 -0700
+++ b/hotspot/src/cpu/x86/vm/c1_LIRGenerator_x86.cpp	Wed Jul 05 17:42:16 2017 +0200
@@ -326,7 +326,8 @@
 
   if (obj_store) {
     // Needs GC write barriers.
-    pre_barrier(LIR_OprFact::address(array_addr), false, NULL);
+    pre_barrier(LIR_OprFact::address(array_addr), LIR_OprFact::illegalOpr /* pre_val */,
+                true /* do_load */, false /* patch */, NULL);
     __ move(value.result(), array_addr, null_check_info);
     // Seems to be a precise
     post_barrier(LIR_OprFact::address(array_addr), value.result());
@@ -794,7 +795,8 @@
 
   if (type == objectType) {  // Write-barrier needed for Object fields.
     // Do the pre-write barrier, if any.
-    pre_barrier(addr, false, NULL);
+    pre_barrier(addr, LIR_OprFact::illegalOpr /* pre_val */,
+                true /* do_load */, false /* patch */, NULL);
   }
 
   LIR_Opr ill = LIR_OprFact::illegalOpr;  // for convenience
@@ -1339,7 +1341,8 @@
     bool is_obj = (type == T_ARRAY || type == T_OBJECT);
     if (is_obj) {
       // Do the pre-write barrier, if any.
-      pre_barrier(LIR_OprFact::address(addr), false, NULL);
+      pre_barrier(LIR_OprFact::address(addr), LIR_OprFact::illegalOpr /* pre_val */,
+                  true /* do_load */, false /* patch */, NULL);
       __ move(data, addr);
       assert(src->is_register(), "must be register");
       // Seems to be a precise address
--- a/hotspot/src/cpu/x86/vm/cppInterpreterGenerator_x86.hpp	Mon Apr 25 15:45:49 2011 -0700
+++ b/hotspot/src/cpu/x86/vm/cppInterpreterGenerator_x86.hpp	Wed Jul 05 17:42:16 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2011, 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
@@ -34,6 +34,7 @@
   address generate_math_entry(AbstractInterpreter::MethodKind kind);
   address generate_empty_entry(void);
   address generate_accessor_entry(void);
+  address generate_Reference_get_entry(void);
   void lock_method(void);
   void generate_stack_overflow_check(void);
 
--- a/hotspot/src/cpu/x86/vm/cppInterpreter_x86.cpp	Mon Apr 25 15:45:49 2011 -0700
+++ b/hotspot/src/cpu/x86/vm/cppInterpreter_x86.cpp	Wed Jul 05 17:42:16 2017 +0200
@@ -936,6 +936,26 @@
 
 }
 
+address InterpreterGenerator::generate_Reference_get_entry(void) {
+#ifndef SERIALGC
+  if (UseG1GC) {
+    // We need to generate have a routine that generates code to:
+    //   * load the value in the referent field
+    //   * passes that value to the pre-barrier.
+    //
+    // In the case of G1 this will record the value of the
+    // referent in an SATB buffer if marking is active.
+    // This will cause concurrent marking to mark the referent
+    // field as live.
+    Unimplemented();
+  }
+#endif // SERIALGC
+
+  // If G1 is not enabled then attempt to go through the accessor entry point
+  // Reference.get is an accessor
+  return generate_accessor_entry();
+}
+
 //
 // C++ Interpreter stub for calling a native method.
 // This sets up a somewhat different looking stack for calling the native method
@@ -2210,6 +2230,8 @@
     case Interpreter::java_lang_math_log     : // fall thru
     case Interpreter::java_lang_math_log10   : // fall thru
     case Interpreter::java_lang_math_sqrt    : entry_point = ((InterpreterGenerator*)this)->generate_math_entry(kind);     break;
+    case Interpreter::java_lang_ref_reference_get
+                                             : entry_point = ((InterpreterGenerator*)this)->generate_Reference_get_entry(); break;
     default                                  : ShouldNotReachHere();                                                       break;
   }
 
--- a/hotspot/src/cpu/x86/vm/interpreterGenerator_x86.hpp	Mon Apr 25 15:45:49 2011 -0700
+++ b/hotspot/src/cpu/x86/vm/interpreterGenerator_x86.hpp	Wed Jul 05 17:42:16 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2011, 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
@@ -39,6 +39,7 @@
   address generate_math_entry(AbstractInterpreter::MethodKind kind);
   address generate_empty_entry(void);
   address generate_accessor_entry(void);
+  address generate_Reference_get_entry();
   void lock_method(void);
   void generate_stack_overflow_check(void);
 
--- a/hotspot/src/cpu/x86/vm/templateInterpreter_x86_32.cpp	Mon Apr 25 15:45:49 2011 -0700
+++ b/hotspot/src/cpu/x86/vm/templateInterpreter_x86_32.cpp	Wed Jul 05 17:42:16 2017 +0200
@@ -776,6 +776,98 @@
 
 }
 
+// Method entry for java.lang.ref.Reference.get.
+address InterpreterGenerator::generate_Reference_get_entry(void) {
+#ifndef SERIALGC
+  // Code: _aload_0, _getfield, _areturn
+  // parameter size = 1
+  //
+  // The code that gets generated by this routine is split into 2 parts:
+  //    1. The "intrinsified" code for G1 (or any SATB based GC),
+  //    2. The slow path - which is an expansion of the regular method entry.
+  //
+  // Notes:-
+  // * In the G1 code we do not check whether we need to block for
+  //   a safepoint. If G1 is enabled then we must execute the specialized
+  //   code for Reference.get (except when the Reference object is null)
+  //   so that we can log the value in the referent field with an SATB
+  //   update buffer.
+  //   If the code for the getfield template is modified so that the
+  //   G1 pre-barrier code is executed when the current method is
+  //   Reference.get() then going through the normal method entry
+  //   will be fine.
+  // * The G1 code below can, however, check the receiver object (the instance
+  //   of java.lang.Reference) and jump to the slow path if null. If the
+  //   Reference object is null then we obviously cannot fetch the referent
+  //   and so we don't need to call the G1 pre-barrier. Thus we can use the
+  //   regular method entry code to generate the NPE.
+  //
+  // This code is based on generate_accessor_enty.
+
+  // rbx,: methodOop
+  // rcx: receiver (preserve for slow entry into asm interpreter)
+
+  // rsi: senderSP must preserved for slow path, set SP to it on fast path
+
+  address entry = __ pc();
+
+  const int referent_offset = java_lang_ref_Reference::referent_offset;
+  guarantee(referent_offset > 0, "referent offset not initialized");
+
+  if (UseG1GC) {
+    Label slow_path;
+
+    // Check if local 0 != NULL
+    // If the receiver is null then it is OK to jump to the slow path.
+    __ movptr(rax, Address(rsp, wordSize));
+    __ testptr(rax, rax);
+    __ jcc(Assembler::zero, slow_path);
+
+    // rax: local 0 (must be preserved across the G1 barrier call)
+    //
+    // rbx: method (at this point it's scratch)
+    // rcx: receiver (at this point it's scratch)
+    // rdx: scratch
+    // rdi: scratch
+    //
+    // rsi: sender sp
+
+    // Preserve the sender sp in case the pre-barrier
+    // calls the runtime
+    __ push(rsi);
+
+    // Load the value of the referent field.
+    const Address field_address(rax, referent_offset);
+    __ movptr(rax, field_address);
+
+    // Generate the G1 pre-barrier code to log the value of
+    // the referent field in an SATB buffer.
+    __ get_thread(rcx);
+    __ g1_write_barrier_pre(noreg /* obj */,
+                            rax /* pre_val */,
+                            rcx /* thread */,
+                            rbx /* tmp */,
+                            true /* tosca_save */,
+                            true /* expand_call */);
+
+    // _areturn
+    __ pop(rsi);                // get sender sp
+    __ pop(rdi);                // get return address
+    __ mov(rsp, rsi);           // set sp to sender sp
+    __ jmp(rdi);
+
+    __ bind(slow_path);
+    (void) generate_normal_entry(false);
+
+    return entry;
+  }
+#endif // SERIALGC
+
+  // If G1 is not enabled then attempt to go through the accessor entry point
+  // Reference.get is an accessor
+  return generate_accessor_entry();
+}
+
 //
 // Interpreter stub for calling a native method. (asm interpreter)
 // This sets up a somewhat different looking stack for calling the native method
@@ -1444,6 +1536,8 @@
     case Interpreter::java_lang_math_log     : // fall thru
     case Interpreter::java_lang_math_log10   : // fall thru
     case Interpreter::java_lang_math_sqrt    : entry_point = ((InterpreterGenerator*)this)->generate_math_entry(kind);     break;
+    case Interpreter::java_lang_ref_reference_get
+                                             : entry_point = ((InterpreterGenerator*)this)->generate_Reference_get_entry(); break;
     default                                  : ShouldNotReachHere();                                                       break;
   }
 
--- a/hotspot/src/cpu/x86/vm/templateInterpreter_x86_64.cpp	Mon Apr 25 15:45:49 2011 -0700
+++ b/hotspot/src/cpu/x86/vm/templateInterpreter_x86_64.cpp	Wed Jul 05 17:42:16 2017 +0200
@@ -757,6 +757,95 @@
   return entry_point;
 }
 
+// Method entry for java.lang.ref.Reference.get.
+address InterpreterGenerator::generate_Reference_get_entry(void) {
+#ifndef SERIALGC
+  // Code: _aload_0, _getfield, _areturn
+  // parameter size = 1
+  //
+  // The code that gets generated by this routine is split into 2 parts:
+  //    1. The "intrinsified" code for G1 (or any SATB based GC),
+  //    2. The slow path - which is an expansion of the regular method entry.
+  //
+  // Notes:-
+  // * In the G1 code we do not check whether we need to block for
+  //   a safepoint. If G1 is enabled then we must execute the specialized
+  //   code for Reference.get (except when the Reference object is null)
+  //   so that we can log the value in the referent field with an SATB
+  //   update buffer.
+  //   If the code for the getfield template is modified so that the
+  //   G1 pre-barrier code is executed when the current method is
+  //   Reference.get() then going through the normal method entry
+  //   will be fine.
+  // * The G1 code can, however, check the receiver object (the instance
+  //   of java.lang.Reference) and jump to the slow path if null. If the
+  //   Reference object is null then we obviously cannot fetch the referent
+  //   and so we don't need to call the G1 pre-barrier. Thus we can use the
+  //   regular method entry code to generate the NPE.
+  //
+  // This code is based on generate_accessor_enty.
+  //
+  // rbx: methodOop
+
+  // r13: senderSP must preserve for slow path, set SP to it on fast path
+
+  address entry = __ pc();
+
+  const int referent_offset = java_lang_ref_Reference::referent_offset;
+  guarantee(referent_offset > 0, "referent offset not initialized");
+
+  if (UseG1GC) {
+    Label slow_path;
+    // rbx: method
+
+    // Check if local 0 != NULL
+    // If the receiver is null then it is OK to jump to the slow path.
+    __ movptr(rax, Address(rsp, wordSize));
+
+    __ testptr(rax, rax);
+    __ jcc(Assembler::zero, slow_path);
+
+    // rax: local 0
+    // rbx: method (but can be used as scratch now)
+    // rdx: scratch
+    // rdi: scratch
+
+    // Generate the G1 pre-barrier code to log the value of
+    // the referent field in an SATB buffer.
+
+    // Load the value of the referent field.
+    const Address field_address(rax, referent_offset);
+    __ load_heap_oop(rax, field_address);
+
+    // Generate the G1 pre-barrier code to log the value of
+    // the referent field in an SATB buffer.
+    __ g1_write_barrier_pre(noreg /* obj */,
+                            rax /* pre_val */,
+                            r15_thread /* thread */,
+                            rbx /* tmp */,
+                            true /* tosca_live */,
+                            true /* expand_call */);
+
+    // _areturn
+    __ pop(rdi);                // get return address
+    __ mov(rsp, r13);           // set sp to sender sp
+    __ jmp(rdi);
+    __ ret(0);
+
+    // generate a vanilla interpreter entry as the slow path
+    __ bind(slow_path);
+    (void) generate_normal_entry(false);
+
+    return entry;
+  }
+#endif // SERIALGC
+
+  // If G1 is not enabled then attempt to go through the accessor entry point
+  // Reference.get is an accessor
+  return generate_accessor_entry();
+}
+
+
 // Interpreter stub for calling a native method. (asm interpreter)
 // This sets up a somewhat different looking stack for calling the
 // native method than the typical interpreter frame setup.
@@ -1463,6 +1552,8 @@
   case Interpreter::java_lang_math_log     : // fall thru
   case Interpreter::java_lang_math_log10   : // fall thru
   case Interpreter::java_lang_math_sqrt    : entry_point = ((InterpreterGenerator*) this)->generate_math_entry(kind);    break;
+  case Interpreter::java_lang_ref_reference_get
+                                           : entry_point = ((InterpreterGenerator*)this)->generate_Reference_get_entry(); break;
   default                                  : ShouldNotReachHere();                                                       break;
   }
 
--- a/hotspot/src/cpu/x86/vm/templateTable_x86_32.cpp	Mon Apr 25 15:45:49 2011 -0700
+++ b/hotspot/src/cpu/x86/vm/templateTable_x86_32.cpp	Wed Jul 05 17:42:16 2017 +0200
@@ -140,7 +140,12 @@
         }
         __ get_thread(rcx);
         __ save_bcp();
-        __ g1_write_barrier_pre(rdx, rcx, rsi, rbx, val != noreg);
+        __ g1_write_barrier_pre(rdx /* obj */,
+                                rbx /* pre_val */,
+                                rcx /* thread */,
+                                rsi /* tmp */,
+                                val != noreg /* tosca_live */,
+                                false /* expand_call */);
 
         // Do the actual store
         // noreg means NULL
@@ -149,7 +154,11 @@
           // No post barrier for NULL
         } else {
           __ movl(Address(rdx, 0), val);
-          __ g1_write_barrier_post(rdx, rax, rcx, rbx, rsi);
+          __ g1_write_barrier_post(rdx /* store_adr */,
+                                   val /* new_val */,
+                                   rcx /* thread */,
+                                   rbx /* tmp */,
+                                   rsi /* tmp2 */);
         }
         __ restore_bcp();
 
--- a/hotspot/src/cpu/x86/vm/templateTable_x86_64.cpp	Mon Apr 25 15:45:49 2011 -0700
+++ b/hotspot/src/cpu/x86/vm/templateTable_x86_64.cpp	Wed Jul 05 17:42:16 2017 +0200
@@ -147,12 +147,21 @@
         } else {
           __ leaq(rdx, obj);
         }
-        __ g1_write_barrier_pre(rdx, r8, rbx, val != noreg);
+        __ g1_write_barrier_pre(rdx /* obj */,
+                                rbx /* pre_val */,
+                                r15_thread /* thread */,
+                                r8  /* tmp */,
+                                val != noreg /* tosca_live */,
+                                false /* expand_call */);
         if (val == noreg) {
           __ store_heap_oop_null(Address(rdx, 0));
         } else {
           __ store_heap_oop(Address(rdx, 0), val);
-          __ g1_write_barrier_post(rdx, val, r8, rbx);
+          __ g1_write_barrier_post(rdx /* store_adr */,
+                                   val /* new_val */,
+                                   r15_thread /* thread */,
+                                   r8 /* tmp */,
+                                   rbx /* tmp2 */);
         }
 
       }
--- a/hotspot/src/cpu/zero/vm/cppInterpreter_zero.cpp	Mon Apr 25 15:45:49 2011 -0700
+++ b/hotspot/src/cpu/zero/vm/cppInterpreter_zero.cpp	Wed Jul 05 17:42:16 2017 +0200
@@ -1302,6 +1302,26 @@
   return generate_entry((address) CppInterpreter::accessor_entry);
 }
 
+address InterpreterGenerator::generate_Reference_get_entry(void) {
+#ifndef SERIALGC
+  if (UseG1GC) {
+    // We need to generate have a routine that generates code to:
+    //   * load the value in the referent field
+    //   * passes that value to the pre-barrier.
+    //
+    // In the case of G1 this will record the value of the
+    // referent in an SATB buffer if marking is active.
+    // This will cause concurrent marking to mark the referent
+    // field as live.
+    Unimplemented();
+  }
+#endif // SERIALGC
+
+  // If G1 is not enabled then attempt to go through the accessor entry point
+  // Reference.get is an accessor
+  return generate_accessor_entry();
+}
+
 address InterpreterGenerator::generate_native_entry(bool synchronized) {
   assert(synchronized == false, "should be");
 
@@ -1357,6 +1377,10 @@
     entry_point = ((InterpreterGenerator*) this)->generate_math_entry(kind);
     break;
 
+  case Interpreter::java_lang_ref_reference_get:
+    entry_point = ((InterpreterGenerator*)this)->generate_Reference_get_entry();
+    break;
+
   default:
     ShouldNotReachHere();
   }
--- a/hotspot/src/cpu/zero/vm/interpreterGenerator_zero.hpp	Mon Apr 25 15:45:49 2011 -0700
+++ b/hotspot/src/cpu/zero/vm/interpreterGenerator_zero.hpp	Wed Jul 05 17:42:16 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
  * Copyright 2007 Red Hat, Inc.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
@@ -37,6 +37,7 @@
   address generate_math_entry(AbstractInterpreter::MethodKind kind);
   address generate_empty_entry();
   address generate_accessor_entry();
+  address generate_Reference_get_entry();
   address generate_method_handle_entry();
 
 #endif // CPU_ZERO_VM_INTERPRETERGENERATOR_ZERO_HPP
--- a/hotspot/src/os/windows/vm/os_windows.cpp	Mon Apr 25 15:45:49 2011 -0700
+++ b/hotspot/src/os/windows/vm/os_windows.cpp	Wed Jul 05 17:42:16 2017 +0200
@@ -921,6 +921,8 @@
   HINSTANCE dbghelp;
   EXCEPTION_POINTERS ep;
   MINIDUMP_EXCEPTION_INFORMATION mei;
+  MINIDUMP_EXCEPTION_INFORMATION* pmei;
+
   HANDLE hProcess = GetCurrentProcess();
   DWORD processId = GetCurrentProcessId();
   HANDLE dumpFile;
@@ -971,17 +973,22 @@
     VMError::report_coredump_status("Failed to create file for dumping", false);
     return;
   }
-
-  ep.ContextRecord = (PCONTEXT) contextRecord;
-  ep.ExceptionRecord = (PEXCEPTION_RECORD) exceptionRecord;
-
-  mei.ThreadId = GetCurrentThreadId();
-  mei.ExceptionPointers = &ep;
+  if (exceptionRecord != NULL && contextRecord != NULL) {
+    ep.ContextRecord = (PCONTEXT) contextRecord;
+    ep.ExceptionRecord = (PEXCEPTION_RECORD) exceptionRecord;
+
+    mei.ThreadId = GetCurrentThreadId();
+    mei.ExceptionPointers = &ep;
+    pmei = &mei;
+  } else {
+    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, &mei, NULL, NULL) == false &&
-      _MiniDumpWriteDump(hProcess, processId, dumpFile, (MINIDUMP_TYPE)MiniDumpWithFullMemory, &mei, NULL, NULL) == false) {
+  if (_MiniDumpWriteDump(hProcess, processId, dumpFile, dumpType, pmei, NULL, NULL) == false &&
+      _MiniDumpWriteDump(hProcess, processId, dumpFile, (MINIDUMP_TYPE)MiniDumpWithFullMemory, pmei, NULL, NULL) == false) {
     VMError::report_coredump_status("Call to MiniDumpWriteDump() failed", false);
   } else {
     VMError::report_coredump_status(buffer, true);
--- a/hotspot/src/share/vm/c1/c1_CodeStubs.hpp	Mon Apr 25 15:45:49 2011 -0700
+++ b/hotspot/src/share/vm/c1/c1_CodeStubs.hpp	Wed Jul 05 17:42:16 2017 +0200
@@ -519,42 +519,126 @@
 // Code stubs for Garbage-First barriers.
 class G1PreBarrierStub: public CodeStub {
  private:
+  bool _do_load;
   LIR_Opr _addr;
   LIR_Opr _pre_val;
   LIR_PatchCode _patch_code;
   CodeEmitInfo* _info;
 
  public:
+  // Version that _does_ generate a load of the previous value from addr.
+  // addr (the address of the field to be read) must be a LIR_Address
   // pre_val (a temporary register) must be a register;
-  // addr (the address of the field to be read) must be a LIR_Address
   G1PreBarrierStub(LIR_Opr addr, LIR_Opr pre_val, LIR_PatchCode patch_code, CodeEmitInfo* info) :
-    _addr(addr), _pre_val(pre_val), _patch_code(patch_code), _info(info)
+    _addr(addr), _pre_val(pre_val), _do_load(true),
+    _patch_code(patch_code), _info(info)
   {
     assert(_pre_val->is_register(), "should be temporary register");
     assert(_addr->is_address(), "should be the address of the field");
   }
 
+  // Version that _does not_ generate load of the previous value; the
+  // previous value is assumed to have already been loaded into pre_val.
+  G1PreBarrierStub(LIR_Opr pre_val) :
+    _addr(LIR_OprFact::illegalOpr), _pre_val(pre_val), _do_load(false),
+    _patch_code(lir_patch_none), _info(NULL)
+  {
+    assert(_pre_val->is_register(), "should be a register");
+  }
+
   LIR_Opr addr() const { return _addr; }
   LIR_Opr pre_val() const { return _pre_val; }
   LIR_PatchCode patch_code() const { return _patch_code; }
   CodeEmitInfo* info() const { return _info; }
+  bool do_load() const { return _do_load; }
 
   virtual void emit_code(LIR_Assembler* e);
   virtual void visit(LIR_OpVisitState* visitor) {
-    // don't pass in the code emit info since it's processed in the fast
-    // path
-    if (_info != NULL)
-      visitor->do_slow_case(_info);
-    else
+    if (_do_load) {
+      // don't pass in the code emit info since it's processed in the fast
+      // path
+      if (_info != NULL)
+        visitor->do_slow_case(_info);
+      else
+        visitor->do_slow_case();
+
+      visitor->do_input(_addr);
+      visitor->do_temp(_pre_val);
+    } else {
       visitor->do_slow_case();
-    visitor->do_input(_addr);
-    visitor->do_temp(_pre_val);
+      visitor->do_input(_pre_val);
+    }
   }
 #ifndef PRODUCT
   virtual void print_name(outputStream* out) const { out->print("G1PreBarrierStub"); }
 #endif // PRODUCT
 };
 
+// This G1 barrier code stub is used in Unsafe.getObject.
+// It generates a sequence of guards around the SATB
+// barrier code that are used to detect when we have
+// the referent field of a Reference object.
+// The first check is assumed to have been generated
+// in the code generated for Unsafe.getObject().
+
+class G1UnsafeGetObjSATBBarrierStub: public CodeStub {
+ private:
+  LIR_Opr _val;
+  LIR_Opr _src;
+
+  LIR_Opr _tmp;
+  LIR_Opr _thread;
+
+  bool _gen_src_check;
+
+ public:
+  // A G1 barrier that is guarded by generated guards that determine whether
+  // val (which is the result of Unsafe.getObject() should be recorded in an
+  // SATB log buffer. We could be reading the referent field of a Reference object
+  // using Unsafe.getObject() and we need to record the referent.
+  //
+  // * val is the operand returned by the unsafe.getObject routine.
+  // * src is the base object
+  // * tmp is a temp used to load the klass of src, and then reference type
+  // * thread is the thread object.
+
+  G1UnsafeGetObjSATBBarrierStub(LIR_Opr val, LIR_Opr src,
+                                LIR_Opr tmp, LIR_Opr thread,
+                                bool gen_src_check) :
+    _val(val), _src(src),
+    _tmp(tmp), _thread(thread),
+    _gen_src_check(gen_src_check)
+  {
+    assert(_val->is_register(), "should have already been loaded");
+    assert(_src->is_register(), "should have already been loaded");
+
+    assert(_tmp->is_register(), "should be a temporary register");
+  }
+
+  LIR_Opr val() const { return _val; }
+  LIR_Opr src() const { return _src; }
+
+  LIR_Opr tmp() const { return _tmp; }
+  LIR_Opr thread() const { return _thread; }
+
+  bool gen_src_check() const { return _gen_src_check; }
+
+  virtual void emit_code(LIR_Assembler* e);
+
+  virtual void visit(LIR_OpVisitState* visitor) {
+    visitor->do_slow_case();
+    visitor->do_input(_val);
+    visitor->do_input(_src);
+    visitor->do_input(_thread);
+
+    visitor->do_temp(_tmp);
+  }
+
+#ifndef PRODUCT
+  virtual void print_name(outputStream* out) const { out->print("G1UnsafeGetObjSATBBarrierStub"); }
+#endif // PRODUCT
+};
+
 class G1PostBarrierStub: public CodeStub {
  private:
   LIR_Opr _addr;
--- a/hotspot/src/share/vm/c1/c1_GraphBuilder.cpp	Mon Apr 25 15:45:49 2011 -0700
+++ b/hotspot/src/share/vm/c1/c1_GraphBuilder.cpp	Wed Jul 05 17:42:16 2017 +0200
@@ -2913,6 +2913,46 @@
       block()->set_end(end);
       break;
     }
+
+  case vmIntrinsics::_Reference_get:
+    {
+      if (UseG1GC) {
+        // With java.lang.ref.reference.get() we must go through the
+        // intrinsic - when G1 is enabled - even when get() is the root
+        // method of the compile so that, if necessary, the value in
+        // the referent field of the reference object gets recorded by
+        // the pre-barrier code.
+        // Specifically, if G1 is enabled, the value in the referent
+        // field is recorded by the G1 SATB pre barrier. This will
+        // result in the referent being marked live and the reference
+        // object removed from the list of discovered references during
+        // reference processing.
+
+        // Set up a stream so that appending instructions works properly.
+        ciBytecodeStream s(scope->method());
+        s.reset_to_bci(0);
+        scope_data()->set_stream(&s);
+        s.next();
+
+        // setup the initial block state
+        _block = start_block;
+        _state = start_block->state()->copy_for_parsing();
+        _last  = start_block;
+        load_local(objectType, 0);
+
+        // Emit the intrinsic node.
+        bool result = try_inline_intrinsics(scope->method());
+        if (!result) BAILOUT("failed to inline intrinsic");
+        method_return(apop());
+
+        // connect the begin and end blocks and we're all done.
+        BlockEnd* end = last()->as_BlockEnd();
+        block()->set_end(end);
+        break;
+      }
+      // Otherwise, fall thru
+    }
+
   default:
     scope_data()->add_to_work_list(start_block);
     iterate_all_blocks();
@@ -3150,6 +3190,15 @@
       append_unsafe_CAS(callee);
       return true;
 
+    case vmIntrinsics::_Reference_get:
+      // It is only when G1 is enabled that we absolutely
+      // need to use the intrinsic version of Reference.get()
+      // so that the value in the referent field, if necessary,
+      // can be registered by the pre-barrier code.
+      if (!UseG1GC) return false;
+      preserves_state = true;
+      break;
+
     default                       : return false; // do not inline
   }
   // create intrinsic node
--- a/hotspot/src/share/vm/c1/c1_Instruction.cpp	Mon Apr 25 15:45:49 2011 -0700
+++ b/hotspot/src/share/vm/c1/c1_Instruction.cpp	Wed Jul 05 17:42:16 2017 +0200
@@ -596,7 +596,7 @@
 // of the inserted block, without recomputing the values of the other blocks
 // in the CFG. Therefore the value of "depth_first_number" in BlockBegin becomes meaningless.
 BlockBegin* BlockBegin::insert_block_between(BlockBegin* sux) {
-  BlockBegin* new_sux = new BlockBegin(-99);
+  BlockBegin* new_sux = new BlockBegin(end()->state()->bci());
 
   // mark this block (special treatment when block order is computed)
   new_sux->set(critical_edge_split_flag);
--- a/hotspot/src/share/vm/c1/c1_LIRGenerator.cpp	Mon Apr 25 15:45:49 2011 -0700
+++ b/hotspot/src/share/vm/c1/c1_LIRGenerator.cpp	Wed Jul 05 17:42:16 2017 +0200
@@ -1209,6 +1209,38 @@
   set_no_result(x);
 }
 
+// Examble: ref.get()
+// Combination of LoadField and g1 pre-write barrier
+void LIRGenerator::do_Reference_get(Intrinsic* x) {
+
+  const int referent_offset = java_lang_ref_Reference::referent_offset;
+  guarantee(referent_offset > 0, "referent offset not initialized");
+
+  assert(x->number_of_arguments() == 1, "wrong type");
+
+  LIRItem reference(x->argument_at(0), this);
+  reference.load_item();
+
+  // need to perform the null check on the reference objecy
+  CodeEmitInfo* info = NULL;
+  if (x->needs_null_check()) {
+    info = state_for(x);
+  }
+
+  LIR_Address* referent_field_adr =
+    new LIR_Address(reference.result(), referent_offset, T_OBJECT);
+
+  LIR_Opr result = rlock_result(x);
+
+  __ load(referent_field_adr, result, info);
+
+  // Register the value in the referent field with the pre-barrier
+  pre_barrier(LIR_OprFact::illegalOpr /* addr_opr */,
+              result /* pre_val */,
+              false  /* do_load */,
+              false  /* patch */,
+              NULL   /* info */);
+}
 
 // Example: object.getClass ()
 void LIRGenerator::do_getClass(Intrinsic* x) {
@@ -1351,13 +1383,14 @@
 
 // Various barriers
 
-void LIRGenerator::pre_barrier(LIR_Opr addr_opr, bool patch,  CodeEmitInfo* info) {
+void LIRGenerator::pre_barrier(LIR_Opr addr_opr, LIR_Opr pre_val,
+                               bool do_load, bool patch, CodeEmitInfo* info) {
   // Do the pre-write barrier, if any.
   switch (_bs->kind()) {
 #ifndef SERIALGC
     case BarrierSet::G1SATBCT:
     case BarrierSet::G1SATBCTLogging:
-      G1SATBCardTableModRef_pre_barrier(addr_opr, patch, info);
+      G1SATBCardTableModRef_pre_barrier(addr_opr, pre_val, do_load, patch, info);
       break;
 #endif // SERIALGC
     case BarrierSet::CardTableModRef:
@@ -1398,9 +1431,8 @@
 ////////////////////////////////////////////////////////////////////////
 #ifndef SERIALGC
 
-void LIRGenerator::G1SATBCardTableModRef_pre_barrier(LIR_Opr addr_opr, bool patch,  CodeEmitInfo* info) {
-  if (G1DisablePreBarrier) return;
-
+void LIRGenerator::G1SATBCardTableModRef_pre_barrier(LIR_Opr addr_opr, LIR_Opr pre_val,
+                                                     bool do_load, bool patch, CodeEmitInfo* info) {
   // First we test whether marking is in progress.
   BasicType flag_type;
   if (in_bytes(PtrQueue::byte_width_of_active()) == 4) {
@@ -1419,26 +1451,40 @@
   // Read the marking-in-progress flag.
   LIR_Opr flag_val = new_register(T_INT);
   __ load(mark_active_flag_addr, flag_val);
-
-  LIR_PatchCode pre_val_patch_code =
-    patch ? lir_patch_normal : lir_patch_none;
-
-  LIR_Opr pre_val = new_register(T_OBJECT);
-
   __ cmp(lir_cond_notEqual, flag_val, LIR_OprFact::intConst(0));
-  if (!addr_opr->is_address()) {
-    assert(addr_opr->is_register(), "must be");
-    addr_opr = LIR_OprFact::address(new LIR_Address(addr_opr, T_OBJECT));
+
+  LIR_PatchCode pre_val_patch_code = lir_patch_none;
+
+  CodeStub* slow;
+
+  if (do_load) {
+    assert(pre_val == LIR_OprFact::illegalOpr, "sanity");
+    assert(addr_opr != LIR_OprFact::illegalOpr, "sanity");
+
+    if (patch)
+      pre_val_patch_code = lir_patch_normal;
+
+    pre_val = new_register(T_OBJECT);
+
+    if (!addr_opr->is_address()) {
+      assert(addr_opr->is_register(), "must be");
+      addr_opr = LIR_OprFact::address(new LIR_Address(addr_opr, T_OBJECT));
+    }
+    slow = new G1PreBarrierStub(addr_opr, pre_val, pre_val_patch_code, info);
+  } else {
+    assert(addr_opr == LIR_OprFact::illegalOpr, "sanity");
+    assert(pre_val->is_register(), "must be");
+    assert(pre_val->type() == T_OBJECT, "must be an object");
+    assert(info == NULL, "sanity");
+
+    slow = new G1PreBarrierStub(pre_val);
   }
-  CodeStub* slow = new G1PreBarrierStub(addr_opr, pre_val, pre_val_patch_code,
-                                        info);
+
   __ branch(lir_cond_notEqual, T_INT, slow);
   __ branch_destination(slow->continuation());
 }
 
 void LIRGenerator::G1SATBCardTableModRef_post_barrier(LIR_OprDesc* addr, LIR_OprDesc* new_val) {
-  if (G1DisablePostBarrier) return;
-
   // If the "new_val" is a constant NULL, no barrier is necessary.
   if (new_val->is_constant() &&
       new_val->as_constant_ptr()->as_jobject() == NULL) return;
@@ -1662,6 +1708,8 @@
   if (is_oop) {
     // Do the pre-write barrier, if any.
     pre_barrier(LIR_OprFact::address(address),
+                LIR_OprFact::illegalOpr /* pre_val */,
+                true /* do_load*/,
                 needs_patching,
                 (info ? new CodeEmitInfo(info) : NULL));
   }
@@ -2091,9 +2139,144 @@
   off.load_item();
   src.load_item();
 
-  LIR_Opr reg = reg = rlock_result(x, x->basic_type());
+  LIR_Opr reg = rlock_result(x, x->basic_type());
 
   get_Object_unsafe(reg, src.result(), off.result(), type, x->is_volatile());
+
+#ifndef SERIALGC
+  // We might be reading the value of the referent field of a
+  // Reference object in order to attach it back to the live
+  // object graph. If G1 is enabled then we need to record
+  // the value that is being returned in an SATB log buffer.
+  //
+  // We need to generate code similar to the following...
+  //
+  // if (offset == java_lang_ref_Reference::referent_offset) {
+  //   if (src != NULL) {
+  //     if (klass(src)->reference_type() != REF_NONE) {
+  //       pre_barrier(..., reg, ...);
+  //     }
+  //   }
+  // }
+  //
+  // The first non-constant check of either the offset or
+  // the src operand will be done here; the remainder
+  // will take place in the generated code stub.
+
+  if (UseG1GC && type == T_OBJECT) {
+    bool gen_code_stub = true;       // Assume we need to generate the slow code stub.
+    bool gen_offset_check = true;       // Assume the code stub has to generate the offset guard.
+    bool gen_source_check = true;       // Assume the code stub has to check the src object for null.
+
+    if (off.is_constant()) {
+      jlong off_con = (off.type()->is_int() ?
+                        (jlong) off.get_jint_constant() :
+                        off.get_jlong_constant());
+
+
+      if (off_con != (jlong) java_lang_ref_Reference::referent_offset) {
+        // The constant offset is something other than referent_offset.
+        // We can skip generating/checking the remaining guards and
+        // skip generation of the code stub.
+        gen_code_stub = false;
+      } else {
+        // The constant offset is the same as referent_offset -
+        // we do not need to generate a runtime offset check.
+        gen_offset_check = false;
+      }
+    }
+
+    // We don't need to generate stub if the source object is an array
+    if (gen_code_stub && src.type()->is_array()) {
+      gen_code_stub = false;
+    }
+
+    if (gen_code_stub) {
+      // We still need to continue with the checks.
+      if (src.is_constant()) {
+        ciObject* src_con = src.get_jobject_constant();
+
+        if (src_con->is_null_object()) {
+          // The constant src object is null - We can skip
+          // generating the code stub.
+          gen_code_stub = false;
+        } else {
+          // Non-null constant source object. We still have to generate
+          // the slow stub - but we don't need to generate the runtime
+          // null object check.
+          gen_source_check = false;
+        }
+      }
+    }
+
+    if (gen_code_stub) {
+      // Temoraries.
+      LIR_Opr src_klass = new_register(T_OBJECT);
+
+      // Get the thread pointer for the pre-barrier
+      LIR_Opr thread = getThreadPointer();
+
+      CodeStub* stub;
+
+      // We can have generate one runtime check here. Let's start with
+      // the offset check.
+      if (gen_offset_check) {
+        // if (offset == referent_offset) -> slow code stub
+        // If offset is an int then we can do the comparison with the
+        // referent_offset constant; otherwise we need to move
+        // referent_offset into a temporary register and generate
+        // a reg-reg compare.
+
+        LIR_Opr referent_off;
+
+        if (off.type()->is_int()) {
+          referent_off = LIR_OprFact::intConst(java_lang_ref_Reference::referent_offset);
+        } else {
+          assert(off.type()->is_long(), "what else?");
+          referent_off = new_register(T_LONG);
+          __ move(LIR_OprFact::longConst(java_lang_ref_Reference::referent_offset), referent_off);
+        }
+
+        __ cmp(lir_cond_equal, off.result(), referent_off);
+
+        // Optionally generate "src == null" check.
+        stub = new G1UnsafeGetObjSATBBarrierStub(reg, src.result(),
+                                                    src_klass, thread,
+                                                    gen_source_check);
+
+        __ branch(lir_cond_equal, as_BasicType(off.type()), stub);
+      } else {
+        if (gen_source_check) {
+          // offset is a const and equals referent offset
+          // if (source != null) -> slow code stub
+          __ cmp(lir_cond_notEqual, src.result(), LIR_OprFact::oopConst(NULL));
+
+          // Since we are generating the "if src == null" guard here,
+          // there is no need to generate the "src == null" check again.
+          stub = new G1UnsafeGetObjSATBBarrierStub(reg, src.result(),
+                                                    src_klass, thread,
+                                                    false);
+
+          __ branch(lir_cond_notEqual, T_OBJECT, stub);
+        } else {
+          // We have statically determined that offset == referent_offset
+          // && src != null so we unconditionally branch to code stub
+          // to perform the guards and record reg in the SATB log buffer.
+
+          stub = new G1UnsafeGetObjSATBBarrierStub(reg, src.result(),
+                                                    src_klass, thread,
+                                                    false);
+
+          __ branch(lir_cond_always, T_ILLEGAL, stub);
+        }
+      }
+
+      // Continuation point
+      __ branch_destination(stub->continuation());
+    }
+  }
+#endif // SERIALGC
+
   if (x->is_volatile() && os::is_MP()) __ membar_acquire();
 }
 
@@ -2759,6 +2942,10 @@
     do_AttemptUpdate(x);
     break;
 
+  case vmIntrinsics::_Reference_get:
+    do_Reference_get(x);
+    break;
+
   default: ShouldNotReachHere(); break;
   }
 }
--- a/hotspot/src/share/vm/c1/c1_LIRGenerator.hpp	Mon Apr 25 15:45:49 2011 -0700
+++ b/hotspot/src/share/vm/c1/c1_LIRGenerator.hpp	Wed Jul 05 17:42:16 2017 +0200
@@ -246,6 +246,7 @@
   void do_AttemptUpdate(Intrinsic* x);
   void do_NIOCheckIndex(Intrinsic* x);
   void do_FPIntrinsics(Intrinsic* x);
+  void do_Reference_get(Intrinsic* x);
 
   void do_UnsafePrefetch(UnsafePrefetch* x, bool is_store);
 
@@ -260,13 +261,14 @@
 
   // generic interface
 
-  void pre_barrier(LIR_Opr addr_opr, bool patch,  CodeEmitInfo* info);
+  void pre_barrier(LIR_Opr addr_opr, LIR_Opr pre_val, bool do_load, bool patch, CodeEmitInfo* info);
   void post_barrier(LIR_OprDesc* addr, LIR_OprDesc* new_val);
 
   // specific implementations
   // pre barriers
 
-  void G1SATBCardTableModRef_pre_barrier(LIR_Opr addr_opr, bool patch,  CodeEmitInfo* info);
+  void G1SATBCardTableModRef_pre_barrier(LIR_Opr addr_opr, LIR_Opr pre_val,
+                                         bool do_load, bool patch, CodeEmitInfo* info);
 
   // post barriers
 
--- a/hotspot/src/share/vm/classfile/classFileParser.cpp	Mon Apr 25 15:45:49 2011 -0700
+++ b/hotspot/src/share/vm/classfile/classFileParser.cpp	Wed Jul 05 17:42:16 2017 +0200
@@ -2196,11 +2196,12 @@
                                               TRAPS) {
   typeArrayHandle nullHandle;
   int length = methods()->length();
-  // If JVMTI original method ordering is enabled we have to
+  // If JVMTI original method ordering or sharing is enabled we have to
   // remember the original class file ordering.
   // We temporarily use the vtable_index field in the methodOop to store the
   // class file index, so we can read in after calling qsort.
-  if (JvmtiExport::can_maintain_original_method_order()) {
+  // Put the method ordering in the shared archive.
+  if (JvmtiExport::can_maintain_original_method_order() || DumpSharedSpaces) {
     for (int index = 0; index < length; index++) {
       methodOop m = methodOop(methods->obj_at(index));
       assert(!m->valid_vtable_index(), "vtable index should not be set");
@@ -2214,8 +2215,9 @@
                               methods_parameter_annotations(),
                               methods_default_annotations());
 
-  // If JVMTI original method ordering is enabled construct int array remembering the original ordering
-  if (JvmtiExport::can_maintain_original_method_order()) {
+  // If JVMTI original method ordering or sharing is enabled construct int
+  // array remembering the original ordering
+  if (JvmtiExport::can_maintain_original_method_order() || DumpSharedSpaces) {
     typeArrayOop new_ordering = oopFactory::new_permanent_intArray(length, CHECK_(nullHandle));
     typeArrayHandle method_ordering(THREAD, new_ordering);
     for (int index = 0; index < length; index++) {
--- a/hotspot/src/share/vm/classfile/systemDictionary.cpp	Mon Apr 25 15:45:49 2011 -0700
+++ b/hotspot/src/share/vm/classfile/systemDictionary.cpp	Wed Jul 05 17:42:16 2017 +0200
@@ -1255,6 +1255,16 @@
         methodHandle m(THREAD, methodOop(methods->obj_at(index2)));
         m()->link_method(m, CHECK_(nh));
       }
+      if (JvmtiExport::has_redefined_a_class()) {
+        // Reinitialize vtable because RedefineClasses may have changed some
+        // entries in this vtable for super classes so the CDS vtable might
+        // point to old or obsolete entries.  RedefineClasses doesn't fix up
+        // vtables in the shared system dictionary, only the main one.
+        // It also redefines the itable too so fix that too.
+        ResourceMark rm(THREAD);
+        ik->vtable()->initialize_vtable(false, CHECK_(nh));
+        ik->itable()->initialize_itable(false, CHECK_(nh));
+      }
     }
 
     if (TraceClassLoading) {
--- a/hotspot/src/share/vm/classfile/vmSymbols.hpp	Mon Apr 25 15:45:49 2011 -0700
+++ b/hotspot/src/share/vm/classfile/vmSymbols.hpp	Wed Jul 05 17:42:16 2017 +0200
@@ -678,6 +678,10 @@
   do_intrinsic(_checkIndex,               java_nio_Buffer,        checkIndex_name, int_int_signature,            F_R)   \
    do_name(     checkIndex_name,                                 "checkIndex")                                          \
                                                                                                                         \
+  /* java/lang/ref/Reference */                                                                                         \
+  do_intrinsic(_Reference_get,            java_lang_ref_Reference, get_name,    void_object_signature, F_R)             \
+                                                                                                                        \
+                                                                                                                        \
   do_class(sun_misc_AtomicLongCSImpl,     "sun/misc/AtomicLongCSImpl")                                                  \
   do_intrinsic(_get_AtomicLong,           sun_misc_AtomicLongCSImpl, get_name, void_long_signature,              F_R)   \
   /*   (symbols get_name and void_long_signature defined above) */                                                      \
--- a/hotspot/src/share/vm/gc_implementation/g1/concurrentG1Refine.hpp	Mon Apr 25 15:45:49 2011 -0700
+++ b/hotspot/src/share/vm/gc_implementation/g1/concurrentG1Refine.hpp	Wed Jul 05 17:42:16 2017 +0200
@@ -172,7 +172,7 @@
 
   // hash a given key (index of card_ptr) with the specified size
   static unsigned int hash(size_t key, size_t size) {
-    return (unsigned int) key % size;
+    return (unsigned int) (key % size);
   }
 
   // hash a given key (index of card_ptr)
@@ -180,11 +180,11 @@
     return hash(key, _n_card_counts);
   }
 
-  unsigned ptr_2_card_num(jbyte* card_ptr) {
-    return (unsigned) (card_ptr - _ct_bot);
+  unsigned int ptr_2_card_num(jbyte* card_ptr) {
+    return (unsigned int) (card_ptr - _ct_bot);
   }
 
-  jbyte* card_num_2_ptr(unsigned card_num) {
+  jbyte* card_num_2_ptr(unsigned int card_num) {
     return (jbyte*) (_ct_bot + card_num);
   }
 
--- a/hotspot/src/share/vm/gc_implementation/g1/g1SATBCardTableModRefBS.cpp	Mon Apr 25 15:45:49 2011 -0700
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1SATBCardTableModRefBS.cpp	Wed Jul 05 17:42:16 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2011, 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
@@ -47,7 +47,9 @@
 
 
 void G1SATBCardTableModRefBS::enqueue(oop pre_val) {
-  assert(pre_val->is_oop_or_null(true), "Error");
+  // Nulls should have been already filtered.
+  assert(pre_val->is_oop(true), "Error");
+
   if (!JavaThread::satb_mark_queue_set().is_active()) return;
   Thread* thr = Thread::current();
   if (thr->is_Java_thread()) {
@@ -59,20 +61,6 @@
   }
 }
 
-// When we know the current java thread:
-template <class T> void
-G1SATBCardTableModRefBS::write_ref_field_pre_static(T* field,
-                                                    oop new_val,
-                                                    JavaThread* jt) {
-  if (!JavaThread::satb_mark_queue_set().is_active()) return;
-  T heap_oop = oopDesc::load_heap_oop(field);
-  if (!oopDesc::is_null(heap_oop)) {
-    oop pre_val = oopDesc::decode_heap_oop_not_null(heap_oop);
-    assert(pre_val->is_oop(true /* ignore mark word */), "Error");
-    jt->satb_mark_queue().enqueue(pre_val);
-  }
-}
-
 template <class T> void
 G1SATBCardTableModRefBS::write_ref_array_pre_work(T* dst, int count) {
   if (!JavaThread::satb_mark_queue_set().is_active()) return;
--- a/hotspot/src/share/vm/gc_implementation/g1/g1SATBCardTableModRefBS.hpp	Mon Apr 25 15:45:49 2011 -0700
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1SATBCardTableModRefBS.hpp	Wed Jul 05 17:42:16 2017 +0200
@@ -37,12 +37,11 @@
 // snapshot-at-the-beginning marking.
 
 class G1SATBCardTableModRefBS: public CardTableModRefBSForCTRS {
-private:
+public:
   // Add "pre_val" to a set of objects that may have been disconnected from the
   // pre-marking object graph.
   static void enqueue(oop pre_val);
 
-public:
   G1SATBCardTableModRefBS(MemRegion whole_heap,
                           int max_covered_regions);
 
@@ -61,10 +60,6 @@
     }
   }
 
-  // When we know the current java thread:
-  template <class T> static void write_ref_field_pre_static(T* field, oop newVal,
-                                                            JavaThread* jt);
-
   // We export this to make it available in cases where the static
   // type of the barrier set is known.  Note that it is non-virtual.
   template <class T> inline void inline_write_ref_field_pre(T* field, oop newVal) {
--- a/hotspot/src/share/vm/gc_implementation/g1/g1_globals.hpp	Mon Apr 25 15:45:49 2011 -0700
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1_globals.hpp	Wed Jul 05 17:42:16 2017 +0200
@@ -89,13 +89,9 @@
           "The number of discovered reference objects to process before "   \
           "draining concurrent marking work queues.")                       \
                                                                             \
-  experimental(bool, G1UseConcMarkReferenceProcessing, false,               \
+  experimental(bool, G1UseConcMarkReferenceProcessing, true,                \
           "If true, enable reference discovery during concurrent "          \
-          "marking and reference processing at the end of remark "          \
-          "(unsafe).")                                                      \
-                                                                            \
-  develop(bool, G1SATBBarrierPrintNullPreVals, false,                       \
-          "If true, count frac of ptr writes with null pre-vals.")          \
+          "marking and reference processing at the end of remark.")         \
                                                                             \
   product(intx, G1SATBBufferSize, 1*K,                                      \
           "Number of entries in an SATB log buffer.")                       \
@@ -150,12 +146,6 @@
   develop(bool, G1PrintParCleanupStats, false,                              \
           "When true, print extra stats about parallel cleanup.")           \
                                                                             \
-  develop(bool, G1DisablePreBarrier, false,                                 \
-          "Disable generation of pre-barrier (i.e., marking barrier)   ")   \
-                                                                            \
-  develop(bool, G1DisablePostBarrier, false,                                \
-          "Disable generation of post-barrier (i.e., RS barrier)   ")       \
-                                                                            \
   product(intx, G1UpdateBufferSize, 256,                                    \
           "Size of an update buffer")                                       \
                                                                             \
--- a/hotspot/src/share/vm/gc_implementation/parNew/parCardTableModRefBS.cpp	Mon Apr 25 15:45:49 2011 -0700
+++ b/hotspot/src/share/vm/gc_implementation/parNew/parCardTableModRefBS.cpp	Wed Jul 05 17:42:16 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2007, 2010 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2011 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
@@ -36,7 +36,6 @@
 void CardTableModRefBS::par_non_clean_card_iterate_work(Space* sp, MemRegion mr,
                                                         DirtyCardToOopClosure* dcto_cl,
                                                         MemRegionClosure* cl,
-                                                        bool clear,
                                                         int n_threads) {
   if (n_threads > 0) {
     assert((n_threads == 1 && ParallelGCThreads == 0) ||
@@ -57,7 +56,7 @@
 
     int stride = 0;
     while (!pst->is_task_claimed(/* reference */ stride)) {
-      process_stride(sp, mr, stride, n_strides, dcto_cl, cl, clear,
+      process_stride(sp, mr, stride, n_strides, dcto_cl, cl,
                      lowest_non_clean,
                      lowest_non_clean_base_chunk_index,
                      lowest_non_clean_chunk_size);
@@ -83,7 +82,6 @@
                jint stride, int n_strides,
                DirtyCardToOopClosure* dcto_cl,
                MemRegionClosure* cl,
-               bool clear,
                jbyte** lowest_non_clean,
                uintptr_t lowest_non_clean_base_chunk_index,
                size_t    lowest_non_clean_chunk_size) {
@@ -129,7 +127,7 @@
                              lowest_non_clean_base_chunk_index,
                              lowest_non_clean_chunk_size);
 
-    non_clean_card_iterate_work(chunk_mr, cl, clear);
+    non_clean_card_iterate_work(chunk_mr, cl);
 
     // Find the next chunk of the stride.
     chunk_card_start += CardsPerStrideChunk * n_strides;
--- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psOldGen.cpp	Mon Apr 25 15:45:49 2011 -0700
+++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psOldGen.cpp	Wed Jul 05 17:42:16 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2011, 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
@@ -176,10 +176,6 @@
   object_mark_sweep()->compact(ZapUnusedHeapArea);
 }
 
-void PSOldGen::move_and_update(ParCompactionManager* cm) {
-  PSParallelCompact::move_and_update(cm, PSParallelCompact::old_space_id);
-}
-
 size_t PSOldGen::contiguous_available() const {
   return object_space()->free_in_bytes() + virtual_space()->uncommitted_size();
 }
--- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psOldGen.hpp	Mon Apr 25 15:45:49 2011 -0700
+++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psOldGen.hpp	Wed Jul 05 17:42:16 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2011, 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
@@ -143,9 +143,6 @@
   void adjust_pointers();
   void compact();
 
-  // Parallel old
-  virtual void move_and_update(ParCompactionManager* cm);
-
   // Size info
   size_t capacity_in_bytes() const        { return object_space()->capacity_in_bytes(); }
   size_t used_in_bytes() const            { return object_space()->used_in_bytes(); }
--- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psParallelCompact.cpp	Mon Apr 25 15:45:49 2011 -0700
+++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psParallelCompact.cpp	Wed Jul 05 17:42:16 2017 +0200
@@ -2104,11 +2104,7 @@
     // klasses are used in the update of an object?
     compact_perm(vmthread_cm);
 
-    if (UseParallelOldGCCompacting) {
-      compact();
-    } else {
-      compact_serial(vmthread_cm);
-    }
+    compact();
 
     // Reset the mark bitmap, summary data, and do other bookkeeping.  Must be
     // done before resizing.
@@ -2582,18 +2578,16 @@
     // each thread?
     if (total_dense_prefix_regions > 0) {
       uint tasks_for_dense_prefix = 1;
-      if (UseParallelDensePrefixUpdate) {
-        if (total_dense_prefix_regions <=
-            (parallel_gc_threads * PAR_OLD_DENSE_PREFIX_OVER_PARTITIONING)) {
-          // Don't over partition.  This assumes that
-          // PAR_OLD_DENSE_PREFIX_OVER_PARTITIONING is a small integer value
-          // so there are not many regions to process.
-          tasks_for_dense_prefix = parallel_gc_threads;
-        } else {
-          // Over partition
-          tasks_for_dense_prefix = parallel_gc_threads *
-            PAR_OLD_DENSE_PREFIX_OVER_PARTITIONING;
-        }
+      if (total_dense_prefix_regions <=
+          (parallel_gc_threads * PAR_OLD_DENSE_PREFIX_OVER_PARTITIONING)) {
+        // Don't over partition.  This assumes that
+        // PAR_OLD_DENSE_PREFIX_OVER_PARTITIONING is a small integer value
+        // so there are not many regions to process.
+        tasks_for_dense_prefix = parallel_gc_threads;
+      } else {
+        // Over partition
+        tasks_for_dense_prefix = parallel_gc_threads *
+          PAR_OLD_DENSE_PREFIX_OVER_PARTITIONING;
       }
       size_t regions_per_thread = total_dense_prefix_regions /
         tasks_for_dense_prefix;
@@ -2733,21 +2727,6 @@
 }
 #endif  // #ifdef ASSERT
 
-void PSParallelCompact::compact_serial(ParCompactionManager* cm) {
-  EventMark m("5 compact serial");
-  TraceTime tm("compact serial", print_phases(), true, gclog_or_tty);
-
-  ParallelScavengeHeap* heap = (ParallelScavengeHeap*)Universe::heap();
-  assert(heap->kind() == CollectedHeap::ParallelScavengeHeap, "Sanity");
-
-  PSYoungGen* young_gen = heap->young_gen();
-  PSOldGen* old_gen = heap->old_gen();
-
-  old_gen->start_array()->reset();
-  old_gen->move_and_update(cm);
-  young_gen->move_and_update(cm);
-}
-
 void
 PSParallelCompact::follow_weak_klass_links() {
   // All klasses on the revisit stack are marked at this point.
@@ -3530,11 +3509,8 @@
            "Object liveness is wrong.");
     return ParMarkBitMap::incomplete;
   }
-  assert(UseParallelOldGCDensePrefix ||
-         (HeapMaximumCompactionInterval > 1) ||
-         (MarkSweepAlwaysCompactCount > 1) ||
-         (forwarding_ptr == new_pointer),
-    "Calculation of new location is incorrect");
+  assert(HeapMaximumCompactionInterval > 1 || MarkSweepAlwaysCompactCount > 1 ||
+         forwarding_ptr == new_pointer, "new location is incorrect");
   return ParMarkBitMap::incomplete;
 }
 
--- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psParallelCompact.hpp	Mon Apr 25 15:45:49 2011 -0700
+++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psParallelCompact.hpp	Wed Jul 05 17:42:16 2017 +0200
@@ -1027,9 +1027,6 @@
                                        ParallelTaskTerminator* terminator_ptr,
                                        uint parallel_gc_threads);
 
-  // For debugging only - compacts the old gen serially
-  static void compact_serial(ParCompactionManager* cm);
-
   // If objects are left in eden after a collection, try to move the boundary
   // and absorb them into the old gen.  Returns true if eden was emptied.
   static bool absorb_live_data_from_eden(PSAdaptiveSizePolicy* size_policy,
--- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psPermGen.cpp	Mon Apr 25 15:45:49 2011 -0700
+++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psPermGen.cpp	Wed Jul 05 17:42:16 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2011, 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
@@ -121,12 +121,6 @@
   }
 }
 
-
-
-void PSPermGen::move_and_update(ParCompactionManager* cm) {
-  PSParallelCompact::move_and_update(cm, PSParallelCompact::perm_space_id);
-}
-
 void PSPermGen::precompact() {
   // Reset start array first.
   _start_array.reset();
--- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psPermGen.hpp	Mon Apr 25 15:45:49 2011 -0700
+++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psPermGen.hpp	Wed Jul 05 17:42:16 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2011, 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
@@ -51,9 +51,6 @@
   // MarkSweep code
   virtual void precompact();
 
-  // Parallel old
-  virtual void move_and_update(ParCompactionManager* cm);
-
   virtual const char* name() const { return "PSPermGen"; }
 };
 
--- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psYoungGen.cpp	Mon Apr 25 15:45:49 2011 -0700
+++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psYoungGen.cpp	Wed Jul 05 17:42:16 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2011, 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
@@ -792,12 +792,6 @@
   to_mark_sweep()->compact(false);
 }
 
-void PSYoungGen::move_and_update(ParCompactionManager* cm) {
-  PSParallelCompact::move_and_update(cm, PSParallelCompact::eden_space_id);
-  PSParallelCompact::move_and_update(cm, PSParallelCompact::from_space_id);
-  PSParallelCompact::move_and_update(cm, PSParallelCompact::to_space_id);
-}
-
 void PSYoungGen::print() const { print_on(tty); }
 void PSYoungGen::print_on(outputStream* st) const {
   st->print(" %-15s", "PSYoungGen");
--- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psYoungGen.hpp	Mon Apr 25 15:45:49 2011 -0700
+++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psYoungGen.hpp	Wed Jul 05 17:42:16 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2011, 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
@@ -127,9 +127,6 @@
   void adjust_pointers();
   void compact();
 
-  // Parallel Old
-  void move_and_update(ParCompactionManager* cm);
-
   // Called during/after gc
   void swap_spaces();
 
--- a/hotspot/src/share/vm/gc_implementation/shared/allocationStats.hpp	Mon Apr 25 15:45:49 2011 -0700
+++ b/hotspot/src/share/vm/gc_implementation/shared/allocationStats.hpp	Wed Jul 05 17:42:16 2017 +0200
@@ -76,7 +76,7 @@
     _beforeSweep = 0;
     _coalBirths = 0;
     _coalDeaths = 0;
-    _splitBirths = split_birth? 1 : 0;
+    _splitBirths = (split_birth ? 1 : 0);
     _splitDeaths = 0;
     _returnedBytes = 0;
   }
--- a/hotspot/src/share/vm/interpreter/abstractInterpreter.hpp	Mon Apr 25 15:45:49 2011 -0700
+++ b/hotspot/src/share/vm/interpreter/abstractInterpreter.hpp	Wed Jul 05 17:42:16 2017 +0200
@@ -104,6 +104,7 @@
     java_lang_math_sqrt,                                        // implementation of java.lang.Math.sqrt  (x)
     java_lang_math_log,                                         // implementation of java.lang.Math.log   (x)
     java_lang_math_log10,                                       // implementation of java.lang.Math.log10 (x)
+    java_lang_ref_reference_get,                                // implementation of java.lang.ref.Reference.get()
     number_of_method_entries,
     invalid = -1
   };
@@ -140,7 +141,7 @@
   // Method activation
   static MethodKind method_kind(methodHandle m);
   static address    entry_for_kind(MethodKind k)                { assert(0 <= k && k < number_of_method_entries, "illegal kind"); return _entry_table[k]; }
-  static address    entry_for_method(methodHandle m)            { return _entry_table[method_kind(m)]; }
+  static address    entry_for_method(methodHandle m)            { return entry_for_kind(method_kind(m)); }
 
   static void       print_method_kind(MethodKind kind)          PRODUCT_RETURN;
 
--- a/hotspot/src/share/vm/interpreter/cppInterpreter.cpp	Mon Apr 25 15:45:49 2011 -0700
+++ b/hotspot/src/share/vm/interpreter/cppInterpreter.cpp	Wed Jul 05 17:42:16 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2011, 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
@@ -125,6 +125,7 @@
     method_entry(java_lang_math_sqrt  );
     method_entry(java_lang_math_log   );
     method_entry(java_lang_math_log10 );
+    method_entry(java_lang_ref_reference_get);
     Interpreter::_native_entry_begin = Interpreter::code()->code_end();
     method_entry(native);
     method_entry(native_synchronized);
--- a/hotspot/src/share/vm/interpreter/interpreter.cpp	Mon Apr 25 15:45:49 2011 -0700
+++ b/hotspot/src/share/vm/interpreter/interpreter.cpp	Wed Jul 05 17:42:16 2017 +0200
@@ -208,12 +208,6 @@
     return empty;
   }
 
-  // Accessor method?
-  if (m->is_accessor()) {
-    assert(m->size_of_parameters() == 1, "fast code for accessors assumes parameter size = 1");
-    return accessor;
-  }
-
   // Special intrinsic method?
   // Note: This test must come _after_ the test for native methods,
   //       otherwise we will run into problems with JDK 1.2, see also
@@ -227,6 +221,15 @@
     case vmIntrinsics::_dsqrt : return java_lang_math_sqrt ;
     case vmIntrinsics::_dlog  : return java_lang_math_log  ;
     case vmIntrinsics::_dlog10: return java_lang_math_log10;
+
+    case vmIntrinsics::_Reference_get:
+                                return java_lang_ref_reference_get;
+  }
+
+  // Accessor method?
+  if (m->is_accessor()) {
+    assert(m->size_of_parameters() == 1, "fast code for accessors assumes parameter size = 1");
+    return accessor;
   }
 
   // Note: for now: zero locals for all non-empty methods
--- a/hotspot/src/share/vm/interpreter/templateInterpreter.cpp	Mon Apr 25 15:45:49 2011 -0700
+++ b/hotspot/src/share/vm/interpreter/templateInterpreter.cpp	Wed Jul 05 17:42:16 2017 +0200
@@ -372,6 +372,7 @@
   method_entry(java_lang_math_sqrt )
   method_entry(java_lang_math_log  )
   method_entry(java_lang_math_log10)
+  method_entry(java_lang_ref_reference_get)
 
   // all native method kinds (must be one contiguous block)
   Interpreter::_native_entry_begin = Interpreter::code()->code_end();
--- a/hotspot/src/share/vm/memory/cardTableModRefBS.cpp	Mon Apr 25 15:45:49 2011 -0700
+++ b/hotspot/src/share/vm/memory/cardTableModRefBS.cpp	Wed Jul 05 17:42:16 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2011, 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
@@ -459,18 +459,17 @@
 void CardTableModRefBS::non_clean_card_iterate(Space* sp,
                                                MemRegion mr,
                                                DirtyCardToOopClosure* dcto_cl,
-                                               MemRegionClosure* cl,
-                                               bool clear) {
+                                               MemRegionClosure* cl) {
   if (!mr.is_empty()) {
     int n_threads = SharedHeap::heap()->n_par_threads();
     if (n_threads > 0) {
 #ifndef SERIALGC
-      par_non_clean_card_iterate_work(sp, mr, dcto_cl, cl, clear, n_threads);
+      par_non_clean_card_iterate_work(sp, mr, dcto_cl, cl, n_threads);
 #else  // SERIALGC
       fatal("Parallel gc not supported here.");
 #endif // SERIALGC
     } else {
-      non_clean_card_iterate_work(mr, cl, clear);
+      non_clean_card_iterate_work(mr, cl);
     }
   }
 }
@@ -481,10 +480,7 @@
 // cards (and miss those marked precleaned). In that sense,
 // the name precleaned is currently somewhat of a misnomer.
 void CardTableModRefBS::non_clean_card_iterate_work(MemRegion mr,
-                                                    MemRegionClosure* cl,
-                                                    bool clear) {
-  // Figure out whether we have to worry about parallelism.
-  bool is_par = (SharedHeap::heap()->n_par_threads() > 1);
+                                                    MemRegionClosure* cl) {
   for (int i = 0; i < _cur_covered_regions; i++) {
     MemRegion mri = mr.intersection(_covered[i]);
     if (mri.word_size() > 0) {
@@ -506,22 +502,6 @@
           MemRegion cur_cards(addr_for(cur_entry),
                               non_clean_cards * card_size_in_words);
           MemRegion dirty_region = cur_cards.intersection(mri);
-          if (clear) {
-            for (size_t i = 0; i < non_clean_cards; i++) {
-              // Clean the dirty cards (but leave the other non-clean
-              // alone.)  If parallel, do the cleaning atomically.
-              jbyte cur_entry_val = cur_entry[i];
-              if (card_is_dirty_wrt_gen_iter(cur_entry_val)) {
-                if (is_par) {
-                  jbyte res = Atomic::cmpxchg(clean_card, &cur_entry[i], cur_entry_val);
-                  assert(res != clean_card,
-                         "Dirty card mysteriously cleaned");
-                } else {
-                  cur_entry[i] = clean_card;
-                }
-              }
-            }
-          }
           cl->do_MemRegion(dirty_region);
         }
         cur_entry = next_entry;
@@ -530,22 +510,6 @@
   }
 }
 
-void CardTableModRefBS::mod_oop_in_space_iterate(Space* sp,
-                                                 OopClosure* cl,
-                                                 bool clear,
-                                                 bool before_save_marks) {
-  // Note that dcto_cl is resource-allocated, so there is no
-  // corresponding "delete".
-  DirtyCardToOopClosure* dcto_cl = sp->new_dcto_cl(cl, precision());
-  MemRegion used_mr;
-  if (before_save_marks) {
-    used_mr = sp->used_region_at_save_marks();
-  } else {
-    used_mr = sp->used_region();
-  }
-  non_clean_card_iterate(sp, used_mr, dcto_cl, dcto_cl, clear);
-}
-
 void CardTableModRefBS::dirty_MemRegion(MemRegion mr) {
   assert((HeapWord*)align_size_down((uintptr_t)mr.start(), HeapWordSize) == mr.start(), "Unaligned start");
   assert((HeapWord*)align_size_up  ((uintptr_t)mr.end(),   HeapWordSize) == mr.end(),   "Unaligned end"  );
@@ -593,9 +557,8 @@
   memset(first, dirty_card, last-first);
 }
 
-// NOTES:
-// (1) Unlike mod_oop_in_space_iterate() above, dirty_card_iterate()
-//     iterates over dirty cards ranges in increasing address order.
+// Unlike several other card table methods, dirty_card_iterate()
+// iterates over dirty cards ranges in increasing address order.
 void CardTableModRefBS::dirty_card_iterate(MemRegion mr,
                                            MemRegionClosure* cl) {
   for (int i = 0; i < _cur_covered_regions; i++) {
@@ -698,7 +661,7 @@
 
 void CardTableModRefBS::verify_clean_region(MemRegion mr) {
   GuaranteeNotModClosure blk(this);
-  non_clean_card_iterate_work(mr, &blk, false);
+  non_clean_card_iterate_work(mr, &blk);
 }
 
 // To verify a MemRegion is entirely dirty this closure is passed to
--- a/hotspot/src/share/vm/memory/cardTableModRefBS.hpp	Mon Apr 25 15:45:49 2011 -0700
+++ b/hotspot/src/share/vm/memory/cardTableModRefBS.hpp	Wed Jul 05 17:42:16 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2011, 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
@@ -171,17 +171,14 @@
   // mode if worker threads are available.
   void non_clean_card_iterate(Space* sp, MemRegion mr,
                               DirtyCardToOopClosure* dcto_cl,
-                              MemRegionClosure* cl,
-                              bool clear);
+                              MemRegionClosure* cl);
 
   // Utility function used to implement the other versions below.
-  void non_clean_card_iterate_work(MemRegion mr, MemRegionClosure* cl,
-                                   bool clear);
+  void non_clean_card_iterate_work(MemRegion mr, MemRegionClosure* cl);
 
   void par_non_clean_card_iterate_work(Space* sp, MemRegion mr,
                                        DirtyCardToOopClosure* dcto_cl,
                                        MemRegionClosure* cl,
-                                       bool clear,
                                        int n_threads);
 
   // Dirty the bytes corresponding to "mr" (not all of which must be
@@ -241,7 +238,6 @@
                       jint stride, int n_strides,
                       DirtyCardToOopClosure* dcto_cl,
                       MemRegionClosure* cl,
-                      bool clear,
                       jbyte** lowest_non_clean,
                       uintptr_t lowest_non_clean_base_chunk_index,
                       size_t lowest_non_clean_chunk_size);
@@ -402,9 +398,6 @@
   virtual void invalidate(MemRegion mr, bool whole_heap = false);
   void clear(MemRegion mr);
   void dirty(MemRegion mr);
-  void mod_oop_in_space_iterate(Space* sp, OopClosure* cl,
-                                bool clear = false,
-                                bool before_save_marks = false);
 
   // *** Card-table-RemSet-specific things.
 
@@ -415,18 +408,15 @@
   // *decreasing* address order.  (This order aids with imprecise card
   // marking, where a dirty card may cause scanning, and summarization
   // marking, of objects that extend onto subsequent cards.)
-  // If "clear" is true, the card is (conceptually) marked unmodified before
-  // applying the closure.
-  void mod_card_iterate(MemRegionClosure* cl, bool clear = false) {
-    non_clean_card_iterate_work(_whole_heap, cl, clear);
+  void mod_card_iterate(MemRegionClosure* cl) {
+    non_clean_card_iterate_work(_whole_heap, cl);
   }
 
   // Like the "mod_cards_iterate" above, except only invokes the closure
   // for cards within the MemRegion "mr" (which is required to be
   // card-aligned and sized.)
-  void mod_card_iterate(MemRegion mr, MemRegionClosure* cl,
-                        bool clear = false) {
-    non_clean_card_iterate_work(mr, cl, clear);
+  void mod_card_iterate(MemRegion mr, MemRegionClosure* cl) {
+    non_clean_card_iterate_work(mr, cl);
   }
 
   static uintx ct_max_alignment_constraint();
--- a/hotspot/src/share/vm/memory/cardTableRS.cpp	Mon Apr 25 15:45:49 2011 -0700
+++ b/hotspot/src/share/vm/memory/cardTableRS.cpp	Wed Jul 05 17:42:16 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2011, 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
@@ -247,7 +247,7 @@
   ClearNoncleanCardWrapper clear_cl(dcto_cl, this);
 
   _ct_bs->non_clean_card_iterate(sp, sp->used_region_at_save_marks(),
-                                dcto_cl, &clear_cl, false);
+                                dcto_cl, &clear_cl);
 }
 
 void CardTableRS::clear_into_younger(Generation* gen, bool clear_perm) {
--- a/hotspot/src/share/vm/memory/dump.cpp	Mon Apr 25 15:45:49 2011 -0700
+++ b/hotspot/src/share/vm/memory/dump.cpp	Wed Jul 05 17:42:16 2017 +0200
@@ -623,24 +623,48 @@
   }
 };
 
-// Itable indices are calculated based on methods array order
-// (see klassItable::compute_itable_index()).  Must reinitialize
+// Vtable and Itable indices are calculated based on methods array
+// order (see klassItable::compute_itable_index()).  Must reinitialize
 // after ALL methods of ALL classes have been reordered.
 // We assume that since checkconstraints is false, this method
 // cannot throw an exception.  An exception here would be
 // problematic since this is the VMThread, not a JavaThread.
 
-class ReinitializeItables: public ObjectClosure {
+class ReinitializeTables: public ObjectClosure {
 private:
   Thread* _thread;
 
 public:
-  ReinitializeItables(Thread* thread) : _thread(thread) {}
+  ReinitializeTables(Thread* thread) : _thread(thread) {}
+
+  // Initialize super vtable first, check if already initialized to avoid
+  // quadradic behavior.  The vtable is cleared in remove_unshareable_info.
+  void reinitialize_vtables(klassOop k) {
+    if (k->blueprint()->oop_is_instanceKlass()) {
+      instanceKlass* ik = instanceKlass::cast(k);
+      if (ik->vtable()->is_initialized()) return;
+      if (ik->super() != NULL) {
+        reinitialize_vtables(ik->super());
+      }
+      ik->vtable()->initialize_vtable(false, _thread);
+    }
+  }
 
   void do_object(oop obj) {
     if (obj->blueprint()->oop_is_instanceKlass()) {
       instanceKlass* ik = instanceKlass::cast((klassOop)obj);
+      ResourceMark rm(_thread);
       ik->itable()->initialize_itable(false, _thread);
+      reinitialize_vtables((klassOop)obj);
+#ifdef ASSERT
+      ik->vtable()->verify(tty, true);
+#endif // ASSERT
+    } else if (obj->blueprint()->oop_is_arrayKlass()) {
+      // The vtable for array klasses are that of its super class,
+      // ie. java.lang.Object.
+      arrayKlass* ak = arrayKlass::cast((klassOop)obj);
+      if (ak->vtable()->is_initialized()) return;
+      ak->vtable()->initialize_vtable(false, _thread);
     }
   }
 };
@@ -1205,9 +1229,9 @@
     gen->ro_space()->object_iterate(&sort);
     gen->rw_space()->object_iterate(&sort);
 
-    ReinitializeItables reinit_itables(THREAD);
-    gen->ro_space()->object_iterate(&reinit_itables);
-    gen->rw_space()->object_iterate(&reinit_itables);
+    ReinitializeTables reinit_tables(THREAD);
+    gen->ro_space()->object_iterate(&reinit_tables);
+    gen->rw_space()->object_iterate(&reinit_tables);
     tty->print_cr("done. ");
     tty->cr();
 
--- a/hotspot/src/share/vm/memory/modRefBarrierSet.hpp	Mon Apr 25 15:45:49 2011 -0700
+++ b/hotspot/src/share/vm/memory/modRefBarrierSet.hpp	Wed Jul 05 17:42:16 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2011, 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
@@ -88,15 +88,6 @@
     assert(false, "can't call");
   }
 
-  // Invoke "cl->do_oop" on (the address of) every possibly-modifed
-  // reference field in objects in "sp".  If "clear" is "true", the oops
-  // are no longer considered possibly modified after application of the
-  // closure.  If' "before_save_marks" is true, oops in objects allocated
-  // after the last call to "save_marks" on "sp" will not be considered.
-  virtual void mod_oop_in_space_iterate(Space* sp, OopClosure* cl,
-                                        bool clear = false,
-                                        bool before_save_marks = false) = 0;
-
   // Causes all refs in "mr" to be assumed to be modified.  If "whole_heap"
   // is true, the caller asserts that the entire heap is being invalidated,
   // which may admit an optimized implementation for some barriers.
--- a/hotspot/src/share/vm/oops/instanceKlass.hpp	Mon Apr 25 15:45:49 2011 -0700
+++ b/hotspot/src/share/vm/oops/instanceKlass.hpp	Wed Jul 05 17:42:16 2017 +0200
@@ -401,6 +401,8 @@
   ReferenceType reference_type() const     { return _reference_type; }
   void set_reference_type(ReferenceType t) { _reference_type = t; }
 
+  static int reference_type_offset_in_bytes() { return offset_of(instanceKlass, _reference_type); }
+
   // find local field, returns true if found
   bool find_local_field(Symbol* name, Symbol* sig, fieldDescriptor* fd) const;
   // find field in direct superinterfaces, returns the interface in which the field is defined
--- a/hotspot/src/share/vm/oops/instanceKlassKlass.cpp	Mon Apr 25 15:45:49 2011 -0700
+++ b/hotspot/src/share/vm/oops/instanceKlassKlass.cpp	Wed Jul 05 17:42:16 2017 +0200
@@ -690,7 +690,8 @@
     guarantee(method_ordering->is_perm(),              "should be in permspace");
     guarantee(method_ordering->is_typeArray(),         "should be type array");
     int length = method_ordering->length();
-    if (JvmtiExport::can_maintain_original_method_order()) {
+    if (JvmtiExport::can_maintain_original_method_order() ||
+        (UseSharedSpaces && length != 0)) {
       guarantee(length == methods->length(),           "invalid method ordering length");
       jlong sum = 0;
       for (j = 0; j < length; j++) {
--- a/hotspot/src/share/vm/oops/klass.cpp	Mon Apr 25 15:45:49 2011 -0700
+++ b/hotspot/src/share/vm/oops/klass.cpp	Wed Jul 05 17:42:16 2017 +0200
@@ -453,6 +453,14 @@
       ik->unlink_class();
     }
   }
+  // Clear the Java vtable if the oop has one.
+  // The vtable isn't shareable because it's in the wrong order wrt the methods
+  // once the method names get moved and resorted.
+  klassVtable* vt = vtable();
+  if (vt != NULL) {
+    assert(oop_is_instance() || oop_is_array(), "nothing else has vtable");
+    vt->clear_vtable();
+  }
   set_subklass(NULL);
   set_next_sibling(NULL);
 }
--- a/hotspot/src/share/vm/oops/klassVtable.cpp	Mon Apr 25 15:45:49 2011 -0700
+++ b/hotspot/src/share/vm/oops/klassVtable.cpp	Wed Jul 05 17:42:16 2017 +0200
@@ -645,6 +645,15 @@
   }
 }
 
+// CDS/RedefineClasses support - clear vtables so they can be reinitialized
+void klassVtable::clear_vtable() {
+  for (int i = 0; i < _length; i++) table()[i].clear();
+}
+
+bool klassVtable::is_initialized() {
+  return _length == 0 || table()[0].method() != NULL;
+}
+
 
 // Garbage collection
 void klassVtable::oop_follow_contents() {
--- a/hotspot/src/share/vm/oops/klassVtable.hpp	Mon Apr 25 15:45:49 2011 -0700
+++ b/hotspot/src/share/vm/oops/klassVtable.hpp	Wed Jul 05 17:42:16 2017 +0200
@@ -75,7 +75,15 @@
 
   void initialize_vtable(bool checkconstraints, TRAPS);   // initialize vtable of a new klass
 
-  // conputes vtable length (in words) and the number of miranda methods
+  // CDS/RedefineClasses support - clear vtables so they can be reinitialized
+  // at dump time.  Clearing gives us an easy way to tell if the vtable has
+  // already been reinitialized at dump time (see dump.cpp).  Vtables can
+  // be initialized at run time by RedefineClasses so dumping the right order
+  // is necessary.
+  void clear_vtable();
+  bool is_initialized();
+
+  // computes vtable length (in words) and the number of miranda methods
   static void compute_vtable_size_and_num_mirandas(int &vtable_length, int &num_miranda_methods,
                                                    klassOop super, objArrayOop methods,
                                                    AccessFlags class_flags, Handle classloader,
--- a/hotspot/src/share/vm/opto/compile.cpp	Mon Apr 25 15:45:49 2011 -0700
+++ b/hotspot/src/share/vm/opto/compile.cpp	Wed Jul 05 17:42:16 2017 +0200
@@ -629,7 +629,7 @@
     initial_gvn()->transform_no_reclaim(top());
 
     // Set up tf(), start(), and find a CallGenerator.
-    CallGenerator* cg;
+    CallGenerator* cg = NULL;
     if (is_osr_compilation()) {
       const TypeTuple *domain = StartOSRNode::osr_domain();
       const TypeTuple *range = TypeTuple::make_range(method()->signature());
@@ -644,9 +644,24 @@
       StartNode* s = new (this, 2) StartNode(root(), tf()->domain());
       initial_gvn()->set_type_bottom(s);
       init_start(s);
-      float past_uses = method()->interpreter_invocation_count();
-      float expected_uses = past_uses;
-      cg = CallGenerator::for_inline(method(), expected_uses);
+      if (method()->intrinsic_id() == vmIntrinsics::_Reference_get && UseG1GC) {
+        // With java.lang.ref.reference.get() we must go through the
+        // intrinsic when G1 is enabled - even when get() is the root
+        // method of the compile - so that, if necessary, the value in
+        // the referent field of the reference object gets recorded by
+        // the pre-barrier code.
+        // Specifically, if G1 is enabled, the value in the referent
+        // field is recorded by the G1 SATB pre barrier. This will
+        // result in the referent being marked live and the reference
+        // object removed from the list of discovered references during
+        // reference processing.
+        cg = find_intrinsic(method(), false);
+      }
+      if (cg == NULL) {
+        float past_uses = method()->interpreter_invocation_count();
+        float expected_uses = past_uses;
+        cg = CallGenerator::for_inline(method(), expected_uses);
+      }
     }
     if (failing())  return;
     if (cg == NULL) {
@@ -2041,6 +2056,52 @@
   // Note that OffsetBot and OffsetTop are very negative.
 }
 
+// Eliminate trivially redundant StoreCMs and accumulate their
+// precedence edges.
+static void eliminate_redundant_card_marks(Node* n) {
+  assert(n->Opcode() == Op_StoreCM, "expected StoreCM");
+  if (n->in(MemNode::Address)->outcnt() > 1) {
+    // There are multiple users of the same address so it might be
+    // possible to eliminate some of the StoreCMs
+    Node* mem = n->in(MemNode::Memory);
+    Node* adr = n->in(MemNode::Address);
+    Node* val = n->in(MemNode::ValueIn);
+    Node* prev = n;
+    bool done = false;
+    // Walk the chain of StoreCMs eliminating ones that match.  As
+    // long as it's a chain of single users then the optimization is
+    // safe.  Eliminating partially redundant StoreCMs would require
+    // cloning copies down the other paths.
+    while (mem->Opcode() == Op_StoreCM && mem->outcnt() == 1 && !done) {
+      if (adr == mem->in(MemNode::Address) &&
+          val == mem->in(MemNode::ValueIn)) {
+        // redundant StoreCM
+        if (mem->req() > MemNode::OopStore) {
+          // Hasn't been processed by this code yet.
+          n->add_prec(mem->in(MemNode::OopStore));
+        } else {
+          // Already converted to precedence edge
+          for (uint i = mem->req(); i < mem->len(); i++) {
+            // Accumulate any precedence edges
+            if (mem->in(i) != NULL) {
+              n->add_prec(mem->in(i));
+            }
+          }
+          // Everything above this point has been processed.
+          done = true;
+        }
+        // Eliminate the previous StoreCM
+        prev->set_req(MemNode::Memory, mem->in(MemNode::Memory));
+        assert(mem->outcnt() == 0, "should be dead");
+        mem->disconnect_inputs(NULL);
+      } else {
+        prev = mem;
+      }
+      mem = prev->in(MemNode::Memory);
+    }
+  }
+}
+
 //------------------------------final_graph_reshaping_impl----------------------
 // Implement items 1-5 from final_graph_reshaping below.
 static void final_graph_reshaping_impl( Node *n, Final_Reshape_Counts &frc ) {
@@ -2167,9 +2228,19 @@
     frc.inc_float_count();
     goto handle_mem;
 
+  case Op_StoreCM:
+    {
+      // Convert OopStore dependence into precedence edge
+      Node* prec = n->in(MemNode::OopStore);
+      n->del_req(MemNode::OopStore);
+      n->add_prec(prec);
+      eliminate_redundant_card_marks(n);
+    }
+
+    // fall through
+
   case Op_StoreB:
   case Op_StoreC:
-  case Op_StoreCM:
   case Op_StorePConditional:
   case Op_StoreI:
   case Op_StoreL:
--- a/hotspot/src/share/vm/opto/graphKit.cpp	Mon Apr 25 15:45:49 2011 -0700
+++ b/hotspot/src/share/vm/opto/graphKit.cpp	Wed Jul 05 17:42:16 2017 +0200
@@ -1457,19 +1457,22 @@
 }
 
 
-void GraphKit::pre_barrier(Node* ctl,
+void GraphKit::pre_barrier(bool do_load,
+                           Node* ctl,
                            Node* obj,
                            Node* adr,
                            uint  adr_idx,
                            Node* val,
                            const TypeOopPtr* val_type,
+                           Node* pre_val,
                            BasicType bt) {
+
   BarrierSet* bs = Universe::heap()->barrier_set();
   set_control(ctl);
   switch (bs->kind()) {
     case BarrierSet::G1SATBCT:
     case BarrierSet::G1SATBCTLogging:
-      g1_write_barrier_pre(obj, adr, adr_idx, val, val_type, bt);
+      g1_write_barrier_pre(do_load, obj, adr, adr_idx, val, val_type, pre_val, bt);
       break;
 
     case BarrierSet::CardTableModRef:
@@ -1532,7 +1535,11 @@
   uint adr_idx = C->get_alias_index(adr_type);
   assert(adr_idx != Compile::AliasIdxTop, "use other store_to_memory factory" );
 
-  pre_barrier(control(), obj, adr, adr_idx, val, val_type, bt);
+  pre_barrier(true /* do_load */,
+              control(), obj, adr, adr_idx, val, val_type,
+              NULL /* pre_val */,
+              bt);
+
   Node* store = store_to_memory(control(), adr, val, bt, adr_idx);
   post_barrier(control(), store, obj, adr, adr_idx, val, bt, use_precise);
   return store;
@@ -3470,12 +3477,31 @@
 }
 
 // G1 pre/post barriers
-void GraphKit::g1_write_barrier_pre(Node* obj,
+void GraphKit::g1_write_barrier_pre(bool do_load,
+                                    Node* obj,
                                     Node* adr,
                                     uint alias_idx,
                                     Node* val,
                                     const TypeOopPtr* val_type,
+                                    Node* pre_val,
                                     BasicType bt) {
+
+  // Some sanity checks
+  // Note: val is unused in this routine.
+
+  if (do_load) {
+    // We need to generate the load of the previous value
+    assert(obj != NULL, "must have a base");
+    assert(adr != NULL, "where are loading from?");
+    assert(pre_val == NULL, "loaded already?");
+    assert(val_type != NULL, "need a type");
+  } else {
+    // In this case both val_type and alias_idx are unused.
+    assert(pre_val != NULL, "must be loaded already");
+    assert(pre_val->bottom_type()->basic_type() == T_OBJECT, "or we shouldn't be here");
+  }
+  assert(bt == T_OBJECT, "or we shouldn't be here");
+
   IdealKit ideal(this, true);
 
   Node* tls = __ thread(); // ThreadLocalStorage
@@ -3497,32 +3523,28 @@
                                           PtrQueue::byte_offset_of_index());
   const int buffer_offset  = in_bytes(JavaThread::satb_mark_queue_offset() +  // 652
                                           PtrQueue::byte_offset_of_buf());
+
   // Now the actual pointers into the thread
-
-  // set_control( ctl);
-
   Node* marking_adr = __ AddP(no_base, tls, __ ConX(marking_offset));
   Node* buffer_adr  = __ AddP(no_base, tls, __ ConX(buffer_offset));
   Node* index_adr   = __ AddP(no_base, tls, __ ConX(index_offset));
 
   // Now some of the values
-
   Node* marking = __ load(__ ctrl(), marking_adr, TypeInt::INT, active_type, Compile::AliasIdxRaw);
 
   // if (!marking)
   __ if_then(marking, BoolTest::ne, zero); {
     Node* index   = __ load(__ ctrl(), index_adr, TypeInt::INT, T_INT, Compile::AliasIdxRaw);
 
-    const Type* t1 = adr->bottom_type();
-    const Type* t2 = val->bottom_type();
-
-    Node* orig = __ load(no_ctrl, adr, val_type, bt, alias_idx);
-    // if (orig != NULL)
-    __ if_then(orig, BoolTest::ne, null()); {
-      Node* buffer  = __ load(__ ctrl(), buffer_adr, TypeRawPtr::NOTNULL, T_ADDRESS, Compile::AliasIdxRaw);
-
+    if (do_load) {
       // load original value
       // alias_idx correct??
+      pre_val = __ load(no_ctrl, adr, val_type, bt, alias_idx);
+    }
+
+    // if (pre_val != NULL)
+    __ if_then(pre_val, BoolTest::ne, null()); {
+      Node* buffer  = __ load(__ ctrl(), buffer_adr, TypeRawPtr::NOTNULL, T_ADDRESS, Compile::AliasIdxRaw);
 
       // is the queue for this thread full?
       __ if_then(index, BoolTest::ne, zero, likely); {
@@ -3536,10 +3558,9 @@
         next_indexX = _gvn.transform( new (C, 2) ConvI2LNode(next_index, TypeLong::make(0, max_jlong, Type::WidenMax)) );
 #endif
 
-        // Now get the buffer location we will log the original value into and store it
+        // Now get the buffer location we will log the previous value into and store it
         Node *log_addr = __ AddP(no_base, buffer, next_indexX);
-        __ store(__ ctrl(), log_addr, orig, T_OBJECT, Compile::AliasIdxRaw);
-
+        __ store(__ ctrl(), log_addr, pre_val, T_OBJECT, Compile::AliasIdxRaw);
         // update the index
         __ store(__ ctrl(), index_adr, next_index, T_INT, Compile::AliasIdxRaw);
 
@@ -3547,9 +3568,9 @@
 
         // logging buffer is full, call the runtime
         const TypeFunc *tf = OptoRuntime::g1_wb_pre_Type();
-        __ make_leaf_call(tf, CAST_FROM_FN_PTR(address, SharedRuntime::g1_wb_pre), "g1_wb_pre", orig, tls);
+        __ make_leaf_call(tf, CAST_FROM_FN_PTR(address, SharedRuntime::g1_wb_pre), "g1_wb_pre", pre_val, tls);
       } __ end_if();  // (!index)
-    } __ end_if();  // (orig != NULL)
+    } __ end_if();  // (pre_val != NULL)
   } __ end_if();  // (!marking)
 
   // Final sync IdealKit and GraphKit.
--- a/hotspot/src/share/vm/opto/graphKit.hpp	Mon Apr 25 15:45:49 2011 -0700
+++ b/hotspot/src/share/vm/opto/graphKit.hpp	Wed Jul 05 17:42:16 2017 +0200
@@ -544,8 +544,10 @@
                              BasicType bt);
 
   // For the few case where the barriers need special help
-  void pre_barrier(Node* ctl, Node* obj, Node* adr, uint adr_idx,
-                   Node* val, const TypeOopPtr* val_type, BasicType bt);
+  void pre_barrier(bool do_load, Node* ctl,
+                   Node* obj, Node* adr, uint adr_idx, Node* val, const TypeOopPtr* val_type,
+                   Node* pre_val,
+                   BasicType bt);
 
   void post_barrier(Node* ctl, Node* store, Node* obj, Node* adr, uint adr_idx,
                     Node* val, BasicType bt, bool use_precise);
@@ -671,11 +673,13 @@
                           Node* adr,  uint adr_idx, Node* val, bool use_precise);
 
   // G1 pre/post barriers
-  void g1_write_barrier_pre(Node* obj,
+  void g1_write_barrier_pre(bool do_load,
+                            Node* obj,
                             Node* adr,
                             uint alias_idx,
                             Node* val,
                             const TypeOopPtr* val_type,
+                            Node* pre_val,
                             BasicType bt);
 
   void g1_write_barrier_post(Node* store,
--- a/hotspot/src/share/vm/opto/lcm.cpp	Mon Apr 25 15:45:49 2011 -0700
+++ b/hotspot/src/share/vm/opto/lcm.cpp	Wed Jul 05 17:42:16 2017 +0200
@@ -688,20 +688,22 @@
       }
       ready_cnt[n->_idx] = local; // Count em up
 
+#ifdef ASSERT
+      if( UseConcMarkSweepGC || UseG1GC ) {
+        if( n->is_Mach() && n->as_Mach()->ideal_Opcode() == Op_StoreCM ) {
+          // Check the precedence edges
+          for (uint prec = n->req(); prec < n->len(); prec++) {
+            Node* oop_store = n->in(prec);
+            if (oop_store != NULL) {
+              assert(cfg->_bbs[oop_store->_idx]->_dom_depth <= this->_dom_depth, "oop_store must dominate card-mark");
+            }
+          }
+        }
+      }
+#endif
+
       // A few node types require changing a required edge to a precedence edge
       // before allocation.
-      if( UseConcMarkSweepGC || UseG1GC ) {
-        if( n->is_Mach() && n->as_Mach()->ideal_Opcode() == Op_StoreCM ) {
-          // Note: Required edges with an index greater than oper_input_base
-          // are not supported by the allocator.
-          // Note2: Can only depend on unmatched edge being last,
-          // can not depend on its absolute position.
-          Node *oop_store = n->in(n->req() - 1);
-          n->del_req(n->req() - 1);
-          n->add_prec(oop_store);
-          assert(cfg->_bbs[oop_store->_idx]->_dom_depth <= this->_dom_depth, "oop_store must dominate card-mark");
-        }
-      }
       if( n->is_Mach() && n->req() > TypeFunc::Parms &&
           (n->as_Mach()->ideal_Opcode() == Op_MemBarAcquire ||
            n->as_Mach()->ideal_Opcode() == Op_MemBarVolatile) ) {
--- a/hotspot/src/share/vm/opto/library_call.cpp	Mon Apr 25 15:45:49 2011 -0700
+++ b/hotspot/src/share/vm/opto/library_call.cpp	Wed Jul 05 17:42:16 2017 +0200
@@ -166,6 +166,10 @@
   // This returns Type::AnyPtr, RawPtr, or OopPtr.
   int classify_unsafe_addr(Node* &base, Node* &offset);
   Node* make_unsafe_address(Node* base, Node* offset);
+  // Helper for inline_unsafe_access.
+  // Generates the guards that check whether the result of
+  // Unsafe.getObject should be recorded in an SATB log buffer.
+  void insert_g1_pre_barrier(Node* base_oop, Node* offset, Node* pre_val);
   bool inline_unsafe_access(bool is_native_ptr, bool is_store, BasicType type, bool is_volatile);
   bool inline_unsafe_prefetch(bool is_native_ptr, bool is_store, bool is_static);
   bool inline_unsafe_allocate();
@@ -240,6 +244,8 @@
   bool inline_numberOfTrailingZeros(vmIntrinsics::ID id);
   bool inline_bitCount(vmIntrinsics::ID id);
   bool inline_reverseBytes(vmIntrinsics::ID id);
+
+  bool inline_reference_get();
 };
 
 
@@ -336,6 +342,14 @@
     if (!UsePopCountInstruction)  return NULL;
     break;
 
+  case vmIntrinsics::_Reference_get:
+    // It is only when G1 is enabled that we absolutely
+    // need to use the intrinsic version of Reference.get()
+    // so that the value in the referent field, if necessary,
+    // can be registered by the pre-barrier code.
+    if (!UseG1GC) return NULL;
+    break;
+
  default:
     assert(id <= vmIntrinsics::LAST_COMPILER_INLINE, "caller responsibility");
     assert(id != vmIntrinsics::_Object_init && id != vmIntrinsics::_invoke, "enum out of order?");
@@ -387,6 +401,7 @@
     tty->print_cr("Intrinsic %s", str);
   }
 #endif
+
   if (kit.try_to_inline()) {
     if (PrintIntrinsics || PrintInlining NOT_PRODUCT( || PrintOptoInlining) ) {
       CompileTask::print_inlining(kit.callee(), jvms->depth() - 1, kit.bci(), is_virtual() ? "(intrinsic, virtual)" : "(intrinsic)");
@@ -402,11 +417,19 @@
   }
 
   if (PrintIntrinsics) {
-    tty->print("Did not inline intrinsic %s%s at bci:%d in",
+    if (jvms->has_method()) {
+      // Not a root compile.
+      tty->print("Did not inline intrinsic %s%s at bci:%d in",
+                 vmIntrinsics::name_at(intrinsic_id()),
+                 (is_virtual() ? " (virtual)" : ""), kit.bci());
+      kit.caller()->print_short_name(tty);
+      tty->print_cr(" (%d bytes)", kit.caller()->code_size());
+    } else {
+      // Root compile
+      tty->print("Did not generate intrinsic %s%s at bci:%d in",
                vmIntrinsics::name_at(intrinsic_id()),
                (is_virtual() ? " (virtual)" : ""), kit.bci());
-    kit.caller()->print_short_name(tty);
-    tty->print_cr(" (%d bytes)", kit.caller()->code_size());
+    }
   }
   C->gather_intrinsic_statistics(intrinsic_id(), is_virtual(), Compile::_intrinsic_failed);
   return NULL;
@@ -418,6 +441,14 @@
   const bool is_native_ptr  = true;
   const bool is_static      = true;
 
+  if (!jvms()->has_method()) {
+    // Root JVMState has a null method.
+    assert(map()->memory()->Opcode() == Op_Parm, "");
+    // Insert the memory aliasing node
+    set_all_memory(reset_memory());
+  }
+  assert(merged_memory(), "");
+
   switch (intrinsic_id()) {
   case vmIntrinsics::_hashCode:
     return inline_native_hashcode(intrinsic()->is_virtual(), !is_static);
@@ -658,6 +689,9 @@
   case vmIntrinsics::_getCallerClass:
     return inline_native_Reflection_getCallerClass();
 
+  case vmIntrinsics::_Reference_get:
+    return inline_reference_get();
+
   default:
     // If you get here, it may be that someone has added a new intrinsic
     // to the list in vmSymbols.hpp without implementing it here.
@@ -2076,6 +2110,106 @@
 
 const static BasicType T_ADDRESS_HOLDER = T_LONG;
 
+// Helper that guards and inserts a G1 pre-barrier.
+void LibraryCallKit::insert_g1_pre_barrier(Node* base_oop, Node* offset, Node* pre_val) {
+  assert(UseG1GC, "should not call this otherwise");
+
+  // We could be accessing the referent field of a reference object. If so, when G1
+  // is enabled, we need to log the value in the referent field in an SATB buffer.
+  // This routine performs some compile time filters and generates suitable
+  // runtime filters that guard the pre-barrier code.
+
+  // Some compile time checks.
+
+  // If offset is a constant, is it java_lang_ref_Reference::_reference_offset?
+  const TypeX* otype = offset->find_intptr_t_type();
+  if (otype != NULL && otype->is_con() &&
+      otype->get_con() != java_lang_ref_Reference::referent_offset) {
+    // Constant offset but not the reference_offset so just return
+    return;
+  }
+
+  // We only need to generate the runtime guards for instances.
+  const TypeOopPtr* btype = base_oop->bottom_type()->isa_oopptr();
+  if (btype != NULL) {
+    if (btype->isa_aryptr()) {
+      // Array type so nothing to do
+      return;
+    }
+
+    const TypeInstPtr* itype = btype->isa_instptr();
+    if (itype != NULL) {
+      // Can the klass of base_oop be statically determined
+      // to be _not_ a sub-class of Reference?
+      ciKlass* klass = itype->klass();
+      if (klass->is_subtype_of(env()->Reference_klass()) &&
+          !env()->Reference_klass()->is_subtype_of(klass)) {
+        return;
+      }
+    }
+  }
+
+  // The compile time filters did not reject base_oop/offset so
+  // we need to generate the following runtime filters
+  //
+  // if (offset == java_lang_ref_Reference::_reference_offset) {
+  //   if (base != null) {
+  //     if (klass(base)->reference_type() != REF_NONE)) {
+  //       pre_barrier(_, pre_val, ...);
+  //     }
+  //   }
+  // }
+
+  float likely  = PROB_LIKELY(0.999);
+  float unlikely  = PROB_UNLIKELY(0.999);
+
+  IdealKit ideal(this);
+#define __ ideal.
+
+  const int reference_type_offset = instanceKlass::reference_type_offset_in_bytes() +
+                                        sizeof(oopDesc);
+
+  Node* referent_off = __ ConX(java_lang_ref_Reference::referent_offset);
+
+  __ if_then(offset, BoolTest::eq, referent_off, unlikely); {
+    __ if_then(base_oop, BoolTest::ne, null(), likely); {
+
+      // Update graphKit memory and control from IdealKit.
+      sync_kit(ideal);
+
+      Node* ref_klass_con = makecon(TypeKlassPtr::make(env()->Reference_klass()));
+      Node* is_instof = gen_instanceof(base_oop, ref_klass_con);
+
+      // Update IdealKit memory and control from graphKit.
+      __ sync_kit(this);
+
+      Node* one = __ ConI(1);
+
+      __ if_then(is_instof, BoolTest::eq, one, unlikely); {
+
+        // Update graphKit from IdeakKit.
+        sync_kit(ideal);
+
+        // Use the pre-barrier to record the value in the referent field
+        pre_barrier(false /* do_load */,
+                    __ ctrl(),
+                    NULL /* obj */, NULL /* adr */, max_juint /* alias_idx */, NULL /* val */, NULL /* val_type */,
+                    pre_val /* pre_val */,
+                    T_OBJECT);
+
+        // Update IdealKit from graphKit.
+        __ sync_kit(this);
+
+      } __ end_if(); // _ref_type != ref_none
+    } __ end_if(); // base  != NULL
+  } __ end_if(); // offset == referent_offset
+
+  // Final sync IdealKit and GraphKit.
+  final_sync(ideal);
+#undef __
+}
+
+
 // Interpret Unsafe.fieldOffset cookies correctly:
 extern jlong Unsafe_field_offset_to_byte_offset(jlong field_offset);
 
@@ -2152,9 +2286,11 @@
   // Build address expression.  See the code in inline_unsafe_prefetch.
   Node *adr;
   Node *heap_base_oop = top();
+  Node* offset = top();
+
   if (!is_native_ptr) {
     // The offset is a value produced by Unsafe.staticFieldOffset or Unsafe.objectFieldOffset
-    Node* offset = pop_pair();
+    offset = pop_pair();
     // The base is either a Java object or a value produced by Unsafe.staticFieldBase
     Node* base   = pop();
     // We currently rely on the cookies produced by Unsafe.xxxFieldOffset
@@ -2195,6 +2331,13 @@
   // or Compile::must_alias will throw a diagnostic assert.)
   bool need_mem_bar = (alias_type->adr_type() == TypeOopPtr::BOTTOM);
 
+  // If we are reading the value of the referent field of a Reference
+  // object (either by using Unsafe directly or through reflection)
+  // then, if G1 is enabled, we need to record the referent in an
+  // SATB log buffer using the pre-barrier mechanism.
+  bool need_read_barrier = UseG1GC && !is_native_ptr && !is_store &&
+                           offset != top() && heap_base_oop != top();
+
   if (!is_store && type == T_OBJECT) {
     // Attempt to infer a sharper value type from the offset and base type.
     ciKlass* sharpened_klass = NULL;
@@ -2278,8 +2421,13 @@
     case T_SHORT:
     case T_INT:
     case T_FLOAT:
+      push(p);
+      break;
     case T_OBJECT:
-      push( p );
+      if (need_read_barrier) {
+        insert_g1_pre_barrier(heap_base_oop, offset, p);
+      }
+      push(p);
       break;
     case T_ADDRESS:
       // Cast to an int type.
@@ -2534,7 +2682,10 @@
   case T_OBJECT:
      // reference stores need a store barrier.
     // (They don't if CAS fails, but it isn't worth checking.)
-    pre_barrier(control(), base, adr, alias_idx, newval, value_type->make_oopptr(), T_OBJECT);
+    pre_barrier(true /* do_load*/,
+                control(), base, adr, alias_idx, newval, value_type->make_oopptr(),
+                NULL /* pre_val*/,
+                T_OBJECT);
 #ifdef _LP64
     if (adr->bottom_type()->is_ptr_to_narrowoop()) {
       Node *newval_enc = _gvn.transform(new (C, 2) EncodePNode(newval, newval->bottom_type()->make_narrowoop()));
@@ -5235,3 +5386,44 @@
                     copyfunc_addr, copyfunc_name, adr_type,
                     src_start, dest_start, copy_length XTOP);
 }
+
+//----------------------------inline_reference_get----------------------------
+
+bool LibraryCallKit::inline_reference_get() {
+  const int nargs = 1; // self
+
+  guarantee(java_lang_ref_Reference::referent_offset > 0,
+            "should have already been set");
+
+  int referent_offset = java_lang_ref_Reference::referent_offset;
+
+  // Restore the stack and pop off the argument
+  _sp += nargs;
+  Node *reference_obj = pop();
+
+  // Null check on self without removing any arguments.
+  _sp += nargs;
+  reference_obj = do_null_check(reference_obj, T_OBJECT);
+  _sp -= nargs;;
+
+  if (stopped()) return true;
+
+  Node *adr = basic_plus_adr(reference_obj, reference_obj, referent_offset);
+
+  ciInstanceKlass* klass = env()->Object_klass();
+  const TypeOopPtr* object_type = TypeOopPtr::make_from_klass(klass);
+
+  Node* no_ctrl = NULL;
+  Node *result = make_load(no_ctrl, adr, object_type, T_OBJECT);
+
+  // Use the pre-barrier to record the value in the referent field
+  pre_barrier(false /* do_load */,
+              control(),
+              NULL /* obj */, NULL /* adr */, max_juint /* alias_idx */, NULL /* val */, NULL /* val_type */,
+              result /* pre_val */,
+              T_OBJECT);
+
+  push(result);
+  return true;
+}
+
--- a/hotspot/src/share/vm/opto/memnode.cpp	Mon Apr 25 15:45:49 2011 -0700
+++ b/hotspot/src/share/vm/opto/memnode.cpp	Wed Jul 05 17:42:16 2017 +0200
@@ -2159,9 +2159,12 @@
   Node* mem     = in(MemNode::Memory);
   Node* address = in(MemNode::Address);
 
-  // Back-to-back stores to same address?  Fold em up.
-  // Generally unsafe if I have intervening uses...
-  if (mem->is_Store() && phase->eqv_uncast(mem->in(MemNode::Address), address)) {
+  // Back-to-back stores to same address?  Fold em up.  Generally
+  // unsafe if I have intervening uses...  Also disallowed for StoreCM
+  // since they must follow each StoreP operation.  Redundant StoreCMs
+  // are eliminated just before matching in final_graph_reshape.
+  if (mem->is_Store() && phase->eqv_uncast(mem->in(MemNode::Address), address) &&
+      mem->Opcode() != Op_StoreCM) {
     // Looking at a dead closed cycle of memory?
     assert(mem != mem->in(MemNode::Memory), "dead loop in StoreNode::Ideal");
 
--- a/hotspot/src/share/vm/opto/output.cpp	Mon Apr 25 15:45:49 2011 -0700
+++ b/hotspot/src/share/vm/opto/output.cpp	Wed Jul 05 17:42:16 2017 +0200
@@ -1354,15 +1354,20 @@
         // Check that oop-store precedes the card-mark
         else if( mach->ideal_Opcode() == Op_StoreCM ) {
           uint storeCM_idx = j;
-          Node *oop_store = mach->in(mach->_cnt);  // First precedence edge
-          assert( oop_store != NULL, "storeCM expects a precedence edge");
-          uint i4;
-          for( i4 = 0; i4 < last_inst; ++i4 ) {
-            if( b->_nodes[i4] == oop_store ) break;
+          int count = 0;
+          for (uint prec = mach->req(); prec < mach->len(); prec++) {
+            Node *oop_store = mach->in(prec);  // Precedence edge
+            if (oop_store == NULL) continue;
+            count++;
+            uint i4;
+            for( i4 = 0; i4 < last_inst; ++i4 ) {
+              if( b->_nodes[i4] == oop_store ) break;
+            }
+            // Note: This test can provide a false failure if other precedence
+            // edges have been added to the storeCMNode.
+            assert( i4 == last_inst || i4 < storeCM_idx, "CM card-mark executes before oop-store");
           }
-          // Note: This test can provide a false failure if other precedence
-          // edges have been added to the storeCMNode.
-          assert( i4 == last_inst || i4 < storeCM_idx, "CM card-mark executes before oop-store");
+          assert(count > 0, "storeCM expects at least one precedence edge");
         }
 #endif
 
--- a/hotspot/src/share/vm/prims/jni.cpp	Mon Apr 25 15:45:49 2011 -0700
+++ b/hotspot/src/share/vm/prims/jni.cpp	Wed Jul 05 17:42:16 2017 +0200
@@ -29,6 +29,9 @@
 #include "classfile/systemDictionary.hpp"
 #include "classfile/vmSymbols.hpp"
 #include "interpreter/linkResolver.hpp"
+#ifndef SERIALGC
+#include "gc_implementation/g1/g1SATBCardTableModRefBS.hpp"
+#endif // SERIALGC
 #include "memory/allocation.inline.hpp"
 #include "memory/gcLocker.inline.hpp"
 #include "memory/oopFactory.hpp"
@@ -1724,6 +1727,26 @@
     o = JvmtiExport::jni_GetField_probe(thread, obj, o, k, fieldID, false);
   }
   jobject ret = JNIHandles::make_local(env, o->obj_field(offset));
+#ifndef SERIALGC
+  // If G1 is enabled and we are accessing the value of the referent
+  // field in a reference object then we need to register a non-null
+  // referent with the SATB barrier.
+  if (UseG1GC) {
+    bool needs_barrier = false;
+
+    if (ret != NULL &&
+        offset == java_lang_ref_Reference::referent_offset &&
+        instanceKlass::cast(k)->reference_type() != REF_NONE) {
+      assert(instanceKlass::cast(k)->is_subclass_of(SystemDictionary::Reference_klass()), "sanity");
+      needs_barrier = true;
+    }
+
+    if (needs_barrier) {
+      oop referent = JNIHandles::resolve(ret);
+      G1SATBCardTableModRefBS::enqueue(referent);
+    }
+  }
+#endif // SERIALGC
   DTRACE_PROBE1(hotspot_jni, GetObjectField__return, ret);
   return ret;
 JNI_END
--- a/hotspot/src/share/vm/prims/jvmtiEnv.cpp	Mon Apr 25 15:45:49 2011 -0700
+++ b/hotspot/src/share/vm/prims/jvmtiEnv.cpp	Wed Jul 05 17:42:16 2017 +0200
@@ -525,7 +525,7 @@
     ObjectLocker ol(loader, THREAD);
 
     // need the path as java.lang.String
-    Handle path = java_lang_String::create_from_str(segment, THREAD);
+    Handle path = java_lang_String::create_from_platform_dependent_str(segment, THREAD);
     if (HAS_PENDING_EXCEPTION) {
       CLEAR_PENDING_EXCEPTION;
       return JVMTI_ERROR_INTERNAL;
--- a/hotspot/src/share/vm/prims/unsafe.cpp	Mon Apr 25 15:45:49 2011 -0700
+++ b/hotspot/src/share/vm/prims/unsafe.cpp	Wed Jul 05 17:42:16 2017 +0200
@@ -24,6 +24,9 @@
 
 #include "precompiled.hpp"
 #include "classfile/vmSymbols.hpp"
+#ifndef SERIALGC
+#include "gc_implementation/g1/g1SATBCardTableModRefBS.hpp"
+#endif // SERIALGC
 #include "memory/allocation.inline.hpp"
 #include "prims/jni.h"
 #include "prims/jvm.h"
@@ -193,7 +196,32 @@
   UnsafeWrapper("Unsafe_GetObject");
   if (obj == NULL)  THROW_0(vmSymbols::java_lang_NullPointerException());
   GET_OOP_FIELD(obj, offset, v)
-  return JNIHandles::make_local(env, v);
+  jobject ret = JNIHandles::make_local(env, v);
+#ifndef SERIALGC
+  // We could be accessing the referent field in a reference
+  // object. If G1 is enabled then we need to register a non-null
+  // referent with the SATB barrier.
+  if (UseG1GC) {
+    bool needs_barrier = false;
+
+    if (ret != NULL) {
+      if (offset == java_lang_ref_Reference::referent_offset) {
+        oop o = JNIHandles::resolve_non_null(obj);
+        klassOop k = o->klass();
+        if (instanceKlass::cast(k)->reference_type() != REF_NONE) {
+          assert(instanceKlass::cast(k)->is_subclass_of(SystemDictionary::Reference_klass()), "sanity");
+          needs_barrier = true;
+        }
+      }
+    }
+
+    if (needs_barrier) {
+      oop referent = JNIHandles::resolve(ret);
+      G1SATBCardTableModRefBS::enqueue(referent);
+    }
+  }
+#endif // SERIALGC
+  return ret;
 UNSAFE_END
 
 UNSAFE_ENTRY(void, Unsafe_SetObject140(JNIEnv *env, jobject unsafe, jobject obj, jint offset, jobject x_h))
@@ -226,7 +254,32 @@
 UNSAFE_ENTRY(jobject, Unsafe_GetObject(JNIEnv *env, jobject unsafe, jobject obj, jlong offset))
   UnsafeWrapper("Unsafe_GetObject");
   GET_OOP_FIELD(obj, offset, v)
-  return JNIHandles::make_local(env, v);
+  jobject ret = JNIHandles::make_local(env, v);
+#ifndef SERIALGC
+  // We could be accessing the referent field in a reference
+  // object. If G1 is enabled then we need to register non-null
+  // referent with the SATB barrier.
+  if (UseG1GC) {
+    bool needs_barrier = false;
+
+    if (ret != NULL) {
+      if (offset == java_lang_ref_Reference::referent_offset && obj != NULL) {
+        oop o = JNIHandles::resolve(obj);
+        klassOop k = o->klass();
+        if (instanceKlass::cast(k)->reference_type() != REF_NONE) {
+          assert(instanceKlass::cast(k)->is_subclass_of(SystemDictionary::Reference_klass()), "sanity");
+          needs_barrier = true;
+        }
+      }
+    }
+
+    if (needs_barrier) {
+      oop referent = JNIHandles::resolve(ret);
+      G1SATBCardTableModRefBS::enqueue(referent);
+    }
+  }
+#endif // SERIALGC
+  return ret;
 UNSAFE_END
 
 UNSAFE_ENTRY(void, Unsafe_SetObject(JNIEnv *env, jobject unsafe, jobject obj, jlong offset, jobject x_h))
--- a/hotspot/src/share/vm/runtime/arguments.cpp	Mon Apr 25 15:45:49 2011 -0700
+++ b/hotspot/src/share/vm/runtime/arguments.cpp	Wed Jul 05 17:42:16 2017 +0200
@@ -244,6 +244,12 @@
   { "MaxLiveObjectEvacuationRatio",
                            JDK_Version::jdk_update(6,24), JDK_Version::jdk(8) },
   { "ForceSharedSpaces",   JDK_Version::jdk_update(6,25), JDK_Version::jdk(8) },
+  { "UseParallelOldGCCompacting",
+                           JDK_Version::jdk_update(6,27), JDK_Version::jdk(8) },
+  { "UseParallelDensePrefixUpdate",
+                           JDK_Version::jdk_update(6,27), JDK_Version::jdk(8) },
+  { "UseParallelOldGCDensePrefix",
+                           JDK_Version::jdk_update(6,27), JDK_Version::jdk(8) },
   { "AllowTransitionalJSR292",       JDK_Version::jdk(7), JDK_Version::jdk(8) },
   { NULL, JDK_Version(0), JDK_Version(0) }
 };
@@ -801,26 +807,22 @@
 
   JDK_Version since = JDK_Version();
 
-  if (parse_argument(arg, origin)) {
-    // do nothing
-  } else if (is_newly_obsolete(arg, &since)) {
-    enum { bufsize = 256 };
-    char buffer[bufsize];
-    since.to_string(buffer, bufsize);
-    jio_fprintf(defaultStream::error_stream(),
-      "Warning: The flag %s has been EOL'd as of %s and will"
-      " be ignored\n", arg, buffer);
-  } else {
-    if (!ignore_unrecognized) {
-      jio_fprintf(defaultStream::error_stream(),
-                  "Unrecognized VM option '%s'\n", arg);
-      // allow for commandline "commenting out" options like -XX:#+Verbose
-      if (strlen(arg) == 0 || arg[0] != '#') {
-        return false;
-      }
-    }
+  if (parse_argument(arg, origin) || ignore_unrecognized) {
+    return true;
   }
-  return true;
+
+  const char * const argname = *arg == '+' || *arg == '-' ? 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;
+  }
+
+  jio_fprintf(defaultStream::error_stream(),
+              "Unrecognized VM option '%s'\n", argname);
+  // allow for commandline "commenting out" options like -XX:#+Verbose
+  return arg[0] == '#';
 }
 
 bool Arguments::process_settings_file(const char* file_name, bool should_exist, jboolean ignore_unrecognized) {
--- a/hotspot/src/share/vm/runtime/globals.hpp	Mon Apr 25 15:45:49 2011 -0700
+++ b/hotspot/src/share/vm/runtime/globals.hpp	Wed Jul 05 17:42:16 2017 +0200
@@ -1355,13 +1355,6 @@
   product(bool, UseParallelOldGC, false,                                    \
           "Use the Parallel Old garbage collector")                         \
                                                                             \
-  product(bool, UseParallelOldGCCompacting, true,                           \
-          "In the Parallel Old garbage collector use parallel compaction")  \
-                                                                            \
-  product(bool, UseParallelDensePrefixUpdate, true,                         \
-          "In the Parallel Old garbage collector use parallel dense"        \
-          " prefix update")                                                 \
-                                                                            \
   product(uintx, HeapMaximumCompactionInterval, 20,                         \
           "How often should we maximally compact the heap (not allowing "   \
           "any dead space)")                                                \
@@ -1381,9 +1374,6 @@
           "The standard deviation used by the par compact dead wood"        \
           "limiter (a number between 0-100).")                              \
                                                                             \
-  product(bool, UseParallelOldGCDensePrefix, true,                          \
-          "Use a dense prefix with the Parallel Old garbage collector")     \
-                                                                            \
   product(uintx, ParallelGCThreads, 0,                                      \
           "Number of parallel threads parallel gc will use")                \
                                                                             \
--- a/jaxp/.hgtags	Mon Apr 25 15:45:49 2011 -0700
+++ b/jaxp/.hgtags	Wed Jul 05 17:42:16 2017 +0200
@@ -113,3 +113,4 @@
 1759daa85d33800bd578853f9531f9de73f70fc7 jdk7-b136
 1d87f7460cde7f8f30af668490f82b52b879bfd8 jdk7-b137
 be3758943770a0a3dd4be6a1cb4063507c4d7062 jdk7-b138
+28c7c0ed2444607829ba11ad827f8d52197a2830 jdk7-b139
--- a/jaxws/.hgtags	Mon Apr 25 15:45:49 2011 -0700
+++ b/jaxws/.hgtags	Wed Jul 05 17:42:16 2017 +0200
@@ -113,3 +113,4 @@
 c81d289c9a532d6e94af3c09d856a2a20529040f jdk7-b136
 ccea3282991ce8b678e188cf32a8239f76ff3bfa jdk7-b137
 cc956c8a8255583535597e9a63db23c510e9a063 jdk7-b138
+c025078c8362076503bb83b8e4da14ba7b347940 jdk7-b139
--- a/jaxws/jaxws.properties	Mon Apr 25 15:45:49 2011 -0700
+++ b/jaxws/jaxws.properties	Wed Jul 05 17:42:16 2017 +0200
@@ -25,8 +25,8 @@
 
 drops.master.copy.base=${drops.dir}
 
-jaxws_src.bundle.name=jdk7-jaxws2_2_2-2010_12_14.zip
-jaxws_src.bundle.md5.checksum=fee9ac72fabc96719eefc66ecaff4bc3
+jaxws_src.bundle.name=jdk7-jaxws2_2_4-b01-2011_04_08.zip
+jaxws_src.bundle.md5.checksum=9f35dd731c99ddb62db650aaf20e5bf4
 jaxws_src.master.bundle.dir=${drops.master.copy.base}
 jaxws_src.master.bundle.url.base=http://download.java.net/glassfish/components/jax-ws/openjdk/jdk7
 
--- a/jdk/.hgtags	Mon Apr 25 15:45:49 2011 -0700
+++ b/jdk/.hgtags	Wed Jul 05 17:42:16 2017 +0200
@@ -113,3 +113,4 @@
 aa13e7702cd9d8aca9aa38f1227f966990866944 jdk7-b136
 29296ea6529a418037ccce95903249665ef31c11 jdk7-b137
 60d3d55dcc9c31a30ced9caa6ef5c0dcd7db031d jdk7-b138
+d80954a89b49fda47c0c5cace65a17f5a758b8bd jdk7-b139
--- a/jdk/make/com/sun/java/pack/Makefile	Mon Apr 25 15:45:49 2011 -0700
+++ b/jdk/make/com/sun/java/pack/Makefile	Wed Jul 05 17:42:16 2017 +0200
@@ -56,10 +56,6 @@
 
 vpath %.cpp $(SHARE_SRC)/native/$(PKGDIR)
 
-
-
-
-
 ifeq ($(STANDALONE),true)
   ZIPOBJDIR = $(OUTPUTDIR)/tmp/sun/java.util.zip/zip/$(OBJDIRNAME)
 
@@ -131,8 +127,9 @@
 pack200-tool:
 	$(call make-launcher, pack200, com.sun.java.util.jar.pack.Driver, , --pack)
 
+# ignore mapfile for non-product binary 
 unpacker:
-	$(MAKE) $(UNPACK_EXE) STANDALONE=true LDMAPFLAGS_OPT= LDMAPFLAGS_DBG=
+	$(MAKE) $(UNPACK_EXE) STANDALONE=true LDMAPFLAGS_DBG=
 
 ifeq ($(PLATFORM), windows)
 IMVERSIONVALUE=$(JDK_MINOR_VERSION).$(JDK_MICRO_VERSION).$(JDK_UPDATE_VER).$(COOKED_BUILD_NUMBER)
@@ -147,8 +144,14 @@
 	$(ECHO) "Resource files not required for Unix"
 endif
 
+# Mapfile-vers.gmk, does not copy over the mapfile-vers-unpack200, when
+# the make utiliy is re-invoked, as in this case. In order to workaround
+# this special case, the mapfile required for the unpack200 command, is
+# explicitly copied over to the expected location.
 $(UNPACK_EXE): $(UNPACK_EXE_FILES_o) updatefiles winres
 	$(prep-target)
+	$(RM) $(TEMPDIR)/mapfile-vers
+	$(CP) mapfile-vers-unpack200 $(TEMPDIR)/mapfile-vers
 	$(LINKER)  $(LDDFLAGS) $(UNPACK_EXE_FILES_o) $(RES) $(LIBCXX) $(LDOUTPUT)$(TEMPDIR)/unpack200$(EXE_SUFFIX)
 ifdef MT
 	$(MT) /manifest $(OBJDIR)/unpack200$(EXE_SUFFIX).manifest /outputresource:$(TEMPDIR)/unpack200$(EXE_SUFFIX);#1
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/make/com/sun/java/pack/mapfile-vers-unpack200	Wed Jul 05 17:42:16 2017 +0200
@@ -0,0 +1,31 @@
+#
+# Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# This code is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation.  Oracle designates this
+# particular file as subject to the "Classpath" exception as provided
+# by Oracle in the LICENSE file that accompanied this code.
+#
+# This code is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+# version 2 for more details (a copy is included in the LICENSE file that
+# accompanied this code).
+#
+# You should have received a copy of the GNU General Public License version
+# 2 along with this work; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+# or visit www.oracle.com if you need additional information or have any
+# questions.
+#
+
+# Define library interface.
+
+SUNWprivate_1.1 {
+	local:
+	    *;
+};
--- a/jdk/make/common/Mapfile-vers.gmk	Mon Apr 25 15:45:49 2011 -0700
+++ b/jdk/make/common/Mapfile-vers.gmk	Wed Jul 05 17:42:16 2017 +0200
@@ -52,8 +52,8 @@
   endif
   
   # If we are re-ordering functions in this solaris library, we need to make
-  #   sure that -xF is added to the compile lines. This option is critical and
-  #   enables the functions to be reordered.
+  # sure that -xF is added to the compile lines. This option is critical and
+  # enables the functions to be reordered.
   ifdef FILES_reorder
     CFLAGS_OPT   += -xF
     CXXFLAGS_OPT += -xF
@@ -76,7 +76,6 @@
 
 endif # PLATFORM
 
-
 ifeq ($(PLATFORM), linux)
 
 ifeq ($(VARIANT), OPT)
--- a/jdk/make/common/Program.gmk	Mon Apr 25 15:45:49 2011 -0700
+++ b/jdk/make/common/Program.gmk	Wed Jul 05 17:42:16 2017 +0200
@@ -55,6 +55,11 @@
 
 program: $(ACTUAL_PROGRAM)
 
+# reuse the mapfiles in the launcher's directory, the same should
+# be applicable to the tool launchers as well.
+FILES_m = $(BUILDDIR)/java/main/java/mapfile-$(ARCH)
+include $(BUILDDIR)/common/Mapfile-vers.gmk
+
 include $(JDK_TOPDIR)/make/common/Rules.gmk
 
 ifdef NEVER_ACT_AS_SERVER_CLASS_MACHINE
--- a/jdk/make/common/Release.gmk	Mon Apr 25 15:45:49 2011 -0700
+++ b/jdk/make/common/Release.gmk	Wed Jul 05 17:42:16 2017 +0200
@@ -885,12 +885,18 @@
 ABS_DB_PATH  :=$(call FullPath,$(CLOSED_SHARE_SRC)/db)
 DB_ZIP_LIST = $(shell $(LS) $(ABS_DB_PATH)/*.zip 2>/dev/null)
 
+# Java DB image. Move the Java DB demo directory into the JDK's demo
+# dir and in the process, rename it to db.  Also remove index.html,
+# since it presumes docs are co-located. Also remove register.html (no
+# longer relevant).
 initial-image-jdk-db: $(DB_ZIP_LIST)
 	$(MKDIR) -p $(JDK_IMAGE_DIR)/db
 	for d in $(DB_ZIP_LIST); do \
           ($(CD) $(JDK_IMAGE_DIR)/db && $(UNZIP) -o $$d); \
 	done
-
+	$(RM) -rf $(DEMODIR)/db
+	$(MV) $(JDK_IMAGE_DIR)/db/demo $(DEMODIR)/db
+	$(RM) $(JDK_IMAGE_DIR)/db/index.html $(JDK_IMAGE_DIR)/db/register.html
 endif
 
 # Standard jdk image
--- a/jdk/make/docs/Makefile	Mon Apr 25 15:45:49 2011 -0700
+++ b/jdk/make/docs/Makefile	Wed Jul 05 17:42:16 2017 +0200
@@ -53,7 +53,7 @@
 DEV_DOCS_URL = $(DEV_DOCS_URL-$(JDK_MINOR_VERSION))
 
 # Url to Java Language Spec
-JLS3_URL = http://java.sun.com/docs/books/jls/
+#JLS3_URL = http://java.sun.com/docs/books/jls/
 
 # Common Java trademark line
 JAVA_TRADEMARK_LINE = Java is a trademark or registered trademark of \
@@ -293,8 +293,8 @@
 <strong>Java$(TRADEMARK)&nbsp;Platform<br>Standard&nbsp;Ed.&nbsp;$(JDK_MINOR_VERSION)</strong>
 
 # Java language specification cite
-TAG_JLS3 = jls3:a:See <cite><a href="$(JLS3_URL)"> \
-The Java Language Specification, Third Edition</a></cite>:
+TAG_JLS = jls:a:See <cite> \
+The Java&trade; Language Specification</cite>:
 
 # Overview file for core apis
 COREAPI_OVERVIEW = $(SHARE_SRC)/classes/overview-core.html
@@ -329,7 +329,7 @@
 	  $(call OptionPair,-tag,specdefault:X)				; \
 	  $(call OptionPair,-tag,Note:X)				; \
 	  $(call OptionPair,-tag,ToDo:X)				; \
-          $(call OptionPair,-tag,$(TAG_JLS3)) 				; \
+          $(call OptionPair,-tag,$(TAG_JLS)) 				; \
 	  $(call OptionOnly,-splitIndex)				; \
 	  $(call OptionPair,-overview,$(COREAPI_OVERVIEW))		; \
 	  $(call OptionPair,-doctitle,$(COREAPI_DOCTITLE))		; \
@@ -1081,6 +1081,7 @@
 	  $(call OptionPair,-doctitle,$(TREEAPI_DOCTITLE))		; \
 	  $(call OptionPair,-windowtitle,$(TREEAPI_WINDOWTITLE) $(DRAFT_WINTITLE));\
 	  $(call OptionPair,-header,$(TREEAPI_HEADER)$(DRAFT_HEADER))	; \
+          $(call OptionPair,-tag,$(TAG_JLS)) 				; \
 	  $(call OptionPair,-bottom,$(TREEAPI_BOTTOM)$(DRAFT_BOTTOM))	; \
 	  $(call OptionTrip,-group,$(TREEAPI_GROUPNAME),$(TREEAPI_REGEXP)); \
 	  $(call OptionTrip,-linkoffline,$(TREEAPI2COREAPI),$(COREAPI_DOCSDIR)/); \
--- a/jdk/make/java/java/FILES_java.gmk	Mon Apr 25 15:45:49 2011 -0700
+++ b/jdk/make/java/java/FILES_java.gmk	Wed Jul 05 17:42:16 2017 +0200
@@ -189,7 +189,6 @@
     java/util/ListResourceBundle.java \
         sun/util/EmptyListResourceBundle.java \
     java/util/Locale.java \
-        sun/util/locale/AsciiUtil.java \
         sun/util/locale/BaseLocale.java \
         sun/util/locale/Extension.java \
         sun/util/locale/InternalLocaleBuilder.java \
@@ -197,6 +196,7 @@
         sun/util/locale/LocaleExtensions.java \
         sun/util/locale/LocaleObjectCache.java \
         sun/util/locale/LocaleSyntaxException.java \
+        sun/util/locale/LocaleUtils.java \
         sun/util/locale/ParseStatus.java \
         sun/util/locale/StringTokenIterator.java \
         sun/util/locale/UnicodeLocaleExtension.java \
--- a/jdk/make/java/main/java/Makefile	Mon Apr 25 15:45:49 2011 -0700
+++ b/jdk/make/java/main/java/Makefile	Wed Jul 05 17:42:16 2017 +0200
@@ -61,5 +61,4 @@
 
 ifeq ($(PLATFORM), solaris)
 LDFLAGS += -R$(OPENWIN_LIB)
-LDFLAGS += -M mapfile-$(ARCH)
 endif
--- a/jdk/make/java/main/java/mapfile-amd64	Mon Apr 25 15:45:49 2011 -0700
+++ b/jdk/make/java/main/java/mapfile-amd64	Wed Jul 05 17:42:16 2017 +0200
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2004, 2011, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -27,7 +27,7 @@
 # interested in declaring a version, simply scoping the file is sufficient.
 #
 
-{
+SUNWprivate_1.1 {
 	global:
 		main;		# Provides basic adb symbol offsets
 		environ;	# Public symbols and required by Java run time
--- a/jdk/make/java/main/java/mapfile-i586	Mon Apr 25 15:45:49 2011 -0700
+++ b/jdk/make/java/main/java/mapfile-i586	Wed Jul 05 17:42:16 2017 +0200
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2004, 2005, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2004, 2011, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -27,7 +27,7 @@
 # interested in declaring a version, simply scoping the file is sufficient.
 #
 
-{
+SUNWprivate_1.1 {
 	global:
 		main;		# Provides basic adb symbol offsets
 		environ;	# Public symbols and required by Java run time
--- a/jdk/make/java/main/java/mapfile-sparc	Mon Apr 25 15:45:49 2011 -0700
+++ b/jdk/make/java/main/java/mapfile-sparc	Wed Jul 05 17:42:16 2017 +0200
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2004, 2011, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -26,7 +26,7 @@
 # interested in declaring a version, simply scoping the file is sufficient.
 #
 
-{
+SUNWprivate_1.1 {
 	global:
 		main;		# Provides basic adb symbol offsets
 		environ;	# Public symbols and required by Java run time
--- a/jdk/make/java/main/java/mapfile-sparcv9	Mon Apr 25 15:45:49 2011 -0700
+++ b/jdk/make/java/main/java/mapfile-sparcv9	Wed Jul 05 17:42:16 2017 +0200
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2004, 2011, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -28,7 +28,7 @@
 # interested in declaring a version, simply scoping the file is sufficient.
 #
 
-{
+SUNWprivate_1.1 {
 	global:
 		main;		# Provides basic adb symbol offsets
 		environ;	# Public symbols and required by Java run time
--- a/jdk/make/javax/crypto/Defs-jce.gmk	Mon Apr 25 15:45:49 2011 -0700
+++ b/jdk/make/javax/crypto/Defs-jce.gmk	Wed Jul 05 17:42:16 2017 +0200
@@ -58,7 +58,7 @@
 SIGNING_KEY_DIR    = /security/ws/JCE-signing/src
 SIGNING_KEYSTORE   = $(SIGNING_KEY_DIR)/KeyStore.jks
 SIGNING_PASSPHRASE = $(SIGNING_KEY_DIR)/passphrase.txt
-SIGNING_ALIAS      = jce_rsa
+SIGNING_ALIAS      = oracle_jce_rsa
 
 #
 # Defines for signing the various jar files.
--- a/jdk/make/jpda/jdwp/jdwp.spec	Mon Apr 25 15:45:49 2011 -0700
+++ b/jdk/make/jpda/jdwp/jdwp.spec	Wed Jul 05 17:42:16 2017 +0200
@@ -519,9 +519,8 @@
         "Both the JNI signature and the generic signature are "
         "returned for each class.  "
 	"Generic signatures are described in the signature attribute "
-        "section in the "
-	"<a href=\"http://java.sun.com/docs/books/vmspec\">
-        "Java Virtual Machine Specification, 3rd Edition.</a>  "
+        "section in "
+        "<cite>The Java&trade; Virtual Machine Specification</cite>. "
         "Since JDWP version 1.5."
 	(Out 
         )
@@ -623,8 +622,8 @@
             (referenceType refType "The reference type ID.")
         )
         (Reply
-            (int modBits "Modifier bits as defined in the "
-	                 "<a href=\"http://java.sun.com/docs/books/vmspec/html/ClassFile.doc.html\">VM Specification</a>")
+            (int modBits "Modifier bits as defined in Chapter 4 of "
+	                 "<cite>The Java&trade; Virtual Machine Specification</cite>")
         )
         (ErrorSet
             (Error INVALID_CLASS     "refType is not the ID of a reference "
@@ -651,8 +650,8 @@
                     (int modBits "The modifier bit flags (also known as access flags) "
 		                 "which provide additional information on the  "
                                  "field declaration. Individual flag values are "
-				 "defined in the "
- 	                         "<a href=\"http://java.sun.com/docs/books/vmspec/html/ClassFile.doc.html\">VM Specification</a>."
+				 "defined in Chapter 4 of "
+ 	                         "<cite>The Java&trade; Virtual Machine Specification</cite>. "
 				 "In addition, The <code>0xf0000000</code> bit identifies "
 				 "the field as synthetic, if the synthetic attribute "
 				 "<a href=\"#JDWP_VirtualMachine_Capabilities\">capability</a> is available.")
@@ -686,8 +685,8 @@
                     (int modBits "The modifier bit flags (also known as access flags) "
 		                 "which provide additional information on the  "
                                  "method declaration. Individual flag values are "
-				 "defined in the "
- 	                         "<a href=\"http://java.sun.com/docs/books/vmspec/html/ClassFile.doc.html\">VM Specification</a>."
+				 "defined in Chapter 4 of "
+ 	                         "<cite>The Java&trade; Virtual Machine Specification</cite>. "
 				 "In addition, The <code>0xf0000000</code> bit identifies "
 				 "the method as synthetic, if the synthetic attribute "
 				 "<a href=\"#JDWP_VirtualMachine_Capabilities\">capability</a> is available.")
@@ -773,8 +772,8 @@
     (Command Status=9
         "Returns the current status of the reference type. The status "
 	"indicates the extent to which the reference type has been "
-	"initialized, as described in the "
-	"<a href=\"http://java.sun.com/docs/books/vmspec/html/Concepts.doc.html#16491\">VM specification</a>. "
+	"initialized, as described in section 2.1.6 of "
+	"<cite>The Java&trade; Virtual Machine Specification</cite>. "
 	"If the class is linked the PREPARED and VERIFIED bits in the returned status bits "
 	"will be set. If the class is initialized the INITIALIZED bit in the returned "
 	"status bits will be set. If an error occured during initialization then the "
@@ -852,9 +851,8 @@
         "Returns the JNI signature of a reference type along with the "
         "generic signature if there is one.  "
 	"Generic signatures are described in the signature attribute "
-        "section in the "
-	"<a href=\"http://java.sun.com/docs/books/vmspec\">
-        "Java Virtual Machine Specification, 3rd Edition.</a>  "
+        "section in "
+        "<cite>The Java&trade; Virtual Machine Specification</cite>. "
         "Since JDWP version 1.5."
 	"<p>
 	(Out
@@ -882,9 +880,8 @@
 	"by the compiler. "
         "Fields are returned in the order they occur in the class file.  "
 	"Generic signatures are described in the signature attribute "
-        "section in the "
-	"<a href=\"http://java.sun.com/docs/books/vmspec\">
-        "Java Virtual Machine Specification, 3rd Edition.</a>  "
+        "section in "
+        "<cite>The Java&trade; Virtual Machine Specification</cite>. "
         "Since JDWP version 1.5."
         (Out
             (referenceType refType "The reference type ID.")
@@ -900,8 +897,8 @@
                     (int modBits "The modifier bit flags (also known as access flags) "
 		                 "which provide additional information on the  "
                                  "field declaration. Individual flag values are "
-				 "defined in the "
- 	                         "<a href=\"http://java.sun.com/docs/books/vmspec/html/ClassFile.doc.html\">VM Specification</a>."
+				 "defined in Chapter 4 of "
+ 	                         "<cite>The Java&trade; Virtual Machine Specification</cite>. "
 				 "In addition, The <code>0xf0000000</code> bit identifies "
 				 "the field as synthetic, if the synthetic attribute "
 				 "<a href=\"#JDWP_VirtualMachine_Capabilities\">capability</a> is available.")
@@ -925,9 +922,8 @@
 	"if present, and any synthetic methods created by the compiler. "
         "Methods are returned in the order they occur in the class file.  "
 	"Generic signatures are described in the signature attribute "
-        "section in the "
-	"<a href=\"http://java.sun.com/docs/books/vmspec\">
-        "Java Virtual Machine Specification, 3rd Edition.</a>  "
+        "section in "
+        "<cite>The Java&trade; Virtual Machine Specification</cite>. "
         "Since JDWP version 1.5."
         (Out
             (referenceType refType "The reference type ID.")
@@ -943,8 +939,8 @@
                     (int modBits "The modifier bit flags (also known as access flags) "
 		                 "which provide additional information on the  "
                                  "method declaration. Individual flag values are "
-				 "defined in the "
- 	                         "<a href=\"http://java.sun.com/docs/books/vmspec/html/ClassFile.doc.html\">VM Specification</a>."
+				 "defined in Chapter 4 of "
+ 	                         "<cite>The Java&trade; Virtual Machine Specification</cite>. "
 				 "In addition, The <code>0xf0000000</code> bit identifies "
 				 "the method as synthetic, if the synthetic attribute "
 				 "<a href=\"#JDWP_VirtualMachine_Capabilities\">capability</a> is available.")
@@ -1006,8 +1002,8 @@
     )
     (Command ConstantPool=18
         "Return the raw bytes of the constant pool in the format of the "
-        "constant_pool item of the Class File Format in the "
-        "Java Virtual Machine Specification. "
+        "constant_pool item of the Class File Format in "
+        "<cite>The Java&trade; Virtual Machine Specification</cite>. "
         "<p>Since JDWP version 1.6. Requires canGetConstantPool capability - see "
 	"<a href=\"#JDWP_VirtualMachine_CapabilitiesNew\">CapabilitiesNew</a>.""
         (Out
@@ -1016,7 +1012,8 @@
         (Reply
             (int count "Total number of constant pool entries plus one. This "
                        "corresponds to the constant_pool_count item of the "
-                       "Class File Format in the Java Virtual Machine Specification. ")
+                       "Class File Format in "
+                       "<cite>The Java&trade; Virtual Machine Specification</cite>. ")
             (Repeat bytes
                 (byte cpbytes "Raw bytes of constant pool")
             )
@@ -1324,7 +1321,8 @@
         )
     )
     (Command Bytecodes=3
-        "Retrieve the method's bytecodes as defined in the JVM Specification."
+        "Retrieve the method's bytecodes as defined in "
+        "<cite>The Java&trade; Virtual Machine Specification</cite>. "
 	"Requires canGetBytecodes capability - see "
 	"<a href=\"#JDWP_VirtualMachine_CapabilitiesNew\">CapabilitiesNew</a>."
         (Out
@@ -1379,9 +1377,8 @@
 	"instance methods, the \"this\" reference is included in the "
 	"table. Also, synthetic variables may be present. "
 	"Generic signatures are described in the signature attribute "
-        "section in the "
-	"<a href=\"http://java.sun.com/docs/books/vmspec\">
-        "Java Virtual Machine Specification, 3rd Edition.</a>  "
+        "section in "
+        "<cite>The Java&trade; Virtual Machine Specification</cite>. "
         "Since JDWP version 1.5."
         (Out
             (referenceType refType "The class.")
@@ -1970,8 +1967,9 @@
 	"<p>"
         "The method which will return early is referred to as the "
         "called method. The called method is the current method (as "
-        "defined by the Frames section in the Java Virtual Machine "
-        "Specification) for the specified thread at the time this command "
+        "defined by the Frames section in "
+        "<cite>The Java&trade; Virtual Machine Specification</cite>) "
+        "for the specified thread at the time this command "
         "is received. "
 	"<p>"
         "The specified thread must be suspended. "
--- a/jdk/make/mksample/Makefile	Mon Apr 25 15:45:49 2011 -0700
+++ b/jdk/make/mksample/Makefile	Wed Jul 05 17:42:16 2017 +0200
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2004, 2010, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2004, 2011, 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
@@ -38,7 +38,7 @@
 endif
 
 SUBDIRS =
-SUBDIRS_misc = nio scripting nbproject
+SUBDIRS_misc = nio scripting nbproject forkjoin
 SUBDIRS_enterprise = $(WEBSERVICES_SUBDIR)
 SUBDIRS_management = jmx
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/make/mksample/forkjoin/Makefile	Wed Jul 05 17:42:16 2017 +0200
@@ -0,0 +1,41 @@
+#
+# Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# This code is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation.  Oracle designates this
+# particular file as subject to the "Classpath" exception as provided
+# by Oracle in the LICENSE file that accompanied this code.
+#
+# This code is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+# version 2 for more details (a copy is included in the LICENSE file that
+# accompanied this code).
+#
+# You should have received a copy of the GNU General Public License version
+# 2 along with this work; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+# or visit www.oracle.com if you need additional information or have any
+# questions.
+#
+
+#
+# Makefile for building all the samples under the forkjoin subdirectory.
+#
+
+BUILDDIR = ../..
+PRODUCT = java
+include $(BUILDDIR)/common/Defs.gmk
+
+SUBDIRS = mergesort
+include $(BUILDDIR)/common/Subdirs.gmk
+
+all build clean clobber::
+	$(SUBDIRS-loop)
+
+clobber clean ::
+	$(RM) -r $(SAMPLEDIR)/forkjoin
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/make/mksample/forkjoin/mergesort/Makefile	Wed Jul 05 17:42:16 2017 +0200
@@ -0,0 +1,51 @@
+#
+# Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# This code is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation.  Oracle designates this
+# particular file as subject to the "Classpath" exception as provided
+# by Oracle in the LICENSE file that accompanied this code.
+#
+# This code is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+# version 2 for more details (a copy is included in the LICENSE file that
+# accompanied this code).
+#
+# You should have received a copy of the GNU General Public License version
+# 2 along with this work; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+# or visit www.oracle.com if you need additional information or have any
+# questions.
+#
+
+#
+# Makefile for the forkjoin/mergesort sample code
+#
+
+BUILDDIR = ../../..
+
+PRODUCT = java
+
+include $(BUILDDIR)/common/Defs.gmk
+
+SAMPLE_SRC_DIR = $(SHARE_SRC)/sample/forkjoin/mergesort
+SAMPLE_DST_DIR = $(SAMPLEDIR)/forkjoin/mergesort
+
+SAMPLE_FILES =							\
+	$(SAMPLE_DST_DIR)/MergeDemo.java			\
+	$(SAMPLE_DST_DIR)/MergeSort.java
+
+all build: $(SAMPLE_FILES)
+
+$(SAMPLE_DST_DIR)/%: $(SAMPLE_SRC_DIR)/%
+	$(install-file)
+
+clean clobber:
+	$(RM) -r $(SAMPLE_DST_DIR)
+
+.PHONY: all build clean clobber
--- a/jdk/make/mksample/nio/Makefile	Mon Apr 25 15:45:49 2011 -0700
+++ b/jdk/make/mksample/nio/Makefile	Wed Jul 05 17:42:16 2017 +0200
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2004, 2010, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2004, 2011, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -31,7 +31,7 @@
 PRODUCT = java
 include $(BUILDDIR)/common/Defs.gmk
 
-SUBDIRS = file multicast server
+SUBDIRS = chatserver file multicast server
 include $(BUILDDIR)/common/Subdirs.gmk
 
 all build clean clobber::
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/make/mksample/nio/chatserver/Makefile	Wed Jul 05 17:42:16 2017 +0200
@@ -0,0 +1,56 @@
+#
+# Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# This code is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation.  Oracle designates this
+# particular file as subject to the "Classpath" exception as provided
+# by Oracle in the LICENSE file that accompanied this code.
+#
+# This code is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+# version 2 for more details (a copy is included in the LICENSE file that
+# accompanied this code).
+#
+# You should have received a copy of the GNU General Public License version
+# 2 along with this work; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+# or visit www.oracle.com if you need additional information or have any
+# questions.
+#
+
+#
+# Makefile for the nio/chatserver sample code
+#
+
+BUILDDIR = ../../..
+
+PRODUCT = java
+
+include $(BUILDDIR)/common/Defs.gmk
+
+SAMPLE_SRC_DIR = $(SHARE_SRC)/sample/nio/chatserver
+SAMPLE_DST_DIR = $(SAMPLEDIR)/nio/chatserver
+
+SAMPLE_FILES =							\
+	$(SAMPLE_DST_DIR)/ChatServer.java			\
+	$(SAMPLE_DST_DIR)/Client.java				\
+	$(SAMPLE_DST_DIR)/ClientReader.java			\
+	$(SAMPLE_DST_DIR)/DataReader.java			\
+	$(SAMPLE_DST_DIR)/MessageReader.java			\
+	$(SAMPLE_DST_DIR)/NameReader.java			\
+	$(SAMPLE_DST_DIR)/README.txt
+
+all build: $(SAMPLE_FILES)
+
+$(SAMPLE_DST_DIR)/%: $(SAMPLE_SRC_DIR)/%
+	$(install-file)
+
+clean clobber:
+	$(RM) -r $(SAMPLE_DST_DIR)
+
+.PHONY: all build clean clobber
--- a/jdk/make/sun/Makefile	Mon Apr 25 15:45:49 2011 -0700
+++ b/jdk/make/sun/Makefile	Wed Jul 05 17:42:16 2017 +0200
@@ -83,6 +83,11 @@
 SUBDIRS_management = management
 SUBDIRS_misc       = $(ORG_SUBDIR) rmi $(JDBC_SUBDIR) tracing
 SUBDIRS_tools      = native2ascii serialver tools jconsole
+
+ifndef OPENJDK
+  SUBDIRS += usagetracker
+endif
+
 include $(BUILDDIR)/common/Subdirs.gmk
 
 all build clean clobber::
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/make/sun/usagetracker/Makefile	Wed Jul 05 17:42:16 2017 +0200
@@ -0,0 +1,40 @@
+#
+# Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# This code is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation.  Oracle designates this
+# particular file as subject to the "Classpath" exception as provided
+# by Oracle in the LICENSE file that accompanied this code.
+#
+# This code is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+# version 2 for more details (a copy is included in the LICENSE file that
+# accompanied this code).
+#
+# You should have received a copy of the GNU General Public License version
+# 2 along with this work; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+# or visit www.oracle.com if you need additional information or have any
+# questions.
+#
+
+BUILDDIR = ../..
+PACKAGE = sun.usagetracker
+PRODUCT = sun
+include $(BUILDDIR)/common/Defs.gmk
+
+#
+# Files
+#
+AUTO_FILES_JAVA_DIRS = sun/usagetracker
+
+#
+# Rules
+#
+include $(BUILDDIR)/common/Classes.gmk
+
--- a/jdk/src/share/bin/jli_util.h	Mon Apr 25 15:45:49 2011 -0700
+++ b/jdk/src/share/bin/jli_util.h	Wed Jul 05 17:42:16 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -35,7 +35,6 @@
 void  JLI_MemFree(void *ptr);
 int   JLI_StrCCmp(const char *s1, const char* s2);
 
-
 #define JLI_StrLen(p1)          strlen((p1))
 #define JLI_StrChr(p1, p2)      strchr((p1), (p2))
 #define JLI_StrRChr(p1, p2)     strrchr((p1), (p2))
@@ -48,6 +47,7 @@
 #define JLI_StrSpn(p1, p2)      strspn((p1), (p2))
 #define JLI_StrCSpn(p1, p2)     strcspn((p1), (p2))
 #define JLI_StrPBrk(p1, p2)     strpbrk((p1), (p2))
+#define JLI_StrTok(p1, p2)      strtok((p1), (p2))
 
 /* On Windows lseek() is in io.h rather than the location dictated by POSIX. */
 #ifdef _WIN32
--- a/jdk/src/share/classes/com/sun/beans/TypeResolver.java	Mon Apr 25 15:45:49 2011 -0700
+++ b/jdk/src/share/classes/com/sun/beans/TypeResolver.java	Wed Jul 05 17:42:16 2017 +0200
@@ -175,8 +175,8 @@
     /**
      * Converts the given {@code type} to the corresponding class.
      * This method implements the concept of type erasure,
-     * that is described in <a href="http://jscstage.sfbay.sun.com/docs/books/jls/third_edition/html/typesValues.html#4.6">section 4.6</a>
-     * of Java Language Specification.
+     * that is described in section 4.6 of
+     * <cite>The Java&trade; Language Specification</cite>.
      *
      * @param type  the array of types to convert
      * @return a corresponding class
--- a/jdk/src/share/classes/com/sun/java/util/jar/pack/package.html	Mon Apr 25 15:45:49 2011 -0700
+++ b/jdk/src/share/classes/com/sun/java/util/jar/pack/package.html	Wed Jul 05 17:42:16 2017 +0200
@@ -88,8 +88,8 @@
 http://java.sun.com/j2se/1.3/docs/guide/jar/jar.html</a></li>
 
 <li>
-Java Virtual Machine Specification : <a href="http://java.sun.com/docs/books/vmspec/2nd-edition/html/ClassFile.doc.html">
-http://java.sun.com/docs/books/vmspec/2nd-edition/html/ClassFile.doc.html</a></li>
+Class File Specification: Chapter 4 of
+<em>The Java&trade; Virtual Machine Specification</em>
 
 <li>
 Hypertext Transfer Protocol -- HTTP/1.1 : <a href="http://www.ietf.org/rfc/rfc2616.txt">
--- a/jdk/src/share/classes/com/sun/jdi/Accessible.java	Mon Apr 25 15:45:49 2011 -0700
+++ b/jdk/src/share/classes/com/sun/jdi/Accessible.java	Wed Jul 05 17:42:16 2017 +0200
@@ -42,12 +42,9 @@
      * Returns the Java<sup><font size=-2>TM</font></sup>
      * programming language modifiers, encoded in an integer.
      * <p>
-     * The modifier encodings are defined in the
-     * <a href="http://java.sun.com/docs/books/vmspec/">Java Virtual Machine
-     * Specification</a>, in the <code>access_flag</code> tables for
-     * <a href="http://java.sun.com/docs/books/vmspec/2nd-edition/html/ClassFile.doc.html#75734">classes</a>,
-     * <a href="http://java.sun.com/docs/books/vmspec/2nd-edition/html/ClassFile.doc.html#88358">fields</a>, and
-     * <a href="http://java.sun.com/docs/books/vmspec/2nd-edition/html/ClassFile.doc.html#75568">methods</a>.
+     * The modifier encodings are defined in
+     * <cite>The Java&trade; Virtual Machine Specification</cite>
+     * in the <code>access_flag</code> tables for classes(section 4.1), fields(section 4.5), and methods(section 4.6).
      */
     public int modifiers();
 
--- a/jdk/src/share/classes/com/sun/jdi/ArrayType.java	Mon Apr 25 15:45:49 2011 -0700
+++ b/jdk/src/share/classes/com/sun/jdi/ArrayType.java	Wed Jul 05 17:42:16 2017 +0200
@@ -77,11 +77,9 @@
      * as specified in the array declaration.
      * <P>
      * Note: The component type of a array will always be
-     * created or loaded before the array - see the
-     * <a href="http://java.sun.com/docs/books/vmspec/">Java Virtual
-     * Machine Specification</a>, section
-     * <a href="http://java.sun.com/docs/books/vmspec/2nd-edition/html/ConstantPool.doc.html#79473">5.3.3
-     * Creating Array Classes</a>.
+     * created or loaded before the array - see
+     * <cite>The Java&trade; Virtual Machine Specification</cite>,
+     * section 5.3.3 - Creating Array Classes.
      * However, although the component type will be loaded it may
      * not yet be prepared, in which case the type will be returned
      * but attempts to perform some operations on the returned type
--- a/jdk/src/share/classes/com/sun/jdi/ClassLoaderReference.java	Mon Apr 25 15:45:49 2011 -0700
+++ b/jdk/src/share/classes/com/sun/jdi/ClassLoaderReference.java	Wed Jul 05 17:42:16 2017 +0200
@@ -71,11 +71,9 @@
      * <p>
      * No ordering of the returned list is guaranteed.
      * <p>
-     * See the revised
-     * <a href="http://java.sun.com/docs/books/vmspec/">Java
-     * Virtual Machine Specification</a> section
-     * <a href="http://java.sun.com/docs/books/vmspec/2nd-edition/html/ConstantPool.doc.html#72007">5.3
-     * Creation and Loading</a>
+     * See
+     * <cite>The Java&trade; Virtual Machine Specification</cite>,
+     * section 5.3 - Creation and Loading
      * for more information on the initiating classloader.
      * <p>
      * Note that unlike {@link #definedClasses()}
--- a/jdk/src/share/classes/com/sun/jdi/ClassNotLoadedException.java	Mon Apr 25 15:45:49 2011 -0700
+++ b/jdk/src/share/classes/com/sun/jdi/ClassNotLoadedException.java	Wed Jul 05 17:42:16 2017 +0200
@@ -60,9 +60,9 @@
  * is visible to the class loader of enclosing class. (That is, the
  * class loader of the enclosing class must be an <i>initiating</i> class
  * loader for the class in question.)
- * See the <a href="http://java.sun.com/docs/books/vmspec/">Java
- * Virtual Machine Specification</a> for
- * more details.
+ * See
+ * <cite>The Java&trade; Virtual Machine Specification</cite>
+ * for more details.
  *
  * @author Gordon Hirsch
  * @since  1.3
--- a/jdk/src/share/classes/com/sun/jdi/ClassType.java	Mon Apr 25 15:45:49 2011 -0700
+++ b/jdk/src/share/classes/com/sun/jdi/ClassType.java	Wed Jul 05 17:42:16 2017 +0200
@@ -164,10 +164,8 @@
      * component type is passed.  The component type can be a primitive type.
      * Autoboxing is not supported.
      *
-     * See the <a href="http://java.sun.com/docs/books/jls/">
-     * Java Language Specification</a>.
-     * section
-     * <a href="http://java.sun.com/docs/books/jls/second_edition/html/conversions.doc.html#184206">5.2</a>
+     * See Section 5.2 of
+     * <cite>The Java&trade; Language Specification</cite>
      * for more information on assignment compatibility.
      * <p>
      * By default, all threads in the target VM are resumed while
@@ -280,10 +278,8 @@
      * component type is passed.  The component type can be a primitive type.
      * Autoboxing is not supported.
      *
-     * See the <a href="http://java.sun.com/docs/books/jls/">
-     * Java Language Specification</a>.
-     * section
-     * <a href="http://java.sun.com/docs/books/jls/second_edition/html/conversions.doc.html#184206">5.2</a>
+     * See section 5.2 of
+     * <cite>The Java&trade; Language Specification</cite>
      * for more information on assignment compatibility.
      * <p>
      * By default, all threads in the target VM are resumed while
--- a/jdk/src/share/classes/com/sun/jdi/LocalVariable.java	Mon Apr 25 15:45:49 2011 -0700
+++ b/jdk/src/share/classes/com/sun/jdi/LocalVariable.java	Wed Jul 05 17:42:16 2017 +0200
@@ -102,9 +102,7 @@
     /**
      * Gets the generic signature for this variable if there is one.
      * Generic signatures are described in the
-     * <a href="http://java.sun.com/docs/books/vmspec">
-     * "Java<sup><font size=-2>TM</font></sup>
-     * Virtual Machine Specification, 3rd Edition.</a>
+     * <cite>The Java&trade; Virtual Machine Specification</cite>.
      *
      * @return a string containing the generic signature, or <code>null</code>
      * if there is no generic signature.
--- a/jdk/src/share/classes/com/sun/jdi/Method.java	Mon Apr 25 15:45:49 2011 -0700
+++ b/jdk/src/share/classes/com/sun/jdi/Method.java	Wed Jul 05 17:42:16 2017 +0200
@@ -164,10 +164,8 @@
 
     /**
      * Determine if this method is a bridge method. Bridge
-     * methods are defined in the
-     * <a href="http://java.sun.com/docs/books/jls">
-     * "Java<sup><font size=-2>TM</font></sup>
-     * Language Specification, 3rd Edition.</a>
+     * methods are defined in
+     * <cite>The Java&trade; Language Specification</cite>.
      *
      * @return <code>true</code> if the method is a bridge method,
      * false otherwise.
--- a/jdk/src/share/classes/com/sun/jdi/ObjectReference.java	Mon Apr 25 15:45:49 2011 -0700
+++ b/jdk/src/share/classes/com/sun/jdi/ObjectReference.java	Wed Jul 05 17:42:16 2017 +0200
@@ -118,10 +118,8 @@
      * enclosing class's class loader). Primitive values must be
      * either assignment compatible with the field type or must be
      * convertible to the field type without loss of information.
-     * See the <a href="http://java.sun.com/docs/books/jls/">
-     * Java<sup><font size=-2>TM</font></sup> Language Specification</a>.
-     * section
-     * <a href="http://java.sun.com/docs/books/jls/second_edition/html/conversions.doc.html#184206">5.2</a>
+     * See section 5.2 of
+     * <cite>The Java&trade; Language Specification</cite>
      * for more information on assignment
      * compatibility.
      *
@@ -182,18 +180,13 @@
      * component type is passed.  The component type can be a primitive type.
      * Autoboxing is not supported.
      *
-     * See the <a href="http://java.sun.com/docs/books/jls/">
-     * Java Language Specification</a>.
-     * section
-     * <a href="http://java.sun.com/docs/books/jls/second_edition/html/conversions.doc.html#184206">5.2</a>
+     * See section 5.2 of
+     * <cite>The Java&trade; Language Specification</cite>
      * for more information on assignment compatibility.
      * <p>
      * By default, the method is invoked using dynamic lookup as
-     * documented in the
-     * <a href="http://java.sun.com/docs/books/jls/">
-     * Java Language Specification</a>
-     * second edition, section
-     * <a href="http://java.sun.com/docs/books/jls/second_edition/html/expressions.doc.html#45606">15.12.4.4</a>;
+     * documented in section 15.12.4.4 of
+     * <cite>The Java&trade; Language Specification</cite>
      * in particular, overriding based on the runtime type of the object
      * mirrored by this {@link ObjectReference} will occur. This
      * behavior can be changed by specifying the
--- a/jdk/src/share/classes/com/sun/jdi/ReferenceType.java	Mon Apr 25 15:45:49 2011 -0700
+++ b/jdk/src/share/classes/com/sun/jdi/ReferenceType.java	Wed Jul 05 17:42:16 2017 +0200
@@ -30,9 +30,8 @@
 
 /**
  * The type of an object in a target VM. ReferenceType encompasses
- * classes, interfaces, and array types as defined in the
- * <a href="http://java.sun.com/docs/books/jls/">
- * Java<sup><font size=-2>TM</font></sup> Language Specification</a>.
+ * classes, interfaces, and array types as defined in
+ * <cite>The Java&trade; Language Specification</cite>.
  * All ReferenceType objects belong to one of the following
  * subinterfaces:
  * {@link ClassType} for classes,
@@ -98,9 +97,7 @@
     /**
      * Gets the generic signature for this type if there is one.
      * Generic signatures are described in the
-     * <a href="http://java.sun.com/docs/books/vmspec">
-     * "Java<sup><font size=-2>TM</font></sup>
-     * Virtual Machine Specification, 3rd Edition.</a>
+     * <cite>The Java&trade; Virtual Machine Specification</cite>.
      *
      * @return a string containing the generic signature, or <code>null</code>
      * if there is no generic signature.
--- a/jdk/src/share/classes/com/sun/jdi/TypeComponent.java	Mon Apr 25 15:45:49 2011 -0700
+++ b/jdk/src/share/classes/com/sun/jdi/TypeComponent.java	Wed Jul 05 17:42:16 2017 +0200
@@ -74,9 +74,7 @@
     /**
      * Gets the generic signature for this TypeComponent if there is one.
      * Generic signatures are described in the
-     * <a href="http://java.sun.com/docs/books/vmspec">
-     * "Java<sup><font size=-2>TM</font></sup>
-     * Virtual Machine Specification, 3rd Edition.</a>
+     * <cite>The Java&trade; Virtual Machine Specification</cite>.
      *
      * @return a string containing the generic signature, or <code>null</code>
      * if there is no generic signature.
--- a/jdk/src/share/classes/com/sun/media/sound/DLSInstrument.java	Mon Apr 25 15:45:49 2011 -0700
+++ b/jdk/src/share/classes/com/sun/media/sound/DLSInstrument.java	Wed Jul 05 17:42:16 2017 +0200
@@ -25,6 +25,7 @@
 package com.sun.media.sound;
 
 import java.util.ArrayList;
+import java.util.Arrays;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
@@ -439,10 +440,10 @@
     }
 
     public byte[] getGuid() {
-        return guid;
+        return guid == null ? null : Arrays.copyOf(guid, guid.length);
     }
 
     public void setGuid(byte[] guid) {
-        this.guid = guid;
+        this.guid = guid == null ? null : Arrays.copyOf(guid, guid.length);
     }
 }
--- a/jdk/src/share/classes/com/sun/media/sound/DLSSample.java	Mon Apr 25 15:45:49 2011 -0700
+++ b/jdk/src/share/classes/com/sun/media/sound/DLSSample.java	Wed Jul 05 17:42:16 2017 +0200
@@ -25,6 +25,7 @@
 package com.sun.media.sound;
 
 import java.io.InputStream;
+import java.util.Arrays;
 import javax.sound.midi.Soundbank;
 import javax.sound.midi.SoundbankResource;
 import javax.sound.sampled.AudioFormat;
@@ -113,10 +114,10 @@
     }
 
     public byte[] getGuid() {
-        return guid;
+        return guid == null ? null : Arrays.copyOf(guid, guid.length);
     }
 
     public void setGuid(byte[] guid) {
-        this.guid = guid;
+        this.guid = guid == null ? null : Arrays.copyOf(guid, guid.length);
     }
 }
--- a/jdk/src/share/classes/com/sun/media/sound/ModelConnectionBlock.java	Mon Apr 25 15:45:49 2011 -0700
+++ b/jdk/src/share/classes/com/sun/media/sound/ModelConnectionBlock.java	Wed Jul 05 17:42:16 2017 +0200
@@ -24,6 +24,8 @@
  */
 package com.sun.media.sound;
 
+import java.util.Arrays;
+
 /**
  * Connection blocks are used to connect source variable
  * to a destination variable.
@@ -117,19 +119,17 @@
     }
 
     public ModelSource[] getSources() {
-        return sources;
+        return Arrays.copyOf(sources, sources.length);
     }
 
     public void setSources(ModelSource[] source) {
-        this.sources = source;
+        this.sources = source == null ? no_sources : Arrays.copyOf(source, source.length);
     }
 
     public void addSource(ModelSource source) {
         ModelSource[] oldsources = sources;
         sources = new ModelSource[oldsources.length + 1];
-        for (int i = 0; i < oldsources.length; i++) {
-            sources[i] = oldsources[i];
-        }
+        System.arraycopy(oldsources, 0, sources, 0, oldsources.length);
         sources[sources.length - 1] = source;
     }
 }
--- a/jdk/src/share/classes/com/sun/media/sound/SoftChannel.java	Mon Apr 25 15:45:49 2011 -0700
+++ b/jdk/src/share/classes/com/sun/media/sound/SoftChannel.java	Wed Jul 05 17:42:16 2017 +0200
@@ -503,7 +503,7 @@
             firstVoice = true;
             voiceNo = 0;
 
-            int tunedKey = (int)(Math.round(tuning.getTuning()[noteNumber]/100.0));
+            int tunedKey = (int)(Math.round(tuning.getTuning(noteNumber)/100.0));
             play_noteNumber = noteNumber;
             play_velocity = velocity;
             play_delay = delay;
@@ -607,7 +607,7 @@
             firstVoice = true;
             voiceNo = 0;
 
-            int tunedKey = (int)(Math.round(tuning.getTuning()[noteNumber]/100.0));
+            int tunedKey = (int)(Math.round(tuning.getTuning(noteNumber)/100.0));
             play_noteNumber = noteNumber;
             play_velocity = lastVelocity[noteNumber];
             play_releasetriggered = true;
@@ -632,7 +632,7 @@
         int delay = play_delay;
         boolean releasetriggered = play_releasetriggered;
 
-        SoftPerformer p = current_instrument.getPerformers()[performerIndex];
+        SoftPerformer p = current_instrument.getPerformer(performerIndex);
 
         if (firstVoice) {
             firstVoice = false;
--- a/jdk/src/share/classes/com/sun/media/sound/SoftInstrument.java	Mon Apr 25 15:45:49 2011 -0700
+++ b/jdk/src/share/classes/com/sun/media/sound/SoftInstrument.java	Wed Jul 05 17:42:16 2017 +0200
@@ -76,7 +76,12 @@
         return data;
     }
 
+    /* am: currently getPerformers() is not used (replaced with getPerformer(int))
     public SoftPerformer[] getPerformers() {
         return performers;
     }
+    */
+    public SoftPerformer getPerformer(int index) {
+        return performers[index];
+    }
 }
--- a/jdk/src/share/classes/com/sun/media/sound/SoftMixingDataLine.java	Mon Apr 25 15:45:49 2011 -0700
+++ b/jdk/src/share/classes/com/sun/media/sound/SoftMixingDataLine.java	Wed Jul 05 17:42:16 2017 +0200
@@ -505,7 +505,7 @@
     }
 
     public Control[] getControls() {
-        return controls;
+        return Arrays.copyOf(controls, controls.length);
     }
 
     public boolean isControlSupported(Type control) {
--- a/jdk/src/share/classes/com/sun/media/sound/SoftProvider.java	Mon Apr 25 15:45:49 2011 -0700
+++ b/jdk/src/share/classes/com/sun/media/sound/SoftProvider.java	Wed Jul 05 17:42:16 2017 +0200
@@ -24,6 +24,7 @@
  */
 package com.sun.media.sound;
 
+import java.util.Arrays;
 import javax.sound.midi.MidiDevice;
 import javax.sound.midi.MidiDevice.Info;
 import javax.sound.midi.spi.MidiDeviceProvider;
@@ -39,7 +40,7 @@
     private static Info[] softinfos = {softinfo};
 
     public MidiDevice.Info[] getDeviceInfo() {
-        return softinfos;
+        return Arrays.copyOf(softinfos, softinfos.length);
     }
 
     public MidiDevice getDevice(MidiDevice.Info info) {
--- a/jdk/src/share/classes/com/sun/media/sound/SoftTuning.java	Mon Apr 25 15:45:49 2011 -0700
+++ b/jdk/src/share/classes/com/sun/media/sound/SoftTuning.java	Wed Jul 05 17:42:16 2017 +0200
@@ -25,6 +25,7 @@
 package com.sun.media.sound;
 
 import java.io.UnsupportedEncodingException;
+import java.util.Arrays;
 
 import javax.sound.midi.Patch;
 
@@ -234,8 +235,10 @@
         }
     }
 
+    // am: getTuning(int) is more effective.
+    // currently getTuning() is used only by tests
     public double[] getTuning() {
-        return tuning;
+        return Arrays.copyOf(tuning, tuning.length);
     }
 
     public double getTuning(int noteNumber) {
--- a/jdk/src/share/classes/com/sun/rowset/CachedRowSetImpl.java	Mon Apr 25 15:45:49 2011 -0700
+++ b/jdk/src/share/classes/com/sun/rowset/CachedRowSetImpl.java	Wed Jul 05 17:42:16 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2011, 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
@@ -111,13 +111,13 @@
      */
     private String tableName;
 
-
     /**
      * A <code>Vector</code> object containing the <code>Row</code>
      * objects that comprise  this <code>CachedRowSetImpl</code> object.
      * @serial
      */
-    private Vector rvh;
+    private Vector<Object> rvh;
+
     /**
      * The current postion of the cursor in this <code>CachedRowSetImpl</code>
      * object.
@@ -293,12 +293,12 @@
     /**
      * The Vector holding the Match Columns
      */
-       private Vector iMatchColumns;
+    private Vector<Integer> iMatchColumns;
 
     /**
      * The Vector that will hold the Match Column names.
      */
-       private Vector strMatchColumns;
+    private Vector<String> strMatchColumns;
 
     /**
      * Trigger that indicates whether the active SyncProvider is exposes the
@@ -484,7 +484,7 @@
      */
     private void initContainer() {
 
-        rvh = new Vector(100);
+        rvh = new Vector<Object>(100);
         cursorPos = 0;
         absolutePos = 0;
         numRows = 0;
@@ -523,12 +523,12 @@
 
         //Instantiating the vector for MatchColumns
 
-        iMatchColumns = new Vector(10);
+        iMatchColumns = new Vector<Integer>(10);
         for(int i = 0; i < 10 ; i++) {
            iMatchColumns.add(i,Integer.valueOf(-1));
         }
 
-        strMatchColumns = new Vector(10);
+        strMatchColumns = new Vector<String>(10);
         for(int j = 0; j < 10; j++) {
            strMatchColumns.add(j,null);
         }
@@ -622,7 +622,7 @@
         Row currentRow;
         int numCols;
         int i;
-        Map map = getTypeMap();
+        Map<String, Class<?>> map = getTypeMap();
         Object obj;
         int mRows;
 
@@ -939,14 +939,9 @@
      */
     public void acceptChanges(Connection con) throws SyncProviderException{
 
-      try{
-         setConnection(con);
-         acceptChanges();
-      } catch (SyncProviderException spe) {
-          throw spe;
-      } catch(SQLException sqle){
-          throw new SyncProviderException(sqle.getMessage());
-      }
+      setConnection(con);
+      acceptChanges();
+
     }
 
     /**
@@ -1289,14 +1284,7 @@
      */
     public Collection<?> toCollection() throws SQLException {
 
-        TreeMap tMap;
-        int count = 0;
-        Row origRow;
-        Vector newRow;
-
-        int colCount = ((RowSetMetaDataImpl)this.getMetaData()).getColumnCount();
-
-        tMap = new TreeMap();
+        TreeMap<Integer, Object> tMap = new TreeMap<>();
 
         for (int i = 0; i<numRows; i++) {
             tMap.put(Integer.valueOf(i), rvh.get(i));
@@ -1325,10 +1313,8 @@
      */
     public Collection<?> toCollection(int column) throws SQLException {
 
-        Vector vec;
-        Row origRow;
         int nRows = numRows;
-        vec = new Vector(nRows);
+        Vector<Object> vec = new Vector<>(nRows);
 
         // create a copy
         CachedRowSetImpl crsTemp;
@@ -2953,7 +2939,7 @@
      */
     public Object getObject(int columnIndex) throws SQLException {
         Object value;
-        java.util.Map map;
+        Map<String, Class<?>> map;
 
         // sanity check.
         checkIndex(columnIndex);
@@ -7257,7 +7243,7 @@
         Row currentRow;
         int numCols;
         int i;
-        Map map = getTypeMap();
+        Map<String, Class<?>> map = getTypeMap();
         Object obj;
         int mRows;
 
@@ -7304,11 +7290,11 @@
             resultSet.absolute(start -1);
         }
         if( pageSize == 0) {
-           rvh = new Vector(getMaxRows());
+           rvh = new Vector<Object>(getMaxRows());
 
         }
         else{
-            rvh = new Vector(getPageSize());
+            rvh = new Vector<Object>(getPageSize());
         }
 
         if (data == null) {
--- a/jdk/src/share/classes/com/sun/rowset/JdbcRowSetImpl.java	Mon Apr 25 15:45:49 2011 -0700
+++ b/jdk/src/share/classes/com/sun/rowset/JdbcRowSetImpl.java	Wed Jul 05 17:42:16 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2011, 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
@@ -93,12 +93,12 @@
     /**
      * The Vector holding the Match Columns
      */
-    private Vector iMatchColumns;
+    private Vector<Integer> iMatchColumns;
 
     /**
      * The Vector that will hold the Match Column names.
      */
-    private Vector strMatchColumns;
+    private Vector<String> strMatchColumns;
 
 
     protected transient JdbcRowSetResourceBundle resBundle;
@@ -213,12 +213,12 @@
 
         //Instantiating the vector for MatchColumns
 
-        iMatchColumns = new Vector(10);
+        iMatchColumns = new Vector<Integer>(10);
         for(int i = 0; i < 10 ; i++) {
            iMatchColumns.add(i,Integer.valueOf(-1));
         }
 
-        strMatchColumns = new Vector(10);
+        strMatchColumns = new Vector<String>(10);
         for(int j = 0; j < 10; j++) {
            strMatchColumns.add(j,null);
         }
@@ -286,12 +286,12 @@
 
         //Instantiating the vector for MatchColumns
 
-        iMatchColumns = new Vector(10);
+        iMatchColumns = new Vector<Integer>(10);
         for(int i = 0; i < 10 ; i++) {
            iMatchColumns.add(i,Integer.valueOf(-1));
         }
 
-        strMatchColumns = new Vector(10);
+        strMatchColumns = new Vector<String>(10);
         for(int j = 0; j < 10; j++) {
            strMatchColumns.add(j,null);
         }
@@ -373,12 +373,12 @@
 
         //Instantiating the vector for MatchColumns
 
-        iMatchColumns = new Vector(10);
+        iMatchColumns = new Vector<Integer>(10);
         for(int i = 0; i < 10 ; i++) {
            iMatchColumns.add(i,Integer.valueOf(-1));
         }
 
-        strMatchColumns = new Vector(10);
+        strMatchColumns = new Vector<String>(10);
         for(int j = 0; j < 10; j++) {
            strMatchColumns.add(j,null);
         }
@@ -463,12 +463,12 @@
 
         //Instantiating the vector for MatchColumns
 
-        iMatchColumns = new Vector(10);
+        iMatchColumns = new Vector<Integer>(10);
         for(int i = 0; i < 10 ; i++) {
            iMatchColumns.add(i,Integer.valueOf(-1));
         }
 
-        strMatchColumns = new Vector(10);
+        strMatchColumns = new Vector<String>(10);
         for(int j = 0; j < 10; j++) {
            strMatchColumns.add(j,null);
         }
@@ -675,7 +675,7 @@
 
         try {
 
-            Map aMap = getTypeMap();
+            Map<String, Class<?>> aMap = getTypeMap();
             if( aMap != null) {
                 conn.setTypeMap(aMap);
             }
--- a/jdk/src/share/classes/com/sun/rowset/JoinRowSetImpl.java	Mon Apr 25 15:45:49 2011 -0700
+++ b/jdk/src/share/classes/com/sun/rowset/JoinRowSetImpl.java	Wed Jul 05 17:42:16 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2011, 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
@@ -59,8 +59,8 @@
     /**
      * A <code>Vector</code> object that contains the <code>RowSet</code> objects
      * that have been added to this <code>JoinRowSet</code> object.
-         */
-    private Vector vecRowSetsInJOIN;
+     */
+    private Vector<CachedRowSetImpl> vecRowSetsInJOIN;
 
     /**
      * The <code>CachedRowSet</code> object that encapsulates this
@@ -78,13 +78,13 @@
      * for this <code>JoinRowSet</code> object.
      * The last join type set forms the basis of succeeding joins.
      */
-    private Vector vecJoinType;
+    private Vector<Integer> vecJoinType;
 
     /**
      * A <code>Vector</code> object containing the names of all the tables entering
      * the join.
      */
-    private Vector vecTableNames;
+    private Vector<String> vecTableNames;
 
     /**
      * An <code>int</code> that indicates the column index of the match column.
@@ -121,10 +121,10 @@
      */
     public JoinRowSetImpl() throws SQLException {
 
-        vecRowSetsInJOIN = new Vector();
+        vecRowSetsInJOIN = new Vector<CachedRowSetImpl>();
         crsInternal = new CachedRowSetImpl();
-        vecJoinType = new Vector();
-        vecTableNames = new Vector();
+        vecJoinType = new Vector<Integer>();
+        vecTableNames = new Vector<String>();
         iMatchKey = -1;
         strMatchKey = null;
         supportedJOINs =
@@ -222,7 +222,7 @@
            // either of the setter methods have been set.
            if(boolColId){
               //
-              ArrayList indices = new ArrayList();
+              ArrayList<Integer> indices = new ArrayList<>();
               for(int i=0;i<cRowset.getMatchColumnNames().length;i++) {
                   if( (strMatchKey = (cRowset.getMatchColumnNames())[i]) != null) {
                       iMatchKey = cRowset.findColumn(strMatchKey);
--- a/jdk/src/share/classes/java/awt/Dialog.java	Mon Apr 25 15:45:49 2011 -0700
+++ b/jdk/src/share/classes/java/awt/Dialog.java	Wed Jul 05 17:42:16 2017 +0200
@@ -903,7 +903,7 @@
             if (peer == null) {
                 addNotify();
             }
-            validate();
+            validateUnconditionally();
             if (visible) {
                 toFront();
                 retval = false;
--- a/jdk/src/share/classes/java/awt/GraphicsDevice.java	Mon Apr 25 15:45:49 2011 -0700
+++ b/jdk/src/share/classes/java/awt/GraphicsDevice.java	Wed Jul 05 17:42:16 2017 +0200
@@ -243,8 +243,10 @@
      * a non-client of the input method framework.
      * </ul>
      * <p>
-     * Simulated full-screen mode resizes
-     * the window to the size of the screen and positions it at (0,0).
+     * The simulated full-screen mode places and resizes the window to the maximum
+     * possible visible area of the screen. However, the native windowing system
+     * may modify the requested geometry-related data, so that the {@code Window} object
+     * is placed and sized in a way that corresponds closely to the desktop settings.
      * <p>
      * When entering full-screen mode, if the window to be used as a
      * full-screen window is not visible, this method will make it visible.
--- a/jdk/src/share/classes/java/awt/Toolkit.java	Mon Apr 25 15:45:49 2011 -0700
+++ b/jdk/src/share/classes/java/awt/Toolkit.java	Wed Jul 05 17:42:16 2017 +0200
@@ -466,6 +466,10 @@
      */
     protected void loadSystemColors(int[] systemColors)
         throws HeadlessException {
+        if (GraphicsEnvironment.isHeadless()){
+            throw new HeadlessException();
+        }
+
     }
 
 /**
@@ -500,6 +504,10 @@
      */
     public void setDynamicLayout(boolean dynamic)
         throws HeadlessException {
+        if (GraphicsEnvironment.isHeadless()){
+            throw new HeadlessException();
+        }
+
     }
 
     /**
@@ -523,6 +531,9 @@
      */
     protected boolean isDynamicLayoutSet()
         throws HeadlessException {
+        if (GraphicsEnvironment.isHeadless()){
+            throw new HeadlessException();
+        }
         if (this != Toolkit.getDefaultToolkit()) {
             return Toolkit.getDefaultToolkit().isDynamicLayoutSet();
         } else {
@@ -558,6 +569,9 @@
      */
     public boolean isDynamicLayoutActive()
         throws HeadlessException {
+        if (GraphicsEnvironment.isHeadless()){
+            throw new HeadlessException();
+        }
         if (this != Toolkit.getDefaultToolkit()) {
             return Toolkit.getDefaultToolkit().isDynamicLayoutActive();
         } else {
@@ -601,6 +615,9 @@
      */
     public Insets getScreenInsets(GraphicsConfiguration gc)
         throws HeadlessException {
+        if (GraphicsEnvironment.isHeadless()){
+            throw new HeadlessException();
+        }
         if (this != Toolkit.getDefaultToolkit()) {
             return Toolkit.getDefaultToolkit().getScreenInsets(gc);
         } else {
@@ -1342,6 +1359,9 @@
      * @since 1.4
      */
     public Clipboard getSystemSelection() throws HeadlessException {
+        if (GraphicsEnvironment.isHeadless()){
+            throw new HeadlessException();
+        }
         if (this != Toolkit.getDefaultToolkit()) {
             return Toolkit.getDefaultToolkit().getSystemSelection();
         } else {
@@ -1371,6 +1391,10 @@
      * @since     JDK1.1
      */
     public int getMenuShortcutKeyMask() throws HeadlessException {
+        if (GraphicsEnvironment.isHeadless()){
+            throw new HeadlessException();
+        }
+
         return Event.CTRL_MASK;
     }
 
@@ -1499,6 +1523,9 @@
      */
     public Dimension getBestCursorSize(int preferredWidth,
         int preferredHeight) throws HeadlessException {
+        if (GraphicsEnvironment.isHeadless()){
+            throw new HeadlessException();
+        }
         // Override to implement custom cursor support.
         if (this != Toolkit.getDefaultToolkit()) {
             return Toolkit.getDefaultToolkit().
@@ -1526,6 +1553,9 @@
      * @since     1.2
      */
     public int getMaximumCursorColors() throws HeadlessException {
+        if (GraphicsEnvironment.isHeadless()){
+            throw new HeadlessException();
+        }
         // Override to implement custom cursor support.
         if (this != Toolkit.getDefaultToolkit()) {
             return Toolkit.getDefaultToolkit().getMaximumCursorColors();
@@ -2561,8 +2591,6 @@
     * initialized with {@code true}.
     * Changing this value after the {@code Toolkit} class initialization will have no effect.
     * <p>
-    * The current value could be queried by using the
-    * {@code System.getProperty("sun.awt.enableExtraMouseButtons")} method.
     * @exception HeadlessException if GraphicsEnvironment.isHeadless() returns true
     * @return {@code true} if events from extra mouse buttons are allowed to be processed and posted;
     *         {@code false} otherwise
@@ -2572,6 +2600,9 @@
     * @since 1.7
      */
     public boolean areExtraMouseButtonsEnabled() throws HeadlessException {
+        if (GraphicsEnvironment.isHeadless()){
+            throw new HeadlessException();
+        }
         return Toolkit.getDefaultToolkit().areExtraMouseButtonsEnabled();
     }
 }
--- a/jdk/src/share/classes/java/awt/Window.java	Mon Apr 25 15:45:49 2011 -0700
+++ b/jdk/src/share/classes/java/awt/Window.java	Wed Jul 05 17:42:16 2017 +0200
@@ -870,6 +870,11 @@
      * are automatically enlarged if either is less than
      * the minimum size as specified by previous call to
      * {@code setMinimumSize}.
+     * <p>
+     * The method changes the geometry-related data. Therefore,
+     * the native windowing system may ignore such requests, or it may modify
+     * the requested data, so that the {@code Window} object is placed and sized
+     * in a way that corresponds closely to the desktop settings.
      *
      * @see #getSize
      * @see #setBounds
@@ -887,6 +892,11 @@
      * are automatically enlarged if either is less than
      * the minimum size as specified by previous call to
      * {@code setMinimumSize}.
+     * <p>
+     * The method changes the geometry-related data. Therefore,
+     * the native windowing system may ignore such requests, or it may modify
+     * the requested data, so that the {@code Window} object is placed and sized
+     * in a way that corresponds closely to the desktop settings.
      *
      * @see #getSize
      * @see #setBounds
@@ -898,6 +908,32 @@
     }
 
     /**
+     * {@inheritDoc}
+     * <p>
+     * The method changes the geometry-related data. Therefore,
+     * the native windowing system may ignore such requests, or it may modify
+     * the requested data, so that the {@code Window} object is placed and sized
+     * in a way that corresponds closely to the desktop settings.
+     */
+    @Override
+    public void setLocation(int x, int y) {
+        super.setLocation(x, y);
+    }
+
+    /**
+     * {@inheritDoc}
+     * <p>
+     * The method changes the geometry-related data. Therefore,
+     * the native windowing system may ignore such requests, or it may modify
+     * the requested data, so that the {@code Window} object is placed and sized
+     * in a way that corresponds closely to the desktop settings.
+     */
+    @Override
+    public void setLocation(Point p) {
+        super.setLocation(p);
+    }
+
+    /**
      * @deprecated As of JDK version 1.1,
      * replaced by <code>setBounds(int, int, int, int)</code>.
      */
@@ -3147,6 +3183,11 @@
      * placed at the left side of the screen. The similar placement
      * will occur if both top and bottom edges are out of the screen.
      * In that case, the window is placed at the top side of the screen.
+     * <p>
+     * The method changes the geometry-related data. Therefore,
+     * the native windowing system may ignore such requests, or it may modify
+     * the requested data, so that the {@code Window} object is placed and sized
+     * in a way that corresponds closely to the desktop settings.
      *
      * @param c  the component in relation to which the window's location
      *           is determined
@@ -3395,6 +3436,11 @@
      * are automatically enlarged if either is less than
      * the minimum size as specified by previous call to
      * {@code setMinimumSize}.
+     * <p>
+     * The method changes the geometry-related data. Therefore,
+     * the native windowing system may ignore such requests, or it may modify
+     * the requested data, so that the {@code Window} object is placed and sized
+     * in a way that corresponds closely to the desktop settings.
      *
      * @see #getBounds
      * @see #setLocation(int, int)
@@ -3424,6 +3470,11 @@
      * will be automatically enlarged if either is less than
      * the minimum size as specified by previous call to
      * {@code setMinimumSize}.
+     * <p>
+     * The method changes the geometry-related data. Therefore,
+     * the native windowing system may ignore such requests, or it may modify
+     * the requested data, so that the {@code Window} object is placed and sized
+     * in a way that corresponds closely to the desktop settings.
      *
      * @see #getBounds
      * @see #setLocation(int, int)
--- a/jdk/src/share/classes/java/awt/doc-files/AWTThreadIssues.html	Mon Apr 25 15:45:49 2011 -0700
+++ b/jdk/src/share/classes/java/awt/doc-files/AWTThreadIssues.html	Wed Jul 05 17:42:16 2017 +0200
@@ -40,10 +40,9 @@
 <a name="Autoshutdown"></a>
 <h2>Auto-shutdown</h2>
 
-According to <a href="http://java.sun.com/docs/books/vmspec/2nd-edition/html/VMSpecTOC.doc.html"><i>The 
-Java</i><sup><small>TM</small></sup> <i>Virtual Machine Specification,
-Second edition</i></a> (see <a href="http://java.sun.com/docs/books/vmspec/2nd-edition/html/Concepts.doc.html#19152">2.17.9</a>
-and <a href="http://java.sun.com/docs/books/vmspec/2nd-edition/html/Concepts.doc.html#33308">2.19</a>),
+According to
+<cite>The Java&trade; Virtual Machine Specification</cite>,
+sections 2.17.9 and 2.19,
 the Java virtual machine (JVM) initially starts up with a single non-daemon
 thread, which typically calls the <code>main</code> method of some class.
 The virtual machine terminates all its activity and exits when
@@ -183,7 +182,8 @@
         <...>
 </pre>
 
-The Java Virtual Machine Specification guarantees
+<cite>The Java&trade; Virtual Machine Specification</cite>
+ guarantees
 that the JVM doesn't exit until this thread terminates.
 </body>
 </html>
--- a/jdk/src/share/classes/java/io/Console.java	Mon Apr 25 15:45:49 2011 -0700
+++ b/jdk/src/share/classes/java/io/Console.java	Wed Jul 05 17:42:16 2017 +0200
@@ -148,8 +148,8 @@
     *         extra arguments are ignored.  The number of arguments is
     *         variable and may be zero.  The maximum number of arguments is
     *         limited by the maximum dimension of a Java array as defined by
-    *         the <a href="http://java.sun.com/docs/books/vmspec/">Java
-    *         Virtual Machine Specification</a>.  The behaviour on a
+    *         <cite>The Java&trade; Virtual Machine Specification</cite>.
+    *         The behaviour on a
     *         <tt>null</tt> argument depends on the <a
     *         href="../util/Formatter.html#syntax">conversion</a>.
     *
@@ -187,8 +187,8 @@
     *         extra arguments are ignored.  The number of arguments is
     *         variable and may be zero.  The maximum number of arguments is
     *         limited by the maximum dimension of a Java array as defined by
-    *         the <a href="http://java.sun.com/docs/books/vmspec/">Java
-    *         Virtual Machine Specification</a>.  The behaviour on a
+    *         <cite>The Java&trade; Virtual Machine Specification</cite>.
+    *         The behaviour on a
     *         <tt>null</tt> argument depends on the <a
     *         href="../util/Formatter.html#syntax">conversion</a>.
     *
@@ -220,8 +220,7 @@
     *         string.  If there are more arguments than format specifiers, the
     *         extra arguments are ignored.  The maximum number of arguments is
     *         limited by the maximum dimension of a Java array as defined by
-    *         the <a href="http://java.sun.com/docs/books/vmspec/">Java
-    *         Virtual Machine Specification</a>.
+    *         <cite>The Java&trade; Virtual Machine Specification</cite>.
     *
     * @throws  IllegalFormatException
     *          If a format string contains an illegal syntax, a format
@@ -285,8 +284,7 @@
     *         string.  If there are more arguments than format specifiers, the
     *         extra arguments are ignored.  The maximum number of arguments is
     *         limited by the maximum dimension of a Java array as defined by
-    *         the <a href="http://java.sun.com/docs/books/vmspec/">Java
-    *         Virtual Machine Specification</a>.
+    *         <cite>The Java&trade; Virtual Machine Specification</cite>.
     *
     * @throws  IllegalFormatException
     *          If a format string contains an illegal syntax, a format
--- a/jdk/src/share/classes/java/io/PrintStream.java	Mon Apr 25 15:45:49 2011 -0700
+++ b/jdk/src/share/classes/java/io/PrintStream.java	Wed Jul 05 17:42:16 2017 +0200
@@ -846,8 +846,8 @@
      *         extra arguments are ignored.  The number of arguments is
      *         variable and may be zero.  The maximum number of arguments is
      *         limited by the maximum dimension of a Java array as defined by
-     *         the <a href="http://java.sun.com/docs/books/vmspec/">Java
-     *         Virtual Machine Specification</a>.  The behaviour on a
+     *         <cite>The Java&trade; Virtual Machine Specification</cite>.
+     *         The behaviour on a
      *         <tt>null</tt> argument depends on the <a
      *         href="../util/Formatter.html#syntax">conversion</a>.
      *
@@ -896,8 +896,8 @@
      *         extra arguments are ignored.  The number of arguments is
      *         variable and may be zero.  The maximum number of arguments is
      *         limited by the maximum dimension of a Java array as defined by
-     *         the <a href="http://java.sun.com/docs/books/vmspec/">Java
-     *         Virtual Machine Specification</a>.  The behaviour on a
+     *         <cite>The Java&trade; Virtual Machine Specification</cite>.
+     *         The behaviour on a
      *         <tt>null</tt> argument depends on the <a
      *         href="../util/Formatter.html#syntax">conversion</a>.
      *
@@ -939,8 +939,8 @@
      *         extra arguments are ignored.  The number of arguments is
      *         variable and may be zero.  The maximum number of arguments is
      *         limited by the maximum dimension of a Java array as defined by
-     *         the <a href="http://java.sun.com/docs/books/vmspec/">Java
-     *         Virtual Machine Specification</a>.  The behaviour on a
+     *         <cite>The Java&trade; Virtual Machine Specification</cite>.
+     *         The behaviour on a
      *         <tt>null</tt> argument depends on the <a
      *         href="../util/Formatter.html#syntax">conversion</a>.
      *
@@ -996,8 +996,8 @@
      *         extra arguments are ignored.  The number of arguments is
      *         variable and may be zero.  The maximum number of arguments is
      *         limited by the maximum dimension of a Java array as defined by
-     *         the <a href="http://java.sun.com/docs/books/vmspec/">Java
-     *         Virtual Machine Specification</a>.  The behaviour on a
+     *         <cite>The Java&trade; Virtual Machine Specification</cite>.
+     *         The behaviour on a
      *         <tt>null</tt> argument depends on the <a
      *         href="../util/Formatter.html#syntax">conversion</a>.
      *
--- a/jdk/src/share/classes/java/io/PrintWriter.java	Mon Apr 25 15:45:49 2011 -0700
+++ b/jdk/src/share/classes/java/io/PrintWriter.java	Wed Jul 05 17:42:16 2017 +0200
@@ -779,8 +779,8 @@
      *         extra arguments are ignored.  The number of arguments is
      *         variable and may be zero.  The maximum number of arguments is
      *         limited by the maximum dimension of a Java array as defined by
-     *         the <a href="http://java.sun.com/docs/books/vmspec/">Java
-     *         Virtual Machine Specification</a>.  The behaviour on a
+     *         <cite>The Java&trade; Virtual Machine Specification</cite>.
+     *         The behaviour on a
      *         <tt>null</tt> argument depends on the <a
      *         href="../util/Formatter.html#syntax">conversion</a>.
      *
@@ -830,8 +830,8 @@
      *         extra arguments are ignored.  The number of arguments is
      *         variable and may be zero.  The maximum number of arguments is
      *         limited by the maximum dimension of a Java array as defined by
-     *         the <a href="http://java.sun.com/docs/books/vmspec/">Java
-     *         Virtual Machine Specification</a>.  The behaviour on a
+     *         <cite>The Java&trade; Virtual Machine Specification</cite>.
+     *         The behaviour on a
      *         <tt>null</tt> argument depends on the <a
      *         href="../util/Formatter.html#syntax">conversion</a>.
      *
@@ -874,8 +874,8 @@
      *         extra arguments are ignored.  The number of arguments is
      *         variable and may be zero.  The maximum number of arguments is
      *         limited by the maximum dimension of a Java array as defined by
-     *         the <a href="http://java.sun.com/docs/books/vmspec/">Java
-     *         Virtual Machine Specification</a>.  The behaviour on a
+     *         <cite>The Java&trade; Virtual Machine Specification</cite>.
+     *         The behaviour on a
      *         <tt>null</tt> argument depends on the <a
      *         href="../util/Formatter.html#syntax">conversion</a>.
      *
@@ -934,8 +934,8 @@
      *         extra arguments are ignored.  The number of arguments is
      *         variable and may be zero.  The maximum number of arguments is
      *         limited by the maximum dimension of a Java array as defined by
-     *         the <a href="http://java.sun.com/docs/books/vmspec/">Java
-     *         Virtual Machine Specification</a>.  The behaviour on a
+     *         <cite>The Java&trade; Virtual Machine Specification</cite>.
+     *         The behaviour on a
      *         <tt>null</tt> argument depends on the <a
      *         href="../util/Formatter.html#syntax">conversion</a>.
      *
--- a/jdk/src/share/classes/java/lang/AssertionError.java	Mon Apr 25 15:45:49 2011 -0700
+++ b/jdk/src/share/classes/java/lang/AssertionError.java	Wed Jul 05 17:42:16 2017 +0200
@@ -34,11 +34,9 @@
  *     new AssertionError(<i>expression</i>)
  * </pre>
  * has as its detail message the <i>string conversion</i> of
- * <i>expression</i> (as defined in <a
- * href="http://java.sun.com/docs/books/jls/second_edition/html/j.title.doc.html">
- * <i>The Java Language Specification, Second Edition</i></a>,
- * <a href="http://java.sun.com/docs/books/jls/second_edition/html/expressions.doc.html#40220">
- * Section  15.18.1.1</a>), regardless of the type of <i>expression</i>.
+ * <i>expression</i> (as defined in section 15.18.1.1 of
+ * <cite>The Java&trade; Language Specification</cite>),
+ * regardless of the type of <i>expression</i>.
  *
  * @since   1.4
  */
@@ -63,8 +61,8 @@
     /**
      * Constructs an AssertionError with its detail message derived
      * from the specified object, which is converted to a string as
-     * defined in <i>The Java Language Specification, Second
-     * Edition</i>, Section 15.18.1.1.
+     * defined in section 15.18.1.1 of
+     * <cite>The Java&trade; Language Specification</cite>.
      *<p>
      * If the specified object is an instance of {@code Throwable}, it
      * becomes the <i>cause</i> of the newly constructed assertion error.
@@ -81,8 +79,8 @@
     /**
      * Constructs an AssertionError with its detail message derived
      * from the specified <code>boolean</code>, which is converted to
-     * a string as defined in <i>The Java Language Specification,
-     * Second Edition</i>, Section 15.18.1.1.
+     * a string as defined in section 15.18.1.1 of
+     * <cite>The Java&trade; Language Specification</cite>.
      *
      * @param detailMessage value to be used in constructing detail message
      */
@@ -93,8 +91,8 @@
     /**
      * Constructs an AssertionError with its detail message derived
      * from the specified <code>char</code>, which is converted to a
-     * string as defined in <i>The Java Language Specification, Second
-     * Edition</i>, Section 15.18.1.1.
+     * string as defined in section 15.18.1.1 of
+     * <cite>The Java&trade; Language Specification</cite>.
      *
      * @param detailMessage value to be used in constructing detail message
      */
@@ -105,8 +103,8 @@
     /**
      * Constructs an AssertionError with its detail message derived
      * from the specified <code>int</code>, which is converted to a
-     * string as defined in <i>The Java Language Specification, Second
-     * Edition</i>, Section 15.18.1.1.
+     * string as defined in section 15.18.1.1 of
+     * <cite>The Java&trade; Language Specification</cite>.
      *
      * @param detailMessage value to be used in constructing detail message
      */
@@ -117,8 +115,8 @@
     /**
      * Constructs an AssertionError with its detail message derived
      * from the specified <code>long</code>, which is converted to a
-     * string as defined in <i>The Java Language Specification, Second
-     * Edition</i>, Section 15.18.1.1.
+     * string as defined in section 15.18.1.1 of
+     * <cite>The Java&trade; Language Specification</cite>.
      *
      * @param detailMessage value to be used in constructing detail message
      */
@@ -129,8 +127,8 @@
     /**
      * Constructs an AssertionError with its detail message derived
      * from the specified <code>float</code>, which is converted to a
-     * string as defined in <i>The Java Language Specification, Second
-     * Edition</i>, Section 15.18.1.1.
+     * string as defined in section 15.18.1.1 of
+     * <cite>The Java&trade; Language Specification</cite>.
      *
      * @param detailMessage value to be used in constructing detail message
      */
@@ -141,8 +139,8 @@
     /**
      * Constructs an AssertionError with its detail message derived
      * from the specified <code>double</code>, which is converted to a
-     * string as defined in <i>The Java Language Specification, Second
-     * Edition</i>, Section 15.18.1.1.
+     * string as defined in section 15.18.1.1 of
+     * <cite>The Java&trade; Language Specification</cite>.
      *
      * @param detailMessage value to be used in constructing detail message
      */
--- a/jdk/src/share/classes/java/lang/Byte.java	Mon Apr 25 15:45:49 2011 -0700
+++ b/jdk/src/share/classes/java/lang/Byte.java	Wed Jul 05 17:42:16 2017 +0200
@@ -251,9 +251,9 @@
      * </blockquote>
      *
      * <i>DecimalNumeral</i>, <i>HexDigits</i>, and <i>OctalDigits</i>
-     * are defined in <a href="http://java.sun.com/docs/books/jls/second_edition/html/lexical.doc.html#48282">&sect;3.10.1</a>
-     * of the <a href="http://java.sun.com/docs/books/jls/html/">Java
-     * Language Specification</a>.
+     * are as defined in section 3.10.1 of
+     * <cite>The Java&trade; Language Specification</cite>,
+     * except that underscores are not accepted between digits.
      *
      * <p>The sequence of characters following an optional
      * sign and/or radix specifier ("{@code 0x}", "{@code 0X}",
--- a/jdk/src/share/classes/java/lang/Character.java	Mon Apr 25 15:45:49 2011 -0700
+++ b/jdk/src/share/classes/java/lang/Character.java	Wed Jul 05 17:42:16 2017 +0200
@@ -4182,9 +4182,11 @@
             aliases.put("AVST", AVESTAN);
             aliases.put("BALI", BALINESE);
             aliases.put("BAMU", BAMUM);
+            aliases.put("BATK", BATAK);
             aliases.put("BENG", BENGALI);
             aliases.put("BOPO", BOPOMOFO);
             aliases.put("BRAI", BRAILLE);
+            aliases.put("BRAH", BRAHMI);
             aliases.put("BUGI", BUGINESE);
             aliases.put("BUHD", BUHID);
             aliases.put("CANS", CANADIAN_ABORIGINAL);
@@ -4228,6 +4230,7 @@
             aliases.put("LISU", LISU);
             aliases.put("LYCI", LYCIAN);
             aliases.put("LYDI", LYDIAN);
+            aliases.put("MAND", MANDAIC);
             aliases.put("MLYM", MALAYALAM);
             aliases.put("MONG", MONGOLIAN);
             aliases.put("MTEI", MEETEI_MAYEK);
--- a/jdk/src/share/classes/java/lang/Class.java	Mon Apr 25 15:45:49 2011 -0700
+++ b/jdk/src/share/classes/java/lang/Class.java	Wed Jul 05 17:42:16 2017 +0200
@@ -95,8 +95,8 @@
  * </pre></blockquote>
  *
  * <p> It is also possible to get the {@code Class} object for a named
- * type (or for void) using a class literal
- * (JLS Section <A HREF="http://java.sun.com/docs/books/jls/second_edition/html/expressions.doc.html#251530">15.8.2</A>).
+ * type (or for void) using a class literal.  See Section 15.8.2 of
+ * <cite>The Java&trade; Language Specification</cite>.
  * For example:
  *
  * <p> <blockquote>
@@ -521,7 +521,8 @@
      *
      * <p> If this class object represents a reference type that is not an
      * array type then the binary name of the class is returned, as specified
-     * by the Java Language Specification, Second Edition.
+     * by
+     * <cite>The Java&trade; Language Specification</cite>.
      *
      * <p> If this class object represents a primitive type or void, then the
      * name returned is a {@code String} equal to the Java language
@@ -630,8 +631,8 @@
      *     the type variables declared by this generic declaration
      * @throws java.lang.reflect.GenericSignatureFormatError if the generic
      *     signature of this generic declaration does not conform to
-     *     the format specified in the Java Virtual Machine Specification,
-     *     3rd edition
+     *     the format specified in
+     *     <cite>The Java&trade; Virtual Machine Specification</cite>
      * @since 1.5
      */
     public TypeVariable<Class<T>>[] getTypeParameters() {
@@ -675,8 +676,8 @@
      * returned.
      *
      * @throws java.lang.reflect.GenericSignatureFormatError if the generic
-     *     class signature does not conform to the format specified in the
-     *     Java Virtual Machine Specification, 3rd edition
+     *     class signature does not conform to the format specified in
+     *     <cite>The Java&trade; Virtual Machine Specification</cite>
      * @throws TypeNotPresentException if the generic superclass
      *     refers to a non-existent type declaration
      * @throws java.lang.reflect.MalformedParameterizedTypeException if the
@@ -798,7 +799,8 @@
      *
      * @throws java.lang.reflect.GenericSignatureFormatError
      *     if the generic class signature does not conform to the format
-     *     specified in the Java Virtual Machine Specification, 3rd edition
+     *     specified in
+     *     <cite>The Java&trade; Virtual Machine Specification</cite>
      * @throws TypeNotPresentException if any of the generic
      *     superinterfaces refers to a non-existent type declaration
      * @throws java.lang.reflect.MalformedParameterizedTypeException
--- a/jdk/src/share/classes/java/lang/ClassLoader.java	Mon Apr 25 15:45:49 2011 -0700
+++ b/jdk/src/share/classes/java/lang/ClassLoader.java	Wed Jul 05 17:42:16 2017 +0200
@@ -160,8 +160,8 @@
  * <h4> <a name="name">Binary names</a> </h4>
  *
  * <p> Any class name provided as a {@link String} parameter to methods in
- * <tt>ClassLoader</tt> must be a binary name as defined by the <a
- * href="http://java.sun.com/docs/books/jls/">Java Language Specification</a>.
+ * <tt>ClassLoader</tt> must be a binary name as defined by
+ * <cite>The Java&trade; Language Specification</cite>.
  *
  * <p> Examples of valid class names include:
  * <blockquote><pre>
@@ -531,9 +531,8 @@
      * @param  b
      *         The bytes that make up the class data.  The bytes in positions
      *         <tt>off</tt> through <tt>off+len-1</tt> should have the format
-     *         of a valid class file as defined by the <a
-     *         href="http://java.sun.com/docs/books/vmspec/">Java Virtual
-     *         Machine Specification</a>.
+     *         of a valid class file as defined by
+     *         <cite>The Java&trade; Virtual Machine Specification</cite>.
      *
      * @param  off
      *         The start offset in <tt>b</tt> of the class data
@@ -597,9 +596,8 @@
      * @param  b
      *         The bytes that make up the class data.  The bytes in positions
      *         <tt>off</tt> through <tt>off+len-1</tt> should have the format
-     *         of a valid class file as defined by the <a
-     *         href="http://java.sun.com/docs/books/vmspec/">Java Virtual
-     *         Machine Specification</a>.
+     *         of a valid class file as defined by
+     *         <cite>The Java&trade; Virtual Machine Specification</cite>.
      *
      * @param  off
      *         The start offset in <tt>b</tt> of the class data
@@ -748,9 +746,8 @@
      * @param  b
      *         The bytes that make up the class data. The bytes in positions
      *         <tt>off</tt> through <tt>off+len-1</tt> should have the format
-     *         of a valid class file as defined by the <a
-     *         href="http://java.sun.com/docs/books/vmspec/">Java Virtual
-     *         Machine Specification</a>.
+     *         of a valid class file as defined by
+     *         <cite>The Java&trade; Virtual Machine Specification</cite>.
      *
      * @param  off
      *         The start offset in <tt>b</tt> of the class data
@@ -838,8 +835,7 @@
      *         The bytes that make up the class data. The bytes from positions
      *         <tt>b.position()</tt> through <tt>b.position() + b.limit() -1
      *         </tt> should have the format of a valid class file as defined by
-     *         the <a href="http://java.sun.com/docs/books/vmspec/">Java Virtual
-     *         Machine Specification</a>.
+     *         <cite>The Java&trade; Virtual Machine Specification</cite>.
      *
      * @param  protectionDomain
      *         The ProtectionDomain of the class, or <tt>null</tt>.
@@ -998,9 +994,8 @@
      * Links the specified class.  This (misleadingly named) method may be
      * used by a class loader to link a class.  If the class <tt>c</tt> has
      * already been linked, then this method simply returns. Otherwise, the
-     * class is linked as described in the "Execution" chapter of the <a
-     * href="http://java.sun.com/docs/books/jls/">Java Language
-     * Specification</a>.
+     * class is linked as described in the "Execution" chapter of
+     * <cite>The Java&trade; Language Specification</cite>.
      * </p>
      *
      * @param  c
@@ -2034,8 +2029,8 @@
      *         The name of the package whose package default assertion status
      *         is to be set. A <tt>null</tt> value indicates the unnamed
      *         package that is "current"
-     *         (<a href="http://java.sun.com/docs/books/jls/">Java Language
-     *         Specification</a>, section 7.4.2).
+     *         (see section 7.4.2 of
+     *         <cite>The Java&trade; Language Specification</cite>.)
      *
      * @param  enabled
      *         <tt>true</tt> if classes loaded by this classloader and
--- a/jdk/src/share/classes/java/lang/Double.java	Mon Apr 25 15:45:49 2011 -0700
+++ b/jdk/src/share/classes/java/lang/Double.java	Wed Jul 05 17:42:16 2017 +0200
@@ -392,9 +392,10 @@
      * where <i>Sign</i>, <i>FloatingPointLiteral</i>,
      * <i>HexNumeral</i>, <i>HexDigits</i>, <i>SignedInteger</i> and
      * <i>FloatTypeSuffix</i> are as defined in the lexical structure
-     * sections of the <a
-     * href="http://java.sun.com/docs/books/jls/html/">Java Language
-     * Specification</a>. If {@code s} does not have the form of
+     * sections of
+     * <cite>The Java&trade; Language Specification</cite>,
+     * except that underscores are not accepted between digits.
+     * If {@code s} does not have the form of
      * a <i>FloatValue</i>, then a {@code NumberFormatException}
      * is thrown. Otherwise, {@code s} is regarded as
      * representing an exact decimal value in the usual
@@ -464,8 +465,8 @@
      *       // Since this method allows integer-only strings as input
      *       // in addition to strings of floating-point literals, the
      *       // two sub-patterns below are simplifications of the grammar
-     *       // productions from the Java Language Specification, 2nd
-     *       // edition, section 3.10.2.
+     *       // productions from section 3.10.2 of
+     *       // <cite>The Java&trade; Language Specification</cite>.
      *
      *       // Digits ._opt Digits_opt ExponentPart_opt FloatTypeSuffix_opt
      *       "((("+Digits+"(\\.)?("+Digits+"?)("+Exp+")?)|"+
--- a/jdk/src/share/classes/java/lang/Enum.java	Mon Apr 25 15:45:49 2011 -0700
+++ b/jdk/src/share/classes/java/lang/Enum.java	Wed Jul 05 17:42:16 2017 +0200
@@ -36,9 +36,8 @@
  *
  * More information about enums, including descriptions of the
  * implicitly declared methods synthesized by the compiler, can be
- * found in <i>The Java&trade; Language Specification, Third
- * Edition</i>, <a
- * href="http://java.sun.com/docs/books/jls/third_edition/html/classes.html#8.9">&sect;8.9</a>.
+ * found in section 8.9 of
+ * <cite>The Java&trade; Language Specification</cite>.
  *
  * <p> Note that when using an enumeration type as the type of a set
  * or as the type of the keys in a map, specialized and efficient
--- a/jdk/src/share/classes/java/lang/Error.java	Mon Apr 25 15:45:49 2011 -0700
+++ b/jdk/src/share/classes/java/lang/Error.java	Wed Jul 05 17:42:16 2017 +0200
@@ -43,7 +43,7 @@
  *
  * @author  Frank Yellin
  * @see     java.lang.ThreadDeath
- * @jls3 11.2 Compile-Time Checking of Exceptions
+ * @jls 11.2 Compile-Time Checking of Exceptions
  * @since   JDK1.0
  */
 public class Error extends Throwable {
--- a/jdk/src/share/classes/java/lang/Exception.java	Mon Apr 25 15:45:49 2011 -0700
+++ b/jdk/src/share/classes/java/lang/Exception.java	Wed Jul 05 17:42:16 2017 +0200
@@ -39,7 +39,7 @@
  *
  * @author  Frank Yellin
  * @see     java.lang.Error
- * @jls3 11.2 Compile-Time Checking of Exceptions
+ * @jls 11.2 Compile-Time Checking of Exceptions
  * @since   JDK1.0
  */
 public class Exception extends Throwable {
--- a/jdk/src/share/classes/java/lang/Float.java	Mon Apr 25 15:45:49 2011 -0700
+++ b/jdk/src/share/classes/java/lang/Float.java	Wed Jul 05 17:42:16 2017 +0200
@@ -353,9 +353,10 @@
      * where <i>Sign</i>, <i>FloatingPointLiteral</i>,
      * <i>HexNumeral</i>, <i>HexDigits</i>, <i>SignedInteger</i> and
      * <i>FloatTypeSuffix</i> are as defined in the lexical structure
-     * sections of the <a
-     * href="http://java.sun.com/docs/books/jls/html/">Java Language
-     * Specification</a>. If {@code s} does not have the form of
+     * sections of
+     * <cite>The Java&trade; Language Specification</cite>,
+     * except that underscores are not accepted between digits.
+     * If {@code s} does not have the form of
      * a <i>FloatValue</i>, then a {@code NumberFormatException}
      * is thrown. Otherwise, {@code s} is regarded as
      * representing an exact decimal value in the usual
--- a/jdk/src/share/classes/java/lang/Integer.java	Mon Apr 25 15:45:49 2011 -0700
+++ b/jdk/src/share/classes/java/lang/Integer.java	Wed Jul 05 17:42:16 2017 +0200
@@ -918,9 +918,9 @@
      * </blockquote>
      *
      * <i>DecimalNumeral</i>, <i>HexDigits</i>, and <i>OctalDigits</i>
-     * are defined in <a href="http://java.sun.com/docs/books/jls/second_edition/html/lexical.doc.html#48282">&sect;3.10.1</a>
-     * of the <a href="http://java.sun.com/docs/books/jls/html/">Java
-     * Language Specification</a>.
+     * are as defined in section 3.10.1 of
+     * <cite>The Java&trade; Language Specification</cite>,
+     * except that underscores are not accepted between digits.
      *
      * <p>The sequence of characters following an optional
      * sign and/or radix specifier ("{@code 0x}", "{@code 0X}",
--- a/jdk/src/share/classes/java/lang/Long.java	Mon Apr 25 15:45:49 2011 -0700
+++ b/jdk/src/share/classes/java/lang/Long.java	Wed Jul 05 17:42:16 2017 +0200
@@ -598,9 +598,9 @@
      * </blockquote>
      *
      * <i>DecimalNumeral</i>, <i>HexDigits</i>, and <i>OctalDigits</i>
-     * are defined in <a href="http://java.sun.com/docs/books/jls/second_edition/html/lexical.doc.html#48282">&sect;3.10.1</a>
-     * of the <a href="http://java.sun.com/docs/books/jls/html/">Java
-     * Language Specification</a>.
+     * are as defined in section 3.10.1 of
+     * <cite>The Java&trade; Language Specification</cite>,
+     * except that underscores are not accepted between digits.
      *
      * <p>The sequence of characters following an optional
      * sign and/or radix specifier ("{@code 0x}", "{@code 0X}",
--- a/jdk/src/share/classes/java/lang/Math.java	Mon Apr 25 15:45:49 2011 -0700
+++ b/jdk/src/share/classes/java/lang/Math.java	Wed Jul 05 17:42:16 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1994, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1994, 2011, 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
@@ -627,11 +627,9 @@
     }
 
     /**
-     * Returns the closest {@code int} to the argument. The
-     * result is rounded to an integer by adding 1/2, taking the
-     * floor of the result, and casting the result to type {@code int}.
-     * In other words, the result is equal to the value of the expression:
-     * <p>{@code (int)Math.floor(a + 0.5f)}
+     * Returns the closest {@code int} to the argument, with ties
+     * rounding up.
+     *
      * <p>
      * Special cases:
      * <ul><li>If the argument is NaN, the result is 0.
@@ -649,17 +647,17 @@
      * @see     java.lang.Integer#MIN_VALUE
      */
     public static int round(float a) {
-        return (int)floor(a + 0.5f);
+        if (a != 0x1.fffffep-2f) // greatest float value less than 0.5
+            return (int)floor(a + 0.5f);
+        else
+            return 0;
     }
 
     /**
-     * Returns the closest {@code long} to the argument. The result
-     * is rounded to an integer by adding 1/2, taking the floor of the
-     * result, and casting the result to type {@code long}. In other
-     * words, the result is equal to the value of the expression:
-     * <p>{@code (long)Math.floor(a + 0.5d)}
-     * <p>
-     * Special cases:
+     * Returns the closest {@code long} to the argument, with ties
+     * rounding up.
+     *
+     * <p>Special cases:
      * <ul><li>If the argument is NaN, the result is 0.
      * <li>If the argument is negative infinity or any value less than or
      * equal to the value of {@code Long.MIN_VALUE}, the result is
@@ -676,7 +674,10 @@
      * @see     java.lang.Long#MIN_VALUE
      */
     public static long round(double a) {
-        return (long)floor(a + 0.5d);
+        if (a != 0x1.fffffffffffffp-2) // greatest double value less than 0.5
+            return (long)floor(a + 0.5d);
+        else
+            return 0;
     }
 
     private static Random randomNumberGenerator;
--- a/jdk/src/share/classes/java/lang/Object.java	Mon Apr 25 15:45:49 2011 -0700
+++ b/jdk/src/share/classes/java/lang/Object.java	Wed Jul 05 17:42:16 2017 +0200
@@ -58,9 +58,8 @@
      *
      * @return The {@code Class} object that represents the runtime
      *         class of this object.
-     * @see    <a href="http://java.sun.com/docs/books/jls/">The Java
-     *         Language Specification, Third Edition (15.8.2 Class
-     *         Literals)</a>
+     * @see    Class Literals, section 15.8.2 of
+     *         <cite>The Java&trade; Language Specification</cite>.
      */
     public final native Class<?> getClass();
 
--- a/jdk/src/share/classes/java/lang/Override.java	Mon Apr 25 15:45:49 2011 -0700
+++ b/jdk/src/share/classes/java/lang/Override.java	Wed Jul 05 17:42:16 2017 +0200
@@ -43,7 +43,7 @@
  *
  * @author  Peter von der Ah&eacute;
  * @author  Joshua Bloch
- * @jls3 9.6.1.4 Override
+ * @jls 9.6.1.4 Override
  * @since 1.5
  */
 @Target(ElementType.METHOD)
--- a/jdk/src/share/classes/java/lang/Package.java	Mon Apr 25 15:45:49 2011 -0700
+++ b/jdk/src/share/classes/java/lang/Package.java	Wed Jul 05 17:42:16 2017 +0200
@@ -109,10 +109,9 @@
     /**
      * Return the name of this package.
      *
-     * @return  The fully-qualified name of this package as defined in the
-     *          <em>Java Language Specification, Third Edition</em>
-     *          <a href="http://java.sun.com/docs/books/jls/third_edition/html/names.html#6.5.3">
-     *          &sect;6.5.3</a>, for example, {@code java.lang}
+     * @return  The fully-qualified name of this package as defined in section 6.5.3 of
+     *          <cite>The Java&trade; Language Specification</cite>,
+     *          for example, {@code java.lang}
      */
     public String getName() {
         return pkgName;
--- a/jdk/src/share/classes/java/lang/RuntimeException.java	Mon Apr 25 15:45:49 2011 -0700
+++ b/jdk/src/share/classes/java/lang/RuntimeException.java	Wed Jul 05 17:42:16 2017 +0200
@@ -37,7 +37,7 @@
  * propagate outside the method or constructor boundary.
  *
  * @author  Frank Yellin
- * @jls3 11.2 Compile-Time Checking of Exceptions
+ * @jls 11.2 Compile-Time Checking of Exceptions
  * @since   JDK1.0
  */
 public class RuntimeException extends Exception {
--- a/jdk/src/share/classes/java/lang/SafeVarargs.java	Mon Apr 25 15:45:49 2011 -0700
+++ b/jdk/src/share/classes/java/lang/SafeVarargs.java	Wed Jul 05 17:42:16 2017 +0200
@@ -70,8 +70,8 @@
  *
  * </ul>
  *
- * @jls3 4.7 Reifiable Types
- * @jls3 8.4.1 Formal Parameters
+ * @jls 4.7 Reifiable Types
+ * @jls 8.4.1 Formal Parameters
  */
 @Documented
 @Retention(RetentionPolicy.RUNTIME)
--- a/jdk/src/share/classes/java/lang/Short.java	Mon Apr 25 15:45:49 2011 -0700
+++ b/jdk/src/share/classes/java/lang/Short.java	Wed Jul 05 17:42:16 2017 +0200
@@ -256,9 +256,9 @@
      * </blockquote>
      *
      * <i>DecimalNumeral</i>, <i>HexDigits</i>, and <i>OctalDigits</i>
-     * are defined in <a href="http://java.sun.com/docs/books/jls/second_edition/html/lexical.doc.html#48282">&sect;3.10.1</a>
-     * of the <a href="http://java.sun.com/docs/books/jls/html/">Java
-     * Language Specification</a>.
+     * are as defined in section 3.10.1 of
+     * <cite>The Java&trade; Language Specification</cite>,
+     * except that underscores are not accepted between digits.
      *
      * <p>The sequence of characters following an optional
      * sign and/or radix specifier ("{@code 0x}", "{@code 0X}",
--- a/jdk/src/share/classes/java/lang/StrictMath.java	Mon Apr 25 15:45:49 2011 -0700
+++ b/jdk/src/share/classes/java/lang/StrictMath.java	Wed Jul 05 17:42:16 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2011, 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
@@ -613,11 +613,8 @@
     public static native double pow(double a, double b);
 
     /**
-     * Returns the closest {@code int} to the argument. The
-     * result is rounded to an integer by adding 1/2, taking the
-     * floor of the result, and casting the result to type {@code int}.
-     * In other words, the result is equal to the value of the expression:
-     * <p>{@code (int)Math.floor(a + 0.5f)}
+     * Returns the closest {@code int} to the argument, with ties
+     * rounding up.
      *
      * <p>Special cases:
      * <ul><li>If the argument is NaN, the result is 0.
@@ -635,15 +632,12 @@
      * @see     java.lang.Integer#MIN_VALUE
      */
     public static int round(float a) {
-        return (int)floor(a + 0.5f);
+        return Math.round(a);
     }
 
     /**
-     * Returns the closest {@code long} to the argument. The result
-     * is rounded to an integer by adding 1/2, taking the floor of the
-     * result, and casting the result to type {@code long}. In other
-     * words, the result is equal to the value of the expression:
-     * <p>{@code (long)Math.floor(a + 0.5d)}
+     * Returns the closest {@code long} to the argument, with ties
+     * rounding up.
      *
      * <p>Special cases:
      * <ul><li>If the argument is NaN, the result is 0.
@@ -662,7 +656,7 @@
      * @see     java.lang.Long#MIN_VALUE
      */
     public static long round(double a) {
-        return (long)floor(a + 0.5d);
+        return Math.round(a);
     }
 
     private static Random randomNumberGenerator;
--- a/jdk/src/share/classes/java/lang/String.java	Mon Apr 25 15:45:49 2011 -0700
+++ b/jdk/src/share/classes/java/lang/String.java	Wed Jul 05 17:42:16 2017 +0200
@@ -2819,8 +2819,8 @@
      *         extra arguments are ignored.  The number of arguments is
      *         variable and may be zero.  The maximum number of arguments is
      *         limited by the maximum dimension of a Java array as defined by
-     *         the <a href="http://java.sun.com/docs/books/vmspec/">Java
-     *         Virtual Machine Specification</a>.  The behaviour on a
+     *         <cite>The Java&trade; Virtual Machine Specification</cite>.
+     *         The behaviour on a
      *         <tt>null</tt> argument depends on the <a
      *         href="../util/Formatter.html#syntax">conversion</a>.
      *
@@ -2863,8 +2863,8 @@
      *         extra arguments are ignored.  The number of arguments is
      *         variable and may be zero.  The maximum number of arguments is
      *         limited by the maximum dimension of a Java array as defined by
-     *         the <a href="http://java.sun.com/docs/books/vmspec/">Java
-     *         Virtual Machine Specification</a>.  The behaviour on a
+     *         <cite>The Java&trade; Virtual Machine Specification</cite>.
+     *         The behaviour on a
      *         <tt>null</tt> argument depends on the <a
      *         href="../util/Formatter.html#syntax">conversion</a>.
      *
@@ -3066,9 +3066,8 @@
      * if and only if <code>s.equals(t)</code> is <code>true</code>.
      * <p>
      * All literal strings and string-valued constant expressions are
-     * interned. String literals are defined in &sect;3.10.5 of the
-     * <a href="http://java.sun.com/docs/books/jls/html/">Java Language
-     * Specification</a>
+     * interned. String literals are defined in section 3.10.5 of the
+     * <cite>The Java&trade; Language Specification</cite>.
      *
      * @return  a string that has the same contents as this string, but is
      *          guaranteed to be from a pool of unique strings.
--- a/jdk/src/share/classes/java/lang/Throwable.java	Mon Apr 25 15:45:49 2011 -0700
+++ b/jdk/src/share/classes/java/lang/Throwable.java	Wed Jul 05 17:42:16 2017 +0200
@@ -108,7 +108,7 @@
  * @author  unascribed
  * @author  Josh Bloch (Added exception chaining and programmatic access to
  *          stack trace in 1.4.)
- * @jls3 11.2 Compile-Time Checking of Exceptions
+ * @jls 11.2 Compile-Time Checking of Exceptions
  * @since JDK1.0
  */
 public class Throwable implements Serializable {
--- a/jdk/src/share/classes/java/lang/annotation/Annotation.java	Mon Apr 25 15:45:49 2011 -0700
+++ b/jdk/src/share/classes/java/lang/annotation/Annotation.java	Wed Jul 05 17:42:16 2017 +0200
@@ -31,9 +31,8 @@
  * an annotation type.  Also note that this interface does not itself
  * define an annotation type.
  *
- * More information about annotation types can be found in <i>The
- * Java&trade; Language Specification, Third Edition</i>, <a
- * href="http://java.sun.com/docs/books/jls/third_edition/html/interfaces.html#9.6">&sect;9.6</a>.
+ * More information about annotation types can be found in section 9.6 of
+ * <cite>The Java&trade; Language Specification</cite>.
  *
  * @author  Josh Bloch
  * @since   1.5
--- a/jdk/src/share/classes/java/lang/instrument/ClassFileTransformer.java	Mon Apr 25 15:45:49 2011 -0700
+++ b/jdk/src/share/classes/java/lang/instrument/ClassFileTransformer.java	Wed Jul 05 17:42:16 2017 +0200
@@ -36,9 +36,9 @@
  * to transform class files.
  * The transformation occurs before the class is defined by the JVM.
  * <P>
- * Note the term <i>class file</i> is used as defined in the chapter
- * <a href="http://java.sun.com/docs/books/vmspec/2nd-edition/html/ClassFile.doc.html#80959">The class File Format</a>
- * of <i>The Java Virtual Machine Specification</i>, to mean a sequence
+ * Note the term <i>class file</i> is used as defined in section 3.1 of
+ * <cite>The Java&trade; Virtual Machine Specification</cite>,
+ * to mean a sequence
  * of bytes in class file format, whether or not they reside in a file.
  *
  * @see     java.lang.instrument.Instrumentation
--- a/jdk/src/share/classes/java/lang/instrument/Instrumentation.java	Mon Apr 25 15:45:49 2011 -0700
+++ b/jdk/src/share/classes/java/lang/instrument/Instrumentation.java	Wed Jul 05 17:42:16 2017 +0200
@@ -434,8 +434,9 @@
      * avoiding these types of issues, is to use a unique package name for the
      * instrumentation classes.
      *
-     * <p> The <a href="http://java.sun.com/docs/books/vmspec/">Java Virtual Machine
-     * Specification</a> specifies that a subsequent attempt to resolve a symbolic
+     * <p>
+     * <cite>The Java&trade; Virtual Machine Specification</cite>
+     * specifies that a subsequent attempt to resolve a symbolic
      * reference that the Java virtual machine has previously unsuccessfully attempted
      * to resolve always fails with the same error that was thrown as a result of the
      * initial resolution attempt. Consequently, if the JAR file contains an entry
@@ -487,8 +488,9 @@
      * getName()} method on the <code>jarfile</code> and this is provided as the
      * parameter to the <code>appendToClassPathForInstrumentation</code> method.
      *
-     * <p> The <a href="http://java.sun.com/docs/books/vmspec/">Java Virtual Machine
-     * Specification</a> specifies that a subsequent attempt to resolve a symbolic
+     * <p>
+     * <cite>The Java&trade; Virtual Machine Specification</cite>
+     * specifies that a subsequent attempt to resolve a symbolic
      * reference that the Java virtual machine has previously unsuccessfully attempted
      * to resolve always fails with the same error that was thrown as a result of the
      * initial resolution attempt. Consequently, if the JAR file contains an entry
--- a/jdk/src/share/classes/java/lang/invoke/package-info.java	Mon Apr 25 15:45:49 2011 -0700
+++ b/jdk/src/share/classes/java/lang/invoke/package-info.java	Wed Jul 05 17:42:16 2017 +0200
@@ -194,8 +194,8 @@
  * Method handle constants for subtags {@code REF_getStatic}, {@code REF_putStatic}, and {@code REF_invokeStatic}
  * may force class initialization on their first invocation, just like the corresponding bytecodes.
  * <p>
- * The rules of section 5.4.3 of the
- * <a href="http://java.sun.com/docs/books/jvms/second_edition/html/ConstantPool.doc.html#73492">JVM Specification</a>
+ * The rules of section 5.4.3 of
+ * <cite>The Java&trade; Virtual Machine Specification</cite>
  * apply to the resolution of {@code CONSTANT_MethodType}, {@code CONSTANT_MethodHandle},
  * and {@code CONSTANT_InvokeDynamic} constants,
  * by the execution of {@code invokedynamic} and {@code ldc} instructions.
--- a/jdk/src/share/classes/java/lang/reflect/Constructor.java	Mon Apr 25 15:45:49 2011 -0700
+++ b/jdk/src/share/classes/java/lang/reflect/Constructor.java	Wed Jul 05 17:42:16 2017 +0200
@@ -186,8 +186,8 @@
      *     the type variables declared by this generic declaration
      * @throws GenericSignatureFormatError if the generic
      *     signature of this generic declaration does not conform to
-     *     the format specified in the Java Virtual Machine Specification,
-     *     3rd edition
+     *     the format specified in
+     *     <cite>The Java&trade; Virtual Machine Specification</cite>
      * @since 1.5
      */
     public TypeVariable<Constructor<T>>[] getTypeParameters() {
@@ -229,7 +229,8 @@
      *     parameter types of the underlying method, in declaration order
      * @throws GenericSignatureFormatError
      *     if the generic method signature does not conform to the format
-     *     specified in the Java Virtual Machine Specification, 3rd edition
+     *     specified in
+     *     <cite>The Java&trade; Virtual Machine Specification</cite>
      * @throws TypeNotPresentException if any of the parameter
      *     types of the underlying method refers to a non-existent type
      *     declaration
@@ -273,7 +274,8 @@
      *     thrown by the underlying method
      * @throws GenericSignatureFormatError
      *     if the generic method signature does not conform to the format
-     *     specified in the Java Virtual Machine Specification, 3rd edition
+     *     specified in
+     *     <cite>The Java&trade; Virtual Machine Specification</cite>
      * @throws TypeNotPresentException if the underlying method's
      *     {@code throws} clause refers to a non-existent type declaration
      * @throws MalformedParameterizedTypeException if
@@ -468,8 +470,8 @@
      *
      * <p>If the constructor's declaring class is an inner class in a
      * non-static context, the first argument to the constructor needs
-     * to be the enclosing instance; see <i>The Java Language
-     * Specification</i>, section 15.9.3.
+     * to be the enclosing instance; see section 15.9.3 of
+     * <cite>The Java&trade; Language Specification</cite>.
      *
      * <p>If the required access and argument checks succeed and the
      * instantiation will proceed, the constructor's declaring class
@@ -541,7 +543,8 @@
      * constructor; returns {@code false} otherwise.
      *
      * @return true if and only if this constructor is a synthetic
-     * constructor as defined by the Java Language Specification.
+     * constructor as defined by
+     * <cite>The Java&trade; Language Specification</cite>.
      * @since 1.5
      */
     public boolean isSynthetic() {
--- a/jdk/src/share/classes/java/lang/reflect/Field.java	Mon Apr 25 15:45:49 2011 -0700
+++ b/jdk/src/share/classes/java/lang/reflect/Field.java	Wed Jul 05 17:42:16 2017 +0200
@@ -221,8 +221,8 @@
      * @return a {@code Type} object that represents the declared type for
      *     the field represented by this {@code Field} object
      * @throws GenericSignatureFormatError if the generic field
-     *     signature does not conform to the format specified in the Java
-     *     Virtual Machine Specification, 3rd edition
+     *     signature does not conform to the format specified in
+     *     <cite>The Java&trade; Virtual Machine Specification</cite>
      * @throws TypeNotPresentException if the generic type
      *     signature of the underlying field refers to a non-existent
      *     type declaration
--- a/jdk/src/share/classes/java/lang/reflect/GenericDeclaration.java	Mon Apr 25 15:45:49 2011 -0700
+++ b/jdk/src/share/classes/java/lang/reflect/GenericDeclaration.java	Wed Jul 05 17:42:16 2017 +0200
@@ -42,8 +42,8 @@
      *     the type variables declared by this generic declaration
      * @throws GenericSignatureFormatError if the generic
      *     signature of this generic declaration does not conform to
-     *     the format specified in the Java Virtual Machine Specification,
-     *     3rd edition
+     *     the format specified in
+     *     <cite>The Java&trade; Virtual Machine Specification</cite>
      */
     public TypeVariable<?>[] getTypeParameters();
 }
--- a/jdk/src/share/classes/java/lang/reflect/Method.java	Mon Apr 25 15:45:49 2011 -0700
+++ b/jdk/src/share/classes/java/lang/reflect/Method.java	Wed Jul 05 17:42:16 2017 +0200
@@ -194,8 +194,8 @@
      *     the type variables declared by this generic declaration
      * @throws GenericSignatureFormatError if the generic
      *     signature of this generic declaration does not conform to
-     *     the format specified in the Java Virtual Machine Specification,
-     *     3rd edition
+     *     the format specified in
+     *     <cite>The Java&trade; Virtual Machine Specification</cite>
      * @since 1.5
      */
     public TypeVariable<Method>[] getTypeParameters() {
@@ -230,7 +230,8 @@
      *     type of the underlying  method
      * @throws GenericSignatureFormatError
      *     if the generic method signature does not conform to the format
-     *     specified in the Java Virtual Machine Specification, 3rd edition
+     *     specified in
+     *     <cite>The Java&trade; Virtual Machine Specification</cite>
      * @throws TypeNotPresentException if the underlying method's
      *     return type refers to a non-existent type declaration
      * @throws MalformedParameterizedTypeException if the
@@ -275,7 +276,8 @@
      *     parameter types of the underlying method, in declaration order
      * @throws GenericSignatureFormatError
      *     if the generic method signature does not conform to the format
-     *     specified in the Java Virtual Machine Specification, 3rd edition
+     *     specified in
+     *     <cite>The Java&trade; Virtual Machine Specification</cite>
      * @throws TypeNotPresentException if any of the parameter
      *     types of the underlying method refers to a non-existent type
      *     declaration
@@ -319,7 +321,8 @@
      *     thrown by the underlying method
      * @throws GenericSignatureFormatError
      *     if the generic method signature does not conform to the format
-     *     specified in the Java Virtual Machine Specification, 3rd edition
+     *     specified in
+     *     <cite>The Java&trade; Virtual Machine Specification</cite>
      * @throws TypeNotPresentException if the underlying method's
      *     {@code throws} clause refers to a non-existent type declaration
      * @throws MalformedParameterizedTypeException if
--- a/jdk/src/share/classes/java/lang/reflect/Modifier.java	Mon Apr 25 15:45:49 2011 -0700
+++ b/jdk/src/share/classes/java/lang/reflect/Modifier.java	Wed Jul 05 17:42:16 2017 +0200
@@ -34,14 +34,8 @@
  * constants to decode class and member access modifiers.  The sets of
  * modifiers are represented as integers with distinct bit positions
  * representing different modifiers.  The values for the constants
- * representing the modifiers are taken from <a
- * href="http://java.sun.com/docs/books/vmspec/2nd-edition/html/VMSpecTOC.doc.html"><i>The
- * Java</i><sup><small>TM</small></sup> <i>Virtual Machine Specification, Second
- * edition</i></a> tables
- * <a href="http://java.sun.com/docs/books/vmspec/2nd-edition/html/ClassFile.doc.html#75734">4.1</a>,
- * <a href="http://java.sun.com/docs/books/vmspec/2nd-edition/html/ClassFile.doc.html#88358">4.4</a>,
- * <a href="http://java.sun.com/docs/books/vmspec/2nd-edition/html/ClassFile.doc.html#75568">4.5</a>, and
- * <a href="http://java.sun.com/docs/books/vmspec/2nd-edition/html/ClassFile.doc.html#88478">4.7</a>.
+ * representing the modifiers are taken from the tables in sections 4.1, 4.4, 4.5, and 4.7 of
+ * <cite>The Java&trade; Virtual Machine Specification</cite>.
  *
  * @see Class#getModifiers()
  * @see Member#getModifiers()
@@ -214,14 +208,8 @@
      *    public final synchronized strictfp
      * </pre></blockquote>
      * The modifier names are returned in an order consistent with the
-     * suggested modifier orderings given in <a
-     * href="http://java.sun.com/docs/books/jls/second_edition/html/j.title.doc.html"><em>The
-     * Java Language Specification, Second Edition</em></a> sections
-     * <a href="http://java.sun.com/docs/books/jls/second_edition/html/classes.doc.html#21613">&sect;8.1.1</a>,
-     * <a href="http://java.sun.com/docs/books/jls/second_edition/html/classes.doc.html#78091">&sect;8.3.1</a>,
-     * <a href="http://java.sun.com/docs/books/jls/second_edition/html/classes.doc.html#78188">&sect;8.4.3</a>,
-     * <a href="http://java.sun.com/docs/books/jls/second_edition/html/classes.doc.html#42018">&sect;8.8.3</a>, and
-     * <a href="http://java.sun.com/docs/books/jls/second_edition/html/interfaces.doc.html#235947">&sect;9.1.1</a>.
+     * suggested modifier orderings given in sections 8.1.1, 8.3.1, 8.4.3, 8.8.3, and 9.1.1 of
+     * <cite>The Java&trade; Language Specification</cite>.
      * The full modifier ordering used by this method is:
      * <blockquote> {@code
      * public protected private abstract static final transient
@@ -269,9 +257,8 @@
     }
 
     /*
-     * Access modifier flag constants from <em>The Java Virtual
-     * Machine Specification, Second Edition</em>, tables 4.1, 4.4,
-     * 4.5, and 4.7.
+     * Access modifier flag constants from tables 4.1, 4.4, 4.5, and 4.7 of
+     * <cite>The Java&trade; Virtual Machine Specification</cite>
      */
 
     /**
@@ -403,7 +390,7 @@
      * @return an {@code int} value OR-ing together the source language
      * modifiers that can be applied to a class.
      *
-     * @jls3 8.1.1 Class Modifiers
+     * @jls 8.1.1 Class Modifiers
      * @since 1.7
      */
     public static int classModifiers() {
@@ -416,7 +403,7 @@
      * @return an {@code int} value OR-ing together the source language
      * modifiers that can be applied to an inteface.
      *
-     * @jls3 9.1.1 Interface Modifiers
+     * @jls 9.1.1 Interface Modifiers
      * @since 1.7
      */
     public static int interfaceModifiers() {
@@ -429,7 +416,7 @@
      * @return an {@code int} value OR-ing together the source language
      * modifiers that can be applied to a constructor.
      *
-     * @jls3 8.8.3 Constructor Modifiers
+     * @jls 8.8.3 Constructor Modifiers
      * @since 1.7
      */
     public static int constructorModifiers() {
@@ -442,7 +429,7 @@
      * @return an {@code int} value OR-ing together the source language
      * modifiers that can be applied to a method.
      *
-     * @jls3 8.4.3 Method Modifiers
+     * @jls 8.4.3 Method Modifiers
      * @since 1.7
      */
     public static int methodModifiers() {
@@ -456,7 +443,7 @@
      * @return an {@code int} value OR-ing together the source language
      * modifiers that can be applied to a field.
      *
-     * @jls3 8.3.1 Field Modifiers
+     * @jls 8.3.1 Field Modifiers
      * @since 1.7
      */
     public static int fieldModifiers() {
--- a/jdk/src/share/classes/java/math/BigDecimal.java	Mon Apr 25 15:45:49 2011 -0700
+++ b/jdk/src/share/classes/java/math/BigDecimal.java	Wed Jul 05 17:42:16 2017 +0200
@@ -2905,12 +2905,11 @@
 
     /**
      * Converts this {@code BigDecimal} to a {@code BigInteger}.
-     * This conversion is analogous to a <a
-     * href="http://java.sun.com/docs/books/jls/second_edition/html/conversions.doc.html#25363"><i>narrowing
-     * primitive conversion</i></a> from {@code double} to
-     * {@code long} as defined in the <a
-     * href="http://java.sun.com/docs/books/jls/html/">Java Language
-     * Specification</a>: any fractional part of this
+     * This conversion is analogous to the
+     * <i>narrowing primitive conversion</i> from {@code double} to
+     * {@code long} as defined in section 5.1.3 of
+     * <cite>The Java&trade; Language Specification</cite>:
+     * any fractional part of this
      * {@code BigDecimal} will be discarded.  Note that this
      * conversion can lose information about the precision of the
      * {@code BigDecimal} value.
@@ -2942,13 +2941,12 @@
     }
 
     /**
-     * Converts this {@code BigDecimal} to a {@code long}.  This
-     * conversion is analogous to a <a
-     * href="http://java.sun.com/docs/books/jls/second_edition/html/conversions.doc.html#25363"><i>narrowing
-     * primitive conversion</i></a> from {@code double} to
-     * {@code short} as defined in the <a
-     * href="http://java.sun.com/docs/books/jls/html/">Java Language
-     * Specification</a>: any fractional part of this
+     * Converts this {@code BigDecimal} to a {@code long}.
+     * This conversion is analogous to the
+     * <i>narrowing primitive conversion</i> from {@code double} to
+     * {@code short} as defined in section 5.1.3 of
+     * <cite>The Java&trade; Language Specification</cite>:
+     * any fractional part of this
      * {@code BigDecimal} will be discarded, and if the resulting
      * "{@code BigInteger}" is too big to fit in a
      * {@code long}, only the low-order 64 bits are returned.
@@ -3011,13 +3009,12 @@
     }
 
     /**
-     * Converts this {@code BigDecimal} to an {@code int}.  This
-     * conversion is analogous to a <a
-     * href="http://java.sun.com/docs/books/jls/second_edition/html/conversions.doc.html#25363"><i>narrowing
-     * primitive conversion</i></a> from {@code double} to
-     * {@code short} as defined in the <a
-     * href="http://java.sun.com/docs/books/jls/html/">Java Language
-     * Specification</a>: any fractional part of this
+     * Converts this {@code BigDecimal} to an {@code int}.
+     * This conversion is analogous to the
+     * <i>narrowing primitive conversion</i> from {@code double} to
+     * {@code short} as defined in section 5.1.3 of
+     * <cite>The Java&trade; Language Specification</cite>:
+     * any fractional part of this
      * {@code BigDecimal} will be discarded, and if the resulting
      * "{@code BigInteger}" is too big to fit in an
      * {@code int}, only the low-order 32 bits are returned.
@@ -3095,12 +3092,11 @@
 
     /**
      * Converts this {@code BigDecimal} to a {@code float}.
-     * This conversion is similar to the <a
-     * href="http://java.sun.com/docs/books/jls/second_edition/html/conversions.doc.html#25363"><i>narrowing
-     * primitive conversion</i></a> from {@code double} to
-     * {@code float} defined in the <a
-     * href="http://java.sun.com/docs/books/jls/html/">Java Language
-     * Specification</a>: if this {@code BigDecimal} has too great a
+     * This conversion is similar to the
+     * <i>narrowing primitive conversion</i> from {@code double} to
+     * {@code float} as defined in section 5.1.3 of
+     * <cite>The Java&trade; Language Specification</cite>:
+     * if this {@code BigDecimal} has too great a
      * magnitude to represent as a {@code float}, it will be
      * converted to {@link Float#NEGATIVE_INFINITY} or {@link
      * Float#POSITIVE_INFINITY} as appropriate.  Note that even when
@@ -3119,12 +3115,11 @@
 
     /**
      * Converts this {@code BigDecimal} to a {@code double}.
-     * This conversion is similar to the <a
-     * href="http://java.sun.com/docs/books/jls/second_edition/html/conversions.doc.html#25363"><i>narrowing
-     * primitive conversion</i></a> from {@code double} to
-     * {@code float} as defined in the <a
-     * href="http://java.sun.com/docs/books/jls/html/">Java Language
-     * Specification</a>: if this {@code BigDecimal} has too great a
+     * This conversion is similar to the
+     * <i>narrowing primitive conversion</i> from {@code double} to
+     * {@code float} as defined in section 5.1.3 of
+     * <cite>The Java&trade; Language Specification</cite>:
+     * if this {@code BigDecimal} has too great a
      * magnitude represent as a {@code double}, it will be
      * converted to {@link Double#NEGATIVE_INFINITY} or {@link
      * Double#POSITIVE_INFINITY} as appropriate.  Note that even when
--- a/jdk/src/share/classes/java/math/BigInteger.java	Mon Apr 25 15:45:49 2011 -0700
+++ b/jdk/src/share/classes/java/math/BigInteger.java	Wed Jul 05 17:42:16 2017 +0200
@@ -2719,12 +2719,11 @@
 
     /**
      * Converts this BigInteger to an {@code int}.  This
-     * conversion is analogous to a <a
-     * href="http://java.sun.com/docs/books/jls/second_edition/html/conversions.doc.html#25363"><i>narrowing
-     * primitive conversion</i></a> from {@code long} to
-     * {@code int} as defined in the <a
-     * href="http://java.sun.com/docs/books/jls/html/">Java Language
-     * Specification</a>: if this BigInteger is too big to fit in an
+     * conversion is analogous to a
+     * <i>narrowing primitive conversion</i> from {@code long} to
+     * {@code int} as defined in section 5.1.3 of
+     * <cite>The Java&trade; Language Specification</cite>:
+     * if this BigInteger is too big to fit in an
      * {@code int}, only the low-order 32 bits are returned.
      * Note that this conversion can lose information about the
      * overall magnitude of the BigInteger value as well as return a
@@ -2740,12 +2739,11 @@
 
     /**
      * Converts this BigInteger to a {@code long}.  This
-     * conversion is analogous to a <a
-     * href="http://java.sun.com/docs/books/jls/second_edition/html/conversions.doc.html#25363"><i>narrowing
-     * primitive conversion</i></a> from {@code long} to
-     * {@code int} as defined in the <a
-     * href="http://java.sun.com/docs/books/jls/html/">Java Language
-     * Specification</a>: if this BigInteger is too big to fit in a
+     * conversion is analogous to a
+     * <i>narrowing primitive conversion</i> from {@code long} to
+     * {@code int} as defined in section 5.1.3 of
+     * <cite>The Java&trade; Language Specification</cite>:
+     * if this BigInteger is too big to fit in a
      * {@code long}, only the low-order 64 bits are returned.
      * Note that this conversion can lose information about the
      * overall magnitude of the BigInteger value as well as return a
@@ -2763,12 +2761,11 @@
 
     /**
      * Converts this BigInteger to a {@code float}.  This
-     * conversion is similar to the <a
-     * href="http://java.sun.com/docs/books/jls/second_edition/html/conversions.doc.html#25363"><i>narrowing
-     * primitive conversion</i></a> from {@code double} to
-     * {@code float} defined in the <a
-     * href="http://java.sun.com/docs/books/jls/html/">Java Language
-     * Specification</a>: if this BigInteger has too great a magnitude
+     * conversion is similar to the
+     * <i>narrowing primitive conversion</i> from {@code double} to
+     * {@code float} as defined in section 5.1.3 of
+     * <cite>The Java&trade; Language Specification</cite>:
+     * if this BigInteger has too great a magnitude
      * to represent as a {@code float}, it will be converted to
      * {@link Float#NEGATIVE_INFINITY} or {@link
      * Float#POSITIVE_INFINITY} as appropriate.  Note that even when
@@ -2784,12 +2781,11 @@
 
     /**
      * Converts this BigInteger to a {@code double}.  This
-     * conversion is similar to the <a
-     * href="http://java.sun.com/docs/books/jls/second_edition/html/conversions.doc.html#25363"><i>narrowing
-     * primitive conversion</i></a> from {@code double} to
-     * {@code float} defined in the <a
-     * href="http://java.sun.com/docs/books/jls/html/">Java Language
-     * Specification</a>: if this BigInteger has too great a magnitude
+     * conversion is similar to the
+     * <i>narrowing primitive conversion</i> from {@code double} to
+     * {@code float} as defined in section 5.1.3 of
+     * <cite>The Java&trade; Language Specification</cite>:
+     * if this BigInteger has too great a magnitude
      * to represent as a {@code double}, it will be converted to
      * {@link Double#NEGATIVE_INFINITY} or {@link
      * Double#POSITIVE_INFINITY} as appropriate.  Note that even when
--- a/jdk/src/share/classes/java/security/SecureClassLoader.java	Mon Apr 25 15:45:49 2011 -0700
+++ b/jdk/src/share/classes/java/security/SecureClassLoader.java	Wed Jul 05 17:42:16 2017 +0200
@@ -118,10 +118,8 @@
      *                  and without a trailing ".class" suffix.
      * @param      b    the bytes that make up the class data. The bytes in
      *             positions <code>off</code> through <code>off+len-1</code>
-     *             should have the format of a valid class file as defined
-     *             by the
-     *             <a href="http://java.sun.com/docs/books/vmspec/">Java
-     *             Virtual Machine Specification</a>.
+     *             should have the format of a valid class file as defined by
+     *             <cite>The Java&trade; Virtual Machine Specification</cite>.
      * @param      off  the start offset in <code>b</code> of the class data
      * @param      len  the length of the class data
      * @param      cs   the associated CodeSource, or <code>null</code> if none
@@ -157,9 +155,8 @@
      *                  and without a trailing ".class" suffix.
      * @param      b    the bytes that make up the class data.  The bytes from positions
      *                  <tt>b.position()</tt> through <tt>b.position() + b.limit() -1</tt>
-     *                  should have the format of a valid class file as defined by the
-     *                  <a href="http://java.sun.com/docs/books/vmspec/">Java Virtual
-     *                  Machine Specification</a>.
+     *                  should have the format of a valid class file as defined by
+     *                  <cite>The Java&trade; Virtual Machine Specification</cite>.
      * @param      cs   the associated CodeSource, or <code>null</code> if none
      * @return the <code>Class</code> object created from the data,
      *         and optional CodeSource.
--- a/jdk/src/share/classes/java/sql/DriverManager.java	Mon Apr 25 15:45:49 2011 -0700
+++ b/jdk/src/share/classes/java/sql/DriverManager.java	Wed Jul 05 17:42:16 2017 +0200
@@ -80,7 +80,7 @@
 
 
     // List of registered JDBC drivers
-    private final static CopyOnWriteArrayList<Driver> registeredDrivers = new CopyOnWriteArrayList<Driver>();
+    private final static CopyOnWriteArrayList<DriverInfo> registeredDrivers = new CopyOnWriteArrayList<DriverInfo>();
     private static volatile int loginTimeout = 0;
     private static volatile java.io.PrintWriter logWriter = null;
     private static volatile java.io.PrintStream logStream = null;
@@ -265,22 +265,22 @@
 
         // Walk through the loaded registeredDrivers attempting to locate someone
         // who understands the given URL.
-        for (Driver aDriver : registeredDrivers) {
+        for (DriverInfo aDriver : registeredDrivers) {
             // If the caller does not have permission to load the driver then
             // skip it.
-            if(isDriverAllowed(aDriver, callerCL)) {
+            if(isDriverAllowed(aDriver.driver, callerCL)) {
                 try {
-                    if(aDriver.acceptsURL(url)) {
+                    if(aDriver.driver.acceptsURL(url)) {
                         // Success!
-                        println("getDriver returning " + aDriver.getClass().getName());
-                    return (aDriver);
+                        println("getDriver returning " + aDriver.driver.getClass().getName());
+                    return (aDriver.driver);
                     }
 
                 } catch(SQLException sqe) {
                     // Drop through and try the next driver.
                 }
             } else {
-                println("    skipping: " + aDriver.getClass().getName());
+                println("    skipping: " + aDriver.driver.getClass().getName());
             }
 
         }
@@ -305,7 +305,7 @@
 
         /* Register the driver if it has not already been added to our list */
         if(driver != null) {
-            registeredDrivers.addIfAbsent(driver);
+            registeredDrivers.addIfAbsent(new DriverInfo(driver));
         } else {
             // This is for compatibility with the original DriverManager
             throw new NullPointerException();
@@ -333,9 +333,10 @@
         ClassLoader callerCL = DriverManager.getCallerClassLoader();
         println("DriverManager.deregisterDriver: " + driver);
 
-        if(registeredDrivers.contains(driver)) {
+        DriverInfo aDriver = new DriverInfo(driver);
+        if(registeredDrivers.contains(aDriver)) {
             if (isDriverAllowed(driver, callerCL)) {
-                 registeredDrivers.remove(driver);
+                 registeredDrivers.remove(aDriver);
             } else {
                 // If the caller does not have permission to load the driver then
                 // throw a SecurityException.
@@ -363,11 +364,11 @@
         ClassLoader callerCL = DriverManager.getCallerClassLoader();
 
         // Walk through the loaded registeredDrivers.
-        for(Driver aDriver : registeredDrivers) {
+        for(DriverInfo aDriver : registeredDrivers) {
             // If the caller does not have permission to load the driver then
             // skip it.
-            if(isDriverAllowed(aDriver, callerCL)) {
-                result.addElement(aDriver);
+            if(isDriverAllowed(aDriver.driver, callerCL)) {
+                result.addElement(aDriver.driver);
             } else {
                 println("    skipping: " + aDriver.getClass().getName());
             }
@@ -482,8 +483,8 @@
     private static void loadInitialDrivers() {
         String drivers;
         try {
-            drivers = (String)  AccessController.doPrivileged(new PrivilegedAction() {
-                public Object run() {
+            drivers = AccessController.doPrivileged(new PrivilegedAction<String>() {
+                public String run() {
                     return System.getProperty("jdbc.drivers");
                 }
             });
@@ -495,8 +496,8 @@
         // exposed as a java.sql.Driver.class service.
         // ServiceLoader.load() replaces the sun.misc.Providers()
 
-        AccessController.doPrivileged(new PrivilegedAction() {
-            public Object run() {
+        AccessController.doPrivileged(new PrivilegedAction<Void>() {
+            public Void run() {
 
                 ServiceLoader<Driver> loadedDrivers = ServiceLoader.load(Driver.class);
                 Iterator driversIterator = loadedDrivers.iterator();
@@ -569,16 +570,16 @@
         // Remember the first exception that gets raised so we can reraise it.
         SQLException reason = null;
 
-        for(Driver aDriver : registeredDrivers) {
+        for(DriverInfo aDriver : registeredDrivers) {
             // If the caller does not have permission to load the driver then
             // skip it.
-            if(isDriverAllowed(aDriver, callerCL)) {
+            if(isDriverAllowed(aDriver.driver, callerCL)) {
                 try {
-                    println("    trying " + aDriver.getClass().getName());
-                    Connection con = aDriver.connect(url, info);
+                    println("    trying " + aDriver.driver.getClass().getName());
+                    Connection con = aDriver.driver.connect(url, info);
                     if (con != null) {
                         // Success!
-                        println("getConnection returning " + aDriver.getClass().getName());
+                        println("getConnection returning " + aDriver.driver.getClass().getName());
                         return (con);
                     }
                 } catch (SQLException ex) {
@@ -607,3 +608,29 @@
     private static native ClassLoader getCallerClassLoader();
 
 }
+
+/*
+ * Wrapper class for registered Drivers in order to not expose Driver.equals()
+ * to avoid the capture of the Driver it being compared to as it might not
+ * normally have access.
+ */
+class DriverInfo {
+
+    final Driver driver;
+    DriverInfo(Driver driver) {
+        this.driver = driver;
+    }
+
+    public boolean equals(Object other) {
+        return (other instanceof DriverInfo)
+                && this.driver == ((DriverInfo) other).driver;
+    }
+
+    public int hashCode() {
+        return driver.hashCode();
+    }
+
+    public String toString() {
+        return ("driver[className="  + driver + "]");
+    }
+}
--- a/jdk/src/share/classes/java/sql/ResultSet.java	Mon Apr 25 15:45:49 2011 -0700
+++ b/jdk/src/share/classes/java/sql/ResultSet.java	Wed Jul 05 17:42:16 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2011, 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
@@ -137,7 +137,7 @@
  * to retrieve the next result from a sequence of multiple results.
  *
  * <P>The number, types and properties of a <code>ResultSet</code>
- * object's columns are provided by the <code>ResulSetMetaData</code>
+ * object's columns are provided by the <code>ResultSetMetaData</code>
  * object returned by the <code>ResultSet.getMetaData</code> method.
  *
  * @see Statement#executeQuery
@@ -422,7 +422,7 @@
      * of this <code>ResultSet</code> object as
      * a stream of ASCII characters. The value can then be read in chunks from the
      * stream. This method is particularly
-     * suitable for retrieving large <char>LONGVARCHAR</char> values.
+     * suitable for retrieving large <code>LONGVARCHAR</code> values.
      * The JDBC driver will
      * do any necessary conversion from the database format into ASCII.
      *
--- a/jdk/src/share/classes/java/sql/SQLPermission.java	Mon Apr 25 15:45:49 2011 -0700
+++ b/jdk/src/share/classes/java/sql/SQLPermission.java	Wed Jul 05 17:42:16 2017 +0200
@@ -116,11 +116,11 @@
 
     /**
      * Creates a new <code>SQLPermission</code> object with the specified name.
-     * The name is the symbolic name of the <code>SQLPermission</code>; currently,
-     * the only name allowed is "setLog".
+     * The name is the symbolic name of the <code>SQLPermission</code>.
      *
      * @param name the name of this <code>SQLPermission</code> object, which must
-         *             be <code>setLog</code>
+     * be either {@code  setLog}, {@code callAbort}, {@code setSyncFactory},
+     *  or {@code setNetworkTimeout}
      * @throws NullPointerException if <code>name</code> is <code>null</code>.
      * @throws IllegalArgumentException if <code>name</code> is empty.
 
@@ -134,10 +134,11 @@
      * Creates a new <code>SQLPermission</code> object with the specified name.
      * The name is the symbolic name of the <code>SQLPermission</code>; the
      * actions <code>String</code> is currently unused and should be
-         * <code>null</code>.
+     * <code>null</code>.
      *
      * @param name the name of this <code>SQLPermission</code> object, which must
-     *             be <code>setLog</code>
+     * be either {@code  setLog}, {@code callAbort}, {@code setSyncFactory},
+     *  or {@code setNetworkTimeout}
      * @param actions should be <code>null</code>
      * @throws NullPointerException if <code>name</code> is <code>null</code>.
      * @throws IllegalArgumentException if <code>name</code> is empty.
--- a/jdk/src/share/classes/java/sql/Timestamp.java	Mon Apr 25 15:45:49 2011 -0700
+++ b/jdk/src/share/classes/java/sql/Timestamp.java	Wed Jul 05 17:42:16 2017 +0200
@@ -54,7 +54,7 @@
  * As a result, the <code>Timestamp.equals(Object)</code>
  * method is not symmetric with respect to the
  * <code>java.util.Date.equals(Object)</code>
- * method.  Also, the <code>hashcode</code> method uses the underlying
+ * method.  Also, the <code>hashCode</code> method uses the underlying
  * <code>java.util.Date</code>
  * implementation and therefore does not include nanos in its computation.
  * <P>
@@ -515,6 +515,18 @@
       }
     }
 
+    /**
+     * {@inheritDoc}
+     *
+     * The {@code hashCode} method uses the underlying {@code java.util.Date}
+     * implementation and therefore does not include nanos in its computation.
+     *
+     */
+    @Override
+    public int hashCode() {
+        return super.hashCode();
+    }
+
     static final long serialVersionUID = 2745179027874758501L;
 
 }
--- a/jdk/src/share/classes/java/text/ChoiceFormat.java	Mon Apr 25 15:45:49 2011 -0700
+++ b/jdk/src/share/classes/java/text/ChoiceFormat.java	Wed Jul 05 17:42:16 2017 +0200
@@ -136,8 +136,8 @@
  * </pre>
  * </blockquote>
  * And the output result would be like the following:
+ * <blockquote>
  * <pre>
- * <blockquote>
  *   Format with -INF : is negative
  *   Format with -1.0 : is negative
  *   Format with 0 : is zero or fraction
--- a/jdk/src/share/classes/java/util/AbstractQueue.java	Mon Apr 25 15:45:49 2011 -0700
+++ b/jdk/src/share/classes/java/util/AbstractQueue.java	Wed Jul 05 17:42:16 2017 +0200
@@ -30,7 +30,7 @@
  *
  * Written by Doug Lea with assistance from members of JCP JSR-166
  * Expert Group and released to the public domain, as explained at
- * http://creativecommons.org/licenses/publicdomain
+ * http://creativecommons.org/publicdomain/zero/1.0/
  */
 
 package java.util;
--- a/jdk/src/share/classes/java/util/ArrayDeque.java	Mon Apr 25 15:45:49 2011 -0700
+++ b/jdk/src/share/classes/java/util/ArrayDeque.java	Wed Jul 05 17:42:16 2017 +0200
@@ -29,7 +29,7 @@
  * file:
  *
  * Written by Josh Bloch of Google Inc. and released to the public domain,
- * as explained at http://creativecommons.org/licenses/publicdomain.
+ * as explained at http://creativecommons.org/publicdomain/zero/1.0/.
  */
 
 package java.util;
--- a/jdk/src/share/classes/java/util/Deque.java	Mon Apr 25 15:45:49 2011 -0700
+++ b/jdk/src/share/classes/java/util/Deque.java	Wed Jul 05 17:42:16 2017 +0200
@@ -30,7 +30,7 @@
  *
  * Written by Doug Lea and Josh Bloch with assistance from members of
  * JCP JSR-166 Expert Group and released to the public domain, as explained
- * at http://creativecommons.org/licenses/publicdomain
+ * at http://creativecommons.org/publicdomain/zero/1.0/
  */
 
 package java.util;
--- a/jdk/src/share/classes/java/util/EnumMap.java	Mon Apr 25 15:45:49 2011 -0700
+++ b/jdk/src/share/classes/java/util/EnumMap.java	Wed Jul 05 17:42:16 2017 +0200
@@ -106,7 +106,7 @@
     /**
      * Distinguished non-null value for representing null values.
      */
-    private static final Object NULL = new Object();
+    private static final Object NULL = new Integer(0);
 
     private Object maskNull(Object value) {
         return (value == null ? NULL : value);
@@ -116,7 +116,7 @@
         return (V) (value == NULL ? null : value);
     }
 
-    private static Enum[] ZERO_LENGTH_ENUM_ARRAY = new Enum[0];
+    private static final Enum[] ZERO_LENGTH_ENUM_ARRAY = new Enum[0];
 
     /**
      * Creates an empty enum map with the specified key type.
@@ -464,6 +464,7 @@
         public Iterator<Map.Entry<K,V>> iterator() {
             return new EntryIterator();
         }
+
         public boolean contains(Object o) {
             if (!(o instanceof Map.Entry))
                 return false;
@@ -552,70 +553,82 @@
         }
     }
 
-    /**
-     * Since we don't use Entry objects, we use the Iterator itself as entry.
-     */
-    private class EntryIterator extends EnumMapIterator<Map.Entry<K,V>>
-        implements Map.Entry<K,V>
-    {
+    private class EntryIterator extends EnumMapIterator<Map.Entry<K,V>> {
+        private Entry lastReturnedEntry = null;
+
         public Map.Entry<K,V> next() {
             if (!hasNext())
                 throw new NoSuchElementException();
-            lastReturnedIndex = index++;
-            return this;
+            lastReturnedEntry = new Entry(index++);
+            return lastReturnedEntry;
         }
 
-        public K getKey() {
-            checkLastReturnedIndexForEntryUse();
-            return keyUniverse[lastReturnedIndex];
+        public void remove() {
+            lastReturnedIndex =
+                ((null == lastReturnedEntry) ? -1 : lastReturnedEntry.index);
+            super.remove();
+            lastReturnedEntry.index = lastReturnedIndex;
+            lastReturnedEntry = null;
         }
 
-        public V getValue() {
-            checkLastReturnedIndexForEntryUse();
-            return unmaskNull(vals[lastReturnedIndex]);
-        }
+        private class Entry implements Map.Entry<K,V> {
+            private int index;
 
-        public V setValue(V value) {
-            checkLastReturnedIndexForEntryUse();
-            V oldValue = unmaskNull(vals[lastReturnedIndex]);
-            vals[lastReturnedIndex] = maskNull(value);
-            return oldValue;
-        }
+            private Entry(int index) {
+                this.index = index;
+            }
 
-        public boolean equals(Object o) {
-            if (lastReturnedIndex < 0)
-                return o == this;
+            public K getKey() {
+                checkIndexForEntryUse();
+                return keyUniverse[index];
+            }
 
-            if (!(o instanceof Map.Entry))
-                return false;
-            Map.Entry e = (Map.Entry)o;
-            V ourValue = unmaskNull(vals[lastReturnedIndex]);
-            Object hisValue = e.getValue();
-            return e.getKey() == keyUniverse[lastReturnedIndex] &&
-                (ourValue == hisValue ||
-                 (ourValue != null && ourValue.equals(hisValue)));
-        }
+            public V getValue() {
+                checkIndexForEntryUse();
+                return unmaskNull(vals[index]);
+            }
 
-        public int hashCode() {
-            if (lastReturnedIndex < 0)
-                return super.hashCode();
+            public V setValue(V value) {
+                checkIndexForEntryUse();
+                V oldValue = unmaskNull(vals[index]);
+                vals[index] = maskNull(value);
+                return oldValue;
+            }
 
-            Object value = vals[lastReturnedIndex];
-            return keyUniverse[lastReturnedIndex].hashCode()
-                ^ (value == NULL ? 0 : value.hashCode());
-        }
+            public boolean equals(Object o) {
+                if (index < 0)
+                    return o == this;
 
-        public String toString() {
-            if (lastReturnedIndex < 0)
-                return super.toString();
+                if (!(o instanceof Map.Entry))
+                    return false;
 
-            return keyUniverse[lastReturnedIndex] + "="
-                + unmaskNull(vals[lastReturnedIndex]);
-        }
+                Map.Entry e = (Map.Entry)o;
+                V ourValue = unmaskNull(vals[index]);
+                Object hisValue = e.getValue();
+                return (e.getKey() == keyUniverse[index] &&
+                        (ourValue == hisValue ||
+                         (ourValue != null && ourValue.equals(hisValue))));
+            }
 
-        private void checkLastReturnedIndexForEntryUse() {
-            if (lastReturnedIndex < 0)
-                throw new IllegalStateException("Entry was removed");
+            public int hashCode() {
+                if (index < 0)
+                    return super.hashCode();
+
+                return entryHashCode(index);
+            }
+
+            public String toString() {
+                if (index < 0)
+                    return super.toString();
+
+                return keyUniverse[index] + "="
+                    + unmaskNull(vals[index]);
+            }
+
+            private void checkIndexForEntryUse() {
+                if (index < 0)
+                    throw new IllegalStateException("Entry was removed");
+            }
         }
     }
 
@@ -631,10 +644,35 @@
      * @return <tt>true</tt> if the specified object is equal to this map
      */
     public boolean equals(Object o) {
-        if (!(o instanceof EnumMap))
-            return super.equals(o);
+        if (this == o)
+            return true;
+        if (o instanceof EnumMap)
+            return equals((EnumMap)o);
+        if (!(o instanceof Map))
+            return false;
 
-        EnumMap em = (EnumMap)o;
+        Map<K,V> m = (Map<K,V>)o;
+        if (size != m.size())
+            return false;
+
+        for (int i = 0; i < keyUniverse.length; i++) {
+            if (null != vals[i]) {
+                K key = keyUniverse[i];
+                V value = unmaskNull(vals[i]);
+                if (null == value) {
+                    if (!((null == m.get(key)) && m.containsKey(key)))
+                       return false;
+                } else {
+                   if (!value.equals(m.get(key)))
+                      return false;
+                }
+            }
+        }
+
+        return true;
+    }
+
+    private boolean equals(EnumMap em) {
         if (em.keyType != keyType)
             return size == 0 && em.size == 0;
 
@@ -650,6 +688,26 @@
     }
 
     /**
+     * Returns the hash code value for this map.  The hash code of a map is
+     * defined to be the sum of the hash codes of each entry in the map.
+     */
+    public int hashCode() {
+        int h = 0;
+
+        for (int i = 0; i < keyUniverse.length; i++) {
+            if (null != vals[i]) {
+                h += entryHashCode(i);
+            }
+        }
+
+        return h;
+    }
+
+    private int entryHashCode(int index) {
+        return (keyUniverse[index].hashCode() ^ vals[index].hashCode());
+    }
+
+    /**
      * Returns a shallow copy of this enum map.  (The values themselves
      * are not cloned.
      *
@@ -705,9 +763,13 @@
         s.writeInt(size);
 
         // Write out keys and values (alternating)
-        for (Map.Entry<K,V> e :  entrySet()) {
-            s.writeObject(e.getKey());
-            s.writeObject(e.getValue());
+        int entriesToBeWritten = size;
+        for (int i = 0; entriesToBeWritten > 0; i++) {
+            if (null != vals[i]) {
+                s.writeObject(keyUniverse[i]);
+                s.writeObject(unmaskNull(vals[i]));
+                entriesToBeWritten--;
+            }
         }
     }
 
--- a/jdk/src/share/classes/java/util/Formatter.java	Mon Apr 25 15:45:49 2011 -0700
+++ b/jdk/src/share/classes/java/util/Formatter.java	Wed Jul 05 17:42:16 2017 +0200
@@ -1818,9 +1818,9 @@
  * </pre></blockquote>
  *
  * <p> The maximum number of arguments is limited by the maximum dimension of a
- * Java array as defined by the <a
- * href="http://java.sun.com/docs/books/vmspec/">Java Virtual Machine
- * Specification</a>.  If the argument index is does not correspond to an
+ * Java array as defined by
+ * <cite>The Java&trade; Virtual Machine Specification</cite>.
+ * If the argument index is does not correspond to an
  * available argument, then a {@link MissingFormatArgumentException} is thrown.
  *
  * <p> If there are more arguments than format specifiers, the extra arguments
@@ -2403,8 +2403,7 @@
      *         string.  If there are more arguments than format specifiers, the
      *         extra arguments are ignored.  The maximum number of arguments is
      *         limited by the maximum dimension of a Java array as defined by
-     *         the <a href="http://java.sun.com/docs/books/vmspec/">Java
-     *         Virtual Machine Specification</a>.
+     *         <cite>The Java&trade; Virtual Machine Specification</cite>.
      *
      * @throws  IllegalFormatException
      *          If a format string contains an illegal syntax, a format
@@ -2443,8 +2442,7 @@
      *         string.  If there are more arguments than format specifiers, the
      *         extra arguments are ignored.  The maximum number of arguments is
      *         limited by the maximum dimension of a Java array as defined by
-     *         the <a href="http://java.sun.com/docs/books/vmspec/">Java
-     *         Virtual Machine Specification</a>
+     *         <cite>The Java&trade; Virtual Machine Specification</cite>.
      *
      * @throws  IllegalFormatException
      *          If a format string contains an illegal syntax, a format
--- a/jdk/src/share/classes/java/util/IdentityHashMap.java	Mon Apr 25 15:45:49 2011 -0700
+++ b/jdk/src/share/classes/java/util/IdentityHashMap.java	Wed Jul 05 17:42:16 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2011, 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
@@ -829,71 +829,82 @@
         }
     }
 
-    /**
-     * Since we don't use Entry objects, we use the Iterator
-     * itself as an entry.
-     */
     private class EntryIterator
         extends IdentityHashMapIterator<Map.Entry<K,V>>
-        implements Map.Entry<K,V>
     {
+        private Entry lastReturnedEntry = null;
+
         public Map.Entry<K,V> next() {
-            nextIndex();
-            return this;
+            lastReturnedEntry = new Entry(nextIndex());
+            return lastReturnedEntry;
         }
 
-        public K getKey() {
-            // Provide a better exception than out of bounds index
-            if (lastReturnedIndex < 0)
-                throw new IllegalStateException("Entry was removed");
-
-            return (K) unmaskNull(traversalTable[lastReturnedIndex]);
+        public void remove() {
+            lastReturnedIndex =
+                ((null == lastReturnedEntry) ? -1 : lastReturnedEntry.index);
+            super.remove();
+            lastReturnedEntry.index = lastReturnedIndex;
+            lastReturnedEntry = null;
         }
 
-        public V getValue() {
-            // Provide a better exception than out of bounds index
-            if (lastReturnedIndex < 0)
-                throw new IllegalStateException("Entry was removed");
+        private class Entry implements Map.Entry<K,V> {
+            private int index;
 
-            return (V) traversalTable[lastReturnedIndex+1];
-        }
+            private Entry(int index) {
+                this.index = index;
+            }
 
-        public V setValue(V value) {
-            // It would be mean-spirited to proceed here if remove() called
-            if (lastReturnedIndex < 0)
-                throw new IllegalStateException("Entry was removed");
-            V oldValue = (V) traversalTable[lastReturnedIndex+1];
-            traversalTable[lastReturnedIndex+1] = value;
-            // if shadowing, force into main table
-            if (traversalTable != IdentityHashMap.this.table)
-                put((K) traversalTable[lastReturnedIndex], value);
-            return oldValue;
-        }
+            public K getKey() {
+                checkIndexForEntryUse();
+                return (K) unmaskNull(traversalTable[index]);
+            }
 
-        public boolean equals(Object o) {
-            if (lastReturnedIndex < 0)
-                return super.equals(o);
+            public V getValue() {
+                checkIndexForEntryUse();
+                return (V) traversalTable[index+1];
+            }
 
-            if (!(o instanceof Map.Entry))
-                return false;
-            Map.Entry e = (Map.Entry)o;
-            return e.getKey()   == getKey() &&
-                   e.getValue() == getValue();
-        }
+            public V setValue(V value) {
+                checkIndexForEntryUse();
+                V oldValue = (V) traversalTable[index+1];
+                traversalTable[index+1] = value;
+                // if shadowing, force into main table
+                if (traversalTable != IdentityHashMap.this.table)
+                    put((K) traversalTable[index], value);
+                return oldValue;
+            }
 
-        public int hashCode() {
-            if (lastReturnedIndex < 0)
-                return super.hashCode();
+            public boolean equals(Object o) {
+                if (index < 0)
+                    return super.equals(o);
 
-            return System.identityHashCode(getKey()) ^
-                   System.identityHashCode(getValue());
-        }
+                if (!(o instanceof Map.Entry))
+                    return false;
+                Map.Entry e = (Map.Entry)o;
+                return (e.getKey() == unmaskNull(traversalTable[index]) &&
+                       e.getValue() == traversalTable[index+1]);
+            }
 
-        public String toString() {
-            if (lastReturnedIndex < 0)
-                return super.toString();
+            public int hashCode() {
+                if (lastReturnedIndex < 0)
+                    return super.hashCode();
 
-            return getKey() + "=" + getValue();
+                return (System.identityHashCode(unmaskNull(traversalTable[index])) ^
+                       System.identityHashCode(traversalTable[index+1]));
+            }
+
+            public String toString() {
+                if (index < 0)
+                    return super.toString();
+
+                return (unmaskNull(traversalTable[index]) + "="
+                        + traversalTable[index+1]);
+            }
+
+            private void checkIndexForEntryUse() {
+                if (index < 0)
+                    throw new IllegalStateException("Entry was removed");
+            }
         }
     }
 
--- a/jdk/src/share/classes/java/util/Locale.java	Mon Apr 25 15:45:49 2011 -0700
+++ b/jdk/src/share/classes/java/util/Locale.java	Wed Jul 05 17:42:16 2017 +0200
@@ -51,13 +51,13 @@
 
 import sun.security.action.GetPropertyAction;
 import sun.util.LocaleServiceProviderPool;
-import sun.util.locale.AsciiUtil;
 import sun.util.locale.BaseLocale;
 import sun.util.locale.InternalLocaleBuilder;
 import sun.util.locale.LanguageTag;
 import sun.util.locale.LocaleExtensions;
 import sun.util.locale.LocaleObjectCache;
 import sun.util.locale.LocaleSyntaxException;
+import sun.util.locale.LocaleUtils;
 import sun.util.locale.ParseStatus;
 import sun.util.locale.UnicodeLocaleExtension;
 import sun.util.resources.LocaleData;
@@ -412,59 +412,59 @@
 
     /** Useful constant for language.
      */
-    static public final Locale ENGLISH = getInstance("en", "", "");
+    static public final Locale ENGLISH = createConstant("en", "");
 
     /** Useful constant for language.
      */
-    static public final Locale FRENCH = getInstance("fr", "", "");
+    static public final Locale FRENCH = createConstant("fr", "");
 
     /** Useful constant for language.
      */
-    static public final Locale GERMAN = getInstance("de", "", "");
+    static public final Locale GERMAN = createConstant("de", "");
 
     /** Useful constant for language.
      */
-    static public final Locale ITALIAN = getInstance("it", "", "");
+    static public final Locale ITALIAN = createConstant("it", "");
 
     /** Useful constant for language.
      */
-    static public final Locale JAPANESE = getInstance("ja", "", "");
+    static public final Locale JAPANESE = createConstant("ja", "");
 
     /** Useful constant for language.
      */
-    static public final Locale KOREAN = getInstance("ko", "", "");
+    static public final Locale KOREAN = createConstant("ko", "");
 
     /** Useful constant for language.
      */
-    static public final Locale CHINESE = getInstance("zh", "", "");
+    static public final Locale CHINESE = createConstant("zh", "");
 
     /** Useful constant for language.
      */
-    static public final Locale SIMPLIFIED_CHINESE = getInstance("zh", "CN", "");
+    static public final Locale SIMPLIFIED_CHINESE = createConstant("zh", "CN");
 
     /** Useful constant for language.
      */
-    static public final Locale TRADITIONAL_CHINESE = getInstance("zh", "TW", "");
+    static public final Locale TRADITIONAL_CHINESE = createConstant("zh", "TW");
 
     /** Useful constant for country.
      */
-    static public final Locale FRANCE = getInstance("fr", "FR", "");
+    static public final Locale FRANCE = createConstant("fr", "FR");
 
     /** Useful constant for country.
      */
-    static public final Locale GERMANY = getInstance("de", "DE", "");
+    static public final Locale GERMANY = createConstant("de", "DE");
 
     /** Useful constant for country.
      */
-    static public final Locale ITALY = getInstance("it", "IT", "");
+    static public final Locale ITALY = createConstant("it", "IT");
 
     /** Useful constant for country.
      */
-    static public final Locale JAPAN = getInstance("ja", "JP", "");
+    static public final Locale JAPAN = createConstant("ja", "JP");
 
     /** Useful constant for country.
      */
-    static public final Locale KOREA = getInstance("ko", "KR", "");
+    static public final Locale KOREA = createConstant("ko", "KR");
 
     /** Useful constant for country.
      */
@@ -480,19 +480,19 @@
 
     /** Useful constant for country.
      */
-    static public final Locale UK = getInstance("en", "GB", "");
+    static public final Locale UK = createConstant("en", "GB");
 
     /** Useful constant for country.
      */
-    static public final Locale US = getInstance("en", "US", "");
+    static public final Locale US = createConstant("en", "US");
 
     /** Useful constant for country.
      */
-    static public final Locale CANADA = getInstance("en", "CA", "");
+    static public final Locale CANADA = createConstant("en", "CA");
 
     /** Useful constant for country.
      */
-    static public final Locale CANADA_FRENCH = getInstance("fr", "CA", "");
+    static public final Locale CANADA_FRENCH = createConstant("fr", "CA");
 
     /**
      * Useful constant for the root locale.  The root locale is the locale whose
@@ -502,7 +502,7 @@
      *
      * @since 1.6
      */
-    static public final Locale ROOT = getInstance("", "", "");
+    static public final Locale ROOT = createConstant("", "");
 
     /**
      * The key for the private use extension ('x').
@@ -532,14 +532,14 @@
     private static final int DISPLAY_LANGUAGE = 0;
     private static final int DISPLAY_COUNTRY  = 1;
     private static final int DISPLAY_VARIANT  = 2;
-    private static final int DISPLAY_SCRIPT = 3;
+    private static final int DISPLAY_SCRIPT   = 3;
 
     /**
      * Private constructor used by getInstance method
      */
     private Locale(BaseLocale baseLocale, LocaleExtensions extensions) {
-        _baseLocale = baseLocale;
-        _extensions = extensions;
+        this.baseLocale = baseLocale;
+        this.localeExtensions = extensions;
     }
 
     /**
@@ -572,8 +572,8 @@
         if (language== null || country == null || variant == null) {
             throw new NullPointerException();
         }
-        _baseLocale = BaseLocale.getInstance(convertOldISOCodes(language), "", country, variant);
-        _extensions = getCompatibilityExtensions(language, "", country, variant);
+        baseLocale = BaseLocale.getInstance(convertOldISOCodes(language), "", country, variant);
+        localeExtensions = getCompatibilityExtensions(language, "", country, variant);
     }
 
     /**
@@ -627,6 +627,15 @@
     }
 
     /**
+     * This method must be called only for creating the Locale.*
+     * constants due to making shortcuts.
+     */
+    private static Locale createConstant(String lang, String country) {
+        BaseLocale base = BaseLocale.createInstance(lang, country);
+        return getInstance(base, null);
+    }
+
+    /**
      * Returns a <code>Locale</code> constructed from the given
      * <code>language</code>, <code>country</code> and
      * <code>variant</code>. If the same <code>Locale</code> instance
@@ -641,7 +650,7 @@
      * @exception NullPointerException if any argument is null.
      */
     static Locale getInstance(String language, String country, String variant) {
-        return getInstance(language, "", country, variant, LocaleExtensions.EMPTY_EXTENSIONS);
+        return getInstance(language, "", country, variant, null);
     }
 
     static Locale getInstance(String language, String script, String country,
@@ -651,10 +660,6 @@
         }
 
         if (extensions == null) {
-            extensions = LocaleExtensions.EMPTY_EXTENSIONS;
-        }
-
-        if (extensions.equals(LocaleExtensions.EMPTY_EXTENSIONS)) {
             extensions = getCompatibilityExtensions(language, script, country, variant);
         }
 
@@ -668,22 +673,33 @@
     }
 
     private static class Cache extends LocaleObjectCache<LocaleKey, Locale> {
-        public Cache() {
+        private Cache() {
         }
+
+        @Override
         protected Locale createObject(LocaleKey key) {
-            return new Locale(key._base, key._exts);
+            return new Locale(key.base, key.exts);
         }
     }
 
-    private static class LocaleKey {
-        private BaseLocale _base;
-        private LocaleExtensions _exts;
+    private static final class LocaleKey {
+        private final BaseLocale base;
+        private final LocaleExtensions exts;
+        private final int hash;
 
         private LocaleKey(BaseLocale baseLocale, LocaleExtensions extensions) {
-            _base = baseLocale;
-            _exts = extensions;
+            base = baseLocale;
+            exts = extensions;
+
+            // Calculate the hash value here because it's always used.
+            int h = base.hashCode();
+            if (exts != null) {
+                h ^= exts.hashCode();
+            }
+            hash = h;
         }
 
+        @Override
         public boolean equals(Object obj) {
             if (this == obj) {
                 return true;
@@ -692,11 +708,18 @@
                 return false;
             }
             LocaleKey other = (LocaleKey)obj;
-            return _base.equals(other._base) && _exts.equals(other._exts);
+            if (hash != other.hash || !base.equals(other.base)) {
+                return false;
+            }
+            if (exts == null) {
+                return other.exts == null;
+            }
+            return exts.equals(other.exts);
         }
 
+        @Override
         public int hashCode() {
-            return _base.hashCode() ^ _exts.hashCode();
+            return hash;
         }
     }
 
@@ -981,7 +1004,7 @@
      * @see #getDisplayLanguage
      */
     public String getLanguage() {
-        return _baseLocale.getLanguage();
+        return baseLocale.getLanguage();
     }
 
     /**
@@ -995,7 +1018,7 @@
      * @since 1.7
      */
     public String getScript() {
-        return _baseLocale.getScript();
+        return baseLocale.getScript();
     }
 
     /**
@@ -1007,7 +1030,7 @@
      * @see #getDisplayCountry
      */
     public String getCountry() {
-        return _baseLocale.getRegion();
+        return baseLocale.getRegion();
     }
 
     /**
@@ -1017,7 +1040,7 @@
      * @see #getDisplayVariant
      */
     public String getVariant() {
-        return _baseLocale.getVariant();
+        return baseLocale.getVariant();
     }
 
     /**
@@ -1039,7 +1062,7 @@
         if (!LocaleExtensions.isValidKey(key)) {
             throw new IllegalArgumentException("Ill-formed extension key: " + key);
         }
-        return _extensions.getExtensionValue(key);
+        return (localeExtensions == null) ? null : localeExtensions.getExtensionValue(key);
     }
 
     /**
@@ -1052,7 +1075,10 @@
      * @since 1.7
      */
     public Set<Character> getExtensionKeys() {
-        return _extensions.getKeys();
+        if (localeExtensions == null) {
+            return Collections.emptySet();
+        }
+        return localeExtensions.getKeys();
     }
 
     /**
@@ -1064,7 +1090,10 @@
      * @since 1.7
      */
     public Set<String> getUnicodeLocaleAttributes() {
-        return _extensions.getUnicodeLocaleAttributes();
+        if (localeExtensions == null) {
+            return Collections.emptySet();
+        }
+        return localeExtensions.getUnicodeLocaleAttributes();
     }
 
     /**
@@ -1085,7 +1114,7 @@
         if (!UnicodeLocaleExtension.isKey(key)) {
             throw new IllegalArgumentException("Ill-formed Unicode locale key: " + key);
         }
-        return _extensions.getUnicodeLocaleType(key);
+        return (localeExtensions == null) ? null : localeExtensions.getUnicodeLocaleType(key);
     }
 
     /**
@@ -1097,7 +1126,10 @@
      * @since 1.7
      */
     public Set<String> getUnicodeLocaleKeys() {
-        return _extensions.getUnicodeLocaleKeys();
+        if (localeExtensions == null) {
+            return Collections.emptySet();
+        }
+        return localeExtensions.getUnicodeLocaleKeys();
     }
 
     /**
@@ -1106,16 +1138,17 @@
      * @return base locale of this Locale
      */
     BaseLocale getBaseLocale() {
-        return _baseLocale;
+        return baseLocale;
     }
 
     /**
-     * Package local method returning the Locale's LocaleExtensions,
-     * used by ResourceBundle
-     * @return locale exnteions of this Locale
+     * Package private method returning the Locale's LocaleExtensions,
+     * used by ResourceBundle.
+     * @return locale exnteions of this Locale,
+     *         or {@code null} if no extensions are defined
      */
      LocaleExtensions getLocaleExtensions() {
-         return _extensions;
+         return localeExtensions;
      }
 
     /**
@@ -1160,26 +1193,27 @@
      * @see #getDisplayName
      * @see #toLanguageTag
      */
+    @Override
     public final String toString() {
-        boolean l = (_baseLocale.getLanguage().length() != 0);
-        boolean s = (_baseLocale.getScript().length() != 0);
-        boolean r = (_baseLocale.getRegion().length() != 0);
-        boolean v = (_baseLocale.getVariant().length() != 0);
-        boolean e = (_extensions.getID().length() != 0);
+        boolean l = (baseLocale.getLanguage().length() != 0);
+        boolean s = (baseLocale.getScript().length() != 0);
+        boolean r = (baseLocale.getRegion().length() != 0);
+        boolean v = (baseLocale.getVariant().length() != 0);
+        boolean e = (localeExtensions != null && localeExtensions.getID().length() != 0);
 
-        StringBuilder result = new StringBuilder(_baseLocale.getLanguage());
+        StringBuilder result = new StringBuilder(baseLocale.getLanguage());
         if (r || (l && (v || s || e))) {
             result.append('_')
-                .append(_baseLocale.getRegion()); // This may just append '_'
+                .append(baseLocale.getRegion()); // This may just append '_'
         }
         if (v && (l || r)) {
             result.append('_')
-                .append(_baseLocale.getVariant());
+                .append(baseLocale.getVariant());
         }
 
         if (s && (l || r)) {
             result.append("_#")
-                .append(_baseLocale.getScript());
+                .append(baseLocale.getScript());
         }
 
         if (e && (l || r)) {
@@ -1187,7 +1221,7 @@
             if (!s) {
                 result.append('#');
             }
-            result.append(_extensions.getID());
+            result.append(localeExtensions.getID());
         }
 
         return result.toString();
@@ -1261,7 +1295,7 @@
      * @since 1.7
      */
     public String toLanguageTag() {
-        LanguageTag tag = LanguageTag.parseLocale(_baseLocale, _extensions);
+        LanguageTag tag = LanguageTag.parseLocale(baseLocale, localeExtensions);
         StringBuilder buf = new StringBuilder();
 
         String subtag = tag.getLanguage();
@@ -1433,8 +1467,9 @@
         bldr.setLanguageTag(tag);
         BaseLocale base = bldr.getBaseLocale();
         LocaleExtensions exts = bldr.getLocaleExtensions();
-        if (exts.isEmpty() && base.getVariant().length() > 0) {
-            exts = getCompatibilityExtensions(base.getLanguage(), base.getScript(), base.getRegion(), base.getVariant());
+        if (exts == null && base.getVariant().length() > 0) {
+            exts = getCompatibilityExtensions(base.getLanguage(), base.getScript(),
+                                              base.getRegion(), base.getVariant());
         }
         return getInstance(base, exts);
     }
@@ -1454,7 +1489,7 @@
      * three-letter language abbreviation is not available for this locale.
      */
     public String getISO3Language() throws MissingResourceException {
-        String lang = _baseLocale.getLanguage();
+        String lang = baseLocale.getLanguage();
         if (lang.length() == 3) {
             return lang;
         }
@@ -1481,10 +1516,10 @@
      * three-letter country abbreviation is not available for this locale.
      */
     public String getISO3Country() throws MissingResourceException {
-        String country3 = getISO3Code(_baseLocale.getRegion(), LocaleISOData.isoCountryTable);
+        String country3 = getISO3Code(baseLocale.getRegion(), LocaleISOData.isoCountryTable);
         if (country3 == null) {
             throw new MissingResourceException("Couldn't find 3-letter country code for "
-                    + _baseLocale.getRegion(), "FormatData_" + toString(), "ShortCountry");
+                    + baseLocale.getRegion(), "FormatData_" + toString(), "ShortCountry");
         }
         return country3;
     }
@@ -1542,7 +1577,7 @@
      * @exception NullPointerException if <code>inLocale</code> is <code>null</code>
      */
     public String getDisplayLanguage(Locale inLocale) {
-        return getDisplayString(_baseLocale.getLanguage(), inLocale, DISPLAY_LANGUAGE);
+        return getDisplayString(baseLocale.getLanguage(), inLocale, DISPLAY_LANGUAGE);
     }
 
     /**
@@ -1568,7 +1603,7 @@
      * @since 1.7
      */
     public String getDisplayScript(Locale inLocale) {
-        return getDisplayString(_baseLocale.getScript(), inLocale, DISPLAY_SCRIPT);
+        return getDisplayString(baseLocale.getScript(), inLocale, DISPLAY_SCRIPT);
     }
 
     /**
@@ -1603,7 +1638,7 @@
      * @exception NullPointerException if <code>inLocale</code> is <code>null</code>
      */
     public String getDisplayCountry(Locale inLocale) {
-        return getDisplayString(_baseLocale.getRegion(), inLocale, DISPLAY_COUNTRY);
+        return getDisplayString(baseLocale.getRegion(), inLocale, DISPLAY_COUNTRY);
     }
 
     private String getDisplayString(String code, Locale inLocale, int type) {
@@ -1662,7 +1697,7 @@
      * @exception NullPointerException if <code>inLocale</code> is <code>null</code>
      */
     public String getDisplayVariant(Locale inLocale) {
-        if (_baseLocale.getVariant().length() == 0)
+        if (baseLocale.getVariant().length() == 0)
             return "";
 
         OpenListResourceBundle bundle = LocaleData.getLocaleNames(inLocale);
@@ -1758,7 +1793,7 @@
                 return formatList(variantNames, listPattern, listCompositionPattern);
             }
         }
-        ArrayList<String> names = new ArrayList<String>(4);
+        ArrayList<String> names = new ArrayList<>(4);
         if (languageName.length() != 0) {
             names.add(languageName);
         }
@@ -1833,10 +1868,14 @@
      * Since Locales are often used in hashtables, caches the value
      * for speed.
      */
+    @Override
     public int hashCode() {
         int hc = hashCodeValue;
         if (hc == 0) {
-            hc = _baseLocale.hashCode() ^ _extensions.hashCode();
+            hc = baseLocale.hashCode();
+            if (localeExtensions != null) {
+                hc ^= localeExtensions.hashCode();
+            }
             hashCodeValue = hc;
         }
         return hc;
@@ -1851,21 +1890,26 @@
      *
      * @return true if this Locale is equal to the specified object.
      */
-
+    @Override
     public boolean equals(Object obj) {
         if (this == obj)                      // quick check
             return true;
         if (!(obj instanceof Locale))
             return false;
-        BaseLocale otherBase = ((Locale)obj)._baseLocale;
-        LocaleExtensions otherExt = ((Locale)obj)._extensions;
-        return _baseLocale.equals(otherBase) && _extensions.equals(otherExt);
+        BaseLocale otherBase = ((Locale)obj).baseLocale;
+        if (!baseLocale.equals(otherBase)) {
+            return false;
+        }
+        if (localeExtensions == null) {
+            return ((Locale)obj).localeExtensions == null;
+        }
+        return localeExtensions.equals(((Locale)obj).localeExtensions);
     }
 
     // ================= privates =====================================
 
-    private transient BaseLocale _baseLocale;
-    private transient LocaleExtensions _extensions;
+    private transient BaseLocale baseLocale;
+    private transient LocaleExtensions localeExtensions;
 
     /**
      * Calculated hashcode
@@ -1883,7 +1927,7 @@
      */
     private String[] getDisplayVariantArray(OpenListResourceBundle bundle, Locale inLocale) {
         // Split the variant name into tokens separated by '_'.
-        StringTokenizer tokenizer = new StringTokenizer(_baseLocale.getVariant(), "_");
+        StringTokenizer tokenizer = new StringTokenizer(baseLocale.getVariant(), "_");
         String[] names = new String[tokenizer.countTokens()];
 
         // For each variant token, lookup the display name.  If
@@ -1996,11 +2040,11 @@
      */
     private void writeObject(ObjectOutputStream out) throws IOException {
         ObjectOutputStream.PutField fields = out.putFields();
-        fields.put("language", _baseLocale.getLanguage());
-        fields.put("script", _baseLocale.getScript());
-        fields.put("country", _baseLocale.getRegion());
-        fields.put("variant", _baseLocale.getVariant());
-        fields.put("extensions", _extensions.getID());
+        fields.put("language", baseLocale.getLanguage());
+        fields.put("script", baseLocale.getScript());
+        fields.put("country", baseLocale.getRegion());
+        fields.put("variant", baseLocale.getVariant());
+        fields.put("extensions", localeExtensions == null ? "" : localeExtensions.getID());
         fields.put("hashcode", -1); // place holder just for backward support
         out.writeFields();
     }
@@ -2020,13 +2064,17 @@
         String country = (String)fields.get("country", "");
         String variant = (String)fields.get("variant", "");
         String extStr = (String)fields.get("extensions", "");
-        _baseLocale = BaseLocale.getInstance(convertOldISOCodes(language), script, country, variant);
-        try {
-            InternalLocaleBuilder bldr = new InternalLocaleBuilder();
-            bldr.setExtensions(extStr);
-            _extensions = bldr.getLocaleExtensions();
-        } catch (LocaleSyntaxException e) {
-            throw new IllformedLocaleException(e.getMessage());
+        baseLocale = BaseLocale.getInstance(convertOldISOCodes(language), script, country, variant);
+        if (extStr.length() > 0) {
+            try {
+                InternalLocaleBuilder bldr = new InternalLocaleBuilder();
+                bldr.setExtensions(extStr);
+                localeExtensions = bldr.getLocaleExtensions();
+            } catch (LocaleSyntaxException e) {
+                throw new IllformedLocaleException(e.getMessage());
+            }
+        } else {
+            localeExtensions = null;
         }
     }
 
@@ -2045,8 +2093,8 @@
      * @throws java.io.ObjectStreamException
      */
     private Object readResolve() throws java.io.ObjectStreamException {
-        return getInstance(_baseLocale.getLanguage(), _baseLocale.getScript(),
-                _baseLocale.getRegion(), _baseLocale.getVariant(), _extensions);
+        return getInstance(baseLocale.getLanguage(), baseLocale.getScript(),
+                baseLocale.getRegion(), baseLocale.getVariant(), localeExtensions);
     }
 
     private static volatile String[] isoLanguages = null;
@@ -2056,7 +2104,7 @@
     private static String convertOldISOCodes(String language) {
         // we accept both the old and the new ISO codes for the languages whose ISO
         // codes have changed, but we always store the OLD code, for backward compatibility
-        language = AsciiUtil.toLowerString(language).intern();
+        language = LocaleUtils.toLowerString(language).intern();
         if (language == "he") {
             return "iw";
         } else if (language == "yi") {
@@ -2068,19 +2116,22 @@
         }
     }
 
-    private static LocaleExtensions getCompatibilityExtensions(String language, String script, String country, String variant) {
-        LocaleExtensions extensions = LocaleExtensions.EMPTY_EXTENSIONS;
+    private static LocaleExtensions getCompatibilityExtensions(String language,
+                                                               String script,
+                                                               String country,
+                                                               String variant) {
+        LocaleExtensions extensions = null;
         // Special cases for backward compatibility support
-        if (AsciiUtil.caseIgnoreMatch(language, "ja")
+        if (LocaleUtils.caseIgnoreMatch(language, "ja")
                 && script.length() == 0
-                && AsciiUtil.caseIgnoreMatch(country, "JP")
-                && AsciiUtil.caseIgnoreMatch(variant, "JP")) {
+                && LocaleUtils.caseIgnoreMatch(country, "jp")
+                && "JP".equals(variant)) {
             // ja_JP_JP -> u-ca-japanese (calendar = japanese)
             extensions = LocaleExtensions.CALENDAR_JAPANESE;
-        } else if (AsciiUtil.caseIgnoreMatch(language, "th")
+        } else if (LocaleUtils.caseIgnoreMatch(language, "th")
                 && script.length() == 0
-                && AsciiUtil.caseIgnoreMatch(country, "TH")
-                && AsciiUtil.caseIgnoreMatch(variant, "TH")) {
+                && LocaleUtils.caseIgnoreMatch(country, "th")
+                && "TH".equals(variant)) {
             // th_TH_TH -> u-nu-thai (numbersystem = thai)
             extensions = LocaleExtensions.NUMBER_THAI;
         }
@@ -2196,7 +2247,7 @@
      * @since 1.7
      */
     public static final class Builder {
-        private InternalLocaleBuilder _locbld;
+        private final InternalLocaleBuilder localeBuilder;
 
         /**
          * Constructs an empty Builder. The default value of all
@@ -2204,7 +2255,7 @@
          * empty string.
          */
         public Builder() {
-            _locbld = new InternalLocaleBuilder();
+            localeBuilder = new InternalLocaleBuilder();
         }
 
         /**
@@ -2229,7 +2280,7 @@
          */
         public Builder setLocale(Locale locale) {
             try {
-                _locbld.setLocale(locale._baseLocale, locale._extensions);
+                localeBuilder.setLocale(locale.baseLocale, locale.localeExtensions);
             } catch (LocaleSyntaxException e) {
                 throw new IllformedLocaleException(e.getMessage(), e.getErrorIndex());
             }
@@ -2259,8 +2310,7 @@
             if (sts.isError()) {
                 throw new IllformedLocaleException(sts.getErrorMessage(), sts.getErrorIndex());
             }
-            _locbld.setLanguageTag(tag);
-
+            localeBuilder.setLanguageTag(tag);
             return this;
         }
 
@@ -2279,7 +2329,7 @@
          */
         public Builder setLanguage(String language) {
             try {
-                _locbld.setLanguage(language);
+                localeBuilder.setLanguage(language);
             } catch (LocaleSyntaxException e) {
                 throw new IllformedLocaleException(e.getMessage(), e.getErrorIndex());
             }
@@ -2300,7 +2350,7 @@
          */
         public Builder setScript(String script) {
             try {
-                _locbld.setScript(script);
+                localeBuilder.setScript(script);
             } catch (LocaleSyntaxException e) {
                 throw new IllformedLocaleException(e.getMessage(), e.getErrorIndex());
             }
@@ -2325,7 +2375,7 @@
          */
         public Builder setRegion(String region) {
             try {
-                _locbld.setRegion(region);
+                localeBuilder.setRegion(region);
             } catch (LocaleSyntaxException e) {
                 throw new IllformedLocaleException(e.getMessage(), e.getErrorIndex());
             }
@@ -2352,7 +2402,7 @@
          */
         public Builder setVariant(String variant) {
             try {
-                _locbld.setVariant(variant);
+                localeBuilder.setVariant(variant);
             } catch (LocaleSyntaxException e) {
                 throw new IllformedLocaleException(e.getMessage(), e.getErrorIndex());
             }
@@ -2384,7 +2434,7 @@
          */
         public Builder setExtension(char key, String value) {
             try {
-                _locbld.setExtension(key, value);
+                localeBuilder.setExtension(key, value);
             } catch (LocaleSyntaxException e) {
                 throw new IllformedLocaleException(e.getMessage(), e.getErrorIndex());
             }
@@ -2414,7 +2464,7 @@
          */
         public Builder setUnicodeLocaleKeyword(String key, String type) {
             try {
-                _locbld.setUnicodeLocaleKeyword(key, type);
+                localeBuilder.setUnicodeLocaleKeyword(key, type);
             } catch (LocaleSyntaxException e) {
                 throw new IllformedLocaleException(e.getMessage(), e.getErrorIndex());
             }
@@ -2435,7 +2485,7 @@
          */
         public Builder addUnicodeLocaleAttribute(String attribute) {
             try {
-                _locbld.addUnicodeLocaleAttribute(attribute);
+                localeBuilder.addUnicodeLocaleAttribute(attribute);
             } catch (LocaleSyntaxException e) {
                 throw new IllformedLocaleException(e.getMessage(), e.getErrorIndex());
             }
@@ -2458,7 +2508,7 @@
          */
         public Builder removeUnicodeLocaleAttribute(String attribute) {
             try {
-                _locbld.removeUnicodeLocaleAttribute(attribute);
+                localeBuilder.removeUnicodeLocaleAttribute(attribute);
             } catch (LocaleSyntaxException e) {
                 throw new IllformedLocaleException(e.getMessage(), e.getErrorIndex());
             }
@@ -2471,7 +2521,7 @@
          * @return This builder.
          */
         public Builder clear() {
-            _locbld.clear();
+            localeBuilder.clear();
             return this;
         }
 
@@ -2483,7 +2533,7 @@
          * @see #setExtension(char, String)
          */
         public Builder clearExtensions() {
-            _locbld.clearExtensions();
+            localeBuilder.clearExtensions();
             return this;
         }
 
@@ -2498,9 +2548,9 @@
          * @return A Locale.
          */
         public Locale build() {
-            BaseLocale baseloc = _locbld.getBaseLocale();
-            LocaleExtensions extensions = _locbld.getLocaleExtensions();
-            if (extensions.isEmpty() && baseloc.getVariant().length() > 0) {
+            BaseLocale baseloc = localeBuilder.getBaseLocale();
+            LocaleExtensions extensions = localeBuilder.getLocaleExtensions();
+            if (extensions == null && baseloc.getVariant().length() > 0) {
                 extensions = getCompatibilityExtensions(baseloc.getLanguage(), baseloc.getScript(),
                         baseloc.getRegion(), baseloc.getVariant());
             }
--- a/jdk/src/share/classes/java/util/NavigableMap.java	Mon Apr 25 15:45:49 2011 -0700
+++ b/jdk/src/share/classes/java/util/NavigableMap.java	Wed Jul 05 17:42:16 2017 +0200
@@ -30,7 +30,7 @@
  *
  * Written by Doug Lea and Josh Bloch with assistance from members of JCP
  * JSR-166 Expert Group and released to the public domain, as explained at
- * http://creativecommons.org/licenses/publicdomain
+ * http://creativecommons.org/publicdomain/zero/1.0/
  */
 
 package java.util;
--- a/jdk/src/share/classes/java/util/NavigableSet.java	Mon Apr 25 15:45:49 2011 -0700
+++ b/jdk/src/share/classes/java/util/NavigableSet.java	Wed Jul 05 17:42:16 2017 +0200
@@ -30,7 +30,7 @@
  *
  * Written by Doug Lea and Josh Bloch with assistance from members of JCP
  * JSR-166 Expert Group and released to the public domain, as explained at
- * http://creativecommons.org/licenses/publicdomain
+ * http://creativecommons.org/publicdomain/zero/1.0/
  */
 
 package java.util;
--- a/jdk/src/share/classes/java/util/Properties.java	Mon Apr 25 15:45:49 2011 -0700
+++ b/jdk/src/share/classes/java/util/Properties.java	Wed Jul 05 17:42:16 2017 +0200
@@ -68,8 +68,9 @@
  * methods work the same way as the load(Reader)/store(Writer, String) pair, except
  * the input/output stream is encoded in ISO 8859-1 character encoding.
  * Characters that cannot be directly represented in this encoding can be written using
- * <a href="http://java.sun.com/docs/books/jls/third_edition/html/lexical.html#3.3">Unicode escapes</a>
- * ; only a single 'u' character is allowed in an escape
+ * Unicode escapes as defined in section 3.3 of
+ * <cite>The Java&trade; Language Specification</cite>;
+ * only a single 'u' character is allowed in an escape
  * sequence. The native2ascii tool can be used to convert property files to and
  * from other character encodings.
  *
@@ -272,11 +273,8 @@
      * <a name="unicodeescapes"></a>
      * Characters in keys and elements can be represented in escape
      * sequences similar to those used for character and string literals
-     * (see <a
-     * href="http://java.sun.com/docs/books/jls/third_edition/html/lexical.html#3.3">&sect;3.3</a>
-     * and <a
-     * href="http://java.sun.com/docs/books/jls/third_edition/html/lexical.html#3.10.6">&sect;3.10.6</a>
-     * of the <i>Java Language Specification</i>).
+     * (see sections 3.3 and 3.10.6 of
+     * <cite>The Java&trade; Language Specification</cite>).
      *
      * The differences from the character escape sequences and Unicode
      * escapes used for characters and strings are:
@@ -326,8 +324,9 @@
      * {@link #load(java.io.Reader) load(Reader)} and is assumed to use
      * the ISO 8859-1 character encoding; that is each byte is one Latin1
      * character. Characters not in Latin1, and certain special characters,
-     * are represented in keys and elements using
-     * <a href="http://java.sun.com/docs/books/jls/third_edition/html/lexical.html#3.3">Unicode escapes</a>.
+     * are represented in keys and elements using Unicode escapes as defined in
+     * section 3.3 of
+     * <cite>The Java&trade; Language Specification</cite>.
      * <p>
      * The specified stream remains open after this method returns.
      *
--- a/jdk/src/share/classes/java/util/PropertyResourceBundle.java	Mon Apr 25 15:45:49 2011 -0700
+++ b/jdk/src/share/classes/java/util/PropertyResourceBundle.java	Wed Jul 05 17:42:16 2017 +0200
@@ -104,8 +104,9 @@
  * from an InputStream or a Reader, which represents a property file.
  * Constructing a PropertyResourceBundle instance from an InputStream requires
  * that the input stream be encoded in ISO-8859-1.  In that case, characters
- * that cannot be represented in ISO-8859-1 encoding must be represented by
- * <a href="http://java.sun.com/docs/books/jls/third_edition/html/lexical.html#3.3">Unicode Escapes</a>,
+ * that cannot be represented in ISO-8859-1 encoding must be represented by Unicode Escapes
+ * as defined in section 3.3 of
+ * <cite>The Java&trade; Language Specification</cite>
  * whereas the other constructor which takes a Reader does not have that limitation.
  *
  * @see ResourceBundle
--- a/jdk/src/share/classes/java/util/Queue.java	Mon Apr 25 15:45:49 2011 -0700
+++ b/jdk/src/share/classes/java/util/Queue.java	Wed Jul 05 17:42:16 2017 +0200
@@ -30,7 +30,7 @@
  *
  * Written by Doug Lea with assistance from members of JCP JSR-166
  * Expert Group and released to the public domain, as explained at
- * http://creativecommons.org/licenses/publicdomain
+ * http://creativecommons.org/publicdomain/zero/1.0/
  */
 
 package java.util;
--- a/jdk/src/share/classes/java/util/ResourceBundle.java	Mon Apr 25 15:45:49 2011 -0700
+++ b/jdk/src/share/classes/java/util/ResourceBundle.java	Wed Jul 05 17:42:16 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2011, 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
@@ -57,7 +57,6 @@
 import java.util.jar.JarEntry;
 
 import sun.util.locale.BaseLocale;
-import sun.util.locale.LocaleExtensions;
 import sun.util.locale.LocaleObjectCache;
 
 
@@ -290,7 +289,7 @@
      * name for compatibility with some workarounds for bug 4212439.
      */
     private static final ConcurrentMap<CacheKey, BundleReference> cacheList
-        = new ConcurrentHashMap<CacheKey, BundleReference>(INITIAL_CACHE_SIZE);
+        = new ConcurrentHashMap<>(INITIAL_CACHE_SIZE);
 
     /**
      * Queue for reference objects referring to class loaders or bundles.
@@ -1755,7 +1754,7 @@
      * @since 1.6
      */
     public Set<String> keySet() {
-        Set<String> keys = new HashSet<String>();
+        Set<String> keys = new HashSet<>();
         for (ResourceBundle rb = this; rb != null; rb = rb.parent) {
             keys.addAll(rb.handleKeySet());
         }
@@ -1783,7 +1782,7 @@
         if (keySet == null) {
             synchronized (this) {
                 if (keySet == null) {
-                    Set<String> keys = new HashSet<String>();
+                    Set<String> keys = new HashSet<>();
                     Enumeration<String> enumKeys = getKeys();
                     while (enumKeys.hasMoreElements()) {
                         String key = enumKeys.nextElement();
@@ -2301,7 +2300,7 @@
             if (baseName == null) {
                 throw new NullPointerException();
             }
-            return new ArrayList<Locale>(CANDIDATES_CACHE.get(locale.getBaseLocale()));
+            return new ArrayList<>(CANDIDATES_CACHE.get(locale.getBaseLocale()));
         }
 
         private static final CandidateListCache CANDIDATES_CACHE = new CandidateListCache();
@@ -2327,14 +2326,14 @@
                 if (language.equals("nb") || isNorwegianBokmal) {
                     List<Locale> tmpList = getDefaultList("nb", script, region, variant);
                     // Insert a locale replacing "nb" with "no" for every list entry
-                    List<Locale> bokmalList = new LinkedList<Locale>();
+                    List<Locale> bokmalList = new LinkedList<>();
                     for (Locale l : tmpList) {
                         bokmalList.add(l);
                         if (l.getLanguage().length() == 0) {
                             break;
                         }
                         bokmalList.add(Locale.getInstance("no", l.getScript(), l.getCountry(),
-                                l.getVariant(), LocaleExtensions.EMPTY_EXTENSIONS));
+                                l.getVariant(), null));
                     }
                     return bokmalList;
                 } else if (language.equals("nn") || isNorwegianNynorsk) {
@@ -2374,7 +2373,7 @@
                 List<String> variants = null;
 
                 if (variant.length() > 0) {
-                    variants = new LinkedList<String>();
+                    variants = new LinkedList<>();
                     int idx = variant.length();
                     while (idx != -1) {
                         variants.add(variant.substring(0, idx));
@@ -2382,32 +2381,32 @@
                     }
                 }
 
-                LinkedList<Locale> list = new LinkedList<Locale>();
+                List<Locale> list = new LinkedList<>();
 
                 if (variants != null) {
                     for (String v : variants) {
-                        list.add(Locale.getInstance(language, script, region, v, LocaleExtensions.EMPTY_EXTENSIONS));
+                        list.add(Locale.getInstance(language, script, region, v, null));
                     }
                 }
                 if (region.length() > 0) {
-                    list.add(Locale.getInstance(language, script, region, "", LocaleExtensions.EMPTY_EXTENSIONS));
+                    list.add(Locale.getInstance(language, script, region, "", null));
                 }
                 if (script.length() > 0) {
-                    list.add(Locale.getInstance(language, script, "", "", LocaleExtensions.EMPTY_EXTENSIONS));
+                    list.add(Locale.getInstance(language, script, "", "", null));
 
                     // With script, after truncating variant, region and script,
                     // start over without script.
                     if (variants != null) {
                         for (String v : variants) {
-                            list.add(Locale.getInstance(language, "", region, v, LocaleExtensions.EMPTY_EXTENSIONS));
+                            list.add(Locale.getInstance(language, "", region, v, null));
                         }
                     }
                     if (region.length() > 0) {
-                        list.add(Locale.getInstance(language, "", region, "", LocaleExtensions.EMPTY_EXTENSIONS));
+                        list.add(Locale.getInstance(language, "", region, "", null));
                     }
                 }
                 if (language.length() > 0) {
-                    list.add(Locale.getInstance(language, "", "", "", LocaleExtensions.EMPTY_EXTENSIONS));
+                    list.add(Locale.getInstance(language, "", "", "", null));
                 }
                 // Add root locale at the end
                 list.add(Locale.ROOT);
--- a/jdk/src/share/classes/java/util/concurrent/AbstractExecutorService.java	Mon Apr 25 15:45:49 2011 -0700
+++ b/jdk/src/share/classes/java/util/concurrent/AbstractExecutorService.java	Wed Jul 05 17:42:16 2017 +0200
@@ -30,7 +30,7 @@
  *
  * Written by Doug Lea with assistance from members of JCP JSR-166
  * Expert Group and released to the public domain, as explained at
- * http://creativecommons.org/licenses/publicdomain
+ * http://creativecommons.org/publicdomain/zero/1.0/
  */
 
 package java.util.concurrent;
--- a/jdk/src/share/classes/java/util/concurrent/ArrayBlockingQueue.java	Mon Apr 25 15:45:49 2011 -0700
+++ b/jdk/src/share/classes/java/util/concurrent/ArrayBlockingQueue.java	Wed Jul 05 17:42:16 2017 +0200
@@ -30,7 +30,7 @@
  *
  * Written by Doug Lea with assistance from members of JCP JSR-166