src/hotspot/share/code/relocInfo.cpp
author gziemski
Mon, 23 Apr 2018 14:51:16 -0500
changeset 49860 ca5216a2a2cc
parent 49857 31e07291ae29
child 49902 3661f31c6df4
permissions -rw-r--r--
8202151: [BACKOUT] Split globals.hpp to factor out the Flag class Summary: Backed out JDK-8081519 Reviewed-by: kvn
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
     1
/*
49860
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents: 49857
diff changeset
     2
 * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
489c9b5090e2 Initial load
duke
parents:
diff changeset
     4
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
489c9b5090e2 Initial load
duke
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
489c9b5090e2 Initial load
duke
parents:
diff changeset
     7
 * published by the Free Software Foundation.
489c9b5090e2 Initial load
duke
parents:
diff changeset
     8
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
489c9b5090e2 Initial load
duke
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
489c9b5090e2 Initial load
duke
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
489c9b5090e2 Initial load
duke
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
489c9b5090e2 Initial load
duke
parents:
diff changeset
    13
 * accompanied this code).
489c9b5090e2 Initial load
duke
parents:
diff changeset
    14
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
489c9b5090e2 Initial load
duke
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
489c9b5090e2 Initial load
duke
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    18
 *
5547
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 1
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 1
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 1
diff changeset
    21
 * questions.
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    22
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
    23
 */
489c9b5090e2 Initial load
duke
parents:
diff changeset
    24
7397
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 6432
diff changeset
    25
#include "precompiled.hpp"
14626
0cf4eccf130f 8003240: x86: move MacroAssembler into separate file
twisti
parents: 13728
diff changeset
    26
#include "code/codeCache.hpp"
7397
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 6432
diff changeset
    27
#include "code/compiledIC.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 6432
diff changeset
    28
#include "code/nmethod.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 6432
diff changeset
    29
#include "code/relocInfo.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 6432
diff changeset
    30
#include "memory/resourceArea.hpp"
49592
77fb0be7d19f 8199946: Move load/store and encode/decode out of oopDesc
stefank
parents: 47765
diff changeset
    31
#include "oops/compressedOops.inline.hpp"
7397
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 6432
diff changeset
    32
#include "runtime/stubCodeGenerator.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 6432
diff changeset
    33
#include "utilities/copy.hpp"
33160
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents: 24952
diff changeset
    34
#include "oops/oop.inline.hpp"
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    35
489c9b5090e2 Initial load
duke
parents:
diff changeset
    36
const RelocationHolder RelocationHolder::none; // its type is relocInfo::none
489c9b5090e2 Initial load
duke
parents:
diff changeset
    37
489c9b5090e2 Initial load
duke
parents:
diff changeset
    38
489c9b5090e2 Initial load
duke
parents:
diff changeset
    39
// Implementation of relocInfo
489c9b5090e2 Initial load
duke
parents:
diff changeset
    40
489c9b5090e2 Initial load
duke
parents:
diff changeset
    41
#ifdef ASSERT
489c9b5090e2 Initial load
duke
parents:
diff changeset
    42
relocInfo::relocInfo(relocType t, int off, int f) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    43
  assert(t != data_prefix_tag, "cannot build a prefix this way");
489c9b5090e2 Initial load
duke
parents:
diff changeset
    44
  assert((t & type_mask) == t, "wrong type");
489c9b5090e2 Initial load
duke
parents:
diff changeset
    45
  assert((f & format_mask) == f, "wrong format");
489c9b5090e2 Initial load
duke
parents:
diff changeset
    46
  assert(off >= 0 && off < offset_limit(), "offset out off bounds");
489c9b5090e2 Initial load
duke
parents:
diff changeset
    47
  assert((off & (offset_unit-1)) == 0, "misaligned offset");
489c9b5090e2 Initial load
duke
parents:
diff changeset
    48
  (*this) = relocInfo(t, RAW_BITS, off, f);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    49
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
    50
#endif
489c9b5090e2 Initial load
duke
parents:
diff changeset
    51
489c9b5090e2 Initial load
duke
parents:
diff changeset
    52
void relocInfo::initialize(CodeSection* dest, Relocation* reloc) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    53
  relocInfo* data = this+1;  // here's where the data might go
489c9b5090e2 Initial load
duke
parents:
diff changeset
    54
  dest->set_locs_end(data);  // sync end: the next call may read dest.locs_end
489c9b5090e2 Initial load
duke
parents:
diff changeset
    55
  reloc->pack_data_to(dest); // maybe write data into locs, advancing locs_end
489c9b5090e2 Initial load
duke
parents:
diff changeset
    56
  relocInfo* data_limit = dest->locs_end();
489c9b5090e2 Initial load
duke
parents:
diff changeset
    57
  if (data_limit > data) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    58
    relocInfo suffix = (*this);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    59
    data_limit = this->finish_prefix((short*) data_limit);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    60
    // Finish up with the suffix.  (Hack note: pack_data_to might edit this.)
489c9b5090e2 Initial load
duke
parents:
diff changeset
    61
    *data_limit = suffix;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    62
    dest->set_locs_end(data_limit+1);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    63
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    64
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
    65
489c9b5090e2 Initial load
duke
parents:
diff changeset
    66
relocInfo* relocInfo::finish_prefix(short* prefix_limit) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    67
  assert(sizeof(relocInfo) == sizeof(short), "change this code");
489c9b5090e2 Initial load
duke
parents:
diff changeset
    68
  short* p = (short*)(this+1);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    69
  assert(prefix_limit >= p, "must be a valid span of data");
489c9b5090e2 Initial load
duke
parents:
diff changeset
    70
  int plen = prefix_limit - p;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    71
  if (plen == 0) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    72
    debug_only(_value = 0xFFFF);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    73
    return this;                         // no data: remove self completely
489c9b5090e2 Initial load
duke
parents:
diff changeset
    74
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    75
  if (plen == 1 && fits_into_immediate(p[0])) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    76
    (*this) = immediate_relocInfo(p[0]); // move data inside self
489c9b5090e2 Initial load
duke
parents:
diff changeset
    77
    return this+1;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    78
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    79
  // cannot compact, so just update the count and return the limit pointer
489c9b5090e2 Initial load
duke
parents:
diff changeset
    80
  (*this) = prefix_relocInfo(plen);   // write new datalen
489c9b5090e2 Initial load
duke
parents:
diff changeset
    81
  assert(data() + datalen() == prefix_limit, "pointers must line up");
489c9b5090e2 Initial load
duke
parents:
diff changeset
    82
  return (relocInfo*)prefix_limit;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    83
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
    84
489c9b5090e2 Initial load
duke
parents:
diff changeset
    85
void relocInfo::set_type(relocType t) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    86
  int old_offset = addr_offset();
489c9b5090e2 Initial load
duke
parents:
diff changeset
    87
  int old_format = format();
489c9b5090e2 Initial load
duke
parents:
diff changeset
    88
  (*this) = relocInfo(t, old_offset, old_format);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    89
  assert(type()==(int)t, "sanity check");
489c9b5090e2 Initial load
duke
parents:
diff changeset
    90
  assert(addr_offset()==old_offset, "sanity check");
489c9b5090e2 Initial load
duke
parents:
diff changeset
    91
  assert(format()==old_format, "sanity check");
489c9b5090e2 Initial load
duke
parents:
diff changeset
    92
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
    93
38133
78b95467b9f1 8151956: Support non-continuous CodeBlobs in HotSpot
rbackman
parents: 36301
diff changeset
    94
nmethod* RelocIterator::code_as_nmethod() const {
78b95467b9f1 8151956: Support non-continuous CodeBlobs in HotSpot
rbackman
parents: 36301
diff changeset
    95
  return _code->as_nmethod();
78b95467b9f1 8151956: Support non-continuous CodeBlobs in HotSpot
rbackman
parents: 36301
diff changeset
    96
}
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    97
489c9b5090e2 Initial load
duke
parents:
diff changeset
    98
void relocInfo::set_format(int f) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    99
  int old_offset = addr_offset();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   100
  assert((f & format_mask) == f, "wrong format");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   101
  _value = (_value & ~(format_mask << offset_width)) | (f << offset_width);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   102
  assert(addr_offset()==old_offset, "sanity check");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   103
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   104
489c9b5090e2 Initial load
duke
parents:
diff changeset
   105
489c9b5090e2 Initial load
duke
parents:
diff changeset
   106
void relocInfo::change_reloc_info_for_address(RelocIterator *itr, address pc, relocType old_type, relocType new_type) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   107
  bool found = false;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   108
  while (itr->next() && !found) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   109
    if (itr->addr() == pc) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   110
      assert(itr->type()==old_type, "wrong relocInfo type found");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   111
      itr->current()->set_type(new_type);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   112
      found=true;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   113
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   114
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   115
  assert(found, "no relocInfo found for pc");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   116
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   117
489c9b5090e2 Initial load
duke
parents:
diff changeset
   118
489c9b5090e2 Initial load
duke
parents:
diff changeset
   119
void relocInfo::remove_reloc_info_for_address(RelocIterator *itr, address pc, relocType old_type) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   120
  change_reloc_info_for_address(itr, pc, old_type, none);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   121
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   122
489c9b5090e2 Initial load
duke
parents:
diff changeset
   123
489c9b5090e2 Initial load
duke
parents:
diff changeset
   124
// ----------------------------------------------------------------------------------------------------
489c9b5090e2 Initial load
duke
parents:
diff changeset
   125
// Implementation of RelocIterator
489c9b5090e2 Initial load
duke
parents:
diff changeset
   126
38133
78b95467b9f1 8151956: Support non-continuous CodeBlobs in HotSpot
rbackman
parents: 36301
diff changeset
   127
