216 // Return "true" if the part of the heap that allocates Java 217 // objects has reached the maximal committed limit that it can 218 // reach, without a garbage collection. 219 virtual bool is_maximal_no_gc() const = 0; 220 221 // Support for java.lang.Runtime.maxMemory(): return the maximum amount of 222 // memory that the vm could make available for storing 'normal' java objects. 223 // This is based on the reserved address space, but should not include space 224 // that the vm uses internally for bookkeeping or temporary storage 225 // (e.g., in the case of the young gen, one of the survivor 226 // spaces). 227 virtual size_t max_capacity() const = 0; 228 229 // Returns "TRUE" iff "p" points into the committed areas of the heap. 230 // This method can be expensive so avoid using it in performance critical 231 // code. 232 virtual bool is_in(const void* p) const = 0; 233 234 DEBUG_ONLY(bool is_in_or_null(const void* p) const { return p == NULL || is_in(p); }) 235 236 // This function verifies that "addr" is a valid oop location, w.r.t. heap 237 // datastructures such as bitmaps and virtual memory address. It does *not* 238 // check if the location is within committed heap memory. 239 virtual void check_oop_location(void* addr) const; 240 241 virtual uint32_t hash_oop(oop obj) const; 242 243 void set_gc_cause(GCCause::Cause v) { 244 if (UsePerfData) { 245 _gc_lastcause = _gc_cause; 246 _perf_gc_lastcause->set_value(GCCause::to_string(_gc_lastcause)); 247 _perf_gc_cause->set_value(GCCause::to_string(v)); 248 } 249 _gc_cause = v; 250 } 251 GCCause::Cause gc_cause() { return _gc_cause; } 252 253 oop obj_allocate(Klass* klass, int size, TRAPS); 254 virtual oop array_allocate(Klass* klass, int size, int length, bool do_zero, TRAPS); 255 oop class_allocate(Klass* klass, int size, TRAPS); 256 257 // Utilities for turning raw memory into filler objects. 258 // 259 // min_fill_size() is the smallest region that can be filled. 260 // fill_with_objects() can fill arbitrary-sized regions of the heap using 490 // Provides a thread pool to SafepointSynchronize to use 491 // for parallel safepoint cleanup. 492 // GCs that use a GC worker thread pool may want to share 493 // it for use during safepoint cleanup. This is only possible 494 // if the GC can pause and resume concurrent work (e.g. G1 495 // concurrent marking) for an intermittent non-GC safepoint. 496 // If this method returns NULL, SafepointSynchronize will 497 // perform cleanup tasks serially in the VMThread. 498 virtual WorkGang* get_safepoint_workers() { return NULL; } 499 500 // Support for object pinning. This is used by JNI Get*Critical() 501 // and Release*Critical() family of functions. If supported, the GC 502 // must guarantee that pinned objects never move. 503 virtual bool supports_object_pinning() const; 504 virtual oop pin_object(JavaThread* thread, oop obj); 505 virtual void unpin_object(JavaThread* thread, oop obj); 506 507 // Deduplicate the string, iff the GC supports string deduplication. 508 virtual void deduplicate_string(oop str); 509 510 virtual bool is_oop(oop object) const; 511 512 virtual size_t obj_size(oop obj) const; 513 514 // Non product verification and debugging. 515 #ifndef PRODUCT 516 // Support for PromotionFailureALot. Return true if it's time to cause a 517 // promotion failure. The no-argument version uses 518 // this->_promotion_failure_alot_count as the counter. 519 bool promotion_should_fail(volatile size_t* count); 520 bool promotion_should_fail(); 521 522 // Reset the PromotionFailureALot counters. Should be called at the end of a 523 // GC in which promotion failure occurred. 524 void reset_promotion_should_fail(volatile size_t* count); 525 void reset_promotion_should_fail(); 526 #endif // #ifndef PRODUCT 527 }; 528 529 // Class to set and reset the GC cause for a CollectedHeap. | 216 // Return "true" if the part of the heap that allocates Java 217 // objects has reached the maximal committed limit that it can 218 // reach, without a garbage collection. 219 virtual bool is_maximal_no_gc() const = 0; 220 221 // Support for java.lang.Runtime.maxMemory(): return the maximum amount of 222 // memory that the vm could make available for storing 'normal' java objects. 223 // This is based on the reserved address space, but should not include space 224 // that the vm uses internally for bookkeeping or temporary storage 225 // (e.g., in the case of the young gen, one of the survivor 226 // spaces). 227 virtual size_t max_capacity() const = 0; 228 229 // Returns "TRUE" iff "p" points into the committed areas of the heap. 230 // This method can be expensive so avoid using it in performance critical 231 // code. 232 virtual bool is_in(const void* p) const = 0; 233 234 DEBUG_ONLY(bool is_in_or_null(const void* p) const { return p == NULL || is_in(p); }) 235 236 virtual uint32_t hash_oop(oop obj) const; 237 238 void set_gc_cause(GCCause::Cause v) { 239 if (UsePerfData) { 240 _gc_lastcause = _gc_cause; 241 _perf_gc_lastcause->set_value(GCCause::to_string(_gc_lastcause)); 242 _perf_gc_cause->set_value(GCCause::to_string(v)); 243 } 244 _gc_cause = v; 245 } 246 GCCause::Cause gc_cause() { return _gc_cause; } 247 248 oop obj_allocate(Klass* klass, int size, TRAPS); 249 virtual oop array_allocate(Klass* klass, int size, int length, bool do_zero, TRAPS); 250 oop class_allocate(Klass* klass, int size, TRAPS); 251 252 // Utilities for turning raw memory into filler objects. 253 // 254 // min_fill_size() is the smallest region that can be filled. 255 // fill_with_objects() can fill arbitrary-sized regions of the heap using 485 // Provides a thread pool to SafepointSynchronize to use 486 // for parallel safepoint cleanup. 487 // GCs that use a GC worker thread pool may want to share 488 // it for use during safepoint cleanup. This is only possible 489 // if the GC can pause and resume concurrent work (e.g. G1 490 // concurrent marking) for an intermittent non-GC safepoint. 491 // If this method returns NULL, SafepointSynchronize will 492 // perform cleanup tasks serially in the VMThread. 493 virtual WorkGang* get_safepoint_workers() { return NULL; } 494 495 // Support for object pinning. This is used by JNI Get*Critical() 496 // and Release*Critical() family of functions. If supported, the GC 497 // must guarantee that pinned objects never move. 498 virtual bool supports_object_pinning() const; 499 virtual oop pin_object(JavaThread* thread, oop obj); 500 virtual void unpin_object(JavaThread* thread, oop obj); 501 502 // Deduplicate the string, iff the GC supports string deduplication. 503 virtual void deduplicate_string(oop str); 504 505 // This function verifies that "addr" is a valid oop location, w.r.t. heap 506 // datastructures such as bitmaps and virtual memory address. It does *not* 507 // check if the location is within committed heap memory. 508 virtual bool is_oop_location(void* addr) const; 509 virtual bool is_oop(oop object) const; 510 511 virtual size_t obj_size(oop obj) const; 512 513 // Non product verification and debugging. 514 #ifndef PRODUCT 515 // Support for PromotionFailureALot. Return true if it's time to cause a 516 // promotion failure. The no-argument version uses 517 // this->_promotion_failure_alot_count as the counter. 518 bool promotion_should_fail(volatile size_t* count); 519 bool promotion_should_fail(); 520 521 // Reset the PromotionFailureALot counters. Should be called at the end of a 522 // GC in which promotion failure occurred. 523 void reset_promotion_should_fail(volatile size_t* count); 524 void reset_promotion_should_fail(); 525 #endif // #ifndef PRODUCT 526 }; 527 528 // Class to set and reset the GC cause for a CollectedHeap. |