< prev index next >

src/hotspot/share/code/relocInfo.cpp

Print this page
*** 21,14 ***
--- 21,16 ---
   * questions.
   *
   */
  
  #include "precompiled.hpp"
+ #include "ci/ciUtilities.hpp"
  #include "code/codeCache.hpp"
  #include "code/compiledIC.hpp"
  #include "code/nmethod.hpp"
  #include "code/relocInfo.hpp"
+ #include "code/SCCache.hpp"
  #include "memory/resourceArea.hpp"
  #include "memory/universe.hpp"
  #include "oops/compressedOops.inline.hpp"
  #include "oops/oop.inline.hpp"
  #include "runtime/flags/flagSetting.hpp"

*** 172,10 ***
--- 174,13 ---
    set_limits(begin, limit);
  }
  
  bool RelocIterator::addr_in_const() const {
    const int n = CodeBuffer::SECT_CONSTS;
+   if (_section_start[n] == nullptr) {
+     return false;
+   }
    return section_start(n) <= addr() && addr() < section_end(n);
  }
  
  
  void RelocIterator::set_limits(address begin, address limit) {

*** 475,23 ***
  void trampoline_stub_Relocation::unpack_data() {
    address base = binding()->section_start(CodeBuffer::SECT_INSTS);
    _owner = address_from_scaled_offset(unpack_1_int(), base);
  }
  
! void external_word_Relocation::pack_data_to(CodeSection* dest) {
-   short* p = (short*) dest->locs_end();
  #ifndef _LP64
!   p = pack_1_int_to(p, (int32_t) (intptr_t)_target);
  #else
    jlong t = (jlong) _target;
    int32_t lo = low(t);
    int32_t hi = high(t);
!   p = pack_2_ints_to(p, lo, hi);
  #endif /* _LP64 */
-   dest->set_locs_end((relocInfo*) p);
  }
  
  
  void external_word_Relocation::unpack_data() {
  #ifndef _LP64
    _target = (address) (intptr_t)unpack_1_int();
  #else
--- 480,25 ---
  void trampoline_stub_Relocation::unpack_data() {
    address base = binding()->section_start(CodeBuffer::SECT_INSTS);
    _owner = address_from_scaled_offset(unpack_1_int(), base);
  }
  
! short* external_word_Relocation::pack_data_to(short* p) {
  #ifndef _LP64
!   return pack_1_int_to(p, (int32_t) (intptr_t)_target);
  #else
    jlong t = (jlong) _target;
    int32_t lo = low(t);
    int32_t hi = high(t);
!   return pack_2_ints_to(p, lo, hi);
  #endif /* _LP64 */
  }
  
+ void external_word_Relocation::pack_data_to(CodeSection* dest) {
+   short* p = (short*) dest->locs_end();
+   dest->set_locs_end((relocInfo*)pack_data_to(p));
+ }
  
  void external_word_Relocation::unpack_data() {
  #ifndef _LP64
    _target = (address) (intptr_t)unpack_1_int();
  #else

*** 763,10 ***
--- 770,18 ---
      set_value(_target);
    }
    // If target is nullptr, this is  an absolute embedded reference to an external
    // location, which means  there is nothing to fix here.  In either case, the
    // resulting target should be an "external" address.
+ #ifdef ASSERT
+   if (SCCache::is_on()) {
+     // SCA needs relocation info for card table base which may point to CodeCache
+     if (is_card_table_address(target())) {
+       return;
+     }
+   }
+ #endif
    postcond(src->section_index_of(target()) == CodeBuffer::SECT_NONE);
    postcond(dest->section_index_of(target()) == CodeBuffer::SECT_NONE);
  }
  
  

*** 853,12 ***
        if (code() != nullptr || r->oop_is_immediate()) {
          oop_addr  = r->oop_addr();
          raw_oop   = *oop_addr;
          oop_value = r->oop_value();
        }
!       tty->print(" | [oop_addr=" INTPTR_FORMAT " *=" INTPTR_FORMAT " offset=%d]",
!                  p2i(oop_addr), p2i(raw_oop), r->offset());
        // Do not print the oop by default--we want this routine to
        // work even during GC or other inconvenient times.
        if (WizardMode && oop_value != nullptr) {
          tty->print("oop_value=" INTPTR_FORMAT ": ", p2i(oop_value));
          if (oopDesc::is_oop(oop_value)) {
--- 868,12 ---
        if (code() != nullptr || r->oop_is_immediate()) {
          oop_addr  = r->oop_addr();
          raw_oop   = *oop_addr;
          oop_value = r->oop_value();
        }
!       tty->print(" | [oop_addr=" INTPTR_FORMAT " *=" INTPTR_FORMAT " index=%d offset=%d]",
!                  p2i(oop_addr), p2i(raw_oop), r->oop_index(), r->offset());
        // Do not print the oop by default--we want this routine to
        // work even during GC or other inconvenient times.
        if (WizardMode && oop_value != nullptr) {
          tty->print("oop_value=" INTPTR_FORMAT ": ", p2i(oop_value));
          if (oopDesc::is_oop(oop_value)) {

*** 876,12 ***
        if (code() != nullptr || r->metadata_is_immediate()) {
          metadata_addr  = r->metadata_addr();
          raw_metadata   = *metadata_addr;
          metadata_value = r->metadata_value();
        }
!       tty->print(" | [metadata_addr=" INTPTR_FORMAT " *=" INTPTR_FORMAT " offset=%d]",
!                  p2i(metadata_addr), p2i(raw_metadata), r->offset());
        if (metadata_value != nullptr) {
          tty->print("metadata_value=" INTPTR_FORMAT ": ", p2i(metadata_value));
          metadata_value->print_value_on(tty);
        }
        break;
--- 891,12 ---
        if (code() != nullptr || r->metadata_is_immediate()) {
          metadata_addr  = r->metadata_addr();
          raw_metadata   = *metadata_addr;
          metadata_value = r->metadata_value();
        }
!       tty->print(" | [metadata_addr=" INTPTR_FORMAT " *=" INTPTR_FORMAT " index=%d offset=%d]",
!                  p2i(metadata_addr), p2i(raw_metadata), r->metadata_index(), r->offset());
        if (metadata_value != nullptr) {
          tty->print("metadata_value=" INTPTR_FORMAT ": ", p2i(metadata_value));
          metadata_value->print_value_on(tty);
        }
        break;

*** 897,24 ***
    case relocInfo::static_call_type:
      {
        static_call_Relocation* r = (static_call_Relocation*) reloc();
        tty->print(" | [destination=" INTPTR_FORMAT " metadata=" INTPTR_FORMAT "]",
                   p2i(r->destination()), p2i(r->method_value()));
        break;
      }
    case relocInfo::runtime_call_type:
    case relocInfo::runtime_call_w_cp_type:
      {
        CallRelocation* r = (CallRelocation*) reloc();
!       tty->print(" | [destination=" INTPTR_FORMAT "]", p2i(r->destination()));
        break;
      }
    case relocInfo::virtual_call_type:
      {
        virtual_call_Relocation* r = (virtual_call_Relocation*) reloc();
        tty->print(" | [destination=" INTPTR_FORMAT " cached_value=" INTPTR_FORMAT " metadata=" INTPTR_FORMAT "]",
                   p2i(r->destination()), p2i(r->cached_value()), p2i(r->method_value()));
        break;
      }
    case relocInfo::static_stub_type:
      {
        static_stub_Relocation* r = (static_stub_Relocation*) reloc();
--- 912,58 ---
    case relocInfo::static_call_type:
      {
        static_call_Relocation* r = (static_call_Relocation*) reloc();
        tty->print(" | [destination=" INTPTR_FORMAT " metadata=" INTPTR_FORMAT "]",
                   p2i(r->destination()), p2i(r->method_value()));
+       CodeBlob* cb = CodeCache::find_blob(r->destination());
+       if (cb != nullptr) {
+         tty->print(" Blob::%s", cb->name());
+       }
        break;
      }
    case relocInfo::runtime_call_type:
    case relocInfo::runtime_call_w_cp_type:
      {
        CallRelocation* r = (CallRelocation*) reloc();
!       address dest = r->destination();
+       tty->print(" | [destination=" INTPTR_FORMAT "]", p2i(dest));
+       if (StubRoutines::contains(dest)) {
+         StubCodeDesc* desc = StubCodeDesc::desc_for(dest);
+         if (desc == nullptr) {
+           desc = StubCodeDesc::desc_for(dest + frame::pc_return_offset);
+         }
+         if (desc != nullptr) {
+           tty->print(" Stub::%s", desc->name());
+         }
+       } else {
+         CodeBlob* cb = CodeCache::find_blob(dest);
+         if (cb != nullptr) {
+           tty->print(" Blob::%s", cb->name());
+         } else {
+           ResourceMark rm;
+           const int buflen = 1024;
+           char* buf = NEW_RESOURCE_ARRAY(char, buflen);
+           int offset;
+           if (os::dll_address_to_function_name(dest, buf, buflen, &offset)) {
+             tty->print(" %s", buf);
+             if (offset != 0) {
+               tty->print("+%d", offset);
+             }
+           }
+         }
+       }
        break;
      }
    case relocInfo::virtual_call_type:
      {
        virtual_call_Relocation* r = (virtual_call_Relocation*) reloc();
        tty->print(" | [destination=" INTPTR_FORMAT " cached_value=" INTPTR_FORMAT " metadata=" INTPTR_FORMAT "]",
                   p2i(r->destination()), p2i(r->cached_value()), p2i(r->method_value()));
+       CodeBlob* cb = CodeCache::find_blob(r->destination());
+       if (cb != nullptr) {
+         tty->print(" Blob::%s", cb->name());
+       }
        break;
      }
    case relocInfo::static_stub_type:
      {
        static_stub_Relocation* r = (static_stub_Relocation*) reloc();

*** 930,10 ***
--- 979,14 ---
    case relocInfo::opt_virtual_call_type:
      {
        opt_virtual_call_Relocation* r = (opt_virtual_call_Relocation*) reloc();
        tty->print(" | [destination=" INTPTR_FORMAT " metadata=" INTPTR_FORMAT "]",
                   p2i(r->destination()), p2i(r->method_value()));
+       CodeBlob* cb = CodeCache::find_blob(r->destination());
+       if (cb != nullptr) {
+         tty->print(" Blob::%s", cb->name());
+       }
        break;
      }
    default:
      break;
    }
< prev index next >