src/hotspot/share/gc/g1/g1CollectedHeap.cpp
branchstuefe-new-metaspace-branch
changeset 58838 55ce65813b62
parent 58645 28c7e6711871
parent 58797 f29ca6895893
equal deleted inserted replaced
58807:3863dfd99d8e 58838:55ce65813b62
  1628   }
  1628   }
  1629   return JNI_OK;
  1629   return JNI_OK;
  1630 }
  1630 }
  1631 
  1631 
  1632 jint G1CollectedHeap::initialize() {
  1632 jint G1CollectedHeap::initialize() {
  1633   os::enable_vtime();
       
  1634 
  1633 
  1635   // Necessary to satisfy locking discipline assertions.
  1634   // Necessary to satisfy locking discipline assertions.
  1636 
  1635 
  1637   MutexLocker x(Heap_lock);
  1636   MutexLocker x(Heap_lock);
  1638 
  1637 
  3612       p->record_thread_work_item(termination_phase, worker_id, cl.term_attempts());
  3611       p->record_thread_work_item(termination_phase, worker_id, cl.term_attempts());
  3613     } else {
  3612     } else {
  3614       p->record_or_add_time_secs(termination_phase, worker_id, cl.term_time());
  3613       p->record_or_add_time_secs(termination_phase, worker_id, cl.term_time());
  3615       p->record_or_add_thread_work_item(termination_phase, worker_id, cl.term_attempts());
  3614       p->record_or_add_thread_work_item(termination_phase, worker_id, cl.term_attempts());
  3616     }
  3615     }
       
  3616     assert(pss->trim_ticks().seconds() == 0.0, "Unexpected partial trimming during evacuation");
  3617   }
  3617   }
  3618 
  3618 
  3619   virtual void start_work(uint worker_id) { }
  3619   virtual void start_work(uint worker_id) { }
  3620 
  3620 
  3621   virtual void end_work(uint worker_id) { }
  3621   virtual void end_work(uint worker_id) { }
  3653 };
  3653 };
  3654 
  3654 
  3655 class G1EvacuateRegionsTask : public G1EvacuateRegionsBaseTask {
  3655 class G1EvacuateRegionsTask : public G1EvacuateRegionsBaseTask {
  3656   G1RootProcessor* _root_processor;
  3656   G1RootProcessor* _root_processor;
  3657 
  3657 
  3658   void verify_trim_ticks(G1ParScanThreadState* pss, const char* location) {
       
  3659     assert(pss->trim_ticks().seconds() == 0.0, "Unexpected partial trimming during evacuation at %s %.3lf " JLONG_FORMAT, location, pss->trim_ticks().seconds(), pss->trim_ticks().value());
       
  3660   }
       
  3661 
       
  3662   void scan_roots(G1ParScanThreadState* pss, uint worker_id) {
  3658   void scan_roots(G1ParScanThreadState* pss, uint worker_id) {
  3663     _root_processor->evacuate_roots(pss, worker_id);
  3659     _root_processor->evacuate_roots(pss, worker_id);
  3664     verify_trim_ticks(pss, "roots");
       
  3665     _g1h->rem_set()->scan_heap_roots(pss, worker_id, G1GCPhaseTimes::ScanHR, G1GCPhaseTimes::ObjCopy);
  3660     _g1h->rem_set()->scan_heap_roots(pss, worker_id, G1GCPhaseTimes::ScanHR, G1GCPhaseTimes::ObjCopy);
  3666     verify_trim_ticks(pss, "heap roots");
       
  3667     _g1h->rem_set()->scan_collection_set_regions(pss, worker_id, G1GCPhaseTimes::ScanHR, G1GCPhaseTimes::CodeRoots, G1GCPhaseTimes::ObjCopy);
  3661     _g1h->rem_set()->scan_collection_set_regions(pss, worker_id, G1GCPhaseTimes::ScanHR, G1GCPhaseTimes::CodeRoots, G1GCPhaseTimes::ObjCopy);
  3668     verify_trim_ticks(pss, "scan cset");
       
  3669   }
  3662   }
  3670 
  3663 
  3671   void evacuate_live_objects(G1ParScanThreadState* pss, uint worker_id) {
  3664   void evacuate_live_objects(G1ParScanThreadState* pss, uint worker_id) {
  3672     G1EvacuateRegionsBaseTask::evacuate_live_objects(pss, worker_id, G1GCPhaseTimes::ObjCopy, G1GCPhaseTimes::Termination);
  3665     G1EvacuateRegionsBaseTask::evacuate_live_objects(pss, worker_id, G1GCPhaseTimes::ObjCopy, G1GCPhaseTimes::Termination);
  3673     verify_trim_ticks(pss, "evac live");
       
  3674   }
  3666   }
  3675 
  3667 
  3676   void start_work(uint worker_id) {
  3668   void start_work(uint worker_id) {
  3677     _g1h->phase_times()->record_time_secs(G1GCPhaseTimes::GCWorkerStart, worker_id, Ticks::now().seconds());
  3669     _g1h->phase_times()->record_time_secs(G1GCPhaseTimes::GCWorkerStart, worker_id, Ticks::now().seconds());
  3678   }
  3670   }
  4104 
  4096 
  4105   void complete_work() {
  4097   void complete_work() {
  4106     _cl.complete_work();
  4098     _cl.complete_work();
  4107 
  4099 
  4108     G1Policy* policy = G1CollectedHeap::heap()->policy();
  4100     G1Policy* policy = G1CollectedHeap::heap()->policy();
  4109     policy->record_max_rs_length(_rs_length);
  4101     policy->record_rs_length(_rs_length);
  4110     policy->cset_regions_freed();
  4102     policy->cset_regions_freed();
  4111   }
  4103   }
  4112 public:
  4104 public:
  4113   G1FreeCollectionSetTask(G1CollectionSet* collection_set, G1EvacuationInfo* evacuation_info, const size_t* surviving_young_words) :
  4105   G1FreeCollectionSetTask(G1CollectionSet* collection_set, G1EvacuationInfo* evacuation_info, const size_t* surviving_young_words) :
  4114     AbstractGangTask("G1 Free Collection Set"),
  4106     AbstractGangTask("G1 Free Collection Set"),