|
1 /* |
|
2 * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved. |
|
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
|
4 * |
|
5 * This code is free software; you can redistribute it and/or modify it |
|
6 * under the terms of the GNU General Public License version 2 only, as |
|
7 * published by the Free Software Foundation. |
|
8 * |
|
9 * This code is distributed in the hope that it will be useful, but WITHOUT |
|
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
12 * version 2 for more details (a copy is included in the LICENSE file that |
|
13 * accompanied this code). |
|
14 * |
|
15 * You should have received a copy of the GNU General Public License version |
|
16 * 2 along with this work; if not, write to the Free Software Foundation, |
|
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
|
18 * |
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
|
20 * or visit www.oracle.com if you need additional information or have any |
|
21 * questions. |
|
22 */ |
|
23 |
|
24 #ifndef SHARE_GC_Z_ZCOLLECTEDHEAP_HPP |
|
25 #define SHARE_GC_Z_ZCOLLECTEDHEAP_HPP |
|
26 |
|
27 #include "gc/shared/collectedHeap.hpp" |
|
28 #include "gc/shared/softRefPolicy.hpp" |
|
29 #include "gc/z/zBarrierSet.hpp" |
|
30 #include "gc/z/zCollectorPolicy.hpp" |
|
31 #include "gc/z/zDirector.hpp" |
|
32 #include "gc/z/zDriver.hpp" |
|
33 #include "gc/z/zInitialize.hpp" |
|
34 #include "gc/z/zHeap.hpp" |
|
35 #include "gc/z/zRuntimeWorkers.hpp" |
|
36 #include "gc/z/zStat.hpp" |
|
37 |
|
38 class ZCollectedHeap : public CollectedHeap { |
|
39 friend class VMStructs; |
|
40 |
|
41 private: |
|
42 ZCollectorPolicy* _collector_policy; |
|
43 SoftRefPolicy _soft_ref_policy; |
|
44 ZBarrierSet _barrier_set; |
|
45 ZInitialize _initialize; |
|
46 ZHeap _heap; |
|
47 ZDirector* _director; |
|
48 ZDriver* _driver; |
|
49 ZStat* _stat; |
|
50 ZRuntimeWorkers _runtime_workers; |
|
51 |
|
52 virtual HeapWord* allocate_new_tlab(size_t min_size, |
|
53 size_t requested_size, |
|
54 size_t* actual_size); |
|
55 |
|
56 public: |
|
57 static ZCollectedHeap* heap(); |
|
58 |
|
59 using CollectedHeap::ensure_parsability; |
|
60 using CollectedHeap::accumulate_statistics_all_tlabs; |
|
61 using CollectedHeap::resize_all_tlabs; |
|
62 |
|
63 ZCollectedHeap(ZCollectorPolicy* policy); |
|
64 virtual Name kind() const; |
|
65 virtual const char* name() const; |
|
66 virtual jint initialize(); |
|
67 virtual void initialize_serviceability(); |
|
68 virtual void stop(); |
|
69 |
|
70 virtual CollectorPolicy* collector_policy() const; |
|
71 virtual SoftRefPolicy* soft_ref_policy(); |
|
72 |
|
73 virtual size_t max_capacity() const; |
|
74 virtual size_t capacity() const; |
|
75 virtual size_t used() const; |
|
76 |
|
77 virtual bool is_maximal_no_gc() const; |
|
78 virtual bool is_scavengable(oop obj); |
|
79 virtual bool is_in(const void* p) const; |
|
80 virtual bool is_in_closed_subset(const void* p) const; |
|
81 |
|
82 virtual HeapWord* mem_allocate(size_t size, bool* gc_overhead_limit_was_exceeded); |
|
83 virtual MetaWord* satisfy_failed_metadata_allocation(ClassLoaderData* loader_data, |
|
84 size_t size, |
|
85 Metaspace::MetadataType mdtype); |
|
86 virtual void collect(GCCause::Cause cause); |
|
87 virtual void collect_as_vm_thread(GCCause::Cause cause); |
|
88 virtual void do_full_collection(bool clear_all_soft_refs); |
|
89 |
|
90 virtual bool supports_tlab_allocation() const; |
|
91 virtual size_t tlab_capacity(Thread* thr) const; |
|
92 virtual size_t tlab_used(Thread* thr) const; |
|
93 virtual size_t max_tlab_size() const; |
|
94 virtual size_t unsafe_max_tlab_alloc(Thread* thr) const; |
|
95 |
|
96 virtual bool can_elide_tlab_store_barriers() const; |
|
97 virtual bool can_elide_initializing_store_barrier(oop new_obj); |
|
98 virtual bool card_mark_must_follow_store() const; |
|
99 |
|
100 virtual GrowableArray<GCMemoryManager*> memory_managers(); |
|
101 virtual GrowableArray<MemoryPool*> memory_pools(); |
|
102 |
|
103 virtual void object_iterate(ObjectClosure* cl); |
|
104 virtual void safe_object_iterate(ObjectClosure* cl); |
|
105 |
|
106 virtual HeapWord* block_start(const void* addr) const; |
|
107 virtual size_t block_size(const HeapWord* addr) const; |
|
108 virtual bool block_is_obj(const HeapWord* addr) const; |
|
109 |
|
110 virtual void register_nmethod(nmethod* nm); |
|
111 virtual void unregister_nmethod(nmethod* nm); |
|
112 virtual void verify_nmethod(nmethod* nmethod); |
|
113 |
|
114 virtual WorkGang* get_safepoint_workers(); |
|
115 |
|
116 virtual jlong millis_since_last_gc(); |
|
117 |
|
118 virtual void gc_threads_do(ThreadClosure* tc) const; |
|
119 |
|
120 virtual VirtualSpaceSummary create_heap_space_summary(); |
|
121 |
|
122 virtual void print_on(outputStream* st) const; |
|
123 virtual void print_on_error(outputStream* st) const; |
|
124 virtual void print_extended_on(outputStream* st) const; |
|
125 virtual void print_gc_threads_on(outputStream* st) const; |
|
126 virtual void print_tracing_info() const; |
|
127 |
|
128 virtual void prepare_for_verify(); |
|
129 virtual void verify(VerifyOption option /* ignored */); |
|
130 virtual bool is_oop(oop object) const; |
|
131 }; |
|
132 |
|
133 #endif // SHARE_GC_Z_ZCOLLECTEDHEAP_HPP |