src/hotspot/share/runtime/stubRoutines.cpp
branchdatagramsocketimpl-branch
changeset 58678 9cf78a70fa4f
parent 53546 63eb7e38ce84
child 58679 9c3209ff7550
equal deleted inserted replaced
58677:13588c901957 58678:9cf78a70fa4f
    22  *
    22  *
    23  */
    23  */
    24 
    24 
    25 #include "precompiled.hpp"
    25 #include "precompiled.hpp"
    26 #include "asm/codeBuffer.hpp"
    26 #include "asm/codeBuffer.hpp"
       
    27 #include "asm/macroAssembler.inline.hpp"
    27 #include "memory/resourceArea.hpp"
    28 #include "memory/resourceArea.hpp"
    28 #include "oops/access.inline.hpp"
    29 #include "oops/access.inline.hpp"
    29 #include "oops/oop.inline.hpp"
    30 #include "oops/oop.inline.hpp"
    30 #include "runtime/interfaceSupport.inline.hpp"
    31 #include "runtime/interfaceSupport.inline.hpp"
    31 #include "runtime/timerTrace.hpp"
    32 #include "runtime/timerTrace.hpp"
    36 #include "utilities/vmError.hpp"
    37 #include "utilities/vmError.hpp"
    37 #ifdef COMPILER2
    38 #ifdef COMPILER2
    38 #include "opto/runtime.hpp"
    39 #include "opto/runtime.hpp"
    39 #endif
    40 #endif
    40 
    41 
       
    42 UnsafeCopyMemory* UnsafeCopyMemory::_table                      = NULL;
       
    43 int UnsafeCopyMemory::_table_length                             = 0;
       
    44 int UnsafeCopyMemory::_table_max_length                         = 0;
       
    45 address UnsafeCopyMemory::_common_exit_stub_pc                  = NULL;
    41 
    46 
    42 // Implementation of StubRoutines - for a description
    47 // Implementation of StubRoutines - for a description
    43 // of how to extend it, see the header file.
    48 // of how to extend it, see the header file.
    44 
    49 
    45 // Class Variables
    50 // Class Variables
   106 address StubRoutines::_arrayof_oop_disjoint_arraycopy    = CAST_FROM_FN_PTR(address, StubRoutines::arrayof_oop_copy);
   111 address StubRoutines::_arrayof_oop_disjoint_arraycopy    = CAST_FROM_FN_PTR(address, StubRoutines::arrayof_oop_copy);
   107 address StubRoutines::_arrayof_oop_disjoint_arraycopy_uninit  = CAST_FROM_FN_PTR(address, StubRoutines::arrayof_oop_copy_uninit);
   112 address StubRoutines::_arrayof_oop_disjoint_arraycopy_uninit  = CAST_FROM_FN_PTR(address, StubRoutines::arrayof_oop_copy_uninit);
   108 
   113 
   109 address StubRoutines::_zero_aligned_words = CAST_FROM_FN_PTR(address, Copy::zero_to_words);
   114 address StubRoutines::_zero_aligned_words = CAST_FROM_FN_PTR(address, Copy::zero_to_words);
   110 
   115 
       
   116 address StubRoutines::_data_cache_writeback              = NULL;
       
   117 address StubRoutines::_data_cache_writeback_sync         = NULL;
       
   118 
   111 address StubRoutines::_checkcast_arraycopy               = NULL;
   119 address StubRoutines::_checkcast_arraycopy               = NULL;
   112 address StubRoutines::_checkcast_arraycopy_uninit        = NULL;
   120 address StubRoutines::_checkcast_arraycopy_uninit        = NULL;
   113 address StubRoutines::_unsafe_arraycopy                  = NULL;
   121 address StubRoutines::_unsafe_arraycopy                  = NULL;
   114 address StubRoutines::_generic_arraycopy                 = NULL;
   122 address StubRoutines::_generic_arraycopy                 = NULL;
   115 
       
   116 
   123 
   117 address StubRoutines::_jbyte_fill;
   124 address StubRoutines::_jbyte_fill;
   118 address StubRoutines::_jshort_fill;
   125 address StubRoutines::_jshort_fill;
   119 address StubRoutines::_jint_fill;
   126 address StubRoutines::_jint_fill;
   120 address StubRoutines::_arrayof_jbyte_fill;
   127 address StubRoutines::_arrayof_jbyte_fill;
   123 
   130 
   124 address StubRoutines::_aescrypt_encryptBlock               = NULL;
   131 address StubRoutines::_aescrypt_encryptBlock               = NULL;
   125 address StubRoutines::_aescrypt_decryptBlock               = NULL;
   132 address StubRoutines::_aescrypt_decryptBlock               = NULL;
   126 address StubRoutines::_cipherBlockChaining_encryptAESCrypt = NULL;
   133 address StubRoutines::_cipherBlockChaining_encryptAESCrypt = NULL;
   127 address StubRoutines::_cipherBlockChaining_decryptAESCrypt = NULL;
   134 address StubRoutines::_cipherBlockChaining_decryptAESCrypt = NULL;
       
   135 address StubRoutines::_electronicCodeBook_encryptAESCrypt  = NULL;
       
   136 address StubRoutines::_electronicCodeBook_decryptAESCrypt  = NULL;
   128 address StubRoutines::_counterMode_AESCrypt                = NULL;
   137 address StubRoutines::_counterMode_AESCrypt                = NULL;
   129 address StubRoutines::_ghash_processBlocks                 = NULL;
   138 address StubRoutines::_ghash_processBlocks                 = NULL;
   130 address StubRoutines::_base64_encodeBlock                  = NULL;
   139 address StubRoutines::_base64_encodeBlock                  = NULL;
   131 
   140 
   132 address StubRoutines::_sha1_implCompress     = NULL;
   141 address StubRoutines::_sha1_implCompress     = NULL;
   174 // Note: to break cycle with universe initialization, stubs are generated in two phases.
   183 // Note: to break cycle with universe initialization, stubs are generated in two phases.
   175 // The first one generates stubs needed during universe init (e.g., _handle_must_compile_first_entry).
   184 // The first one generates stubs needed during universe init (e.g., _handle_must_compile_first_entry).
   176 // The second phase includes all other stubs (which may depend on universe being initialized.)
   185 // The second phase includes all other stubs (which may depend on universe being initialized.)
   177 
   186 
   178 extern void StubGenerator_generate(CodeBuffer* code, bool all); // only interface to generators
   187 extern void StubGenerator_generate(CodeBuffer* code, bool all); // only interface to generators
       
   188 
       
   189 void UnsafeCopyMemory::create_table(int max_size) {
       
   190   UnsafeCopyMemory::_table = new UnsafeCopyMemory[max_size];
       
   191   UnsafeCopyMemory::_table_max_length = max_size;
       
   192 }
       
   193 
       
   194 bool UnsafeCopyMemory::contains_pc(address pc) {
       
   195   for (int i = 0; i < UnsafeCopyMemory::_table_length; i++) {
       
   196     UnsafeCopyMemory* entry = &UnsafeCopyMemory::_table[i];
       
   197     if (pc >= entry->start_pc() && pc < entry->end_pc()) {
       
   198       return true;
       
   199     }
       
   200   }
       
   201   return false;
       
   202 }
       
   203 
       
   204 address UnsafeCopyMemory::page_error_continue_pc(address pc) {
       
   205   for (int i = 0; i < UnsafeCopyMemory::_table_length; i++) {
       
   206     UnsafeCopyMemory* entry = &UnsafeCopyMemory::_table[i];
       
   207     if (pc >= entry->start_pc() && pc < entry->end_pc()) {
       
   208       return entry->error_exit_pc();
       
   209     }
       
   210   }
       
   211   return NULL;
       
   212 }
   179 
   213 
   180 void StubRoutines::initialize1() {
   214 void StubRoutines::initialize1() {
   181   if (_code1 == NULL) {
   215   if (_code1 == NULL) {
   182     ResourceMark rm;
   216     ResourceMark rm;
   183     TraceTime timer("StubRoutines generation 1", TRACETIME_LOG(Info, startuptime));
   217     TraceTime timer("StubRoutines generation 1", TRACETIME_LOG(Info, startuptime));
   567   }
   601   }
   568 
   602 
   569 #undef RETURN_STUB
   603 #undef RETURN_STUB
   570 #undef RETURN_STUB_PARM
   604 #undef RETURN_STUB_PARM
   571 }
   605 }
       
   606 
       
   607 UnsafeCopyMemoryMark::UnsafeCopyMemoryMark(StubCodeGenerator* cgen, bool add_entry, bool continue_at_scope_end, address error_exit_pc) {
       
   608   _cgen = cgen;
       
   609   _ucm_entry = NULL;
       
   610   if (add_entry) {
       
   611     address err_exit_pc = NULL;
       
   612     if (!continue_at_scope_end) {
       
   613       err_exit_pc = error_exit_pc != NULL ? error_exit_pc : UnsafeCopyMemory::common_exit_stub_pc();
       
   614     }
       
   615     assert(err_exit_pc != NULL || continue_at_scope_end, "error exit not set");
       
   616     _ucm_entry = UnsafeCopyMemory::add_to_table(_cgen->assembler()->pc(), NULL, err_exit_pc);
       
   617   }
       
   618 }
       
   619 
       
   620 UnsafeCopyMemoryMark::~UnsafeCopyMemoryMark() {
       
   621   if (_ucm_entry != NULL) {
       
   622     _ucm_entry->set_end_pc(_cgen->assembler()->pc());
       
   623     if (_ucm_entry->error_exit_pc() == NULL) {
       
   624       _ucm_entry->set_error_exit_pc(_cgen->assembler()->pc());
       
   625     }
       
   626   }
       
   627 }