25 #ifndef SHARE_VM_GC_G1_G1BLOCKOFFSETTABLE_INLINE_HPP |
25 #ifndef SHARE_VM_GC_G1_G1BLOCKOFFSETTABLE_INLINE_HPP |
26 #define SHARE_VM_GC_G1_G1BLOCKOFFSETTABLE_INLINE_HPP |
26 #define SHARE_VM_GC_G1_G1BLOCKOFFSETTABLE_INLINE_HPP |
27 |
27 |
28 #include "gc/g1/g1BlockOffsetTable.hpp" |
28 #include "gc/g1/g1BlockOffsetTable.hpp" |
29 #include "gc/g1/heapRegion.hpp" |
29 #include "gc/g1/heapRegion.hpp" |
|
30 #include "gc/shared/memset_with_concurrent_readers.hpp" |
30 #include "gc/shared/space.hpp" |
31 #include "gc/shared/space.hpp" |
31 |
32 |
32 inline HeapWord* G1BlockOffsetTable::block_start(const void* addr) { |
33 inline HeapWord* G1BlockOffsetTable::block_start(const void* addr) { |
33 if (addr >= _bottom && addr < _end) { |
34 if (addr >= _bottom && addr < _end) { |
34 return block_start_unsafe(addr); |
35 return block_start_unsafe(addr); |
66 |
67 |
67 void G1BlockOffsetSharedArray::set_offset_array(size_t left, size_t right, u_char offset) { |
68 void G1BlockOffsetSharedArray::set_offset_array(size_t left, size_t right, u_char offset) { |
68 check_index(right, "right index out of range"); |
69 check_index(right, "right index out of range"); |
69 assert(left <= right, "indexes out of order"); |
70 assert(left <= right, "indexes out of order"); |
70 size_t num_cards = right - left + 1; |
71 size_t num_cards = right - left + 1; |
71 if (UseMemSetInBOT) { |
72 memset_with_concurrent_readers(&_offset_array[left], offset, num_cards); |
72 memset(&_offset_array[left], offset, num_cards); |
|
73 } else { |
|
74 size_t i = left; |
|
75 const size_t end = i + num_cards; |
|
76 for (; i < end; i++) { |
|
77 _offset_array[i] = offset; |
|
78 } |
|
79 } |
|
80 } |
73 } |
81 |
74 |
82 // Variant of index_for that does not check the index for validity. |
75 // Variant of index_for that does not check the index for validity. |
83 inline size_t G1BlockOffsetSharedArray::index_for_raw(const void* p) const { |
76 inline size_t G1BlockOffsetSharedArray::index_for_raw(const void* p) const { |
84 return pointer_delta((char*)p, _reserved.start(), sizeof(char)) >> LogN; |
77 return pointer_delta((char*)p, _reserved.start(), sizeof(char)) >> LogN; |