< prev index next >

src/hotspot/share/gc/shared/generation.hpp

Print this page




 139 
 140   // allocate and initialize ("weak") refs processing support
 141   virtual void ref_processor_init();
 142   void set_ref_processor(ReferenceProcessor* rp) {
 143     assert(_ref_processor == NULL, "clobbering existing _ref_processor");
 144     _ref_processor = rp;
 145   }
 146 
 147   virtual Generation::Name kind() { return Generation::Other; }
 148 
 149   // This properly belongs in the collector, but for now this
 150   // will do.
 151   virtual bool refs_discovery_is_atomic() const { return true;  }
 152   virtual bool refs_discovery_is_mt()     const { return false; }
 153 
 154   // Space inquiries (results in bytes)
 155   size_t initial_size();
 156   virtual size_t capacity() const = 0;  // The maximum number of object bytes the
 157                                         // generation can currently hold.
 158   virtual size_t used() const = 0;      // The number of used bytes in the gen.
 159   virtual size_t used_stable() const;   // The number of used bytes for memory monitoring tools.
 160   virtual size_t free() const = 0;      // The number of free bytes in the gen.
 161 
 162   // Support for java.lang.Runtime.maxMemory(); see CollectedHeap.
 163   // Returns the total number of bytes  available in a generation
 164   // for the allocation of objects.
 165   virtual size_t max_capacity() const;
 166 
 167   // If this is a young generation, the maximum number of bytes that can be
 168   // allocated in this generation before a GC is triggered.
 169   virtual size_t capacity_before_gc() const { return 0; }
 170 
 171   // The largest number of contiguous free bytes in the generation,
 172   // including expansion  (Assumes called at a safepoint.)
 173   virtual size_t contiguous_available() const = 0;
 174   // The largest number of contiguous free bytes in this or any higher generation.
 175   virtual size_t max_contiguous_available() const;
 176 
 177   // Returns true if promotions of the specified amount are
 178   // likely to succeed without a promotion failure.
 179   // Promotion of the full amount is not guaranteed but


 284     guarantee(false, "Generation doesn't support thread local allocation buffers");
 285     return 0;
 286   }
 287 
 288   // "obj" is the address of an object in a younger generation.  Allocate space
 289   // for "obj" in the current (or some higher) generation, and copy "obj" into
 290   // the newly allocated space, if possible, returning the result (or NULL if
 291   // the allocation failed).
 292   //
 293   // The "obj_size" argument is just obj->size(), passed along so the caller can
 294   // avoid repeating the virtual call to retrieve it.
 295   virtual oop promote(oop obj, size_t obj_size);
 296 
 297   // Thread "thread_num" (0 <= i < ParalleGCThreads) wants to promote
 298   // object "obj", whose original mark word was "m", and whose size is
 299   // "word_sz".  If possible, allocate space for "obj", copy obj into it
 300   // (taking care to copy "m" into the mark word when done, since the mark
 301   // word of "obj" may have been overwritten with a forwarding pointer, and
 302   // also taking care to copy the klass pointer *last*.  Returns the new
 303   // object if successful, or else NULL.
 304   virtual oop par_promote(int thread_num, oop obj, markWord m, size_t word_sz);
 305 
 306   // Informs the current generation that all par_promote_alloc's in the
 307   // collection have been completed; any supporting data structures can be
 308   // reset.  Default is to do nothing.
 309   virtual void par_promote_alloc_done(int thread_num) {}
 310 
 311   // Informs the current generation that all oop_since_save_marks_iterates
 312   // performed by "thread_num" in the current collection, if any, have been
 313   // completed; any supporting data structures can be reset.  Default is to
 314   // do nothing.
 315   virtual void par_oop_since_save_marks_iterate_done(int thread_num) {}
 316 
 317   // Returns "true" iff collect() should subsequently be called on this
 318   // this generation. See comment below.
 319   // This is a generic implementation which can be overridden.
 320   //
 321   // Note: in the current (1.4) implementation, when genCollectedHeap's
 322   // incremental_collection_will_fail flag is set, all allocations are
 323   // slow path (the only fast-path place to allocate is DefNew, which
 324   // will be full if the flag is set).




 139 
 140   // allocate and initialize ("weak") refs processing support
 141   virtual void ref_processor_init();
 142   void set_ref_processor(ReferenceProcessor* rp) {
 143     assert(_ref_processor == NULL, "clobbering existing _ref_processor");
 144     _ref_processor = rp;
 145   }
 146 
 147   virtual Generation::Name kind() { return Generation::Other; }
 148 
 149   // This properly belongs in the collector, but for now this
 150   // will do.
 151   virtual bool refs_discovery_is_atomic() const { return true;  }
 152   virtual bool refs_discovery_is_mt()     const { return false; }
 153 
 154   // Space inquiries (results in bytes)
 155   size_t initial_size();
 156   virtual size_t capacity() const = 0;  // The maximum number of object bytes the
 157                                         // generation can currently hold.
 158   virtual size_t used() const = 0;      // The number of used bytes in the gen.

 159   virtual size_t free() const = 0;      // The number of free bytes in the gen.
 160 
 161   // Support for java.lang.Runtime.maxMemory(); see CollectedHeap.
 162   // Returns the total number of bytes  available in a generation
 163   // for the allocation of objects.
 164   virtual size_t max_capacity() const;
 165 
 166   // If this is a young generation, the maximum number of bytes that can be
 167   // allocated in this generation before a GC is triggered.
 168   virtual size_t capacity_before_gc() const { return 0; }
 169 
 170   // The largest number of contiguous free bytes in the generation,
 171   // including expansion  (Assumes called at a safepoint.)
 172   virtual size_t contiguous_available() const = 0;
 173   // The largest number of contiguous free bytes in this or any higher generation.
 174   virtual size_t max_contiguous_available() const;
 175 
 176   // Returns true if promotions of the specified amount are
 177   // likely to succeed without a promotion failure.
 178   // Promotion of the full amount is not guaranteed but


 283     guarantee(false, "Generation doesn't support thread local allocation buffers");
 284     return 0;
 285   }
 286 
 287   // "obj" is the address of an object in a younger generation.  Allocate space
 288   // for "obj" in the current (or some higher) generation, and copy "obj" into
 289   // the newly allocated space, if possible, returning the result (or NULL if
 290   // the allocation failed).
 291   //
 292   // The "obj_size" argument is just obj->size(), passed along so the caller can
 293   // avoid repeating the virtual call to retrieve it.
 294   virtual oop promote(oop obj, size_t obj_size);
 295 
 296   // Thread "thread_num" (0 <= i < ParalleGCThreads) wants to promote
 297   // object "obj", whose original mark word was "m", and whose size is
 298   // "word_sz".  If possible, allocate space for "obj", copy obj into it
 299   // (taking care to copy "m" into the mark word when done, since the mark
 300   // word of "obj" may have been overwritten with a forwarding pointer, and
 301   // also taking care to copy the klass pointer *last*.  Returns the new
 302   // object if successful, or else NULL.
 303   virtual oop par_promote(int thread_num, oop obj, markOop m, size_t word_sz);
 304 
 305   // Informs the current generation that all par_promote_alloc's in the
 306   // collection have been completed; any supporting data structures can be
 307   // reset.  Default is to do nothing.
 308   virtual void par_promote_alloc_done(int thread_num) {}
 309 
 310   // Informs the current generation that all oop_since_save_marks_iterates
 311   // performed by "thread_num" in the current collection, if any, have been
 312   // completed; any supporting data structures can be reset.  Default is to
 313   // do nothing.
 314   virtual void par_oop_since_save_marks_iterate_done(int thread_num) {}
 315 
 316   // Returns "true" iff collect() should subsequently be called on this
 317   // this generation. See comment below.
 318   // This is a generic implementation which can be overridden.
 319   //
 320   // Note: in the current (1.4) implementation, when genCollectedHeap's
 321   // incremental_collection_will_fail flag is set, all allocations are
 322   // slow path (the only fast-path place to allocate is DefNew, which
 323   // will be full if the flag is set).


< prev index next >