< prev index next >

src/share/vm/jfr/recorder/stacktrace/jfrStackTraceRepository.hpp

Print this page
rev 9055 : 8214542: JFR: Old Object Sample event slow on a deep heap in debug builds
Reviewed-by: egahlin, rwestberg

@@ -34,13 +34,13 @@
 class JfrChunkWriter;
 class Method;
 
 class JfrStackFrame {
  private:
-  const Method* _method;
+  mutable const Method* _method;
   traceid _methodid;
-  int _line;
+  mutable int _line;
   int _bci;
   u1 _type;
 
  public:
   enum {

@@ -56,11 +56,11 @@
   JfrStackFrame(const traceid& id, int bci, int type, int lineno) :
     _method(NULL), _methodid(id), _line(lineno), _bci(bci), _type(type) {}
   bool equals(const JfrStackFrame& rhs) const;
   void write(JfrChunkWriter& cw) const;
   void write(JfrCheckpointWriter& cpw) const;
-  void resolve_lineno();
+  void resolve_lineno() const;
 };
 
 class JfrStackTrace : public StackObj {
   friend class JfrStackTraceRepository;
  private:

@@ -68,11 +68,11 @@
   traceid _id;
   u4 _nr_of_frames;
   unsigned int _hash;
   const u4 _max_frames;
   bool _reached_root;
-  bool _lineno;
+  mutable bool _lineno;
 
  public:
   JfrStackTrace(JfrStackFrame* frames, u4 max_frames) : _frames(frames),
                                                         _id(0),
                                                         _nr_of_frames(0),

@@ -80,13 +80,14 @@
                                                         _reached_root(false),
                                                         _max_frames(max_frames),
                                                         _lineno(false) {}
   bool record_thread(JavaThread& thread, frame& frame);
   bool record_safe(JavaThread* thread, int skip, bool leakp = false);
-  void resolve_linenos();
+  void resolve_linenos() const;
   void set_nr_of_frames(u4 nr_of_frames) { _nr_of_frames = nr_of_frames; }
   void set_hash(unsigned int hash) { _hash = hash; }
+  unsigned int hash() const { return _hash; }
   void set_frame(u4 frame_pos, JfrStackFrame& frame);
   void set_reached_root(bool reached_root) { _reached_root = reached_root; }
   bool full_stacktrace() const { return _reached_root; }
   bool have_lineno() const { return _lineno; }
 };

@@ -126,27 +127,30 @@
   static const u4 TABLE_SIZE = 2053;
   StackTrace* _table[TABLE_SIZE];
   traceid _next_id;
   u4 _entries;
 
-  size_t write_impl(JfrChunkWriter& cw, bool clear);
-  traceid record_for(JavaThread* thread, int skip, JfrStackFrame* frames, u4 max_frames);
-  traceid record_for(JavaThread* thread, int skip, JfrStackFrame* frames, u4 max_frames, unsigned int* hash);
   traceid add_trace(const JfrStackTrace& stacktrace);
-  const StackTrace* resolve_entry(unsigned int hash, traceid id) const;
+  static traceid add(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 void write_metadata(JfrCheckpointWriter& cpw);
 
+  static bool fill_stacktrace_for(JavaThread* thread, JfrStackTrace* stacktrace, int skip);
+
   JfrStackTraceRepository();
-  static JfrStackTraceRepository& instance();
- public:
   static JfrStackTraceRepository* create();
   bool initialize();
   static void destroy();
+
+  static JfrStackTraceRepository& instance();
+
+ public:
   static traceid add(const JfrStackTrace& stacktrace);
   static traceid record(Thread* thread, int skip = 0);
-  static traceid record(Thread* thread, int skip, unsigned int* hash);
   traceid write(JfrCheckpointWriter& cpw, traceid id, unsigned int hash);
   size_t write(JfrChunkWriter& cw, bool clear);
   size_t clear();
 };
 
< prev index next >