< prev index next >

src/hotspot/share/code/codeBlob.cpp

Print this page
@@ -20,10 +20,11 @@
   * or visit www.oracle.com if you need additional information or have any
   * questions.
   *
   */
  
+ #include "code/aotCodeCache.hpp"
  #include "code/codeBlob.hpp"
  #include "code/codeCache.hpp"
  #include "code/relocInfo.hpp"
  #include "code/vtableStubs.hpp"
  #include "compiler/disassembler.hpp"

@@ -187,10 +188,16 @@
    assert(is_aligned(size,            oopSize), "unaligned size");
    assert(is_aligned(header_size,     oopSize), "unaligned size");
    assert(_mutable_data == blob_end(), "sanity");
  }
  
+ #ifdef ASSERT
+ CodeBlob::~CodeBlob() {
+   assert(_oop_maps == nullptr || AOTCodeCache::is_address_in_aot_cache((address)_oop_maps), "Not flushed");
+ }
+ #endif
+  
  void CodeBlob::restore_mutable_data(address reloc_data) {
    // Relocation data is now stored as part of the mutable data area; allocate it before copy relocations
    if (_mutable_data_size > 0) {
      _mutable_data = (address)os::malloc(_mutable_data_size, mtCode);
      if (_mutable_data == nullptr) {

@@ -211,11 +218,11 @@
      os::free(_mutable_data);
      _mutable_data = blob_end(); // Valid not null address
      _mutable_data_size = 0;
      _relocation_size = 0;
    }
-   if (_oop_maps != nullptr) {
+   if (_oop_maps != nullptr && !AOTCodeCache::is_address_in_aot_cache((address)_oop_maps)) {
      delete _oop_maps;
      _oop_maps = nullptr;
    }
    NOT_PRODUCT(_asm_remarks.clear());
    NOT_PRODUCT(_dbg_strings.clear());

@@ -244,12 +251,12 @@
  void CodeBlob::prepare_for_archiving_impl() {
    set_name(nullptr);
    _oop_maps = nullptr;
    _mutable_data = nullptr;
  #ifndef PRODUCT
-   asm_remarks().clear();
-   dbg_strings().clear();
+   asm_remarks().clear_ref();
+   dbg_strings().clear_ref();
  #endif /* PRODUCT */
  }
  
  void CodeBlob::prepare_for_archiving() {
    vptr(_kind)->prepare_for_archiving(this);

@@ -302,11 +309,10 @@
        blob = archived_blob->restore(code_cache_buffer,
                                      name,
                                      archived_reloc_data,
                                      archived_oop_maps);
        assert(blob != nullptr, "sanity check");
- 
        // Flush the code block
        ICache::invalidate_range(blob->code_begin(), blob->code_size());
        CodeCache::commit(blob); // Count adapters
      }
    }
< prev index next >