author | mgronlun |
Tue, 02 Jul 2019 14:31:43 +0200 | |
changeset 55564 | 7df7c1f71ccf |
parent 54669 | ad45b3802d4e |
child 55571 | 49102ba8cf14 |
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" |
|
31 |
#include "jfr/leakprofiler/chains/edgeQueue.hpp" |
|
32 |
#include "jfr/leakprofiler/chains/rootSetClosure.hpp" |
|
33 |
#include "jfr/leakprofiler/utilities/unifiedOop.hpp" |
|
34 |
#include "memory/universe.hpp" |
|
35 |
#include "oops/access.inline.hpp" |
|
36 |
#include "prims/jvmtiExport.hpp" |
|
37 |
#include "runtime/jniHandles.inline.hpp" |
|
38 |
#include "runtime/synchronizer.hpp" |
|
39 |
#include "runtime/thread.hpp" |
|
40 |
#include "services/management.hpp" |
|
41 |
#include "utilities/align.hpp" |
|
54669
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
52141
diff
changeset
|
42 |
#if INCLUDE_JVMCI |
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
52141
diff
changeset
|
43 |
#include "jvmci/jvmci.hpp" |
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
52141
diff
changeset
|
44 |
#endif |
50113 | 45 |
|
46 |
RootSetClosure::RootSetClosure(EdgeQueue* edge_queue) : |
|
47 |
_edge_queue(edge_queue) { |
|
48 |
} |
|
49 |
||
50 |
void RootSetClosure::do_oop(oop* ref) { |
|
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"); |
|
64 |
const oop pointee = *ref; |
|
65 |
if (pointee != NULL) { |
|
66 |
closure_impl(ref, pointee); |
|
67 |
} |
|
68 |
} |
|
69 |
||
70 |
void RootSetClosure::do_oop(narrowOop* ref) { |
|
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) { |
|
75 |
closure_impl(UnifiedOop::encode(ref), pointee); |
|
76 |
} |
|
77 |
} |
|
78 |
||
79 |
void RootSetClosure::closure_impl(const oop* reference, const oop pointee) { |
|
80 |
if (!_edge_queue->is_full()) { |
|
81 |
_edge_queue->add(NULL, reference); |
|
82 |
} |
|
83 |
} |
|
84 |
||
85 |
void RootSetClosure::add_to_queue(EdgeQueue* edge_queue) { |
|
86 |
RootSetClosure rs(edge_queue); |
|
87 |
process_roots(&rs); |
|
88 |
} |
|
89 |
||
90 |
class RootSetClosureMarkScope : public MarkScope { |
|
91 |
}; |
|
92 |
||
93 |
void RootSetClosure::process_roots(OopClosure* closure) { |
|
94 |
RootSetClosureMarkScope mark_scope; |
|
95 |
||
55564
7df7c1f71ccf
8225706: JFR RootResolver resets CLD claims with no restore
mgronlun
parents:
54669
diff
changeset
|
96 |
CLDToOopClosure cldt_closure(closure, ClassLoaderData::_claim_none); |
50113 | 97 |
ClassLoaderDataGraph::always_strong_cld_do(&cldt_closure); |
98 |
CodeBlobToOopClosure blobs(closure, false); |
|
99 |
Threads::oops_do(closure, &blobs); |
|
100 |
ObjectSynchronizer::oops_do(closure); |
|
101 |
Universe::oops_do(closure); |
|
102 |
JNIHandles::oops_do(closure); |
|
103 |
JvmtiExport::oops_do(closure); |
|
50297
580744d900c8
8202813: Move vm_weak processing from SystemDictionary to WeakProcessor
coleenp
parents:
50113
diff
changeset
|
104 |
SystemDictionary::oops_do(closure); |
50113 | 105 |
Management::oops_do(closure); |
106 |
StringTable::oops_do(closure); |
|
107 |
AOTLoader::oops_do(closure); |
|
54669
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
52141
diff
changeset
|
108 |
JVMCI_ONLY(JVMCI::oops_do(closure);) |
50113 | 109 |
} |