7199092: NMT: NMT needs to deal overlapped virtual memory ranges

Enhanced virtual memory tracking to track committed regions as well as reserved regions, so NMT now can generate virtual memory map.

Reviewed-by: acorn, coleenp
This commit is contained in:
Zhengyu Gu 2012-10-19 21:40:07 -04:00
parent 240b5c9329
commit 3e481cdd81
29 changed files with 800 additions and 364 deletions

View file

@ -29,6 +29,7 @@
#include "runtime/arguments.hpp"
#include "runtime/java.hpp"
#include "runtime/os.hpp"
#include "services/memTracker.hpp"
#include "utilities/defaultStream.hpp"
# include <sys/stat.h>
@ -344,24 +345,13 @@ ReservedSpace FileMapInfo::reserve_shared_memory() {
fail_continue(err_msg("Unable to reserved shared space at required address " INTPTR_FORMAT, requested_addr));
return rs;
}
// the reserved virtual memory is for mapping class data sharing archive
if (MemTracker::is_on()) {
MemTracker::record_virtual_memory_type((address)rs.base(), mtClassShared);
}
return rs;
}
// Memory map a region in the address space.
char* FileMapInfo::map_region(int i, ReservedSpace rs) {
struct FileMapInfo::FileMapHeader::space_info* si = &_header._space[i];
size_t used = si->_used;
size_t size = align_size_up(used, os::vm_allocation_granularity());
ReservedSpace mapped_rs = rs.first_part(size, true, true);
ReservedSpace unmapped_rs = rs.last_part(size);
mapped_rs.release();
return map_region(i);
}
// Memory map a region in the address space.
static const char* shared_region_name[] = { "ReadOnly", "ReadWrite", "MiscData", "MiscCode"};