264
265 // Support for java.lang.Runtime.maxMemory(): return the maximum amount of
266 // memory that the vm could make available for storing 'normal' java objects.
267 // This is based on the reserved address space, but should not include space
268 // that the vm uses internally for bookkeeping or temporary storage
269 // (e.g., in the case of the young gen, one of the survivor
270 // spaces).
271 virtual size_t max_capacity() const = 0;
272
273 // Returns "TRUE" iff "p" points into the committed areas of the heap.
274 // This method can be expensive so avoid using it in performance critical
275 // code.
276 virtual bool is_in(const void* p) const = 0;
277
278 DEBUG_ONLY(bool is_in_or_null(const void* p) const { return p == nullptr || is_in(p); })
279
280 void set_gc_cause(GCCause::Cause v);
281 GCCause::Cause gc_cause() { return _gc_cause; }
282
283 oop obj_allocate(Klass* klass, size_t size, TRAPS);
284 virtual oop array_allocate(Klass* klass, size_t size, int length, bool do_zero, TRAPS);
285 oop class_allocate(Klass* klass, size_t size, TRAPS);
286
287 // Utilities for turning raw memory into filler objects.
288 //
289 // min_fill_size() is the smallest region that can be filled.
290 // fill_with_objects() can fill arbitrary-sized regions of the heap using
291 // multiple objects. fill_with_object() is for regions known to be smaller
292 // than the largest array of integers; it uses a single object to fill the
293 // region and has slightly less overhead.
294 static size_t min_fill_size() {
295 return size_t(align_object_size(oopDesc::header_size()));
296 }
297
298 static void fill_with_objects(HeapWord* start, size_t words, bool zap = true);
299
300 static void fill_with_object(HeapWord* start, size_t words, bool zap = true);
301 static void fill_with_object(MemRegion region, bool zap = true) {
302 fill_with_object(region.start(), region.word_size(), zap);
303 }
|
264
265 // Support for java.lang.Runtime.maxMemory(): return the maximum amount of
266 // memory that the vm could make available for storing 'normal' java objects.
267 // This is based on the reserved address space, but should not include space
268 // that the vm uses internally for bookkeeping or temporary storage
269 // (e.g., in the case of the young gen, one of the survivor
270 // spaces).
271 virtual size_t max_capacity() const = 0;
272
273 // Returns "TRUE" iff "p" points into the committed areas of the heap.
274 // This method can be expensive so avoid using it in performance critical
275 // code.
276 virtual bool is_in(const void* p) const = 0;
277
278 DEBUG_ONLY(bool is_in_or_null(const void* p) const { return p == nullptr || is_in(p); })
279
280 void set_gc_cause(GCCause::Cause v);
281 GCCause::Cause gc_cause() { return _gc_cause; }
282
283 oop obj_allocate(Klass* klass, size_t size, TRAPS);
284 oop obj_buffer_allocate(Klass* klass, size_t size, TRAPS); // doesn't clear memory
285 virtual oop array_allocate(Klass* klass, size_t size, int length, bool do_zero, TRAPS);
286 oop class_allocate(Klass* klass, size_t size, TRAPS);
287
288 // Utilities for turning raw memory into filler objects.
289 //
290 // min_fill_size() is the smallest region that can be filled.
291 // fill_with_objects() can fill arbitrary-sized regions of the heap using
292 // multiple objects. fill_with_object() is for regions known to be smaller
293 // than the largest array of integers; it uses a single object to fill the
294 // region and has slightly less overhead.
295 static size_t min_fill_size() {
296 return size_t(align_object_size(oopDesc::header_size()));
297 }
298
299 static void fill_with_objects(HeapWord* start, size_t words, bool zap = true);
300
301 static void fill_with_object(HeapWord* start, size_t words, bool zap = true);
302 static void fill_with_object(MemRegion region, bool zap = true) {
303 fill_with_object(region.start(), region.word_size(), zap);
304 }
|