82 // the next safepoint. Make sure that the CompiledICHolder* is
83 // marked for release at this point since it won't be identifiable
84 // once the entry point is overwritten.
85 InlineCacheBuffer::queue_for_release((CompiledICHolder*)_value->data());
86 }
87
88 if (TraceCompiledIC) {
89 tty->print(" ");
90 print_compiled_ic();
91 tty->print(" changing destination to " INTPTR_FORMAT, p2i(entry_point));
92 if (!is_optimized()) {
93 tty->print(" changing cached %s to " INTPTR_FORMAT, is_icholder ? "icholder" : "metadata", p2i((address)cache));
94 }
95 if (is_icstub) {
96 tty->print(" (icstub)");
97 }
98 tty->cr();
99 }
100
101 {
102 MutexLockerEx pl(Patching_lock, Mutex::_no_safepoint_check_flag);
103 #ifdef ASSERT
104 CodeBlob* cb = CodeCache::find_blob_unsafe(_ic_call);
105 assert(cb != NULL && cb->is_nmethod(), "must be nmethod");
106 #endif
107 _ic_call->set_destination_mt_safe(entry_point);
108 }
109
110 if (is_optimized() || is_icstub) {
111 // Optimized call sites don't have a cache value and ICStub call
112 // sites only change the entry point. Changing the value in that
113 // case could lead to MT safety issues.
114 assert(cache == NULL, "must be null");
115 return;
116 }
117
118 if (cache == NULL) cache = (void*)Universe::non_oop_word();
119
120 _value->set_data((intptr_t)cache);
121 }
122
123
124 void CompiledIC::set_ic_destination(ICStub* stub) {
125 internal_set_ic_destination(stub->code_begin(), true, NULL, false);
126 }
127
128
512 } else {
513 // Use icholder entry
514 CompiledICHolder* holder = new CompiledICHolder(method(), receiver_klass());
515 info.set_icholder_entry(method()->get_c2i_unverified_entry(), holder);
516 }
517 }
518 assert(info.is_optimized() == is_optimized, "must agree");
519 }
520
521
522 bool CompiledIC::is_icholder_entry(address entry) {
523 CodeBlob* cb = CodeCache::find_blob_unsafe(entry);
524 return (cb != NULL && cb->is_adapter_blob());
525 }
526
527 // ----------------------------------------------------------------------------
528
529 void CompiledStaticCall::set_to_clean() {
530 assert (CompiledIC_lock->is_locked() || SafepointSynchronize::is_at_safepoint(), "mt unsafe call");
531 // Reset call site
532 MutexLockerEx pl(Patching_lock, Mutex::_no_safepoint_check_flag);
533 #ifdef ASSERT
534 CodeBlob* cb = CodeCache::find_blob_unsafe(this);
535 assert(cb != NULL && cb->is_nmethod(), "must be nmethod");
536 #endif
537 set_destination_mt_safe(SharedRuntime::get_resolve_static_call_stub());
538
539 // Do not reset stub here: It is too expensive to call find_stub.
540 // Instead, rely on caller (nmethod::clear_inline_caches) to clear
541 // both the call and its stub.
542 }
543
544
545 bool CompiledStaticCall::is_clean() const {
546 return destination() == SharedRuntime::get_resolve_static_call_stub();
547 }
548
549 bool CompiledStaticCall::is_call_to_compiled() const {
550 return CodeCache::contains(destination());
551 }
552
|
82 // the next safepoint. Make sure that the CompiledICHolder* is
83 // marked for release at this point since it won't be identifiable
84 // once the entry point is overwritten.
85 InlineCacheBuffer::queue_for_release((CompiledICHolder*)_value->data());
86 }
87
88 if (TraceCompiledIC) {
89 tty->print(" ");
90 print_compiled_ic();
91 tty->print(" changing destination to " INTPTR_FORMAT, p2i(entry_point));
92 if (!is_optimized()) {
93 tty->print(" changing cached %s to " INTPTR_FORMAT, is_icholder ? "icholder" : "metadata", p2i((address)cache));
94 }
95 if (is_icstub) {
96 tty->print(" (icstub)");
97 }
98 tty->cr();
99 }
100
101 {
102 MutexLockerEx pl(SafepointSynchronize::is_at_safepoint() ? NULL : Patching_lock, Mutex::_no_safepoint_check_flag);
103 #ifdef ASSERT
104 CodeBlob* cb = CodeCache::find_blob_unsafe(_ic_call);
105 assert(cb != NULL && cb->is_nmethod(), "must be nmethod");
106 #endif
107 _ic_call->set_destination_mt_safe(entry_point);
108 }
109
110 if (is_optimized() || is_icstub) {
111 // Optimized call sites don't have a cache value and ICStub call
112 // sites only change the entry point. Changing the value in that
113 // case could lead to MT safety issues.
114 assert(cache == NULL, "must be null");
115 return;
116 }
117
118 if (cache == NULL) cache = (void*)Universe::non_oop_word();
119
120 _value->set_data((intptr_t)cache);
121 }
122
123
124 void CompiledIC::set_ic_destination(ICStub* stub) {
125 internal_set_ic_destination(stub->code_begin(), true, NULL, false);
126 }
127
128
512 } else {
513 // Use icholder entry
514 CompiledICHolder* holder = new CompiledICHolder(method(), receiver_klass());
515 info.set_icholder_entry(method()->get_c2i_unverified_entry(), holder);
516 }
517 }
518 assert(info.is_optimized() == is_optimized, "must agree");
519 }
520
521
522 bool CompiledIC::is_icholder_entry(address entry) {
523 CodeBlob* cb = CodeCache::find_blob_unsafe(entry);
524 return (cb != NULL && cb->is_adapter_blob());
525 }
526
527 // ----------------------------------------------------------------------------
528
529 void CompiledStaticCall::set_to_clean() {
530 assert (CompiledIC_lock->is_locked() || SafepointSynchronize::is_at_safepoint(), "mt unsafe call");
531 // Reset call site
532 MutexLockerEx pl(SafepointSynchronize::is_at_safepoint() ? NULL : Patching_lock, Mutex::_no_safepoint_check_flag);
533 #ifdef ASSERT
534 CodeBlob* cb = CodeCache::find_blob_unsafe(this);
535 assert(cb != NULL && cb->is_nmethod(), "must be nmethod");
536 #endif
537 set_destination_mt_safe(SharedRuntime::get_resolve_static_call_stub());
538
539 // Do not reset stub here: It is too expensive to call find_stub.
540 // Instead, rely on caller (nmethod::clear_inline_caches) to clear
541 // both the call and its stub.
542 }
543
544
545 bool CompiledStaticCall::is_clean() const {
546 return destination() == SharedRuntime::get_resolve_static_call_stub();
547 }
548
549 bool CompiledStaticCall::is_call_to_compiled() const {
550 return CodeCache::contains(destination());
551 }
552
|