comparison src/share/vm/code/compiledIC.cpp @ 15046:5c71dcf0915d

use hotspot static stubs for call sites
author Tom Rodriguez <tom.rodriguez@oracle.com>
date Wed, 09 Apr 2014 16:33:37 -0700
parents 02f27ecb4f3a
children d1b948f9db34
comparison
equal deleted inserted replaced
15045:0286888f792b 15046:5c71dcf0915d
74 assert(!is_icholder || is_icholder_entry(entry_point), "must be"); 74 assert(!is_icholder || is_icholder_entry(entry_point), "must be");
75 75
76 // Don't use ic_destination for this test since that forwards 76 // Don't use ic_destination for this test since that forwards
77 // through ICBuffer instead of returning the actual current state of 77 // through ICBuffer instead of returning the actual current state of
78 // the CompiledIC. 78 // the CompiledIC.
79 if (is_icholder_entry(_ic_call->destination()) GRAAL_ONLY(&& _value != NULL)) { 79 if (is_icholder_entry(_ic_call->destination())) {
80 // When patching for the ICStub case the cached value isn't 80 // When patching for the ICStub case the cached value isn't
81 // overwritten until the ICStub copied into the CompiledIC during 81 // overwritten until the ICStub copied into the CompiledIC during
82 // the next safepoint. Make sure that the CompiledICHolder* is 82 // the next safepoint. Make sure that the CompiledICHolder* is
83 // marked for release at this point since it won't be identifiable 83 // marked for release at this point since it won't be identifiable
84 // once the entry point is overwritten. 84 // once the entry point is overwritten.
104 CodeBlob* cb = CodeCache::find_blob_unsafe(_ic_call); 104 CodeBlob* cb = CodeCache::find_blob_unsafe(_ic_call);
105 assert(cb != NULL && cb->is_nmethod(), "must be nmethod"); 105 assert(cb != NULL && cb->is_nmethod(), "must be nmethod");
106 #endif 106 #endif
107 _ic_call->set_destination_mt_safe(entry_point); 107 _ic_call->set_destination_mt_safe(entry_point);
108 } 108 }
109
110 #ifdef GRAAL
111 if (_value == NULL) {
112 // Can happen when Graal converted a virtual call into an invoke special based on static analysis.
113 return;
114 }
115 #endif
116 109
117 if (is_optimized() || is_icstub) { 110 if (is_optimized() || is_icstub) {
118 // Optimized call sites don't have a cache value and ICStub call 111 // Optimized call sites don't have a cache value and ICStub call
119 // sites only change the entry point. Changing the value in that 112 // sites only change the entry point. Changing the value in that
120 // case could lead to MT safety issues. 113 // case could lead to MT safety issues.
236 // Check that the cached_value is a klass for non-optimized monomorphic calls 229 // Check that the cached_value is a klass for non-optimized monomorphic calls
237 // This assertion is invalid for compiler1: a call that does not look optimized (no static stub) can be used 230 // This assertion is invalid for compiler1: a call that does not look optimized (no static stub) can be used
238 // for calling directly to vep without using the inline cache (i.e., cached_value == NULL) 231 // for calling directly to vep without using the inline cache (i.e., cached_value == NULL)
239 #ifdef ASSERT 232 #ifdef ASSERT
240 CodeBlob* caller = CodeCache::find_blob_unsafe(instruction_address()); 233 CodeBlob* caller = CodeCache::find_blob_unsafe(instruction_address());
241 bool is_c1_or_graal_method = caller->is_compiled_by_c1() || caller->is_compiled_by_graal(); 234 bool is_c1_method = caller->is_compiled_by_c1();
242 assert( is_c1_or_graal_method || 235 assert( is_c1_method ||
243 !is_monomorphic || 236 !is_monomorphic ||
244 is_optimized() || 237 is_optimized() ||
245 (cached_metadata() != NULL && cached_metadata()->is_klass()), "sanity check"); 238 (cached_metadata() != NULL && cached_metadata()->is_klass()), "sanity check");
246 #endif // ASSERT 239 #endif // ASSERT
247 return is_monomorphic; 240 return is_monomorphic;
262 assert(!is_call_to_interpreted || (is_icholder_call() && cached_icholder() != NULL), "sanity check"); 255 assert(!is_call_to_interpreted || (is_icholder_call() && cached_icholder() != NULL), "sanity check");
263 } else { 256 } else {
264 // Check if we are calling into our own codeblob (i.e., to a stub) 257 // Check if we are calling into our own codeblob (i.e., to a stub)
265 CodeBlob* cb = CodeCache::find_blob(_ic_call->instruction_address()); 258 CodeBlob* cb = CodeCache::find_blob(_ic_call->instruction_address());
266 address dest = ic_destination(); 259 address dest = ic_destination();
267 #ifndef GRAAL
268 #ifdef ASSERT 260 #ifdef ASSERT
269 { 261 {
270 CodeBlob* db = CodeCache::find_blob_unsafe(dest); 262 CodeBlob* db = CodeCache::find_blob_unsafe(dest);
271 assert(!db->is_adapter_blob(), "must use stub!"); 263 assert(!db->is_adapter_blob(), "must use stub!");
272 } 264 }
273 #endif /* ASSERT */ 265 #endif /* ASSERT */
274 #endif
275 is_call_to_interpreted = cb->contains(dest); 266 is_call_to_interpreted = cb->contains(dest);
276 } 267 }
277 return is_call_to_interpreted; 268 return is_call_to_interpreted;
278 } 269 }
279 270