30 31 // On macOS, we use a virtual backing file. It is represented by a reserved virtual 32 // address space, in which we commit physical memory using the mach_vm_map() API. 33 // The multi-mapping API simply remaps these addresses using mach_vm_remap() into 34 // the different heap views. This works as-if there was a backing file, it's just 35 // that the file is represented with memory mappings instead. 36 37 class ZBackingFile { 38 private: 39 uintptr_t _base; 40 size_t _size; 41 bool _initialized; 42 43 bool commit_inner(size_t offset, size_t length); 44 45 public: 46 ZBackingFile(); 47 48 bool is_initialized() const; 49 50 size_t size() const; 51 52 size_t commit(size_t offset, size_t length); 53 size_t uncommit(size_t offset, size_t length); 54 55 void map(uintptr_t addr, size_t size, uintptr_t offset) const; 56 void unmap(uintptr_t addr, size_t size) const; 57 }; 58 59 #endif // OS_BSD_GC_Z_ZBACKINGFILE_BSD_HPP | 30 31 // On macOS, we use a virtual backing file. It is represented by a reserved virtual 32 // address space, in which we commit physical memory using the mach_vm_map() API. 33 // The multi-mapping API simply remaps these addresses using mach_vm_remap() into 34 // the different heap views. This works as-if there was a backing file, it's just 35 // that the file is represented with memory mappings instead. 36 37 class ZBackingFile { 38 private: 39 uintptr_t _base; 40 size_t _size; 41 bool _initialized; 42 43 bool commit_inner(size_t offset, size_t length); 44 45 public: 46 ZBackingFile(); 47 48 bool is_initialized() const; 49 50 void warn_commit_limits(size_t max) const; 51 52 size_t size() const; 53 54 size_t commit(size_t offset, size_t length); 55 size_t uncommit(size_t offset, size_t length); 56 57 void map(uintptr_t addr, size_t size, uintptr_t offset) const; 58 void unmap(uintptr_t addr, size_t size) const; 59 }; 60 61 #endif // OS_BSD_GC_Z_ZBACKINGFILE_BSD_HPP |