1 /*
2 * Copyright (c) 2011, 2025, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
55 bool _reached_root;
56 mutable bool _lineno;
57 mutable bool _written;
58
59 const JfrStackTrace* next() const { return _next; }
60
61 void write(JfrChunkWriter& cw) const;
62 void write(JfrCheckpointWriter& cpw) const;
63 bool equals(const JfrStackTrace& rhs) const;
64
65 void set_id(traceid id) { _id = id; }
66 void set_hash(unsigned int hash) { _hash = hash; }
67 void set_reached_root(bool reached_root) { _reached_root = reached_root; }
68 void resolve_linenos() const;
69
70 int number_of_frames() const;
71 bool have_lineno() const { return _lineno; }
72 bool full_stacktrace() const { return _reached_root; }
73 bool record_inner(JavaThread* jt, const frame& frame, bool in_continuation, int skip, int64_t stack_filter_id = -1);
74 bool record(JavaThread* jt, const frame& frame, bool in_continuation, int skip, int64_t stack_filter_id = -1);
75 void record_interpreter_top_frame(const JfrSampleRequest& request);
76
77 JfrStackTrace(traceid id, const JfrStackTrace& trace, const JfrStackTrace* next);
78
79 public:
80 // ResourceArea allocation, remember ResourceMark.
81 JfrStackTrace();
82 ~JfrStackTrace();
83
84 traceid hash() const { return _hash; }
85 traceid id() const { return _id; }
86
87 bool record(JavaThread* current_thread, int skip, int64_t stack_filter_id);
88 bool record(JavaThread* jt, const frame& frame, bool in_continuation, const JfrSampleRequest& request);
89 bool should_write() const { return !_written; }
90 };
91
92 #endif // SHARE_JFR_RECORDER_STACKTRACE_JFRSTACKTRACE_HPP
|
1 /*
2 * Copyright (c) 2011, 2026, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
55 bool _reached_root;
56 mutable bool _lineno;
57 mutable bool _written;
58
59 const JfrStackTrace* next() const { return _next; }
60
61 void write(JfrChunkWriter& cw) const;
62 void write(JfrCheckpointWriter& cpw) const;
63 bool equals(const JfrStackTrace& rhs) const;
64
65 void set_id(traceid id) { _id = id; }
66 void set_hash(unsigned int hash) { _hash = hash; }
67 void set_reached_root(bool reached_root) { _reached_root = reached_root; }
68 void resolve_linenos() const;
69
70 int number_of_frames() const;
71 bool have_lineno() const { return _lineno; }
72 bool full_stacktrace() const { return _reached_root; }
73 bool record_inner(JavaThread* jt, const frame& frame, bool in_continuation, int skip, int64_t stack_filter_id = -1);
74 bool record(JavaThread* jt, const frame& frame, bool in_continuation, int skip, int64_t stack_filter_id = -1);
75 void record_frame(const Method* method, int bci, u1 type);
76 void record_interpreter_top_frame(const JfrSampleRequest& request);
77 void record_stack_repair_top_frame(const JfrSampleRequest& request);
78
79 JfrStackTrace(traceid id, const JfrStackTrace& trace, const JfrStackTrace* next);
80
81 public:
82 // ResourceArea allocation, remember ResourceMark.
83 JfrStackTrace();
84 ~JfrStackTrace();
85
86 traceid hash() const { return _hash; }
87 traceid id() const { return _id; }
88
89 bool record(JavaThread* current_thread, int skip, int64_t stack_filter_id);
90 bool record(JavaThread* jt, const frame& frame, bool in_continuation, const JfrSampleRequest& request);
91 bool should_write() const { return !_written; }
92 };
93
94 #endif // SHARE_JFR_RECORDER_STACKTRACE_JFRSTACKTRACE_HPP
|