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