25 #include "precompiled.hpp"
26 #include "classfile/dictionary.hpp"
27 #include "classfile/javaClasses.hpp"
28 #include "classfile/systemDictionary.hpp"
29 #include "classfile/vmSymbols.hpp"
30 #include "gc/shared/collectedHeap.inline.hpp"
31 #include "logging/log.hpp"
32 #include "memory/heapInspection.hpp"
33 #include "memory/metadataFactory.hpp"
34 #include "memory/oopFactory.hpp"
35 #include "memory/resourceArea.hpp"
36 #include "oops/instanceKlass.hpp"
37 #include "oops/klass.inline.hpp"
38 #include "oops/oop.inline.hpp"
39 #include "runtime/atomic.inline.hpp"
40 #include "runtime/orderAccess.inline.hpp"
41 #include "trace/traceMacros.hpp"
42 #include "utilities/macros.hpp"
43 #include "utilities/stack.inline.hpp"
44 #if INCLUDE_ALL_GCS
45 #include "gc/g1/g1SATBCardTableModRefBS.hpp"
46 #endif // INCLUDE_ALL_GCS
47
48 bool Klass::is_cloneable() const {
49 return _access_flags.is_cloneable_fast() ||
50 is_subtype_of(SystemDictionary::Cloneable_klass());
51 }
52
53 void Klass::set_is_cloneable() {
54 if (name() != vmSymbols::java_lang_invoke_MemberName()) {
55 _access_flags.set_is_cloneable_fast();
56 } else {
57 assert(is_final(), "no subclasses allowed");
58 // MemberName cloning should not be intrinsified and always happen in JVM_Clone.
59 }
60 }
61
62 void Klass::set_name(Symbol* n) {
63 _name = n;
64 if (_name != NULL) _name->increment_refcount();
65 }
430 // Clean the implementors list and method data.
431 if (clean_alive_klasses && current->is_instance_klass()) {
432 InstanceKlass* ik = InstanceKlass::cast(current);
433 ik->clean_weak_instanceklass_links(is_alive);
434 }
435 }
436 }
437
438 void Klass::klass_update_barrier_set(oop v) {
439 record_modified_oops();
440 }
441
442 // This barrier is used by G1 to remember the old oop values, so
443 // that we don't forget any objects that were live at the snapshot at
444 // the beginning. This function is only used when we write oops into Klasses.
445 void Klass::klass_update_barrier_set_pre(oop* p, oop v) {
446 #if INCLUDE_ALL_GCS
447 if (UseG1GC) {
448 oop obj = *p;
449 if (obj != NULL) {
450 G1SATBCardTableModRefBS::enqueue(obj);
451 }
452 }
453 #endif
454 }
455
456 void Klass::klass_oop_store(oop* p, oop v) {
457 assert(!Universe::heap()->is_in_reserved((void*)p), "Should store pointer into metadata");
458 assert(v == NULL || Universe::heap()->is_in_reserved((void*)v), "Should store pointer to an object");
459
460 // do the store
461 if (always_do_update_barrier) {
462 klass_oop_store((volatile oop*)p, v);
463 } else {
464 klass_update_barrier_set_pre(p, v);
465 *p = v;
466 klass_update_barrier_set(v);
467 }
468 }
469
470 void Klass::klass_oop_store(volatile oop* p, oop v) {
|
25 #include "precompiled.hpp"
26 #include "classfile/dictionary.hpp"
27 #include "classfile/javaClasses.hpp"
28 #include "classfile/systemDictionary.hpp"
29 #include "classfile/vmSymbols.hpp"
30 #include "gc/shared/collectedHeap.inline.hpp"
31 #include "logging/log.hpp"
32 #include "memory/heapInspection.hpp"
33 #include "memory/metadataFactory.hpp"
34 #include "memory/oopFactory.hpp"
35 #include "memory/resourceArea.hpp"
36 #include "oops/instanceKlass.hpp"
37 #include "oops/klass.inline.hpp"
38 #include "oops/oop.inline.hpp"
39 #include "runtime/atomic.inline.hpp"
40 #include "runtime/orderAccess.inline.hpp"
41 #include "trace/traceMacros.hpp"
42 #include "utilities/macros.hpp"
43 #include "utilities/stack.inline.hpp"
44 #if INCLUDE_ALL_GCS
45 #include "gc/shared/satbMarkQueue.hpp"
46 #endif // INCLUDE_ALL_GCS
47
48 bool Klass::is_cloneable() const {
49 return _access_flags.is_cloneable_fast() ||
50 is_subtype_of(SystemDictionary::Cloneable_klass());
51 }
52
53 void Klass::set_is_cloneable() {
54 if (name() != vmSymbols::java_lang_invoke_MemberName()) {
55 _access_flags.set_is_cloneable_fast();
56 } else {
57 assert(is_final(), "no subclasses allowed");
58 // MemberName cloning should not be intrinsified and always happen in JVM_Clone.
59 }
60 }
61
62 void Klass::set_name(Symbol* n) {
63 _name = n;
64 if (_name != NULL) _name->increment_refcount();
65 }
430 // Clean the implementors list and method data.
431 if (clean_alive_klasses && current->is_instance_klass()) {
432 InstanceKlass* ik = InstanceKlass::cast(current);
433 ik->clean_weak_instanceklass_links(is_alive);
434 }
435 }
436 }
437
438 void Klass::klass_update_barrier_set(oop v) {
439 record_modified_oops();
440 }
441
442 // This barrier is used by G1 to remember the old oop values, so
443 // that we don't forget any objects that were live at the snapshot at
444 // the beginning. This function is only used when we write oops into Klasses.
445 void Klass::klass_update_barrier_set_pre(oop* p, oop v) {
446 #if INCLUDE_ALL_GCS
447 if (UseG1GC) {
448 oop obj = *p;
449 if (obj != NULL) {
450 SATBMarkQueue::enqueue(obj);
451 }
452 }
453 #endif
454 }
455
456 void Klass::klass_oop_store(oop* p, oop v) {
457 assert(!Universe::heap()->is_in_reserved((void*)p), "Should store pointer into metadata");
458 assert(v == NULL || Universe::heap()->is_in_reserved((void*)v), "Should store pointer to an object");
459
460 // do the store
461 if (always_do_update_barrier) {
462 klass_oop_store((volatile oop*)p, v);
463 } else {
464 klass_update_barrier_set_pre(p, v);
465 *p = v;
466 klass_update_barrier_set(v);
467 }
468 }
469
470 void Klass::klass_oop_store(volatile oop* p, oop v) {
|