128 MarkSweep::ref_processor()->discover_reference(obj, klass->reference_type())) {
129 // reference was discovered, referent will be traversed later
130 klass->InstanceKlass::oop_ms_follow_contents(obj);
131 debug_only(
132 if(TraceReferenceGC && PrintGCDetails) {
133 gclog_or_tty->print_cr(" Non NULL enqueued " PTR_FORMAT, p2i(obj));
134 }
135 )
136 return;
137 } else {
138 // treat referent as normal oop
139 debug_only(
140 if(TraceReferenceGC && PrintGCDetails) {
141 gclog_or_tty->print_cr(" Non NULL normal " PTR_FORMAT, p2i(obj));
142 }
143 )
144 MarkSweep::mark_and_push(referent_addr);
145 }
146 }
147 T* next_addr = (T*)java_lang_ref_Reference::next_addr(obj);
148 if (ReferenceProcessor::pending_list_uses_discovered_field()) {
149 // Treat discovered as normal oop, if ref is not "active",
150 // i.e. if next is non-NULL.
151 T next_oop = oopDesc::load_heap_oop(next_addr);
152 if (!oopDesc::is_null(next_oop)) { // i.e. ref is not "active"
153 T* discovered_addr = (T*)java_lang_ref_Reference::discovered_addr(obj);
154 debug_only(
155 if(TraceReferenceGC && PrintGCDetails) {
156 gclog_or_tty->print_cr(" Process discovered as normal "
157 PTR_FORMAT, p2i(discovered_addr));
158 }
159 )
160 MarkSweep::mark_and_push(discovered_addr);
161 }
162 } else {
163 #ifdef ASSERT
164 // In the case of older JDKs which do not use the discovered
165 // field for the pending list, an inactive ref (next != NULL)
166 // must always have a NULL discovered field.
167 oop next = oopDesc::load_decode_heap_oop(next_addr);
168 oop discovered = java_lang_ref_Reference::discovered(obj);
169 assert(oopDesc::is_null(next) || oopDesc::is_null(discovered),
170 err_msg("Found an inactive reference " PTR_FORMAT " with a non-NULL discovered field",
171 p2i(obj)));
172 #endif
173 }
174 // treat next as normal oop. next is a link in the reference queue.
175 debug_only(
176 if(TraceReferenceGC && PrintGCDetails) {
177 gclog_or_tty->print_cr(" Process next as normal " PTR_FORMAT, p2i(next_addr));
178 }
179 )
180 MarkSweep::mark_and_push(next_addr);
181 klass->InstanceKlass::oop_ms_follow_contents(obj);
182 }
183
184 void InstanceRefKlass::oop_ms_follow_contents(oop obj) {
185 if (UseCompressedOops) {
186 oop_ms_follow_contents_specialized<narrowOop>(this, obj);
187 } else {
188 oop_ms_follow_contents_specialized<oop>(this, obj);
189 }
190 }
191
192 template <class T>
|
128 MarkSweep::ref_processor()->discover_reference(obj, klass->reference_type())) {
129 // reference was discovered, referent will be traversed later
130 klass->InstanceKlass::oop_ms_follow_contents(obj);
131 debug_only(
132 if(TraceReferenceGC && PrintGCDetails) {
133 gclog_or_tty->print_cr(" Non NULL enqueued " PTR_FORMAT, p2i(obj));
134 }
135 )
136 return;
137 } else {
138 // treat referent as normal oop
139 debug_only(
140 if(TraceReferenceGC && PrintGCDetails) {
141 gclog_or_tty->print_cr(" Non NULL normal " PTR_FORMAT, p2i(obj));
142 }
143 )
144 MarkSweep::mark_and_push(referent_addr);
145 }
146 }
147 T* next_addr = (T*)java_lang_ref_Reference::next_addr(obj);
148 // Treat discovered as normal oop, if ref is not "active",
149 // i.e. if next is non-NULL.
150 T next_oop = oopDesc::load_heap_oop(next_addr);
151 if (!oopDesc::is_null(next_oop)) { // i.e. ref is not "active"
152 T* discovered_addr = (T*)java_lang_ref_Reference::discovered_addr(obj);
153 debug_only(
154 if(TraceReferenceGC && PrintGCDetails) {
155 gclog_or_tty->print_cr(" Process discovered as normal "
156 PTR_FORMAT, p2i(discovered_addr));
157 }
158 )
159 MarkSweep::mark_and_push(discovered_addr);
160 }
161 // treat next as normal oop. next is a link in the reference queue.
162 debug_only(
163 if(TraceReferenceGC && PrintGCDetails) {
164 gclog_or_tty->print_cr(" Process next as normal " PTR_FORMAT, p2i(next_addr));
165 }
166 )
167 MarkSweep::mark_and_push(next_addr);
168 klass->InstanceKlass::oop_ms_follow_contents(obj);
169 }
170
171 void InstanceRefKlass::oop_ms_follow_contents(oop obj) {
172 if (UseCompressedOops) {
173 oop_ms_follow_contents_specialized<narrowOop>(this, obj);
174 } else {
175 oop_ms_follow_contents_specialized<oop>(this, obj);
176 }
177 }
178
179 template <class T>
|