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