src/hotspot/share/gc/shared/genCollectedHeap.hpp
changeset 47819 ee36a8e36561
parent 47624 b055cb5170f5
child 48168 cb5d2d4453d0
equal deleted inserted replaced
47818:2f6ab27efb60 47819:ee36a8e36561
    81   // Collects the given generation.
    81   // Collects the given generation.
    82   void collect_generation(Generation* gen, bool full, size_t size, bool is_tlab,
    82   void collect_generation(Generation* gen, bool full, size_t size, bool is_tlab,
    83                           bool run_verification, bool clear_soft_refs,
    83                           bool run_verification, bool clear_soft_refs,
    84                           bool restore_marks_for_biased_locking);
    84                           bool restore_marks_for_biased_locking);
    85 
    85 
       
    86   // Reserve aligned space for the heap as needed by the contained generations.
       
    87   char* allocate(size_t alignment, ReservedSpace* heap_rs);
       
    88 
       
    89   // Initialize ("weak") refs processing support
       
    90   void ref_processing_init();
       
    91 
    86 protected:
    92 protected:
    87 
    93 
    88   // The set of potentially parallel tasks in root scanning.
    94   // The set of potentially parallel tasks in root scanning.
    89   enum GCH_strong_roots_tasks {
    95   enum GCH_strong_roots_tasks {
    90     GCH_PS_Universe_oops_do,
    96     GCH_PS_Universe_oops_do,
   132 
   138 
   133   // Does the "cause" of GC indicate that
   139   // Does the "cause" of GC indicate that
   134   // we absolutely __must__ clear soft refs?
   140   // we absolutely __must__ clear soft refs?
   135   bool must_clear_all_soft_refs();
   141   bool must_clear_all_soft_refs();
   136 
   142 
       
   143   GenCollectedHeap(GenCollectorPolicy *policy);
       
   144 
       
   145   virtual void check_gen_kinds() = 0;
       
   146 
   137 public:
   147 public:
   138   GenCollectedHeap(GenCollectorPolicy *policy);
       
   139 
   148 
   140   // Returns JNI_OK on success
   149   // Returns JNI_OK on success
   141   virtual jint initialize();
   150   virtual jint initialize();
   142 
   151 
   143   // Reserve aligned space for the heap as needed by the contained generations.
       
   144   char* allocate(size_t alignment, ReservedSpace* heap_rs);
       
   145 
       
   146   // Does operations required after initialization has been done.
   152   // Does operations required after initialization has been done.
   147   void post_initialize();
   153   void post_initialize();
   148 
       
   149   virtual void check_gen_kinds();
       
   150 
       
   151   // Initialize ("weak") refs processing support
       
   152   virtual void ref_processing_init();
       
   153 
       
   154   virtual Name kind() const {
       
   155     return CollectedHeap::GenCollectedHeap;
       
   156   }
       
   157 
       
   158   virtual const char* name() const {
       
   159     return "Serial";
       
   160   }
       
   161 
   154 
   162   Generation* young_gen() const { return _young_gen; }
   155   Generation* young_gen() const { return _young_gen; }
   163   Generation* old_gen()   const { return _old_gen; }
   156   Generation* old_gen()   const { return _old_gen; }
   164 
   157 
   165   bool is_young_gen(const Generation* gen) const { return gen == _young_gen; }
   158   bool is_young_gen(const Generation* gen) const { return gen == _young_gen; }
   212   // The methods is_in(), is_in_closed_subset() and is_in_youngest() may
   205   // The methods is_in(), is_in_closed_subset() and is_in_youngest() may
   213   // be expensive to compute in general, so, to prevent
   206   // be expensive to compute in general, so, to prevent
   214   // their inadvertent use in product jvm's, we restrict their use to
   207   // their inadvertent use in product jvm's, we restrict their use to
   215   // assertion checking or verification only.
   208   // assertion checking or verification only.
   216   bool is_in(const void* p) const;
   209   bool is_in(const void* p) const;
   217 
       
   218   // override
       
   219   virtual bool is_in_closed_subset(const void* p) const {
       
   220     return is_in(p);
       
   221   }
       
   222 
   210 
   223   // Returns true if the reference is to an object in the reserved space
   211   // Returns true if the reference is to an object in the reserved space
   224   // for the young generation.
   212   // for the young generation.
   225   // Assumes the the young gen address range is less than that of the old gen.
   213   // Assumes the the young gen address range is less than that of the old gen.
   226   bool is_in_young(oop p);
   214   bool is_in_young(oop p);
   282   // Can a compiler initialize a new object without store barriers?
   270   // Can a compiler initialize a new object without store barriers?
   283   // This permission only extends from the creation of a new object
   271   // This permission only extends from the creation of a new object
   284   // via a TLAB up to the first subsequent safepoint.
   272   // via a TLAB up to the first subsequent safepoint.
   285   virtual bool can_elide_tlab_store_barriers() const {
   273   virtual bool can_elide_tlab_store_barriers() const {
   286     return true;
   274     return true;
   287   }
       
   288 
       
   289   virtual bool card_mark_must_follow_store() const {
       
   290     return false;
       
   291   }
   275   }
   292 
   276 
   293   // We don't need barriers for stores to objects in the
   277   // We don't need barriers for stores to objects in the
   294   // young gen and, a fortiori, for initializing stores to
   278   // young gen and, a fortiori, for initializing stores to
   295   // objects therein. This applies to DefNew+Tenured and ParNew+CMS
   279   // objects therein. This applies to DefNew+Tenured and ParNew+CMS