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/metaspaceClosure.hpp"
35 #include "memory/metaspaceShared.hpp"
36 #include "memory/oopFactory.hpp"
37 #include "memory/resourceArea.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 #if INCLUDE_ALL_GCS
47 #include "gc/g1/g1SATBCardTableModRefBS.hpp"
48 #endif // INCLUDE_ALL_GCS
49
50 bool Klass::is_cloneable() const {
51 return _access_flags.is_cloneable_fast() ||
52 is_subtype_of(SystemDictionary::Cloneable_klass());
53 }
54
55 void Klass::set_is_cloneable() {
56 if (name() != vmSymbols::java_lang_invoke_MemberName()) {
57 _access_flags.set_is_cloneable_fast();
58 } else {
59 assert(is_final(), "no subclasses allowed");
60 // MemberName cloning should not be intrinsified and always happen in JVM_Clone.
61 }
62 }
63
64 void Klass::set_name(Symbol* n) {
65 _name = n;
66 if (_name != NULL) _name->increment_refcount();
67 }
68
433 ik->clean_weak_instanceklass_links(is_alive);
434
435 // JVMTI RedefineClasses creates previous versions that are not in
436 // the class hierarchy, so process them here.
437 while ((ik = ik->previous_versions()) != NULL) {
438 ik->clean_weak_instanceklass_links(is_alive);
439 }
440 }
441 }
442 }
443
444 void Klass::klass_update_barrier_set(oop v) {
445 record_modified_oops();
446 }
447
448 // This barrier is used by G1 to remember the old oop values, so
449 // that we don't forget any objects that were live at the snapshot at
450 // the beginning. This function is only used when we write oops into Klasses.
451 void Klass::klass_update_barrier_set_pre(oop* p, oop v) {
452 #if INCLUDE_ALL_GCS
453 if (UseG1GC || (UseShenandoahGC && ShenandoahSATBBarrier)) {
454 oop obj = *p;
455 if (obj != NULL) {
456 G1SATBCardTableModRefBS::enqueue(obj);
457 }
458 }
459 #endif
460 }
461
462 void Klass::klass_oop_store(oop* p, oop v) {
463 assert(!Universe::heap()->is_in_reserved((void*)p), "Should store pointer into metadata");
464 assert(v == NULL || Universe::heap()->is_in_reserved((void*)v), "Should store pointer to an object");
465
466 // do the store
467 if (always_do_update_barrier) {
468 klass_oop_store((volatile oop*)p, v);
469 } else {
470 klass_update_barrier_set_pre(p, v);
471 *p = v;
472 klass_update_barrier_set(v);
473 }
474 }
475
476 void Klass::klass_oop_store(volatile oop* p, oop v) {
477 assert(!Universe::heap()->is_in_reserved((void*)p), "Should store pointer into metadata");
|
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/metaspaceClosure.hpp"
35 #include "memory/metaspaceShared.hpp"
36 #include "memory/oopFactory.hpp"
37 #include "memory/resourceArea.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 bool Klass::is_cloneable() const {
48 return _access_flags.is_cloneable_fast() ||
49 is_subtype_of(SystemDictionary::Cloneable_klass());
50 }
51
52 void Klass::set_is_cloneable() {
53 if (name() != vmSymbols::java_lang_invoke_MemberName()) {
54 _access_flags.set_is_cloneable_fast();
55 } else {
56 assert(is_final(), "no subclasses allowed");
57 // MemberName cloning should not be intrinsified and always happen in JVM_Clone.
58 }
59 }
60
61 void Klass::set_name(Symbol* n) {
62 _name = n;
63 if (_name != NULL) _name->increment_refcount();
64 }
65
430 ik->clean_weak_instanceklass_links(is_alive);
431
432 // JVMTI RedefineClasses creates previous versions that are not in
433 // the class hierarchy, so process them here.
434 while ((ik = ik->previous_versions()) != NULL) {
435 ik->clean_weak_instanceklass_links(is_alive);
436 }
437 }
438 }
439 }
440
441 void Klass::klass_update_barrier_set(oop v) {
442 record_modified_oops();
443 }
444
445 // This barrier is used by G1 to remember the old oop values, so
446 // that we don't forget any objects that were live at the snapshot at
447 // the beginning. This function is only used when we write oops into Klasses.
448 void Klass::klass_update_barrier_set_pre(oop* p, oop v) {
449 #if INCLUDE_ALL_GCS
450 oop obj = oopDesc::load_heap_oop(p);
451 if (! oopDesc::is_null(obj)) {
452 oopDesc::bs()->keep_alive_barrier(obj);
453 }
454 #endif
455 }
456
457 void Klass::klass_oop_store(oop* p, oop v) {
458 assert(!Universe::heap()->is_in_reserved((void*)p), "Should store pointer into metadata");
459 assert(v == NULL || Universe::heap()->is_in_reserved((void*)v), "Should store pointer to an object");
460
461 // do the store
462 if (always_do_update_barrier) {
463 klass_oop_store((volatile oop*)p, v);
464 } else {
465 klass_update_barrier_set_pre(p, v);
466 *p = v;
467 klass_update_barrier_set(v);
468 }
469 }
470
471 void Klass::klass_oop_store(volatile oop* p, oop v) {
472 assert(!Universe::heap()->is_in_reserved((void*)p), "Should store pointer into metadata");
|