src/share/vm/gc_implementation/g1/concurrentMark.hpp

Print this page




 792   // subsequent oops_do() on the mark stack and
 793   // invalidate_entries_into_cset() on the region stack will iterate
 794   // only over indices valid at the time of this call.
 795   void set_oops_do_bound() {
 796     _markStack.set_oops_do_bound();
 797     _regionStack.set_oops_do_bound();
 798   }
 799   // Iterate over the oops in the mark stack and all local queues. It
 800   // also calls invalidate_entries_into_cset() on the region stack.
 801   void oops_do(OopClosure* f);
 802   // It is called at the end of an evacuation pause during marking so
 803   // that CM is notified of where the new end of the heap is. It
 804   // doesn't do anything if concurrent_marking_in_progress() is false,
 805   // unless the force parameter is true.
 806   void update_g1_committed(bool force = false);
 807 
 808   void complete_marking_in_collection_set();
 809 
 810   // It indicates that a new collection set is being chosen.
 811   void newCSet();

 812   // It registers a collection set heap region with CM. This is used
 813   // to determine whether any heap regions are located above the finger.
 814   void registerCSetRegion(HeapRegion* hr);
 815 








 816   // Registers the maximum region-end associated with a set of
 817   // regions with CM. Again this is used to determine whether any
 818   // heap regions are located above the finger.
 819   void register_collection_set_finger(HeapWord* max_finger) {
 820     // max_finger is the highest heap region end of the regions currently
 821     // contained in the collection set. If this value is larger than
 822     // _min_finger then we need to gray objects.
 823     // This routine is like registerCSetRegion but for an entire
 824     // collection of regions.
 825     if (max_finger > _min_finger)
 826       _should_gray_objects = true;
 827   }
 828 
 829   // Returns "true" if at least one mark has been completed.
 830   bool at_least_one_mark_complete() { return _at_least_one_mark_complete; }
 831 
 832   bool isMarked(oop p) const {
 833     assert(p != NULL && p->is_oop(), "expected an oop");
 834     HeapWord* addr = (HeapWord*)p;
 835     assert(addr >= _nextMarkBitMap->startWord() ||


1022   int                         _global_pushes;
1023   int                         _global_pops;
1024   int                         _global_max_size;
1025 
1026   int                         _global_transfers_to;
1027   int                         _global_transfers_from;
1028 
1029   int                         _region_stack_pops;
1030 
1031   int                         _regions_claimed;
1032   int                         _objs_found_on_bitmap;
1033 
1034   int                         _satb_buffers_processed;
1035 #endif // _MARKING_STATS_
1036 
1037   // it updates the local fields after this task has claimed
1038   // a new region to scan
1039   void setup_for_region(HeapRegion* hr);
1040   // it brings up-to-date the limit of the region
1041   void update_region_limit();
1042   // it resets the local fields after a task has finished scanning a
1043   // region
1044   void giveup_current_region();
1045 
1046   // called when either the words scanned or the refs visited limit
1047   // has been reached
1048   void reached_limit();
1049   // recalculates the words scanned and refs visited limits
1050   void recalculate_limits();
1051   // decreases the words scanned and refs visited limits when we reach
1052   // an expensive operation
1053   void decrease_limits();
1054   // it checks whether the words scanned or refs visited reached their
1055   // respective limit and calls reached_limit() if they have
1056   void check_limits() {
1057     if (_words_scanned >= _words_scanned_limit ||
1058         _refs_reached >= _refs_reached_limit)
1059       reached_limit();
1060   }
1061   // this is supposed to be called regularly during a marking step as
1062   // it checks a bunch of conditions that might cause the marking step
1063   // to abort
1064   void regular_clock_call();


1077   // trying not to exceed the given duration. However, it might exit
1078   // prematurely, according to some conditions (i.e. SATB buffers are
1079   // available for processing).
1080   void do_marking_step(double target_ms, bool do_stealing, bool do_termination);
1081 
1082   // These two calls start and stop the timer
1083   void record_start_time() {
1084     _elapsed_time_ms = os::elapsedTime() * 1000.0;
1085   }
1086   void record_end_time() {
1087     _elapsed_time_ms = os::elapsedTime() * 1000.0 - _elapsed_time_ms;
1088   }
1089 
1090   // returns the task ID
1091   int task_id() { return _task_id; }
1092 
1093   // From TerminatorTerminator. It determines whether this task should
1094   // exit the termination protocol after it's entered it.
1095   virtual bool should_exit_termination();
1096 





1097   HeapWord* finger()            { return _finger; }
1098 
1099   bool has_aborted()            { return _has_aborted; }
1100   void set_has_aborted()        { _has_aborted = true; }
1101   void clear_has_aborted()      { _has_aborted = false; }
1102   bool has_timed_out()          { return _has_timed_out; }
1103   bool claimed()                { return _claimed; }
1104 
1105   // Support routines for the partially scanned region that may be
1106   // recorded as a result of aborting while draining the CMRegionStack
1107   MemRegion aborted_region()    { return _aborted_region; }
1108   void set_aborted_region(MemRegion mr)
1109                                 { _aborted_region = mr; }
1110 
1111   // Clears any recorded partially scanned region
1112   void clear_aborted_region()   { set_aborted_region(MemRegion()); }
1113 
1114   void set_oop_closure(OopClosure* oop_closure) {
1115     _oop_closure = oop_closure;
1116   }




 792   // subsequent oops_do() on the mark stack and
 793   // invalidate_entries_into_cset() on the region stack will iterate
 794   // only over indices valid at the time of this call.
 795   void set_oops_do_bound() {
 796     _markStack.set_oops_do_bound();
 797     _regionStack.set_oops_do_bound();
 798   }
 799   // Iterate over the oops in the mark stack and all local queues. It
 800   // also calls invalidate_entries_into_cset() on the region stack.
 801   void oops_do(OopClosure* f);
 802   // It is called at the end of an evacuation pause during marking so
 803   // that CM is notified of where the new end of the heap is. It
 804   // doesn't do anything if concurrent_marking_in_progress() is false,
 805   // unless the force parameter is true.
 806   void update_g1_committed(bool force = false);
 807 
 808   void complete_marking_in_collection_set();
 809 
 810   // It indicates that a new collection set is being chosen.
 811   void newCSet();
 812 
 813   // It registers a collection set heap region with CM. This is used
 814   // to determine whether any heap regions are located above the finger.
 815   void registerCSetRegion(HeapRegion* hr);
 816 
 817   // Resets the region fields of any active CMTask whose region fields
 818   // are in the collection set (i.e. the region currently claimed by
 819   // the CMTask will be evacuated and may be used, subsequently, as
 820   // an alloc region). When this happens the region fields in the CMTask
 821   // are stale and, hence, should be cleared causing the worker thread
 822   // to claim a new region.
 823   void reset_active_task_region_fields_in_cset();
 824 
 825   // Registers the maximum region-end associated with a set of
 826   // regions with CM. Again this is used to determine whether any
 827   // heap regions are located above the finger.
 828   void register_collection_set_finger(HeapWord* max_finger) {
 829     // max_finger is the highest heap region end of the regions currently
 830     // contained in the collection set. If this value is larger than
 831     // _min_finger then we need to gray objects.
 832     // This routine is like registerCSetRegion but for an entire
 833     // collection of regions.
 834     if (max_finger > _min_finger)
 835       _should_gray_objects = true;
 836   }
 837 
 838   // Returns "true" if at least one mark has been completed.
 839   bool at_least_one_mark_complete() { return _at_least_one_mark_complete; }
 840 
 841   bool isMarked(oop p) const {
 842     assert(p != NULL && p->is_oop(), "expected an oop");
 843     HeapWord* addr = (HeapWord*)p;
 844     assert(addr >= _nextMarkBitMap->startWord() ||


1031   int                         _global_pushes;
1032   int                         _global_pops;
1033   int                         _global_max_size;
1034 
1035   int                         _global_transfers_to;
1036   int                         _global_transfers_from;
1037 
1038   int                         _region_stack_pops;
1039 
1040   int                         _regions_claimed;
1041   int                         _objs_found_on_bitmap;
1042 
1043   int                         _satb_buffers_processed;
1044 #endif // _MARKING_STATS_
1045 
1046   // it updates the local fields after this task has claimed
1047   // a new region to scan
1048   void setup_for_region(HeapRegion* hr);
1049   // it brings up-to-date the limit of the region
1050   void update_region_limit();



1051 
1052   // called when either the words scanned or the refs visited limit
1053   // has been reached
1054   void reached_limit();
1055   // recalculates the words scanned and refs visited limits
1056   void recalculate_limits();
1057   // decreases the words scanned and refs visited limits when we reach
1058   // an expensive operation
1059   void decrease_limits();
1060   // it checks whether the words scanned or refs visited reached their
1061   // respective limit and calls reached_limit() if they have
1062   void check_limits() {
1063     if (_words_scanned >= _words_scanned_limit ||
1064         _refs_reached >= _refs_reached_limit)
1065       reached_limit();
1066   }
1067   // this is supposed to be called regularly during a marking step as
1068   // it checks a bunch of conditions that might cause the marking step
1069   // to abort
1070   void regular_clock_call();


1083   // trying not to exceed the given duration. However, it might exit
1084   // prematurely, according to some conditions (i.e. SATB buffers are
1085   // available for processing).
1086   void do_marking_step(double target_ms, bool do_stealing, bool do_termination);
1087 
1088   // These two calls start and stop the timer
1089   void record_start_time() {
1090     _elapsed_time_ms = os::elapsedTime() * 1000.0;
1091   }
1092   void record_end_time() {
1093     _elapsed_time_ms = os::elapsedTime() * 1000.0 - _elapsed_time_ms;
1094   }
1095 
1096   // returns the task ID
1097   int task_id() { return _task_id; }
1098 
1099   // From TerminatorTerminator. It determines whether this task should
1100   // exit the termination protocol after it's entered it.
1101   virtual bool should_exit_termination();
1102 
1103   // Resets the local region fields after a task has finished scanning a
1104   // region; or when they have become stale as a result of the region
1105   // being evacuated.
1106   void giveup_current_region();
1107 
1108   HeapWord* finger()            { return _finger; }
1109 
1110   bool has_aborted()            { return _has_aborted; }
1111   void set_has_aborted()        { _has_aborted = true; }
1112   void clear_has_aborted()      { _has_aborted = false; }
1113   bool has_timed_out()          { return _has_timed_out; }
1114   bool claimed()                { return _claimed; }
1115 
1116   // Support routines for the partially scanned region that may be
1117   // recorded as a result of aborting while draining the CMRegionStack
1118   MemRegion aborted_region()    { return _aborted_region; }
1119   void set_aborted_region(MemRegion mr)
1120                                 { _aborted_region = mr; }
1121 
1122   // Clears any recorded partially scanned region
1123   void clear_aborted_region()   { set_aborted_region(MemRegion()); }
1124 
1125   void set_oop_closure(OopClosure* oop_closure) {
1126     _oop_closure = oop_closure;
1127   }