< prev index next >

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

Print this page
rev 52675 : 8213890: Implementation of JEP 344: Abortable Mixed Collections for G1
Reviewed-by:
Contributed-by: erik.helin@oracle.com, stefan.johansson@oracle.com
rev 52676 : imported patch AMGC-impl


   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));


 184 }
 185 
 186 inline void G1ParScanThreadState::trim_queue_partially() {
 187   if (!needs_partial_trimming()) {
 188     return;
 189   }
 190 
 191   const Ticks start = Ticks::now();
 192   do {
 193     trim_queue_to_threshold(_stack_trim_lower_threshold);
 194   } while (!is_partially_trimmed());
 195   _trim_ticks += Ticks::now() - start;
 196 }
 197 
 198 inline Tickspan G1ParScanThreadState::trim_ticks() const {
 199   return _trim_ticks;
 200 }
 201 
 202 inline void G1ParScanThreadState::reset_trim_ticks() {
 203   _trim_ticks = Tickspan();



















 204 }
 205 
 206 #endif // SHARE_VM_GC_G1_G1PARSCANTHREADSTATE_INLINE_HPP


   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/g1OopStarChunkedList.inline.hpp"
  30 #include "gc/g1/g1ParScanThreadState.hpp"
  31 #include "gc/g1/g1RemSet.hpp"
  32 #include "oops/access.inline.hpp"
  33 #include "oops/oop.inline.hpp"
  34 
  35 template <class T> void G1ParScanThreadState::do_oop_evac(T* p) {
  36   // Reference should not be NULL here as such are never pushed to the task queue.
  37   oop obj = RawAccess<IS_NOT_NULL>::oop_load(p);
  38 
  39   // Although we never intentionally push references outside of the collection
  40   // set, due to (benign) races in the claim mechanism during RSet scanning more
  41   // than one thread might claim the same card. So the same card may be
  42   // processed multiple times, and so we might get references into old gen here.
  43   // So we need to redo this check.
  44   const InCSetState in_cset_state = _g1h->in_cset_state(obj);
  45   // References pushed onto the work stack should never point to a humongous region
  46   // as they are not added to the collection set due to above precondition.
  47   assert(!in_cset_state.is_humongous(),
  48          "Obj " PTR_FORMAT " should not refer to humongous region %u from " PTR_FORMAT,
  49          p2i(obj), _g1h->addr_to_region((HeapWord*)obj), p2i(p));


 185 }
 186 
 187 inline void G1ParScanThreadState::trim_queue_partially() {
 188   if (!needs_partial_trimming()) {
 189     return;
 190   }
 191 
 192   const Ticks start = Ticks::now();
 193   do {
 194     trim_queue_to_threshold(_stack_trim_lower_threshold);
 195   } while (!is_partially_trimmed());
 196   _trim_ticks += Ticks::now() - start;
 197 }
 198 
 199 inline Tickspan G1ParScanThreadState::trim_ticks() const {
 200   return _trim_ticks;
 201 }
 202 
 203 inline void G1ParScanThreadState::reset_trim_ticks() {
 204   _trim_ticks = Tickspan();
 205 }
 206 
 207 template <typename T>
 208 inline void G1ParScanThreadState::remember_root_into_optional_region(T* p) {
 209   oop o = RawAccess<IS_NOT_NULL>::oop_load(p);
 210   uint index = _g1h->heap_region_containing(o)->index_in_opt_cset();
 211   _oops_into_optional_regions[index].push_root(p);
 212 }
 213 
 214 template <typename T>
 215 inline void G1ParScanThreadState::remember_reference_into_optional_region(T* p) {
 216   oop o = RawAccess<IS_NOT_NULL>::oop_load(p);
 217   uint index = _g1h->heap_region_containing(o)->index_in_opt_cset();
 218   _oops_into_optional_regions[index].push_oop(p);
 219   DEBUG_ONLY(verify_ref(p);)
 220 }
 221 
 222 G1OopStarChunkedList* G1ParScanThreadState::oops_into_optional_region(const HeapRegion* hr) {
 223   return &_oops_into_optional_regions[hr->index_in_opt_cset()];
 224 }
 225 
 226 #endif // SHARE_VM_GC_G1_G1PARSCANTHREADSTATE_INLINE_HPP
< prev index next >