< prev index next >

src/hotspot/share/gc/shenandoah/shenandoahAsserts.cpp

Print this page
*** 69,10 ***
--- 69,13 ---
    msg.append("    %3s allocated after mark start\n", ctx->allocated_after_mark_start(obj) ? "" : "not");
    msg.append("    %3s after update watermark\n",     cast_from_oop<HeapWord*>(obj) >= r->get_update_watermark() ? "" : "not");
    msg.append("    %3s marked strong\n",              ctx->is_marked_strong(obj) ? "" : "not");
    msg.append("    %3s marked weak\n",                ctx->is_marked_weak(obj) ? "" : "not");
    msg.append("    %3s in collection set\n",          heap->in_collection_set(obj) ? "" : "not");
+   if (heap->mode()->is_generational() && !obj->is_forwarded()) {
+     msg.append("  age: %d\n", obj->age());
+   }
    msg.append("  mark:%s\n", mw_ss.freeze());
    msg.append("  region: %s", ss.freeze());
  }
  
  void ShenandoahAsserts::print_non_obj(ShenandoahMessageBuffer& msg, void* loc) {

*** 422,11 ***
  
    if (lock->owned_by_self()) {
      return;
    }
  
!   ShenandoahMessageBuffer msg("Must ba at a Shenandoah safepoint or held %s lock", lock->name());
    report_vm_error(file, line, msg.buffer());
  }
  
  void ShenandoahAsserts::assert_heaplocked(const char* file, int line) {
    ShenandoahHeap* heap = ShenandoahHeap::heap();
--- 425,11 ---
  
    if (lock->owned_by_self()) {
      return;
    }
  
!   ShenandoahMessageBuffer msg("Must be at a Shenandoah safepoint or held %s lock", lock->name());
    report_vm_error(file, line, msg.buffer());
  }
  
  void ShenandoahAsserts::assert_heaplocked(const char* file, int line) {
    ShenandoahHeap* heap = ShenandoahHeap::heap();

*** 455,12 ***
  
    if (heap->lock()->owned_by_self()) {
      return;
    }
  
!   if (ShenandoahSafepoint::is_at_shenandoah_safepoint() && Thread::current()->is_VM_thread()) {
      return;
    }
  
    ShenandoahMessageBuffer msg("Heap lock must be owned by current thread, or be at safepoint");
    report_vm_error(file, line, msg.buffer());
  }
--- 458,57 ---
  
    if (heap->lock()->owned_by_self()) {
      return;
    }
  
!   if (ShenandoahSafepoint::is_at_shenandoah_safepoint()) {
      return;
    }
  
    ShenandoahMessageBuffer msg("Heap lock must be owned by current thread, or be at safepoint");
    report_vm_error(file, line, msg.buffer());
  }
+ 
+ void ShenandoahAsserts::assert_generational(const char* file, int line) {
+   if (ShenandoahHeap::heap()->mode()->is_generational()) {
+     return;
+   }
+ 
+   ShenandoahMessageBuffer msg("Must be in generational mode");
+   report_vm_error(file, line, msg.buffer());
+ }
+ 
+ void ShenandoahAsserts::assert_control_or_vm_thread_at_safepoint(bool at_safepoint, const char* file, int line) {
+   Thread* thr = Thread::current();
+   if (thr == ShenandoahHeap::heap()->control_thread()) {
+     return;
+   }
+   if (thr->is_VM_thread()) {
+     if (!at_safepoint) {
+       return;
+     } else if (SafepointSynchronize::is_at_safepoint()) {
+       return;
+     }
+   }
+ 
+   ShenandoahMessageBuffer msg("Must be either control thread, or vm thread");
+   if (at_safepoint) {
+     msg.append(" at a safepoint");
+   }
+   report_vm_error(file, line, msg.buffer());
+ }
+ 
+ void ShenandoahAsserts::assert_generations_reconciled(const char* file, int line) {
+   if (!SafepointSynchronize::is_at_safepoint()) {
+     return;
+   }
+ 
+   ShenandoahHeap* heap = ShenandoahHeap::heap();
+   ShenandoahGeneration* ggen = heap->gc_generation();
+   ShenandoahGeneration* agen = heap->active_generation();
+   if (agen == ggen) {
+     return;
+   }
+ 
+   ShenandoahMessageBuffer msg("Active(%d) & GC(%d) Generations aren't reconciled", agen->type(), ggen->type());
+   report_vm_error(file, line, msg.buffer());
+ }
< prev index next >