25 #ifndef SHARE_VM_OOPS_INSTANCEREFKLASS_HPP |
25 #ifndef SHARE_VM_OOPS_INSTANCEREFKLASS_HPP |
26 #define SHARE_VM_OOPS_INSTANCEREFKLASS_HPP |
26 #define SHARE_VM_OOPS_INSTANCEREFKLASS_HPP |
27 |
27 |
28 #include "oops/instanceKlass.hpp" |
28 #include "oops/instanceKlass.hpp" |
29 |
29 |
30 // An instanceRefKlass is a specialized InstanceKlass for Java |
30 // An InstanceRefKlass is a specialized InstanceKlass for Java |
31 // classes that are subclasses of java/lang/ref/Reference. |
31 // classes that are subclasses of java/lang/ref/Reference. |
32 // |
32 // |
33 // These classes are used to implement soft/weak/final/phantom |
33 // These classes are used to implement soft/weak/final/phantom |
34 // references and finalization, and need special treatment by the |
34 // references and finalization, and need special treatment by the |
35 // garbage collector. |
35 // garbage collector. |
42 // order of reachability. Reference objects eligible for notification |
42 // order of reachability. Reference objects eligible for notification |
43 // are linked to the static pending_list in class java/lang/ref/Reference, |
43 // are linked to the static pending_list in class java/lang/ref/Reference, |
44 // and the pending list lock object in the same class is notified. |
44 // and the pending list lock object in the same class is notified. |
45 |
45 |
46 |
46 |
47 class instanceRefKlass: public InstanceKlass { |
47 class InstanceRefKlass: public InstanceKlass { |
48 friend class InstanceKlass; |
48 friend class InstanceKlass; |
49 |
49 |
50 // Constructor |
50 // Constructor |
51 instanceRefKlass(int vtable_len, int itable_len, int static_field_size, int nonstatic_oop_map_size, ReferenceType rt, AccessFlags access_flags, bool is_anonymous) |
51 InstanceRefKlass(int vtable_len, int itable_len, int static_field_size, int nonstatic_oop_map_size, ReferenceType rt, AccessFlags access_flags, bool is_anonymous) |
52 : InstanceKlass(vtable_len, itable_len, static_field_size, nonstatic_oop_map_size, rt, access_flags, is_anonymous) {} |
52 : InstanceKlass(vtable_len, itable_len, static_field_size, nonstatic_oop_map_size, rt, access_flags, is_anonymous) {} |
53 |
53 |
54 public: |
54 public: |
55 instanceRefKlass() { assert(DumpSharedSpaces || UseSharedSpaces, "only for CDS"); } |
55 InstanceRefKlass() { assert(DumpSharedSpaces || UseSharedSpaces, "only for CDS"); } |
56 // Type testing |
56 // Type testing |
57 bool oop_is_instanceRef() const { return true; } |
57 bool oop_is_instanceRef() const { return true; } |
58 |
58 |
59 // Casting from Klass* |
59 // Casting from Klass* |
60 static instanceRefKlass* cast(Klass* k) { |
60 static InstanceRefKlass* cast(Klass* k) { |
61 assert(k->oop_is_instanceRef(), "cast to instanceRefKlass"); |
61 assert(k->oop_is_instanceRef(), "cast to InstanceRefKlass"); |
62 return (instanceRefKlass*) k; |
62 return (InstanceRefKlass*) k; |
63 } |
63 } |
64 |
64 |
65 // Garbage collection |
65 // Garbage collection |
66 int oop_adjust_pointers(oop obj); |
66 int oop_adjust_pointers(oop obj); |
67 void oop_follow_contents(oop obj); |
67 void oop_follow_contents(oop obj); |