Merge

Fri, 30 Oct 2009 13:31:11 -0400

author
tonyp
date
Fri, 30 Oct 2009 13:31:11 -0400
changeset 1483
29adffcb6a61
parent 1477
4926bf2d292f
parent 1482
beb8f45ee9f0
child 1484
a6280c71758e
child 1486
26f1542097f1
child 1500
c4ecde2f6b3c

Merge

     1.1 --- a/src/cpu/x86/vm/assembler_x86.cpp	Thu Oct 29 08:49:31 2009 -0700
     1.2 +++ b/src/cpu/x86/vm/assembler_x86.cpp	Fri Oct 30 13:31:11 2009 -0400
     1.3 @@ -8214,6 +8214,15 @@
     1.4    }
     1.5  }
     1.6  
     1.7 +// Used for storing NULLs.
     1.8 +void MacroAssembler::store_heap_oop_null(Address dst) {
     1.9 +  if (UseCompressedOops) {
    1.10 +    movl(dst, (int32_t)NULL_WORD);
    1.11 +  } else {
    1.12 +    movslq(dst, (int32_t)NULL_WORD);
    1.13 +  }
    1.14 +}
    1.15 +
    1.16  // Algorithm must match oop.inline.hpp encode_heap_oop.
    1.17  void MacroAssembler::encode_heap_oop(Register r) {
    1.18    assert (UseCompressedOops, "should be compressed");
     2.1 --- a/src/cpu/x86/vm/assembler_x86.hpp	Thu Oct 29 08:49:31 2009 -0700
     2.2 +++ b/src/cpu/x86/vm/assembler_x86.hpp	Fri Oct 30 13:31:11 2009 -0400
     2.3 @@ -1682,6 +1682,17 @@
     2.4  
     2.5    void load_heap_oop(Register dst, Address src);
     2.6    void store_heap_oop(Address dst, Register src);
     2.7 +
     2.8 +  // This dummy is to prevent a call to store_heap_oop from
     2.9 +  // converting a zero (like NULL) into a Register by giving
    2.10 +  // the compiler two choices it can't resolve
    2.11 +
    2.12 +  void store_heap_oop(Address dst, void* dummy);
    2.13 +
    2.14 +  // Used for storing NULL. All other oop constants should be
    2.15 +  // stored using routines that take a jobject.
    2.16 +  void store_heap_oop_null(Address dst);
    2.17 +
    2.18    void encode_heap_oop(Register r);
    2.19    void decode_heap_oop(Register r);
    2.20    void encode_heap_oop_not_null(Register r);
     3.1 --- a/src/cpu/x86/vm/templateTable_x86_64.cpp	Thu Oct 29 08:49:31 2009 -0700
     3.2 +++ b/src/cpu/x86/vm/templateTable_x86_64.cpp	Fri Oct 30 13:31:11 2009 -0400
     3.3 @@ -139,7 +139,7 @@
     3.4          }
     3.5          __ g1_write_barrier_pre(rdx, r8, rbx, val != noreg);
     3.6          if (val == noreg) {
     3.7 -          __ store_heap_oop(Address(rdx, 0), NULL_WORD);
     3.8 +          __ store_heap_oop_null(Address(rdx, 0));
     3.9          } else {
    3.10            __ store_heap_oop(Address(rdx, 0), val);
    3.11            __ g1_write_barrier_post(rdx, val, r8, rbx);
    3.12 @@ -152,7 +152,7 @@
    3.13      case BarrierSet::CardTableExtension:
    3.14        {
    3.15          if (val == noreg) {
    3.16 -          __ store_heap_oop(obj, NULL_WORD);
    3.17 +          __ store_heap_oop_null(obj);
    3.18          } else {
    3.19            __ store_heap_oop(obj, val);
    3.20            // flatten object address if needed
    3.21 @@ -168,7 +168,7 @@
    3.22      case BarrierSet::ModRef:
    3.23      case BarrierSet::Other:
    3.24        if (val == noreg) {
    3.25 -        __ store_heap_oop(obj, NULL_WORD);
    3.26 +        __ store_heap_oop_null(obj);
    3.27        } else {
    3.28          __ store_heap_oop(obj, val);
    3.29        }
     4.1 --- a/src/share/vm/gc_implementation/g1/concurrentMark.cpp	Thu Oct 29 08:49:31 2009 -0700
     4.2 +++ b/src/share/vm/gc_implementation/g1/concurrentMark.cpp	Fri Oct 30 13:31:11 2009 -0400
     4.3 @@ -667,39 +667,6 @@
     4.4  // Called at the first checkpoint.
     4.5  //
     4.6  
     4.7 -#define PRINT_REACHABLE_AT_INITIAL_MARK 0
     4.8 -#if PRINT_REACHABLE_AT_INITIAL_MARK
     4.9 -static FILE* reachable_file = NULL;
    4.10 -
    4.11 -class PrintReachableClosure: public OopsInGenClosure {
    4.12 -  CMBitMap* _bm;
    4.13 -  int _level;
    4.14 -public:
    4.15 -  PrintReachableClosure(CMBitMap* bm) :
    4.16 -    _bm(bm), _level(0) {
    4.17 -    guarantee(reachable_file != NULL, "pre-condition");
    4.18 -  }
    4.19 -  void do_oop(oop* p) {
    4.20 -    oop obj = *p;
    4.21 -    HeapWord* obj_addr = (HeapWord*)obj;
    4.22 -    if (obj == NULL) return;
    4.23 -    fprintf(reachable_file, "%d: "PTR_FORMAT" -> "PTR_FORMAT" (%d)\n",
    4.24 -            _level, p, (void*) obj, _bm->isMarked(obj_addr));
    4.25 -    if (!_bm->isMarked(obj_addr)) {
    4.26 -      _bm->mark(obj_addr);
    4.27 -      _level++;
    4.28 -      obj->oop_iterate(this);
    4.29 -      _level--;
    4.30 -    }
    4.31 -  }
    4.32 -};
    4.33 -#endif // PRINT_REACHABLE_AT_INITIAL_MARK
    4.34 -
    4.35 -#define SEND_HEAP_DUMP_TO_FILE 0
    4.36 -#if SEND_HEAP_DUMP_TO_FILE
    4.37 -static FILE* heap_dump_file = NULL;
    4.38 -#endif // SEND_HEAP_DUMP_TO_FILE
    4.39 -
    4.40  void ConcurrentMark::clearNextBitmap() {
    4.41     guarantee(!G1CollectedHeap::heap()->mark_in_progress(), "Precondition.");
    4.42  
    4.43 @@ -737,32 +704,9 @@
    4.44  
    4.45    _has_aborted = false;
    4.46  
    4.47 -  // Find all the reachable objects...
    4.48 -#if PRINT_REACHABLE_AT_INITIAL_MARK
    4.49 -  guarantee(reachable_file == NULL, "Protocol");
    4.50 -  char fn_buf[100];
    4.51 -  sprintf(fn_buf, "/tmp/reachable.txt.%d", os::current_process_id());
    4.52 -  reachable_file = fopen(fn_buf, "w");
    4.53 -  // clear the mark bitmap (no grey objects to start with)
    4.54 -  _nextMarkBitMap->clearAll();
    4.55 -  PrintReachableClosure prcl(_nextMarkBitMap);
    4.56 -  g1h->process_strong_roots(true,    // activate StrongRootsScope
    4.57 -                            false,   // fake perm gen collection
    4.58 -                            SharedHeap::SO_AllClasses,
    4.59 -                            &prcl, // Regular roots
    4.60 -                            NULL,  // do not visit active blobs
    4.61 -                            &prcl    // Perm Gen Roots
    4.62 -                            );
    4.63 -  // The root iteration above "consumed" dirty cards in the perm gen.
    4.64 -  // Therefore, as a shortcut, we dirty all such cards.
    4.65 -  g1h->rem_set()->invalidate(g1h->perm_gen()->used_region(), false);
    4.66 -  fclose(reachable_file);
    4.67 -  reachable_file = NULL;
    4.68 -  // clear the mark bitmap again.
    4.69 -  _nextMarkBitMap->clearAll();
    4.70 -  COMPILER2_PRESENT(DerivedPointerTable::update_pointers());
    4.71 -  COMPILER2_PRESENT(DerivedPointerTable::clear());
    4.72 -#endif // PRINT_REACHABLE_AT_INITIAL_MARK
    4.73 +  if (G1PrintReachableAtInitialMark) {
    4.74 +    print_reachable(true, "before");
    4.75 +  }
    4.76  
    4.77    // Initialise marking structures. This has to be done in a STW phase.
    4.78    reset();
    4.79 @@ -1965,15 +1909,21 @@
    4.80  #endif
    4.81  }
    4.82  
    4.83 +#ifndef PRODUCT
    4.84 +
    4.85  class ReachablePrinterOopClosure: public OopClosure {
    4.86  private:
    4.87    G1CollectedHeap* _g1h;
    4.88    CMBitMapRO*      _bitmap;
    4.89    outputStream*    _out;
    4.90 +  bool             _use_prev_marking;
    4.91  
    4.92  public:
    4.93 -  ReachablePrinterOopClosure(CMBitMapRO* bitmap, outputStream* out) :
    4.94 -    _bitmap(bitmap), _g1h(G1CollectedHeap::heap()), _out(out) { }
    4.95 +  ReachablePrinterOopClosure(CMBitMapRO*   bitmap,
    4.96 +                             outputStream* out,
    4.97 +                             bool          use_prev_marking) :
    4.98 +    _g1h(G1CollectedHeap::heap()),
    4.99 +    _bitmap(bitmap), _out(out), _use_prev_marking(use_prev_marking) { }
   4.100  
   4.101    void do_oop(narrowOop* p) { do_oop_work(p); }
   4.102    void do_oop(      oop* p) { do_oop_work(p); }
   4.103 @@ -1988,14 +1938,23 @@
   4.104      else {
   4.105        HeapRegion* hr  = _g1h->heap_region_containing(obj);
   4.106        guarantee(hr != NULL, "invariant");
   4.107 -      if (hr->obj_allocated_since_prev_marking(obj)) {
   4.108 +      bool over_tams = false;
   4.109 +      if (_use_prev_marking) {
   4.110 +        over_tams = hr->obj_allocated_since_prev_marking(obj);
   4.111 +      } else {
   4.112 +        over_tams = hr->obj_allocated_since_next_marking(obj);
   4.113 +      }
   4.114 +
   4.115 +      if (over_tams) {
   4.116          str = "over TAMS";
   4.117 -        if (_bitmap->isMarked((HeapWord*) obj))
   4.118 +        if (_bitmap->isMarked((HeapWord*) obj)) {
   4.119            str2 = " AND MARKED";
   4.120 -      } else if (_bitmap->isMarked((HeapWord*) obj))
   4.121 +        }
   4.122 +      } else if (_bitmap->isMarked((HeapWord*) obj)) {
   4.123          str = "marked";
   4.124 -      else
   4.125 +      } else {
   4.126          str = "#### NOT MARKED ####";
   4.127 +      }
   4.128      }
   4.129  
   4.130      _out->print_cr("    "PTR_FORMAT" contains "PTR_FORMAT" %s%s",
   4.131 @@ -2005,16 +1964,19 @@
   4.132  
   4.133  class ReachablePrinterClosure: public BitMapClosure {
   4.134  private:
   4.135 -  CMBitMapRO* _bitmap;
   4.136 +  CMBitMapRO*   _bitmap;
   4.137    outputStream* _out;
   4.138 +  bool          _use_prev_marking;
   4.139  
   4.140  public:
   4.141 -  ReachablePrinterClosure(CMBitMapRO* bitmap, outputStream* out) :
   4.142 -    _bitmap(bitmap), _out(out) { }
   4.143 +  ReachablePrinterClosure(CMBitMapRO*   bitmap,
   4.144 +                          outputStream* out,
   4.145 +                          bool          use_prev_marking) :
   4.146 +    _bitmap(bitmap), _out(out), _use_prev_marking(use_prev_marking) { }
   4.147  
   4.148    bool do_bit(size_t offset) {
   4.149      HeapWord* addr = _bitmap->offsetToHeapWord(offset);
   4.150 -    ReachablePrinterOopClosure oopCl(_bitmap, _out);
   4.151 +    ReachablePrinterOopClosure oopCl(_bitmap, _out, _use_prev_marking);
   4.152  
   4.153      _out->print_cr("  obj "PTR_FORMAT", offset %10d (marked)", addr, offset);
   4.154      oop(addr)->oop_iterate(&oopCl);
   4.155 @@ -2026,76 +1988,111 @@
   4.156  
   4.157  class ObjInRegionReachablePrinterClosure : public ObjectClosure {
   4.158  private:
   4.159 -  CMBitMapRO* _bitmap;
   4.160 +  CMBitMapRO*   _bitmap;
   4.161    outputStream* _out;
   4.162 +  bool          _use_prev_marking;
   4.163  
   4.164  public:
   4.165 +  ObjInRegionReachablePrinterClosure(CMBitMapRO*   bitmap,
   4.166 +                                     outputStream* out,
   4.167 +                                     bool          use_prev_marking) :
   4.168 +    _bitmap(bitmap), _out(out), _use_prev_marking(use_prev_marking) { }
   4.169 +
   4.170    void do_object(oop o) {
   4.171 -    ReachablePrinterOopClosure oopCl(_bitmap, _out);
   4.172 +    ReachablePrinterOopClosure oopCl(_bitmap, _out, _use_prev_marking);
   4.173  
   4.174      _out->print_cr("  obj "PTR_FORMAT" (over TAMS)", (void*) o);
   4.175      o->oop_iterate(&oopCl);
   4.176      _out->print_cr("");
   4.177    }
   4.178 -
   4.179 -  ObjInRegionReachablePrinterClosure(CMBitMapRO* bitmap, outputStream* out) :
   4.180 -    _bitmap(bitmap), _out(out) { }
   4.181  };
   4.182  
   4.183  class RegionReachablePrinterClosure : public HeapRegionClosure {
   4.184  private:
   4.185 -  CMBitMapRO* _bitmap;
   4.186 +  CMBitMapRO*   _bitmap;
   4.187    outputStream* _out;
   4.188 +  bool          _use_prev_marking;
   4.189  
   4.190  public:
   4.191    bool doHeapRegion(HeapRegion* hr) {
   4.192      HeapWord* b = hr->bottom();
   4.193      HeapWord* e = hr->end();
   4.194      HeapWord* t = hr->top();
   4.195 -    HeapWord* p = hr->prev_top_at_mark_start();
   4.196 +    HeapWord* p = NULL;
   4.197 +    if (_use_prev_marking) {
   4.198 +      p = hr->prev_top_at_mark_start();
   4.199 +    } else {
   4.200 +      p = hr->next_top_at_mark_start();
   4.201 +    }
   4.202      _out->print_cr("** ["PTR_FORMAT", "PTR_FORMAT"] top: "PTR_FORMAT" "
   4.203 -                   "PTAMS: "PTR_FORMAT, b, e, t, p);
   4.204 +                   "TAMS: "PTR_FORMAT, b, e, t, p);
   4.205      _out->print_cr("");
   4.206  
   4.207 -    ObjInRegionReachablePrinterClosure ocl(_bitmap, _out);
   4.208 +    ObjInRegionReachablePrinterClosure ocl(_bitmap, _out, _use_prev_marking);
   4.209      hr->object_iterate_mem_careful(MemRegion(p, t), &ocl);
   4.210  
   4.211      return false;
   4.212    }
   4.213  
   4.214 -  RegionReachablePrinterClosure(CMBitMapRO* bitmap,
   4.215 -                                outputStream* out) :
   4.216 -    _bitmap(bitmap), _out(out) { }
   4.217 +  RegionReachablePrinterClosure(CMBitMapRO*   bitmap,
   4.218 +                                outputStream* out,
   4.219 +                                bool          use_prev_marking) :
   4.220 +    _bitmap(bitmap), _out(out), _use_prev_marking(use_prev_marking) { }
   4.221  };
   4.222  
   4.223 -void ConcurrentMark::print_prev_bitmap_reachable() {
   4.224 -  outputStream* out = gclog_or_tty;
   4.225 -
   4.226 -#if SEND_HEAP_DUMP_TO_FILE
   4.227 -  guarantee(heap_dump_file == NULL, "Protocol");
   4.228 -  char fn_buf[100];
   4.229 -  sprintf(fn_buf, "/tmp/dump.txt.%d", os::current_process_id());
   4.230 -  heap_dump_file = fopen(fn_buf, "w");
   4.231 -  fileStream fstream(heap_dump_file);
   4.232 -  out = &fstream;
   4.233 -#endif // SEND_HEAP_DUMP_TO_FILE
   4.234 -
   4.235 -  RegionReachablePrinterClosure rcl(_prevMarkBitMap, out);
   4.236 -  out->print_cr("--- ITERATING OVER REGIONS WITH PTAMS < TOP");
   4.237 +void ConcurrentMark::print_reachable(bool use_prev_marking, const char* str) {
   4.238 +  gclog_or_tty->print_cr("== Doing reachable object dump... ");
   4.239 +
   4.240 +  if (G1PrintReachableBaseFile == NULL) {
   4.241 +    gclog_or_tty->print_cr("  #### error: no base file defined");
   4.242 +    return;
   4.243 +  }
   4.244 +
   4.245 +  if (strlen(G1PrintReachableBaseFile) + 1 + strlen(str) >
   4.246 +      (JVM_MAXPATHLEN - 1)) {
   4.247 +    gclog_or_tty->print_cr("  #### error: file name too long");
   4.248 +    return;
   4.249 +  }
   4.250 +
   4.251 +  char file_name[JVM_MAXPATHLEN];
   4.252 +  sprintf(file_name, "%s.%s", G1PrintReachableBaseFile, str);
   4.253 +  gclog_or_tty->print_cr("  dumping to file %s", file_name);
   4.254 +
   4.255 +  fileStream fout(file_name);
   4.256 +  if (!fout.is_open()) {
   4.257 +    gclog_or_tty->print_cr("  #### error: could not open file");
   4.258 +    return;
   4.259 +  }
   4.260 +
   4.261 +  outputStream* out = &fout;
   4.262 +
   4.263 +  CMBitMapRO* bitmap = NULL;
   4.264 +  if (use_prev_marking) {
   4.265 +    bitmap = _prevMarkBitMap;
   4.266 +  } else {
   4.267 +    bitmap = _nextMarkBitMap;
   4.268 +  }
   4.269 +
   4.270 +  out->print_cr("-- USING %s", (use_prev_marking) ? "PTAMS" : "NTAMS");
   4.271 +  out->cr();
   4.272 +
   4.273 +  RegionReachablePrinterClosure rcl(bitmap, out, use_prev_marking);
   4.274 +  out->print_cr("--- ITERATING OVER REGIONS WITH TAMS < TOP");
   4.275 +  out->cr();
   4.276    _g1h->heap_region_iterate(&rcl);
   4.277 -  out->print_cr("");
   4.278 -
   4.279 -  ReachablePrinterClosure cl(_prevMarkBitMap, out);
   4.280 -  out->print_cr("--- REACHABLE OBJECTS ON THE BITMAP");
   4.281 -  _prevMarkBitMap->iterate(&cl);
   4.282 -  out->print_cr("");
   4.283 -
   4.284 -#if SEND_HEAP_DUMP_TO_FILE
   4.285 -  fclose(heap_dump_file);
   4.286 -  heap_dump_file = NULL;
   4.287 -#endif // SEND_HEAP_DUMP_TO_FILE
   4.288 +  out->cr();
   4.289 +
   4.290 +  ReachablePrinterClosure cl(bitmap, out, use_prev_marking);
   4.291 +  out->print_cr("--- ITERATING OVER MARKED OBJECTS ON THE BITMAP");
   4.292 +  out->cr();
   4.293 +  bitmap->iterate(&cl);
   4.294 +  out->cr();
   4.295 +
   4.296 +  gclog_or_tty->print_cr("  done");
   4.297  }
   4.298  
   4.299 +#endif // PRODUCT
   4.300 +
   4.301  // This note is for drainAllSATBBuffers and the code in between.
   4.302  // In the future we could reuse a task to do this work during an
   4.303  // evacuation pause (since now tasks are not active and can be claimed
     5.1 --- a/src/share/vm/gc_implementation/g1/concurrentMark.hpp	Thu Oct 29 08:49:31 2009 -0700
     5.2 +++ b/src/share/vm/gc_implementation/g1/concurrentMark.hpp	Fri Oct 30 13:31:11 2009 -0400
     5.3 @@ -612,10 +612,11 @@
     5.4    // we do nothing.
     5.5    void markAndGrayObjectIfNecessary(oop p);
     5.6  
     5.7 -  // This iterates over the bitmap of the previous marking and prints
     5.8 -  // out all objects that are marked on the bitmap and indicates
     5.9 -  // whether what they point to is also marked or not.
    5.10 -  void print_prev_bitmap_reachable();
    5.11 +  // This iterates over the marking bitmap (either prev or next) and
    5.12 +  // prints out all objects that are marked on the bitmap and indicates
    5.13 +  // whether what they point to is also marked or not. It also iterates
    5.14 +  // the objects over TAMS (either prev or next).
    5.15 +  void print_reachable(bool use_prev_marking, const char* str);
    5.16  
    5.17    // Clear the next marking bitmap (will be called concurrently).
    5.18    void clearNextBitmap();
     6.1 --- a/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp	Thu Oct 29 08:49:31 2009 -0700
     6.2 +++ b/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp	Fri Oct 30 13:31:11 2009 -0400
     6.3 @@ -2371,8 +2371,9 @@
     6.4        gclog_or_tty->print_cr("Heap:");
     6.5        print_on(gclog_or_tty, true /* extended */);
     6.6        gclog_or_tty->print_cr("");
     6.7 -      if (VerifyDuringGC && G1VerifyConcMarkPrintReachable) {
     6.8 -        concurrent_mark()->print_prev_bitmap_reachable();
     6.9 +      if (VerifyDuringGC && G1VerifyDuringGCPrintReachable) {
    6.10 +        concurrent_mark()->print_reachable(use_prev_marking,
    6.11 +                                           "failed-verification");
    6.12        }
    6.13        gclog_or_tty->flush();
    6.14      }
    6.15 @@ -3135,7 +3136,7 @@
    6.16           _evac_failure_scan_stack->length() == 0,
    6.17           "Postcondition");
    6.18    assert(!_drain_in_progress, "Postcondition");
    6.19 -  // Don't have to delete, since the scan stack is a resource object.
    6.20 +  delete _evac_failure_scan_stack;
    6.21    _evac_failure_scan_stack = NULL;
    6.22  }
    6.23  
     7.1 --- a/src/share/vm/gc_implementation/g1/g1CollectorPolicy.cpp	Thu Oct 29 08:49:31 2009 -0700
     7.2 +++ b/src/share/vm/gc_implementation/g1/g1CollectorPolicy.cpp	Fri Oct 30 13:31:11 2009 -0400
     7.3 @@ -1516,7 +1516,8 @@
     7.4        (end_time_sec - _recent_prev_end_times_for_all_gcs_sec->oldest()) * 1000.0;
     7.5      update_recent_gc_times(end_time_sec, elapsed_ms);
     7.6      _recent_avg_pause_time_ratio = _recent_gc_times_ms->sum()/interval_ms;
     7.7 -    assert(recent_avg_pause_time_ratio() < 1.00, "All GC?");
     7.8 +    // using 1.01 to account for floating point inaccuracies
     7.9 +    assert(recent_avg_pause_time_ratio() < 1.01, "All GC?");
    7.10    }
    7.11  
    7.12    if (G1PolicyVerbose > 1) {
     8.1 --- a/src/share/vm/gc_implementation/g1/g1_globals.hpp	Thu Oct 29 08:49:31 2009 -0700
     8.2 +++ b/src/share/vm/gc_implementation/g1/g1_globals.hpp	Fri Oct 30 13:31:11 2009 -0400
     8.3 @@ -55,8 +55,14 @@
     8.4    develop(intx, G1MarkingVerboseLevel, 0,                                   \
     8.5            "Level (0-4) of verboseness of the marking code")                 \
     8.6                                                                              \
     8.7 -  develop(bool, G1VerifyConcMarkPrintReachable, false,                      \
     8.8 -          "If conc mark verification fails, print reachable objects")       \
     8.9 +  develop(bool, G1PrintReachableAtInitialMark, false,                       \
    8.10 +          "Reachable object dump at the initial mark pause")                \
    8.11 +                                                                            \
    8.12 +  develop(bool, G1VerifyDuringGCPrintReachable, false,                      \
    8.13 +          "If conc mark verification fails, dump reachable objects")        \
    8.14 +                                                                            \
    8.15 +  develop(ccstr, G1PrintReachableBaseFile, NULL,                            \
    8.16 +          "The base file name for the reachable object dumps")              \
    8.17                                                                              \
    8.18    develop(bool, G1TraceMarkStackOverflow, false,                            \
    8.19            "If true, extra debugging code for CM restart for ovflw.")        \
     9.1 --- a/src/share/vm/gc_implementation/g1/sparsePRT.cpp	Thu Oct 29 08:49:31 2009 -0700
     9.2 +++ b/src/share/vm/gc_implementation/g1/sparsePRT.cpp	Fri Oct 30 13:31:11 2009 -0400
     9.3 @@ -135,7 +135,6 @@
     9.4    _occupied_entries(0), _occupied_cards(0),
     9.5    _entries(NEW_C_HEAP_ARRAY(SparsePRTEntry, capacity)),
     9.6    _buckets(NEW_C_HEAP_ARRAY(int, capacity)),
     9.7 -  _next_deleted(NULL), _deleted(false),
     9.8    _free_list(NullEntry), _free_region(0)
     9.9  {
    9.10    clear();
    9.11 @@ -296,40 +295,6 @@
    9.12    assert(e2->num_valid_cards() > 0, "Postcondition.");
    9.13  }
    9.14  
    9.15 -RSHashTable* RSHashTable::_head_deleted_list = NULL;
    9.16 -
    9.17 -void RSHashTable::add_to_deleted_list(RSHashTable* rsht) {
    9.18 -  assert(!rsht->deleted(), "Should delete only once.");
    9.19 -  rsht->set_deleted(true);
    9.20 -  RSHashTable* hd = _head_deleted_list;
    9.21 -  while (true) {
    9.22 -    rsht->_next_deleted = hd;
    9.23 -    RSHashTable* res =
    9.24 -      (RSHashTable*)
    9.25 -      Atomic::cmpxchg_ptr(rsht, &_head_deleted_list, hd);
    9.26 -    if (res == hd) return;
    9.27 -    else hd = res;
    9.28 -  }
    9.29 -}
    9.30 -
    9.31 -RSHashTable* RSHashTable::get_from_deleted_list() {
    9.32 -  RSHashTable* hd = _head_deleted_list;
    9.33 -  while (hd != NULL) {
    9.34 -    RSHashTable* next = hd->next_deleted();
    9.35 -    RSHashTable* res =
    9.36 -      (RSHashTable*)
    9.37 -      Atomic::cmpxchg_ptr(next, &_head_deleted_list, hd);
    9.38 -    if (res == hd) {
    9.39 -      hd->set_next_deleted(NULL);
    9.40 -      hd->set_deleted(false);
    9.41 -      return hd;
    9.42 -    } else {
    9.43 -      hd = res;
    9.44 -    }
    9.45 -  }
    9.46 -  return NULL;
    9.47 -}
    9.48 -
    9.49  CardIdx_t /* RSHashTable:: */ RSHashTableIter::find_first_card_in_list() {
    9.50    CardIdx_t res;
    9.51    while (_bl_ind != RSHashTable::NullEntry) {
    9.52 @@ -442,15 +407,6 @@
    9.53      sprt->cleanup();
    9.54      sprt = get_from_expanded_list();
    9.55    }
    9.56 -  // Now delete all deleted RSHashTables.
    9.57 -  RSHashTable* rsht = RSHashTable::get_from_deleted_list();
    9.58 -  while (rsht != NULL) {
    9.59 -#if SPARSE_PRT_VERBOSE
    9.60 -    gclog_or_tty->print_cr("About to delete RSHT " PTR_FORMAT ".", rsht);
    9.61 -#endif
    9.62 -    delete rsht;
    9.63 -    rsht = RSHashTable::get_from_deleted_list();
    9.64 -  }
    9.65  }
    9.66  
    9.67  
    9.68 @@ -511,8 +467,10 @@
    9.69  }
    9.70  
    9.71  void SparsePRT::cleanup() {
    9.72 -  // Make sure that the current and next tables agree.  (Another mechanism
    9.73 -  // takes care of deleting now-unused tables.)
    9.74 +  // Make sure that the current and next tables agree.
    9.75 +  if (_cur != _next) {
    9.76 +    delete _cur;
    9.77 +  }
    9.78    _cur = _next;
    9.79    set_expanded(false);
    9.80  }
    9.81 @@ -535,7 +493,8 @@
    9.82        _next->add_entry(e);
    9.83      }
    9.84    }
    9.85 -  if (last != _cur)
    9.86 -    RSHashTable::add_to_deleted_list(last);
    9.87 +  if (last != _cur) {
    9.88 +    delete last;
    9.89 +  }
    9.90    add_to_expanded_list(this);
    9.91  }
    10.1 --- a/src/share/vm/gc_implementation/g1/sparsePRT.hpp	Thu Oct 29 08:49:31 2009 -0700
    10.2 +++ b/src/share/vm/gc_implementation/g1/sparsePRT.hpp	Fri Oct 30 13:31:11 2009 -0400
    10.3 @@ -102,13 +102,6 @@
    10.4    int  _free_region;
    10.5    int  _free_list;
    10.6  
    10.7 -  static RSHashTable* _head_deleted_list;
    10.8 -  RSHashTable* _next_deleted;
    10.9 -  RSHashTable* next_deleted() { return _next_deleted; }
   10.10 -  void set_next_deleted(RSHashTable* rsht) { _next_deleted = rsht; }
   10.11 -  bool _deleted;
   10.12 -  void set_deleted(bool b) { _deleted = b; }
   10.13 -
   10.14    // Requires that the caller hold a lock preventing parallel modifying
   10.15    // operations, and that the the table be less than completely full.  If
   10.16    // an entry for "region_ind" is already in the table, finds it and
   10.17 @@ -154,14 +147,10 @@
   10.18    size_t occupied_entries() const { return _occupied_entries; }
   10.19    size_t occupied_cards() const   { return _occupied_cards;   }
   10.20    size_t mem_size() const;
   10.21 -  bool deleted() { return _deleted; }
   10.22  
   10.23    SparsePRTEntry* entry(int i) const { return &_entries[i]; }
   10.24  
   10.25    void print();
   10.26 -
   10.27 -  static void add_to_deleted_list(RSHashTable* rsht);
   10.28 -  static RSHashTable* get_from_deleted_list();
   10.29  };
   10.30  
   10.31  // ValueObj because will be embedded in HRRS iterator.
    11.1 --- a/src/share/vm/services/heapDumper.cpp	Thu Oct 29 08:49:31 2009 -0700
    11.2 +++ b/src/share/vm/services/heapDumper.cpp	Fri Oct 30 13:31:11 2009 -0400
    11.3 @@ -1913,8 +1913,9 @@
    11.4      if (use_default_filename) {
    11.5        char fn[32];
    11.6        sprintf(fn, "java_pid%d", os::current_process_id());
    11.7 -      assert(strlen(base_path) + strlen(fn) < sizeof(base_path), "HeapDumpPath too long");
    11.8 +      assert(strlen(base_path) + strlen(fn) + strlen(".hprof") < sizeof(base_path), "HeapDumpPath too long");
    11.9        strcat(base_path, fn);
   11.10 +      strcat(base_path, ".hprof");
   11.11      }
   11.12      assert(strlen(base_path) < sizeof(my_path), "Buffer too small");
   11.13      strcpy(my_path, base_path);
   11.14 @@ -1927,8 +1928,6 @@
   11.15      strcat(my_path, fn);
   11.16    }
   11.17    dump_file_seq++;   // increment seq number for next time we dump
   11.18 -  assert(strlen(".hprof") + strlen(my_path) < sizeof(my_path), "HeapDumpPath too long");
   11.19 -  strcat(my_path, ".hprof");
   11.20  
   11.21    HeapDumper dumper(false /* no GC before heap dump */,
   11.22                      true  /* send to tty */);

mercurial