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