author | mgronlun |
Mon, 02 Sep 2019 19:42:46 +0200 | |
branch | JEP-349-branch |
changeset 57983 | a57907813a83 |
parent 57934 | 9c150f2b1fea |
child 58154 | 060d9d139109 |
permissions | -rw-r--r-- |
50113 | 1 |
/* |
53775 | 2 |
* Copyright (c) 2011, 2019, Oracle and/or its affiliates. All rights reserved. |
50113 | 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 |
* |
|
23 |
*/ |
|
24 |
||
25 |
#include "precompiled.hpp" |
|
26 |
#include "jfr/metadata/jfrSerializer.hpp" |
|
57870
00860d9caf4d
New metadata system for oldobjects built on top of simplified tagging model. Caching and serialization improvements. Flushpoint checkpoint with chunkheader contents.
mgronlun
parents:
57360
diff
changeset
|
27 |
#include "jfr/recorder/checkpoint/jfrCheckpointWriter.hpp" |
50113 | 28 |
#include "jfr/recorder/repository/jfrChunkWriter.hpp" |
29 |
#include "jfr/recorder/stacktrace/jfrStackTraceRepository.hpp" |
|
57902 | 30 |
#include "jfr/support/jfrThreadLocal.hpp" |
50113 | 31 |
#include "runtime/mutexLocker.hpp" |
32 |
||
33 |
static JfrStackTraceRepository* _instance = NULL; |
|
34 |
||
57870
00860d9caf4d
New metadata system for oldobjects built on top of simplified tagging model. Caching and serialization improvements. Flushpoint checkpoint with chunkheader contents.
mgronlun
parents:
57360
diff
changeset
|
35 |
JfrStackTraceRepository::JfrStackTraceRepository() : _next_id(0), _entries(0) { |
00860d9caf4d
New metadata system for oldobjects built on top of simplified tagging model. Caching and serialization improvements. Flushpoint checkpoint with chunkheader contents.
mgronlun
parents:
57360
diff
changeset
|
36 |
memset(_table, 0, sizeof(_table)); |
00860d9caf4d
New metadata system for oldobjects built on top of simplified tagging model. Caching and serialization improvements. Flushpoint checkpoint with chunkheader contents.
mgronlun
parents:
57360
diff
changeset
|
37 |
} |
00860d9caf4d
New metadata system for oldobjects built on top of simplified tagging model. Caching and serialization improvements. Flushpoint checkpoint with chunkheader contents.
mgronlun
parents:
57360
diff
changeset
|
38 |
|
50113 | 39 |
JfrStackTraceRepository& JfrStackTraceRepository::instance() { |
40 |
return *_instance; |
|
41 |
} |
|
42 |
||
43 |
JfrStackTraceRepository* JfrStackTraceRepository::create() { |
|
44 |
assert(_instance == NULL, "invariant"); |
|
45 |
_instance = new JfrStackTraceRepository(); |
|
46 |
return _instance; |
|
47 |
} |
|
48 |
||
49 |
class JfrFrameType : public JfrSerializer { |
|
50 |
public: |
|
51 |
void serialize(JfrCheckpointWriter& writer) { |
|
52 |
writer.write_count(JfrStackFrame::NUM_FRAME_TYPES); |
|
53 |
writer.write_key(JfrStackFrame::FRAME_INTERPRETER); |
|
54 |
writer.write("Interpreted"); |
|
55 |
writer.write_key(JfrStackFrame::FRAME_JIT); |
|
56 |
writer.write("JIT compiled"); |
|
57 |
writer.write_key(JfrStackFrame::FRAME_INLINE); |
|
58 |
writer.write("Inlined"); |
|
59 |
writer.write_key(JfrStackFrame::FRAME_NATIVE); |
|
60 |
writer.write("Native"); |
|
61 |
} |
|
62 |
}; |
|
63 |
||
64 |
bool JfrStackTraceRepository::initialize() { |
|
57360 | 65 |
return JfrSerializer::register_serializer(TYPE_FRAMETYPE, true, new JfrFrameType()); |
50113 | 66 |
} |
67 |
||
57870
00860d9caf4d
New metadata system for oldobjects built on top of simplified tagging model. Caching and serialization improvements. Flushpoint checkpoint with chunkheader contents.
mgronlun
parents:
57360
diff
changeset
|
68 |
void JfrStackTraceRepository::destroy() { |
00860d9caf4d
New metadata system for oldobjects built on top of simplified tagging model. Caching and serialization improvements. Flushpoint checkpoint with chunkheader contents.
mgronlun
parents:
57360
diff
changeset
|
69 |
assert(_instance != NULL, "invarinat"); |
00860d9caf4d
New metadata system for oldobjects built on top of simplified tagging model. Caching and serialization improvements. Flushpoint checkpoint with chunkheader contents.
mgronlun
parents:
57360
diff
changeset
|
70 |
delete _instance; |
00860d9caf4d
New metadata system for oldobjects built on top of simplified tagging model. Caching and serialization improvements. Flushpoint checkpoint with chunkheader contents.
mgronlun
parents:
57360
diff
changeset
|
71 |
_instance = NULL; |
50113 | 72 |
} |
73 |
||
57872 | 74 |
static traceid last_id = 0; |
75 |
||
76 |
bool JfrStackTraceRepository::is_modified() const { |
|
77 |
return last_id != _next_id; |
|
78 |
} |
|
79 |
||
50113 | 80 |
size_t JfrStackTraceRepository::write_impl(JfrChunkWriter& sw, bool clear) { |
54623
1126f0607c70
8222811: Consolidate MutexLockerEx and MutexLocker
coleenp
parents:
54603
diff
changeset
|
81 |
MutexLocker lock(JfrStacktrace_lock, Mutex::_no_safepoint_check_flag); |
50113 | 82 |
assert(_entries > 0, "invariant"); |
83 |
int count = 0; |
|
84 |
for (u4 i = 0; i < TABLE_SIZE; ++i) { |
|
57870
00860d9caf4d
New metadata system for oldobjects built on top of simplified tagging model. Caching and serialization improvements. Flushpoint checkpoint with chunkheader contents.
mgronlun
parents:
57360
diff
changeset
|
85 |
JfrStackTrace* stacktrace = _table[i]; |
50113 | 86 |
while (stacktrace != NULL) { |
57870
00860d9caf4d
New metadata system for oldobjects built on top of simplified tagging model. Caching and serialization improvements. Flushpoint checkpoint with chunkheader contents.
mgronlun
parents:
57360
diff
changeset
|
87 |
JfrStackTrace* next = const_cast<JfrStackTrace*>(stacktrace->next()); |
50113 | 88 |
if (stacktrace->should_write()) { |
89 |
stacktrace->write(sw); |
|
90 |
++count; |
|
91 |
} |
|
92 |
if (clear) { |
|
93 |
delete stacktrace; |
|
94 |
} |
|
95 |
stacktrace = next; |
|
96 |
} |
|
97 |
} |
|
98 |
if (clear) { |
|
99 |
memset(_table, 0, sizeof(_table)); |
|
100 |
_entries = 0; |
|
101 |
} |
|
57872 | 102 |
last_id = _next_id; |
50113 | 103 |
return count; |
104 |
} |
|
105 |
||
106 |
size_t JfrStackTraceRepository::write(JfrChunkWriter& sw, bool clear) { |
|
107 |
return _entries > 0 ? write_impl(sw, clear) : 0; |
|
108 |
} |
|
109 |
||
110 |
traceid JfrStackTraceRepository::write(JfrCheckpointWriter& writer, traceid id, unsigned int hash) { |
|
111 |
assert(JfrStacktrace_lock->owned_by_self(), "invariant"); |
|
57870
00860d9caf4d
New metadata system for oldobjects built on top of simplified tagging model. Caching and serialization improvements. Flushpoint checkpoint with chunkheader contents.
mgronlun
parents:
57360
diff
changeset
|
112 |
const JfrStackTrace* const trace = lookup(hash, id); |
50113 | 113 |
assert(trace != NULL, "invariant"); |
114 |
assert(trace->hash() == hash, "invariant"); |
|
115 |
assert(trace->id() == id, "invariant"); |
|
116 |
trace->write(writer); |
|
117 |
return id; |
|
118 |
} |
|
119 |
||
57870
00860d9caf4d
New metadata system for oldobjects built on top of simplified tagging model. Caching and serialization improvements. Flushpoint checkpoint with chunkheader contents.
mgronlun
parents:
57360
diff
changeset
|
120 |
void JfrStackTraceRepository::write_metadata(JfrCheckpointWriter& writer) { |
00860d9caf4d
New metadata system for oldobjects built on top of simplified tagging model. Caching and serialization improvements. Flushpoint checkpoint with chunkheader contents.
mgronlun
parents:
57360
diff
changeset
|
121 |
JfrFrameType fct; |
00860d9caf4d
New metadata system for oldobjects built on top of simplified tagging model. Caching and serialization improvements. Flushpoint checkpoint with chunkheader contents.
mgronlun
parents:
57360
diff
changeset
|
122 |
writer.write_type(TYPE_FRAMETYPE); |
00860d9caf4d
New metadata system for oldobjects built on top of simplified tagging model. Caching and serialization improvements. Flushpoint checkpoint with chunkheader contents.
mgronlun
parents:
57360
diff
changeset
|
123 |
fct.serialize(writer); |
50113 | 124 |
} |
125 |
||
57870
00860d9caf4d
New metadata system for oldobjects built on top of simplified tagging model. Caching and serialization improvements. Flushpoint checkpoint with chunkheader contents.
mgronlun
parents:
57360
diff
changeset
|
126 |
size_t JfrStackTraceRepository::clear() { |
00860d9caf4d
New metadata system for oldobjects built on top of simplified tagging model. Caching and serialization improvements. Flushpoint checkpoint with chunkheader contents.
mgronlun
parents:
57360
diff
changeset
|
127 |
MutexLocker lock(JfrStacktrace_lock, Mutex::_no_safepoint_check_flag); |
00860d9caf4d
New metadata system for oldobjects built on top of simplified tagging model. Caching and serialization improvements. Flushpoint checkpoint with chunkheader contents.
mgronlun
parents:
57360
diff
changeset
|
128 |
if (_entries == 0) { |
00860d9caf4d
New metadata system for oldobjects built on top of simplified tagging model. Caching and serialization improvements. Flushpoint checkpoint with chunkheader contents.
mgronlun
parents:
57360
diff
changeset
|
129 |
return 0; |
50113 | 130 |
} |
57870
00860d9caf4d
New metadata system for oldobjects built on top of simplified tagging model. Caching and serialization improvements. Flushpoint checkpoint with chunkheader contents.
mgronlun
parents:
57360
diff
changeset
|
131 |
for (u4 i = 0; i < TABLE_SIZE; ++i) { |
00860d9caf4d
New metadata system for oldobjects built on top of simplified tagging model. Caching and serialization improvements. Flushpoint checkpoint with chunkheader contents.
mgronlun
parents:
57360
diff
changeset
|
132 |
JfrStackTrace* stacktrace = _table[i]; |
00860d9caf4d
New metadata system for oldobjects built on top of simplified tagging model. Caching and serialization improvements. Flushpoint checkpoint with chunkheader contents.
mgronlun
parents:
57360
diff
changeset
|
133 |
while (stacktrace != NULL) { |
00860d9caf4d
New metadata system for oldobjects built on top of simplified tagging model. Caching and serialization improvements. Flushpoint checkpoint with chunkheader contents.
mgronlun
parents:
57360
diff
changeset
|
134 |
JfrStackTrace* next = const_cast<JfrStackTrace*>(stacktrace->next()); |
00860d9caf4d
New metadata system for oldobjects built on top of simplified tagging model. Caching and serialization improvements. Flushpoint checkpoint with chunkheader contents.
mgronlun
parents:
57360
diff
changeset
|
135 |
delete stacktrace; |
00860d9caf4d
New metadata system for oldobjects built on top of simplified tagging model. Caching and serialization improvements. Flushpoint checkpoint with chunkheader contents.
mgronlun
parents:
57360
diff
changeset
|
136 |
stacktrace = next; |
50113 | 137 |
} |
138 |
} |
|
57870
00860d9caf4d
New metadata system for oldobjects built on top of simplified tagging model. Caching and serialization improvements. Flushpoint checkpoint with chunkheader contents.
mgronlun
parents:
57360
diff
changeset
|
139 |
memset(_table, 0, sizeof(_table)); |
00860d9caf4d
New metadata system for oldobjects built on top of simplified tagging model. Caching and serialization improvements. Flushpoint checkpoint with chunkheader contents.
mgronlun
parents:
57360
diff
changeset
|
140 |
const size_t processed = _entries; |
00860d9caf4d
New metadata system for oldobjects built on top of simplified tagging model. Caching and serialization improvements. Flushpoint checkpoint with chunkheader contents.
mgronlun
parents:
57360
diff
changeset
|
141 |
_entries = 0; |
00860d9caf4d
New metadata system for oldobjects built on top of simplified tagging model. Caching and serialization improvements. Flushpoint checkpoint with chunkheader contents.
mgronlun
parents:
57360
diff
changeset
|
142 |
return processed; |
50113 | 143 |
} |
144 |
||
57870
00860d9caf4d
New metadata system for oldobjects built on top of simplified tagging model. Caching and serialization improvements. Flushpoint checkpoint with chunkheader contents.
mgronlun
parents:
57360
diff
changeset
|
145 |
traceid JfrStackTraceRepository::record(Thread* thread, int skip /* 0 */) { |
00860d9caf4d
New metadata system for oldobjects built on top of simplified tagging model. Caching and serialization improvements. Flushpoint checkpoint with chunkheader contents.
mgronlun
parents:
57360
diff
changeset
|
146 |
assert(thread == Thread::current(), "invariant"); |
00860d9caf4d
New metadata system for oldobjects built on top of simplified tagging model. Caching and serialization improvements. Flushpoint checkpoint with chunkheader contents.
mgronlun
parents:
57360
diff
changeset
|
147 |
JfrThreadLocal* const tl = thread->jfr_thread_local(); |
00860d9caf4d
New metadata system for oldobjects built on top of simplified tagging model. Caching and serialization improvements. Flushpoint checkpoint with chunkheader contents.
mgronlun
parents:
57360
diff
changeset
|
148 |
assert(tl != NULL, "invariant"); |
00860d9caf4d
New metadata system for oldobjects built on top of simplified tagging model. Caching and serialization improvements. Flushpoint checkpoint with chunkheader contents.
mgronlun
parents:
57360
diff
changeset
|
149 |
if (tl->has_cached_stack_trace()) { |
00860d9caf4d
New metadata system for oldobjects built on top of simplified tagging model. Caching and serialization improvements. Flushpoint checkpoint with chunkheader contents.
mgronlun
parents:
57360
diff
changeset
|
150 |
return tl->cached_stack_trace_id(); |
50113 | 151 |
} |
57870
00860d9caf4d
New metadata system for oldobjects built on top of simplified tagging model. Caching and serialization improvements. Flushpoint checkpoint with chunkheader contents.
mgronlun
parents:
57360
diff
changeset
|
152 |
if (!thread->is_Java_thread() || thread->is_hidden_from_external_view() || tl->is_excluded()) { |
00860d9caf4d
New metadata system for oldobjects built on top of simplified tagging model. Caching and serialization improvements. Flushpoint checkpoint with chunkheader contents.
mgronlun
parents:
57360
diff
changeset
|
153 |
return 0; |
00860d9caf4d
New metadata system for oldobjects built on top of simplified tagging model. Caching and serialization improvements. Flushpoint checkpoint with chunkheader contents.
mgronlun
parents:
57360
diff
changeset
|
154 |
} |
00860d9caf4d
New metadata system for oldobjects built on top of simplified tagging model. Caching and serialization improvements. Flushpoint checkpoint with chunkheader contents.
mgronlun
parents:
57360
diff
changeset
|
155 |
JfrStackFrame* frames = tl->stackframes(); |
00860d9caf4d
New metadata system for oldobjects built on top of simplified tagging model. Caching and serialization improvements. Flushpoint checkpoint with chunkheader contents.
mgronlun
parents:
57360
diff
changeset
|
156 |
if (frames == NULL) { |
00860d9caf4d
New metadata system for oldobjects built on top of simplified tagging model. Caching and serialization improvements. Flushpoint checkpoint with chunkheader contents.
mgronlun
parents:
57360
diff
changeset
|
157 |
// pending oom |
00860d9caf4d
New metadata system for oldobjects built on top of simplified tagging model. Caching and serialization improvements. Flushpoint checkpoint with chunkheader contents.
mgronlun
parents:
57360
diff
changeset
|
158 |
return 0; |
00860d9caf4d
New metadata system for oldobjects built on top of simplified tagging model. Caching and serialization improvements. Flushpoint checkpoint with chunkheader contents.
mgronlun
parents:
57360
diff
changeset
|
159 |
} |
00860d9caf4d
New metadata system for oldobjects built on top of simplified tagging model. Caching and serialization improvements. Flushpoint checkpoint with chunkheader contents.
mgronlun
parents:
57360
diff
changeset
|
160 |
assert(frames != NULL, "invariant"); |
00860d9caf4d
New metadata system for oldobjects built on top of simplified tagging model. Caching and serialization improvements. Flushpoint checkpoint with chunkheader contents.
mgronlun
parents:
57360
diff
changeset
|
161 |
assert(tl->stackframes() == frames, "invariant"); |
57902 | 162 |
return instance().record_for((JavaThread*)thread, skip, frames, tl->stackdepth()); |
50113 | 163 |
} |
164 |
||
57870
00860d9caf4d
New metadata system for oldobjects built on top of simplified tagging model. Caching and serialization improvements. Flushpoint checkpoint with chunkheader contents.
mgronlun
parents:
57360
diff
changeset
|
165 |
traceid JfrStackTraceRepository::record_for(JavaThread* thread, int skip, JfrStackFrame *frames, u4 max_frames) { |
00860d9caf4d
New metadata system for oldobjects built on top of simplified tagging model. Caching and serialization improvements. Flushpoint checkpoint with chunkheader contents.
mgronlun
parents:
57360
diff
changeset
|
166 |
JfrStackTrace stacktrace(frames, max_frames); |
00860d9caf4d
New metadata system for oldobjects built on top of simplified tagging model. Caching and serialization improvements. Flushpoint checkpoint with chunkheader contents.
mgronlun
parents:
57360
diff
changeset
|
167 |
return stacktrace.record_safe(thread, skip) ? add(stacktrace) : 0; |
50113 | 168 |
} |
169 |
||
57870
00860d9caf4d
New metadata system for oldobjects built on top of simplified tagging model. Caching and serialization improvements. Flushpoint checkpoint with chunkheader contents.
mgronlun
parents:
57360
diff
changeset
|
170 |
traceid JfrStackTraceRepository::add(const JfrStackTrace& stacktrace) { |
00860d9caf4d
New metadata system for oldobjects built on top of simplified tagging model. Caching and serialization improvements. Flushpoint checkpoint with chunkheader contents.
mgronlun
parents:
57360
diff
changeset
|
171 |
traceid tid = instance().add_trace(stacktrace); |
00860d9caf4d
New metadata system for oldobjects built on top of simplified tagging model. Caching and serialization improvements. Flushpoint checkpoint with chunkheader contents.
mgronlun
parents:
57360
diff
changeset
|
172 |
if (tid == 0) { |
00860d9caf4d
New metadata system for oldobjects built on top of simplified tagging model. Caching and serialization improvements. Flushpoint checkpoint with chunkheader contents.
mgronlun
parents:
57360
diff
changeset
|
173 |
stacktrace.resolve_linenos(); |
00860d9caf4d
New metadata system for oldobjects built on top of simplified tagging model. Caching and serialization improvements. Flushpoint checkpoint with chunkheader contents.
mgronlun
parents:
57360
diff
changeset
|
174 |
tid = instance().add_trace(stacktrace); |
00860d9caf4d
New metadata system for oldobjects built on top of simplified tagging model. Caching and serialization improvements. Flushpoint checkpoint with chunkheader contents.
mgronlun
parents:
57360
diff
changeset
|
175 |
} |
00860d9caf4d
New metadata system for oldobjects built on top of simplified tagging model. Caching and serialization improvements. Flushpoint checkpoint with chunkheader contents.
mgronlun
parents:
57360
diff
changeset
|
176 |
assert(tid != 0, "invariant"); |
00860d9caf4d
New metadata system for oldobjects built on top of simplified tagging model. Caching and serialization improvements. Flushpoint checkpoint with chunkheader contents.
mgronlun
parents:
57360
diff
changeset
|
177 |
return tid; |
50113 | 178 |
} |
179 |
||
57934 | 180 |
void JfrStackTraceRepository::record_and_cache(JavaThread* thread, int skip /* 0 */) { |
181 |
assert(thread != NULL, "invariant"); |
|
57902 | 182 |
JfrThreadLocal* const tl = thread->jfr_thread_local(); |
183 |
assert(tl != NULL, "invariant"); |
|
57934 | 184 |
assert(!tl->has_cached_stack_trace(), "invariant"); |
57902 | 185 |
JfrStackTrace stacktrace(tl->stackframes(), tl->stackdepth()); |
186 |
stacktrace.record_safe(thread, skip); |
|
57983
a57907813a83
old object sample blob:ification and serialization support
mgronlun
parents:
57934
diff
changeset
|
187 |
const unsigned int hash = stacktrace.hash(); |
a57907813a83
old object sample blob:ification and serialization support
mgronlun
parents:
57934
diff
changeset
|
188 |
if (hash != 0) { |
a57907813a83
old object sample blob:ification and serialization support
mgronlun
parents:
57934
diff
changeset
|
189 |
tl->set_cached_stack_trace_id(instance().add(stacktrace), hash); |
a57907813a83
old object sample blob:ification and serialization support
mgronlun
parents:
57934
diff
changeset
|
190 |
} |
57902 | 191 |
} |
192 |
||
57870
00860d9caf4d
New metadata system for oldobjects built on top of simplified tagging model. Caching and serialization improvements. Flushpoint checkpoint with chunkheader contents.
mgronlun
parents:
57360
diff
changeset
|
193 |
traceid JfrStackTraceRepository::add_trace(const JfrStackTrace& stacktrace) { |
00860d9caf4d
New metadata system for oldobjects built on top of simplified tagging model. Caching and serialization improvements. Flushpoint checkpoint with chunkheader contents.
mgronlun
parents:
57360
diff
changeset
|
194 |
MutexLocker lock(JfrStacktrace_lock, Mutex::_no_safepoint_check_flag); |
00860d9caf4d
New metadata system for oldobjects built on top of simplified tagging model. Caching and serialization improvements. Flushpoint checkpoint with chunkheader contents.
mgronlun
parents:
57360
diff
changeset
|
195 |
const size_t index = stacktrace._hash % TABLE_SIZE; |
00860d9caf4d
New metadata system for oldobjects built on top of simplified tagging model. Caching and serialization improvements. Flushpoint checkpoint with chunkheader contents.
mgronlun
parents:
57360
diff
changeset
|
196 |
const JfrStackTrace* table_entry = _table[index]; |
50113 | 197 |
|
57870
00860d9caf4d
New metadata system for oldobjects built on top of simplified tagging model. Caching and serialization improvements. Flushpoint checkpoint with chunkheader contents.
mgronlun
parents:
57360
diff
changeset
|
198 |
while (table_entry != NULL) { |
00860d9caf4d
New metadata system for oldobjects built on top of simplified tagging model. Caching and serialization improvements. Flushpoint checkpoint with chunkheader contents.
mgronlun
parents:
57360
diff
changeset
|
199 |
if (table_entry->equals(stacktrace)) { |
00860d9caf4d
New metadata system for oldobjects built on top of simplified tagging model. Caching and serialization improvements. Flushpoint checkpoint with chunkheader contents.
mgronlun
parents:
57360
diff
changeset
|
200 |
return table_entry->id(); |
00860d9caf4d
New metadata system for oldobjects built on top of simplified tagging model. Caching and serialization improvements. Flushpoint checkpoint with chunkheader contents.
mgronlun
parents:
57360
diff
changeset
|
201 |
} |
00860d9caf4d
New metadata system for oldobjects built on top of simplified tagging model. Caching and serialization improvements. Flushpoint checkpoint with chunkheader contents.
mgronlun
parents:
57360
diff
changeset
|
202 |
table_entry = table_entry->next(); |
00860d9caf4d
New metadata system for oldobjects built on top of simplified tagging model. Caching and serialization improvements. Flushpoint checkpoint with chunkheader contents.
mgronlun
parents:
57360
diff
changeset
|
203 |
} |
50113 | 204 |
|
57870
00860d9caf4d
New metadata system for oldobjects built on top of simplified tagging model. Caching and serialization improvements. Flushpoint checkpoint with chunkheader contents.
mgronlun
parents:
57360
diff
changeset
|
205 |
if (!stacktrace.have_lineno()) { |
00860d9caf4d
New metadata system for oldobjects built on top of simplified tagging model. Caching and serialization improvements. Flushpoint checkpoint with chunkheader contents.
mgronlun
parents:
57360
diff
changeset
|
206 |
return 0; |
00860d9caf4d
New metadata system for oldobjects built on top of simplified tagging model. Caching and serialization improvements. Flushpoint checkpoint with chunkheader contents.
mgronlun
parents:
57360
diff
changeset
|
207 |
} |
00860d9caf4d
New metadata system for oldobjects built on top of simplified tagging model. Caching and serialization improvements. Flushpoint checkpoint with chunkheader contents.
mgronlun
parents:
57360
diff
changeset
|
208 |
|
00860d9caf4d
New metadata system for oldobjects built on top of simplified tagging model. Caching and serialization improvements. Flushpoint checkpoint with chunkheader contents.
mgronlun
parents:
57360
diff
changeset
|
209 |
traceid id = ++_next_id; |
00860d9caf4d
New metadata system for oldobjects built on top of simplified tagging model. Caching and serialization improvements. Flushpoint checkpoint with chunkheader contents.
mgronlun
parents:
57360
diff
changeset
|
210 |
_table[index] = new JfrStackTrace(id, stacktrace, _table[index]); |
00860d9caf4d
New metadata system for oldobjects built on top of simplified tagging model. Caching and serialization improvements. Flushpoint checkpoint with chunkheader contents.
mgronlun
parents:
57360
diff
changeset
|
211 |
++_entries; |
00860d9caf4d
New metadata system for oldobjects built on top of simplified tagging model. Caching and serialization improvements. Flushpoint checkpoint with chunkheader contents.
mgronlun
parents:
57360
diff
changeset
|
212 |
return id; |
50113 | 213 |
} |
214 |
||
215 |
// invariant is that the entry to be resolved actually exists in the table |
|
57870
00860d9caf4d
New metadata system for oldobjects built on top of simplified tagging model. Caching and serialization improvements. Flushpoint checkpoint with chunkheader contents.
mgronlun
parents:
57360
diff
changeset
|
216 |
const JfrStackTrace* JfrStackTraceRepository::lookup(unsigned int hash, traceid id) const { |
50113 | 217 |
const size_t index = (hash % TABLE_SIZE); |
57870
00860d9caf4d
New metadata system for oldobjects built on top of simplified tagging model. Caching and serialization improvements. Flushpoint checkpoint with chunkheader contents.
mgronlun
parents:
57360
diff
changeset
|
218 |
const JfrStackTrace* trace = _table[index]; |
50113 | 219 |
while (trace != NULL && trace->id() != id) { |
220 |
trace = trace->next(); |
|
221 |
} |
|
222 |
assert(trace != NULL, "invariant"); |
|
223 |
assert(trace->hash() == hash, "invariant"); |
|
224 |
assert(trace->id() == id, "invariant"); |
|
225 |
return trace; |
|
226 |
} |