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

Print this page
rev 4802 : imported patch optimize-nmethod-scanning
rev 4803 : imported patch thomas-comments-2


 321   void set_young_type(YoungType new_type) {
 322     //assert(_young_type != new_type, "setting the same type" );
 323     // TODO: add more assertions here
 324     _young_type = new_type;
 325   }
 326 
 327   // Cached attributes used in the collection set policy information
 328 
 329   // The RSet length that was added to the total value
 330   // for the collection set.
 331   size_t _recorded_rs_length;
 332 
 333   // The predicted elapsed time that was added to total value
 334   // for the collection set.
 335   double _predicted_elapsed_time_ms;
 336 
 337   // The predicted number of bytes to copy that was added to
 338   // the total value for the collection set.
 339   size_t _predicted_bytes_to_copy;
 340 
 341   // A list of code blobs (nmethods) whose code contains pointers into this region
 342   GrowableArray<nmethod*>* _strong_code_root_list;
 343 
 344  public:
 345   HeapRegion(uint hrs_index,
 346              G1BlockOffsetSharedArray* sharedOffsetArray,
 347              MemRegion mr);
 348 
 349   static int    LogOfHRGrainBytes;
 350   static int    LogOfHRGrainWords;
 351 
 352   static size_t GrainBytes;
 353   static size_t GrainWords;
 354   static size_t CardsPerRegion;
 355 
 356   static size_t align_up_to_region_byte_size(size_t sz) {
 357     return (sz + (size_t) GrainBytes - 1) &
 358                                       ~((1 << (size_t) LogOfHRGrainBytes) - 1);
 359   }
 360 
 361   // It sets up the heap region size (GrainBytes / GrainWords), as
 362   // well as other related fields that are based on the heap region
 363   // size (LogOfHRGrainBytes / LogOfHRGrainWords /


 784   void set_recorded_rs_length(size_t rs_length) {
 785     _recorded_rs_length = rs_length;
 786   }
 787 
 788   void set_predicted_elapsed_time_ms(double ms) {
 789     _predicted_elapsed_time_ms = ms;
 790   }
 791 
 792   void set_predicted_bytes_to_copy(size_t bytes) {
 793     _predicted_bytes_to_copy = bytes;
 794   }
 795 
 796 #define HeapRegion_OOP_SINCE_SAVE_MARKS_DECL(OopClosureType, nv_suffix)  \
 797   virtual void oop_since_save_marks_iterate##nv_suffix(OopClosureType* cl);
 798   SPECIALIZED_SINCE_SAVE_MARKS_CLOSURES(HeapRegion_OOP_SINCE_SAVE_MARKS_DECL)
 799 
 800   virtual CompactibleSpace* next_compaction_space() const;
 801 
 802   virtual void reset_after_compaction();
 803 
 804   // Routines for managing the list of code roots that point into
 805   // this heap region.
 806   void add_strong_code_root(nmethod* nm);
 807   void remove_strong_code_root(nmethod* nm);
 808 
 809   GrowableArray<nmethod*>* strong_code_root_list() {
 810     return _strong_code_root_list;
 811   }
 812 
 813   // During a collection, migrate successfully evacuated strong
 814   // code roots attached to this region to the new regions that
 815   // they point into. Unsuccessfully evacuated code roots are
 816   // not migrated.
 817   void migrate_strong_code_roots();
 818 
 819   // Applies blk->do_code_blob() to each of the entries in
 820   // the strong code roots list;
 821   void strong_code_roots_do(CodeBlobClosure* blk) const;
 822 
 823   // Returns the amount of memory, in bytes, currently
 824   // consumed by the strong code roots.
 825   size_t strong_code_root_mem_size();
 826 
 827   // Verify that the entries on the strong code root list are live and
 828   // include at least one pointer into this region.
 829   void verify_strong_code_roots(VerifyOption vo, bool* failures) const;
 830 
 831   void print() const;
 832   void print_on(outputStream* st) const;
 833 
 834   // vo == UsePrevMarking  -> use "prev" marking information,
 835   // vo == UseNextMarking -> use "next" marking information
 836   // vo == UseMarkWord    -> use the mark word in the object header
 837   //
 838   // NOTE: Only the "prev" marking information is guaranteed to be
 839   // consistent most of the time, so most calls to this should use
 840   // vo == UsePrevMarking.
 841   // Currently, there is only one case where this is called with
 842   // vo == UseNextMarking, which is to verify the "next" marking
 843   // information at the end of remark.
 844   // Currently there is only one place where this is called with
 845   // vo == UseMarkWord, which is to verify the marking during a
 846   // full GC.
 847   void verify(VerifyOption vo, bool *failures) const;
 848 




 321   void set_young_type(YoungType new_type) {
 322     //assert(_young_type != new_type, "setting the same type" );
 323     // TODO: add more assertions here
 324     _young_type = new_type;
 325   }
 326 
 327   // Cached attributes used in the collection set policy information
 328 
 329   // The RSet length that was added to the total value
 330   // for the collection set.
 331   size_t _recorded_rs_length;
 332 
 333   // The predicted elapsed time that was added to total value
 334   // for the collection set.
 335   double _predicted_elapsed_time_ms;
 336 
 337   // The predicted number of bytes to copy that was added to
 338   // the total value for the collection set.
 339   size_t _predicted_bytes_to_copy;
 340 



 341  public:
 342   HeapRegion(uint hrs_index,
 343              G1BlockOffsetSharedArray* sharedOffsetArray,
 344              MemRegion mr);
 345 
 346   static int    LogOfHRGrainBytes;
 347   static int    LogOfHRGrainWords;
 348 
 349   static size_t GrainBytes;
 350   static size_t GrainWords;
 351   static size_t CardsPerRegion;
 352 
 353   static size_t align_up_to_region_byte_size(size_t sz) {
 354     return (sz + (size_t) GrainBytes - 1) &
 355                                       ~((1 << (size_t) LogOfHRGrainBytes) - 1);
 356   }
 357 
 358   // It sets up the heap region size (GrainBytes / GrainWords), as
 359   // well as other related fields that are based on the heap region
 360   // size (LogOfHRGrainBytes / LogOfHRGrainWords /


 781   void set_recorded_rs_length(size_t rs_length) {
 782     _recorded_rs_length = rs_length;
 783   }
 784 
 785   void set_predicted_elapsed_time_ms(double ms) {
 786     _predicted_elapsed_time_ms = ms;
 787   }
 788 
 789   void set_predicted_bytes_to_copy(size_t bytes) {
 790     _predicted_bytes_to_copy = bytes;
 791   }
 792 
 793 #define HeapRegion_OOP_SINCE_SAVE_MARKS_DECL(OopClosureType, nv_suffix)  \
 794   virtual void oop_since_save_marks_iterate##nv_suffix(OopClosureType* cl);
 795   SPECIALIZED_SINCE_SAVE_MARKS_CLOSURES(HeapRegion_OOP_SINCE_SAVE_MARKS_DECL)
 796 
 797   virtual CompactibleSpace* next_compaction_space() const;
 798 
 799   virtual void reset_after_compaction();
 800 
 801   // Routines for managing a list of code roots (attached to the
 802   // this region's RSet) that point into this heap region.
 803   void add_strong_code_root(nmethod* nm);
 804   void remove_strong_code_root(nmethod* nm);
 805 
 806   // During a collection, migrate the successfully evacuated
 807   // strong code roots that referenced into this region to the
 808   // new regions that they now point into. Unsuccessfully
 809   // evacuated code roots are not migrated.




 810   void migrate_strong_code_roots();
 811 
 812   // Applies blk->do_code_blob() to each of the entries in
 813   // the strong code roots list for this region
 814   void strong_code_roots_do(CodeBlobClosure* blk) const;
 815 
 816   // Verify that the entries on the strong code root list for this
 817   // region are live and include at least one pointer into this region.




 818   void verify_strong_code_roots(VerifyOption vo, bool* failures) const;
 819 
 820   void print() const;
 821   void print_on(outputStream* st) const;
 822 
 823   // vo == UsePrevMarking  -> use "prev" marking information,
 824   // vo == UseNextMarking -> use "next" marking information
 825   // vo == UseMarkWord    -> use the mark word in the object header
 826   //
 827   // NOTE: Only the "prev" marking information is guaranteed to be
 828   // consistent most of the time, so most calls to this should use
 829   // vo == UsePrevMarking.
 830   // Currently, there is only one case where this is called with
 831   // vo == UseNextMarking, which is to verify the "next" marking
 832   // information at the end of remark.
 833   // Currently there is only one place where this is called with
 834   // vo == UseMarkWord, which is to verify the marking during a
 835   // full GC.
 836   void verify(VerifyOption vo, bool *failures) const;
 837