# HG changeset patch # User mgronlun # Date 1567512301 -7200 # Node ID b08487c6eb4d6ffa571aa54d15382240de78eb0b # Parent 338ea33db84dac8326ceaf46ca10aaba941e4bb5 reductions diff -r 338ea33db84d -r b08487c6eb4d src/hotspot/share/jfr/leakprofiler/checkpoint/objectSampleCheckpoint.cpp --- a/src/hotspot/share/jfr/leakprofiler/checkpoint/objectSampleCheckpoint.cpp Tue Sep 03 13:31:54 2019 +0200 +++ b/src/hotspot/share/jfr/leakprofiler/checkpoint/objectSampleCheckpoint.cpp Tue Sep 03 14:05:01 2019 +0200 @@ -240,8 +240,6 @@ #ifdef ASSERT static void validate_stack_trace(const ObjectSample* sample, const JfrStackTrace* stack_trace) { - assert(sample != NULL, "invariant"); - assert(!sample->is_dead(), "invariant"); assert(!sample->has_stacktrace(), "invariant"); assert(stack_trace != NULL, "invariant"); assert(stack_trace->hash() == sample->stack_trace_hash(), "invariant"); @@ -255,7 +253,7 @@ sample->set_stacktrace(blob); return; } - const JfrStackTrace* stack_trace = resolve(sample); + const JfrStackTrace* const stack_trace = resolve(sample); DEBUG_ONLY(validate_stack_trace(sample, stack_trace)); JfrCheckpointWriter writer; writer.write_type(TYPE_STACKTRACE); @@ -304,11 +302,11 @@ return mutable_predicate(id_set, id); } -void ObjectSampleCheckpoint::tag(const JfrStackFrame& frame, traceid method_id) { +void ObjectSampleCheckpoint::add_to_leakp_set(const Method* method, traceid method_id) { if (is_processed(method_id) || is_klass_unloaded(method_id)) { return; } - JfrTraceId::set_leakp(frame._method); + JfrTraceId::set_leakp(method); } void ObjectSampleCheckpoint::write_stacktrace(const JfrStackTrace* trace, JfrCheckpointWriter& writer) { @@ -317,15 +315,11 @@ writer.write(trace->id()); writer.write((u1)!trace->_reached_root); writer.write(trace->_nr_of_frames); - traceid last_id = 0; // JfrStackFrames for (u4 i = 0; i < trace->_nr_of_frames; ++i) { - trace->_frames[i].write(writer); - const traceid method_id = trace->_frames[i]._methodid; - if (method_id != last_id) { - tag(trace->_frames[i], method_id); - last_id = method_id; - } + const JfrStackFrame& frame = trace->_frames[i]; + frame.write(writer); + add_to_leakp_set(frame._method, frame._methodid); } } diff -r 338ea33db84d -r b08487c6eb4d src/hotspot/share/jfr/leakprofiler/checkpoint/objectSampleCheckpoint.hpp --- a/src/hotspot/share/jfr/leakprofiler/checkpoint/objectSampleCheckpoint.hpp Tue Sep 03 13:31:54 2019 +0200 +++ b/src/hotspot/share/jfr/leakprofiler/checkpoint/objectSampleCheckpoint.hpp Tue Sep 03 14:05:01 2019 +0200 @@ -28,12 +28,12 @@ #include "memory/allocation.hpp" class EdgeStore; -class Klass; class JavaThread; class JfrCheckpointWriter; -class JfrStackFrame; class JfrStackTrace; class JfrStackTraceRepository; +class Klass; +class Method; class ObjectSample; class ObjectSampleMarker; class ObjectSampler; @@ -44,8 +44,8 @@ friend class PathToGcRootsOperation; friend class StackTraceBlobInstaller; private: + static void add_to_leakp_set(const Method* method, traceid method_id); static int save_mark_words(const ObjectSampler* sampler, ObjectSampleMarker& marker, bool emit_all); - static void tag(const JfrStackFrame& frame, traceid method_id); static void write_stacktrace(const JfrStackTrace* trace, JfrCheckpointWriter& writer); static void write(ObjectSampler* sampler, EdgeStore* edge_store, bool emit_all, Thread* thread); public: @@ -57,3 +57,4 @@ }; #endif // SHARE_JFR_LEAKPROFILER_CHECKPOINT_OBJECTSAMPLECHECKPOINT_HPP +