1 /*
2 * Copyright (c) 2001, 2007, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
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 inline HeapWord* G1BlockOffsetTable::block_start(const void* addr) {
26 if (addr >= _bottom && addr < _end) {
27 return block_start_unsafe(addr);
28 } else {
29 return NULL;
30 }
31 }
32
33 inline HeapWord*
34 G1BlockOffsetTable::block_start_const(const void* addr) const {
35 if (addr >= _bottom && addr < _end) {
36 return block_start_unsafe_const(addr);
37 } else {
38 return NULL;
39 }
40 }
41
42 inline size_t G1BlockOffsetSharedArray::index_for(const void* p) const {
43 char* pc = (char*)p;
44 assert(pc >= (char*)_reserved.start() &&
134 inline void G1BlockOffsetArray::freed(HeapWord* blk_start, HeapWord* blk_end) {
135 // Verify that the BOT shows [blk_start, blk_end) to be one block.
136 verify_single_block(blk_start, blk_end);
137 // adjust _unallocated_block upward or downward
138 // as appropriate
139 if (BlockOffsetArrayUseUnallocatedBlock) {
140 assert(_unallocated_block <= _end,
141 "Inconsistent value for _unallocated_block");
142 if (blk_end >= _unallocated_block && blk_start <= _unallocated_block) {
143 // CMS-specific note: a block abutting _unallocated_block to
144 // its left is being freed, a new block is being added or
145 // we are resetting following a compaction
146 _unallocated_block = blk_start;
147 }
148 }
149 }
150
151 inline void G1BlockOffsetArray::freed(HeapWord* blk, size_t size) {
152 freed(blk, blk + size);
153 }
|
1 /*
2 * Copyright (c) 2001, 2010, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
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 "memory/space.hpp"
30
31 inline HeapWord* G1BlockOffsetTable::block_start(const void* addr) {
32 if (addr >= _bottom && addr < _end) {
33 return block_start_unsafe(addr);
34 } else {
35 return NULL;
36 }
37 }
38
39 inline HeapWord*
40 G1BlockOffsetTable::block_start_const(const void* addr) const {
41 if (addr >= _bottom && addr < _end) {
42 return block_start_unsafe_const(addr);
43 } else {
44 return NULL;
45 }
46 }
47
48 inline size_t G1BlockOffsetSharedArray::index_for(const void* p) const {
49 char* pc = (char*)p;
50 assert(pc >= (char*)_reserved.start() &&
140 inline void G1BlockOffsetArray::freed(HeapWord* blk_start, HeapWord* blk_end) {
141 // Verify that the BOT shows [blk_start, blk_end) to be one block.
142 verify_single_block(blk_start, blk_end);
143 // adjust _unallocated_block upward or downward
144 // as appropriate
145 if (BlockOffsetArrayUseUnallocatedBlock) {
146 assert(_unallocated_block <= _end,
147 "Inconsistent value for _unallocated_block");
148 if (blk_end >= _unallocated_block && blk_start <= _unallocated_block) {
149 // CMS-specific note: a block abutting _unallocated_block to
150 // its left is being freed, a new block is being added or
151 // we are resetting following a compaction
152 _unallocated_block = blk_start;
153 }
154 }
155 }
156
157 inline void G1BlockOffsetArray::freed(HeapWord* blk, size_t size) {
158 freed(blk, blk + size);
159 }
160
161 #endif // SHARE_VM_GC_IMPLEMENTATION_G1_G1BLOCKOFFSETTABLE_INLINE_HPP
|