< prev index next >

src/share/vm/gc/g1/g1BlockOffsetTable.inline.hpp

Print this page
rev 12060 : imported patch block_start_acquire


 119   uint offset = _bot->offset_array(index);  // Extend u_char to uint.
 120   while (offset >= BOTConstants::N_words) {
 121     // The excess of the offset from N_words indicates a power of Base
 122     // to go back by.
 123     size_t n_cards_back = BOTConstants::entry_to_cards_back(offset);
 124     q -= (BOTConstants::N_words * n_cards_back);
 125     index -= n_cards_back;
 126     offset = _bot->offset_array(index);
 127   }
 128   assert(offset < BOTConstants::N_words, "offset too large");
 129   q -= offset;
 130   return q;
 131 }
 132 
 133 inline HeapWord* G1BlockOffsetTablePart::forward_to_block_containing_addr_const(HeapWord* q, HeapWord* n,
 134                                                                                 const void* addr) const {
 135   if (addr >= _space->top()) return _space->top();
 136   while (n <= addr) {
 137     q = n;
 138     oop obj = oop(q);
 139     if (obj->klass_or_null() == NULL) {
 140       return q;
 141     }
 142     n += block_size(q);
 143   }
 144   assert(q <= n, "wrong order for q and addr");
 145   assert(addr < n, "wrong order for addr and n");
 146   return q;
 147 }
 148 
 149 inline HeapWord* G1BlockOffsetTablePart::forward_to_block_containing_addr(HeapWord* q,
 150                                                                           const void* addr) {
 151   if (oop(q)->klass_or_null() == NULL) {
 152     return q;
 153   }
 154   HeapWord* n = q + block_size(q);
 155   // In the normal case, where the query "addr" is a card boundary, and the
 156   // offset table chunks are the same size as cards, the block starting at
 157   // "q" will contain addr, so the test below will fail, and we'll fall
 158   // through quickly.
 159   if (n <= addr) {
 160     q = forward_to_block_containing_addr_slow(q, n, addr);
 161   }
 162   assert(q <= addr, "wrong order for current and arg");
 163   return q;
 164 }
 165 
 166 #endif // SHARE_VM_GC_G1_G1BLOCKOFFSETTABLE_INLINE_HPP


 119   uint offset = _bot->offset_array(index);  // Extend u_char to uint.
 120   while (offset >= BOTConstants::N_words) {
 121     // The excess of the offset from N_words indicates a power of Base
 122     // to go back by.
 123     size_t n_cards_back = BOTConstants::entry_to_cards_back(offset);
 124     q -= (BOTConstants::N_words * n_cards_back);
 125     index -= n_cards_back;
 126     offset = _bot->offset_array(index);
 127   }
 128   assert(offset < BOTConstants::N_words, "offset too large");
 129   q -= offset;
 130   return q;
 131 }
 132 
 133 inline HeapWord* G1BlockOffsetTablePart::forward_to_block_containing_addr_const(HeapWord* q, HeapWord* n,
 134                                                                                 const void* addr) const {
 135   if (addr >= _space->top()) return _space->top();
 136   while (n <= addr) {
 137     q = n;
 138     oop obj = oop(q);
 139     if (obj->klass_or_null_acquire() == NULL) {
 140       return q;
 141     }
 142     n += block_size(q);
 143   }
 144   assert(q <= n, "wrong order for q and addr");
 145   assert(addr < n, "wrong order for addr and n");
 146   return q;
 147 }
 148 
 149 inline HeapWord* G1BlockOffsetTablePart::forward_to_block_containing_addr(HeapWord* q,
 150                                                                           const void* addr) {
 151   if (oop(q)->klass_or_null_acquire() == NULL) {
 152     return q;
 153   }
 154   HeapWord* n = q + block_size(q);
 155   // In the normal case, where the query "addr" is a card boundary, and the
 156   // offset table chunks are the same size as cards, the block starting at
 157   // "q" will contain addr, so the test below will fail, and we'll fall
 158   // through quickly.
 159   if (n <= addr) {
 160     q = forward_to_block_containing_addr_slow(q, n, addr);
 161   }
 162   assert(q <= addr, "wrong order for current and arg");
 163   return q;
 164 }
 165 
 166 #endif // SHARE_VM_GC_G1_G1BLOCKOFFSETTABLE_INLINE_HPP
< prev index next >