45 return REF_PHANTOM;
46 } else {
47 ShouldNotReachHere();
48 return REF_NONE;
49 }
50 }
51
52 static ReferenceType determine_reference_type(const ClassFileParser& parser) {
53 const ReferenceType rt = parser.super_reference_type();
54 if (rt != REF_NONE) {
55 // Inherit type from super class
56 return rt;
57 }
58
59 // Bootstrapping: this is one of the direct subclasses of java.lang.ref.Reference
60 const Symbol* const name = parser.class_name();
61 return reference_subclass_name_to_type(name);
62 }
63
64 InstanceRefKlass::InstanceRefKlass(const ClassFileParser& parser)
65 : InstanceKlass(parser, Kind, determine_reference_type(parser)) {}
66
67 void InstanceRefKlass::update_nonstatic_oop_maps(Klass* k) {
68 // Clear the nonstatic oop-map entries corresponding to referent
69 // and discovered fields. They are treated specially by the
70 // garbage collector.
71 InstanceKlass* ik = InstanceKlass::cast(k);
72
73 // Check that we have the right class
74 debug_only(static bool first_time = true);
75 assert(k == vmClasses::Reference_klass() && first_time,
76 "Invalid update of maps");
77 debug_only(first_time = false);
78 assert(ik->nonstatic_oop_map_count() == 1, "just checking");
79
80 OopMapBlock* map = ik->start_of_nonstatic_oop_maps();
81
82 #ifdef ASSERT
83 // Verify fields are in the expected places.
84 int referent_offset = java_lang_ref_Reference::referent_offset();
85 int queue_offset = java_lang_ref_Reference::queue_offset();
|
45 return REF_PHANTOM;
46 } else {
47 ShouldNotReachHere();
48 return REF_NONE;
49 }
50 }
51
52 static ReferenceType determine_reference_type(const ClassFileParser& parser) {
53 const ReferenceType rt = parser.super_reference_type();
54 if (rt != REF_NONE) {
55 // Inherit type from super class
56 return rt;
57 }
58
59 // Bootstrapping: this is one of the direct subclasses of java.lang.ref.Reference
60 const Symbol* const name = parser.class_name();
61 return reference_subclass_name_to_type(name);
62 }
63
64 InstanceRefKlass::InstanceRefKlass(const ClassFileParser& parser)
65 : InstanceKlass(parser, Kind, markWord::prototype(), determine_reference_type(parser)) {}
66
67 void InstanceRefKlass::update_nonstatic_oop_maps(Klass* k) {
68 // Clear the nonstatic oop-map entries corresponding to referent
69 // and discovered fields. They are treated specially by the
70 // garbage collector.
71 InstanceKlass* ik = InstanceKlass::cast(k);
72
73 // Check that we have the right class
74 debug_only(static bool first_time = true);
75 assert(k == vmClasses::Reference_klass() && first_time,
76 "Invalid update of maps");
77 debug_only(first_time = false);
78 assert(ik->nonstatic_oop_map_count() == 1, "just checking");
79
80 OopMapBlock* map = ik->start_of_nonstatic_oop_maps();
81
82 #ifdef ASSERT
83 // Verify fields are in the expected places.
84 int referent_offset = java_lang_ref_Reference::referent_offset();
85 int queue_offset = java_lang_ref_Reference::queue_offset();
|