hotspot/src/share/vm/memory/space.cpp
changeset 360 21d113ecbf6a
parent 1 489c9b5090e2
child 593 803947e176bd
child 1374 4c24294029a9
equal deleted inserted replaced
357:f4edb0d9f109 360:21d113ecbf6a
    23  */
    23  */
    24 
    24 
    25 # include "incls/_precompiled.incl"
    25 # include "incls/_precompiled.incl"
    26 # include "incls/_space.cpp.incl"
    26 # include "incls/_space.cpp.incl"
    27 
    27 
       
    28 void SpaceMemRegionOopsIterClosure::do_oop(oop* p)       { SpaceMemRegionOopsIterClosure::do_oop_work(p); }
       
    29 void SpaceMemRegionOopsIterClosure::do_oop(narrowOop* p) { SpaceMemRegionOopsIterClosure::do_oop_work(p); }
       
    30 
    28 HeapWord* DirtyCardToOopClosure::get_actual_top(HeapWord* top,
    31 HeapWord* DirtyCardToOopClosure::get_actual_top(HeapWord* top,
    29                                                 HeapWord* top_obj) {
    32                                                 HeapWord* top_obj) {
    30   if (top_obj != NULL) {
    33   if (top_obj != NULL) {
    31     if (_sp->block_is_obj(top_obj)) {
    34     if (_sp->block_is_obj(top_obj)) {
    32       if (_precision == CardTableModRefBS::ObjHeadPreciseArray) {
    35       if (_precision == CardTableModRefBS::ObjHeadPreciseArray) {
   148                                           CardTableModRefBS::PrecisionStyle precision,
   151                                           CardTableModRefBS::PrecisionStyle precision,
   149                                           HeapWord* boundary) {
   152                                           HeapWord* boundary) {
   150   return new DirtyCardToOopClosure(this, cl, precision, boundary);
   153   return new DirtyCardToOopClosure(this, cl, precision, boundary);
   151 }
   154 }
   152 
   155 
   153 void FilteringClosure::do_oop(oop* p) {
       
   154   do_oop_nv(p);
       
   155 }
       
   156 
       
   157 HeapWord* ContiguousSpaceDCTOC::get_actual_top(HeapWord* top,
   156 HeapWord* ContiguousSpaceDCTOC::get_actual_top(HeapWord* top,
   158                                                HeapWord* top_obj) {
   157                                                HeapWord* top_obj) {
   159   if (top_obj != NULL && top_obj < (_sp->toContiguousSpace())->top()) {
   158   if (top_obj != NULL && top_obj < (_sp->toContiguousSpace())->top()) {
   160     if (_precision == CardTableModRefBS::ObjHeadPreciseArray) {
   159     if (_precision == CardTableModRefBS::ObjHeadPreciseArray) {
   161       if (oop(top_obj)->is_objArray() || oop(top_obj)->is_typeArray()) {
   160       if (oop(top_obj)->is_objArray() || oop(top_obj)->is_typeArray()) {
   335     // mark and handle it specially later on.
   334     // mark and handle it specially later on.
   336     q->init_mark();
   335     q->init_mark();
   337     assert(q->forwardee() == NULL, "should be forwarded to NULL");
   336     assert(q->forwardee() == NULL, "should be forwarded to NULL");
   338   }
   337   }
   339 
   338 
   340   debug_only(MarkSweep::register_live_oop(q, size));
   339   VALIDATE_MARK_SWEEP_ONLY(MarkSweep::register_live_oop(q, size));
   341   compact_top += size;
   340   compact_top += size;
   342 
   341 
   343   // we need to update the offset table so that the beginnings of objects can be
   342   // we need to update the offset table so that the beginnings of objects can be
   344   // found during scavenge.  Note that we are updating the offset table based on
   343   // found during scavenge.  Note that we are updating the offset table based on
   345   // where the object will be once the compaction phase finishes.
   344   // where the object will be once the compaction phase finishes.
   404   debug_only(HeapWord* prev_q = NULL);
   403   debug_only(HeapWord* prev_q = NULL);
   405   while (q < t) {
   404   while (q < t) {
   406     if (oop(q)->is_gc_marked()) {
   405     if (oop(q)->is_gc_marked()) {
   407       // q is alive
   406       // q is alive
   408 
   407 
   409       debug_only(MarkSweep::track_interior_pointers(oop(q)));
   408       VALIDATE_MARK_SWEEP_ONLY(MarkSweep::track_interior_pointers(oop(q)));
   410       // point all the oops to the new location
   409       // point all the oops to the new location
   411       size_t size = oop(q)->adjust_pointers();
   410       size_t size = oop(q)->adjust_pointers();
   412       debug_only(MarkSweep::check_interior_pointers());
   411       VALIDATE_MARK_SWEEP_ONLY(MarkSweep::check_interior_pointers());
   413 
   412 
   414       debug_only(prev_q = q);
   413       debug_only(prev_q = q);
   415       debug_only(MarkSweep::validate_live_oop(oop(q), size));
   414       VALIDATE_MARK_SWEEP_ONLY(MarkSweep::validate_live_oop(oop(q), size));
   416 
   415 
   417       q += size;
   416       q += size;
   418     } else {
   417     } else {
   419       // q is not a live object.  But we're not in a compactible space,
   418       // q is not a live object.  But we're not in a compactible space,
   420       // So we don't have live ranges.
   419       // So we don't have live ranges.
   882 }
   881 }
   883 
   882 
   884 
   883 
   885 class VerifyOldOopClosure : public OopClosure {
   884 class VerifyOldOopClosure : public OopClosure {
   886  public:
   885  public:
   887   oop the_obj;
   886   oop  _the_obj;
   888   bool allow_dirty;
   887   bool _allow_dirty;
   889   void do_oop(oop* p) {
   888   void do_oop(oop* p) {
   890     the_obj->verify_old_oop(p, allow_dirty);
   889     _the_obj->verify_old_oop(p, _allow_dirty);
       
   890   }
       
   891   void do_oop(narrowOop* p) {
       
   892     _the_obj->verify_old_oop(p, _allow_dirty);
   891   }
   893   }
   892 };
   894 };
   893 
   895 
   894 #define OBJ_SAMPLE_INTERVAL 0
   896 #define OBJ_SAMPLE_INTERVAL 0
   895 #define BLOCK_SAMPLE_INTERVAL 100
   897 #define BLOCK_SAMPLE_INTERVAL 100
   896 
   898 
   897 void OffsetTableContigSpace::verify(bool allow_dirty) const {
   899 void OffsetTableContigSpace::verify(bool allow_dirty) const {
   898   HeapWord* p = bottom();
   900   HeapWord* p = bottom();
   899   HeapWord* prev_p = NULL;
   901   HeapWord* prev_p = NULL;
   900   VerifyOldOopClosure blk;      // Does this do anything?
   902   VerifyOldOopClosure blk;      // Does this do anything?
   901   blk.allow_dirty = allow_dirty;
   903   blk._allow_dirty = allow_dirty;
   902   int objs = 0;
   904   int objs = 0;
   903   int blocks = 0;
   905   int blocks = 0;
   904 
   906 
   905   if (VerifyObjectStartArray) {
   907   if (VerifyObjectStartArray) {
   906     _offsets.verify();
   908     _offsets.verify();
   917       blocks++;
   919       blocks++;
   918     }
   920     }
   919 
   921 
   920     if (objs == OBJ_SAMPLE_INTERVAL) {
   922     if (objs == OBJ_SAMPLE_INTERVAL) {
   921       oop(p)->verify();
   923       oop(p)->verify();
   922       blk.the_obj = oop(p);
   924       blk._the_obj = oop(p);
   923       oop(p)->oop_iterate(&blk);
   925       oop(p)->oop_iterate(&blk);
   924       objs = 0;
   926       objs = 0;
   925     } else {
   927     } else {
   926       objs++;
   928       objs++;
   927     }
   929     }