1 /*
2 * Copyright (c) 2014, 2023, 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 *
29
30 #include "classfile/classLoaderData.hpp"
31 #include "code/nmethod.hpp"
32 #include "oops/access.inline.hpp"
33 #include "oops/compressedOops.inline.hpp"
34 #include "oops/klass.hpp"
35 #include "oops/instanceKlass.inline.hpp"
36 #include "oops/instanceMirrorKlass.inline.hpp"
37 #include "oops/instanceClassLoaderKlass.inline.hpp"
38 #include "oops/instanceRefKlass.inline.hpp"
39 #include "oops/instanceStackChunkKlass.inline.hpp"
40 #include "oops/objArrayKlass.inline.hpp"
41 #include "oops/typeArrayKlass.inline.hpp"
42 #include "utilities/debug.hpp"
43
44 // Defaults to strong claiming.
45 inline MetadataVisitingOopIterateClosure::MetadataVisitingOopIterateClosure(ReferenceDiscoverer* rd) :
46 ClaimMetadataVisitingOopIterateClosure(ClassLoaderData::_claim_strong, rd) {}
47
48 inline void ClaimMetadataVisitingOopIterateClosure::do_cld(ClassLoaderData* cld) {
49 cld->oops_do(this, _claim);
50 }
51
52 inline void ClaimMetadataVisitingOopIterateClosure::do_klass(Klass* k) {
53 ClassLoaderData* cld = k->class_loader_data();
54 ClaimMetadataVisitingOopIterateClosure::do_cld(cld);
55 }
56
57 inline void ClaimMetadataVisitingOopIterateClosure::do_nmethod(nmethod* nm) {
58 nm->follow_nmethod(this);
59 }
60
61 inline void ClaimMetadataVisitingOopIterateClosure::do_method(Method* m) {
62 // Mark interpreted frames for class redefinition
63 m->record_gc_epoch();
64 }
65
66 // Dispatch table implementation for *Klass::oop_oop_iterate
67 //
68 // It allows for a single call to do a multi-dispatch to an optimized version
69 // of oop_oop_iterate that statically know all these types:
|
1 /*
2 * Copyright (c) 2014, 2024, 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 *
29
30 #include "classfile/classLoaderData.hpp"
31 #include "code/nmethod.hpp"
32 #include "oops/access.inline.hpp"
33 #include "oops/compressedOops.inline.hpp"
34 #include "oops/klass.hpp"
35 #include "oops/instanceKlass.inline.hpp"
36 #include "oops/instanceMirrorKlass.inline.hpp"
37 #include "oops/instanceClassLoaderKlass.inline.hpp"
38 #include "oops/instanceRefKlass.inline.hpp"
39 #include "oops/instanceStackChunkKlass.inline.hpp"
40 #include "oops/objArrayKlass.inline.hpp"
41 #include "oops/typeArrayKlass.inline.hpp"
42 #include "utilities/debug.hpp"
43
44 // Defaults to strong claiming.
45 inline MetadataVisitingOopIterateClosure::MetadataVisitingOopIterateClosure(ReferenceDiscoverer* rd) :
46 ClaimMetadataVisitingOopIterateClosure(ClassLoaderData::_claim_strong, rd) {}
47
48 inline void ClaimMetadataVisitingOopIterateClosure::do_cld(ClassLoaderData* cld) {
49 if (cld != nullptr) {
50 // Could be null during early VM bootstrap for archived heap objects whose
51 // class has not yet been loaded by CDS.
52 cld->oops_do(this, _claim);
53 }
54 }
55
56 inline void ClaimMetadataVisitingOopIterateClosure::do_klass(Klass* k) {
57 ClassLoaderData* cld = k->class_loader_data();
58 ClaimMetadataVisitingOopIterateClosure::do_cld(cld);
59 }
60
61 inline void ClaimMetadataVisitingOopIterateClosure::do_nmethod(nmethod* nm) {
62 nm->follow_nmethod(this);
63 }
64
65 inline void ClaimMetadataVisitingOopIterateClosure::do_method(Method* m) {
66 // Mark interpreted frames for class redefinition
67 m->record_gc_epoch();
68 }
69
70 // Dispatch table implementation for *Klass::oop_oop_iterate
71 //
72 // It allows for a single call to do a multi-dispatch to an optimized version
73 // of oop_oop_iterate that statically know all these types:
|