changeset 5548:e2533d62ca88 jdk7u80-b01

Merge
author lana
date Tue, 03 Jun 2014 09:59:36 -0700
parents 89ea97c17f90 (current diff) 5a83d40edceb (diff)
children 42a819ab201a c1b245e7e701 699a0d90d7f4 6bee813b7b17
files
diffstat 12 files changed, 155 insertions(+), 43 deletions(-) [+]
line wrap: on
line diff
--- a/agent/src/os/linux/libproc.h	Tue May 20 12:34:04 2014 -0700
+++ b/agent/src/os/linux/libproc.h	Tue Jun 03 09:59:36 2014 -0700
@@ -34,19 +34,7 @@
 #include "libproc_md.h"
 #endif
 
-#if defined(sparc) || defined(sparcv9)
-/*
-  If _LP64 is defined ptrace.h should be taken from /usr/include/asm-sparc64
-  otherwise it should be from /usr/include/asm-sparc
-  These two files define pt_regs structure differently
-*/
-#ifdef _LP64
-#include "asm-sparc64/ptrace.h"
-#else
-#include "asm-sparc/ptrace.h"
-#endif
-
-#endif //sparc or sparcv9
+#include <linux/ptrace.h>
 
 /************************************************************************************
 
--- a/src/cpu/sparc/vm/assembler_sparc.hpp	Tue May 20 12:34:04 2014 -0700
+++ b/src/cpu/sparc/vm/assembler_sparc.hpp	Tue Jun 03 09:59:36 2014 -0700
@@ -1745,7 +1745,7 @@
 
   inline void swap( Register s1, Register s2, Register d );
   inline void swap( Register s1, int simm13a, Register d);
-  inline void swap( Address& a,               Register d, int offset = 0 );
+  inline void swap( const Address& a, Register d, int offset = 0 );
 
   // pp 232
 
--- a/src/cpu/sparc/vm/assembler_sparc.inline.hpp	Tue May 20 12:34:04 2014 -0700
+++ b/src/cpu/sparc/vm/assembler_sparc.inline.hpp	Tue Jun 03 09:59:36 2014 -0700
@@ -347,7 +347,7 @@
 inline void Assembler::swap(    Register s1, Register s2, Register d) { v9_dep();  emit_long( op(ldst_op) | rd(d) | op3(swap_op3) | rs1(s1) | rs2(s2) ); }
 inline void Assembler::swap(    Register s1, int simm13a, Register d) { v9_dep();  emit_data( op(ldst_op) | rd(d) | op3(swap_op3) | rs1(s1) | immed(true) | simm(simm13a, 13)); }
 
-inline void Assembler::swap(    Address& a, Register d, int offset ) {
+inline void Assembler::swap(    const Address& a, Register d, int offset ) {
   relocate(a.rspec(offset));
   if (a.has_index()) { assert(offset == 0, ""); swap( a.base(), a.index(), d         ); }
   else               {                          swap( a.base(), a.disp() + offset, d ); }
--- a/src/cpu/sparc/vm/frame_sparc.hpp	Tue May 20 12:34:04 2014 -0700
+++ b/src/cpu/sparc/vm/frame_sparc.hpp	Tue Jun 03 09:59:36 2014 -0700
@@ -282,8 +282,8 @@
 
   // next two fns read and write Lmonitors value,
  private:
-  BasicObjectLock* interpreter_frame_monitors()           const  { return *interpreter_frame_monitors_addr(); }
-  void interpreter_frame_set_monitors(BasicObjectLock* monitors) {        *interpreter_frame_monitors_addr() = monitors; }
+  BasicObjectLock* interpreter_frame_monitors() const;
+  void interpreter_frame_set_monitors(BasicObjectLock* monitors);
 #else
  public:
   inline interpreterState get_interpreterState() const {
--- a/src/cpu/sparc/vm/frame_sparc.inline.hpp	Tue May 20 12:34:04 2014 -0700
+++ b/src/cpu/sparc/vm/frame_sparc.inline.hpp	Tue Jun 03 09:59:36 2014 -0700
@@ -217,6 +217,13 @@
   return (methodOop*)sp_addr_at( Lmethod->sp_offset_in_saved_window());
 }
 
+inline BasicObjectLock* frame::interpreter_frame_monitors() const {
+  return *interpreter_frame_monitors_addr();
+}
+
+inline void frame::interpreter_frame_set_monitors(BasicObjectLock* monitors) {
+  *interpreter_frame_monitors_addr() = monitors;
+}
 
 // Constant pool cache
 
--- a/src/cpu/sparc/vm/stubGenerator_sparc.cpp	Tue May 20 12:34:04 2014 -0700
+++ b/src/cpu/sparc/vm/stubGenerator_sparc.cpp	Tue Jun 03 09:59:36 2014 -0700
@@ -89,7 +89,7 @@
  private:
 
 #ifdef PRODUCT
-#define inc_counter_np(a,b,c) (0)
+#define inc_counter_np(a,b,c)
 #else
 #define inc_counter_np(counter, t1, t2) \
   BLOCK_COMMENT("inc_counter " #counter); \
@@ -1126,7 +1126,7 @@
                                               Label& L_loop, bool use_prefetch, bool use_bis);
 
   void disjoint_copy_core(Register from, Register to, Register count, int log2_elem_size,
-                          int iter_size, CopyLoopFunc copy_loop_func) {
+                          int iter_size, StubGenerator::CopyLoopFunc copy_loop_func) {
     Label L_copy;
 
     assert(log2_elem_size <= 3, "the following code should be changed");
@@ -1277,7 +1277,7 @@
     __ inc(from, 8);
     __ sllx(O3, left_shift,  O3);
 
-    disjoint_copy_core(from, to, count, log2_elem_size, 16, copy_16_bytes_shift_loop);
+    disjoint_copy_core(from, to, count, log2_elem_size, 16, &StubGenerator::copy_16_bytes_shift_loop);
 
     __ inccc(count, count_dec>>1 ); // + 8 bytes
     __ brx(Assembler::negative, true, Assembler::pn, L_copy_last_bytes);
@@ -2156,7 +2156,7 @@
       __ dec(count, 4);   // The cmp at the beginning guaranty count >= 4
       __ sllx(O3, 32,  O3);
 
-      disjoint_copy_core(from, to, count, 2, 16, copy_16_bytes_loop);
+      disjoint_copy_core(from, to, count, 2, 16, &StubGenerator::copy_16_bytes_loop);
 
       __ br(Assembler::always, false, Assembler::pt, L_copy_4_bytes);
       __ delayed()->inc(count, 4); // restore 'count'
@@ -2437,7 +2437,7 @@
     // count >= 0 (original count - 8)
     __ mov(from, from64);
 
-    disjoint_copy_core(from64, to64, count, 3, 64, copy_64_bytes_loop);
+    disjoint_copy_core(from64, to64, count, 3, 64, &StubGenerator::copy_64_bytes_loop);
 
       // Restore O4(offset0), O5(offset8)
       __ sub(from64, from, offset0);
--- a/src/os_cpu/linux_sparc/vm/assembler_linux_sparc.cpp	Tue May 20 12:34:04 2014 -0700
+++ b/src/os_cpu/linux_sparc/vm/assembler_linux_sparc.cpp	Tue Jun 03 09:59:36 2014 -0700
@@ -28,7 +28,7 @@
 #include "runtime/os.hpp"
 #include "runtime/threadLocalStorage.hpp"
 
-#include <asm-sparc/traps.h>
+#include <asm/traps.h>
 
 void MacroAssembler::read_ccr_trap(Register ccr_save) {
   // No implementation
--- a/src/os_cpu/linux_sparc/vm/atomic_linux_sparc.inline.hpp	Tue May 20 12:34:04 2014 -0700
+++ b/src/os_cpu/linux_sparc/vm/atomic_linux_sparc.inline.hpp	Tue Jun 03 09:59:36 2014 -0700
@@ -79,12 +79,12 @@
   __asm__ volatile(
     "1: \n\t"
     " ldx    [%2], %%o2\n\t"
-    " add    %0, %%o2, %%o3\n\t"
+    " add    %1, %%o2, %%o3\n\t"
     " casx   [%2], %%o2, %%o3\n\t"
     " cmp    %%o2, %%o3\n\t"
     " bne    %%xcc, 1b\n\t"
     "  nop\n\t"
-    " add    %0, %%o2, %0\n\t"
+    " add    %1, %%o2, %0\n\t"
     : "=r" (rv)
     : "r" (add_value), "r" (dest)
     : "memory", "o2", "o3");
--- a/src/os_cpu/linux_sparc/vm/os_linux_sparc.cpp	Tue May 20 12:34:04 2014 -0700
+++ b/src/os_cpu/linux_sparc/vm/os_linux_sparc.cpp	Tue Jun 03 09:59:36 2014 -0700
@@ -302,29 +302,30 @@
   if (context == NULL) return;
 
   ucontext_t *uc = (ucontext_t*)context;
+  sigcontext* sc = (sigcontext*)context;
   intptr_t *sp = (intptr_t *)os::Linux::ucontext_get_sp(uc);
 
   st->print_cr("Register to memory mapping:");
   st->cr();
 
   // this is only for the "general purpose" registers
-  st->print("G1="); print_location(st, SIG_REGS(sc).u_regs[CON__G1]);
-  st->print("G2="); print_location(st, SIG_REGS(sc).u_regs[CON__G2]);
-  st->print("G3="); print_location(st, SIG_REGS(sc).u_regs[CON__G3]);
-  st->print("G4="); print_location(st, SIG_REGS(sc).u_regs[CON__G4]);
-  st->print("G5="); print_location(st, SIG_REGS(sc).u_regs[CON__G5]);
-  st->print("G6="); print_location(st, SIG_REGS(sc).u_regs[CON__G6]);
-  st->print("G7="); print_location(st, SIG_REGS(sc).u_regs[CON__G7]);
+  st->print("G1="); print_location(st, SIG_REGS(sc).u_regs[CON_G1]);
+  st->print("G2="); print_location(st, SIG_REGS(sc).u_regs[CON_G2]);
+  st->print("G3="); print_location(st, SIG_REGS(sc).u_regs[CON_G3]);
+  st->print("G4="); print_location(st, SIG_REGS(sc).u_regs[CON_G4]);
+  st->print("G5="); print_location(st, SIG_REGS(sc).u_regs[CON_G5]);
+  st->print("G6="); print_location(st, SIG_REGS(sc).u_regs[CON_G6]);
+  st->print("G7="); print_location(st, SIG_REGS(sc).u_regs[CON_G7]);
   st->cr();
 
-  st->print("O0="); print_location(st, SIG_REGS(sc).u_regs[CON__O0]);
-  st->print("O1="); print_location(st, SIG_REGS(sc).u_regs[CON__O1]);
-  st->print("O2="); print_location(st, SIG_REGS(sc).u_regs[CON__O2]);
-  st->print("O3="); print_location(st, SIG_REGS(sc).u_regs[CON__O3]);
-  st->print("O4="); print_location(st, SIG_REGS(sc).u_regs[CON__O4]);
-  st->print("O5="); print_location(st, SIG_REGS(sc).u_regs[CON__O5]);
-  st->print("O6="); print_location(st, SIG_REGS(sc).u_regs[CON__O6]);
-  st->print("O7="); print_location(st, SIG_REGS(sc).u_regs[CON__O7]);
+  st->print("O0="); print_location(st, SIG_REGS(sc).u_regs[CON_O0]);
+  st->print("O1="); print_location(st, SIG_REGS(sc).u_regs[CON_O1]);
+  st->print("O2="); print_location(st, SIG_REGS(sc).u_regs[CON_O2]);
+  st->print("O3="); print_location(st, SIG_REGS(sc).u_regs[CON_O3]);
+  st->print("O4="); print_location(st, SIG_REGS(sc).u_regs[CON_O4]);
+  st->print("O5="); print_location(st, SIG_REGS(sc).u_regs[CON_O5]);
+  st->print("O6="); print_location(st, SIG_REGS(sc).u_regs[CON_O6]);
+  st->print("O7="); print_location(st, SIG_REGS(sc).u_regs[CON_O7]);
   st->cr();
 
   st->print("L0="); print_location(st, sp[L0->sp_offset_in_saved_window()]);
@@ -525,7 +526,7 @@
   if (nativeInstruction_at(*pc)->is_ic_miss_trap()) {
 #ifdef ASSERT
 #ifdef TIERED
-    CodeBlob* cb = CodeCache::find_blob_unsafe(pc);
+    CodeBlob* cb = CodeCache::find_blob_unsafe(*pc);
     assert(cb->is_compiled_by_c2(), "Wrong compiler");
 #endif // TIERED
 #endif // ASSERT
--- a/src/share/vm/gc_implementation/g1/g1SATBCardTableModRefBS.cpp	Tue May 20 12:34:04 2014 -0700
+++ b/src/share/vm/gc_implementation/g1/g1SATBCardTableModRefBS.cpp	Tue Jun 03 09:59:36 2014 -0700
@@ -107,7 +107,15 @@
   jbyte *const first = byte_for(mr.start());
   jbyte *const last = byte_after(mr.last());
 
-  memset(first, g1_young_gen, last - first);
+  // Below we may use an explicit loop instead of memset() because on
+  // certain platforms memset() can give concurrent readers phantom zeros.
+  if (UseMemSetInBOT) {
+    memset(first, g1_young_gen, last - first);
+  } else {
+    for (jbyte* i = first; i < last; i++) {
+      *i = g1_young_gen;
+    }
+  }
 }
 
 #ifndef PRODUCT
--- a/src/share/vm/services/heapDumper.cpp	Tue May 20 12:34:04 2014 -0700
+++ b/src/share/vm/services/heapDumper.cpp	Tue Jun 03 09:59:36 2014 -0700
@@ -720,7 +720,7 @@
 
       // reflection and sun.misc.Unsafe classes may have a reference to a
       // klassOop so filter it out.
-      if (o != NULL && o->is_klass()) {
+      if (o != NULL && o->is_perm() && o->is_klass()) {
         o = NULL;
       }
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/gc/heap_inspection/TestG1ConcurrentGCHeapDump.java	Tue Jun 03 09:59:36 2014 -0700
@@ -0,0 +1,108 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test TestG1ConcurrentGCHeapDump
+ * @bug 8038925
+ * @summary Checks that a heap dump can be made with G1 when no fullgc
+ *          has been made
+ * @run main/othervm -Xms512m -Xmx1024m -XX:+ExplicitGCInvokesConcurrent TestG1ConcurrentGCHeapDump
+ */
+import java.util.List;
+import java.util.ArrayList;
+import java.util.LinkedList;
+
+import javax.management.MBeanServer;
+import java.lang.management.ManagementFactory;
+import java.lang.management.GarbageCollectorMXBean;
+
+import sun.management.ManagementFactoryHelper;
+import com.sun.management.HotSpotDiagnosticMXBean;
+import com.sun.management.VMOption;
+
+import java.io.IOException;
+
+import java.io.File;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.nio.file.Files;
+
+public class TestG1ConcurrentGCHeapDump {
+
+  private static final String HOTSPOT_BEAN_NAME =
+    "com.sun.management:type=HotSpotDiagnostic";
+
+  private static final String G1_OLD_BEAN_NAME =
+    "java.lang:type=GarbageCollector,name=G1 Old Generation";
+
+  private static MBeanServer server = ManagementFactory.getPlatformMBeanServer();
+
+  private static void dumpHeap() throws IOException {
+    HotSpotDiagnosticMXBean hotspot_bean =
+      ManagementFactory.newPlatformMXBeanProxy(server,
+          HOTSPOT_BEAN_NAME, HotSpotDiagnosticMXBean.class);
+
+    Path dir = Files.createTempDirectory("JDK-8038925_");
+    String file = dir + File.separator + "heapdump";
+    hotspot_bean.dumpHeap(file, false);
+    Files.delete(Paths.get(file));
+    Files.delete(dir);
+  }
+
+  private static void verifyNoFullGC() throws IOException {
+    GarbageCollectorMXBean g1_old_bean =
+      ManagementFactory.newPlatformMXBeanProxy(server,
+          G1_OLD_BEAN_NAME, GarbageCollectorMXBean.class);
+
+    if (g1_old_bean.getCollectionCount() != 0) {
+      throw new RuntimeException("A full GC has occured, this test will not work.");
+    }
+  }
+
+  public static void main(String[] args) throws IOException {
+    HotSpotDiagnosticMXBean diagnostic = ManagementFactoryHelper.getDiagnosticMXBean();
+    VMOption option = diagnostic.getVMOption("UseG1GC");
+    if (option.getValue().equals("false")) {
+      System.out.println("Skipping this test. It is only a G1 test.");
+      return;
+    }
+
+    // Create some dead objects
+    ArrayList<List<Integer>> arraylist = new ArrayList<List<Integer>>();
+    for (int i = 0; i < 2; i++) {
+      for (int j = 0; j < 100; j++) {
+        LinkedList<Integer> li = new LinkedList<Integer>();
+        arraylist.add(li);
+        for (int k = 0; k < 10000; k++) {
+          li.add(k);
+        }
+      }
+      arraylist = new ArrayList<List<Integer>>();
+      System.gc();
+    }
+    // Try to dump heap
+    dumpHeap();
+    // Make sure no full GC has happened, since test won't work if that is the case
+    verifyNoFullGC();
+  }
+}