1602 char* os::map_memory(int fd, const char* file_name, size_t file_offset,
1603 char *addr, size_t bytes, bool read_only,
1604 bool allow_exec) {
1605 char* result = pd_map_memory(fd, file_name, file_offset, addr, bytes, read_only, allow_exec);
1606 if (result != NULL) {
1607 MemTracker::record_virtual_memory_reserve_and_commit((address)result, bytes, CALLER_PC);
1608 }
1609 return result;
1610 }
1611
1612 char* os::remap_memory(int fd, const char* file_name, size_t file_offset,
1613 char *addr, size_t bytes, bool read_only,
1614 bool allow_exec) {
1615 return pd_remap_memory(fd, file_name, file_offset, addr, bytes,
1616 read_only, allow_exec);
1617 }
1618
1619 bool os::unmap_memory(char *addr, size_t bytes) {
1620 bool result;
1621 if (MemTracker::tracking_level() > NMT_minimal) {
1622 Tracker tkr = MemTracker::get_virtual_memory_release_tracker();
1623 result = pd_unmap_memory(addr, bytes);
1624 if (result) {
1625 tkr.record((address)addr, bytes);
1626 }
1627 } else {
1628 result = pd_unmap_memory(addr, bytes);
1629 }
1630 return result;
1631 }
1632
1633 void os::free_memory(char *addr, size_t bytes, size_t alignment_hint) {
1634 pd_free_memory(addr, bytes, alignment_hint);
1635 }
1636
1637 void os::realign_memory(char *addr, size_t bytes, size_t alignment_hint) {
1638 pd_realign_memory(addr, bytes, alignment_hint);
1639 }
1640
1641 #ifndef TARGET_OS_FAMILY_windows
1642 /* try to switch state from state "from" to state "to"
|
1602 char* os::map_memory(int fd, const char* file_name, size_t file_offset,
1603 char *addr, size_t bytes, bool read_only,
1604 bool allow_exec) {
1605 char* result = pd_map_memory(fd, file_name, file_offset, addr, bytes, read_only, allow_exec);
1606 if (result != NULL) {
1607 MemTracker::record_virtual_memory_reserve_and_commit((address)result, bytes, CALLER_PC);
1608 }
1609 return result;
1610 }
1611
1612 char* os::remap_memory(int fd, const char* file_name, size_t file_offset,
1613 char *addr, size_t bytes, bool read_only,
1614 bool allow_exec) {
1615 return pd_remap_memory(fd, file_name, file_offset, addr, bytes,
1616 read_only, allow_exec);
1617 }
1618
1619 bool os::unmap_memory(char *addr, size_t bytes) {
1620 bool result;
1621 if (MemTracker::tracking_level() > NMT_minimal) {
1622 Tracker tkr = MemTracker::get_virtual_memory_uncommit_tracker();
1623 result = pd_unmap_memory(addr, bytes);
1624 if (result) {
1625 tkr.record((address)addr, bytes);
1626 }
1627 } else {
1628 result = pd_unmap_memory(addr, bytes);
1629 }
1630 return result;
1631 }
1632
1633 void os::free_memory(char *addr, size_t bytes, size_t alignment_hint) {
1634 pd_free_memory(addr, bytes, alignment_hint);
1635 }
1636
1637 void os::realign_memory(char *addr, size_t bytes, size_t alignment_hint) {
1638 pd_realign_memory(addr, bytes, alignment_hint);
1639 }
1640
1641 #ifndef TARGET_OS_FAMILY_windows
1642 /* try to switch state from state "from" to state "to"
|