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