src/hotspot/share/aot/aotCodeHeap.cpp
branchdatagramsocketimpl-branch
changeset 58678 9cf78a70fa4f
parent 55005 9b70ebd131b4
child 58679 9c3209ff7550
equal deleted inserted replaced
58677:13588c901957 58678:9cf78a70fa4f
    35 #include "jvmci/compilerRuntime.hpp"
    35 #include "jvmci/compilerRuntime.hpp"
    36 #include "jvmci/jvmciRuntime.hpp"
    36 #include "jvmci/jvmciRuntime.hpp"
    37 #include "memory/allocation.inline.hpp"
    37 #include "memory/allocation.inline.hpp"
    38 #include "memory/universe.hpp"
    38 #include "memory/universe.hpp"
    39 #include "oops/compressedOops.hpp"
    39 #include "oops/compressedOops.hpp"
       
    40 #include "oops/klass.inline.hpp"
    40 #include "oops/method.inline.hpp"
    41 #include "oops/method.inline.hpp"
    41 #include "runtime/deoptimization.hpp"
    42 #include "runtime/deoptimization.hpp"
    42 #include "runtime/handles.inline.hpp"
    43 #include "runtime/handles.inline.hpp"
    43 #include "runtime/os.hpp"
    44 #include "runtime/os.hpp"
    44 #include "runtime/safepointVerifiers.hpp"
    45 #include "runtime/safepointVerifiers.hpp"
   211 AOTLib::~AOTLib() {
   212 AOTLib::~AOTLib() {
   212   os::free((void*) _name);
   213   os::free((void*) _name);
   213 }
   214 }
   214 
   215 
   215 AOTCodeHeap::~AOTCodeHeap() {
   216 AOTCodeHeap::~AOTCodeHeap() {
   216   if (_classes != NULL) {
   217   FREE_C_HEAP_ARRAY(AOTClass, _classes);
   217     FREE_C_HEAP_ARRAY(AOTClass, _classes);
   218   FREE_C_HEAP_ARRAY(CodeToAMethod, _code_to_aot);
   218   }
       
   219   if (_code_to_aot != NULL) {
       
   220     FREE_C_HEAP_ARRAY(CodeToAMethod, _code_to_aot);
       
   221   }
       
   222 }
   219 }
   223 
   220 
   224 AOTLib::AOTLib(void* handle, const char* name, int dso_id) : _valid(true), _dl_handle(handle), _dso_id(dso_id) {
   221 AOTLib::AOTLib(void* handle, const char* name, int dso_id) : _valid(true), _dl_handle(handle), _dso_id(dso_id) {
   225   _name = (const char*) os::strdup(name);
   222   _name = (const char*) os::strdup(name);
   226 
   223 
   354   } else { // success
   351   } else { // success
   355     // Publish method
   352     // Publish method
   356 #ifdef TIERED
   353 #ifdef TIERED
   357     mh->set_aot_code(aot);
   354     mh->set_aot_code(aot);
   358 #endif
   355 #endif
   359     Method::set_code(mh, aot);
   356     {
       
   357       MutexLocker pl(CompiledMethod_lock, Mutex::_no_safepoint_check_flag);
       
   358       Method::set_code(mh, aot);
       
   359     }
   360     if (PrintAOT || (PrintCompilation && PrintAOT)) {
   360     if (PrintAOT || (PrintCompilation && PrintAOT)) {
   361       PauseNoSafepointVerifier pnsv(&nsv); // aot code is registered already
   361       PauseNoSafepointVerifier pnsv(&nsv); // aot code is registered already
   362       aot->print_on(tty, NULL);
   362       aot->print_on(tty, NULL);
   363     }
   363     }
   364     // Publish oop only after we are visible to CompiledMethodIterator
   364     // Publish oop only after we are visible to CompiledMethodIterator
   400     assert(code_id < _method_count, "sanity");
   400     assert(code_id < _method_count, "sanity");
   401     jlong* state_adr = &_method_state[code_id];
   401     jlong* state_adr = &_method_state[code_id];
   402     int len = Bytes::get_Java_u2((address)stub_name);
   402     int len = Bytes::get_Java_u2((address)stub_name);
   403     stub_name += 2;
   403     stub_name += 2;
   404     char* full_name = NEW_C_HEAP_ARRAY(char, len+5, mtCode);
   404     char* full_name = NEW_C_HEAP_ARRAY(char, len+5, mtCode);
   405     if (full_name == NULL) { // No memory?
       
   406       break;
       
   407     }
       
   408     memcpy(full_name, "AOT ", 4);
   405     memcpy(full_name, "AOT ", 4);
   409     memcpy(full_name+4, stub_name, len);
   406     memcpy(full_name+4, stub_name, len);
   410     full_name[len+4] = 0;
   407     full_name[len+4] = 0;
   411     guarantee(_code_to_aot[code_id]._state != invalid, "stub %s can't be invalidated", full_name);
   408     guarantee(_code_to_aot[code_id]._state != invalid, "stub %s can't be invalidated", full_name);
   412     AOTCompiledMethod* aot = new AOTCompiledMethod(entry, NULL, meta, metadata_table, metadata_size, state_adr, this, full_name, code_id, i);
   409     AOTCompiledMethod* aot = new AOTCompiledMethod(entry, NULL, meta, metadata_table, metadata_size, state_adr, this, full_name, code_id, i);
   531 
   528 
   532     SET_AOT_GLOBAL_SYMBOL_VALUE("_aot_stub_routines_aescrypt_encryptBlock", address, StubRoutines::_aescrypt_encryptBlock);
   529     SET_AOT_GLOBAL_SYMBOL_VALUE("_aot_stub_routines_aescrypt_encryptBlock", address, StubRoutines::_aescrypt_encryptBlock);
   533     SET_AOT_GLOBAL_SYMBOL_VALUE("_aot_stub_routines_aescrypt_decryptBlock", address, StubRoutines::_aescrypt_decryptBlock);
   530     SET_AOT_GLOBAL_SYMBOL_VALUE("_aot_stub_routines_aescrypt_decryptBlock", address, StubRoutines::_aescrypt_decryptBlock);
   534     SET_AOT_GLOBAL_SYMBOL_VALUE("_aot_stub_routines_cipherBlockChaining_encryptAESCrypt", address, StubRoutines::_cipherBlockChaining_encryptAESCrypt);
   531     SET_AOT_GLOBAL_SYMBOL_VALUE("_aot_stub_routines_cipherBlockChaining_encryptAESCrypt", address, StubRoutines::_cipherBlockChaining_encryptAESCrypt);
   535     SET_AOT_GLOBAL_SYMBOL_VALUE("_aot_stub_routines_cipherBlockChaining_decryptAESCrypt", address, StubRoutines::_cipherBlockChaining_decryptAESCrypt);
   532     SET_AOT_GLOBAL_SYMBOL_VALUE("_aot_stub_routines_cipherBlockChaining_decryptAESCrypt", address, StubRoutines::_cipherBlockChaining_decryptAESCrypt);
       
   533     SET_AOT_GLOBAL_SYMBOL_VALUE("_aot_stub_routines_electronicCodeBook_encryptAESCrypt", address, StubRoutines::_electronicCodeBook_encryptAESCrypt);
       
   534     SET_AOT_GLOBAL_SYMBOL_VALUE("_aot_stub_routines_electronicCodeBook_decryptAESCrypt", address, StubRoutines::_electronicCodeBook_decryptAESCrypt);
   536     SET_AOT_GLOBAL_SYMBOL_VALUE("_aot_stub_routines_update_bytes_crc32", address, StubRoutines::_updateBytesCRC32);
   535     SET_AOT_GLOBAL_SYMBOL_VALUE("_aot_stub_routines_update_bytes_crc32", address, StubRoutines::_updateBytesCRC32);
   537     SET_AOT_GLOBAL_SYMBOL_VALUE("_aot_stub_routines_crc_table_adr", address, StubRoutines::_crc_table_adr);
   536     SET_AOT_GLOBAL_SYMBOL_VALUE("_aot_stub_routines_crc_table_adr", address, StubRoutines::_crc_table_adr);
   538 
   537 
   539 
   538 
   540     SET_AOT_GLOBAL_SYMBOL_VALUE("_aot_stub_routines_sha1_implCompress", address, StubRoutines::_sha1_implCompress);
   539     SET_AOT_GLOBAL_SYMBOL_VALUE("_aot_stub_routines_sha1_implCompress", address, StubRoutines::_sha1_implCompress);