< prev index next >

src/share/vm/gc_implementation/parallelScavenge/psParallelCompact.hpp

Print this page




 916 class PSParallelCompact : AllStatic {
 917  public:
 918   // Convenient access to type names.
 919   typedef ParMarkBitMap::idx_t idx_t;
 920   typedef ParallelCompactData::RegionData RegionData;
 921   typedef ParallelCompactData::BlockData BlockData;
 922 
 923   typedef enum {
 924     old_space_id, eden_space_id,
 925     from_space_id, to_space_id, last_space_id
 926   } SpaceId;
 927 
 928  public:
 929   // Inline closure decls
 930   //
 931   class IsAliveClosure: public BoolObjectClosure {
 932    public:
 933     virtual bool do_object_b(oop p);
 934   };
 935 
 936   class KeepAliveClosure: public OopClosure {
 937    private:
 938     ParCompactionManager* _compaction_manager;
 939    protected:
 940     template <class T> inline void do_oop_work(T* p);
 941    public:
 942     KeepAliveClosure(ParCompactionManager* cm) : _compaction_manager(cm) { }
 943     virtual void do_oop(oop* p);
 944     virtual void do_oop(narrowOop* p);
 945   };
 946 
 947   class FollowStackClosure: public VoidClosure {
 948    private:
 949     ParCompactionManager* _compaction_manager;
 950    public:
 951     FollowStackClosure(ParCompactionManager* cm) : _compaction_manager(cm) { }
 952     virtual void do_void();
 953   };
 954 
 955   class AdjustPointerClosure: public ExtendedOopClosure {
 956    public:
 957     template <typename T> void do_oop_nv(T* p);
 958     virtual void do_oop(oop* p);
 959     virtual void do_oop(narrowOop* p);
 960 
 961     // This closure provides its own oop verification code.
 962     debug_only(virtual bool should_verify_oops() { return false; })
 963   };
 964 
 965   class AdjustKlassClosure : public KlassClosure {
 966    public:
 967     void do_klass(Klass* klass);
 968   };
 969 
 970   friend class KeepAliveClosure;
 971   friend class FollowStackClosure;
 972   friend class AdjustPointerClosure;
 973   friend class AdjustKlassClosure;
 974   friend class FollowKlassClosure;
 975   friend class InstanceClassLoaderKlass;
 976   friend class RefProcTaskProxy;
 977 
 978  private:
 979   static STWGCTimer           _gc_timer;
 980   static ParallelOldTracer    _gc_tracer;
 981   static elapsedTimer         _accumulated_time;
 982   static unsigned int         _total_invocations;
 983   static unsigned int         _maximum_compaction_gc_num;
 984   static jlong                _time_of_last_gc;   // ms
 985   static CollectorCounters*   _counters;
 986   static ParMarkBitMap        _mark_bitmap;
 987   static ParallelCompactData  _summary_data;
 988   static IsAliveClosure       _is_alive_closure;
 989   static SpaceInfo            _space_info[last_space_id];
 990   static bool                 _print_phases;


1318 #ifdef  ASSERT
1319   // Sanity check the new location of a word in the heap.
1320   static inline void check_new_location(HeapWord* old_addr, HeapWord* new_addr);
1321   // Verify that all the regions have been emptied.
1322   static void verify_complete(SpaceId space_id);
1323 #endif  // #ifdef ASSERT
1324 };
1325 
1326 inline bool PSParallelCompact::mark_obj(oop obj) {
1327   const int obj_size = obj->size();
1328   if (mark_bitmap()->mark_obj(obj, obj_size)) {
1329     _summary_data.add_obj(obj, obj_size);
1330     return true;
1331   } else {
1332     return false;
1333   }
1334 }
1335 
1336 inline bool PSParallelCompact::is_marked(oop obj) {
1337   return mark_bitmap()->is_marked(obj);
1338 }
1339 
1340 template <class T>
1341 inline void PSParallelCompact::KeepAliveClosure::do_oop_work(T* p) {
1342   mark_and_push(_compaction_manager, p);
1343 }
1344 
1345 inline bool PSParallelCompact::print_phases() {
1346   return _print_phases;
1347 }
1348 
1349 inline double PSParallelCompact::normal_distribution(double density) {
1350   assert(_dwl_initialized, "uninitialized");
1351   const double squared_term = (density - _dwl_mean) / _dwl_std_dev;
1352   return _dwl_first_term * exp(-0.5 * squared_term * squared_term);
1353 }
1354 
1355 inline bool
1356 PSParallelCompact::dead_space_crosses_boundary(const RegionData* region,
1357                                                idx_t bit)
1358 {
1359   assert(bit > 0, "cannot call this for the first bit/region");
1360   assert(_summary_data.region_to_addr(region) == _mark_bitmap.bit_to_addr(bit),
1361          "sanity check");
1362 




 916 class PSParallelCompact : AllStatic {
 917  public:
 918   // Convenient access to type names.
 919   typedef ParMarkBitMap::idx_t idx_t;
 920   typedef ParallelCompactData::RegionData RegionData;
 921   typedef ParallelCompactData::BlockData BlockData;
 922 
 923   typedef enum {
 924     old_space_id, eden_space_id,
 925     from_space_id, to_space_id, last_space_id
 926   } SpaceId;
 927 
 928  public:
 929   // Inline closure decls
 930   //
 931   class IsAliveClosure: public BoolObjectClosure {
 932    public:
 933     virtual bool do_object_b(oop p);
 934   };
 935 











 936   class FollowStackClosure: public VoidClosure {
 937    private:
 938     ParCompactionManager* _compaction_manager;
 939    public:
 940     FollowStackClosure(ParCompactionManager* cm) : _compaction_manager(cm) { }
 941     virtual void do_void();
 942   };
 943 
 944   class AdjustPointerClosure: public ExtendedOopClosure {
 945    public:
 946     template <typename T> void do_oop_nv(T* p);
 947     virtual void do_oop(oop* p);
 948     virtual void do_oop(narrowOop* p);
 949 
 950     // This closure provides its own oop verification code.
 951     debug_only(virtual bool should_verify_oops() { return false; })
 952   };
 953 
 954   class AdjustKlassClosure : public KlassClosure {
 955    public:
 956     void do_klass(Klass* klass);
 957   };
 958 

 959   friend class FollowStackClosure;
 960   friend class AdjustPointerClosure;
 961   friend class AdjustKlassClosure;
 962   friend class FollowKlassClosure;
 963   friend class InstanceClassLoaderKlass;
 964   friend class RefProcTaskProxy;
 965 
 966  private:
 967   static STWGCTimer           _gc_timer;
 968   static ParallelOldTracer    _gc_tracer;
 969   static elapsedTimer         _accumulated_time;
 970   static unsigned int         _total_invocations;
 971   static unsigned int         _maximum_compaction_gc_num;
 972   static jlong                _time_of_last_gc;   // ms
 973   static CollectorCounters*   _counters;
 974   static ParMarkBitMap        _mark_bitmap;
 975   static ParallelCompactData  _summary_data;
 976   static IsAliveClosure       _is_alive_closure;
 977   static SpaceInfo            _space_info[last_space_id];
 978   static bool                 _print_phases;


1306 #ifdef  ASSERT
1307   // Sanity check the new location of a word in the heap.
1308   static inline void check_new_location(HeapWord* old_addr, HeapWord* new_addr);
1309   // Verify that all the regions have been emptied.
1310   static void verify_complete(SpaceId space_id);
1311 #endif  // #ifdef ASSERT
1312 };
1313 
1314 inline bool PSParallelCompact::mark_obj(oop obj) {
1315   const int obj_size = obj->size();
1316   if (mark_bitmap()->mark_obj(obj, obj_size)) {
1317     _summary_data.add_obj(obj, obj_size);
1318     return true;
1319   } else {
1320     return false;
1321   }
1322 }
1323 
1324 inline bool PSParallelCompact::is_marked(oop obj) {
1325   return mark_bitmap()->is_marked(obj);





1326 }
1327 
1328 inline bool PSParallelCompact::print_phases() {
1329   return _print_phases;
1330 }
1331 
1332 inline double PSParallelCompact::normal_distribution(double density) {
1333   assert(_dwl_initialized, "uninitialized");
1334   const double squared_term = (density - _dwl_mean) / _dwl_std_dev;
1335   return _dwl_first_term * exp(-0.5 * squared_term * squared_term);
1336 }
1337 
1338 inline bool
1339 PSParallelCompact::dead_space_crosses_boundary(const RegionData* region,
1340                                                idx_t bit)
1341 {
1342   assert(bit > 0, "cannot call this for the first bit/region");
1343   assert(_summary_data.region_to_addr(region) == _mark_bitmap.bit_to_addr(bit),
1344          "sanity check");
1345 


< prev index next >