equal
deleted
inserted
replaced
1 /* |
1 /* |
2 * Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 2001, 2015, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * |
4 * |
5 * This code is free software; you can redistribute it and/or modify it |
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 |
6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. |
7 * published by the Free Software Foundation. |
24 |
24 |
25 #ifndef SHARE_VM_GC_IMPLEMENTATION_G1_G1BLOCKOFFSETTABLE_INLINE_HPP |
25 #ifndef SHARE_VM_GC_IMPLEMENTATION_G1_G1BLOCKOFFSETTABLE_INLINE_HPP |
26 #define SHARE_VM_GC_IMPLEMENTATION_G1_G1BLOCKOFFSETTABLE_INLINE_HPP |
26 #define SHARE_VM_GC_IMPLEMENTATION_G1_G1BLOCKOFFSETTABLE_INLINE_HPP |
27 |
27 |
28 #include "gc_implementation/g1/g1BlockOffsetTable.hpp" |
28 #include "gc_implementation/g1/g1BlockOffsetTable.hpp" |
29 #include "gc_implementation/g1/g1CollectedHeap.inline.hpp" |
|
30 #include "gc_implementation/g1/heapRegion.inline.hpp" |
29 #include "gc_implementation/g1/heapRegion.inline.hpp" |
31 #include "memory/space.hpp" |
30 #include "memory/space.hpp" |
32 |
31 |
33 inline HeapWord* G1BlockOffsetTable::block_start(const void* addr) { |
32 inline HeapWord* G1BlockOffsetTable::block_start(const void* addr) { |
34 if (addr >= _bottom && addr < _end) { |
33 if (addr >= _bottom && addr < _end) { |
44 return block_start_unsafe_const(addr); |
43 return block_start_unsafe_const(addr); |
45 } else { |
44 } else { |
46 return NULL; |
45 return NULL; |
47 } |
46 } |
48 } |
47 } |
49 |
|
50 #define check_index(index, msg) \ |
|
51 assert((index) < (_reserved.word_size() >> LogN_words), \ |
|
52 err_msg("%s - index: "SIZE_FORMAT", _vs.committed_size: "SIZE_FORMAT, \ |
|
53 msg, (index), (_reserved.word_size() >> LogN_words))); \ |
|
54 assert(G1CollectedHeap::heap()->is_in_exact(address_for_index_raw(index)), \ |
|
55 err_msg("Index "SIZE_FORMAT" corresponding to "PTR_FORMAT \ |
|
56 " (%u) is not in committed area.", \ |
|
57 (index), \ |
|
58 p2i(address_for_index_raw(index)), \ |
|
59 G1CollectedHeap::heap()->addr_to_region(address_for_index_raw(index)))); |
|
60 |
48 |
61 u_char G1BlockOffsetSharedArray::offset_array(size_t index) const { |
49 u_char G1BlockOffsetSharedArray::offset_array(size_t index) const { |
62 check_index(index, "index out of range"); |
50 check_index(index, "index out of range"); |
63 return _offset_array[index]; |
51 return _offset_array[index]; |
64 } |
52 } |
116 " _reserved.start() " PTR_FORMAT " _reserved.end() " |
104 " _reserved.start() " PTR_FORMAT " _reserved.end() " |
117 PTR_FORMAT, |
105 PTR_FORMAT, |
118 p2i(result), p2i(_reserved.start()), p2i(_reserved.end()))); |
106 p2i(result), p2i(_reserved.start()), p2i(_reserved.end()))); |
119 return result; |
107 return result; |
120 } |
108 } |
121 |
|
122 #undef check_index |
|
123 |
109 |
124 inline size_t |
110 inline size_t |
125 G1BlockOffsetArray::block_size(const HeapWord* p) const { |
111 G1BlockOffsetArray::block_size(const HeapWord* p) const { |
126 return gsp()->block_size(p); |
112 return gsp()->block_size(p); |
127 } |
113 } |