8191369: NMT: Enhance thread stack tracking

More precise thread stack tracking on Linux and Windows

Reviewed-by: coleenp, adinn, minqi
This commit is contained in:
Zhengyu Gu 2018-03-01 16:35:36 -05:00
parent d7765d9002
commit 354249f51e
8 changed files with 209 additions and 28 deletions

View file

@ -160,9 +160,7 @@ class VirtualMemorySummary : AllStatic {
as_snapshot()->by_type(to)->commit_memory(size);
}
static inline void snapshot(VirtualMemorySnapshot* s) {
as_snapshot()->copy_to(s);
}
static void snapshot(VirtualMemorySnapshot* s);
static VirtualMemorySnapshot* as_snapshot() {
return (VirtualMemorySnapshot*)_snapshot;
@ -336,6 +334,9 @@ class ReservedMemoryRegion : public VirtualMemoryRegion {
return compare(rgn) == 0;
}
// uncommitted thread stack bottom, above guard pages if there is any.
address thread_stack_uncommitted_bottom() const;
bool add_committed_region(address addr, size_t size, const NativeCallStack& stack);
bool remove_uncommitted_region(address addr, size_t size);
@ -389,6 +390,7 @@ class VirtualMemoryWalker : public StackObj {
// Main class called from MemTracker to track virtual memory allocations, commits and releases.
class VirtualMemoryTracker : AllStatic {
friend class VirtualMemoryTrackerTest;
friend class ThreadStackTrackingTest;
public:
static bool initialize(NMT_TrackingLevel level);
@ -408,6 +410,9 @@ class VirtualMemoryTracker : AllStatic {
static bool transition(NMT_TrackingLevel from, NMT_TrackingLevel to);
// Snapshot current thread stacks
static void snapshot_thread_stacks();
private:
static SortedLinkedList<ReservedMemoryRegion, compare_reserved_region_base>* _reserved_regions;
};