author | chegar |
Thu, 17 Oct 2019 20:54:25 +0100 | |
branch | datagramsocketimpl-branch |
changeset 58679 | 9c3209ff7550 |
parent 58678 | 9cf78a70fa4f |
parent 55740 | b3ff56f955c8 |
permissions | -rw-r--r-- |
50113 | 1 |
/* |
54669
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
52141
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 |
||
25 |
#include "precompiled.hpp" |
|
26 |
#include "aot/aotLoader.hpp" |
|
51959
db0c3952de52
8209645: Split ClassLoaderData and ClassLoaderDataGraph into separate files
coleenp
parents:
50297
diff
changeset
|
27 |
#include "classfile/classLoaderDataGraph.hpp" |
50113 | 28 |
#include "classfile/stringTable.hpp" |
29 |
#include "classfile/systemDictionary.hpp" |
|
30 |
#include "gc/shared/strongRootsScope.hpp" |
|
55571
49102ba8cf14
8214542: JFR: Old Object Sample event slow on a deep heap in debug builds
mgronlun
parents:
55564
diff
changeset
|
31 |
#include "jfr/leakprofiler/chains/bfsClosure.hpp" |
49102ba8cf14
8214542: JFR: Old Object Sample event slow on a deep heap in debug builds
mgronlun
parents:
55564
diff
changeset
|
32 |
#include "jfr/leakprofiler/chains/dfsClosure.hpp" |
50113 | 33 |
#include "jfr/leakprofiler/chains/edgeQueue.hpp" |
34 |
#include "jfr/leakprofiler/chains/rootSetClosure.hpp" |
|
35 |
#include "jfr/leakprofiler/utilities/unifiedOop.hpp" |
|
36 |
#include "memory/universe.hpp" |
|
37 |
#include "oops/access.inline.hpp" |
|
55571
49102ba8cf14
8214542: JFR: Old Object Sample event slow on a deep heap in debug builds
mgronlun
parents:
55564
diff
changeset
|
38 |
#include "oops/oop.inline.hpp" |
50113 | 39 |
#include "prims/jvmtiExport.hpp" |
40 |
#include "runtime/jniHandles.inline.hpp" |
|
41 |
#include "runtime/synchronizer.hpp" |
|
42 |
#include "runtime/thread.hpp" |
|
43 |
#include "services/management.hpp" |
|
44 |
#include "utilities/align.hpp" |
|
45 |
||
55571
49102ba8cf14
8214542: JFR: Old Object Sample event slow on a deep heap in debug builds
mgronlun
parents:
55564
diff
changeset
|
46 |
template <typename Delegate> |
49102ba8cf14
8214542: JFR: Old Object Sample event slow on a deep heap in debug builds
mgronlun
parents:
55564
diff
changeset
|
47 |
RootSetClosure<Delegate>::RootSetClosure(Delegate* delegate) : _delegate(delegate) {} |
50113 | 48 |
|
55571
49102ba8cf14
8214542: JFR: Old Object Sample event slow on a deep heap in debug builds
mgronlun
parents:
55564
diff
changeset
|
49 |
template <typename Delegate> |
49102ba8cf14
8214542: JFR: Old Object Sample event slow on a deep heap in debug builds
mgronlun
parents:
55564
diff
changeset
|
50 |
void RootSetClosure<Delegate>::do_oop(oop* ref) { |
50113 | 51 |
assert(ref != NULL, "invariant"); |
52 |
// We discard unaligned root references because |
|
53 |
// our reference tagging scheme will use |
|
54 |
// the lowest bit in a represented reference |
|
55 |
// to indicate the reference is narrow. |
|
56 |
// It is mainly roots delivered via nmethods::do_oops() |
|
57 |
// that come in unaligned. It should be ok to duck these |
|
58 |
// since they are supposedly weak. |
|
59 |
if (!is_aligned(ref, HeapWordSize)) { |
|
60 |
return; |
|
61 |
} |
|
62 |
||
63 |
assert(is_aligned(ref, HeapWordSize), "invariant"); |
|
55571
49102ba8cf14
8214542: JFR: Old Object Sample event slow on a deep heap in debug builds
mgronlun
parents:
55564
diff
changeset
|
64 |
if (*ref != NULL) { |
49102ba8cf14
8214542: JFR: Old Object Sample event slow on a deep heap in debug builds
mgronlun
parents:
55564
diff
changeset
|
65 |
_delegate->do_root(ref); |
50113 | 66 |
} |
67 |
} |
|
68 |
||
55571
49102ba8cf14
8214542: JFR: Old Object Sample event slow on a deep heap in debug builds
mgronlun
parents:
55564
diff
changeset
|
69 |
template <typename Delegate> |
49102ba8cf14
8214542: JFR: Old Object Sample event slow on a deep heap in debug builds
mgronlun
parents:
55564
diff
changeset
|
70 |
void RootSetClosure<Delegate>::do_oop(narrowOop* ref) { |
50113 | 71 |
assert(ref != NULL, "invariant"); |
72 |
assert(is_aligned(ref, sizeof(narrowOop)), "invariant"); |
|
73 |
const oop pointee = RawAccess<>::oop_load(ref); |
|
74 |
if (pointee != NULL) { |
|
55571
49102ba8cf14
8214542: JFR: Old Object Sample event slow on a deep heap in debug builds
mgronlun
parents:
55564
diff
changeset
|
75 |
_delegate->do_root(UnifiedOop::encode(ref)); |
50113 | 76 |
} |
77 |
} |
|
78 |
||
55571
49102ba8cf14
8214542: JFR: Old Object Sample event slow on a deep heap in debug builds
mgronlun
parents:
55564
diff
changeset
|
79 |
class RootSetClosureMarkScope : public MarkScope {}; |
49102ba8cf14
8214542: JFR: Old Object Sample event slow on a deep heap in debug builds
mgronlun
parents:
55564
diff
changeset
|
80 |
|
49102ba8cf14
8214542: JFR: Old Object Sample event slow on a deep heap in debug builds
mgronlun
parents:
55564
diff
changeset
|
81 |
template <typename Delegate> |
49102ba8cf14
8214542: JFR: Old Object Sample event slow on a deep heap in debug builds
mgronlun
parents:
55564
diff
changeset
|
82 |
void RootSetClosure<Delegate>::process() { |
49102ba8cf14
8214542: JFR: Old Object Sample event slow on a deep heap in debug builds
mgronlun
parents:
55564
diff
changeset
|
83 |
RootSetClosureMarkScope mark_scope; |
49102ba8cf14
8214542: JFR: Old Object Sample event slow on a deep heap in debug builds
mgronlun
parents:
55564
diff
changeset
|
84 |
CLDToOopClosure cldt_closure(this, ClassLoaderData::_claim_none); |
49102ba8cf14
8214542: JFR: Old Object Sample event slow on a deep heap in debug builds
mgronlun
parents:
55564
diff
changeset
|
85 |
ClassLoaderDataGraph::always_strong_cld_do(&cldt_closure); |
49102ba8cf14
8214542: JFR: Old Object Sample event slow on a deep heap in debug builds
mgronlun
parents:
55564
diff
changeset
|
86 |
CodeBlobToOopClosure blobs(this, false); |
49102ba8cf14
8214542: JFR: Old Object Sample event slow on a deep heap in debug builds
mgronlun
parents:
55564
diff
changeset
|
87 |
Threads::oops_do(this, &blobs); |
49102ba8cf14
8214542: JFR: Old Object Sample event slow on a deep heap in debug builds
mgronlun
parents:
55564
diff
changeset
|
88 |
ObjectSynchronizer::oops_do(this); |
49102ba8cf14
8214542: JFR: Old Object Sample event slow on a deep heap in debug builds
mgronlun
parents:
55564
diff
changeset
|
89 |
Universe::oops_do(this); |
49102ba8cf14
8214542: JFR: Old Object Sample event slow on a deep heap in debug builds
mgronlun
parents:
55564
diff
changeset
|
90 |
JNIHandles::oops_do(this); |
49102ba8cf14
8214542: JFR: Old Object Sample event slow on a deep heap in debug builds
mgronlun
parents:
55564
diff
changeset
|
91 |
JvmtiExport::oops_do(this); |
49102ba8cf14
8214542: JFR: Old Object Sample event slow on a deep heap in debug builds
mgronlun
parents:
55564
diff
changeset
|
92 |
SystemDictionary::oops_do(this); |
49102ba8cf14
8214542: JFR: Old Object Sample event slow on a deep heap in debug builds
mgronlun
parents:
55564
diff
changeset
|
93 |
Management::oops_do(this); |
49102ba8cf14
8214542: JFR: Old Object Sample event slow on a deep heap in debug builds
mgronlun
parents:
55564
diff
changeset
|
94 |
StringTable::oops_do(this); |
49102ba8cf14
8214542: JFR: Old Object Sample event slow on a deep heap in debug builds
mgronlun
parents:
55564
diff
changeset
|
95 |
AOTLoader::oops_do(this); |
50113 | 96 |
} |
97 |
||
55571
49102ba8cf14
8214542: JFR: Old Object Sample event slow on a deep heap in debug builds
mgronlun
parents:
55564
diff
changeset
|
98 |
template class RootSetClosure<BFSClosure>; |
49102ba8cf14
8214542: JFR: Old Object Sample event slow on a deep heap in debug builds
mgronlun
parents:
55564
diff
changeset
|
99 |
template class RootSetClosure<DFSClosure>; |