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