34 #include "gc/g1/heapRegionRemSet.hpp" |
34 #include "gc/g1/heapRegionRemSet.hpp" |
35 #include "memory/iterator.inline.hpp" |
35 #include "memory/iterator.inline.hpp" |
36 #include "oops/access.inline.hpp" |
36 #include "oops/access.inline.hpp" |
37 #include "oops/compressedOops.inline.hpp" |
37 #include "oops/compressedOops.inline.hpp" |
38 #include "oops/oopsHierarchy.hpp" |
38 #include "oops/oopsHierarchy.hpp" |
|
39 #include "oops/oop.inline.hpp" |
39 #include "runtime/prefetch.inline.hpp" |
40 #include "runtime/prefetch.inline.hpp" |
40 |
41 |
41 template <class T> |
42 template <class T> |
42 inline void G1ScanClosureBase::prefetch_and_push(T* p, const oop obj) { |
43 inline void G1ScanClosureBase::prefetch_and_push(T* p, const oop obj) { |
43 // We're not going to even bother checking whether the object is |
44 // We're not going to even bother checking whether the object is |
44 // already forwarded or not, as this usually causes an immediate |
45 // already forwarded or not, as this usually causes an immediate |
45 // stall. We'll try to prefetch the object (for write, given that |
46 // stall. We'll try to prefetch the object (for write, given that |
46 // we might need to install the forwarding reference) and we'll |
47 // we might need to install the forwarding reference) and we'll |
47 // get back to it when pop it from the queue |
48 // get back to it when pop it from the queue |
48 Prefetch::write(obj->mark_addr(), 0); |
49 Prefetch::write(obj->mark_addr_raw(), 0); |
49 Prefetch::read(obj->mark_addr(), (HeapWordSize*2)); |
50 Prefetch::read(obj->mark_addr_raw(), (HeapWordSize*2)); |
50 |
51 |
51 // slightly paranoid test; I'm trying to catch potential |
52 // slightly paranoid test; I'm trying to catch potential |
52 // problems before we go into push_on_queue to know where the |
53 // problems before we go into push_on_queue to know where the |
53 // problem is coming from |
54 // problem is coming from |
54 assert((obj == RawAccess<>::oop_load(p)) || |
55 assert((obj == RawAccess<>::oop_load(p)) || |
238 assert(_worker_id == _par_scan_state->worker_id(), "sanity"); |
239 assert(_worker_id == _par_scan_state->worker_id(), "sanity"); |
239 |
240 |
240 const InCSetState state = _g1->in_cset_state(obj); |
241 const InCSetState state = _g1->in_cset_state(obj); |
241 if (state.is_in_cset()) { |
242 if (state.is_in_cset()) { |
242 oop forwardee; |
243 oop forwardee; |
243 markOop m = obj->mark(); |
244 markOop m = obj->mark_raw(); |
244 if (m->is_marked()) { |
245 if (m->is_marked()) { |
245 forwardee = (oop) m->decode_pointer(); |
246 forwardee = (oop) m->decode_pointer(); |
246 } else { |
247 } else { |
247 forwardee = _par_scan_state->copy_to_survivor_space(state, obj, m); |
248 forwardee = _par_scan_state->copy_to_survivor_space(state, obj, m); |
248 } |
249 } |