author | chegar |
Thu, 17 Oct 2019 20:54:25 +0100 | |
branch | datagramsocketimpl-branch |
changeset 58679 | 9c3209ff7550 |
parent 58678 | 9cf78a70fa4f |
parent 58132 | caa25ab47aca |
permissions | -rw-r--r-- |
50113 | 1 |
/* |
53244
9807daeb47c4
8216167: Update include guards to reflect correct directories
coleenp
parents:
50113
diff
changeset
|
2 |
* Copyright (c) 2014, 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 |
||
53244
9807daeb47c4
8216167: Update include guards to reflect correct directories
coleenp
parents:
50113
diff
changeset
|
25 |
#ifndef SHARE_JFR_LEAKPROFILER_CHAINS_EDGESTORE_HPP |
9807daeb47c4
8216167: Update include guards to reflect correct directories
coleenp
parents:
50113
diff
changeset
|
26 |
#define SHARE_JFR_LEAKPROFILER_CHAINS_EDGESTORE_HPP |
50113 | 27 |
|
55571
49102ba8cf14
8214542: JFR: Old Object Sample event slow on a deep heap in debug builds
mgronlun
parents:
53244
diff
changeset
|
28 |
#include "jfr/leakprofiler/chains/edge.hpp" |
50113 | 29 |
#include "jfr/utilities/jfrHashtable.hpp" |
30 |
#include "memory/allocation.hpp" |
|
31 |
||
32 |
typedef u8 traceid; |
|
33 |
||
55571
49102ba8cf14
8214542: JFR: Old Object Sample event slow on a deep heap in debug builds
mgronlun
parents:
53244
diff
changeset
|
34 |
class StoredEdge : public Edge { |
50113 | 35 |
private: |
55571
49102ba8cf14
8214542: JFR: Old Object Sample event slow on a deep heap in debug builds
mgronlun
parents:
53244
diff
changeset
|
36 |
mutable traceid _gc_root_id; |
49102ba8cf14
8214542: JFR: Old Object Sample event slow on a deep heap in debug builds
mgronlun
parents:
53244
diff
changeset
|
37 |
size_t _skip_length; |
50113 | 38 |
|
39 |
public: |
|
55571
49102ba8cf14
8214542: JFR: Old Object Sample event slow on a deep heap in debug builds
mgronlun
parents:
53244
diff
changeset
|
40 |
StoredEdge(); |
49102ba8cf14
8214542: JFR: Old Object Sample event slow on a deep heap in debug builds
mgronlun
parents:
53244
diff
changeset
|
41 |
StoredEdge(const Edge* parent, const oop* reference); |
49102ba8cf14
8214542: JFR: Old Object Sample event slow on a deep heap in debug builds
mgronlun
parents:
53244
diff
changeset
|
42 |
StoredEdge(const Edge& edge); |
49102ba8cf14
8214542: JFR: Old Object Sample event slow on a deep heap in debug builds
mgronlun
parents:
53244
diff
changeset
|
43 |
StoredEdge(const StoredEdge& edge); |
49102ba8cf14
8214542: JFR: Old Object Sample event slow on a deep heap in debug builds
mgronlun
parents:
53244
diff
changeset
|
44 |
void operator=(const StoredEdge& edge); |
50113 | 45 |
|
55571
49102ba8cf14
8214542: JFR: Old Object Sample event slow on a deep heap in debug builds
mgronlun
parents:
53244
diff
changeset
|
46 |
traceid gc_root_id() const { return _gc_root_id; } |
49102ba8cf14
8214542: JFR: Old Object Sample event slow on a deep heap in debug builds
mgronlun
parents:
53244
diff
changeset
|
47 |
void set_gc_root_id(traceid root_id) const { _gc_root_id = root_id; } |
50113 | 48 |
|
55571
49102ba8cf14
8214542: JFR: Old Object Sample event slow on a deep heap in debug builds
mgronlun
parents:
53244
diff
changeset
|
49 |
bool is_skip_edge() const { return _skip_length != 0; } |
49102ba8cf14
8214542: JFR: Old Object Sample event slow on a deep heap in debug builds
mgronlun
parents:
53244
diff
changeset
|
50 |
size_t skip_length() const { return _skip_length; } |
49102ba8cf14
8214542: JFR: Old Object Sample event slow on a deep heap in debug builds
mgronlun
parents:
53244
diff
changeset
|
51 |
void set_skip_length(size_t length) { _skip_length = length; } |
50113 | 52 |
|
55571
49102ba8cf14
8214542: JFR: Old Object Sample event slow on a deep heap in debug builds
mgronlun
parents:
53244
diff
changeset
|
53 |
void set_parent(const Edge* edge) { this->_parent = edge; } |
50113 | 54 |
|
55571
49102ba8cf14
8214542: JFR: Old Object Sample event slow on a deep heap in debug builds
mgronlun
parents:
53244
diff
changeset
|
55 |
StoredEdge* parent() const { |
49102ba8cf14
8214542: JFR: Old Object Sample event slow on a deep heap in debug builds
mgronlun
parents:
53244
diff
changeset
|
56 |
return const_cast<StoredEdge*>(static_cast<const StoredEdge*>(Edge::parent())); |
50113 | 57 |
} |
58 |
}; |
|
59 |
||
60 |
class EdgeStore : public CHeapObj<mtTracing> { |
|
58132
caa25ab47aca
8225797: OldObjectSample event creates unexpected amount of checkpoint data
mgronlun
parents:
55571
diff
changeset
|
61 |
typedef HashTableHost<StoredEdge, traceid, JfrHashtableEntry, EdgeStore> EdgeHashTable; |
50113 | 62 |
typedef EdgeHashTable::HashEntry EdgeEntry; |
63 |
template <typename, |
|
64 |
typename, |
|
65 |
template<typename, typename> class, |
|
66 |
typename, |
|
67 |
size_t> |
|
68 |
friend class HashTableHost; |
|
55571
49102ba8cf14
8214542: JFR: Old Object Sample event slow on a deep heap in debug builds
mgronlun
parents:
53244
diff
changeset
|
69 |
friend class EventEmitter; |
49102ba8cf14
8214542: JFR: Old Object Sample event slow on a deep heap in debug builds
mgronlun
parents:
53244
diff
changeset
|
70 |
friend class ObjectSampleWriter; |
49102ba8cf14
8214542: JFR: Old Object Sample event slow on a deep heap in debug builds
mgronlun
parents:
53244
diff
changeset
|
71 |
friend class ObjectSampleCheckpoint; |
50113 | 72 |
private: |
73 |
static traceid _edge_id_counter; |
|
74 |
EdgeHashTable* _edges; |
|
75 |
||
76 |
// Hash table callbacks |
|
58132
caa25ab47aca
8225797: OldObjectSample event creates unexpected amount of checkpoint data
mgronlun
parents:
55571
diff
changeset
|
77 |
void on_link(EdgeEntry* entry); |
caa25ab47aca
8225797: OldObjectSample event creates unexpected amount of checkpoint data
mgronlun
parents:
55571
diff
changeset
|
78 |
bool on_equals(uintptr_t hash, const EdgeEntry* entry); |
caa25ab47aca
8225797: OldObjectSample event creates unexpected amount of checkpoint data
mgronlun
parents:
55571
diff
changeset
|
79 |
void on_unlink(EdgeEntry* entry); |
50113 | 80 |
|
55571
49102ba8cf14
8214542: JFR: Old Object Sample event slow on a deep heap in debug builds
mgronlun
parents:
53244
diff
changeset
|
81 |
StoredEdge* get(const oop* reference) const; |
49102ba8cf14
8214542: JFR: Old Object Sample event slow on a deep heap in debug builds
mgronlun
parents:
53244
diff
changeset
|
82 |
StoredEdge* put(const oop* reference); |
49102ba8cf14
8214542: JFR: Old Object Sample event slow on a deep heap in debug builds
mgronlun
parents:
53244
diff
changeset
|
83 |
traceid gc_root_id(const Edge* edge) const; |
49102ba8cf14
8214542: JFR: Old Object Sample event slow on a deep heap in debug builds
mgronlun
parents:
53244
diff
changeset
|
84 |
|
49102ba8cf14
8214542: JFR: Old Object Sample event slow on a deep heap in debug builds
mgronlun
parents:
53244
diff
changeset
|
85 |
bool put_edges(StoredEdge** previous, const Edge** current, size_t length); |
49102ba8cf14
8214542: JFR: Old Object Sample event slow on a deep heap in debug builds
mgronlun
parents:
53244
diff
changeset
|
86 |
bool put_skip_edge(StoredEdge** previous, const Edge** current, size_t distance_to_root); |
49102ba8cf14
8214542: JFR: Old Object Sample event slow on a deep heap in debug builds
mgronlun
parents:
53244
diff
changeset
|
87 |
void put_chain_epilogue(StoredEdge* leak_context_edge, const Edge* root) const; |
49102ba8cf14
8214542: JFR: Old Object Sample event slow on a deep heap in debug builds
mgronlun
parents:
53244
diff
changeset
|
88 |
|
49102ba8cf14
8214542: JFR: Old Object Sample event slow on a deep heap in debug builds
mgronlun
parents:
53244
diff
changeset
|
89 |
StoredEdge* associate_leak_context_with_candidate(const Edge* edge); |
49102ba8cf14
8214542: JFR: Old Object Sample event slow on a deep heap in debug builds
mgronlun
parents:
53244
diff
changeset
|
90 |
void store_gc_root_id_in_leak_context_edge(StoredEdge* leak_context_edge, const Edge* root) const; |
49102ba8cf14
8214542: JFR: Old Object Sample event slow on a deep heap in debug builds
mgronlun
parents:
53244
diff
changeset
|
91 |
StoredEdge* link_new_edge(StoredEdge** previous, const Edge** current); |
49102ba8cf14
8214542: JFR: Old Object Sample event slow on a deep heap in debug builds
mgronlun
parents:
53244
diff
changeset
|
92 |
void link_with_existing_chain(const StoredEdge* current_stored, StoredEdge** previous, size_t previous_length); |
49102ba8cf14
8214542: JFR: Old Object Sample event slow on a deep heap in debug builds
mgronlun
parents:
53244
diff
changeset
|
93 |
|
49102ba8cf14
8214542: JFR: Old Object Sample event slow on a deep heap in debug builds
mgronlun
parents:
53244
diff
changeset
|
94 |
template <typename T> |
49102ba8cf14
8214542: JFR: Old Object Sample event slow on a deep heap in debug builds
mgronlun
parents:
53244
diff
changeset
|
95 |
void iterate(T& functor) const { _edges->iterate_value<T>(functor); } |
49102ba8cf14
8214542: JFR: Old Object Sample event slow on a deep heap in debug builds
mgronlun
parents:
53244
diff
changeset
|
96 |
|
49102ba8cf14
8214542: JFR: Old Object Sample event slow on a deep heap in debug builds
mgronlun
parents:
53244
diff
changeset
|
97 |
DEBUG_ONLY(bool contains(const oop* reference) const;) |
50113 | 98 |
|
99 |
public: |
|
100 |
EdgeStore(); |
|
101 |
~EdgeStore(); |
|
102 |
||
103 |
bool is_empty() const; |
|
104 |
traceid get_id(const Edge* edge) const; |
|
55571
49102ba8cf14
8214542: JFR: Old Object Sample event slow on a deep heap in debug builds
mgronlun
parents:
53244
diff
changeset
|
105 |
void put_chain(const Edge* chain, size_t length); |
50113 | 106 |
}; |
107 |
||
53244
9807daeb47c4
8216167: Update include guards to reflect correct directories
coleenp
parents:
50113
diff
changeset
|
108 |
#endif // SHARE_JFR_LEAKPROFILER_CHAINS_EDGESTORE_HPP |