void RelocIterator::initialize(CompiledMethod* nm, address begin, address limit) {
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   128
  initialize_misc();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   129
5686
5435e77aa3df 6951083: oops and relocations should part of nmethod not CodeBlob
twisti
parents: 1
diff changeset
   130
  if (nm == NULL && begin != NULL) {
5435e77aa3df 6951083: oops and relocations should part of nmethod not CodeBlob
twisti
parents: 1
diff changeset
   131
    // allow nmethod to be deduced from beginning address
5435e77aa3df 6951083: oops and relocations should part of nmethod not CodeBlob
twisti
parents: 1
diff changeset
   132
    CodeBlob* cb = CodeCache::find_blob(begin);
45325
2cded43c8842 8180813: Null pointer dereference of CodeCache::find_blob() result
thartmann
parents: 42650
diff changeset
   133
    nm = (cb != NULL) ? cb->as_compiled_method_or_null() : NULL;
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   134
  }
45325
2cded43c8842 8180813: Null pointer dereference of CodeCache::find_blob() result
thartmann
parents: 42650
diff changeset
   135
  guarantee(nm != NULL, "must be able to deduce nmethod from other arguments");
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   136
5686
5435e77aa3df 6951083: oops and relocations should part of nmethod not CodeBlob
twisti
parents: 1
diff changeset
   137
  _code    = nm;
5435e77aa3df 6951083: oops and relocations should part of nmethod not CodeBlob
twisti
parents: 1
diff changeset
   138
  _current = nm->relocation_begin() - 1;
5435e77aa3df 6951083: oops and relocations should part of nmethod not CodeBlob
twisti
parents: 1
diff changeset
   139
  _end     = nm->relocation_end();
6432
d36e09b60939 6961697: move nmethod constants section before instruction section
twisti
parents: 6418
diff changeset
   140
  _addr    = nm->content_begin();
d36e09b60939 6961697: move nmethod constants section before instruction section
twisti
parents: 6418
diff changeset
   141
d36e09b60939 6961697: move nmethod constants section before instruction section
twisti
parents: 6418
diff changeset
   142
  // Initialize code sections.
d36e09b60939 6961697: move nmethod constants section before instruction section
twisti
parents: 6418
diff changeset
   143
  _section_start[CodeBuffer::SECT_CONSTS] = nm->consts_begin();
d36e09b60939 6961697: move nmethod constants section before instruction section
twisti
parents: 6418
diff changeset
   144
  _section_start[CodeBuffer::SECT_INSTS ] = nm->insts_begin() ;
d36e09b60939 6961697: move nmethod constants section before instruction section
twisti
parents: 6418
diff changeset
   145
  _section_start[CodeBuffer::SECT_STUBS ] = nm->stub_begin()  ;
d36e09b60939 6961697: move nmethod constants section before instruction section
twisti
parents: 6418
diff changeset
   146
d36e09b60939 6961697: move nmethod constants section before instruction section
twisti
parents: 6418
diff changeset
   147
  _section_end  [CodeBuffer::SECT_CONSTS] = nm->consts_end()  ;
d36e09b60939 6961697: move nmethod constants section before instruction section
twisti
parents: 6418
diff changeset
   148
  _section_end  [CodeBuffer::SECT_INSTS ] = nm->insts_end()   ;
d36e09b60939 6961697: move nmethod constants section before instruction section
twisti
parents: 6418
diff changeset
   149
  _section_end  [CodeBuffer::SECT_STUBS ] = nm->stub_end()    ;
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   150
489c9b5090e2 Initial load
duke
parents:
diff changeset
   151
  assert(!has_current(), "just checking");
6418
6671edbd230e 6978355: renaming for 6961697
twisti
parents: 5702
diff changeset
   152
  assert(begin == NULL || begin >= nm->code_begin(), "in bounds");
6671edbd230e 6978355: renaming for 6961697
twisti
parents: 5702
diff changeset
   153
  assert(limit == NULL || limit <= nm->code_end(),   "in bounds");
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   154
  set_limits(begin, limit);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   155
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   156
489c9b5090e2 Initial load
duke
parents:
diff changeset
   157
489c9b5090e2 Initial load
duke
parents:
diff changeset
   158
RelocIterator::RelocIterator(CodeSection* cs, address begin, address limit) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   159
  initialize_misc();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   160
489c9b5090e2 Initial load
duke
parents:
diff changeset
   161
  _current = cs->locs_start()-1;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   162
  _end     = cs->locs_end();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   163
  _addr    = cs->start();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   164
  _code    = NULL; // Not cb->blob();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   165
489c9b5090e2 Initial load
duke
parents:
diff changeset
   166
  CodeBuffer* cb = cs->outer();
6432
d36e09b60939 6961697: move nmethod constants section before instruction section
twisti
parents: 6418
diff changeset
   167
  assert((int) SECT_LIMIT == CodeBuffer::SECT_LIMIT, "my copy must be equal");
d36e09b60939 6961697: move nmethod constants section before instruction section
twisti
parents: 6418
diff changeset
   168
  for (int n = (int) CodeBuffer::SECT_FIRST; n < (int) CodeBuffer::SECT_LIMIT; n++) {
d36e09b60939 6961697: move nmethod constants section before instruction section
twisti
parents: 6418
diff changeset
   169
    CodeSection* cs = cb->code_section(n);
d36e09b60939 6961697: move nmethod constants section before instruction section
twisti
parents: 6418
diff changeset
   170
    _section_start[n] = cs->start();
d36e09b60939 6961697: move nmethod constants section before instruction section
twisti
parents: 6418
diff changeset
   171
    _section_end  [n] = cs->end();
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   172
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   173
489c9b5090e2 Initial load
duke
parents:
diff changeset
   174
  assert(!has_current(), "just checking");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   175
489c9b5090e2 Initial load
duke
parents:
diff changeset
   176
  assert(begin == NULL || begin >= cs->start(), "in bounds");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   177
  assert(limit == NULL || limit <= cs->end(),   "in bounds");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   178
  set_limits(begin, limit);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   179
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   180
489c9b5090e2 Initial load
duke
parents:
diff changeset
   181
489c9b5090e2 Initial load
duke
parents:
diff changeset
   182
enum { indexCardSize = 128 };
489c9b5090e2 Initial load
duke
parents:
diff changeset
   183
struct RelocIndexEntry {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   184
  jint addr_offset;          // offset from header_end of an addr()
489c9b5090e2 Initial load
duke
parents:
diff changeset
   185
  jint reloc_offset;         // offset from header_end of a relocInfo (prefix)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   186
};
489c9b5090e2 Initial load
duke
parents:
diff changeset
   187
489c9b5090e2 Initial load
duke
parents:
diff changeset
   188
6432
d36e09b60939 6961697: move nmethod constants section before instruction section
twisti
parents: 6418
diff changeset
   189
bool RelocIterator::addr_in_const() const {
d36e09b60939 6961697: move nmethod constants section before instruction section
twisti
parents: 6418
diff changeset
   190
  const int n = CodeBuffer::SECT_CONSTS;
d36e09b60939 6961697: move nmethod constants section before instruction section
twisti
parents: 6418
diff changeset
   191
  return section_start(n) <= addr() && addr() < section_end(n);
d36e09b60939 6961697: move nmethod constants section before instruction section
twisti
parents: 6418
diff changeset
   192
}
d36e09b60939 6961697: move nmethod constants section before instruction section
twisti
parents: 6418
diff changeset
   193
d36e09b60939 6961697: move nmethod constants section before instruction section
twisti
parents: 6418
diff changeset
   194
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   195
void RelocIterator::set_limits(address begin, address limit) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   196
  _limit = limit;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   197
489c9b5090e2 Initial load
duke
parents:
diff changeset
   198
  // the limit affects this next stuff:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   199
  if (begin != NULL) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   200
    relocInfo* backup;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   201
    address    backup_addr;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   202
    while (true) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   203
      backup      = _current;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   204
      backup_addr = _addr;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   205
      if (!next() || addr() >= begin) break;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   206
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   207
    // At this point, either we are at the first matching record,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   208
    // or else there is no such record, and !has_current().
489c9b5090e2 Initial load
duke
parents:
diff changeset
   209
    // In either case, revert to the immediatly preceding state.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   210
    _current = backup;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   211
    _addr    = backup_addr;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   212
    set_has_current(false);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   213
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   214
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   215
489c9b5090e2 Initial load
duke
parents:
diff changeset
   216
489c9b5090e2 Initial load
duke
parents:
diff changeset
   217
void RelocIterator::set_limit(address limit) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   218
  address code_end = (address)code() + code()->size();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   219
  assert(limit == NULL || limit <= code_end, "in bounds");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   220
  _limit = limit;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   221
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   222
489c9b5090e2 Initial load
duke
parents:
diff changeset
   223
// All the strange bit-encodings are in here.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   224
// The idea is to encode relocation data which are small integers
489c9b5090e2 Initial load
duke
parents:
diff changeset
   225
// very efficiently (a single extra halfword).  Larger chunks of
489c9b5090e2 Initial load
duke
parents:
diff changeset
   226
// relocation data need a halfword header to hold their size.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   227
void RelocIterator::advance_over_prefix() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   228
  if (_current->is_datalen()) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   229
    _data    = (short*) _current->data();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   230
    _datalen =          _current->datalen();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   231
    _current += _datalen + 1;   // skip the embedded data & header
489c9b5090e2 Initial load
duke
parents:
diff changeset
   232
  } else {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   233
    _databuf = _current->immediate();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   234
    _data = &_databuf;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   235
    _datalen = 1;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   236
    _current++;                 // skip the header
489c9b5090e2 Initial load
duke
parents:
diff changeset
   237
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   238
  // The client will see the following relocInfo, whatever that is.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   239
  // It is the reloc to which the preceding data applies.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   240
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   241
489c9b5090e2 Initial load
duke
parents:
diff changeset
   242
6432
d36e09b60939 6961697: move nmethod constants section before instruction section
twisti
parents: 6418
diff changeset
   243
void RelocIterator::initialize_misc() {
d36e09b60939 6961697: move nmethod constants section before instruction section
twisti
parents: 6418
diff changeset
   244
  set_has_current(false);
d36e09b60939 6961697: move nmethod constants section before instruction section
twisti
parents: 6418
diff changeset
   245
  for (int i = (int) CodeBuffer::SECT_FIRST; i < (int) CodeBuffer::SECT_LIMIT; i++) {
d36e09b60939 6961697: move nmethod constants section before instruction section
twisti
parents: 6418
diff changeset
   246
    _section_start[i] = NULL;  // these will be lazily computed, if needed
d36e09b60939 6961697: move nmethod constants section before instruction section
twisti
parents: 6418
diff changeset
   247
    _section_end  [i] = NULL;
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   248
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   249
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   250
489c9b5090e2 Initial load
duke
parents:
diff changeset
   251
489c9b5090e2 Initial load
duke
parents:
diff changeset
   252
Relocation* RelocIterator::reloc() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   253
  // (take the "switch" out-of-line)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   254
  relocInfo::relocType t = type();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   255
  if (false) {}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   256
  #define EACH_TYPE(name)                             \
489c9b5090e2 Initial load
duke
parents:
diff changeset
   257
  else if (t == relocInfo::name##_type) {             \
489c9b5090e2 Initial load
duke
parents:
diff changeset
   258
    return name##_reloc();                            \
489c9b5090e2 Initial load
duke
parents:
diff changeset
   259
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   260
  APPLY_TO_RELOCATIONS(EACH_TYPE);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   261
  #undef EACH_TYPE
489c9b5090e2 Initial load
duke
parents:
diff changeset
   262
  assert(t == relocInfo::none, "must be padding");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   263
  return new(_rh) Relocation();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   264
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   265
489c9b5090e2 Initial load
duke
parents:
diff changeset
   266
489c9b5090e2 Initial load
duke
parents:
diff changeset
   267
//////// Methods for flyweight Relocation types
489c9b5090e2 Initial load
duke
parents:
diff changeset
   268
489c9b5090e2 Initial load
duke
parents:
diff changeset
   269
489c9b5090e2 Initial load
duke
parents:
diff changeset
   270
RelocationHolder RelocationHolder::plus(int offset) const {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   271
  if (offset != 0) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   272
    switch (type()) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   273
    case relocInfo::none:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   274
      break;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   275
    case relocInfo::oop_type:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   276
      {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   277
        oop_Relocation* r = (oop_Relocation*)reloc();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   278
        return oop_Relocation::spec(r->oop_index(), r->offset() + offset);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   279
      }
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 9124
diff changeset
   280
    case relocInfo::metadata_type:
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 9124
diff changeset
   281
      {
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 9124
diff changeset
   282
        metadata_Relocation* r = (metadata_Relocation*)reloc();
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 9124
diff changeset
   283
        return metadata_Relocation::spec(r->metadata_index(), r->offset() + offset);
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 9124
diff changeset
   284
      }
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   285
    default:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   286
      ShouldNotReachHere();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   287
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   288
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   289
  return (*this);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   290
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   291
489c9b5090e2 Initial load
duke
parents:
diff changeset
   292
489c9b5090e2 Initial load
duke
parents:
diff changeset
   293
void Relocation::guarantee_size() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   294
  guarantee(false, "Make _relocbuf bigger!");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   295
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   296
489c9b5090e2 Initial load
duke
parents:
diff changeset
   297
    // some relocations can compute their own values
489c9b5090e2 Initial load
duke
parents:
diff changeset
   298
address Relocation::value() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   299
  ShouldNotReachHere();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   300
  return NULL;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   301
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   302
489c9b5090e2 Initial load
duke
parents:
diff changeset
   303
489c9b5090e2 Initial load
duke
parents:
diff changeset
   304
void Relocation::set_value(address x) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   305
  ShouldNotReachHere();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   306
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   307
33160
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents: 24952
diff changeset
   308
void Relocation::const_set_data_value(address x) {
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents: 24952
diff changeset
   309
#ifdef _LP64
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents: 24952
diff changeset
   310
  if (format() == relocInfo::narrow_oop_in_const) {
49592
77fb0be7d19f 8199946: Move load/store and encode/decode out of oopDesc
stefank
parents: 47765
diff changeset
   311
    *(narrowOop*)addr() = CompressedOops::encode((oop) x);
33160
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents: 24952
diff changeset
   312
  } else {
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents: 24952
diff changeset
   313
#endif
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents: 24952
diff changeset
   314
    *(address*)addr() = x;
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents: 24952
diff changeset
   315
#ifdef _LP64
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents: 24952
diff changeset
   316
  }
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents: 24952
diff changeset
   317
#endif
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents: 24952
diff changeset
   318
}
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents: 24952
diff changeset
   319
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents: 24952
diff changeset
   320
void Relocation::const_verify_data_value(address x) {
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents: 24952
diff changeset
   321
#ifdef _LP64
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents: 24952
diff changeset
   322
  if (format() == relocInfo::narrow_oop_in_const) {
49592
77fb0be7d19f 8199946: Move load/store and encode/decode out of oopDesc
stefank
parents: 47765
diff changeset
   323
    guarantee(*(narrowOop*)addr() == CompressedOops::encode((oop) x), "must agree");
33160
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents: 24952
diff changeset
   324
  } else {
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents: 24952
diff changeset
   325
#endif
33807
9f8b0f8a3f29 8140584: nmethod::oops_do_marking_epilogue always runs verification code
stefank
parents: 33198
diff changeset
   326
    guarantee(*(address*)addr() == x, "must agree");
33160
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents: 24952
diff changeset
   327
#ifdef _LP64
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents: 24952
diff changeset
   328
  }
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents: 24952
diff changeset
   329
#endif
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents: 24952
diff changeset
   330
}
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents: 24952
diff changeset
   331
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   332
489c9b5090e2 Initial load
duke
parents:
diff changeset
   333
RelocationHolder Relocation::spec_simple(relocInfo::relocType rtype) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   334
  if (rtype == relocInfo::none)  return RelocationHolder::none;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   335
  relocInfo ri = relocInfo(rtype, 0);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   336
  RelocIterator itr;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   337
  itr.set_current(ri);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   338
  itr.reloc();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   339
  return itr._rh;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   340
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   341
489c9b5090e2 Initial load
duke
parents:
diff changeset
   342
address Relocation::old_addr_for(address newa,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   343
                                 const CodeBuffer* src, CodeBuffer* dest) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   344
  int sect = dest->section_index_of(newa);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   345
  guarantee(sect != CodeBuffer::SECT_NONE, "lost track of this address");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   346
  address ostart = src->code_section(sect)->start();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   347
  address nstart = dest->code_section(sect)->start();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   348
  return ostart + (newa - nstart);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   349
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   350
489c9b5090e2 Initial load
duke
parents:
diff changeset
   351
address Relocation::new_addr_for(address olda,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   352
                                 const CodeBuffer* src, CodeBuffer* dest) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   353
  debug_only(const CodeBuffer* src0 = src);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   354
  int sect = CodeBuffer::SECT_NONE;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   355
  // Look for olda in the source buffer, and all previous incarnations
489c9b5090e2 Initial load
duke
parents:
diff changeset
   356
  // if the source buffer has been expanded.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   357
  for (; src != NULL; src = src->before_expand()) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   358
    sect = src->section_index_of(olda);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   359
    if (sect != CodeBuffer::SECT_NONE)  break;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   360
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   361
  guarantee(sect != CodeBuffer::SECT_NONE, "lost track of this address");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   362
  address ostart = src->code_section(sect)->start();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   363
  address nstart = dest->code_section(sect)->start();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   364
  return nstart + (olda - ostart);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   365
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   366
489c9b5090e2 Initial load
duke
parents:
diff changeset
   367
void Relocation::normalize_address(address& addr, const CodeSection* dest, bool allow_other_sections) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   368
  address addr0 = addr;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   369
  if (addr0 == NULL || dest->allocates2(addr0))  return;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   370
  CodeBuffer* cb = dest->outer();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   371
  addr = new_addr_for(addr0, cb, cb);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   372
  assert(allow_other_sections || dest->contains2(addr),
489c9b5090e2 Initial load
duke
parents:
diff changeset
   373
         "addr must be in required section");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   374
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   375
489c9b5090e2 Initial load
duke
parents:
diff changeset
   376
489c9b5090e2 Initial load
duke
parents:
diff changeset
   377
void CallRelocation::set_destination(address x) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   378
  pd_set_call_destination(x);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   379
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   380
489c9b5090e2 Initial load
duke
parents:
diff changeset
   381
void CallRelocation::fix_relocation_after_move(const CodeBuffer* src, CodeBuffer* dest) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   382
  // Usually a self-relative reference to an external routine.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   383
  // On some platforms, the reference is absolute (not self-relative).
489c9b5090e2 Initial load
duke
parents:
diff changeset
   384
  // The enhanced use of pd_call_destination sorts this all out.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   385
  address orig_addr = old_addr_for(addr(), src, dest);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   386
  address callee    = pd_call_destination(orig_addr);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   387
  // Reassert the callee address, this time in the new copy of the code.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   388
  pd_set_call_destination(callee);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   389
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   390
489c9b5090e2 Initial load
duke
parents:
diff changeset
   391
489c9b5090e2 Initial load
duke
parents:
diff changeset
   392
//// pack/unpack methods
489c9b5090e2 Initial load
duke
parents:
diff changeset
   393
489c9b5090e2 Initial load
duke
parents:
diff changeset
   394
void oop_Relocation::pack_data_to(CodeSection* dest) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   395
  short* p = (short*) dest->locs_end();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   396
  p = pack_2_ints_to(p, _oop_index, _offset);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   397
  dest->set_locs_end((relocInfo*) p);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   398
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   399
489c9b5090e2 Initial load
duke
parents:
diff changeset
   400
489c9b5090e2 Initial load
duke
parents:
diff changeset
   401
void oop_Relocation::unpack_data() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   402
  unpack_2_ints(_oop_index, _offset);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   403
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   404
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 9124
diff changeset
   405
void metadata_Relocation::pack_data_to(CodeSection* dest) {
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 9124
diff changeset
   406
  short* p = (short*) dest->locs_end();
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 9124
diff changeset
   407
  p = pack_2_ints_to(p, _metadata_index, _offset);
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 9124
diff changeset
   408
  dest->set_locs_end((relocInfo*) p);
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 9124
diff changeset
   409
}
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 9124
diff changeset
   410
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 9124
diff changeset
   411
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 9124
diff changeset
   412
void metadata_Relocation::unpack_data() {
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 9124
diff changeset
   413
  unpack_2_ints(_metadata_index, _offset);
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 9124
diff changeset
   414
}
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 9124
diff changeset
   415
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   416
489c9b5090e2 Initial load
duke
parents:
diff changeset
   417
void virtual_call_Relocation::pack_data_to(CodeSection* dest) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   418
  short*  p     = (short*) dest->locs_end();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   419
  address point =          dest->locs_point();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   420
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 9124
diff changeset
   421
  normalize_address(_cached_value, dest);
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 9124
diff changeset
   422
  jint x0 = scaled_offset_null_special(_cached_value, point);
35086
bbf32241d851 8072008: Emit direct call instead of linkTo* for recursive indy/MH.invoke* calls
vlivanov
parents: 33807
diff changeset
   423
  p = pack_2_ints_to(p, x0, _method_index);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   424
  dest->set_locs_end((relocInfo*) p);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   425
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   426
489c9b5090e2 Initial load
duke
parents:
diff changeset
   427
489c9b5090e2 Initial load
duke
parents:
diff changeset
   428
void virtual_call_Relocation::unpack_data() {
35086
bbf32241d851 8072008: Emit direct call instead of linkTo* for recursive indy/MH.invoke* calls
vlivanov
parents: 33807
diff changeset
   429
  jint x0 = 0;
bbf32241d851 8072008: Emit direct call instead of linkTo* for recursive indy/MH.invoke* calls
vlivanov
parents: 33807
diff changeset
   430
  unpack_2_ints(x0, _method_index);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   431
  address point = addr();
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 9124
diff changeset
   432
  _cached_value = x0==0? NULL: address_from_scaled_offset(x0, point);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   433
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   434
42064
a530dbabe64f 8167184: [s390] Extend relocations for pc-relative instructions.
goetz
parents: 42044
diff changeset
   435
void runtime_call_w_cp_Relocation::pack_data_to(CodeSection * dest) {
a530dbabe64f 8167184: [s390] Extend relocations for pc-relative instructions.
goetz
parents: 42044
diff changeset
   436
  short* p = pack_1_int_to((short *)dest->locs_end(), (jint)(_offset >> 2));
a530dbabe64f 8167184: [s390] Extend relocations for pc-relative instructions.
goetz
parents: 42044
diff changeset
   437
  dest->set_locs_end((relocInfo*) p);
a530dbabe64f 8167184: [s390] Extend relocations for pc-relative instructions.
goetz
parents: 42044
diff changeset
   438
}
a530dbabe64f 8167184: [s390] Extend relocations for pc-relative instructions.
goetz
parents: 42044
diff changeset
   439
a530dbabe64f 8167184: [s390] Extend relocations for pc-relative instructions.
goetz
parents: 42044
diff changeset
   440
void runtime_call_w_cp_Relocation::unpack_data() {
a530dbabe64f 8167184: [s390] Extend relocations for pc-relative instructions.
goetz
parents: 42044
diff changeset
   441
  _offset = unpack_1_int() << 2;
a530dbabe64f 8167184: [s390] Extend relocations for pc-relative instructions.
goetz
parents: 42044
diff changeset
   442
}
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   443
489c9b5090e2 Initial load
duke
parents:
diff changeset
   444
void static_stub_Relocation::pack_data_to(CodeSection* dest) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   445
  short* p = (short*) dest->locs_end();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   446
  CodeSection* insts = dest->outer()->insts();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   447
  normalize_address(_static_call, insts);
42650
1f304d0c888b 8171008: Integrate AOT compiler into JDK
kvn
parents: 42064
diff changeset
   448
  jint is_aot = _is_aot ? 1 : 0;
1f304d0c888b 8171008: Integrate AOT compiler into JDK
kvn
parents: 42064
diff changeset
   449
  p = pack_2_ints_to(p, scaled_offset(_static_call, insts->start()), is_aot);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   450
  dest->set_locs_end((relocInfo*) p);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   451
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   452
489c9b5090e2 Initial load
duke
parents:
diff changeset
   453
void static_stub_Relocation::unpack_data() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   454
  address base = binding()->section_start(CodeBuffer::SECT_INSTS);
42650
1f304d0c888b 8171008: Integrate AOT compiler into JDK
kvn
parents: 42064
diff changeset
   455
  jint offset;
1f304d0c888b 8171008: Integrate AOT compiler into JDK
kvn
parents: 42064
diff changeset
   456
  jint is_aot;
1f304d0c888b 8171008: Integrate AOT compiler into JDK
kvn
parents: 42064
diff changeset
   457
  unpack_2_ints(offset, is_aot);
33160
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents: 24952
diff changeset
   458
  _static_call = address_from_scaled_offset(offset, base);
42650
1f304d0c888b 8171008: Integrate AOT compiler into JDK
kvn
parents: 42064
diff changeset
   459
  _is_aot = (is_aot == 1);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   460
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   461
22813
422557569a6b 8016696: PPC64 (part 4): add relocation for trampoline stubs
goetz
parents: 18446
diff changeset
   462
void trampoline_stub_Relocation::pack_data_to(CodeSection* dest ) {
422557569a6b 8016696: PPC64 (part 4): add relocation for trampoline stubs
goetz
parents: 18446
diff changeset
   463
  short* p = (short*) dest->locs_end();
422557569a6b 8016696: PPC64 (part 4): add relocation for trampoline stubs
goetz
parents: 18446
diff changeset
   464
  CodeSection* insts = dest->outer()->insts();
422557569a6b 8016696: PPC64 (part 4): add relocation for trampoline stubs
goetz
parents: 18446
diff changeset
   465
  normalize_address(_owner, insts);
422557569a6b 8016696: PPC64 (part 4): add relocation for trampoline stubs
goetz
parents: 18446
diff changeset
   466
  p = pack_1_int_to(p, scaled_offset(_owner, insts->start()));
422557569a6b 8016696: PPC64 (part 4): add relocation for trampoline stubs
goetz
parents: 18446
diff changeset
   467
  dest->set_locs_end((relocInfo*) p);
422557569a6b 8016696: PPC64 (part 4): add relocation for trampoline stubs
goetz
parents: 18446
diff changeset
   468
}
422557569a6b 8016696: PPC64 (part 4): add relocation for trampoline stubs
goetz
parents: 18446
diff changeset
   469
422557569a6b 8016696: PPC64 (part 4): add relocation for trampoline stubs
goetz
parents: 18446
diff changeset
   470
void trampoline_stub_Relocation::unpack_data() {
422557569a6b 8016696: PPC64 (part 4): add relocation for trampoline stubs
goetz
parents: 18446
diff changeset
   471
  address base = binding()->section_start(CodeBuffer::SECT_INSTS);
422557569a6b 8016696: PPC64 (part 4): add relocation for trampoline stubs
goetz
parents: 18446
diff changeset
   472
  _owner = address_from_scaled_offset(unpack_1_int(), base);
422557569a6b 8016696: PPC64 (part 4): add relocation for trampoline stubs
goetz
parents: 18446
diff changeset
   473
}
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   474
489c9b5090e2 Initial load
duke
parents:
diff changeset
   475
void external_word_Relocation::pack_data_to(CodeSection* dest) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   476
  short* p = (short*) dest->locs_end();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   477
#ifndef _LP64
36301
cb578d8c6cba 8149741: Don't refer to stub entry points by index in external_word relocations
vlivanov
parents: 35086
diff changeset
   478
  p = pack_1_int_to(p, (int32_t) (intptr_t)_target);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   479
#else
36301
cb578d8c6cba 8149741: Don't refer to stub entry points by index in external_word relocations
vlivanov
parents: 35086
diff changeset
   480
  jlong t = (jlong) _target;
cb578d8c6cba 8149741: Don't refer to stub entry points by index in external_word relocations
vlivanov
parents: 35086
diff changeset
   481
  int32_t lo = low(t);
cb578d8c6cba 8149741: Don't refer to stub entry points by index in external_word relocations
vlivanov
parents: 35086
diff changeset
   482
  int32_t hi = high(t);
cb578d8c6cba 8149741: Don't refer to stub entry points by index in external_word relocations
vlivanov
parents: 35086
diff changeset
   483
  p = pack_2_ints_to(p, lo, hi);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   484
#endif /* _LP64 */
489c9b5090e2 Initial load
duke
parents:
diff changeset
   485
  dest->set_locs_end((relocInfo*) p);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   486
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   487
489c9b5090e2 Initial load
duke
parents:
diff changeset
   488
489c9b5090e2 Initial load
duke
parents:
diff changeset
   489
void external_word_Relocation::unpack_data() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   490
#ifndef _LP64
36301
cb578d8c6cba 8149741: Don't refer to stub entry points by index in external_word relocations
vlivanov
parents: 35086
diff changeset
   491
  _target = (address) (intptr_t)unpack_1_int();
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   492
#else
47765
b7c7428eaab9 8189610: Reconcile jvm.h and all jvm_md.h between java.base and hotspot
coleenp
parents: 47216
diff changeset
   493
  jint lo, hi;
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   494
  unpack_2_ints(lo, hi);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   495
  jlong t = jlong_from(hi, lo);;
36301
cb578d8c6cba 8149741: Don't refer to stub entry points by index in external_word relocations
vlivanov
parents: 35086
diff changeset
   496
  _target = (address) t;
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   497
#endif /* _LP64 */
489c9b5090e2 Initial load
duke
parents:
diff changeset
   498
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   499
489c9b5090e2 Initial load
duke
parents:
diff changeset
   500
489c9b5090e2 Initial load
duke
parents:
diff changeset
   501
void internal_word_Relocation::pack_data_to(CodeSection* dest) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   502
  short* p = (short*) dest->locs_end();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   503
  normalize_address(_target, dest, true);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   504
489c9b5090e2 Initial load
duke
parents:
diff changeset
   505
  // Check whether my target address is valid within this section.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   506
  // If not, strengthen the relocation type to point to another section.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   507
  int sindex = _section;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   508
  if (sindex == CodeBuffer::SECT_NONE && _target != NULL
489c9b5090e2 Initial load
duke
parents:
diff changeset
   509
      && (!dest->allocates(_target) || _target == dest->locs_point())) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   510
    sindex = dest->outer()->section_index_of(_target);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   511
    guarantee(sindex != CodeBuffer::SECT_NONE, "must belong somewhere");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   512
    relocInfo* base = dest->locs_end() - 1;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   513
    assert(base->type() == this->type(), "sanity");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   514
    // Change the written type, to be section_word_type instead.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   515
    base->set_type(relocInfo::section_word_type);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   516
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   517
489c9b5090e2 Initial load
duke
parents:
diff changeset
   518
  // Note: An internal_word relocation cannot refer to its own instruction,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   519
  // because we reserve "0" to mean that the pointer itself is embedded
489c9b5090e2 Initial load
duke
parents:
diff changeset
   520
  // in the code stream.  We use a section_word relocation for such cases.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   521
489c9b5090e2 Initial load
duke
parents:
diff changeset
   522
  if (sindex == CodeBuffer::SECT_NONE) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   523
    assert(type() == relocInfo::internal_word_type, "must be base class");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   524
    guarantee(_target == NULL || dest->allocates2(_target), "must be within the given code section");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   525
    jint x0 = scaled_offset_null_special(_target, dest->locs_point());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   526
    assert(!(x0 == 0 && _target != NULL), "correct encoding of null target");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   527
    p = pack_1_int_to(p, x0);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   528
  } else {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   529
    assert(_target != NULL, "sanity");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   530
    CodeSection* sect = dest->outer()->code_section(sindex);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   531
    guarantee(sect->allocates2(_target), "must be in correct section");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   532
    address base = sect->start();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   533
    jint offset = scaled_offset(_target, base);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   534
    assert((uint)sindex < (uint)CodeBuffer::SECT_LIMIT, "sanity");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   535
    assert(CodeBuffer::SECT_LIMIT <= (1 << section_width), "section_width++");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   536
    p = pack_1_int_to(p, (offset << section_width) | sindex);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   537
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   538
489c9b5090e2 Initial load
duke
parents:
diff changeset
   539
  dest->set_locs_end((relocInfo*) p);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   540
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   541
489c9b5090e2 Initial load
duke
parents:
diff changeset
   542
489c9b5090e2 Initial load
duke
parents:
diff changeset
   543
void internal_word_Relocation::unpack_data() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   544
  jint x0 = unpack_1_int();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   545
  _target = x0==0? NULL: address_from_scaled_offset(x0, addr());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   546
  _section = CodeBuffer::SECT_NONE;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   547
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   548
489c9b5090e2 Initial load
duke
parents:
diff changeset
   549
489c9b5090e2 Initial load
duke
parents:
diff changeset
   550
void section_word_Relocation::unpack_data() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   551
  jint    x      = unpack_1_int();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   552
  jint    offset = (x >> section_width);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   553
  int     sindex = (x & ((1<<section_width)-1));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   554
  address base   = binding()->section_start(sindex);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   555
489c9b5090e2 Initial load
duke
parents:
diff changeset
   556
  _section = sindex;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   557
  _target  = address_from_scaled_offset(offset, base);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   558
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   559
489c9b5090e2 Initial load
duke
parents:
diff changeset
   560
//// miscellaneous methods
489c9b5090e2 Initial load
duke
parents:
diff changeset
   561
oop* oop_Relocation::oop_addr() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   562
  int n = _oop_index;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   563
  if (n == 0) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   564
    // oop is stored in the code stream
489c9b5090e2 Initial load
duke
parents:
diff changeset
   565
    return (oop*) pd_address_in_code();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   566
  } else {
5686
5435e77aa3df 6951083: oops and relocations should part of nmethod not CodeBlob
twisti
parents: 1
diff changeset
   567
    // oop is stored in table at nmethod::oops_begin
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   568
    return code()->oop_addr_at(n);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   569
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   570
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   571
489c9b5090e2 Initial load
duke
parents:
diff changeset
   572
489c9b5090e2 Initial load
duke
parents:
diff changeset
   573
oop oop_Relocation::oop_value() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   574
  oop v = *oop_addr();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   575
  // clean inline caches store a special pseudo-null
489c9b5090e2 Initial load
duke
parents:
diff changeset
   576
  if (v == (oop)Universe::non_oop_word())  v = NULL;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   577
  return v;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   578
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   579
489c9b5090e2 Initial load
duke
parents:
diff changeset
   580
489c9b5090e2 Initial load
duke
parents:
diff changeset
   581
void oop_Relocation::fix_oop_relocation() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   582
  if (!oop_is_immediate()) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   583
    // get the oop from the pool, and re-insert it into the instruction:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   584
    set_value(value());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   585
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   586
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   587
489c9b5090e2 Initial load
duke
parents:
diff changeset
   588
8724
693c6b883b54 7028374: race in fix_oop_relocations for scavengeable nmethods
never
parents: 8107
diff changeset
   589
void oop_Relocation::verify_oop_relocation() {
693c6b883b54 7028374: race in fix_oop_relocations for scavengeable nmethods
never
parents: 8107
diff changeset
   590
  if (!oop_is_immediate()) {
693c6b883b54 7028374: race in fix_oop_relocations for scavengeable nmethods
never
parents: 8107
diff changeset
   591
    // get the oop from the pool, and re-insert it into the instruction:
693c6b883b54 7028374: race in fix_oop_relocations for scavengeable nmethods
never
parents: 8107
diff changeset
   592
    verify_value(value());
693c6b883b54 7028374: race in fix_oop_relocations for scavengeable nmethods
never
parents: 8107
diff changeset
   593
  }
693c6b883b54 7028374: race in fix_oop_relocations for scavengeable nmethods
never
parents: 8107
diff changeset
   594
}
693c6b883b54 7028374: race in fix_oop_relocations for scavengeable nmethods
never
parents: 8107
diff changeset
   595
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 9124
diff changeset
   596
// meta data versions
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 9124
diff changeset
   597
Metadata** metadata_Relocation::metadata_addr() {
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 9124
diff changeset
   598
  int n = _metadata_index;
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 9124
diff changeset
   599
  if (n == 0) {
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 9124
diff changeset
   600
    // metadata is stored in the code stream
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 9124
diff changeset
   601
    return (Metadata**) pd_address_in_code();
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   602
    } else {
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 9124
diff changeset
   603
    // metadata is stored in table at nmethod::metadatas_begin
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 9124
diff changeset
   604
    return code()->metadata_addr_at(n);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   605
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   606
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   607
489c9b5090e2 Initial load
duke
parents:
diff changeset
   608
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 9124
diff changeset
   609
Metadata* metadata_Relocation::metadata_value() {
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 9124
diff changeset
   610
  Metadata* v = *metadata_addr();
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 9124
diff changeset
   611
  // clean inline caches store a special pseudo-null
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 9124
diff changeset
   612
  if (v == (Metadata*)Universe::non_oop_word())  v = NULL;
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 9124
diff changeset
   613
  return v;
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   614
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   615
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 9124
diff changeset
   616
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 9124
diff changeset
   617
void metadata_Relocation::fix_metadata_relocation() {
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 9124
diff changeset
   618
  if (!metadata_is_immediate()) {
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 9124
diff changeset
   619
    // get the metadata from the pool, and re-insert it into the instruction:
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 9124
diff changeset
   620
    pd_fix_value(value());
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 9124
diff changeset
   621
  }
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   622
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   623
489c9b5090e2 Initial load
duke
parents:
diff changeset
   624
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 9124
diff changeset
   625
void metadata_Relocation::verify_metadata_relocation() {
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 9124
diff changeset
   626
  if (!metadata_is_immediate()) {
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 9124
diff changeset
   627
    // get the metadata from the pool, and re-insert it into the instruction:
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 9124
diff changeset
   628
    verify_value(value());
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 9124
diff changeset
   629
  }
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   630
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   631
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 9124
diff changeset
   632
address virtual_call_Relocation::cached_value() {
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 9124
diff changeset
   633
  assert(_cached_value != NULL && _cached_value < addr(), "must precede ic_call");
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 9124
diff changeset
   634
  return _cached_value;
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   635
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   636
35086
bbf32241d851 8072008: Emit direct call instead of linkTo* for recursive indy/MH.invoke* calls
vlivanov
parents: 33807
diff changeset
   637
Method* virtual_call_Relocation::method_value() {
42044
c1e8e7815bf3 8167299: -XX:+PrintRelocations crashes the VM
simonis
parents: 38133
diff changeset
   638
  CompiledMethod* cm = code();
c1e8e7815bf3 8167299: -XX:+PrintRelocations crashes the VM
simonis
parents: 38133
diff changeset
   639
  if (cm == NULL) return (Method*)NULL;
c1e8e7815bf3 8167299: -XX:+PrintRelocations crashes the VM
simonis
parents: 38133
diff changeset
   640
  Metadata* m = cm->metadata_at(_method_index);
35086
bbf32241d851 8072008: Emit direct call instead of linkTo* for recursive indy/MH.invoke* calls
vlivanov
parents: 33807
diff changeset
   641
  assert(m != NULL || _method_index == 0, "should be non-null for non-zero index");
bbf32241d851 8072008: Emit direct call instead of linkTo* for recursive indy/MH.invoke* calls
vlivanov
parents: 33807
diff changeset
   642
  assert(m == NULL || m->is_method(), "not a method");
bbf32241d851 8072008: Emit direct call instead of linkTo* for recursive indy/MH.invoke* calls
vlivanov
parents: 33807
diff changeset
   643
  return (Method*)m;
bbf32241d851 8072008: Emit direct call instead of linkTo* for recursive indy/MH.invoke* calls
vlivanov
parents: 33807
diff changeset
   644
}
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   645
489c9b5090e2 Initial load
duke
parents:
diff changeset
   646
void virtual_call_Relocation::clear_inline_cache() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   647
  // No stubs for ICs
489c9b5090e2 Initial load
duke
parents:
diff changeset
   648
  // Clean IC
489c9b5090e2 Initial load
duke
parents:
diff changeset
   649
  ResourceMark rm;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   650
  CompiledIC* icache = CompiledIC_at(this);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   651
  icache->set_to_clean();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   652
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   653
489c9b5090e2 Initial load
duke
parents:
diff changeset
   654
35086
bbf32241d851 8072008: Emit direct call instead of linkTo* for recursive indy/MH.invoke* calls
vlivanov
parents: 33807
diff changeset
   655
void opt_virtual_call_Relocation::pack_data_to(CodeSection* dest) {
bbf32241d851 8072008: Emit direct call instead of linkTo* for recursive indy/MH.invoke* calls
vlivanov
parents: 33807
diff changeset
   656
  short* p = (short*) dest->locs_end();
bbf32241d851 8072008: Emit direct call instead of linkTo* for recursive indy/MH.invoke* calls
vlivanov
parents: 33807
diff changeset
   657
  p = pack_1_int_to(p, _method_index);
bbf32241d851 8072008: Emit direct call instead of linkTo* for recursive indy/MH.invoke* calls
vlivanov
parents: 33807
diff changeset
   658
  dest->set_locs_end((relocInfo*) p);
bbf32241d851 8072008: Emit direct call instead of linkTo* for recursive indy/MH.invoke* calls
vlivanov
parents: 33807
diff changeset
   659
}
bbf32241d851 8072008: Emit direct call instead of linkTo* for recursive indy/MH.invoke* calls
vlivanov
parents: 33807
diff changeset
   660
bbf32241d851 8072008: Emit direct call instead of linkTo* for recursive indy/MH.invoke* calls
vlivanov
parents: 33807
diff changeset
   661
void opt_virtual_call_Relocation::unpack_data() {
bbf32241d851 8072008: Emit direct call instead of linkTo* for recursive indy/MH.invoke* calls
vlivanov
parents: 33807
diff changeset
   662
  _method_index = unpack_1_int();
bbf32241d851 8072008: Emit direct call instead of linkTo* for recursive indy/MH.invoke* calls
vlivanov
parents: 33807
diff changeset
   663
}
bbf32241d851 8072008: Emit direct call instead of linkTo* for recursive indy/MH.invoke* calls
vlivanov
parents: 33807
diff changeset
   664
bbf32241d851 8072008: Emit direct call instead of linkTo* for recursive indy/MH.invoke* calls
vlivanov
parents: 33807
diff changeset
   665
Method* opt_virtual_call_Relocation::method_value() {
42044
c1e8e7815bf3 8167299: -XX:+PrintRelocations crashes the VM
simonis
parents: 38133
diff changeset
   666
  CompiledMethod* cm = code();
c1e8e7815bf3 8167299: -XX:+PrintRelocations crashes the VM
simonis
parents: 38133
diff changeset
   667
  if (cm == NULL) return (Method*)NULL;
c1e8e7815bf3 8167299: -XX:+PrintRelocations crashes the VM
simonis
parents: 38133
diff changeset
   668
  Metadata* m = cm->metadata_at(_method_index);
35086
bbf32241d851 8072008: Emit direct call instead of linkTo* for recursive indy/MH.invoke* calls
vlivanov
parents: 33807
diff changeset
   669
  assert(m != NULL || _method_index == 0, "should be non-null for non-zero index");
bbf32241d851 8072008: Emit direct call instead of linkTo* for recursive indy/MH.invoke* calls
vlivanov
parents: 33807
diff changeset
   670
  assert(m == NULL || m->is_method(), "not a method");
bbf32241d851 8072008: Emit direct call instead of linkTo* for recursive indy/MH.invoke* calls
vlivanov
parents: 33807
diff changeset
   671
  return (Method*)m;
bbf32241d851 8072008: Emit direct call instead of linkTo* for recursive indy/MH.invoke* calls
vlivanov
parents: 33807
diff changeset
   672
}
bbf32241d851 8072008: Emit direct call instead of linkTo* for recursive indy/MH.invoke* calls
vlivanov
parents: 33807
diff changeset
   673
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   674
void opt_virtual_call_Relocation::clear_inline_cache() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   675
  // No stubs for ICs
489c9b5090e2 Initial load
duke
parents:
diff changeset
   676
  // Clean IC
489c9b5090e2 Initial load
duke
parents:
diff changeset
   677
  ResourceMark rm;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   678
  CompiledIC* icache = CompiledIC_at(this);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   679
  icache->set_to_clean();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   680
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   681
489c9b5090e2 Initial load
duke
parents:
diff changeset
   682
42650
1f304d0c888b 8171008: Integrate AOT compiler into JDK
kvn
parents: 42064
diff changeset
   683
address opt_virtual_call_Relocation::static_stub(bool is_aot) {
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   684
  // search for the static stub who points back to this static call
489c9b5090e2 Initial load
duke
parents:
diff changeset
   685
  address static_call_addr = addr();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   686
  RelocIterator iter(code());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   687
  while (iter.next()) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   688
    if (iter.type() == relocInfo::static_stub_type) {
33160
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents: 24952
diff changeset
   689
      static_stub_Relocation* stub_reloc = iter.static_stub_reloc();
42650
1f304d0c888b 8171008: Integrate AOT compiler into JDK
kvn
parents: 42064
diff changeset
   690
      if (stub_reloc->static_call() == static_call_addr && stub_reloc->is_aot() == is_aot) {
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   691
        return iter.addr();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   692
      }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   693
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   694
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   695
  return NULL;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   696
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   697
35086
bbf32241d851 8072008: Emit direct call instead of linkTo* for recursive indy/MH.invoke* calls
vlivanov
parents: 33807
diff changeset
   698
Method* static_call_Relocation::method_value() {
42044
c1e8e7815bf3 8167299: -XX:+PrintRelocations crashes the VM
simonis
parents: 38133
diff changeset
   699
  CompiledMethod* cm = code();
c1e8e7815bf3 8167299: -XX:+PrintRelocations crashes the VM
simonis
parents: 38133
diff changeset
   700
  if (cm == NULL) return (Method*)NULL;
c1e8e7815bf3 8167299: -XX:+PrintRelocations crashes the VM
simonis
parents: 38133
diff changeset
   701
  Metadata* m = cm->metadata_at(_method_index);
35086
bbf32241d851 8072008: Emit direct call instead of linkTo* for recursive indy/MH.invoke* calls
vlivanov
parents: 33807
diff changeset
   702
  assert(m != NULL || _method_index == 0, "should be non-null for non-zero index");
bbf32241d851 8072008: Emit direct call instead of linkTo* for recursive indy/MH.invoke* calls
vlivanov
parents: 33807
diff changeset
   703
  assert(m == NULL || m->is_method(), "not a method");
bbf32241d851 8072008: Emit direct call instead of linkTo* for recursive indy/MH.invoke* calls
vlivanov
parents: 33807
diff changeset
   704
  return (Method*)m;
bbf32241d851 8072008: Emit direct call instead of linkTo* for recursive indy/MH.invoke* calls
vlivanov
parents: 33807
diff changeset
   705
}
bbf32241d851 8072008: Emit direct call instead of linkTo* for recursive indy/MH.invoke* calls
vlivanov
parents: 33807
diff changeset
   706
bbf32241d851 8072008: Emit direct call instead of linkTo* for recursive indy/MH.invoke* calls
vlivanov
parents: 33807
diff changeset
   707
void static_call_Relocation::pack_data_to(CodeSection* dest) {
bbf32241d851 8072008: Emit direct call instead of linkTo* for recursive indy/MH.invoke* calls
vlivanov
parents: 33807
diff changeset
   708
  short* p = (short*) dest->locs_end();
bbf32241d851 8072008: Emit direct call instead of linkTo* for recursive indy/MH.invoke* calls
vlivanov
parents: 33807
diff changeset
   709
  p = pack_1_int_to(p, _method_index);
bbf32241d851 8072008: Emit direct call instead of linkTo* for recursive indy/MH.invoke* calls
vlivanov
parents: 33807
diff changeset
   710
  dest->set_locs_end((relocInfo*) p);
bbf32241d851 8072008: Emit direct call instead of linkTo* for recursive indy/MH.invoke* calls
vlivanov
parents: 33807
diff changeset
   711
}
bbf32241d851 8072008: Emit direct call instead of linkTo* for recursive indy/MH.invoke* calls
vlivanov
parents: 33807
diff changeset
   712
bbf32241d851 8072008: Emit direct call instead of linkTo* for recursive indy/MH.invoke* calls
vlivanov
parents: 33807
diff changeset
   713
void static_call_Relocation::unpack_data() {
bbf32241d851 8072008: Emit direct call instead of linkTo* for recursive indy/MH.invoke* calls
vlivanov
parents: 33807
diff changeset
   714
  _method_index = unpack_1_int();
bbf32241d851 8072008: Emit direct call instead of linkTo* for recursive indy/MH.invoke* calls
vlivanov
parents: 33807
diff changeset
   715
}
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   716
489c9b5090e2 Initial load
duke
parents:
diff changeset
   717
void static_call_Relocation::clear_inline_cache() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   718
  // Safe call site info
42650
1f304d0c888b 8171008: Integrate AOT compiler into JDK
kvn
parents: 42064
diff changeset
   719
  CompiledStaticCall* handler = this->code()->compiledStaticCall_at(this);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   720
  handler->set_to_clean();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   721
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   722
489c9b5090e2 Initial load
duke
parents:
diff changeset
   723
42650
1f304d0c888b 8171008: Integrate AOT compiler into JDK
kvn
parents: 42064
diff changeset
   724
address static_call_Relocation::static_stub(bool is_aot) {
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   725
  // search for the static stub who points back to this static call
489c9b5090e2 Initial load
duke
parents:
diff changeset
   726
  address static_call_addr = addr();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   727
  RelocIterator iter(code());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   728
  while (iter.next()) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   729
    if (iter.type() == relocInfo::static_stub_type) {
33160
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents: 24952
diff changeset
   730
      static_stub_Relocation* stub_reloc = iter.static_stub_reloc();
42650
1f304d0c888b 8171008: Integrate AOT compiler into JDK
kvn
parents: 42064
diff changeset
   731
      if (stub_reloc->static_call() == static_call_addr && stub_reloc->is_aot() == is_aot) {
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   732
        return iter.addr();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   733
      }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   734
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   735
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   736
  return NULL;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   737
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   738
22813
422557569a6b 8016696: PPC64 (part 4): add relocation for trampoline stubs
goetz
parents: 18446
diff changeset
   739
// Finds the trampoline address for a call. If no trampoline stub is
422557569a6b 8016696: PPC64 (part 4): add relocation for trampoline stubs
goetz
parents: 18446
diff changeset
   740
// found NULL is returned which can be handled by the caller.
422557569a6b 8016696: PPC64 (part 4): add relocation for trampoline stubs
goetz
parents: 18446
diff changeset
   741
address trampoline_stub_Relocation::get_trampoline_for(address call, nmethod* code) {
422557569a6b 8016696: PPC64 (part 4): add relocation for trampoline stubs
goetz
parents: 18446
diff changeset
   742
  // There are no relocations available when the code gets relocated
422557569a6b 8016696: PPC64 (part 4): add relocation for trampoline stubs
goetz
parents: 18446
diff changeset
   743
  // because of CodeBuffer expansion.
422557569a6b 8016696: PPC64 (part 4): add relocation for trampoline stubs
goetz
parents: 18446
diff changeset
   744
  if (code->relocation_size() == 0)
422557569a6b 8016696: PPC64 (part 4): add relocation for trampoline stubs
goetz
parents: 18446
diff changeset
   745
    return NULL;
422557569a6b 8016696: PPC64 (part 4): add relocation for trampoline stubs
goetz
parents: 18446
diff changeset
   746
422557569a6b 8016696: PPC64 (part 4): add relocation for trampoline stubs
goetz
parents: 18446
diff changeset
   747
  RelocIterator iter(code, call);
422557569a6b 8016696: PPC64 (part 4): add relocation for trampoline stubs
goetz
parents: 18446
diff changeset
   748
  while (iter.next()) {
422557569a6b 8016696: PPC64 (part 4): add relocation for trampoline stubs
goetz
parents: 18446
diff changeset
   749
    if (iter.type() == relocInfo::trampoline_stub_type) {
422557569a6b 8016696: PPC64 (part 4): add relocation for trampoline stubs
goetz
parents: 18446
diff changeset
   750
      if (iter.trampoline_stub_reloc()->owner() == call) {
422557569a6b 8016696: PPC64 (part 4): add relocation for trampoline stubs
goetz
parents: 18446
diff changeset
   751
        return iter.addr();
422557569a6b 8016696: PPC64 (part 4): add relocation for trampoline stubs
goetz
parents: 18446
diff changeset
   752
      }
422557569a6b 8016696: PPC64 (part 4): add relocation for trampoline stubs
goetz
parents: 18446
diff changeset
   753
    }
422557569a6b 8016696: PPC64 (part 4): add relocation for trampoline stubs
goetz
parents: 18446
diff changeset
   754
  }
422557569a6b 8016696: PPC64 (part 4): add relocation for trampoline stubs
goetz
parents: 18446
diff changeset
   755
422557569a6b 8016696: PPC64 (part 4): add relocation for trampoline stubs
goetz
parents: 18446
diff changeset
   756
  return NULL;
422557569a6b 8016696: PPC64 (part 4): add relocation for trampoline stubs
goetz
parents: 18446
diff changeset
   757
}
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   758
489c9b5090e2 Initial load
duke
parents:
diff changeset
   759
void static_stub_Relocation::clear_inline_cache() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   760
  // Call stub is only used when calling the interpreted code.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   761
  // It does not really need to be cleared, except that we want to clean out the methodoop.
42650
1f304d0c888b 8171008: Integrate AOT compiler into JDK
kvn
parents: 42064
diff changeset
   762
  CompiledDirectStaticCall::set_stub_to_clean(this);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   763
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   764
489c9b5090e2 Initial load
duke
parents:
diff changeset
   765
489c9b5090e2 Initial load
duke
parents:
diff changeset
   766
void external_word_Relocation::fix_relocation_after_move(const CodeBuffer* src, CodeBuffer* dest) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   767
  address target = _target;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   768
  if (target == NULL) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   769
    // An absolute embedded reference to an external location,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   770
    // which means there is nothing to fix here.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   771
    return;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   772
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   773
  // Probably this reference is absolute, not relative, so the
489c9b5090e2 Initial load
duke
parents:
diff changeset
   774
  // following is probably a no-op.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   775
  assert(src->section_index_of(target) == CodeBuffer::SECT_NONE, "sanity");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   776
  set_value(target);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   777
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   778
489c9b5090e2 Initial load
duke
parents:
diff changeset
   779
489c9b5090e2 Initial load
duke
parents:
diff changeset
   780
address external_word_Relocation::target() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   781
  address target = _target;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   782
  if (target == NULL) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   783
    target = pd_get_address_from_code();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   784
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   785
  return target;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   786
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   787
489c9b5090e2 Initial load
duke
parents:
diff changeset
   788
489c9b5090e2 Initial load
duke
parents:
diff changeset
   789
void internal_word_Relocation::fix_relocation_after_move(const CodeBuffer* src, CodeBuffer* dest) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   790
  address target = _target;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   791
  if (target == NULL) {
24952
953481cd953d 8044538: assert(which != imm_operand) failed: instruction is not a movq reg, imm64
thartmann
parents: 24424
diff changeset
   792
    target = new_addr_for(this->target(), src, dest);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   793
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   794
  set_value(target);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   795
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   796
489c9b5090e2 Initial load
duke
parents:
diff changeset
   797
489c9b5090e2 Initial load
duke
parents:
diff changeset
   798
address internal_word_Relocation::target() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   799
  address target = _target;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   800
  if (target == NULL) {
24952
953481cd953d 8044538: assert(which != imm_operand) failed: instruction is not a movq reg, imm64
thartmann
parents: 24424
diff changeset
   801
    if (addr_in_const()) {
953481cd953d 8044538: assert(which != imm_operand) failed: instruction is not a movq reg, imm64
thartmann
parents: 24424
diff changeset
   802
      target = *(address*)addr();
953481cd953d 8044538: assert(which != imm_operand) failed: instruction is not a movq reg, imm64
thartmann
parents: 24424
diff changeset
   803
    } else {
953481cd953d 8044538: assert(which != imm_operand) failed: instruction is not a movq reg, imm64
thartmann
parents: 24424
diff changeset
   804
      target = pd_get_address_from_code();
953481cd953d 8044538: assert(which != imm_operand) failed: instruction is not a movq reg, imm64
thartmann
parents: 24424
diff changeset
   805
    }
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   806
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   807
  return target;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   808
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   809
489c9b5090e2 Initial load
duke
parents:
diff changeset
   810
//---------------------------------------------------------------------------------
489c9b5090e2 Initial load
duke
parents:
diff changeset
   811
// Non-product code
489c9b5090e2 Initial load
duke
parents:
diff changeset
   812
489c9b5090e2 Initial load
duke
parents:
diff changeset
   813
#ifndef PRODUCT
489c9b5090e2 Initial load
duke
parents:
diff changeset
   814
489c9b5090e2 Initial load
duke
parents:
diff changeset
   815
static const char* reloc_type_string(relocInfo::relocType t) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   816
  switch (t) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   817
  #define EACH_CASE(name) \
489c9b5090e2 Initial load
duke
parents:
diff changeset
   818
  case relocInfo::name##_type: \
489c9b5090e2 Initial load
duke
parents:
diff changeset
   819
    return #name;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   820
489c9b5090e2 Initial load
duke
parents:
diff changeset
   821
  APPLY_TO_RELOCATIONS(EACH_CASE);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   822
  #undef EACH_CASE
489c9b5090e2 Initial load
duke
parents:
diff changeset
   823
489c9b5090e2 Initial load
duke
parents:
diff changeset
   824
  case relocInfo::none:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   825
    return "none";
489c9b5090e2 Initial load
duke
parents:
diff changeset
   826
  case relocInfo::data_prefix_tag:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   827
    return "prefix";
489c9b5090e2 Initial load
duke
parents:
diff changeset
   828
  default:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   829
    return "UNKNOWN RELOC TYPE";
489c9b5090e2 Initial load
duke
parents:
diff changeset
   830
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   831
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   832
489c9b5090e2 Initial load
duke
parents:
diff changeset
   833
489c9b5090e2 Initial load
duke
parents:
diff changeset
   834
void RelocIterator::print_current() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   835
  if (!has_current()) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   836
    tty->print_cr("(no relocs)");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   837
    return;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   838
  }
7427
d7b79a367474 6985015: C1 needs to support compressed oops
iveresov
parents: 7397
diff changeset
   839
  tty->print("relocInfo@" INTPTR_FORMAT " [type=%d(%s) addr=" INTPTR_FORMAT " offset=%d",
33148
68fa8b6c4340 8042893: compiler: PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC needs to be removed from source files
david
parents: 24952
diff changeset
   840
             p2i(_current), type(), reloc_type_string((relocInfo::relocType) type()), p2i(_addr), _current->addr_offset());
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   841
  if (current()->format() != 0)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   842
    tty->print(" format=%d", current()->format());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   843
  if (datalen() == 1) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   844
    tty->print(" data=%d", data()[0]);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   845
  } else if (datalen() > 0) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   846
    tty->print(" data={");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   847
    for (int i = 0; i < datalen(); i++) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   848
      tty->print("%04x", data()[i] & 0xFFFF);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   849
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   850
    tty->print("}");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   851
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   852
  tty->print("]");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   853
  switch (type()) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   854
  case relocInfo::oop_type:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   855
    {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   856
      oop_Relocation* r = oop_reloc();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   857
      oop* oop_addr  = NULL;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   858
      oop  raw_oop   = NULL;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   859
      oop  oop_value = NULL;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   860
      if (code() != NULL || r->oop_is_immediate()) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   861
        oop_addr  = r->oop_addr();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   862
        raw_oop   = *oop_addr;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   863
        oop_value = r->oop_value();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   864
      }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   865
      tty->print(" | [oop_addr=" INTPTR_FORMAT " *=" INTPTR_FORMAT " offset=%d]",
33148
68fa8b6c4340 8042893: compiler: PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC needs to be removed from source files
david
parents: 24952
diff changeset
   866
                 p2i(oop_addr), p2i(raw_oop), r->offset());
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   867
      // Do not print the oop by default--we want this routine to
489c9b5090e2 Initial load
duke
parents:
diff changeset
   868
      // work even during GC or other inconvenient times.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   869
      if (WizardMode && oop_value != NULL) {
33148
68fa8b6c4340 8042893: compiler: PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC needs to be removed from source files
david
parents: 24952
diff changeset
   870
        tty->print("oop_value=" INTPTR_FORMAT ": ", p2i(oop_value));
46968
9119841280f4 8160399: is_oop_or_null involves undefined behavior
coleenp
parents: 46630
diff changeset
   871
        if (oopDesc::is_oop(oop_value)) {
42044
c1e8e7815bf3 8167299: -XX:+PrintRelocations crashes the VM
simonis
parents: 38133
diff changeset
   872
          oop_value->print_value_on(tty);
c1e8e7815bf3 8167299: -XX:+PrintRelocations crashes the VM
simonis
parents: 38133
diff changeset
   873
        }
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   874
      }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   875
      break;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   876
    }
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 9124
diff changeset
   877
  case relocInfo::metadata_type:
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 9124
diff changeset
   878
    {
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 9124
diff changeset
   879
      metadata_Relocation* r = metadata_reloc();
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 9124
diff changeset
   880
      Metadata** metadata_addr  = NULL;
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 9124
diff changeset
   881
      Metadata*    raw_metadata   = NULL;
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 9124
diff changeset
   882
      Metadata*    metadata_value = NULL;
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 9124
diff changeset
   883
      if (code() != NULL || r->metadata_is_immediate()) {
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 9124
diff changeset
   884
        metadata_addr  = r->metadata_addr();
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 9124
diff changeset
   885
        raw_metadata   = *metadata_addr;
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 9124
diff changeset
   886
        metadata_value = r->metadata_value();
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 9124
diff changeset
   887
      }
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 9124
diff changeset
   888
      tty->print(" | [metadata_addr=" INTPTR_FORMAT " *=" INTPTR_FORMAT " offset=%d]",
33148
68fa8b6c4340 8042893: compiler: PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC needs to be removed from source files
david
parents: 24952
diff changeset
   889
                 p2i(metadata_addr), p2i(raw_metadata), r->offset());
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 9124
diff changeset
   890
      if (metadata_value != NULL) {
33148
68fa8b6c4340 8042893: compiler: PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC needs to be removed from source files
david
parents: 24952
diff changeset
   891
        tty->print("metadata_value=" INTPTR_FORMAT ": ", p2i(metadata_value));
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 9124
diff changeset
   892
        metadata_value->print_value_on(tty);
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 9124
diff changeset
   893
      }
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 9124
diff changeset
   894
      break;
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 9124
diff changeset
   895
    }
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   896
  case relocInfo::external_word_type:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   897
  case relocInfo::internal_word_type:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   898
  case relocInfo::section_word_type:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   899
    {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   900
      DataRelocation* r = (DataRelocation*) reloc();
33148
68fa8b6c4340 8042893: compiler: PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC needs to be removed from source files
david
parents: 24952
diff changeset
   901
      tty->print(" | [target=" INTPTR_FORMAT "]", p2i(r->value())); //value==target
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   902
      break;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   903
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   904
  case relocInfo::static_call_type:
35086
bbf32241d851 8072008: Emit direct call instead of linkTo* for recursive indy/MH.invoke* calls
vlivanov
parents: 33807
diff changeset
   905
    {
bbf32241d851 8072008: Emit direct call instead of linkTo* for recursive indy/MH.invoke* calls
vlivanov
parents: 33807
diff changeset
   906
      static_call_Relocation* r = (static_call_Relocation*) reloc();
bbf32241d851 8072008: Emit direct call instead of linkTo* for recursive indy/MH.invoke* calls
vlivanov
parents: 33807
diff changeset
   907
      tty->print(" | [destination=" INTPTR_FORMAT " metadata=" INTPTR_FORMAT "]",
bbf32241d851 8072008: Emit direct call instead of linkTo* for recursive indy/MH.invoke* calls
vlivanov
parents: 33807
diff changeset
   908
                 p2i(r->destination()), p2i(r->method_value()));
bbf32241d851 8072008: Emit direct call instead of linkTo* for recursive indy/MH.invoke* calls
vlivanov
parents: 33807
diff changeset
   909
      break;
bbf32241d851 8072008: Emit direct call instead of linkTo* for recursive indy/MH.invoke* calls
vlivanov
parents: 33807
diff changeset
   910
    }
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   911
  case relocInfo::runtime_call_type:
42064
a530dbabe64f 8167184: [s390] Extend relocations for pc-relative instructions.
goetz
parents: 42044
diff changeset
   912
  case relocInfo::runtime_call_w_cp_type:
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   913
    {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   914
      CallRelocation* r = (CallRelocation*) reloc();
33148
68fa8b6c4340 8042893: compiler: PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC needs to be removed from source files
david
parents: 24952
diff changeset
   915
      tty->print(" | [destination=" INTPTR_FORMAT "]", p2i(r->destination()));
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   916
      break;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   917
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   918
  case relocInfo::virtual_call_type:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   919
    {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   920
      virtual_call_Relocation* r = (virtual_call_Relocation*) reloc();
35086
bbf32241d851 8072008: Emit direct call instead of linkTo* for recursive indy/MH.invoke* calls
vlivanov
parents: 33807
diff changeset
   921
      tty->print(" | [destination=" INTPTR_FORMAT " cached_value=" INTPTR_FORMAT " metadata=" INTPTR_FORMAT "]",
bbf32241d851 8072008: Emit direct call instead of linkTo* for recursive indy/MH.invoke* calls
vlivanov
parents: 33807
diff changeset
   922
                 p2i(r->destination()), p2i(r->cached_value()), p2i(r->method_value()));
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   923
      break;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   924
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   925
  case relocInfo::static_stub_type:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   926
    {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   927
      static_stub_Relocation* r = (static_stub_Relocation*) reloc();
33148
68fa8b6c4340 8042893: compiler: PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC needs to be removed from source files
david
parents: 24952
diff changeset
   928
      tty->print(" | [static_call=" INTPTR_FORMAT "]", p2i(r->static_call()));
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   929
      break;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   930
    }
22813
422557569a6b 8016696: PPC64 (part 4): add relocation for trampoline stubs
goetz
parents: 18446
diff changeset
   931
  case relocInfo::trampoline_stub_type:
422557569a6b 8016696: PPC64 (part 4): add relocation for trampoline stubs
goetz
parents: 18446
diff changeset
   932
    {
422557569a6b 8016696: PPC64 (part 4): add relocation for trampoline stubs
goetz
parents: 18446
diff changeset
   933
      trampoline_stub_Relocation* r = (trampoline_stub_Relocation*) reloc();
33148
68fa8b6c4340 8042893: compiler: PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC needs to be removed from source files
david
parents: 24952
diff changeset
   934
      tty->print(" | [trampoline owner=" INTPTR_FORMAT "]", p2i(r->owner()));
22813
422557569a6b 8016696: PPC64 (part 4): add relocation for trampoline stubs
goetz
parents: 18446
diff changeset
   935
      break;
422557569a6b 8016696: PPC64 (part 4): add relocation for trampoline stubs
goetz
parents: 18446
diff changeset
   936
    }
35086
bbf32241d851 8072008: Emit direct call instead of linkTo* for recursive indy/MH.invoke* calls
vlivanov
parents: 33807
diff changeset
   937
  case relocInfo::opt_virtual_call_type:
bbf32241d851 8072008: Emit direct call instead of linkTo* for recursive indy/MH.invoke* calls
vlivanov
parents: 33807
diff changeset
   938
    {
bbf32241d851 8072008: Emit direct call instead of linkTo* for recursive indy/MH.invoke* calls
vlivanov
parents: 33807
diff changeset
   939
      opt_virtual_call_Relocation* r = (opt_virtual_call_Relocation*) reloc();
bbf32241d851 8072008: Emit direct call instead of linkTo* for recursive indy/MH.invoke* calls
vlivanov
parents: 33807
diff changeset
   940
      tty->print(" | [destination=" INTPTR_FORMAT " metadata=" INTPTR_FORMAT "]",
bbf32241d851 8072008: Emit direct call instead of linkTo* for recursive indy/MH.invoke* calls
vlivanov
parents: 33807
diff changeset
   941
                 p2i(r->destination()), p2i(r->method_value()));
bbf32241d851 8072008: Emit direct call instead of linkTo* for recursive indy/MH.invoke* calls
vlivanov
parents: 33807
diff changeset
   942
      break;
bbf32241d851 8072008: Emit direct call instead of linkTo* for recursive indy/MH.invoke* calls
vlivanov
parents: 33807
diff changeset
   943
    }
46630
75aa3e39d02c 8182299: Enable disabled clang warnings, build on OSX 10 + Xcode 8
jwilhelm
parents: 46530
diff changeset
   944
  default:
75aa3e39d02c 8182299: Enable disabled clang warnings, build on OSX 10 + Xcode 8
jwilhelm
parents: 46530
diff changeset
   945
    break;
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   946
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   947
  tty->cr();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   948
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   949
489c9b5090e2 Initial load
duke
parents:
diff changeset
   950
489c9b5090e2 Initial load
duke
parents:
diff changeset
   951
void RelocIterator::print() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   952
  RelocIterator save_this = (*this);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   953
  relocInfo* scan = _current;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   954
  if (!has_current())  scan += 1;  // nothing to scan here!
489c9b5090e2 Initial load
duke
parents:
diff changeset
   955
489c9b5090e2 Initial load
duke
parents:
diff changeset
   956
  bool skip_next = has_current();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   957
  bool got_next;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   958
  while (true) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   959
    got_next = (skip_next || next());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   960
    skip_next = false;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   961
33148
68fa8b6c4340 8042893: compiler: PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC needs to be removed from source files
david
parents: 24952
diff changeset
   962
    tty->print("         @" INTPTR_FORMAT ": ", p2i(scan));
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   963
    relocInfo* newscan = _current+1;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   964
    if (!has_current())  newscan -= 1;  // nothing to scan here!
489c9b5090e2 Initial load
duke
parents:
diff changeset
   965
    while (scan < newscan) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   966
      tty->print("%04x", *(short*)scan & 0xFFFF);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   967
      scan++;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   968
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   969
    tty->cr();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   970
489c9b5090e2 Initial load
duke
parents:
diff changeset
   971
    if (!got_next)  break;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   972
    print_current();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   973
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   974
489c9b5090e2 Initial load
duke
parents:
diff changeset
   975
  (*this) = save_this;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   976
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   977
489c9b5090e2 Initial load
duke
parents:
diff changeset
   978
// For the debugger:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   979
extern "C"
5686
5435e77aa3df 6951083: oops and relocations should part of nmethod not CodeBlob
twisti
parents: 1
diff changeset
   980
void print_blob_locs(nmethod* nm) {
5435e77aa3df 6951083: oops and relocations should part of nmethod not CodeBlob
twisti
parents: 1
diff changeset
   981
  nm->print();
5435e77aa3df 6951083: oops and relocations should part of nmethod not CodeBlob
twisti
parents: 1
diff changeset
   982
  RelocIterator iter(nm);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   983
  iter.print();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   984
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   985
extern "C"
489c9b5090e2 Initial load
duke
parents:
diff changeset
   986
void print_buf_locs(CodeBuffer* cb) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   987
  FlagSetting fs(PrintRelocations, true);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   988
  cb->print();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   989
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   990
#endif // !PRODUCT