17 *
18 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
19 * or visit www.oracle.com if you need additional information or have any
20 * questions.
21 *
22 */
23
24 #include "precompiled.hpp"
25 #include "classfile/dictionary.hpp"
26 #include "classfile/javaClasses.hpp"
27 #include "classfile/systemDictionary.hpp"
28 #include "classfile/vmSymbols.hpp"
29 #include "gc/shared/collectedHeap.inline.hpp"
30 #include "logging/log.hpp"
31 #include "memory/heapInspection.hpp"
32 #include "memory/metadataFactory.hpp"
33 #include "memory/metaspaceClosure.hpp"
34 #include "memory/metaspaceShared.hpp"
35 #include "memory/oopFactory.hpp"
36 #include "memory/resourceArea.hpp"
37 #include "oops/instanceKlass.hpp"
38 #include "oops/klass.inline.hpp"
39 #include "oops/oop.inline.hpp"
40 #include "runtime/atomic.hpp"
41 #include "runtime/orderAccess.inline.hpp"
42 #include "trace/traceMacros.hpp"
43 #include "utilities/macros.hpp"
44 #include "utilities/stack.inline.hpp"
45
46 void Klass::set_java_mirror(Handle m) {
47 assert(!m.is_null(), "New mirror should never be null.");
48 assert(_java_mirror.resolve() == NULL, "should only be used to initialize mirror");
49 _java_mirror = class_loader_data()->add_handle(m);
50 }
51
52 oop Klass::java_mirror() const {
53 return _java_mirror.resolve();
54 }
55
56 bool Klass::is_cloneable() const {
57 return _access_flags.is_cloneable_fast() ||
58 is_subtype_of(SystemDictionary::Cloneable_klass());
59 }
60
61 void Klass::set_is_cloneable() {
62 if (name() != vmSymbols::java_lang_invoke_MemberName()) {
63 _access_flags.set_is_cloneable_fast();
64 } else {
65 assert(is_final(), "no subclasses allowed");
66 // MemberName cloning should not be intrinsified and always happen in JVM_Clone.
67 }
68 }
69
70 void Klass::set_name(Symbol* n) {
71 _name = n;
72 if (_name != NULL) _name->increment_refcount();
|
17 *
18 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
19 * or visit www.oracle.com if you need additional information or have any
20 * questions.
21 *
22 */
23
24 #include "precompiled.hpp"
25 #include "classfile/dictionary.hpp"
26 #include "classfile/javaClasses.hpp"
27 #include "classfile/systemDictionary.hpp"
28 #include "classfile/vmSymbols.hpp"
29 #include "gc/shared/collectedHeap.inline.hpp"
30 #include "logging/log.hpp"
31 #include "memory/heapInspection.hpp"
32 #include "memory/metadataFactory.hpp"
33 #include "memory/metaspaceClosure.hpp"
34 #include "memory/metaspaceShared.hpp"
35 #include "memory/oopFactory.hpp"
36 #include "memory/resourceArea.hpp"
37 #include "oops/access.inline.hpp"
38 #include "oops/instanceKlass.hpp"
39 #include "oops/klass.inline.hpp"
40 #include "oops/oop.inline.hpp"
41 #include "runtime/atomic.hpp"
42 #include "runtime/orderAccess.inline.hpp"
43 #include "trace/traceMacros.hpp"
44 #include "utilities/macros.hpp"
45 #include "utilities/stack.inline.hpp"
46
47 void Klass::set_java_mirror(Handle m) {
48 assert(!m.is_null(), "New mirror should never be null.");
49 assert(_java_mirror.resolve() == NULL, "should only be used to initialize mirror");
50 _java_mirror = class_loader_data()->add_handle(m);
51 }
52
53 oop Klass::java_mirror() const {
54 return _java_mirror.resolve();
55 }
56
57 oop Klass::java_mirror_phantom() {
58 // Loading the klass_holder as a phantom oop ref keeps the class alive.
59 // After the holder has been kept alive, it is safe to return the mirror.
60 (void)klass_holder_phantom();
61 return java_mirror();
62 }
63
64 oop Klass::klass_holder_phantom() {
65 oop* addr = &class_loader_data()->_class_loader;
66 return RootAccess<IN_CONCURRENT_ROOT | ON_PHANTOM_OOP_REF>::oop_load(addr);
67 }
68
69 bool Klass::is_cloneable() const {
70 return _access_flags.is_cloneable_fast() ||
71 is_subtype_of(SystemDictionary::Cloneable_klass());
72 }
73
74 void Klass::set_is_cloneable() {
75 if (name() != vmSymbols::java_lang_invoke_MemberName()) {
76 _access_flags.set_is_cloneable_fast();
77 } else {
78 assert(is_final(), "no subclasses allowed");
79 // MemberName cloning should not be intrinsified and always happen in JVM_Clone.
80 }
81 }
82
83 void Klass::set_name(Symbol* n) {
84 _name = n;
85 if (_name != NULL) _name->increment_refcount();
|