< prev index next >

src/hotspot/share/gc/z/zForwarding.cpp

Print this page




  41 void ZForwarding::destroy(ZForwarding* forwarding) {
  42   AttachedArray::free(forwarding);
  43 }
  44 
  45 ZForwarding::ZForwarding(ZPage* page, uint32_t nentries) :
  46     _virtual(page->virtual_memory()),
  47     _object_alignment_shift(page->object_alignment_shift()),
  48     _entries(nentries),
  49     _page(page),
  50     _refcount(1),
  51     _pinned(false) {}
  52 
  53 void ZForwarding::verify() const {
  54   guarantee(_refcount > 0, "Invalid refcount");
  55   guarantee(_page != NULL, "Invalid page");
  56 
  57   uint32_t live_objects = 0;
  58 
  59   for (ZForwardingCursor i = 0; i < _entries.length(); i++) {
  60     const ZForwardingEntry entry = at(&i);
  61     if (entry.is_empty()) {
  62       // Skip empty entries
  63       continue;
  64     }
  65 
  66     // Check from index
  67     guarantee(entry.from_index() < _page->object_max_count(), "Invalid from index");
  68 
  69     // Check for duplicates
  70     for (ZForwardingCursor j = i + 1; j < _entries.length(); j++) {
  71       const ZForwardingEntry other = at(&j);
  72       guarantee(entry.from_index() != other.from_index(), "Duplicate from");
  73       guarantee(entry.to_offset() != other.to_offset(), "Duplicate to");
  74     }
  75 
  76     live_objects++;
  77   }
  78 
  79   // Check number of non-empty entries
  80   guarantee(live_objects == _page->live_objects(), "Invalid number of entries");
  81 }


  41 void ZForwarding::destroy(ZForwarding* forwarding) {
  42   AttachedArray::free(forwarding);
  43 }
  44 
  45 ZForwarding::ZForwarding(ZPage* page, uint32_t nentries) :
  46     _virtual(page->virtual_memory()),
  47     _object_alignment_shift(page->object_alignment_shift()),
  48     _entries(nentries),
  49     _page(page),
  50     _refcount(1),
  51     _pinned(false) {}
  52 
  53 void ZForwarding::verify() const {
  54   guarantee(_refcount > 0, "Invalid refcount");
  55   guarantee(_page != NULL, "Invalid page");
  56 
  57   uint32_t live_objects = 0;
  58 
  59   for (ZForwardingCursor i = 0; i < _entries.length(); i++) {
  60     const ZForwardingEntry entry = at(&i);
  61     if (!entry.populated()) {
  62       // Skip empty entries
  63       continue;
  64     }
  65 
  66     // Check from index
  67     guarantee(entry.from_index() < _page->object_max_count(), "Invalid from index");
  68 
  69     // Check for duplicates
  70     for (ZForwardingCursor j = i + 1; j < _entries.length(); j++) {
  71       const ZForwardingEntry other = at(&j);
  72       guarantee(entry.from_index() != other.from_index(), "Duplicate from");
  73       guarantee(entry.to_offset() != other.to_offset(), "Duplicate to");
  74     }
  75 
  76     live_objects++;
  77   }
  78 
  79   // Check number of non-empty entries
  80   guarantee(live_objects == _page->live_objects(), "Invalid number of entries");
  81 }
< prev index next >