2626#include " gc/z/zLargePages.inline.hpp"
2727#include " gc/z/zMapper_windows.hpp"
2828#include " gc/z/zSyscall_windows.hpp"
29- #include " gc/z/zVirtualMemory.inline.hpp"
29+ #include " gc/z/zValue.inline.hpp"
30+ #include " gc/z/zMemory.inline.hpp"
3031#include " utilities/align.hpp"
3132#include " utilities/debug.hpp"
3233
@@ -82,41 +83,41 @@ class ZVirtualMemoryManagerSmallPages : public ZVirtualMemoryManagerImpl {
8283 // Called when a memory area is returned to the memory manager but can't
8384 // be merged with an already existing area. Make sure this area is covered
8485 // by a single placeholder.
85- static void create_callback (const ZMemory* area ) {
86- assert (is_aligned (area-> size (), ZGranuleSize), " Must be granule aligned" );
86+ static void create_callback (const ZMemoryRange& range ) {
87+ assert (is_aligned (range. size (), ZGranuleSize), " Must be granule aligned" );
8788
88- coalesce_into_one_placeholder (area-> start (), area-> size ());
89+ coalesce_into_one_placeholder (range. start (), range. size ());
8990 }
9091
9192 // Called when a complete memory area in the memory manager is allocated.
9293 // Create granule sized placeholders for the entire area.
93- static void destroy_callback (const ZMemory* area ) {
94- assert (is_aligned (area-> size (), ZGranuleSize), " Must be granule aligned" );
94+ static void destroy_callback (const ZMemoryRange& range ) {
95+ assert (is_aligned (range. size (), ZGranuleSize), " Must be granule aligned" );
9596
96- split_into_granule_sized_placeholders (area-> start (), area-> size ());
97+ split_into_granule_sized_placeholders (range. start (), range. size ());
9798 }
9899
99100 // Called when a memory area is allocated at the front of an exising memory area.
100101 // Turn the first part of the memory area into granule sized placeholders.
101- static void shrink_from_front_callback (const ZMemory* area , size_t size) {
102- assert (area-> size () > size, " Must be larger than what we try to split out" );
102+ static void shrink_from_front_callback (const ZMemoryRange& range , size_t size) {
103+ assert (range. size () > size, " Must be larger than what we try to split out" );
103104 assert (is_aligned (size, ZGranuleSize), " Must be granule aligned" );
104105
105106 // Split the area into two placeholders
106- split_placeholder (area-> start (), size);
107+ split_placeholder (range. start (), size);
107108
108109 // Split the first part into granule sized placeholders
109- split_into_granule_sized_placeholders (area-> start (), size);
110+ split_into_granule_sized_placeholders (range. start (), size);
110111 }
111112
112113 // Called when a memory area is allocated at the end of an existing memory area.
113114 // Turn the second part of the memory area into granule sized placeholders.
114- static void shrink_from_back_callback (const ZMemory* area , size_t size) {
115- assert (area-> size () > size, " Must be larger than what we try to split out" );
115+ static void shrink_from_back_callback (const ZMemoryRange& range , size_t size) {
116+ assert (range. size () > size, " Must be larger than what we try to split out" );
116117 assert (is_aligned (size, ZGranuleSize), " Must be granule aligned" );
117118
118119 // Split the area into two placeholders
119- const zoffset start = to_zoffset (area-> end () - size);
120+ const zoffset start = to_zoffset (range. end () - size);
120121 split_placeholder (start, size);
121122
122123 // Split the second part into granule sized placeholders
@@ -125,19 +126,19 @@ class ZVirtualMemoryManagerSmallPages : public ZVirtualMemoryManagerImpl {
125126
126127 // Called when freeing a memory area and it can be merged at the start of an
127128 // existing area. Coalesce the underlying placeholders into one.
128- static void grow_from_front_callback (const ZMemory* area , size_t size) {
129- assert (is_aligned (area-> size (), ZGranuleSize), " Must be granule aligned" );
129+ static void grow_from_front_callback (const ZMemoryRange& range , size_t size) {
130+ assert (is_aligned (range. size (), ZGranuleSize), " Must be granule aligned" );
130131
131- const zoffset start = area-> start () - size;
132- coalesce_into_one_placeholder (start, area-> size () + size);
132+ const zoffset start = range. start () - size;
133+ coalesce_into_one_placeholder (start, range. size () + size);
133134 }
134135
135136 // Called when freeing a memory area and it can be merged at the end of an
136137 // existing area. Coalesce the underlying placeholders into one.
137- static void grow_from_back_callback (const ZMemory* area , size_t size) {
138- assert (is_aligned (area-> size (), ZGranuleSize), " Must be granule aligned" );
138+ static void grow_from_back_callback (const ZMemoryRange& range , size_t size) {
139+ assert (is_aligned (range. size (), ZGranuleSize), " Must be granule aligned" );
139140
140- coalesce_into_one_placeholder (area-> start (), area-> size () + size);
141+ coalesce_into_one_placeholder (range. start (), range. size () + size);
141142 }
142143
143144 static void register_with (ZMemoryManager* manager) {
@@ -221,7 +222,7 @@ void ZVirtualMemoryManager::pd_initialize_before_reserve() {
221222}
222223
223224void ZVirtualMemoryManager::pd_initialize_after_reserve () {
224- _impl->initialize_after_reserve (&_manager );
225+ _impl->initialize_after_reserve (_managers. addr ( 0 ) );
225226}
226227
227228bool ZVirtualMemoryManager::pd_reserve (zaddress_unsafe addr, size_t size) {
0 commit comments