Small bugfixes and improvements epsilon-gc-branch
authorshade
Thu, 26 Apr 2018 18:46:01 +0200
branchepsilon-gc-branch
changeset 56492 e1871d34a188
parent 56491 ad0621bda88a
child 56493 b99bcc5a6c2a
Small bugfixes and improvements
src/hotspot/share/gc/epsilon/epsilonBarrierSet.hpp
src/hotspot/share/gc/epsilon/epsilonHeap.cpp
src/hotspot/share/gc/epsilon/epsilonHeap.hpp
src/hotspot/share/gc/epsilon/epsilonMemoryPool.cpp
src/hotspot/share/gc/epsilon/epsilonMemoryPool.hpp
test/hotspot/jtreg/TEST.groups
--- a/src/hotspot/share/gc/epsilon/epsilonBarrierSet.hpp	Thu Apr 26 18:16:16 2018 +0200
+++ b/src/hotspot/share/gc/epsilon/epsilonBarrierSet.hpp	Thu Apr 26 18:46:01 2018 +0200
@@ -29,7 +29,7 @@
 #include "gc/shared/barrierSet.hpp"
 
 // No interaction with application is required for Epsilon, and therefore
-// the barrier set is mostly empty.
+// the barrier set is empty.
 class EpsilonBarrierSet: public BarrierSet {
   friend class VMStructs;
 
@@ -39,9 +39,6 @@
 
   template <DecoratorSet decorators, typename BarrierSetT = EpsilonBarrierSet>
   class AccessBarrier: public BarrierSet::AccessBarrier<decorators, BarrierSetT> {};
-
-protected:
-  virtual void write_ref_array_work(MemRegion mr) {}
 };
 
 template<>
--- a/src/hotspot/share/gc/epsilon/epsilonHeap.cpp	Thu Apr 26 18:16:16 2018 +0200
+++ b/src/hotspot/share/gc/epsilon/epsilonHeap.cpp	Thu Apr 26 18:46:01 2018 +0200
@@ -63,7 +63,7 @@
   }
   if (UseTLAB) {
     log_info(gc)("Using TLAB allocation; min: " SIZE_FORMAT "K, max: " SIZE_FORMAT "K",
-                                ThreadLocalAllocBuffer::min_size()*HeapWordSize / K,
+                                ThreadLocalAllocBuffer::min_size() * HeapWordSize / K,
                                 _max_tlab_size*HeapWordSize / K);
   } else {
     log_info(gc)("Not using TLAB allocation");
@@ -88,7 +88,7 @@
 }
 
 GrowableArray<MemoryPool*> EpsilonHeap::memory_pools() {
-  GrowableArray<MemoryPool*> memory_pools(3);
+  GrowableArray<MemoryPool*> memory_pools(1);
   memory_pools.append(_pool);
   return memory_pools;
 }
@@ -116,7 +116,7 @@
 EpsilonHeap* EpsilonHeap::heap() {
   CollectedHeap* heap = Universe::heap();
   assert(heap != NULL, "Uninitialized access to EpsilonHeap::heap()");
-  assert(heap->kind() == CollectedHeap::Epsilon, "Not a EpsilonHeap");
+  assert(heap->kind() == CollectedHeap::Epsilon, "Not an Epsilon heap");
   return (EpsilonHeap*)heap;
 }
 
--- 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
--- a/src/hotspot/share/gc/epsilon/epsilonMemoryPool.cpp	Thu Apr 26 18:16:16 2018 +0200
+++ b/src/hotspot/share/gc/epsilon/epsilonMemoryPool.cpp	Thu Apr 26 18:46:01 2018 +0200
@@ -26,12 +26,6 @@
 #include "gc/epsilon/epsilonHeap.hpp"
 #include "epsilonMemoryPool.hpp"
 
-EpsilonDummyMemoryPool::EpsilonDummyMemoryPool() :
-        CollectedMemoryPool("Epsilon Dummy",
-                            0,
-                            0,
-                            false /* support_usage_threshold */) {}
-
 EpsilonMemoryPool::EpsilonMemoryPool(EpsilonHeap* heap) :
         _heap(heap),
         CollectedMemoryPool("Epsilon Heap",
--- a/src/hotspot/share/gc/epsilon/epsilonMemoryPool.hpp	Thu Apr 26 18:16:16 2018 +0200
+++ b/src/hotspot/share/gc/epsilon/epsilonMemoryPool.hpp	Thu Apr 26 18:46:01 2018 +0200
@@ -31,30 +31,15 @@
 #include "services/memoryUsage.hpp"
 #endif // INCLUDE_ALL_GCS
 
-class EpsilonDummyMemoryPool : public CollectedMemoryPool {
-public:
-  EpsilonDummyMemoryPool();
-  MemoryUsage get_memory_usage()      { return MemoryUsage(0, 0, 0, 0); }
-  size_t used_in_bytes()              { return 0; }
-  size_t max_size() const             { return 0; }
-};
-
 class EpsilonMemoryPool : public CollectedMemoryPool {
 private:
   EpsilonHeap* _heap;
 
 public:
   EpsilonMemoryPool(EpsilonHeap* heap);
-
-  size_t committed_in_bytes() {
-    return _heap->capacity();
-  }
-  size_t used_in_bytes() {
-    return _heap->used();
-  }
-  size_t max_size() const {
-    return _heap->max_capacity();
-  }
+  size_t committed_in_bytes() { return _heap->capacity();     }
+  size_t used_in_bytes()      { return _heap->used();         }
+  size_t max_size()     const { return _heap->max_capacity(); }
   MemoryUsage get_memory_usage();
 };
 
--- a/test/hotspot/jtreg/TEST.groups	Thu Apr 26 18:16:16 2018 +0200
+++ b/test/hotspot/jtreg/TEST.groups	Thu Apr 26 18:46:01 2018 +0200
@@ -58,9 +58,6 @@
 hotspot_native_sanity = \
   native_sanity
 
-hotspot_gc_epsilon = \
-  gc/epsilon/
-
 tier1_common = \
   sanity/BasicVMTest.java \
   gtest/GTestWrapper.java
@@ -313,3 +310,6 @@
   -:tier1_runtime_appcds_exclude \
   -:hotspot_nmt \
   -:hotspot_tier2_runtime_platform_agnostic
+
+hotspot_gc_epsilon = \
+  gc/epsilon/