8180423: Remove flag UseRelocIndex
authorredestad
Wed, 17 May 2017 11:41:08 +0200
changeset 46469 f0f38f5ac34f
parent 46464 6432a858a220
child 46470 799dda2aaaf5
8180423: Remove flag UseRelocIndex Reviewed-by: kvn, thartmann
hotspot/src/share/vm/asm/codeBuffer.cpp
hotspot/src/share/vm/code/codeBlob.cpp
hotspot/src/share/vm/code/nmethod.cpp
hotspot/src/share/vm/code/relocInfo.cpp
hotspot/src/share/vm/code/relocInfo.hpp
hotspot/src/share/vm/runtime/globals.hpp
--- a/hotspot/src/share/vm/asm/codeBuffer.cpp	Tue May 16 19:36:55 2017 -0400
+++ b/hotspot/src/share/vm/asm/codeBuffer.cpp	Wed May 17 11:41:08 2017 +0200
@@ -623,9 +623,7 @@
 }
 
 csize_t CodeBuffer::total_relocation_size() const {
-  csize_t lsize = copy_relocations_to(NULL);  // dry run only
-  csize_t csize = total_content_size();
-  csize_t total = RelocIterator::locs_and_index_size(csize, lsize);
+  csize_t total = copy_relocations_to(NULL);  // dry run only
   return (csize_t) align_size_up(total, HeapWordSize);
 }
 
@@ -726,13 +724,6 @@
   //
   buf_offset = copy_relocations_to(buf, buf_limit, false);
 
-  // Account for index:
-  if (buf != NULL) {
-    RelocIterator::create_index(dest->relocation_begin(),
-                                buf_offset / sizeof(relocInfo),
-                                dest->relocation_end());
-  }
-
   return buf_offset;
 }
 
--- a/hotspot/src/share/vm/code/codeBlob.cpp	Tue May 16 19:36:55 2017 -0400
+++ b/hotspot/src/share/vm/code/codeBlob.cpp	Wed May 17 11:41:08 2017 +0200
@@ -131,14 +131,6 @@
   : CodeBlob(name, compiler_none, CodeBlobLayout((address) this, size, header_size, locs_size, size), frame_complete, 0, NULL, false /* caller_must_gc_arguments */)
 {
   assert(locs_size   == round_to(locs_size,   oopSize), "unaligned size");
-  assert(!UseRelocIndex, "no space allocated for reloc index yet");
-
-  // Note: If UseRelocIndex is enabled, there needs to be (at least) one
-  //       extra word for the relocation information, containing the reloc
-  //       index table length. Unfortunately, the reloc index table imple-
-  //       mentation is not easily understandable and thus it is not clear
-  //       what exactly the format is supposed to be. For now, we just turn
-  //       off the use of this table (gri 7/6/2000).
 }
 
 
--- a/hotspot/src/share/vm/code/nmethod.cpp	Tue May 16 19:36:55 2017 -0400
+++ b/hotspot/src/share/vm/code/nmethod.cpp	Wed May 17 11:41:08 2017 +0200
@@ -2357,26 +2357,6 @@
   tty->print_cr("relocations:");
   RelocIterator iter(this);
   iter.print();
-  if (UseRelocIndex) {
-    jint* index_end   = (jint*)relocation_end() - 1;
-    jint  index_size  = *index_end;
-    jint* index_start = (jint*)( (address)index_end - index_size );
-    tty->print_cr("    index @" INTPTR_FORMAT ": index_size=%d", p2i(index_start), index_size);
-    if (index_size > 0) {
-      jint* ip;
-      for (ip = index_start; ip+2 <= index_end; ip += 2)
-        tty->print_cr("  (%d %d) addr=" INTPTR_FORMAT " @" INTPTR_FORMAT,
-                      ip[0],
-                      ip[1],
-                      p2i(header_end()+ip[0]),
-                      p2i(relocation_begin()-1+ip[1]));
-      for (; ip < index_end; ip++)
-        tty->print_cr("  (%d ?)", ip[0]);
-      tty->print_cr("          @" INTPTR_FORMAT ": index_size=%d", p2i(ip), *ip);
-      ip++;
-      tty->print_cr("reloc_end @" INTPTR_FORMAT ":", p2i(ip));
-    }
-  }
 }
 
 
