< prev index next >

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

Print this page
rev 59232 : [mq]: scan_task
   1 /*
   2  * Copyright (c) 2001, 2019, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   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
   7  * published by the Free Software Foundation.
   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  *


  41 #include "utilities/align.hpp"
  42 
  43 template <class T>
  44 inline void G1ScanClosureBase::prefetch_and_push(T* p, const oop obj) {
  45   // We're not going to even bother checking whether the object is
  46   // already forwarded or not, as this usually causes an immediate
  47   // stall. We'll try to prefetch the object (for write, given that
  48   // we might need to install the forwarding reference) and we'll
  49   // get back to it when pop it from the queue
  50   Prefetch::write(obj->mark_addr_raw(), 0);
  51   Prefetch::read(obj->mark_addr_raw(), (HeapWordSize*2));
  52 
  53   // slightly paranoid test; I'm trying to catch potential
  54   // problems before we go into push_on_queue to know where the
  55   // problem is coming from
  56   assert((obj == RawAccess<>::oop_load(p)) ||
  57          (obj->is_forwarded() &&
  58          obj->forwardee() == RawAccess<>::oop_load(p)),
  59          "p should still be pointing to obj or to its forwardee");
  60 
  61   _par_scan_state->push_on_queue(p);
  62 }
  63 
  64 template <class T>
  65 inline void G1ScanClosureBase::handle_non_cset_obj_common(G1HeapRegionAttr const region_attr, T* p, oop const obj) {
  66   if (region_attr.is_humongous()) {
  67     _g1h->set_humongous_is_live(obj);
  68   } else if (region_attr.is_optional()) {
  69     _par_scan_state->remember_reference_into_optional_region(p);
  70   }
  71 }
  72 
  73 inline void G1ScanClosureBase::trim_queue_partially() {
  74   _par_scan_state->trim_queue_partially();
  75 }
  76 
  77 template <class T>
  78 inline void G1ScanEvacuatedObjClosure::do_oop_work(T* p) {
  79   T heap_oop = RawAccess<>::oop_load(p);
  80 
  81   if (CompressedOops::is_null(heap_oop)) {


   1 /*
   2  * Copyright (c) 2001, 2020, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   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
   7  * published by the Free Software Foundation.
   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  *


  41 #include "utilities/align.hpp"
  42 
  43 template <class T>
  44 inline void G1ScanClosureBase::prefetch_and_push(T* p, const oop obj) {
  45   // We're not going to even bother checking whether the object is
  46   // already forwarded or not, as this usually causes an immediate
  47   // stall. We'll try to prefetch the object (for write, given that
  48   // we might need to install the forwarding reference) and we'll
  49   // get back to it when pop it from the queue
  50   Prefetch::write(obj->mark_addr_raw(), 0);
  51   Prefetch::read(obj->mark_addr_raw(), (HeapWordSize*2));
  52 
  53   // slightly paranoid test; I'm trying to catch potential
  54   // problems before we go into push_on_queue to know where the
  55   // problem is coming from
  56   assert((obj == RawAccess<>::oop_load(p)) ||
  57          (obj->is_forwarded() &&
  58          obj->forwardee() == RawAccess<>::oop_load(p)),
  59          "p should still be pointing to obj or to its forwardee");
  60 
  61   _par_scan_state->push_on_queue(ScannerTask(p));
  62 }
  63 
  64 template <class T>
  65 inline void G1ScanClosureBase::handle_non_cset_obj_common(G1HeapRegionAttr const region_attr, T* p, oop const obj) {
  66   if (region_attr.is_humongous()) {
  67     _g1h->set_humongous_is_live(obj);
  68   } else if (region_attr.is_optional()) {
  69     _par_scan_state->remember_reference_into_optional_region(p);
  70   }
  71 }
  72 
  73 inline void G1ScanClosureBase::trim_queue_partially() {
  74   _par_scan_state->trim_queue_partially();
  75 }
  76 
  77 template <class T>
  78 inline void G1ScanEvacuatedObjClosure::do_oop_work(T* p) {
  79   T heap_oop = RawAccess<>::oop_load(p);
  80 
  81   if (CompressedOops::is_null(heap_oop)) {


< prev index next >