hotspot/src/share/vm/gc_implementation/parallelScavenge/psParallelCompact.hpp
changeset 360 21d113ecbf6a
parent 1 489c9b5090e2
child 971 f0b20be4165d
child 670 ddf3e9583f2f
equal deleted inserted replaced
357:f4edb0d9f109 360:21d113ecbf6a
    78   // Sizes are in HeapWords, unless indicated otherwise.
    78   // Sizes are in HeapWords, unless indicated otherwise.
    79   static const size_t Log2ChunkSize;
    79   static const size_t Log2ChunkSize;
    80   static const size_t ChunkSize;
    80   static const size_t ChunkSize;
    81   static const size_t ChunkSizeBytes;
    81   static const size_t ChunkSizeBytes;
    82 
    82 
    83  // Mask for the bits in a size_t to get an offset within a chunk.
    83   // Mask for the bits in a size_t to get an offset within a chunk.
    84   static const size_t ChunkSizeOffsetMask;
    84   static const size_t ChunkSizeOffsetMask;
    85  // Mask for the bits in a pointer to get an offset within a chunk.
    85   // Mask for the bits in a pointer to get an offset within a chunk.
    86   static const size_t ChunkAddrOffsetMask;
    86   static const size_t ChunkAddrOffsetMask;
    87  // Mask for the bits in a pointer to get the address of the start of a chunk.
    87   // Mask for the bits in a pointer to get the address of the start of a chunk.
    88   static const size_t ChunkAddrMask;
    88   static const size_t ChunkAddrMask;
    89 
    89 
    90   static const size_t Log2BlockSize;
    90   static const size_t Log2BlockSize;
    91   static const size_t BlockSize;
    91   static const size_t BlockSize;
    92   static const size_t BlockOffsetMask;
    92   static const size_t BlockOffsetMask;
   227   // 'parity' of the first 1 bit in the Block:  a positive offset means the
   227   // 'parity' of the first 1 bit in the Block:  a positive offset means the
   228   // first 1 bit marks the start of an object, a negative offset means the first
   228   // first 1 bit marks the start of an object, a negative offset means the first
   229   // 1 bit marks the end of an object.
   229   // 1 bit marks the end of an object.
   230   class BlockData
   230   class BlockData
   231   {
   231   {
   232   public:
   232    public:
   233     typedef short int blk_ofs_t;
   233     typedef short int blk_ofs_t;
   234 
   234 
   235     blk_ofs_t offset() const { return _offset >= 0 ? _offset : -_offset; }
   235     blk_ofs_t offset() const { return _offset >= 0 ? _offset : -_offset; }
   236     blk_ofs_t raw_offset() const { return _offset; }
   236     blk_ofs_t raw_offset() const { return _offset; }
   237     void set_first_is_start_bit(bool v) { _first_is_start_bit = v; }
   237     void set_first_is_start_bit(bool v) { _first_is_start_bit = v; }
   267     bool first_is_end_bit() {
   267     bool first_is_end_bit() {
   268       assert(_set_phase > 0, "Not initialized");
   268       assert(_set_phase > 0, "Not initialized");
   269       return !_first_is_start_bit;
   269       return !_first_is_start_bit;
   270     }
   270     }
   271 
   271 
   272   private:
   272    private:
   273     blk_ofs_t _offset;
   273     blk_ofs_t _offset;
   274     // This is temporary until the mark_bitmap is separated into
   274     // This is temporary until the mark_bitmap is separated into
   275     // a start bit array and an end bit array.
   275     // a start bit array and an end bit array.
   276     bool      _first_is_start_bit;
   276     bool      _first_is_start_bit;
   277 #ifdef ASSERT
   277 #ifdef ASSERT
   278     short     _set_phase;
   278     short     _set_phase;
   279     static short _cur_phase;
   279     static short _cur_phase;
   280   public:
   280    public:
   281     static void set_cur_phase(short v) { _cur_phase = v; }
   281     static void set_cur_phase(short v) { _cur_phase = v; }
   282 #endif
   282 #endif
   283   };
   283   };
   284 
   284 
   285 public:
   285 public:
   727     perm_space_id, old_space_id, eden_space_id,
   727     perm_space_id, old_space_id, eden_space_id,
   728     from_space_id, to_space_id, last_space_id
   728     from_space_id, to_space_id, last_space_id
   729   } SpaceId;
   729   } SpaceId;
   730 
   730 
   731  public:
   731  public:
   732   // In line closure decls
   732   // Inline closure decls
   733   //
   733   //
   734 
       
   735   class IsAliveClosure: public BoolObjectClosure {
   734   class IsAliveClosure: public BoolObjectClosure {
   736    public:
   735    public:
   737     void do_object(oop p) { assert(false, "don't call"); }
   736     virtual void do_object(oop p);
   738     bool do_object_b(oop p) { return mark_bitmap()->is_marked(p); }
   737     virtual bool do_object_b(oop p);
   739   };
   738   };
   740 
   739 
   741   class KeepAliveClosure: public OopClosure {
   740   class KeepAliveClosure: public OopClosure {
       
   741    private:
       
   742     ParCompactionManager* _compaction_manager;
       
   743    protected:
       
   744     template <class T> inline void do_oop_work(T* p);
       
   745    public:
       
   746     KeepAliveClosure(ParCompactionManager* cm) : _compaction_manager(cm) { }
       
   747     virtual void do_oop(oop* p);
       
   748     virtual void do_oop(narrowOop* p);
       
   749   };
       
   750 
       
   751   // Current unused
       
   752   class FollowRootClosure: public OopsInGenClosure {
       
   753    private:
   742     ParCompactionManager* _compaction_manager;
   754     ParCompactionManager* _compaction_manager;
   743    public:
   755    public:
   744     KeepAliveClosure(ParCompactionManager* cm) {
   756     FollowRootClosure(ParCompactionManager* cm) : _compaction_manager(cm) { }
   745       _compaction_manager = cm;
   757     virtual void do_oop(oop* p);
   746     }
   758     virtual void do_oop(narrowOop* p);
   747     void do_oop(oop* p);
   759     virtual const bool do_nmethods() const { return true; }
   748   };
   760   };
   749 
   761 
   750   class FollowRootClosure: public OopsInGenClosure{
   762   class FollowStackClosure: public VoidClosure {
       
   763    private:
   751     ParCompactionManager* _compaction_manager;
   764     ParCompactionManager* _compaction_manager;
   752    public:
   765    public:
   753     FollowRootClosure(ParCompactionManager* cm) {
   766     FollowStackClosure(ParCompactionManager* cm) : _compaction_manager(cm) { }
   754       _compaction_manager = cm;
   767     virtual void do_void();
   755     }
       
   756     void do_oop(oop* p) { follow_root(_compaction_manager, p); }
       
   757     virtual const bool do_nmethods() const { return true; }
       
   758   };
   768   };
   759 
   769 
   760   class FollowStackClosure: public VoidClosure {
       
   761     ParCompactionManager* _compaction_manager;
       
   762    public:
       
   763     FollowStackClosure(ParCompactionManager* cm) {
       
   764       _compaction_manager = cm;
       
   765     }
       
   766     void do_void() { follow_stack(_compaction_manager); }
       
   767   };
       
   768 
       
   769   class AdjustPointerClosure: public OopsInGenClosure {
   770   class AdjustPointerClosure: public OopsInGenClosure {
       
   771    private:
   770     bool _is_root;
   772     bool _is_root;
   771    public:
   773    public:
   772     AdjustPointerClosure(bool is_root) : _is_root(is_root) {}
   774     AdjustPointerClosure(bool is_root) : _is_root(is_root) { }
   773     void do_oop(oop* p) { adjust_pointer(p, _is_root); }
   775     virtual void do_oop(oop* p);
       
   776     virtual void do_oop(narrowOop* p);
   774   };
   777   };
   775 
   778 
   776   // Closure for verifying update of pointers.  Does not
   779   // Closure for verifying update of pointers.  Does not
   777   // have any side effects.
   780   // have any side effects.
   778   class VerifyUpdateClosure: public ParMarkBitMapClosure {
   781   class VerifyUpdateClosure: public ParMarkBitMapClosure {
   802   friend class FollowStackClosure;
   805   friend class FollowStackClosure;
   803   friend class AdjustPointerClosure;
   806   friend class AdjustPointerClosure;
   804   friend class FollowRootClosure;
   807   friend class FollowRootClosure;
   805   friend class instanceKlassKlass;
   808   friend class instanceKlassKlass;
   806   friend class RefProcTaskProxy;
   809   friend class RefProcTaskProxy;
   807 
       
   808   static void mark_and_push_internal(ParCompactionManager* cm, oop* p);
       
   809 
   810 
   810  private:
   811  private:
   811   static elapsedTimer         _accumulated_time;
   812   static elapsedTimer         _accumulated_time;
   812   static unsigned int         _total_invocations;
   813   static unsigned int         _total_invocations;
   813   static unsigned int         _maximum_compaction_gc_num;
   814   static unsigned int         _maximum_compaction_gc_num;
   836   static bool   _dwl_initialized;
   837   static bool   _dwl_initialized;
   837 #endif  // #ifdef ASSERT
   838 #endif  // #ifdef ASSERT
   838 
   839 
   839  private:
   840  private:
   840   // Closure accessors
   841   // Closure accessors
   841   static OopClosure* adjust_pointer_closure() { return (OopClosure*)&_adjust_pointer_closure; }
   842   static OopClosure* adjust_pointer_closure()      { return (OopClosure*)&_adjust_pointer_closure; }
   842   static OopClosure* adjust_root_pointer_closure() { return (OopClosure*)&_adjust_root_pointer_closure; }
   843   static OopClosure* adjust_root_pointer_closure() { return (OopClosure*)&_adjust_root_pointer_closure; }
   843   static BoolObjectClosure* is_alive_closure() { return (BoolObjectClosure*)&_is_alive_closure; }
   844   static BoolObjectClosure* is_alive_closure()     { return (BoolObjectClosure*)&_is_alive_closure; }
   844 
   845 
   845   static void initialize_space_info();
   846   static void initialize_space_info();
   846 
   847 
   847   // Return true if details about individual phases should be printed.
   848   // Return true if details about individual phases should be printed.
   848   static inline bool print_phases();
   849   static inline bool print_phases();
   857   static void marking_phase(ParCompactionManager* cm,
   858   static void marking_phase(ParCompactionManager* cm,
   858                             bool maximum_heap_compaction);
   859                             bool maximum_heap_compaction);
   859   static void follow_stack(ParCompactionManager* cm);
   860   static void follow_stack(ParCompactionManager* cm);
   860   static void follow_weak_klass_links(ParCompactionManager* cm);
   861   static void follow_weak_klass_links(ParCompactionManager* cm);
   861 
   862 
   862   static void adjust_pointer(oop* p, bool is_root);
   863   template <class T> static inline void adjust_pointer(T* p, bool is_root);
   863   static void adjust_root_pointer(oop* p) { adjust_pointer(p, true); }
   864   static void adjust_root_pointer(oop* p) { adjust_pointer(p, true); }
   864 
   865 
   865   static void follow_root(ParCompactionManager* cm, oop* p);
   866   template <class T>
       
   867   static inline void follow_root(ParCompactionManager* cm, T* p);
   866 
   868 
   867   // Compute the dense prefix for the designated space.  This is an experimental
   869   // Compute the dense prefix for the designated space.  This is an experimental
   868   // implementation currently not used in production.
   870   // implementation currently not used in production.
   869   static HeapWord* compute_dense_prefix_via_density(const SpaceId id,
   871   static HeapWord* compute_dense_prefix_via_density(const SpaceId id,
   870                                                     bool maximum_compaction);
   872                                                     bool maximum_compaction);
   969   // Reset time since last full gc
   971   // Reset time since last full gc
   970   static void reset_millis_since_last_gc();
   972   static void reset_millis_since_last_gc();
   971 
   973 
   972  protected:
   974  protected:
   973 #ifdef VALIDATE_MARK_SWEEP
   975 #ifdef VALIDATE_MARK_SWEEP
   974   static GrowableArray<oop*>*            _root_refs_stack;
   976   static GrowableArray<void*>*           _root_refs_stack;
   975   static GrowableArray<oop> *            _live_oops;
   977   static GrowableArray<oop> *            _live_oops;
   976   static GrowableArray<oop> *            _live_oops_moved_to;
   978   static GrowableArray<oop> *            _live_oops_moved_to;
   977   static GrowableArray<size_t>*          _live_oops_size;
   979   static GrowableArray<size_t>*          _live_oops_size;
   978   static size_t                          _live_oops_index;
   980   static size_t                          _live_oops_index;
   979   static size_t                          _live_oops_index_at_perm;
   981   static size_t                          _live_oops_index_at_perm;
   980   static GrowableArray<oop*>*            _other_refs_stack;
   982   static GrowableArray<void*>*           _other_refs_stack;
   981   static GrowableArray<oop*>*            _adjusted_pointers;
   983   static GrowableArray<void*>*           _adjusted_pointers;
   982   static bool                            _pointer_tracking;
   984   static bool                            _pointer_tracking;
   983   static bool                            _root_tracking;
   985   static bool                            _root_tracking;
   984 
   986 
   985   // The following arrays are saved since the time of the last GC and
   987   // The following arrays are saved since the time of the last GC and
   986   // assist in tracking down problems where someone has done an errant
   988   // assist in tracking down problems where someone has done an errant
   997   static GrowableArray<size_t>*          _last_gc_live_oops_size;
   999   static GrowableArray<size_t>*          _last_gc_live_oops_size;
   998 #endif
  1000 #endif
   999 
  1001 
  1000  public:
  1002  public:
  1001   class MarkAndPushClosure: public OopClosure {
  1003   class MarkAndPushClosure: public OopClosure {
       
  1004    private:
  1002     ParCompactionManager* _compaction_manager;
  1005     ParCompactionManager* _compaction_manager;
  1003    public:
  1006    public:
  1004     MarkAndPushClosure(ParCompactionManager* cm) {
  1007     MarkAndPushClosure(ParCompactionManager* cm) : _compaction_manager(cm) { }
  1005       _compaction_manager = cm;
  1008     virtual void do_oop(oop* p);
  1006     }
  1009     virtual void do_oop(narrowOop* p);
  1007     void do_oop(oop* p) { mark_and_push(_compaction_manager, p); }
       
  1008     virtual const bool do_nmethods() const { return true; }
  1010     virtual const bool do_nmethods() const { return true; }
  1009   };
  1011   };
  1010 
  1012 
  1011   PSParallelCompact();
  1013   PSParallelCompact();
  1012 
  1014 
  1036     return _updated_int_array_klass_obj;
  1038     return _updated_int_array_klass_obj;
  1037   }
  1039   }
  1038 
  1040 
  1039   // Marking support
  1041   // Marking support
  1040   static inline bool mark_obj(oop obj);
  1042   static inline bool mark_obj(oop obj);
  1041   static bool mark_obj(oop* p)  {
  1043   // Check mark and maybe push on marking stack
  1042     if (*p != NULL) {
  1044   template <class T> static inline void mark_and_push(ParCompactionManager* cm,
  1043       return mark_obj(*p);
  1045                                                       T* p);
  1044     } else {
       
  1045       return false;
       
  1046     }
       
  1047   }
       
  1048   static void mark_and_push(ParCompactionManager* cm, oop* p) {
       
  1049                                           // Check mark and maybe push on
       
  1050                                           // marking stack
       
  1051     oop m = *p;
       
  1052     if (m != NULL && mark_bitmap()->is_unmarked(m)) {
       
  1053       mark_and_push_internal(cm, p);
       
  1054     }
       
  1055   }
       
  1056 
  1046 
  1057   // Compaction support.
  1047   // Compaction support.
  1058   // Return true if p is in the range [beg_addr, end_addr).
  1048   // Return true if p is in the range [beg_addr, end_addr).
  1059   static inline bool is_in(HeapWord* p, HeapWord* beg_addr, HeapWord* end_addr);
  1049   static inline bool is_in(HeapWord* p, HeapWord* beg_addr, HeapWord* end_addr);
  1060   static inline bool is_in(oop* p, HeapWord* beg_addr, HeapWord* end_addr);
  1050   static inline bool is_in(oop* p, HeapWord* beg_addr, HeapWord* end_addr);
  1125 
  1115 
  1126   // Update the deferred objects in the space.
  1116   // Update the deferred objects in the space.
  1127   static void update_deferred_objects(ParCompactionManager* cm, SpaceId id);
  1117   static void update_deferred_objects(ParCompactionManager* cm, SpaceId id);
  1128 
  1118 
  1129   // Mark pointer and follow contents.
  1119   // Mark pointer and follow contents.
  1130   static void mark_and_follow(ParCompactionManager* cm, oop* p);
  1120   template <class T>
       
  1121   static inline void mark_and_follow(ParCompactionManager* cm, T* p);
  1131 
  1122 
  1132   static ParMarkBitMap* mark_bitmap() { return &_mark_bitmap; }
  1123   static ParMarkBitMap* mark_bitmap() { return &_mark_bitmap; }
  1133   static ParallelCompactData& summary_data() { return _summary_data; }
  1124   static ParallelCompactData& summary_data() { return _summary_data; }
  1134 
  1125 
  1135   static inline void adjust_pointer(oop* p) { adjust_pointer(p, false); }
  1126   static inline void adjust_pointer(oop* p)       { adjust_pointer(p, false); }
  1136   static inline void adjust_pointer(oop* p,
  1127   static inline void adjust_pointer(narrowOop* p) { adjust_pointer(p, false); }
       
  1128 
       
  1129   template <class T>
       
  1130   static inline void adjust_pointer(T* p,
  1137                                     HeapWord* beg_addr,
  1131                                     HeapWord* beg_addr,
  1138                                     HeapWord* end_addr);
  1132                                     HeapWord* end_addr);
  1139 
  1133 
  1140   // Reference Processing
  1134   // Reference Processing
  1141   static ReferenceProcessor* const ref_processor() { return _ref_processor; }
  1135   static ReferenceProcessor* const ref_processor() { return _ref_processor; }
  1145 
  1139 
  1146   // Time since last full gc (in milliseconds).
  1140   // Time since last full gc (in milliseconds).
  1147   static jlong millis_since_last_gc();
  1141   static jlong millis_since_last_gc();
  1148 
  1142 
  1149 #ifdef VALIDATE_MARK_SWEEP
  1143 #ifdef VALIDATE_MARK_SWEEP
  1150   static void track_adjusted_pointer(oop* p, oop newobj, bool isroot);
  1144   static void track_adjusted_pointer(void* p, bool isroot);
  1151   static void check_adjust_pointer(oop* p);     // Adjust this pointer
  1145   static void check_adjust_pointer(void* p);
  1152   static void track_interior_pointers(oop obj);
  1146   static void track_interior_pointers(oop obj);
  1153   static void check_interior_pointers();
  1147   static void check_interior_pointers();
  1154 
  1148 
  1155   static void reset_live_oop_tracking(bool at_perm);
  1149   static void reset_live_oop_tracking(bool at_perm);
  1156   static void register_live_oop(oop p, size_t size);
  1150   static void register_live_oop(oop p, size_t size);
  1183   // Verify that all the chunks have been emptied.
  1177   // Verify that all the chunks have been emptied.
  1184   static void verify_complete(SpaceId space_id);
  1178   static void verify_complete(SpaceId space_id);
  1185 #endif  // #ifdef ASSERT
  1179 #endif  // #ifdef ASSERT
  1186 };
  1180 };
  1187 
  1181 
  1188 bool PSParallelCompact::mark_obj(oop obj) {
  1182 inline bool PSParallelCompact::mark_obj(oop obj) {
  1189   const int obj_size = obj->size();
  1183   const int obj_size = obj->size();
  1190   if (mark_bitmap()->mark_obj(obj, obj_size)) {
  1184   if (mark_bitmap()->mark_obj(obj, obj_size)) {
  1191     _summary_data.add_obj(obj, obj_size);
  1185     _summary_data.add_obj(obj, obj_size);
  1192     return true;
  1186     return true;
  1193   } else {
  1187   } else {
  1194     return false;
  1188     return false;
  1195   }
  1189   }
  1196 }
  1190 }
  1197 
  1191 
  1198 inline bool PSParallelCompact::print_phases()
  1192 template <class T>
  1199 {
  1193 inline void PSParallelCompact::follow_root(ParCompactionManager* cm, T* p) {
       
  1194   assert(!Universe::heap()->is_in_reserved(p),
       
  1195          "roots shouldn't be things within the heap");
       
  1196 #ifdef VALIDATE_MARK_SWEEP
       
  1197   if (ValidateMarkSweep) {
       
  1198     guarantee(!_root_refs_stack->contains(p), "should only be in here once");
       
  1199     _root_refs_stack->push(p);
       
  1200   }
       
  1201 #endif
       
  1202   T heap_oop = oopDesc::load_heap_oop(p);
       
  1203   if (!oopDesc::is_null(heap_oop)) {
       
  1204     oop obj = oopDesc::decode_heap_oop_not_null(heap_oop);
       
  1205     if (mark_bitmap()->is_unmarked(obj)) {
       
  1206       if (mark_obj(obj)) {
       
  1207         obj->follow_contents(cm);
       
  1208       }
       
  1209     }
       
  1210   }
       
  1211   follow_stack(cm);
       
  1212 }
       
  1213 
       
  1214 template <class T>
       
  1215 inline void PSParallelCompact::mark_and_follow(ParCompactionManager* cm,
       
  1216                                                T* p) {
       
  1217   T heap_oop = oopDesc::load_heap_oop(p);
       
  1218   if (!oopDesc::is_null(heap_oop)) {
       
  1219     oop obj = oopDesc::decode_heap_oop_not_null(heap_oop);
       
  1220     if (mark_bitmap()->is_unmarked(obj)) {
       
  1221       if (mark_obj(obj)) {
       
  1222         obj->follow_contents(cm);
       
  1223       }
       
  1224     }
       
  1225   }
       
  1226 }
       
  1227 
       
  1228 template <class T>
       
  1229 inline void PSParallelCompact::mark_and_push(ParCompactionManager* cm, T* p) {
       
  1230   T heap_oop = oopDesc::load_heap_oop(p);
       
  1231   if (!oopDesc::is_null(heap_oop)) {
       
  1232     oop obj = oopDesc::decode_heap_oop_not_null(heap_oop);
       
  1233     if (mark_bitmap()->is_unmarked(obj)) {
       
  1234       if (mark_obj(obj)) {
       
  1235         // This thread marked the object and owns the subsequent processing of it.
       
  1236         cm->save_for_scanning(obj);
       
  1237       }
       
  1238     }
       
  1239   }
       
  1240 }
       
  1241 
       
  1242 template <class T>
       
  1243 inline void PSParallelCompact::adjust_pointer(T* p, bool isroot) {
       
  1244   T heap_oop = oopDesc::load_heap_oop(p);
       
  1245   if (!oopDesc::is_null(heap_oop)) {
       
  1246     oop obj     = oopDesc::decode_heap_oop_not_null(heap_oop);
       
  1247     oop new_obj = (oop)summary_data().calc_new_pointer(obj);
       
  1248     assert(new_obj != NULL ||                     // is forwarding ptr?
       
  1249            obj->is_shared(),                      // never forwarded?
       
  1250            "should be forwarded");
       
  1251     // Just always do the update unconditionally?
       
  1252     if (new_obj != NULL) {
       
  1253       assert(Universe::heap()->is_in_reserved(new_obj),
       
  1254              "should be in object space");
       
  1255       oopDesc::encode_store_heap_oop_not_null(p, new_obj);
       
  1256     }
       
  1257   }
       
  1258   VALIDATE_MARK_SWEEP_ONLY(track_adjusted_pointer(p, isroot));
       
  1259 }
       
  1260 
       
  1261 template <class T>
       
  1262 inline void PSParallelCompact::KeepAliveClosure::do_oop_work(T* p) {
       
  1263 #ifdef VALIDATE_MARK_SWEEP
       
  1264   if (ValidateMarkSweep) {
       
  1265     if (!Universe::heap()->is_in_reserved(p)) {
       
  1266       _root_refs_stack->push(p);
       
  1267     } else {
       
  1268       _other_refs_stack->push(p);
       
  1269     }
       
  1270   }
       
  1271 #endif
       
  1272   mark_and_push(_compaction_manager, p);
       
  1273 }
       
  1274 
       
  1275 inline bool PSParallelCompact::print_phases() {
  1200   return _print_phases;
  1276   return _print_phases;
  1201 }
  1277 }
  1202 
  1278 
  1203 inline double PSParallelCompact::normal_distribution(double density)
  1279 inline double PSParallelCompact::normal_distribution(double density) {
  1204 {
       
  1205   assert(_dwl_initialized, "uninitialized");
  1280   assert(_dwl_initialized, "uninitialized");
  1206   const double squared_term = (density - _dwl_mean) / _dwl_std_dev;
  1281   const double squared_term = (density - _dwl_mean) / _dwl_std_dev;
  1207   return _dwl_first_term * exp(-0.5 * squared_term * squared_term);
  1282   return _dwl_first_term * exp(-0.5 * squared_term * squared_term);
  1208 }
  1283 }
  1209 
  1284 
  1255 
  1330 
  1256 inline bool PSParallelCompact::should_update_klass(klassOop k) {
  1331 inline bool PSParallelCompact::should_update_klass(klassOop k) {
  1257   return ((HeapWord*) k) >= dense_prefix(perm_space_id);
  1332   return ((HeapWord*) k) >= dense_prefix(perm_space_id);
  1258 }
  1333 }
  1259 
  1334 
  1260 inline void PSParallelCompact::adjust_pointer(oop* p,
  1335 template <class T>
       
  1336 inline void PSParallelCompact::adjust_pointer(T* p,
  1261                                               HeapWord* beg_addr,
  1337                                               HeapWord* beg_addr,
  1262                                               HeapWord* end_addr) {
  1338                                               HeapWord* end_addr) {
  1263   if (is_in(p, beg_addr, end_addr)) {
  1339   if (is_in((HeapWord*)p, beg_addr, end_addr)) {
  1264     adjust_pointer(p);
  1340     adjust_pointer(p);
  1265   }
  1341   }
  1266 }
  1342 }
  1267 
  1343 
  1268 class MoveAndUpdateClosure: public ParMarkBitMapClosure {
  1344 class MoveAndUpdateClosure: public ParMarkBitMapClosure {
  1330   virtual IterationStatus do_addr(HeapWord* addr, size_t words);
  1406   virtual IterationStatus do_addr(HeapWord* addr, size_t words);
  1331 
  1407 
  1332   inline void do_addr(HeapWord* addr);
  1408   inline void do_addr(HeapWord* addr);
  1333 };
  1409 };
  1334 
  1410 
  1335 inline void UpdateOnlyClosure::do_addr(HeapWord* addr) {
  1411 inline void UpdateOnlyClosure::do_addr(HeapWord* addr)
       
  1412 {
  1336   _start_array->allocate_block(addr);
  1413   _start_array->allocate_block(addr);
  1337   oop(addr)->update_contents(compaction_manager());
  1414   oop(addr)->update_contents(compaction_manager());
  1338 }
  1415 }
  1339 
  1416 
  1340 class FillClosure: public ParMarkBitMapClosure {
  1417 class FillClosure: public ParMarkBitMapClosure {
  1341 public:
  1418  public:
  1342   FillClosure(ParCompactionManager* cm, PSParallelCompact::SpaceId space_id):
  1419   FillClosure(ParCompactionManager* cm, PSParallelCompact::SpaceId space_id) :
  1343     ParMarkBitMapClosure(PSParallelCompact::mark_bitmap(), cm),
  1420     ParMarkBitMapClosure(PSParallelCompact::mark_bitmap(), cm),
  1344     _space_id(space_id),
  1421     _space_id(space_id),
  1345     _start_array(PSParallelCompact::start_array(space_id))
  1422     _start_array(PSParallelCompact::start_array(space_id)) {
  1346   {
       
  1347     assert(_space_id == PSParallelCompact::perm_space_id ||
  1423     assert(_space_id == PSParallelCompact::perm_space_id ||
  1348            _space_id == PSParallelCompact::old_space_id,
  1424            _space_id == PSParallelCompact::old_space_id,
  1349            "cannot use FillClosure in the young gen");
  1425            "cannot use FillClosure in the young gen");
  1350     assert(bitmap() != NULL, "need a bitmap");
  1426     assert(bitmap() != NULL, "need a bitmap");
  1351     assert(_start_array != NULL, "need a start array");
  1427     assert(_start_array != NULL, "need a start array");