< prev index next >

src/share/vm/code/compiledIC.cpp

Print this page




 304     // is to the interpreter.
 305     CodeBlob* cb = CodeCache::find_blob_unsafe(ic_destination());
 306     is_call_to_interpreted = (cb != NULL && cb->is_adapter_blob());
 307     assert(!is_call_to_interpreted || (is_icholder_call() && cached_icholder() != NULL), "sanity check");
 308   } else {
 309     // Check if we are calling into our own codeblob (i.e., to a stub)
 310     CodeBlob* cb = CodeCache::find_blob(_ic_call->instruction_address());
 311     address dest = ic_destination();
 312 #ifdef ASSERT
 313     {
 314       CodeBlob* db = CodeCache::find_blob_unsafe(dest);
 315       assert(!db->is_adapter_blob(), "must use stub!");
 316     }
 317 #endif /* ASSERT */
 318     is_call_to_interpreted = cb->contains(dest);
 319   }
 320   return is_call_to_interpreted;
 321 }
 322 
 323 
 324 void CompiledIC::set_to_clean() {
 325   assert(SafepointSynchronize::is_at_safepoint() || CompiledIC_lock->is_locked() , "MT-unsafe call");
 326   if (TraceInlineCacheClearing || TraceICs) {
 327     tty->print_cr("IC@" INTPTR_FORMAT ": set to clean", p2i(instruction_address()));
 328     print();
 329   }
 330 
 331   address entry;
 332   if (is_optimized()) {
 333     entry = SharedRuntime::get_resolve_opt_virtual_call_stub();
 334   } else {
 335     entry = SharedRuntime::get_resolve_virtual_call_stub();
 336   }
 337 
 338   // A zombie transition will always be safe, since the metadata has already been set to NULL, so
 339   // we only need to patch the destination
 340   bool safe_transition = is_optimized() || SafepointSynchronize::is_at_safepoint();
 341 
 342   if (safe_transition) {
 343     // Kill any leftover stub we might have too
 344     clear_ic_stub();
 345     if (is_optimized()) {
 346       set_ic_destination(entry);
 347     } else {
 348       set_ic_destination_and_value(entry, (void*)NULL);
 349     }
 350   } else {
 351     // Unsafe transition - create stub.
 352     InlineCacheBuffer::create_transition_stub(this, NULL, entry);
 353   }
 354   // We can't check this anymore. With lazy deopt we could have already
 355   // cleaned this IC entry before we even return. This is possible if
 356   // we ran out of space in the inline cache buffer trying to do the
 357   // set_next and we safepointed to free up space. This is a benign
 358   // race because the IC entry was complete when we safepointed so
 359   // cleaning it immediately is harmless.
 360   // assert(is_clean(), "sanity check");




 304     // is to the interpreter.
 305     CodeBlob* cb = CodeCache::find_blob_unsafe(ic_destination());
 306     is_call_to_interpreted = (cb != NULL && cb->is_adapter_blob());
 307     assert(!is_call_to_interpreted || (is_icholder_call() && cached_icholder() != NULL), "sanity check");
 308   } else {
 309     // Check if we are calling into our own codeblob (i.e., to a stub)
 310     CodeBlob* cb = CodeCache::find_blob(_ic_call->instruction_address());
 311     address dest = ic_destination();
 312 #ifdef ASSERT
 313     {
 314       CodeBlob* db = CodeCache::find_blob_unsafe(dest);
 315       assert(!db->is_adapter_blob(), "must use stub!");
 316     }
 317 #endif /* ASSERT */
 318     is_call_to_interpreted = cb->contains(dest);
 319   }
 320   return is_call_to_interpreted;
 321 }
 322 
 323 
 324 void CompiledIC::set_to_clean(bool in_use) {
 325   assert(SafepointSynchronize::is_at_safepoint() || CompiledIC_lock->is_locked() , "MT-unsafe call");
 326   if (TraceInlineCacheClearing || TraceICs) {
 327     tty->print_cr("IC@" INTPTR_FORMAT ": set to clean", p2i(instruction_address()));
 328     print();
 329   }
 330 
 331   address entry;
 332   if (is_optimized()) {
 333     entry = SharedRuntime::get_resolve_opt_virtual_call_stub();
 334   } else {
 335     entry = SharedRuntime::get_resolve_virtual_call_stub();
 336   }
 337 
 338   // A zombie transition will always be safe, since the metadata has already been set to NULL, so
 339   // we only need to patch the destination
 340   bool safe_transition = !in_use || is_optimized() || SafepointSynchronize::is_at_safepoint();
 341 
 342   if (safe_transition) {
 343     // Kill any leftover stub we might have too
 344     clear_ic_stub();
 345     if (is_optimized()) {
 346       set_ic_destination(entry);
 347     } else {
 348       set_ic_destination_and_value(entry, (void*)NULL);
 349     }
 350   } else {
 351     // Unsafe transition - create stub.
 352     InlineCacheBuffer::create_transition_stub(this, NULL, entry);
 353   }
 354   // We can't check this anymore. With lazy deopt we could have already
 355   // cleaned this IC entry before we even return. This is possible if
 356   // we ran out of space in the inline cache buffer trying to do the
 357   // set_next and we safepointed to free up space. This is a benign
 358   // race because the IC entry was complete when we safepointed so
 359   // cleaning it immediately is harmless.
 360   // assert(is_clean(), "sanity check");


< prev index next >