comparison src/hotspot/share/gc/epsilon/epsilonCollectedHeap.hpp @ 55767:8e22715afabc

Initial import of Epsilon sources from jdk10/sandbox
author shade
date Mon, 06 Nov 2017 18:53:38 +0100
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:c41e23035f54
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
34 class EpsilonCollectedHeap : public CollectedHeap {
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:
43 EpsilonCollectedHeap(EpsilonCollectorPolicy* p) : _policy(p) {};
44
45 virtual Name kind() const {
46 return CollectedHeap::EpsilonCollectedHeap;
47 }
48
49 virtual const char *name() const {
50 return "Epsilon GC";
51 }
52
53 virtual jint initialize();
54
55 virtual void post_initialize() {}
56
57 static EpsilonCollectedHeap* heap();
58
59 virtual size_t capacity() const { return _virtual_space.committed_size(); }
60 virtual size_t used() const { return _space->used(); }
61 virtual size_t max_capacity() const { return _virtual_space.reserved_size(); }
62
63 virtual bool is_maximal_no_gc() const {
64 // No GC is going to happen, unless we are at capacity.
65 // At which point we will fail anyway.
66 return used() == capacity();
67 }
68
69 virtual bool is_in(const void *p) const { return _space->is_in(p); }
70
71 virtual bool is_scavengable(oop obj) {
72 // Epsilon does not move objects, no objects are scavengable.
73 return false;
74 }
75
76 HeapWord* allocate_work(size_t size);
77 virtual HeapWord* mem_allocate(size_t size, bool *gc_overhead_limit_was_exceeded);
78 virtual HeapWord* allocate_new_tlab(size_t size);
79
80 // TLAB allocations
81 virtual bool supports_tlab_allocation() const { return UseTLAB; }
82 virtual size_t tlab_capacity(Thread *thr) const { return capacity(); }
83 virtual size_t tlab_used(Thread *thr) const { return used(); }
84 virtual size_t max_tlab_size() const { return _max_tlab_size; }
85 virtual size_t unsafe_max_tlab_alloc(Thread *thr) const;
86
87 virtual bool can_elide_tlab_store_barriers() const {
88 // No store barriers for Epsilon, allow elision
89 return true;
90 }
91
92 virtual bool can_elide_initializing_store_barrier(oop new_obj) {
93 // No card marks for Epsilon, can elide them all.
94 return true;
95 }
96
97 virtual bool card_mark_must_follow_store() const {
98 // No card marks for Epsilon.
99 return false;
100 }
101
102 virtual void collect(GCCause::Cause cause);
103 virtual void do_full_collection(bool clear_all_soft_refs);
104
105 virtual AdaptiveSizePolicy *size_policy() {
106 // No such thing for Epsilon
107 return NULL;
108 }
109
110 virtual CollectorPolicy *collector_policy() const {
111 return _policy;
112 }
113
114 virtual void object_iterate(ObjectClosure *cl) {
115 safe_object_iterate(cl);
116 }
117
118 virtual void safe_object_iterate(ObjectClosure *cl);
119
120 virtual HeapWord* block_start(const void *addr) const {
121 // Epsilon does not support block parsing.
122 return NULL;
123 }
124
125 virtual size_t block_size(const HeapWord *addr) const {
126 // Epsilon does not support block parsing.
127 return 0;
128 }
129
130 virtual bool block_is_obj(const HeapWord *addr) const {
131 // Epsilon does not support block parsing.
132 return false;
133 }
134
135 virtual jlong millis_since_last_gc() {
136 // Report time since the VM start
137 return os::elapsed_counter() / NANOSECS_PER_MILLISEC;
138 }
139
140 virtual void prepare_for_verify() {
141 // No heap verification.
142 }
143
144 virtual void print_gc_threads_on(outputStream *st) const {
145 // No GC threads.
146 }
147
148 virtual void gc_threads_do(ThreadClosure *tc) const {
149 // No GC threads.
150 }
151
152 virtual void print_on(outputStream *st) const;
153 virtual void print_tracing_info() const;
154
155 virtual void verify(VerifyOption option) {
156 // No heap verification for Epsilon.
157 }
158
159 };
160
161 #endif // SHARE_VM_GC_EPSILON_COLLECTEDHEAP_HPP