src/share/vm/memory/space.hpp

changeset 4037
da91efe96a93
parent 3900
d2a62e0f25eb
child 4384
b735136e0d82
     1.1 --- a/src/share/vm/memory/space.hpp	Fri Aug 31 16:39:35 2012 -0700
     1.2 +++ b/src/share/vm/memory/space.hpp	Sat Sep 01 13:25:18 2012 -0400
     1.3 @@ -65,7 +65,6 @@
     1.4  //       - OffsetTableContigSpace -- contiguous space with a block offset array
     1.5  //                          that allows "fast" block_start calls
     1.6  //         - TenuredSpace -- (used for TenuredGeneration)
     1.7 -//         - ContigPermSpace -- an offset table contiguous space for perm gen
     1.8  
     1.9  // Forward decls.
    1.10  class Space;
    1.11 @@ -79,9 +78,9 @@
    1.12  class DirtyCardToOopClosure;
    1.13  
    1.14  // An oop closure that is circumscribed by a filtering memory region.
    1.15 -class SpaceMemRegionOopsIterClosure: public OopClosure {
    1.16 +class SpaceMemRegionOopsIterClosure: public ExtendedOopClosure {
    1.17   private:
    1.18 -  OopClosure* _cl;
    1.19 +  ExtendedOopClosure* _cl;
    1.20    MemRegion   _mr;
    1.21   protected:
    1.22    template <class T> void do_oop_work(T* p) {
    1.23 @@ -90,10 +89,17 @@
    1.24      }
    1.25    }
    1.26   public:
    1.27 -  SpaceMemRegionOopsIterClosure(OopClosure* cl, MemRegion mr):
    1.28 +  SpaceMemRegionOopsIterClosure(ExtendedOopClosure* cl, MemRegion mr):
    1.29      _cl(cl), _mr(mr) {}
    1.30    virtual void do_oop(oop* p);
    1.31    virtual void do_oop(narrowOop* p);
    1.32 +  virtual bool do_metadata() {
    1.33 +    // _cl is of type ExtendedOopClosure instead of OopClosure, so that we can check this.
    1.34 +    assert(!_cl->do_metadata(), "I've checked all call paths, this shouldn't happen.");
    1.35 +    return false;
    1.36 +  }
    1.37 +  virtual void do_klass(Klass* k)                         { ShouldNotReachHere(); }
    1.38 +  virtual void do_class_loader_data(ClassLoaderData* cld) { ShouldNotReachHere(); }
    1.39  };
    1.40  
    1.41  // A Space describes a heap area. Class Space is an abstract
    1.42 @@ -209,12 +215,12 @@
    1.43    // Iterate over all the ref-containing fields of all objects in the
    1.44    // space, calling "cl.do_oop" on each.  Fields in objects allocated by
    1.45    // applications of the closure are not included in the iteration.
    1.46 -  virtual void oop_iterate(OopClosure* cl);
    1.47 +  virtual void oop_iterate(ExtendedOopClosure* cl);
    1.48  
    1.49    // Same as above, restricted to the intersection of a memory region and
    1.50    // the space.  Fields in objects allocated by applications of the closure
    1.51    // are not included in the iteration.
    1.52 -  virtual void oop_iterate(MemRegion mr, OopClosure* cl) = 0;
    1.53 +  virtual void oop_iterate(MemRegion mr, ExtendedOopClosure* cl) = 0;
    1.54  
    1.55    // Iterate over all objects in the space, calling "cl.do_object" on
    1.56    // each.  Objects allocated by applications of the closure are not
    1.57 @@ -246,7 +252,7 @@
    1.58    // overriden to return the appropriate type of closure
    1.59    // depending on the type of space in which the closure will
    1.60    // operate. ResourceArea allocated.
    1.61 -  virtual DirtyCardToOopClosure* new_dcto_cl(OopClosure* cl,
    1.62 +  virtual DirtyCardToOopClosure* new_dcto_cl(ExtendedOopClosure* cl,
    1.63                                               CardTableModRefBS::PrecisionStyle precision,
    1.64                                               HeapWord* boundary = NULL);
    1.65  
    1.66 @@ -321,7 +327,7 @@
    1.67  
    1.68  class DirtyCardToOopClosure: public MemRegionClosureRO {
    1.69  protected:
    1.70 -  OopClosure* _cl;
    1.71 +  ExtendedOopClosure* _cl;
    1.72    Space* _sp;
    1.73    CardTableModRefBS::PrecisionStyle _precision;
    1.74    HeapWord* _boundary;          // If non-NULL, process only non-NULL oops
    1.75 @@ -351,7 +357,7 @@
    1.76    virtual void walk_mem_region(MemRegion mr, HeapWord* bottom, HeapWord* top);
    1.77  
    1.78  public:
    1.79 -  DirtyCardToOopClosure(Space* sp, OopClosure* cl,
    1.80 +  DirtyCardToOopClosure(Space* sp, ExtendedOopClosure* cl,
    1.81                          CardTableModRefBS::PrecisionStyle precision,
    1.82                          HeapWord* boundary) :
    1.83      _sp(sp), _cl(cl), _precision(precision), _boundary(boundary),
    1.84 @@ -394,8 +400,6 @@
    1.85  class CompactibleSpace: public Space {
    1.86    friend class VMStructs;
    1.87    friend class CompactibleFreeListSpace;
    1.88 -  friend class CompactingPermGenGen;
    1.89 -  friend class CMSPermGenGen;
    1.90  private:
    1.91    HeapWord* _compaction_top;
    1.92    CompactibleSpace* _next_compaction_space;
    1.93 @@ -532,7 +536,7 @@
    1.94     * Occasionally, we want to ensure a full compaction, which is determined  \
    1.95     * by the MarkSweepAlwaysCompactCount parameter.                           \
    1.96     */                                                                        \
    1.97 -  int invocations = SharedHeap::heap()->perm_gen()->stat_record()->invocations;\
    1.98 +  int invocations = MarkSweep::total_invocations();                          \
    1.99    bool skip_dead = (MarkSweepAlwaysCompactCount < 1)                         \
   1.100      ||((invocations % MarkSweepAlwaysCompactCount) != 0);                    \
   1.101                                                                               \
   1.102 @@ -562,7 +566,6 @@
   1.103      if (block_is_obj(q) && oop(q)->is_gc_marked()) {                         \
   1.104        /* prefetch beyond q */                                                \
   1.105        Prefetch::write(q, interval);                                          \
   1.106 -      /* size_t size = oop(q)->size();  changing this for cms for perm gen */\
   1.107        size_t size = block_size(q);                                           \
   1.108        compact_top = cp->space->forward(oop(q), size, cp, compact_top);       \
   1.109        q += size;                                                             \
   1.110 @@ -647,7 +650,7 @@
   1.111        /* I originally tried to conjoin "block_start(q) == q" to the             \
   1.112         * assertion below, but that doesn't work, because you can't              \
   1.113         * accurately traverse previous objects to get to the current one         \
   1.114 -       * after their pointers (including pointers into permGen) have been       \
   1.115 +       * after their pointers have been                                         \
   1.116         * updated, until the actual compaction is done.  dld, 4/00 */            \
   1.117        assert(block_is_obj(q),                                                   \
   1.118               "should be at block boundaries, and should be looking at objs");   \
   1.119 @@ -871,8 +874,8 @@
   1.120    }
   1.121  
   1.122    // Iteration
   1.123 -  void oop_iterate(OopClosure* cl);
   1.124 -  void oop_iterate(MemRegion mr, OopClosure* cl);
   1.125 +  void oop_iterate(ExtendedOopClosure* cl);
   1.126 +  void oop_iterate(MemRegion mr, ExtendedOopClosure* cl);
   1.127    void object_iterate(ObjectClosure* blk);
   1.128    // For contiguous spaces this method will iterate safely over objects
   1.129    // in the space (i.e., between bottom and top) when at a safepoint.
   1.130 @@ -892,6 +895,7 @@
   1.131      _concurrent_iteration_safe_limit = new_limit;
   1.132    }
   1.133  
   1.134 +
   1.135  #ifndef SERIALGC
   1.136    // In support of parallel oop_iterate.
   1.137    #define ContigSpace_PAR_OOP_ITERATE_DECL(OopClosureType, nv_suffix)  \
   1.138 @@ -911,7 +915,7 @@
   1.139    virtual size_t minimum_free_block_size() const { return 0; }
   1.140  
   1.141    // Override.
   1.142 -  DirtyCardToOopClosure* new_dcto_cl(OopClosure* cl,
   1.143 +  DirtyCardToOopClosure* new_dcto_cl(ExtendedOopClosure* cl,
   1.144                                       CardTableModRefBS::PrecisionStyle precision,
   1.145                                       HeapWord* boundary = NULL);
   1.146  
   1.147 @@ -981,13 +985,13 @@
   1.148    // apparent.
   1.149    virtual void walk_mem_region_with_cl(MemRegion mr,
   1.150                                         HeapWord* bottom, HeapWord* top,
   1.151 -                                       OopClosure* cl) = 0;
   1.152 +                                       ExtendedOopClosure* cl) = 0;
   1.153    virtual void walk_mem_region_with_cl(MemRegion mr,
   1.154                                         HeapWord* bottom, HeapWord* top,
   1.155                                         FilteringClosure* cl) = 0;
   1.156  
   1.157  public:
   1.158 -  Filtering_DCTOC(Space* sp, OopClosure* cl,
   1.159 +  Filtering_DCTOC(Space* sp, ExtendedOopClosure* cl,
   1.160                    CardTableModRefBS::PrecisionStyle precision,
   1.161                    HeapWord* boundary) :
   1.162      DirtyCardToOopClosure(sp, cl, precision, boundary) {}
   1.163 @@ -1010,13 +1014,13 @@
   1.164  
   1.165    virtual void walk_mem_region_with_cl(MemRegion mr,
   1.166                                         HeapWord* bottom, HeapWord* top,
   1.167 -                                       OopClosure* cl);
   1.168 +                                       ExtendedOopClosure* cl);
   1.169    virtual void walk_mem_region_with_cl(MemRegion mr,
   1.170                                         HeapWord* bottom, HeapWord* top,
   1.171                                         FilteringClosure* cl);
   1.172  
   1.173  public:
   1.174 -  ContiguousSpaceDCTOC(ContiguousSpace* sp, OopClosure* cl,
   1.175 +  ContiguousSpaceDCTOC(ContiguousSpace* sp, ExtendedOopClosure* cl,
   1.176                         CardTableModRefBS::PrecisionStyle precision,
   1.177                         HeapWord* boundary) :
   1.178      Filtering_DCTOC(sp, cl, precision, boundary)
   1.179 @@ -1076,7 +1080,7 @@
   1.180  // A ContigSpace that Supports an efficient "block_start" operation via
   1.181  // a BlockOffsetArray (whose BlockOffsetSharedArray may be shared with
   1.182  // other spaces.)  This is the abstract base class for old generation
   1.183 -// (tenured, perm) spaces.
   1.184 +// (tenured) spaces.
   1.185  
   1.186  class OffsetTableContigSpace: public ContiguousSpace {
   1.187    friend class VMStructs;
   1.188 @@ -1108,9 +1112,6 @@
   1.189  
   1.190    // Debugging
   1.191    void verify() const;
   1.192 -
   1.193 -  // Shared space support
   1.194 -  void serialize_block_offset_array_offsets(SerializeOopClosure* soc);
   1.195  };
   1.196  
   1.197  
   1.198 @@ -1127,19 +1128,4 @@
   1.199                 MemRegion mr) :
   1.200      OffsetTableContigSpace(sharedOffsetArray, mr) {}
   1.201  };
   1.202 -
   1.203 -
   1.204 -// Class ContigPermSpace is used by CompactingPermGen
   1.205 -
   1.206 -class ContigPermSpace: public OffsetTableContigSpace {
   1.207 -  friend class VMStructs;
   1.208 - protected:
   1.209 -  // Mark sweep support
   1.210 -  size_t allowed_dead_ratio() const;
   1.211 - public:
   1.212 -  // Constructor
   1.213 -  ContigPermSpace(BlockOffsetSharedArray* sharedOffsetArray, MemRegion mr) :
   1.214 -    OffsetTableContigSpace(sharedOffsetArray, mr) {}
   1.215 -};
   1.216 -
   1.217  #endif // SHARE_VM_MEMORY_SPACE_HPP

mercurial