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