--- a/src/hotspot/share/gc/epsilon/epsilonHeap.hpp Thu Apr 26 18:16:16 2018 +0200
+++ b/src/hotspot/share/gc/epsilon/epsilonHeap.hpp Thu Apr 26 18:46:01 2018 +0200
@@ -47,7 +47,10 @@
size_t _last_heap_print;
size_t _step_counter_update;
size_t _step_heap_print;
+
public:
+ static EpsilonHeap* heap();
+
EpsilonHeap(EpsilonCollectorPolicy* p) :
_policy(p),
_memory_manager("Epsilon Heap", "") {};
@@ -60,52 +63,6 @@
return "Epsilon";
}
- virtual jint initialize();
-
- virtual void post_initialize();
-
- virtual void initialize_serviceability();
- virtual GrowableArray<GCMemoryManager*> memory_managers();
- virtual GrowableArray<MemoryPool*> memory_pools();
-
- static EpsilonHeap* heap();
-
- virtual size_t capacity() const { return _virtual_space.committed_size(); }
- virtual size_t used() const { return _space->used(); }
- virtual size_t max_capacity() const { return _virtual_space.reserved_size(); }
-
- virtual bool is_maximal_no_gc() const {
- // No GC is going to happen, unless we are at capacity.
- // At which point we will fail anyway.
- return used() == capacity();
- }
-
- virtual bool is_in(const void* p) const { return _space->is_in(p); }
-
- virtual bool is_scavengable(oop obj) {
- // No GC is going to happen, therefore no objects ever move.
- return false;
- }
-
- HeapWord* allocate_work(size_t size);
- virtual HeapWord* mem_allocate(size_t size, bool* gc_overhead_limit_was_exceeded);
- virtual HeapWord* allocate_new_tlab(size_t size);
-
- // TLAB allocations
- virtual bool supports_tlab_allocation() const { return UseTLAB; }
- virtual size_t tlab_capacity(Thread* thr) const { return capacity(); }
- virtual size_t tlab_used(Thread* thr) const { return used(); }
- virtual size_t max_tlab_size() const { return _max_tlab_size; }
- virtual size_t unsafe_max_tlab_alloc(Thread* thr) const;
-
- virtual void collect(GCCause::Cause cause);
- virtual void do_full_collection(bool clear_all_soft_refs);
-
- virtual AdaptiveSizePolicy* size_policy() {
- // No such thing for Epsilon
- return NULL;
- }
-
virtual CollectorPolicy* collector_policy() const {
return _policy;
}
@@ -114,51 +71,73 @@
return &_soft_ref_policy;
}
+ virtual jint initialize();
+ virtual void post_initialize();
+ virtual void initialize_serviceability();
+
+ virtual GrowableArray<GCMemoryManager*> memory_managers();
+ virtual GrowableArray<MemoryPool*> memory_pools();
+
+ virtual size_t max_capacity() const { return _virtual_space.reserved_size(); }
+ virtual size_t capacity() const { return _virtual_space.committed_size(); }
+ virtual size_t used() const { return _space->used(); }
+
+ virtual bool is_in(const void* p) const {
+ return _space->is_in(p);
+ }
+
+ virtual bool is_scavengable(oop obj) {
+ // No GC is going to happen, therefore no objects ever move.
+ return false;
+ }
+
+ virtual bool is_maximal_no_gc() const {
+ // No GC is going to happen. Return "we are at max", when we are about to fail.
+ return used() == capacity();
+ }
+
+ // Allocation
+ HeapWord* allocate_work(size_t size);
+ virtual HeapWord* mem_allocate(size_t size, bool* gc_overhead_limit_was_exceeded);
+ virtual HeapWord* allocate_new_tlab(size_t size);
+
+ // TLAB allocation
+ virtual bool supports_tlab_allocation() const { return UseTLAB; }
+ virtual size_t tlab_capacity(Thread* thr) const { return capacity(); }
+ virtual size_t tlab_used(Thread* thr) const { return used(); }
+ virtual size_t max_tlab_size() const { return _max_tlab_size; }
+ virtual size_t unsafe_max_tlab_alloc(Thread* thr) const;
+
+ virtual void collect(GCCause::Cause cause);
+ virtual void do_full_collection(bool clear_all_soft_refs);
+
+ // Heap walking support
+ virtual void safe_object_iterate(ObjectClosure* cl);
virtual void object_iterate(ObjectClosure* cl) {
safe_object_iterate(cl);
}
- virtual void safe_object_iterate(ObjectClosure* cl);
-
- virtual HeapWord* block_start(const void* addr) const {
- // No support for block parsing.
- return NULL;
- }
+ // No support for block parsing.
+ virtual HeapWord* block_start(const void* addr) const { return NULL; }
+ virtual size_t block_size(const HeapWord* addr) const { return 0; }
+ virtual bool block_is_obj(const HeapWord* addr) const { return false; }
- virtual size_t block_size(const HeapWord* addr) const {
- // No support for block parsing.
- return 0;
- }
+ // No GC threads
+ virtual void print_gc_threads_on(outputStream* st) const {}
+ virtual void gc_threads_do(ThreadClosure* tc) const {}
- virtual bool block_is_obj(const HeapWord* addr) const {
- // No support for block parsing.
- return false;
- }
+ // No heap verification
+ virtual void prepare_for_verify() {}
+ virtual void verify(VerifyOption option) {}
virtual jlong millis_since_last_gc() {
// Report time since the VM start
return os::elapsed_counter() / NANOSECS_PER_MILLISEC;
}
- virtual void print_gc_threads_on(outputStream* st) const {
- // No GC threads.
- }
-
- virtual void gc_threads_do(ThreadClosure* tc) const {
- // No GC threads.
- }
-
virtual void print_on(outputStream* st) const;
virtual void print_tracing_info() const;
- virtual void prepare_for_verify() {
- // No heap verification.
- }
-
- virtual void verify(VerifyOption option) {
- // No heap verification.
- }
-
};
#endif // SHARE_VM_GC_EPSILON_COLLECTEDHEAP_HPP