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_GC_PARALLEL_PSPARALLELCOMPACT_INLINE_HPP
26 #define SHARE_GC_PARALLEL_PSPARALLELCOMPACT_INLINE_HPP
27
28 #include "gc/parallel/psParallelCompact.hpp"
29
30 #include "gc/parallel/parallelScavengeHeap.hpp"
31 #include "gc/parallel/parMarkBitMap.inline.hpp"
32 #include "gc/shared/collectedHeap.hpp"
33 #include "gc/shared/continuationGCSupport.inline.hpp"
34 #include "oops/access.inline.hpp"
35 #include "oops/compressedOops.inline.hpp"
36 #include "oops/klass.hpp"
37 #include "oops/oop.inline.hpp"
38
39 inline bool PSParallelCompact::is_marked(oop obj) {
40 return mark_bitmap()->is_marked(obj);
41 }
42
43 inline MutableSpace* PSParallelCompact::space(SpaceId id) {
44 assert(id < last_space_id, "id out of range");
45 return _space_info[id].space();
46 }
47
48 inline HeapWord* PSParallelCompact::new_top(SpaceId id) {
49 assert(id < last_space_id, "id out of range");
50 return _space_info[id].new_top();
51 }
52
53 inline HeapWord* PSParallelCompact::dense_prefix(SpaceId id) {
62
63 #ifdef ASSERT
64 inline void PSParallelCompact::check_new_location(HeapWord* old_addr, HeapWord* new_addr) {
65 assert(old_addr >= new_addr || space_id(old_addr) != space_id(new_addr),
66 "must move left or to a different space");
67 assert(is_object_aligned(old_addr) && is_object_aligned(new_addr),
68 "checking alignment");
69 }
70 #endif // ASSERT
71
72 template <class T>
73 inline void PSParallelCompact::adjust_pointer(T* p) {
74 T heap_oop = RawAccess<>::oop_load(p);
75 if (!CompressedOops::is_null(heap_oop)) {
76 oop obj = CompressedOops::decode_not_null(heap_oop);
77 assert(ParallelScavengeHeap::heap()->is_in(obj), "should be in heap");
78
79 if (!obj->is_forwarded()) {
80 return;
81 }
82 oop new_obj = obj->forwardee();
83 assert(new_obj != nullptr, "non-null address for live objects");
84 assert(new_obj != obj, "inv");
85 assert(ParallelScavengeHeap::heap()->is_in_reserved(new_obj),
86 "should be in object space");
87 RawAccess<IS_NOT_NULL>::oop_store(p, new_obj);
88 }
89 }
90
91 #endif // SHARE_GC_PARALLEL_PSPARALLELCOMPACT_INLINE_HPP
|
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_GC_PARALLEL_PSPARALLELCOMPACT_INLINE_HPP
26 #define SHARE_GC_PARALLEL_PSPARALLELCOMPACT_INLINE_HPP
27
28 #include "gc/parallel/psParallelCompact.hpp"
29
30 #include "gc/parallel/parallelScavengeHeap.hpp"
31 #include "gc/parallel/parMarkBitMap.inline.hpp"
32 #include "gc/shared/collectedHeap.hpp"
33 #include "gc/shared/continuationGCSupport.inline.hpp"
34 #include "gc/shared/slidingForwarding.inline.hpp"
35 #include "oops/access.inline.hpp"
36 #include "oops/compressedOops.inline.hpp"
37 #include "oops/klass.hpp"
38 #include "oops/oop.inline.hpp"
39
40 inline bool PSParallelCompact::is_marked(oop obj) {
41 return mark_bitmap()->is_marked(obj);
42 }
43
44 inline MutableSpace* PSParallelCompact::space(SpaceId id) {
45 assert(id < last_space_id, "id out of range");
46 return _space_info[id].space();
47 }
48
49 inline HeapWord* PSParallelCompact::new_top(SpaceId id) {
50 assert(id < last_space_id, "id out of range");
51 return _space_info[id].new_top();
52 }
53
54 inline HeapWord* PSParallelCompact::dense_prefix(SpaceId id) {
63
64 #ifdef ASSERT
65 inline void PSParallelCompact::check_new_location(HeapWord* old_addr, HeapWord* new_addr) {
66 assert(old_addr >= new_addr || space_id(old_addr) != space_id(new_addr),
67 "must move left or to a different space");
68 assert(is_object_aligned(old_addr) && is_object_aligned(new_addr),
69 "checking alignment");
70 }
71 #endif // ASSERT
72
73 template <class T>
74 inline void PSParallelCompact::adjust_pointer(T* p) {
75 T heap_oop = RawAccess<>::oop_load(p);
76 if (!CompressedOops::is_null(heap_oop)) {
77 oop obj = CompressedOops::decode_not_null(heap_oop);
78 assert(ParallelScavengeHeap::heap()->is_in(obj), "should be in heap");
79
80 if (!obj->is_forwarded()) {
81 return;
82 }
83 oop new_obj = SlidingForwarding::forwardee(obj);
84 assert(new_obj != nullptr, "non-null address for live objects");
85 assert(new_obj != obj, "inv");
86 assert(ParallelScavengeHeap::heap()->is_in_reserved(new_obj),
87 "should be in object space");
88 RawAccess<IS_NOT_NULL>::oop_store(p, new_obj);
89 }
90 }
91
92 #endif // SHARE_GC_PARALLEL_PSPARALLELCOMPACT_INLINE_HPP
|