257 if( cb != NULL && cb->is_compiled() ) {
258 CompiledMethod* cm = cb->as_compiled_method();
259 // Clean inline caches pointing to zombie, non-entrant and unloaded methods
260 if (clean_all || !cm->is_in_use() || (cm->method()->code() != cm)) {
261 csc->set_to_clean();
262 }
263 }
264 break;
265 }
266 }
267 }
268 }
269
270 int CompiledMethod::verify_icholder_relocations() {
271 ResourceMark rm;
272 int count = 0;
273
274 RelocIterator iter(this);
275 while(iter.next()) {
276 if (iter.type() == relocInfo::virtual_call_type) {
277 if (CompiledIC::is_icholder_call_site(iter.virtual_call_reloc())) {
278 CompiledIC *ic = CompiledIC_at(&iter);
279 if (TraceCompiledIC) {
280 tty->print("noticed icholder " INTPTR_FORMAT " ", p2i(ic->cached_icholder()));
281 ic->print();
282 }
283 assert(ic->cached_icholder() != NULL, "must be non-NULL");
284 count++;
285 }
286 }
287 }
288
289 return count;
290 }
291
292 // Method that knows how to preserve outgoing arguments at call. This method must be
293 // called with a frame corresponding to a Java invoke
294 void CompiledMethod::preserve_callee_argument_oops(frame fr, const RegisterMap *reg_map, OopClosure* f) {
295 #ifndef SHARK
296 if (method() != NULL && !method()->is_native()) {
297 address pc = fr.pc();
393 } else if (md->is_methodData()) {
394 klass = ((MethodData*)md)->method()->method_holder();
395 } else {
396 md->print();
397 ShouldNotReachHere();
398 }
399 assert(klass->is_loader_alive(_is_alive), "must be alive");
400 }
401 public:
402 static void do_check_class(BoolObjectClosure* is_alive, CompiledMethod* nm) {
403 assert(SafepointSynchronize::is_at_safepoint(), "this is only ok at safepoint");
404 _is_alive = is_alive;
405 nm->metadata_do(check_class);
406 }
407 };
408
409 // This is called during a safepoint so can use static data
410 BoolObjectClosure* CheckClass::_is_alive = NULL;
411 #endif // ASSERT
412
413 void CompiledMethod::clean_ic_if_metadata_is_dead(CompiledIC *ic, BoolObjectClosure *is_alive) {
414 if (ic->is_icholder_call()) {
415 // The only exception is compiledICHolder oops which may
416 // yet be marked below. (We check this further below).
417 CompiledICHolder* cichk_oop = ic->cached_icholder();
418
419 if (cichk_oop->holder_method()->method_holder()->is_loader_alive(is_alive) &&
420 cichk_oop->holder_klass()->is_loader_alive(is_alive)) {
421 return;
422 }
423 } else {
424 Metadata* ic_oop = ic->cached_metadata();
425 if (ic_oop != NULL) {
426 if (ic_oop->is_klass()) {
427 if (((Klass*)ic_oop)->is_loader_alive(is_alive)) {
428 return;
429 }
430 } else if (ic_oop->is_method()) {
431 if (((Method*)ic_oop)->method_holder()->is_loader_alive(is_alive)) {
432 return;
|
257 if( cb != NULL && cb->is_compiled() ) {
258 CompiledMethod* cm = cb->as_compiled_method();
259 // Clean inline caches pointing to zombie, non-entrant and unloaded methods
260 if (clean_all || !cm->is_in_use() || (cm->method()->code() != cm)) {
261 csc->set_to_clean();
262 }
263 }
264 break;
265 }
266 }
267 }
268 }
269
270 int CompiledMethod::verify_icholder_relocations() {
271 ResourceMark rm;
272 int count = 0;
273
274 RelocIterator iter(this);
275 while(iter.next()) {
276 if (iter.type() == relocInfo::virtual_call_type) {
277 if (CompiledIC::is_icholder_call_site(iter.virtual_call_reloc(), this)) {
278 CompiledIC *ic = CompiledIC_at(&iter);
279 if (TraceCompiledIC) {
280 tty->print("noticed icholder " INTPTR_FORMAT " ", p2i(ic->cached_icholder()));
281 ic->print();
282 }
283 assert(ic->cached_icholder() != NULL, "must be non-NULL");
284 count++;
285 }
286 }
287 }
288
289 return count;
290 }
291
292 // Method that knows how to preserve outgoing arguments at call. This method must be
293 // called with a frame corresponding to a Java invoke
294 void CompiledMethod::preserve_callee_argument_oops(frame fr, const RegisterMap *reg_map, OopClosure* f) {
295 #ifndef SHARK
296 if (method() != NULL && !method()->is_native()) {
297 address pc = fr.pc();
393 } else if (md->is_methodData()) {
394 klass = ((MethodData*)md)->method()->method_holder();
395 } else {
396 md->print();
397 ShouldNotReachHere();
398 }
399 assert(klass->is_loader_alive(_is_alive), "must be alive");
400 }
401 public:
402 static void do_check_class(BoolObjectClosure* is_alive, CompiledMethod* nm) {
403 assert(SafepointSynchronize::is_at_safepoint(), "this is only ok at safepoint");
404 _is_alive = is_alive;
405 nm->metadata_do(check_class);
406 }
407 };
408
409 // This is called during a safepoint so can use static data
410 BoolObjectClosure* CheckClass::_is_alive = NULL;
411 #endif // ASSERT
412
413
414 void CompiledMethod::clean_ic_if_metadata_is_dead(CompiledIC *ic, BoolObjectClosure *is_alive) {
415 if (ic->is_icholder_call()) {
416 // The only exception is compiledICHolder oops which may
417 // yet be marked below. (We check this further below).
418 CompiledICHolder* cichk_oop = ic->cached_icholder();
419
420 if (cichk_oop->holder_method()->method_holder()->is_loader_alive(is_alive) &&
421 cichk_oop->holder_klass()->is_loader_alive(is_alive)) {
422 return;
423 }
424 } else {
425 Metadata* ic_oop = ic->cached_metadata();
426 if (ic_oop != NULL) {
427 if (ic_oop->is_klass()) {
428 if (((Klass*)ic_oop)->is_loader_alive(is_alive)) {
429 return;
430 }
431 } else if (ic_oop->is_method()) {
432 if (((Method*)ic_oop)->method_holder()->is_loader_alive(is_alive)) {
433 return;
|