25 #include "precompiled.hpp" |
25 #include "precompiled.hpp" |
26 #include "classfile/systemDictionary.hpp" |
26 #include "classfile/systemDictionary.hpp" |
27 #include "classfile/vmSymbols.hpp" |
27 #include "classfile/vmSymbols.hpp" |
28 #include "code/codeCache.hpp" |
28 #include "code/codeCache.hpp" |
29 #include "code/compiledIC.hpp" |
29 #include "code/compiledIC.hpp" |
|
30 #include "code/codeCacheExtensions.hpp" |
30 #include "code/scopeDesc.hpp" |
31 #include "code/scopeDesc.hpp" |
31 #include "code/vtableStubs.hpp" |
32 #include "code/vtableStubs.hpp" |
32 #include "compiler/abstractCompiler.hpp" |
33 #include "compiler/abstractCompiler.hpp" |
33 #include "compiler/compileBroker.hpp" |
34 #include "compiler/compileBroker.hpp" |
34 #include "compiler/compilerOracle.hpp" |
35 #include "compiler/compilerOracle.hpp" |
2305 if (_buffer == NULL) // Initialize lazily |
2306 if (_buffer == NULL) // Initialize lazily |
2306 _buffer = BufferBlob::create("adapters", AdapterHandlerLibrary_size); |
2307 _buffer = BufferBlob::create("adapters", AdapterHandlerLibrary_size); |
2307 return _buffer; |
2308 return _buffer; |
2308 } |
2309 } |
2309 |
2310 |
|
2311 extern "C" void unexpected_adapter_call() { |
|
2312 ShouldNotCallThis(); |
|
2313 } |
|
2314 |
2310 void AdapterHandlerLibrary::initialize() { |
2315 void AdapterHandlerLibrary::initialize() { |
2311 if (_adapters != NULL) return; |
2316 if (_adapters != NULL) return; |
2312 _adapters = new AdapterHandlerTable(); |
2317 _adapters = new AdapterHandlerTable(); |
2313 |
2318 |
2314 // Create a special handler for abstract methods. Abstract methods |
2319 if (!CodeCacheExtensions::skip_compiler_support()) { |
2315 // are never compiled so an i2c entry is somewhat meaningless, but |
2320 // Create a special handler for abstract methods. Abstract methods |
2316 // throw AbstractMethodError just in case. |
2321 // are never compiled so an i2c entry is somewhat meaningless, but |
2317 // Pass wrong_method_abstract for the c2i transitions to return |
2322 // throw AbstractMethodError just in case. |
2318 // AbstractMethodError for invalid invocations. |
2323 // Pass wrong_method_abstract for the c2i transitions to return |
2319 address wrong_method_abstract = SharedRuntime::get_handle_wrong_method_abstract_stub(); |
2324 // AbstractMethodError for invalid invocations. |
2320 _abstract_method_handler = AdapterHandlerLibrary::new_entry(new AdapterFingerPrint(0, NULL), |
2325 address wrong_method_abstract = SharedRuntime::get_handle_wrong_method_abstract_stub(); |
2321 StubRoutines::throw_AbstractMethodError_entry(), |
2326 _abstract_method_handler = AdapterHandlerLibrary::new_entry(new AdapterFingerPrint(0, NULL), |
2322 wrong_method_abstract, wrong_method_abstract); |
2327 StubRoutines::throw_AbstractMethodError_entry(), |
|
2328 wrong_method_abstract, wrong_method_abstract); |
|
2329 } else { |
|
2330 // Adapters are not supposed to be used. |
|
2331 // Generate a special one to cause an error if used (and store this |
|
2332 // singleton in place of the useless _abstract_method_error adapter). |
|
2333 address entry = (address) &unexpected_adapter_call; |
|
2334 _abstract_method_handler = AdapterHandlerLibrary::new_entry(new AdapterFingerPrint(0, NULL), |
|
2335 entry, |
|
2336 entry, |
|
2337 entry); |
|
2338 |
|
2339 } |
2323 } |
2340 } |
2324 |
2341 |
2325 AdapterHandlerEntry* AdapterHandlerLibrary::new_entry(AdapterFingerPrint* fingerprint, |
2342 AdapterHandlerEntry* AdapterHandlerLibrary::new_entry(AdapterFingerPrint* fingerprint, |
2326 address i2c_entry, |
2343 address i2c_entry, |
2327 address c2i_entry, |
2344 address c2i_entry, |
2343 AdapterFingerPrint* fingerprint = NULL; |
2360 AdapterFingerPrint* fingerprint = NULL; |
2344 { |
2361 { |
2345 MutexLocker mu(AdapterHandlerLibrary_lock); |
2362 MutexLocker mu(AdapterHandlerLibrary_lock); |
2346 // make sure data structure is initialized |
2363 // make sure data structure is initialized |
2347 initialize(); |
2364 initialize(); |
|
2365 |
|
2366 if (CodeCacheExtensions::skip_compiler_support()) { |
|
2367 // adapters are useless and should not be used, including the |
|
2368 // abstract_method_handler. However, some callers check that |
|
2369 // an adapter was installed. |
|
2370 // Return the singleton adapter, stored into _abstract_method_handler |
|
2371 // and modified to cause an error if we ever call it. |
|
2372 return _abstract_method_handler; |
|
2373 } |
2348 |
2374 |
2349 if (method->is_abstract()) { |
2375 if (method->is_abstract()) { |
2350 return _abstract_method_handler; |
2376 return _abstract_method_handler; |
2351 } |
2377 } |
2352 |
2378 |