roman_version
183
184 void ClassLoaderData::ChunkedHandleList::oops_do(OopClosure* f) {
185 Chunk* head = OrderAccess::load_acquire(&_head);
186 if (head != NULL) {
187 // Must be careful when reading size of head
188 oops_do_chunk(f, head, OrderAccess::load_acquire(&head->_size));
189 for (Chunk* c = head->_next; c != NULL; c = c->_next) {
190 oops_do_chunk(f, c, c->_size);
191 }
192 }
193 }
194
195 class VerifyContainsOopClosure : public OopClosure {
196 oop _target;
197 bool _found;
198
199 public:
200 VerifyContainsOopClosure(oop target) : _target(target), _found(false) {}
201
202 void do_oop(oop* p) {
203 if (p != NULL && *p == _target) {
204 _found = true;
205 }
206 }
207
208 void do_oop(narrowOop* p) {
209 // The ChunkedHandleList should not contain any narrowOop
210 ShouldNotReachHere();
211 }
212
213 bool found() const {
214 return _found;
215 }
216 };
217
218 bool ClassLoaderData::ChunkedHandleList::contains(oop p) {
219 VerifyContainsOopClosure cl(p);
220 oops_do(&cl);
221 return cl.found();
222 }
|
183
184 void ClassLoaderData::ChunkedHandleList::oops_do(OopClosure* f) {
185 Chunk* head = OrderAccess::load_acquire(&_head);
186 if (head != NULL) {
187 // Must be careful when reading size of head
188 oops_do_chunk(f, head, OrderAccess::load_acquire(&head->_size));
189 for (Chunk* c = head->_next; c != NULL; c = c->_next) {
190 oops_do_chunk(f, c, c->_size);
191 }
192 }
193 }
194
195 class VerifyContainsOopClosure : public OopClosure {
196 oop _target;
197 bool _found;
198
199 public:
200 VerifyContainsOopClosure(oop target) : _target(target), _found(false) {}
201
202 void do_oop(oop* p) {
203 if (p != NULL && oopDesc::equals(RawAccess<>::oop_load(p), _target)) {
204 _found = true;
205 }
206 }
207
208 void do_oop(narrowOop* p) {
209 // The ChunkedHandleList should not contain any narrowOop
210 ShouldNotReachHere();
211 }
212
213 bool found() const {
214 return _found;
215 }
216 };
217
218 bool ClassLoaderData::ChunkedHandleList::contains(oop p) {
219 VerifyContainsOopClosure cl(p);
220 oops_do(&cl);
221 return cl.found();
222 }
|
362 if (to_cld->is_permanent_class_loader_data()) {
363 return;
364 }
365
366 oop to;
367 if (to_cld->is_anonymous()) {
368 // Just return if an anonymous class is attempting to record a dependency
369 // to itself. (Note that every anonymous class has its own unique class
370 // loader data.)
371 if (to_cld == from_cld) {
372 return;
373 }
374 // Anonymous class dependencies are through the mirror.
375 to = k->java_mirror();
376 } else {
377 to = to_cld->class_loader();
378 oop from = from_cld->class_loader();
379
380 // Just return if this dependency is to a class with the same or a parent
381 // class_loader.
382 if (from == to || java_lang_ClassLoader::isAncestor(from, to)) {
383 return; // this class loader is in the parent list, no need to add it.
384 }
385 }
386
387 // It's a dependency we won't find through GC, add it.
388 if (!_handles.contains(to)) {
389 NOT_PRODUCT(Atomic::inc(&_dependency_count));
390 LogTarget(Trace, class, loader, data) lt;
391 if (lt.is_enabled()) {
392 ResourceMark rm;
393 LogStream ls(lt);
394 ls.print("adding dependency from ");
395 print_value_on(&ls);
396 ls.print(" to ");
397 to_cld->print_value_on(&ls);
398 ls.cr();
399 }
400 Handle dependency(Thread::current(), to);
401 add_handle(dependency);
|
362 if (to_cld->is_permanent_class_loader_data()) {
363 return;
364 }
365
366 oop to;
367 if (to_cld->is_anonymous()) {
368 // Just return if an anonymous class is attempting to record a dependency
369 // to itself. (Note that every anonymous class has its own unique class
370 // loader data.)
371 if (to_cld == from_cld) {
372 return;
373 }
374 // Anonymous class dependencies are through the mirror.
375 to = k->java_mirror();
376 } else {
377 to = to_cld->class_loader();
378 oop from = from_cld->class_loader();
379
380 // Just return if this dependency is to a class with the same or a parent
381 // class_loader.
382 if (oopDesc::equals(from, to) || java_lang_ClassLoader::isAncestor(from, to)) {
383 return; // this class loader is in the parent list, no need to add it.
384 }
385 }
386
387 // It's a dependency we won't find through GC, add it.
388 if (!_handles.contains(to)) {
389 NOT_PRODUCT(Atomic::inc(&_dependency_count));
390 LogTarget(Trace, class, loader, data) lt;
391 if (lt.is_enabled()) {
392 ResourceMark rm;
393 LogStream ls(lt);
394 ls.print("adding dependency from ");
395 print_value_on(&ls);
396 ls.print(" to ");
397 to_cld->print_value_on(&ls);
398 ls.cr();
399 }
400 Handle dependency(Thread::current(), to);
401 add_handle(dependency);
|