68 MEMFLAGS flag = mtNone) { }
69 static inline void record_virtual_memory_reserve_and_commit(void* addr, size_t size,
70 const NativeCallStack& stack, MEMFLAGS flag = mtNone) { }
71 static inline void record_virtual_memory_commit(void* addr, size_t size, const NativeCallStack& stack) { }
72 static inline void record_virtual_memory_type(void* addr, MEMFLAGS flag) { }
73 static inline void record_thread_stack(void* addr, size_t size) { }
74 static inline void release_thread_stack(void* addr, size_t size) { }
75
76 static void final_report(outputStream*) { }
77 static void error_report(outputStream*) { }
78 };
79
80 #else
81
82 #include "runtime/mutexLocker.hpp"
83 #include "runtime/threadCritical.hpp"
84 #include "services/mallocTracker.hpp"
85 #include "services/threadStackTracker.hpp"
86 #include "services/virtualMemoryTracker.hpp"
87
88 extern volatile bool NMT_stack_walkable;
89
90 #define CURRENT_PC ((MemTracker::tracking_level() == NMT_detail && NMT_stack_walkable) ? \
91 NativeCallStack(0, true) : NativeCallStack::empty_stack())
92 #define CALLER_PC ((MemTracker::tracking_level() == NMT_detail && NMT_stack_walkable) ? \
93 NativeCallStack(1, true) : NativeCallStack::empty_stack())
94
95 class MemBaseline;
96
97 // Tracker is used for guarding 'release' semantics of virtual memory operation, to avoid
98 // the other thread obtains and records the same region that is just 'released' by current
99 // thread but before it can record the operation.
100 class Tracker : public StackObj {
101 public:
102 enum TrackerType {
103 uncommit,
104 release
105 };
106
107 public:
108 Tracker(enum TrackerType type) : _type(type) { }
109 void record(address addr, size_t size);
110 private:
111 enum TrackerType _type;
112 // Virtual memory tracking data structures are protected by ThreadCritical lock.
|
68 MEMFLAGS flag = mtNone) { }
69 static inline void record_virtual_memory_reserve_and_commit(void* addr, size_t size,
70 const NativeCallStack& stack, MEMFLAGS flag = mtNone) { }
71 static inline void record_virtual_memory_commit(void* addr, size_t size, const NativeCallStack& stack) { }
72 static inline void record_virtual_memory_type(void* addr, MEMFLAGS flag) { }
73 static inline void record_thread_stack(void* addr, size_t size) { }
74 static inline void release_thread_stack(void* addr, size_t size) { }
75
76 static void final_report(outputStream*) { }
77 static void error_report(outputStream*) { }
78 };
79
80 #else
81
82 #include "runtime/mutexLocker.hpp"
83 #include "runtime/threadCritical.hpp"
84 #include "services/mallocTracker.hpp"
85 #include "services/threadStackTracker.hpp"
86 #include "services/virtualMemoryTracker.hpp"
87
88 #define CURRENT_PC ((MemTracker::tracking_level() == NMT_detail) ? \
89 NativeCallStack(0, true) : NativeCallStack::empty_stack())
90 #define CALLER_PC ((MemTracker::tracking_level() == NMT_detail) ? \
91 NativeCallStack(1, true) : NativeCallStack::empty_stack())
92
93 class MemBaseline;
94
95 // Tracker is used for guarding 'release' semantics of virtual memory operation, to avoid
96 // the other thread obtains and records the same region that is just 'released' by current
97 // thread but before it can record the operation.
98 class Tracker : public StackObj {
99 public:
100 enum TrackerType {
101 uncommit,
102 release
103 };
104
105 public:
106 Tracker(enum TrackerType type) : _type(type) { }
107 void record(address addr, size_t size);
108 private:
109 enum TrackerType _type;
110 // Virtual memory tracking data structures are protected by ThreadCritical lock.
|