49 class ZHeap {
50 friend class VMStructs;
51
52 private:
53 static ZHeap* _heap;
54
55 ZWorkers _workers;
56 ZObjectAllocator _object_allocator;
57 ZPageAllocator _page_allocator;
58 ZPageTable _page_table;
59 ZForwardingTable _forwarding_table;
60 ZMark _mark;
61 ZReferenceProcessor _reference_processor;
62 ZWeakRootsProcessor _weak_roots_processor;
63 ZRelocate _relocate;
64 ZRelocationSet _relocation_set;
65 ZUnload _unload;
66 ZServiceability _serviceability;
67
68 size_t heap_min_size() const;
69 size_t heap_max_size() const;
70 size_t heap_max_reserve_size() const;
71
72 void before_flip();
73 void after_flip();
74
75 void flip_to_marked();
76 void flip_to_remapped();
77
78 void out_of_memory();
79 void fixup_partial_loads();
80
81 public:
82 static ZHeap* heap();
83
84 ZHeap();
85
86 bool is_initialized() const;
87
88 // Heap metrics
111 bool block_is_obj(uintptr_t addr) const;
112
113 // Workers
114 uint nconcurrent_worker_threads() const;
115 uint nconcurrent_no_boost_worker_threads() const;
116 void set_boost_worker_threads(bool boost);
117 void worker_threads_do(ThreadClosure* tc) const;
118 void print_worker_threads_on(outputStream* st) const;
119
120 // Reference processing
121 ReferenceDiscoverer* reference_discoverer();
122 void set_soft_reference_policy(bool clear);
123
124 // Non-strong reference processing
125 void process_non_strong_references();
126
127 // Page allocation
128 ZPage* alloc_page(uint8_t type, size_t size, ZAllocationFlags flags);
129 void undo_alloc_page(ZPage* page);
130 void free_page(ZPage* page, bool reclaimed);
131
132 // Object allocation
133 uintptr_t alloc_tlab(size_t size);
134 uintptr_t alloc_object(size_t size);
135 uintptr_t alloc_object_for_relocation(size_t size);
136 void undo_alloc_object_for_relocation(uintptr_t addr, size_t size);
137 bool is_alloc_stalled() const;
138 void check_out_of_memory();
139
140 // Marking
141 bool is_object_live(uintptr_t addr) const;
142 bool is_object_strongly_live(uintptr_t addr) const;
143 template <bool finalizable, bool publish> void mark_object(uintptr_t addr);
144 void mark_start();
145 void mark(bool initial);
146 void mark_flush_and_free(Thread* thread);
147 bool mark_end();
148
149 // Relocation set
150 void select_relocation_set();
|
49 class ZHeap {
50 friend class VMStructs;
51
52 private:
53 static ZHeap* _heap;
54
55 ZWorkers _workers;
56 ZObjectAllocator _object_allocator;
57 ZPageAllocator _page_allocator;
58 ZPageTable _page_table;
59 ZForwardingTable _forwarding_table;
60 ZMark _mark;
61 ZReferenceProcessor _reference_processor;
62 ZWeakRootsProcessor _weak_roots_processor;
63 ZRelocate _relocate;
64 ZRelocationSet _relocation_set;
65 ZUnload _unload;
66 ZServiceability _serviceability;
67
68 size_t heap_min_size() const;
69 size_t heap_initial_size() const;
70 size_t heap_max_size() const;
71 size_t heap_max_reserve_size() const;
72
73 void before_flip();
74 void after_flip();
75
76 void flip_to_marked();
77 void flip_to_remapped();
78
79 void out_of_memory();
80 void fixup_partial_loads();
81
82 public:
83 static ZHeap* heap();
84
85 ZHeap();
86
87 bool is_initialized() const;
88
89 // Heap metrics
112 bool block_is_obj(uintptr_t addr) const;
113
114 // Workers
115 uint nconcurrent_worker_threads() const;
116 uint nconcurrent_no_boost_worker_threads() const;
117 void set_boost_worker_threads(bool boost);
118 void worker_threads_do(ThreadClosure* tc) const;
119 void print_worker_threads_on(outputStream* st) const;
120
121 // Reference processing
122 ReferenceDiscoverer* reference_discoverer();
123 void set_soft_reference_policy(bool clear);
124
125 // Non-strong reference processing
126 void process_non_strong_references();
127
128 // Page allocation
129 ZPage* alloc_page(uint8_t type, size_t size, ZAllocationFlags flags);
130 void undo_alloc_page(ZPage* page);
131 void free_page(ZPage* page, bool reclaimed);
132
133 // Uncommit memory
134 uint64_t uncommit(uint64_t delay);
135
136 // Object allocation
137 uintptr_t alloc_tlab(size_t size);
138 uintptr_t alloc_object(size_t size);
139 uintptr_t alloc_object_for_relocation(size_t size);
140 void undo_alloc_object_for_relocation(uintptr_t addr, size_t size);
141 bool is_alloc_stalled() const;
142 void check_out_of_memory();
143
144 // Marking
145 bool is_object_live(uintptr_t addr) const;
146 bool is_object_strongly_live(uintptr_t addr) const;
147 template <bool finalizable, bool publish> void mark_object(uintptr_t addr);
148 void mark_start();
149 void mark(bool initial);
150 void mark_flush_and_free(Thread* thread);
151 bool mark_end();
152
153 // Relocation set
154 void select_relocation_set();
|