Mercurial > hg > truffle
comparison src/share/vm/gc_implementation/g1/g1RemSet.inline.hpp @ 1705:2d160770d2e5
6814437: G1: remove the _new_refs array
Summary: The per-worker _new_refs array is used to hold references that point into the collection set. It is populated during RSet updating and subsequently processed. In the event of an evacuation failure it processed again to recreate the RSets of regions in the collection set. Remove the per-worker _new_refs array by processing the references directly. Use a DirtyCardQueue to hold the cards containing the references so that the RSets of regions in the collection set can be recreated when handling an evacuation failure.
Reviewed-by: iveresov, jmasa, tonyp
author | johnc |
---|---|
date | Mon, 02 Aug 2010 12:51:43 -0700 |
parents | c18cbe5936b8 |
children | a03ae377b2e8 |
comparison
equal
deleted
inserted
replaced
1704:63f4675ac87d | 1705:2d160770d2e5 |
---|---|
1 /* | 1 /* |
2 * Copyright (c) 2001, 2009, Oracle and/or its affiliates. All rights reserved. | 2 * Copyright (c) 2001, 2010, 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. |
54 #endif // CHECK_UNHANDLED_OOPS | 54 #endif // CHECK_UNHANDLED_OOPS |
55 assert((intptr_t)o % MinObjAlignmentInBytes == 0, "not oop aligned"); | 55 assert((intptr_t)o % MinObjAlignmentInBytes == 0, "not oop aligned"); |
56 assert(Universe::heap()->is_in_reserved(obj), "must be in heap"); | 56 assert(Universe::heap()->is_in_reserved(obj), "must be in heap"); |
57 } | 57 } |
58 #endif // ASSERT | 58 #endif // ASSERT |
59 assert(from == NULL || from->is_in_reserved(p), | 59 |
60 "p is not in from"); | 60 assert(from == NULL || from->is_in_reserved(p), "p is not in from"); |
61 | |
61 HeapRegion* to = _g1->heap_region_containing(obj); | 62 HeapRegion* to = _g1->heap_region_containing(obj); |
62 // The test below could be optimized by applying a bit op to to and from. | 63 // The test below could be optimized by applying a bit op to to and from. |
63 if (to != NULL && from != NULL && from != to) { | 64 if (to != NULL && from != NULL && from != to) { |
64 // There is a tricky infinite loop if we keep pushing | |
65 // self forwarding pointers onto our _new_refs list. | |
66 // The _par_traversal_in_progress flag is true during the collection pause, | 65 // The _par_traversal_in_progress flag is true during the collection pause, |
67 // false during the evacuation failure handing. | 66 // false during the evacuation failure handing. This should avoid a |
67 // potential loop if we were to add the card containing 'p' to the DCQS | |
68 // that's used to regenerate the remembered sets for the collection set, | |
69 // in the event of an evacuation failure, here. The UpdateRSImmediate | |
70 // closure will eventally call this routine. | |
68 if (_par_traversal_in_progress && | 71 if (_par_traversal_in_progress && |
69 to->in_collection_set() && !self_forwarded(obj)) { | 72 to->in_collection_set() && !self_forwarded(obj)) { |
70 _new_refs[tid]->push((void*)p); | 73 |
71 // Deferred updates to the Cset are either discarded (in the normal case), | 74 assert(_cset_rs_update_cl[tid] != NULL, "should have been set already"); |
75 _cset_rs_update_cl[tid]->do_oop(p); | |
76 | |
77 // Deferred updates to the CSet are either discarded (in the normal case), | |
72 // or processed (if an evacuation failure occurs) at the end | 78 // or processed (if an evacuation failure occurs) at the end |
73 // of the collection. | 79 // of the collection. |
74 // See HRInto_G1RemSet::cleanup_after_oops_into_collection_set_do(). | 80 // See HRInto_G1RemSet::cleanup_after_oops_into_collection_set_do(). |
75 } else { | 81 } else { |
76 #if G1_REM_SET_LOGGING | 82 #if G1_REM_SET_LOGGING |
87 | 93 |
88 template <class T> inline void UpdateRSOopClosure::do_oop_work(T* p) { | 94 template <class T> inline void UpdateRSOopClosure::do_oop_work(T* p) { |
89 assert(_from != NULL, "from region must be non-NULL"); | 95 assert(_from != NULL, "from region must be non-NULL"); |
90 _rs->par_write_ref(_from, p, _worker_i); | 96 _rs->par_write_ref(_from, p, _worker_i); |
91 } | 97 } |
98 | |
99 template <class T> inline void UpdateRSetImmediate::do_oop_work(T* p) { | |
100 assert(_from->is_in_reserved(p), "paranoia"); | |
101 T heap_oop = oopDesc::load_heap_oop(p); | |
102 if (!oopDesc::is_null(heap_oop) && !_from->is_survivor()) { | |
103 _g1_rem_set->par_write_ref(_from, p, 0); | |
104 } | |
105 } | |
106 |