< prev index next >

src/share/vm/gc_implementation/g1/g1RootProcessor.cpp

Print this page




  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 #include "precompiled.hpp"
  26 
  27 #include "classfile/stringTable.hpp"
  28 #include "classfile/systemDictionary.hpp"
  29 #include "code/codeCache.hpp"
  30 #include "gc_implementation/g1/bufferingOopClosure.hpp"
  31 #include "gc_implementation/g1/g1CollectedHeap.inline.hpp"
  32 #include "gc_implementation/g1/g1CollectorPolicy.hpp"

  33 #include "gc_implementation/g1/g1GCPhaseTimes.hpp"
  34 #include "gc_implementation/g1/g1RemSet.inline.hpp"
  35 #include "gc_implementation/g1/g1RootProcessor.hpp"
  36 #include "memory/allocation.inline.hpp"
  37 #include "runtime/fprofiler.hpp"
  38 #include "runtime/mutex.hpp"
  39 #include "services/management.hpp"
  40 
  41 class G1CodeBlobClosure : public CodeBlobClosure {
  42   class HeapRegionGatheringOopClosure : public OopClosure {
  43     G1CollectedHeap* _g1h;
  44     OopClosure* _work;
  45     nmethod* _nm;
  46 
  47     template <typename T>
  48     void do_oop_work(T* p) {
  49       _work->do_oop(p);
  50       T oop_or_narrowoop = oopDesc::load_heap_oop(p);
  51       if (!oopDesc::is_null(oop_or_narrowoop)) {
  52         oop o = oopDesc::decode_heap_oop_not_null(oop_or_narrowoop);


 184   }
 185 
 186   // Finish up any enqueued closure apps (attributed as object copy time).
 187   buf_scan_non_heap_roots.done();
 188   buf_scan_non_heap_weak_roots.done();
 189 
 190   double obj_copy_time_sec = buf_scan_non_heap_roots.closure_app_seconds()
 191       + buf_scan_non_heap_weak_roots.closure_app_seconds();
 192 
 193   phase_times->record_time_secs(G1GCPhaseTimes::ObjCopy, worker_i, obj_copy_time_sec);
 194 
 195   double ext_root_time_sec = os::elapsedTime() - ext_roots_start - obj_copy_time_sec;
 196 
 197   phase_times->record_time_secs(G1GCPhaseTimes::ExtRootScan, worker_i, ext_root_time_sec);
 198 
 199   // During conc marking we have to filter the per-thread SATB buffers
 200   // to make sure we remove any oops into the CSet (which will show up
 201   // as implicitly live).
 202   {
 203     G1GCParPhaseTimesTracker x(phase_times, G1GCPhaseTimes::SATBFiltering, worker_i);
 204     if (!_process_strong_tasks->is_task_claimed(G1RP_PS_filter_satb_buffers) && _g1h->mark_in_progress()) {
 205       JavaThread::satb_mark_queue_set().filter_thread_buffers();
 206     }
 207   }
 208 
 209   _process_strong_tasks->all_tasks_completed();
 210 }
 211 
 212 void G1RootProcessor::process_strong_roots(OopClosure* oops,
 213                                            CLDClosure* clds,
 214                                            CodeBlobClosure* blobs) {
 215 
 216   process_java_roots(oops, clds, clds, NULL, blobs, NULL, 0);
 217   process_vm_roots(oops, NULL, NULL, 0);
 218 
 219   _process_strong_tasks->all_tasks_completed();
 220 }
 221 
 222 void G1RootProcessor::process_all_roots(OopClosure* oops,
 223                                         CLDClosure* clds,
 224                                         CodeBlobClosure* blobs) {




  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 #include "precompiled.hpp"
  26 
  27 #include "classfile/stringTable.hpp"
  28 #include "classfile/systemDictionary.hpp"
  29 #include "code/codeCache.hpp"
  30 #include "gc_implementation/g1/bufferingOopClosure.hpp"
  31 #include "gc_implementation/g1/g1CollectedHeap.inline.hpp"
  32 #include "gc_implementation/g1/g1CollectorPolicy.hpp"
  33 #include "gc_implementation/g1/g1CollectorState.hpp"
  34 #include "gc_implementation/g1/g1GCPhaseTimes.hpp"
  35 #include "gc_implementation/g1/g1RemSet.inline.hpp"
  36 #include "gc_implementation/g1/g1RootProcessor.hpp"
  37 #include "memory/allocation.inline.hpp"
  38 #include "runtime/fprofiler.hpp"
  39 #include "runtime/mutex.hpp"
  40 #include "services/management.hpp"
  41 
  42 class G1CodeBlobClosure : public CodeBlobClosure {
  43   class HeapRegionGatheringOopClosure : public OopClosure {
  44     G1CollectedHeap* _g1h;
  45     OopClosure* _work;
  46     nmethod* _nm;
  47 
  48     template <typename T>
  49     void do_oop_work(T* p) {
  50       _work->do_oop(p);
  51       T oop_or_narrowoop = oopDesc::load_heap_oop(p);
  52       if (!oopDesc::is_null(oop_or_narrowoop)) {
  53         oop o = oopDesc::decode_heap_oop_not_null(oop_or_narrowoop);


 185   }
 186 
 187   // Finish up any enqueued closure apps (attributed as object copy time).
 188   buf_scan_non_heap_roots.done();
 189   buf_scan_non_heap_weak_roots.done();
 190 
 191   double obj_copy_time_sec = buf_scan_non_heap_roots.closure_app_seconds()
 192       + buf_scan_non_heap_weak_roots.closure_app_seconds();
 193 
 194   phase_times->record_time_secs(G1GCPhaseTimes::ObjCopy, worker_i, obj_copy_time_sec);
 195 
 196   double ext_root_time_sec = os::elapsedTime() - ext_roots_start - obj_copy_time_sec;
 197 
 198   phase_times->record_time_secs(G1GCPhaseTimes::ExtRootScan, worker_i, ext_root_time_sec);
 199 
 200   // During conc marking we have to filter the per-thread SATB buffers
 201   // to make sure we remove any oops into the CSet (which will show up
 202   // as implicitly live).
 203   {
 204     G1GCParPhaseTimesTracker x(phase_times, G1GCPhaseTimes::SATBFiltering, worker_i);
 205     if (!_process_strong_tasks->is_task_claimed(G1RP_PS_filter_satb_buffers) && _g1h->collector_state()->mark_in_progress()) {
 206       JavaThread::satb_mark_queue_set().filter_thread_buffers();
 207     }
 208   }
 209 
 210   _process_strong_tasks->all_tasks_completed();
 211 }
 212 
 213 void G1RootProcessor::process_strong_roots(OopClosure* oops,
 214                                            CLDClosure* clds,
 215                                            CodeBlobClosure* blobs) {
 216 
 217   process_java_roots(oops, clds, clds, NULL, blobs, NULL, 0);
 218   process_vm_roots(oops, NULL, NULL, 0);
 219 
 220   _process_strong_tasks->all_tasks_completed();
 221 }
 222 
 223 void G1RootProcessor::process_all_roots(OopClosure* oops,
 224                                         CLDClosure* clds,
 225                                         CodeBlobClosure* blobs) {


< prev index next >