--- old/src/share/vm/jfr/recorder/stacktrace/jfrStackTraceRepository.hpp 2021-07-05 14:05:59.965151560 +0000 +++ new/src/share/vm/jfr/recorder/stacktrace/jfrStackTraceRepository.hpp 2021-07-05 14:05:59.905150668 +0000 @@ -96,6 +96,8 @@ friend class JfrRecorder; friend class JfrRecorderService; friend class ObjectSampler; + friend class RecordStackTrace; + friend class StackTraceWrite; friend class WriteObjectSampleStacktrace; class StackTrace : public JfrCHeapObj { @@ -126,15 +128,17 @@ private: static const u4 TABLE_SIZE = 2053; StackTrace* _table[TABLE_SIZE]; - traceid _next_id; + u4 _last_entries; u4 _entries; traceid add_trace(const JfrStackTrace& stacktrace); - static traceid add(const JfrStackTrace* stacktrace, JavaThread* thread); + static traceid add_for_leak_profiler(const JfrStackTrace* stacktrace, JavaThread* thread); traceid record_for(JavaThread* thread, int skip, JfrStackFrame* frames, u4 max_frames); size_t write_impl(JfrChunkWriter& cw, bool clear); - const StackTrace* resolve_entry(unsigned int hash, traceid id) const; + static const StackTrace* lookup_for_leak_profiler(unsigned int hash, traceid id); + static void record_for_leak_profiler(JavaThread* thread, JfrStackTrace* stacktrace, int skip = 0); + static void clear_leak_profiler(); static void write_metadata(JfrCheckpointWriter& cpw); static bool fill_stacktrace_for(JavaThread* thread, JfrStackTrace* stacktrace, int skip); @@ -147,11 +151,14 @@ static JfrStackTraceRepository& instance(); public: + static JfrStackTraceRepository& leak_profiler_instance(); + static traceid add(JfrStackTraceRepository& repo, const JfrStackTrace& stacktrace); static traceid add(const JfrStackTrace& stacktrace); static traceid record(Thread* thread, int skip = 0); - traceid write(JfrCheckpointWriter& cpw, traceid id, unsigned int hash); + static traceid write_for_leak_profiler(JfrCheckpointWriter& cpw, traceid id, unsigned int hash); size_t write(JfrChunkWriter& cw, bool clear); - size_t clear(); + static size_t clear(); + static size_t clear(JfrStackTraceRepository& repo); }; #endif // SHARE_VM_JFR_RECORDER_STACKTRACE_JFRSTACKTRACEREPOSITORY_HPP