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