--- a/hotspot/src/share/vm/code/relocInfo.cpp	Tue May 16 19:36:55 2017 -0400
+++ b/hotspot/src/share/vm/code/relocInfo.cpp	Wed May 17 11:41:08 2017 +0200
@@ -191,139 +191,18 @@
 }
 
 
-static inline int num_cards(int code_size) {
-  return (code_size-1) / indexCardSize;
-}
-
-
-int RelocIterator::locs_and_index_size(int code_size, int locs_size) {
-  if (!UseRelocIndex)  return locs_size;   // no index
-  code_size = round_to(code_size, oopSize);
-  locs_size = round_to(locs_size, oopSize);
-  int index_size = num_cards(code_size) * sizeof(RelocIndexEntry);
-  // format of indexed relocs:
-  //   relocation_begin:   relocInfo ...
-  //   index:              (addr,reloc#) ...
-  //                       indexSize           :relocation_end
-  return locs_size + index_size + BytesPerInt;
-}
-
-
-void RelocIterator::create_index(relocInfo* dest_begin, int dest_count, relocInfo* dest_end) {
-  address relocation_begin = (address)dest_begin;
-  address relocation_end   = (address)dest_end;
-  int     total_size       = relocation_end - relocation_begin;
-  int     locs_size        = dest_count * sizeof(relocInfo);
-  if (!UseRelocIndex) {
-    Copy::fill_to_bytes(relocation_begin + locs_size, total_size-locs_size, 0);
-    return;
-  }
-  int     index_size       = total_size - locs_size - BytesPerInt;      // find out how much space is left
-  int     ncards           = index_size / sizeof(RelocIndexEntry);
-  assert(total_size == locs_size + index_size + BytesPerInt, "checkin'");
-  assert(index_size >= 0 && index_size % sizeof(RelocIndexEntry) == 0, "checkin'");
-  jint*   index_size_addr  = (jint*)relocation_end - 1;
-
-  assert(sizeof(jint) == BytesPerInt, "change this code");
-
-  *index_size_addr = index_size;
-  if (index_size != 0) {
-    assert(index_size > 0, "checkin'");
-
-    RelocIndexEntry* index = (RelocIndexEntry *)(relocation_begin + locs_size);
-    assert(index == (RelocIndexEntry*)index_size_addr - ncards, "checkin'");
-
-    // walk over the relocations, and fill in index entries as we go
-    RelocIterator iter;
-    const address    initial_addr    = NULL;
-    relocInfo* const initial_current = dest_begin - 1;  // biased by -1 like elsewhere
-
-    iter._code    = NULL;
-    iter._addr    = initial_addr;
-    iter._limit   = (address)(intptr_t)(ncards * indexCardSize);
-    iter._current = initial_current;
-    iter._end     = dest_begin + dest_count;
-
-    int i = 0;
-    address next_card_addr = (address)indexCardSize;
-    int addr_offset = 0;
-    int reloc_offset = 0;
-    while (true) {
-      // Checkpoint the iterator before advancing it.
-      addr_offset  = iter._addr    - initial_addr;
-      reloc_offset = iter._current - initial_current;
-      if (!iter.next())  break;
-      while (iter.addr() >= next_card_addr) {
-        index[i].addr_offset  = addr_offset;
-        index[i].reloc_offset = reloc_offset;
-        i++;
-        next_card_addr += indexCardSize;
-      }
-    }
-    while (i < ncards) {
-      index[i].addr_offset  = addr_offset;
-      index[i].reloc_offset = reloc_offset;
-      i++;
-    }
-  }
-}
-
-
 void RelocIterator::set_limits(address begin, address limit) {
-  int index_size = 0;
-  if (UseRelocIndex && _code != NULL) {
-    index_size = ((jint*)_end)[-1];
-    _end = (relocInfo*)( (address)_end - index_size - BytesPerInt );
-  }
-
   _limit = limit;
 
   // the limit affects this next stuff:
   if (begin != NULL) {
-#ifdef ASSERT
-    // In ASSERT mode we do not actually use the index, but simply
-    // check that its contents would have led us to the right answer.
-    address addrCheck = _addr;
-    relocInfo* infoCheck = _current;
-#endif // ASSERT
-    if (index_size > 0) {
-      // skip ahead
-      RelocIndexEntry* index       = (RelocIndexEntry*)_end;
-      RelocIndexEntry* index_limit = (RelocIndexEntry*)((address)index + index_size);
-      assert(_addr == _code->code_begin(), "_addr must be unadjusted");
-      int card = (begin - _addr) / indexCardSize;
-      if (card > 0) {
-        if (index+card-1 < index_limit)  index += card-1;
-        else                             index = index_limit - 1;
-#ifdef ASSERT
-        addrCheck = _addr    + index->addr_offset;
-        infoCheck = _current + index->reloc_offset;
-#else
-        // Advance the iterator immediately to the last valid state
-        // for the previous card.  Calling "next" will then advance
-        // it to the first item on the required card.
-        _addr    += index->addr_offset;
-        _current += index->reloc_offset;
-#endif // ASSERT
-      }
-    }
-
     relocInfo* backup;
     address    backup_addr;
     while (true) {
       backup      = _current;
       backup_addr = _addr;
-#ifdef ASSERT
-      if (backup == infoCheck) {
-        assert(backup_addr == addrCheck, "must match"); addrCheck = NULL; infoCheck = NULL;
-      } else {
-        assert(addrCheck == NULL || backup_addr <= addrCheck, "must not pass addrCheck");
-      }
-#endif // ASSERT
       if (!next() || addr() >= begin) break;
     }
-    assert(addrCheck == NULL || addrCheck == backup_addr, "must have matched addrCheck");
-    assert(infoCheck == NULL || infoCheck == backup,      "must have matched infoCheck");
     // At this point, either we are at the first matching record,
     // or else there is no such record, and !has_current().
     // In either case, revert to the immediatly preceding state.
--- a/hotspot/src/share/vm/code/relocInfo.hpp	Tue May 16 19:36:55 2017 -0400
+++ b/hotspot/src/share/vm/code/relocInfo.hpp	Wed May 17 11:41:08 2017 +0200
@@ -628,13 +628,6 @@
   // generic relocation accessor; switches on type to call the above
   Relocation* reloc();
 
-  // CodeBlob's have relocation indexes for faster random access:
-  static int locs_and_index_size(int code_size, int locs_size);
-  // Store an index into [dest_start+dest_count..dest_end).
-  // At dest_start[0..dest_count] is the actual relocation information.
-  // Everything else up to dest_end is free space for the index.
-  static void create_index(relocInfo* dest_begin, int dest_count, relocInfo* dest_end);
-
 #ifndef PRODUCT
  public:
   void print();
--- a/hotspot/src/share/vm/runtime/globals.hpp	Tue May 16 19:36:55 2017 -0400
+++ b/hotspot/src/share/vm/runtime/globals.hpp	Wed May 17 11:41:08 2017 +0200
@@ -2501,9 +2501,6 @@
   diagnostic(bool, StressCodeAging, false,                                  \
           "Start with counters compiled in")                                \
                                                                             \
-  develop(bool, UseRelocIndex, false,                                       \
-          "Use an index to speed random access to relocations")             \
-                                                                            \
   develop(bool, StressCodeBuffers, false,                                   \
           "Exercise code buffer expansion and other rare state changes")    \
                                                                             \