55767
|
1 |
/*
|
|
2 |
* Copyright (c) 2017, Red Hat, Inc. and/or its affiliates.
|
|
3 |
*
|
|
4 |
* This code is free software; you can redistribute it and/or modify it
|
|
5 |
* under the terms of the GNU General Public License version 2 only, as
|
|
6 |
* published by the Free Software Foundation.
|
|
7 |
*
|
|
8 |
* This code is distributed in the hope that it will be useful, but WITHOUT
|
|
9 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
10 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
11 |
* version 2 for more details (a copy is included in the LICENSE file that
|
|
12 |
* accompanied this code).
|
|
13 |
*
|
|
14 |
* You should have received a copy of the GNU General Public License version
|
|
15 |
* 2 along with this work; if not, write to the Free Software Foundation,
|
|
16 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
17 |
*
|
|
18 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
|
19 |
* or visit www.oracle.com if you need additional information or have any
|
|
20 |
* questions.
|
|
21 |
*
|
|
22 |
*/
|
|
23 |
|
|
24 |
#ifndef SHARE_VM_GC_EPSILON_COLLECTEDHEAP_HPP
|
|
25 |
#define SHARE_VM_GC_EPSILON_COLLECTEDHEAP_HPP
|
|
26 |
|
|
27 |
#include "gc/shared/collectedHeap.hpp"
|
|
28 |
#include "gc/shared/space.hpp"
|
|
29 |
#include "gc/epsilon/epsilonCollectorPolicy.hpp"
|
|
30 |
#include "gc/epsilon/epsilonMonitoringSupport.hpp"
|
|
31 |
#include "gc/epsilon/epsilonBarrierSet.hpp"
|
|
32 |
#include "gc/epsilon/epsilon_globals.hpp"
|
|
33 |
|
55939
|
34 |
class EpsilonHeap : public CollectedHeap {
|
55767
|
35 |
private:
|
|
36 |
EpsilonCollectorPolicy* _policy;
|
|
37 |
EpsilonMonitoringSupport* _monitoring_support;
|
|
38 |
ContiguousSpace* _space;
|
|
39 |
VirtualSpace _virtual_space;
|
|
40 |
size_t _max_tlab_size;
|
|
41 |
size_t _last_counter_update;
|
|
42 |
public:
|
55939
|
43 |
EpsilonHeap(EpsilonCollectorPolicy* p) : _policy(p) {};
|
55767
|
44 |
|
|
45 |
virtual Name kind() const {
|
55939
|
46 |
return CollectedHeap::EpsilonHeap;
|
55767
|
47 |
}
|
|
48 |
|
|
49 |
virtual const char *name() const {
|
|
50 |
return "Epsilon GC";
|
|
51 |
}
|
|
52 |
|
|
53 |
virtual jint initialize();
|
|
54 |
|
55974
|
55 |
virtual void post_initialize();
|
|
56 |
|
|
57 |
virtual void initialize_serviceability();
|
|
58 |
virtual GrowableArray<GCMemoryManager*> memory_managers();
|
|
59 |
virtual GrowableArray<MemoryPool*> memory_pools();
|
55767
|
60 |
|
55939
|
61 |
static EpsilonHeap* heap();
|
55767
|
62 |
|
|
63 |
virtual size_t capacity() const { return _virtual_space.committed_size(); }
|
|
64 |
virtual size_t used() const { return _space->used(); }
|
|
65 |
virtual size_t max_capacity() const { return _virtual_space.reserved_size(); }
|
|
66 |
|
|
67 |
virtual bool is_maximal_no_gc() const {
|
|
68 |
// No GC is going to happen, unless we are at capacity.
|
|
69 |
// At which point we will fail anyway.
|
|
70 |
return used() == capacity();
|
|
71 |
}
|
|
72 |
|
|
73 |
virtual bool is_in(const void *p) const { return _space->is_in(p); }
|
|
74 |
|
|
75 |
virtual bool is_scavengable(oop obj) {
|
|
76 |
// Epsilon does not move objects, no objects are scavengable.
|
|
77 |
return false;
|
|
78 |
}
|
|
79 |
|
|
80 |
HeapWord* allocate_work(size_t size);
|
|
81 |
virtual HeapWord* mem_allocate(size_t size, bool *gc_overhead_limit_was_exceeded);
|
|
82 |
virtual HeapWord* allocate_new_tlab(size_t size);
|
|
83 |
|
|
84 |
// TLAB allocations
|
|
85 |
virtual bool supports_tlab_allocation() const { return UseTLAB; }
|
|
86 |
virtual size_t tlab_capacity(Thread *thr) const { return capacity(); }
|
|
87 |
virtual size_t tlab_used(Thread *thr) const { return used(); }
|
|
88 |
virtual size_t max_tlab_size() const { return _max_tlab_size; }
|
|
89 |
virtual size_t unsafe_max_tlab_alloc(Thread *thr) const;
|
|
90 |
|
|
91 |
virtual bool can_elide_tlab_store_barriers() const {
|
|
92 |
// No store barriers for Epsilon, allow elision
|
|
93 |
return true;
|
|
94 |
}
|
|
95 |
|
|
96 |
virtual bool can_elide_initializing_store_barrier(oop new_obj) {
|
|
97 |
// No card marks for Epsilon, can elide them all.
|
|
98 |
return true;
|
|
99 |
}
|
|
100 |
|
|
101 |
virtual bool card_mark_must_follow_store() const {
|
|
102 |
// No card marks for Epsilon.
|
|
103 |
return false;
|
|
104 |
}
|
|
105 |
|
|
106 |
virtual void collect(GCCause::Cause cause);
|
|
107 |
virtual void do_full_collection(bool clear_all_soft_refs);
|
|
108 |
|
|
109 |
virtual AdaptiveSizePolicy *size_policy() {
|
|
110 |
// No such thing for Epsilon
|
|
111 |
return NULL;
|
|
112 |
}
|
|
113 |
|
|
114 |
virtual CollectorPolicy *collector_policy() const {
|
|
115 |
return _policy;
|
|
116 |
}
|
|
117 |
|
|
118 |
virtual void object_iterate(ObjectClosure *cl) {
|
|
119 |
safe_object_iterate(cl);
|
|
120 |
}
|
|
121 |
|
|
122 |
virtual void safe_object_iterate(ObjectClosure *cl);
|
|
123 |
|
|
124 |
virtual HeapWord* block_start(const void *addr) const {
|
|
125 |
// Epsilon does not support block parsing.
|
|
126 |
return NULL;
|
|
127 |
}
|
|
128 |
|
|
129 |
virtual size_t block_size(const HeapWord *addr) const {
|
|
130 |
// Epsilon does not support block parsing.
|
|
131 |
return 0;
|
|
132 |
}
|
|
133 |
|
|
134 |
virtual bool block_is_obj(const HeapWord *addr) const {
|
|
135 |
// Epsilon does not support block parsing.
|
|
136 |
return false;
|
|
137 |
}
|
|
138 |
|
|
139 |
virtual jlong millis_since_last_gc() {
|
|
140 |
// Report time since the VM start
|
|
141 |
return os::elapsed_counter() / NANOSECS_PER_MILLISEC;
|
|
142 |
}
|
|
143 |
|
|
144 |
virtual void prepare_for_verify() {
|
|
145 |
// No heap verification.
|
|
146 |
}
|
|
147 |
|
|
148 |
virtual void print_gc_threads_on(outputStream *st) const {
|
|
149 |
// No GC threads.
|
|
150 |
}
|
|
151 |
|
|
152 |
virtual void gc_threads_do(ThreadClosure *tc) const {
|
|
153 |
// No GC threads.
|
|
154 |
}
|
|
155 |
|
|
156 |
virtual void print_on(outputStream *st) const;
|
|
157 |
virtual void print_tracing_info() const;
|
|
158 |
|
|
159 |
virtual void verify(VerifyOption option) {
|
|
160 |
// No heap verification for Epsilon.
|
|
161 |
}
|
|
162 |
|
|
163 |
};
|
|
164 |
|
|
165 |
#endif // SHARE_VM_GC_EPSILON_COLLECTEDHEAP_HPP
|