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_G1_G1PARSCANTHREADSTATE_INLINE_HPP 26 #define SHARE_VM_GC_G1_G1PARSCANTHREADSTATE_INLINE_HPP 27 28 #include "gc/g1/g1ParScanThreadState.hpp" 29 #include "gc/g1/g1RemSet.hpp" 30 #include "oops/access.inline.hpp" 31 #include "oops/oop.inline.hpp" 32 33 template <class T> void G1ParScanThreadState::do_oop_evac(T* p) { 34 // Reference should not be NULL here as such are never pushed to the task queue. 35 oop obj = RawAccess<IS_NOT_NULL>::oop_load(p); 36 37 // Although we never intentionally push references outside of the collection 38 // set, due to (benign) races in the claim mechanism during RSet scanning more 39 // than one thread might claim the same card. So the same card may be 40 // processed multiple times, and so we might get references into old gen here. 41 // So we need to redo this check. 42 const InCSetState in_cset_state = _g1h->in_cset_state(obj); 43 if (!in_cset_state.is_in_cset()) { 44 // In this case somebody else already did all the work. 45 return; 46 } 47 48 markOop m = obj->mark_raw(); 49 if (m->is_marked()) { 50 obj = (oop) m->decode_pointer(); 51 } else { 52 obj = copy_to_survivor_space(in_cset_state, obj, m); 53 } 54 RawAccess<IS_NOT_NULL>::oop_store(p, obj); 55 56 assert(obj != NULL, "Must be"); 57 if (!HeapRegion::is_in_same_region(p, obj)) { 58 HeapRegion* from = _g1h->heap_region_containing(p); 59 update_rs(from, p, obj); 60 } 61 } 62 | 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_G1_G1PARSCANTHREADSTATE_INLINE_HPP 26 #define SHARE_VM_GC_G1_G1PARSCANTHREADSTATE_INLINE_HPP 27 28 #include "gc/g1/g1CollectedHeap.inline.hpp" 29 #include "gc/g1/g1ParScanThreadState.hpp" 30 #include "gc/g1/g1RemSet.hpp" 31 #include "oops/access.inline.hpp" 32 #include "oops/oop.inline.hpp" 33 34 template <class T> void G1ParScanThreadState::do_oop_evac(T* p) { 35 // Reference should not be NULL here as such are never pushed to the task queue. 36 oop obj = RawAccess<IS_NOT_NULL>::oop_load(p); 37 38 // Although we never intentionally push references outside of the collection 39 // set, due to (benign) races in the claim mechanism during RSet scanning more 40 // than one thread might claim the same card. So the same card may be 41 // processed multiple times, and so we might get references into old gen here. 42 // So we need to redo this check. 43 const InCSetState in_cset_state = _g1h->in_cset_state(obj); 44 // References pushed onto the work stack should never point to a humongous region 45 // as they are not added to the collection set due to above precondition. 46 assert(!in_cset_state.is_humongous(), 47 "Obj " PTR_FORMAT " should not refer to humongous region %u from " PTR_FORMAT, 48 p2i(obj), _g1h->addr_to_region((HeapWord*)obj), p2i(p)); 49 50 if (!in_cset_state.is_in_cset()) { 51 // In this case somebody else already did all the work. 52 return; 53 } 54 55 markOop m = obj->mark_raw(); 56 if (m->is_marked()) { 57 obj = (oop) m->decode_pointer(); 58 } else { 59 obj = copy_to_survivor_space(in_cset_state, obj, m); 60 } 61 RawAccess<IS_NOT_NULL>::oop_store(p, obj); 62 63 assert(obj != NULL, "Must be"); 64 if (!HeapRegion::is_in_same_region(p, obj)) { 65 HeapRegion* from = _g1h->heap_region_containing(p); 66 update_rs(from, p, obj); 67 } 68 } 69 |