--- old/share/runtime/os.hpp 2018-06-15 09:47:43.010912581 -0700 +++ new/share/runtime/os.hpp 2018-06-15 09:47:42.966912580 -0700 @@ -228,6 +228,24 @@ // in place until called after initialization has ocurred. return AssumeMP || (_processor_count != 1); } + static inline bool has_nvdimm() { + // This is set AFTER memory is successfully mapped on NVDIMM's + // DAX filesystem + return _nvdimm_present; + } + static inline int nvdimm_fd() { + // ParallelOldGC adaptive sizing requires nvdimm fd. + return _nvdimm_fd; + } + static inline address dram_heapbase() { + return _dram_heap_base; + } + static inline address nvdimm_heapbase() { + return _nvdimm_heap_base; + } + static inline uint nvdimm_regionlength() { + return _nvdimm_region_length; + } static julong available_memory(); static julong physical_memory(); static bool has_allocatable_memory_limit(julong* limit); @@ -243,6 +261,12 @@ } static void set_processor_count(int count) { _processor_count = count; } + static void set_nvdimm_present(bool status) { _nvdimm_present = status; } + static void set_nvdimm_fd(int fd) { _nvdimm_fd = fd; } + static void set_dram_heapbase(address base) {_dram_heap_base = base; } + static void set_nvdimm_heapbase(address base) {_nvdimm_heap_base = base; } + static void set_nvdimm_regionlength(uint length) {_nvdimm_region_length = length; } + // Returns the number of CPUs this process is currently allowed to run on. // Note that on some OSes this can change dynamically. static int active_processor_count(); @@ -331,8 +355,11 @@ static void split_reserved_memory(char *base, size_t size, size_t split, bool realloc); static bool commit_memory(char* addr, size_t bytes, bool executable); + static bool commit_memory(char* addr, size_t bytes, bool executable, int file_desc, size_t offset = 0); static bool commit_memory(char* addr, size_t size, size_t alignment_hint, bool executable); + static bool commit_memory(char* addr, size_t size, size_t alignment_hint, + bool executable, int file_desc, size_t offset = 0); // Same as commit_memory() that either succeeds or calls // vm_exit_out_of_memory() with the specified mesg. static void commit_memory_or_exit(char* addr, size_t bytes, @@ -363,7 +390,8 @@ static int create_file_for_heap(const char* dir); // Map memory to the file referred by fd. This function is slightly different from map_memory() // and is added to be used for implementation of -XX:AllocateHeapAt - static char* map_memory_to_file(char* base, size_t size, int fd); + static char* map_memory_to_file(char* base, size_t size, int fd, int offset = 0, bool exec = false, bool allocate = true); + static int allocate_file(int file_desc, size_t size); // Replace existing reserved memory with file mapping static char* replace_existing_mapping_with_file_mapping(char* base, size_t size, int fd); @@ -1017,7 +1045,11 @@ char fileSep, char pathSep); static bool set_boot_path(char fileSep, char pathSep); - + static bool _nvdimm_present; + static int _nvdimm_fd; + static address _dram_heap_base; + static address _nvdimm_heap_base; + static uint _nvdimm_region_length; }; #ifndef _WINDOWS