56 bool is_null() const; 57 size_t size() const; 58 59 size_t nsegments() const; 60 ZPhysicalMemorySegment segment(size_t index) const; 61 void add_segment(ZPhysicalMemorySegment segment); 62 63 ZPhysicalMemory split(size_t size); 64 void clear(); 65 }; 66 67 class ZPhysicalMemoryManager VALUE_OBJ_CLASS_SPEC { 68 private: 69 ZPhysicalMemoryBacking _backing; 70 const size_t _max_capacity; 71 size_t _capacity; 72 size_t _used; 73 74 bool ensure_available(size_t size); 75 76 public: 77 ZPhysicalMemoryManager(size_t max_capacity, size_t granule_size); 78 79 bool is_initialized() const; 80 81 size_t max_capacity() const; 82 size_t capacity() const; 83 size_t used() const; 84 size_t available() const; 85 86 ZPhysicalMemory alloc(size_t size); 87 void free(ZPhysicalMemory pmem); 88 89 void map(ZPhysicalMemory pmem, uintptr_t offset); 90 void unmap(ZPhysicalMemory pmem, uintptr_t offset); 91 void flip(ZPhysicalMemory pmem, uintptr_t offset); 92 }; 93 94 #endif // SHARE_GC_Z_ZPHYSICALMEMORY_HPP | 56 bool is_null() const; 57 size_t size() const; 58 59 size_t nsegments() const; 60 ZPhysicalMemorySegment segment(size_t index) const; 61 void add_segment(ZPhysicalMemorySegment segment); 62 63 ZPhysicalMemory split(size_t size); 64 void clear(); 65 }; 66 67 class ZPhysicalMemoryManager VALUE_OBJ_CLASS_SPEC { 68 private: 69 ZPhysicalMemoryBacking _backing; 70 const size_t _max_capacity; 71 size_t _capacity; 72 size_t _used; 73 74 bool ensure_available(size_t size); 75 76 void nmt_commit(ZPhysicalMemory pmem, uintptr_t offset); 77 void nmt_uncommit(ZPhysicalMemory pmem, uintptr_t offset); 78 79 public: 80 ZPhysicalMemoryManager(size_t max_capacity, size_t granule_size); 81 82 bool is_initialized() const; 83 84 size_t max_capacity() const; 85 size_t capacity() const; 86 size_t used() const; 87 size_t available() const; 88 89 ZPhysicalMemory alloc(size_t size); 90 void free(ZPhysicalMemory pmem); 91 92 void map(ZPhysicalMemory pmem, uintptr_t offset); 93 void unmap(ZPhysicalMemory pmem, uintptr_t offset); 94 void flip(ZPhysicalMemory pmem, uintptr_t offset); 95 }; 96 97 #endif // SHARE_GC_Z_ZPHYSICALMEMORY_HPP |