246 virtual HeapWord* allocate(size_t word_size, bool is_tlab) = 0;
247
248 // Like "allocate", but performs any necessary locking internally.
249 virtual HeapWord* par_allocate(size_t word_size, bool is_tlab) = 0;
250
251 // Some generation may offer a region for shared, contiguous allocation,
252 // via inlined code (by exporting the address of the top and end fields
253 // defining the extent of the contiguous allocation region.)
254
255 // This function returns "true" iff the heap supports this kind of
256 // allocation. (More precisely, this means the style of allocation that
257 // increments *top_addr()" with a CAS.) (Default is "no".)
258 // A generation that supports this allocation style must use lock-free
259 // allocation for *all* allocation, since there are times when lock free
260 // allocation will be concurrent with plain "allocate" calls.
261 virtual bool supports_inline_contig_alloc() const { return false; }
262
263 // These functions return the addresses of the fields that define the
264 // boundaries of the contiguous allocation area. (These fields should be
265 // physically near to one another.)
266 virtual HeapWord** top_addr() const { return NULL; }
267 virtual HeapWord** end_addr() const { return NULL; }
268
269 // Thread-local allocation buffers
270 virtual bool supports_tlab_allocation() const { return false; }
271 virtual size_t tlab_capacity() const {
272 guarantee(false, "Generation doesn't support thread local allocation buffers");
273 return 0;
274 }
275 virtual size_t tlab_used() const {
276 guarantee(false, "Generation doesn't support thread local allocation buffers");
277 return 0;
278 }
279 virtual size_t unsafe_max_tlab_alloc() const {
280 guarantee(false, "Generation doesn't support thread local allocation buffers");
281 return 0;
282 }
283
284 // "obj" is the address of an object in a younger generation. Allocate space
285 // for "obj" in the current (or some higher) generation, and copy "obj" into
286 // the newly allocated space, if possible, returning the result (or NULL if
|
246 virtual HeapWord* allocate(size_t word_size, bool is_tlab) = 0;
247
248 // Like "allocate", but performs any necessary locking internally.
249 virtual HeapWord* par_allocate(size_t word_size, bool is_tlab) = 0;
250
251 // Some generation may offer a region for shared, contiguous allocation,
252 // via inlined code (by exporting the address of the top and end fields
253 // defining the extent of the contiguous allocation region.)
254
255 // This function returns "true" iff the heap supports this kind of
256 // allocation. (More precisely, this means the style of allocation that
257 // increments *top_addr()" with a CAS.) (Default is "no".)
258 // A generation that supports this allocation style must use lock-free
259 // allocation for *all* allocation, since there are times when lock free
260 // allocation will be concurrent with plain "allocate" calls.
261 virtual bool supports_inline_contig_alloc() const { return false; }
262
263 // These functions return the addresses of the fields that define the
264 // boundaries of the contiguous allocation area. (These fields should be
265 // physically near to one another.)
266 virtual HeapWord* volatile* top_addr() const { return NULL; }
267 virtual HeapWord** end_addr() const { return NULL; }
268
269 // Thread-local allocation buffers
270 virtual bool supports_tlab_allocation() const { return false; }
271 virtual size_t tlab_capacity() const {
272 guarantee(false, "Generation doesn't support thread local allocation buffers");
273 return 0;
274 }
275 virtual size_t tlab_used() const {
276 guarantee(false, "Generation doesn't support thread local allocation buffers");
277 return 0;
278 }
279 virtual size_t unsafe_max_tlab_alloc() const {
280 guarantee(false, "Generation doesn't support thread local allocation buffers");
281 return 0;
282 }
283
284 // "obj" is the address of an object in a younger generation. Allocate space
285 // for "obj" in the current (or some higher) generation, and copy "obj" into
286 // the newly allocated space, if possible, returning the result (or NULL if
|