hotspot/src/share/vm/runtime/sharedRuntime.cpp
changeset 42664 29142a56c193
parent 42650 1f304d0c888b
child 46270 2e7898927798
child 45325 2cded43c8842
equal deleted inserted replaced
42663:2335df372367 42664:29142a56c193
    27 #include "classfile/stringTable.hpp"
    27 #include "classfile/stringTable.hpp"
    28 #include "classfile/systemDictionary.hpp"
    28 #include "classfile/systemDictionary.hpp"
    29 #include "classfile/vmSymbols.hpp"
    29 #include "classfile/vmSymbols.hpp"
    30 #include "code/codeCache.hpp"
    30 #include "code/codeCache.hpp"
    31 #include "code/compiledIC.hpp"
    31 #include "code/compiledIC.hpp"
    32 #include "code/codeCacheExtensions.hpp"
       
    33 #include "code/scopeDesc.hpp"
    32 #include "code/scopeDesc.hpp"
    34 #include "code/vtableStubs.hpp"
    33 #include "code/vtableStubs.hpp"
    35 #include "compiler/abstractCompiler.hpp"
    34 #include "compiler/abstractCompiler.hpp"
    36 #include "compiler/compileBroker.hpp"
    35 #include "compiler/compileBroker.hpp"
    37 #include "compiler/disassembler.hpp"
    36 #include "compiler/disassembler.hpp"
  2578 
  2577 
  2579 void AdapterHandlerLibrary::initialize() {
  2578 void AdapterHandlerLibrary::initialize() {
  2580   if (_adapters != NULL) return;
  2579   if (_adapters != NULL) return;
  2581   _adapters = new AdapterHandlerTable();
  2580   _adapters = new AdapterHandlerTable();
  2582 
  2581 
  2583   if (!CodeCacheExtensions::skip_compiler_support()) {
  2582   // Create a special handler for abstract methods.  Abstract methods
  2584     // Create a special handler for abstract methods.  Abstract methods
  2583   // are never compiled so an i2c entry is somewhat meaningless, but
  2585     // are never compiled so an i2c entry is somewhat meaningless, but
  2584   // throw AbstractMethodError just in case.
  2586     // throw AbstractMethodError just in case.
  2585   // Pass wrong_method_abstract for the c2i transitions to return
  2587     // Pass wrong_method_abstract for the c2i transitions to return
  2586   // AbstractMethodError for invalid invocations.
  2588     // AbstractMethodError for invalid invocations.
  2587   address wrong_method_abstract = SharedRuntime::get_handle_wrong_method_abstract_stub();
  2589     address wrong_method_abstract = SharedRuntime::get_handle_wrong_method_abstract_stub();
  2588   _abstract_method_handler = AdapterHandlerLibrary::new_entry(new AdapterFingerPrint(0, NULL),
  2590     _abstract_method_handler = AdapterHandlerLibrary::new_entry(new AdapterFingerPrint(0, NULL),
  2589                                                               StubRoutines::throw_AbstractMethodError_entry(),
  2591                                                                 StubRoutines::throw_AbstractMethodError_entry(),
  2590                                                               wrong_method_abstract, wrong_method_abstract);
  2592                                                                 wrong_method_abstract, wrong_method_abstract);
       
  2593   } else {
       
  2594     // Adapters are not supposed to be used.
       
  2595     // Generate a special one to cause an error if used (and store this
       
  2596     // singleton in place of the useless _abstract_method_error adapter).
       
  2597     address entry = (address) &unexpected_adapter_call;
       
  2598     _abstract_method_handler = AdapterHandlerLibrary::new_entry(new AdapterFingerPrint(0, NULL),
       
  2599                                                                 entry,
       
  2600                                                                 entry,
       
  2601                                                                 entry);
       
  2602 
       
  2603   }
       
  2604 }
  2591 }
  2605 
  2592 
  2606 AdapterHandlerEntry* AdapterHandlerLibrary::new_entry(AdapterFingerPrint* fingerprint,
  2593 AdapterHandlerEntry* AdapterHandlerLibrary::new_entry(AdapterFingerPrint* fingerprint,
  2607                                                       address i2c_entry,
  2594                                                       address i2c_entry,
  2608                                                       address c2i_entry,
  2595                                                       address c2i_entry,
  2648   AdapterFingerPrint* fingerprint = NULL;
  2635   AdapterFingerPrint* fingerprint = NULL;
  2649   {
  2636   {
  2650     MutexLocker mu(AdapterHandlerLibrary_lock);
  2637     MutexLocker mu(AdapterHandlerLibrary_lock);
  2651     // make sure data structure is initialized
  2638     // make sure data structure is initialized
  2652     initialize();
  2639     initialize();
  2653 
       
  2654     // during dump time, always generate adapters, even if the
       
  2655     // compiler has been turned off.
       
  2656     if (!DumpSharedSpaces && CodeCacheExtensions::skip_compiler_support()) {
       
  2657       // adapters are useless and should not be used, including the
       
  2658       // abstract_method_handler. However, some callers check that
       
  2659       // an adapter was installed.
       
  2660       // Return the singleton adapter, stored into _abstract_method_handler
       
  2661       // and modified to cause an error if we ever call it.
       
  2662       return _abstract_method_handler;
       
  2663     }
       
  2664 
  2640 
  2665     if (method->is_abstract()) {
  2641     if (method->is_abstract()) {
  2666       return _abstract_method_handler;
  2642       return _abstract_method_handler;
  2667     }
  2643     }
  2668 
  2644