hotspot/src/share/vm/gc/parallel/psParallelCompact.hpp
changeset 35877 a2a62511d0f8
parent 35862 411842d0c882
child 36581 8d65a7db1582
equal deleted inserted replaced
35873:96fb98b25b13 35877:a2a62511d0f8
   449 
   449 
   450   // Return the address one past the end of the partial object.
   450   // Return the address one past the end of the partial object.
   451   HeapWord* partial_obj_end(size_t region_idx) const;
   451   HeapWord* partial_obj_end(size_t region_idx) const;
   452 
   452 
   453   // Return the location of the object after compaction.
   453   // Return the location of the object after compaction.
   454   HeapWord* calc_new_pointer(HeapWord* addr);
   454   HeapWord* calc_new_pointer(HeapWord* addr, ParCompactionManager* cm);
   455 
   455 
   456   HeapWord* calc_new_pointer(oop p) {
   456   HeapWord* calc_new_pointer(oop p, ParCompactionManager* cm) {
   457     return calc_new_pointer((HeapWord*) p);
   457     return calc_new_pointer((HeapWord*) p, cm);
   458   }
   458   }
   459 
   459 
   460 #ifdef  ASSERT
   460 #ifdef  ASSERT
   461   void verify_clear(const PSVirtualSpace* vspace);
   461   void verify_clear(const PSVirtualSpace* vspace);
   462   void verify_clear();
   462   void verify_clear();
   935     virtual bool do_object_b(oop p);
   935     virtual bool do_object_b(oop p);
   936   };
   936   };
   937 
   937 
   938   class AdjustPointerClosure: public ExtendedOopClosure {
   938   class AdjustPointerClosure: public ExtendedOopClosure {
   939    public:
   939    public:
       
   940     AdjustPointerClosure(ParCompactionManager* cm) {
       
   941       assert(cm != NULL, "associate ParCompactionManage should not be NULL");
       
   942       _cm = cm;
       
   943     }
   940     template <typename T> void do_oop_nv(T* p);
   944     template <typename T> void do_oop_nv(T* p);
   941     virtual void do_oop(oop* p);
   945     virtual void do_oop(oop* p);
   942     virtual void do_oop(narrowOop* p);
   946     virtual void do_oop(narrowOop* p);
   943 
   947 
   944     // This closure provides its own oop verification code.
   948     // This closure provides its own oop verification code.
   945     debug_only(virtual bool should_verify_oops() { return false; })
   949     debug_only(virtual bool should_verify_oops() { return false; })
       
   950    private:
       
   951     ParCompactionManager* _cm;
   946   };
   952   };
   947 
   953 
   948   class AdjustKlassClosure : public KlassClosure {
   954   class AdjustKlassClosure : public KlassClosure {
   949    public:
   955    public:
       
   956     AdjustKlassClosure(ParCompactionManager* cm) {
       
   957       assert(cm != NULL, "associate ParCompactionManage should not be NULL");
       
   958       _cm = cm;
       
   959     }
   950     void do_klass(Klass* klass);
   960     void do_klass(Klass* klass);
       
   961    private:
       
   962     ParCompactionManager* _cm;
   951   };
   963   };
   952 
   964 
   953   friend class AdjustPointerClosure;
   965   friend class AdjustPointerClosure;
   954   friend class AdjustKlassClosure;
   966   friend class AdjustKlassClosure;
   955   friend class RefProcTaskProxy;
   967   friend class RefProcTaskProxy;
   964   static CollectorCounters*   _counters;
   976   static CollectorCounters*   _counters;
   965   static ParMarkBitMap        _mark_bitmap;
   977   static ParMarkBitMap        _mark_bitmap;
   966   static ParallelCompactData  _summary_data;
   978   static ParallelCompactData  _summary_data;
   967   static IsAliveClosure       _is_alive_closure;
   979   static IsAliveClosure       _is_alive_closure;
   968   static SpaceInfo            _space_info[last_space_id];
   980   static SpaceInfo            _space_info[last_space_id];
   969   static AdjustPointerClosure _adjust_pointer_closure;
       
   970   static AdjustKlassClosure   _adjust_klass_closure;
       
   971 
   981 
   972   // Reference processing (used in ...follow_contents)
   982   // Reference processing (used in ...follow_contents)
   973   static ReferenceProcessor*  _ref_processor;
   983   static ReferenceProcessor*  _ref_processor;
   974 
   984 
   975   // Values computed at initialization and used by dead_wood_limiter().
   985   // Values computed at initialization and used by dead_wood_limiter().
  1061   static void summarize_spaces_quick();
  1071   static void summarize_spaces_quick();
  1062   static void summarize_space(SpaceId id, bool maximum_compaction);
  1072   static void summarize_space(SpaceId id, bool maximum_compaction);
  1063   static void summary_phase(ParCompactionManager* cm, bool maximum_compaction);
  1073   static void summary_phase(ParCompactionManager* cm, bool maximum_compaction);
  1064 
  1074 
  1065   // Adjust addresses in roots.  Does not adjust addresses in heap.
  1075   // Adjust addresses in roots.  Does not adjust addresses in heap.
  1066   static void adjust_roots();
  1076   static void adjust_roots(ParCompactionManager* cm);
  1067 
  1077 
  1068   DEBUG_ONLY(static void write_block_fill_histogram();)
  1078   DEBUG_ONLY(static void write_block_fill_histogram();)
  1069 
  1079 
  1070   // Move objects to new locations.
  1080   // Move objects to new locations.
  1071   static void compact_perm(ParCompactionManager* cm);
  1081   static void compact_perm(ParCompactionManager* cm);
  1107   // at a pointer where it would be appropriate to return a JNI_ENOMEM
  1117   // at a pointer where it would be appropriate to return a JNI_ENOMEM
  1108   // in the event of a failure.
  1118   // in the event of a failure.
  1109   static bool initialize();
  1119   static bool initialize();
  1110 
  1120 
  1111   // Closure accessors
  1121   // Closure accessors
  1112   static PSParallelCompact::AdjustPointerClosure* adjust_pointer_closure() {
       
  1113     return &_adjust_pointer_closure;
       
  1114   }
       
  1115   static KlassClosure* adjust_klass_closure()      { return (KlassClosure*)&_adjust_klass_closure; }
       
  1116   static BoolObjectClosure* is_alive_closure()     { return (BoolObjectClosure*)&_is_alive_closure; }
  1122   static BoolObjectClosure* is_alive_closure()     { return (BoolObjectClosure*)&_is_alive_closure; }
  1117 
  1123 
  1118   // Public accessors
  1124   // Public accessors
  1119   static elapsedTimer* accumulated_time() { return &_accumulated_time; }
  1125   static elapsedTimer* accumulated_time() { return &_accumulated_time; }
  1120   static unsigned int total_invocations() { return _total_invocations; }
  1126   static unsigned int total_invocations() { return _total_invocations; }
  1125 
  1131 
  1126   // Marking support
  1132   // Marking support
  1127   static inline bool mark_obj(oop obj);
  1133   static inline bool mark_obj(oop obj);
  1128   static inline bool is_marked(oop obj);
  1134   static inline bool is_marked(oop obj);
  1129 
  1135 
  1130   template <class T> static inline void adjust_pointer(T* p);
  1136   template <class T> static inline void adjust_pointer(T* p, ParCompactionManager* cm);
  1131 
  1137 
  1132   // Compaction support.
  1138   // Compaction support.
  1133   // Return true if p is in the range [beg_addr, end_addr).
  1139   // Return true if p is in the range [beg_addr, end_addr).
  1134   static inline bool is_in(HeapWord* p, HeapWord* beg_addr, HeapWord* end_addr);
  1140   static inline bool is_in(HeapWord* p, HeapWord* beg_addr, HeapWord* end_addr);
  1135   static inline bool is_in(oop* p, HeapWord* beg_addr, HeapWord* end_addr);
  1141   static inline bool is_in(oop* p, HeapWord* beg_addr, HeapWord* end_addr);