5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
23 */
24
25 #ifndef SHARE_VM_GC_IMPLEMENTATION_G1_G1BLOCKOFFSETTABLE_INLINE_HPP
26 #define SHARE_VM_GC_IMPLEMENTATION_G1_G1BLOCKOFFSETTABLE_INLINE_HPP
27
28 #include "gc_implementation/g1/g1BlockOffsetTable.hpp"
29 #include "gc_implementation/g1/heapRegion.inline.hpp"
30 #include "memory/space.hpp"
31
32 inline HeapWord* G1BlockOffsetTable::block_start(const void* addr) {
33 if (addr >= _bottom && addr < _end) {
34 return block_start_unsafe(addr);
35 } else {
36 return NULL;
37 }
38 }
39
40 inline HeapWord*
41 G1BlockOffsetTable::block_start_const(const void* addr) const {
42 if (addr >= _bottom && addr < _end) {
43 return block_start_unsafe_const(addr);
44 } else {
45 return NULL;
46 }
47 }
48
49 u_char G1BlockOffsetSharedArray::offset_array(size_t index) const {
50 check_index(index, "index out of range");
155 assert(addr < n, "wrong order for addr and n");
156 return q;
157 }
158
159 inline HeapWord*
160 G1BlockOffsetArray::forward_to_block_containing_addr(HeapWord* q,
161 const void* addr) {
162 if (oop(q)->klass_or_null() == NULL) return q;
163 HeapWord* n = q + block_size(q);
164 // In the normal case, where the query "addr" is a card boundary, and the
165 // offset table chunks are the same size as cards, the block starting at
166 // "q" will contain addr, so the test below will fail, and we'll fall
167 // through quickly.
168 if (n <= addr) {
169 q = forward_to_block_containing_addr_slow(q, n, addr);
170 }
171 assert(q <= addr, "wrong order for current and arg");
172 return q;
173 }
174
175 #endif // SHARE_VM_GC_IMPLEMENTATION_G1_G1BLOCKOFFSETTABLE_INLINE_HPP
|
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
23 */
24
25 #ifndef SHARE_VM_GC_G1_G1BLOCKOFFSETTABLE_INLINE_HPP
26 #define SHARE_VM_GC_G1_G1BLOCKOFFSETTABLE_INLINE_HPP
27
28 #include "gc/g1/g1BlockOffsetTable.hpp"
29 #include "gc/g1/heapRegion.inline.hpp"
30 #include "gc/shared/space.hpp"
31
32 inline HeapWord* G1BlockOffsetTable::block_start(const void* addr) {
33 if (addr >= _bottom && addr < _end) {
34 return block_start_unsafe(addr);
35 } else {
36 return NULL;
37 }
38 }
39
40 inline HeapWord*
41 G1BlockOffsetTable::block_start_const(const void* addr) const {
42 if (addr >= _bottom && addr < _end) {
43 return block_start_unsafe_const(addr);
44 } else {
45 return NULL;
46 }
47 }
48
49 u_char G1BlockOffsetSharedArray::offset_array(size_t index) const {
50 check_index(index, "index out of range");
155 assert(addr < n, "wrong order for addr and n");
156 return q;
157 }
158
159 inline HeapWord*
160 G1BlockOffsetArray::forward_to_block_containing_addr(HeapWord* q,
161 const void* addr) {
162 if (oop(q)->klass_or_null() == NULL) return q;
163 HeapWord* n = q + block_size(q);
164 // In the normal case, where the query "addr" is a card boundary, and the
165 // offset table chunks are the same size as cards, the block starting at
166 // "q" will contain addr, so the test below will fail, and we'll fall
167 // through quickly.
168 if (n <= addr) {
169 q = forward_to_block_containing_addr_slow(q, n, addr);
170 }
171 assert(q <= addr, "wrong order for current and arg");
172 return q;
173 }
174
175 #endif // SHARE_VM_GC_G1_G1BLOCKOFFSETTABLE_INLINE_HPP
|