< prev index next >

src/hotspot/share/gc/g1/g1FullGCOopClosures.inline.hpp

Print this page

 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_G1_G1FULLGCOOPCLOSURES_INLINE_HPP
 26 #define SHARE_GC_G1_G1FULLGCOOPCLOSURES_INLINE_HPP
 27 
 28 #include "gc/g1/g1FullGCOopClosures.hpp"
 29 
 30 #include "gc/g1/g1Allocator.inline.hpp"
 31 #include "gc/g1/g1FullCollector.inline.hpp"
 32 #include "gc/g1/g1ConcurrentMarkBitMap.inline.hpp"
 33 #include "gc/g1/g1FullGCMarker.inline.hpp"
 34 #include "gc/g1/heapRegionRemSet.hpp"

 35 #include "memory/iterator.inline.hpp"
 36 #include "memory/universe.hpp"
 37 #include "oops/access.inline.hpp"
 38 #include "oops/compressedOops.inline.hpp"
 39 #include "oops/oop.inline.hpp"
 40 
 41 template <typename T>
 42 inline void G1MarkAndPushClosure::do_oop_work(T* p) {
 43   _marker->mark_and_push(p);
 44 }
 45 
 46 inline void G1MarkAndPushClosure::do_oop(oop* p) {
 47   do_oop_work(p);
 48 }
 49 
 50 inline void G1MarkAndPushClosure::do_oop(narrowOop* p) {
 51   do_oop_work(p);
 52 }
 53 
 54 inline bool G1MarkAndPushClosure::do_metadata() {
 55   return true;
 56 }
 57 
 58 inline void G1MarkAndPushClosure::do_klass(Klass* k) {
 59   _marker->follow_klass(k);
 60 }
 61 
 62 inline void G1MarkAndPushClosure::do_cld(ClassLoaderData* cld) {
 63   _marker->follow_cld(cld);
 64 }
 65 
 66 template <class T> inline void G1AdjustClosure::adjust_pointer(T* p) {

 67   T heap_oop = RawAccess<>::oop_load(p);
 68   if (CompressedOops::is_null(heap_oop)) {
 69     return;
 70   }
 71 
 72   oop obj = CompressedOops::decode_not_null(heap_oop);
 73   assert(Universe::heap()->is_in(obj), "should be in heap");
 74   if (!_collector->is_compacting(obj)) {
 75     // We never forward objects in non-compacting regions so there is no need to
 76     // process them further.
 77     return;
 78   }
 79 
 80   oop forwardee = obj->forwardee();
 81   if (forwardee == NULL) {
 82     // Not forwarded, return current reference.

 83     assert(obj->mark() == markWord::prototype_for_klass(obj->klass()) || // Correct mark
 84            obj->mark_must_be_preserved() || // Will be restored by PreservedMarksSet
 85            (UseBiasedLocking && obj->has_bias_pattern()), // Will be restored by BiasedLocking
 86            "Must have correct prototype or be preserved, obj: " PTR_FORMAT ", mark: " PTR_FORMAT ", prototype: " PTR_FORMAT,
 87            p2i(obj), obj->mark().value(), markWord::prototype_for_klass(obj->klass()).value());

 88     return;
 89   }
 90 
 91   // Forwarded, just update.

 92   assert(G1CollectedHeap::heap()->is_in_reserved(forwardee), "should be in object space");
 93   RawAccess<IS_NOT_NULL>::oop_store(p, forwardee);
 94 }
 95 
 96 inline void G1AdjustClosure::do_oop(oop* p)       { do_oop_work(p); }
 97 inline void G1AdjustClosure::do_oop(narrowOop* p) { do_oop_work(p); }


 98 
 99 inline bool G1IsAliveClosure::do_object_b(oop p) {
100   return _bitmap->is_marked(p) || _collector->is_skip_marking(p);
101 }
102 
103 template<typename T>
104 inline void G1FullKeepAliveClosure::do_oop_work(T* p) {
105   _marker->mark_and_push(p);
106 }
107 
108 #endif // SHARE_GC_G1_G1FULLGCOOPCLOSURES_INLINE_HPP

 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_G1_G1FULLGCOOPCLOSURES_INLINE_HPP
 26 #define SHARE_GC_G1_G1FULLGCOOPCLOSURES_INLINE_HPP
 27 
 28 #include "gc/g1/g1FullGCOopClosures.hpp"
 29 
 30 #include "gc/g1/g1Allocator.inline.hpp"
 31 #include "gc/g1/g1FullCollector.inline.hpp"
 32 #include "gc/g1/g1ConcurrentMarkBitMap.inline.hpp"
 33 #include "gc/g1/g1FullGCMarker.inline.hpp"
 34 #include "gc/g1/heapRegionRemSet.hpp"
 35 #include "gc/shared/slidingForwarding.inline.hpp"
 36 #include "memory/iterator.inline.hpp"
 37 #include "memory/universe.hpp"
 38 #include "oops/access.inline.hpp"
 39 #include "oops/compressedOops.inline.hpp"
 40 #include "oops/oop.inline.hpp"
 41 
 42 template <typename T>
 43 inline void G1MarkAndPushClosure::do_oop_work(T* p) {
 44   _marker->mark_and_push(p);
 45 }
 46 
 47 inline void G1MarkAndPushClosure::do_oop(oop* p) {
 48   do_oop_work(p);
 49 }
 50 
 51 inline void G1MarkAndPushClosure::do_oop(narrowOop* p) {
 52   do_oop_work(p);
 53 }
 54 
 55 inline bool G1MarkAndPushClosure::do_metadata() {
 56   return true;
 57 }
 58 
 59 inline void G1MarkAndPushClosure::do_klass(Klass* k) {
 60   _marker->follow_klass(k);
 61 }
 62 
 63 inline void G1MarkAndPushClosure::do_cld(ClassLoaderData* cld) {
 64   _marker->follow_cld(cld);
 65 }
 66 
 67 template <bool ALT_FWD>
 68 template <class T> inline void G1AdjustClosure<ALT_FWD>::adjust_pointer(T* p) {
 69   T heap_oop = RawAccess<>::oop_load(p);
 70   if (CompressedOops::is_null(heap_oop)) {
 71     return;
 72   }
 73 
 74   oop obj = CompressedOops::decode_not_null(heap_oop);
 75   assert(Universe::heap()->is_in(obj), "should be in heap");
 76   if (!_collector->is_compacting(obj)) {
 77     // We never forward objects in non-compacting regions so there is no need to
 78     // process them further.
 79     return;
 80   }
 81 
 82   if (!SlidingForwarding::is_forwarded(obj)) {

 83     // Not forwarded, return current reference.
 84     /*
 85     assert(obj->mark() == markWord::prototype_for_klass(obj->klass()) || // Correct mark
 86            obj->mark_must_be_preserved() || // Will be restored by PreservedMarksSet
 87            (UseBiasedLocking && obj->has_bias_pattern()), // Will be restored by BiasedLocking
 88            "Must have correct prototype or be preserved, obj: " PTR_FORMAT ", mark: " PTR_FORMAT ", prototype: " PTR_FORMAT,
 89            p2i(obj), obj->mark().value(), markWord::prototype_for_klass(obj->klass()).value());
 90     */
 91     return;
 92   }
 93 
 94   // Forwarded, just update.
 95   oop forwardee = SlidingForwarding::forwardee<ALT_FWD>(obj);
 96   assert(G1CollectedHeap::heap()->is_in_reserved(forwardee), "should be in object space");
 97   RawAccess<IS_NOT_NULL>::oop_store(p, forwardee);
 98 }
 99 
100 template <bool ALT_FWD>
101 inline void G1AdjustClosure<ALT_FWD>::do_oop(oop* p)       { do_oop_work(p); }
102 template <bool ALT_FWD>
103 inline void G1AdjustClosure<ALT_FWD>::do_oop(narrowOop* p) { do_oop_work(p); }
104 
105 inline bool G1IsAliveClosure::do_object_b(oop p) {
106   return _bitmap->is_marked(p) || _collector->is_skip_marking(p);
107 }
108 
109 template<typename T>
110 inline void G1FullKeepAliveClosure::do_oop_work(T* p) {
111   _marker->mark_and_push(p);
112 }
113 
114 #endif // SHARE_GC_G1_G1FULLGCOOPCLOSURES_INLINE_HPP
< prev index next >