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