Print this page


Split Close
Expand all
Collapse all
          --- old/src/share/vm/code/codeBlob.cpp
          +++ new/src/share/vm/code/codeBlob.cpp
↓ open down ↓ 58 lines elided ↑ open up ↑
  59   59    //       what exactly the format is supposed to be. For now, we just turn
  60   60    //       off the use of this table (gri 7/6/2000).
  61   61  
  62   62    _name                  = name;
  63   63    _size                  = size;
  64   64    _frame_complete_offset = frame_complete;
  65   65    _header_size           = header_size;
  66   66    _relocation_size       = locs_size;
  67   67    _instructions_offset   = align_code_offset(header_size + locs_size);
  68   68    _data_offset           = size;
  69      -  _oops_offset           = size;
  70      -  _oops_length           =  0;
  71   69    _frame_size            =  0;
  72   70    set_oop_maps(NULL);
  73   71  }
  74   72  
  75   73  
  76   74  // Creates a CodeBlob from a CodeBuffer. Sets up the size of the different regions,
  77   75  // and copy code and relocation info.
  78   76  CodeBlob::CodeBlob(
  79   77    const char* name,
  80   78    CodeBuffer* cb,
↓ open down ↓ 6 lines elided ↑ open up ↑
  87   85    assert(size == round_to(size, oopSize), "unaligned size");
  88   86    assert(header_size == round_to(header_size, oopSize), "unaligned size");
  89   87  
  90   88    _name                  = name;
  91   89    _size                  = size;
  92   90    _frame_complete_offset = frame_complete;
  93   91    _header_size           = header_size;
  94   92    _relocation_size       = round_to(cb->total_relocation_size(), oopSize);
  95   93    _instructions_offset   = align_code_offset(header_size + _relocation_size);
  96   94    _data_offset           = _instructions_offset + round_to(cb->total_code_size(), oopSize);
  97      -  _oops_offset           = _size - round_to(cb->total_oop_size(), oopSize);
  98      -  _oops_length           = 0;  // temporary, until the copy_oops handshake
  99      -  assert(_oops_offset >=   _data_offset, "codeBlob is too small");
 100   95    assert(_data_offset <= size, "codeBlob is too small");
 101   96  
 102   97    cb->copy_code_and_locs_to(this);
 103   98    set_oop_maps(oop_maps);
 104   99    _frame_size = frame_size;
 105  100  #ifdef COMPILER1
 106  101    // probably wrong for tiered
 107  102    assert(_frame_size >= -1, "must use frame size or -1 for runtime stubs");
 108  103  #endif // COMPILER1
 109  104  }
↓ open down ↓ 14 lines elided ↑ open up ↑
 124  119  
 125  120  void CodeBlob::flush() {
 126  121    if (_oop_maps) {
 127  122      FREE_C_HEAP_ARRAY(unsigned char, _oop_maps);
 128  123      _oop_maps = NULL;
 129  124    }
 130  125    _comments.free();
 131  126  }
 132  127  
 133  128  
 134      -// Promote one word from an assembly-time handle to a live embedded oop.
 135      -inline void CodeBlob::initialize_immediate_oop(oop* dest, jobject handle) {
 136      -  if (handle == NULL ||
 137      -      // As a special case, IC oops are initialized to 1 or -1.
 138      -      handle == (jobject) Universe::non_oop_word()) {
 139      -    (*dest) = (oop)handle;
 140      -  } else {
 141      -    (*dest) = JNIHandles::resolve_non_null(handle);
 142      -  }
 143      -}
 144      -
 145      -
 146      -void CodeBlob::copy_oops(GrowableArray<jobject>* array) {
 147      -  assert(_oops_length == 0, "do this handshake just once, please");
 148      -  int length = array->length();
 149      -  assert((address)(oops_begin() + length) <= data_end(), "oops big enough");
 150      -  oop* dest = oops_begin();
 151      -  for (int index = 0 ; index < length; index++) {
 152      -    initialize_immediate_oop(&dest[index], array->at(index));
 153      -  }
 154      -  _oops_length = length;
 155      -
 156      -  // Now we can fix up all the oops in the code.
 157      -  // We need to do this in the code because
 158      -  // the assembler uses jobjects as placeholders.
 159      -  // The code and relocations have already been
 160      -  // initialized by the CodeBlob constructor,
 161      -  // so it is valid even at this early point to
 162      -  // iterate over relocations and patch the code.
 163      -  fix_oop_relocations(NULL, NULL, /*initialize_immediates=*/ true);
 164      -}
 165      -
 166      -
 167      -relocInfo::relocType CodeBlob::reloc_type_for_address(address pc) {
 168      -  RelocIterator iter(this, pc, pc+1);
 169      -  while (iter.next()) {
 170      -    return (relocInfo::relocType) iter.type();
 171      -  }
 172      -  // No relocation info found for pc
 173      -  ShouldNotReachHere();
 174      -  return relocInfo::none; // dummy return value
 175      -}
 176      -
 177      -
 178      -bool CodeBlob::is_at_poll_return(address pc) {
 179      -  RelocIterator iter(this, pc, pc+1);
 180      -  while (iter.next()) {
 181      -    if (iter.type() == relocInfo::poll_return_type)
 182      -      return true;
 183      -  }
 184      -  return false;
 185      -}
 186      -
 187      -
 188      -bool CodeBlob::is_at_poll_or_poll_return(address pc) {
 189      -  RelocIterator iter(this, pc, pc+1);
 190      -  while (iter.next()) {
 191      -    relocInfo::relocType t = iter.type();
 192      -    if (t == relocInfo::poll_return_type || t == relocInfo::poll_type)
 193      -      return true;
 194      -  }
 195      -  return false;
 196      -}
 197      -
 198      -
 199      -void CodeBlob::fix_oop_relocations(address begin, address end,
 200      -                                   bool initialize_immediates) {
 201      -  // re-patch all oop-bearing instructions, just in case some oops moved
 202      -  RelocIterator iter(this, begin, end);
 203      -  while (iter.next()) {
 204      -    if (iter.type() == relocInfo::oop_type) {
 205      -      oop_Relocation* reloc = iter.oop_reloc();
 206      -      if (initialize_immediates && reloc->oop_is_immediate()) {
 207      -        oop* dest = reloc->oop_addr();
 208      -        initialize_immediate_oop(dest, (jobject) *dest);
 209      -      }
 210      -      // Refresh the oop-related bits of this instruction.
 211      -      reloc->fix_oop_relocation();
 212      -    }
 213      -
 214      -    // There must not be any interfering patches or breakpoints.
 215      -    assert(!(iter.type() == relocInfo::breakpoint_type
 216      -             && iter.breakpoint_reloc()->active()),
 217      -           "no active breakpoint");
 218      -  }
 219      -}
 220      -
 221  129  void CodeBlob::do_unloading(BoolObjectClosure* is_alive,
 222  130                              OopClosure* keep_alive,
 223  131                              bool unloading_occurred) {
 224  132    ShouldNotReachHere();
 225  133  }
 226  134  
 227  135  OopMap* CodeBlob::oop_map_for_return_address(address return_address) {
 228  136    address pc = return_address ;
 229  137    assert (oop_maps() != NULL, "nope");
 230  138    return oop_maps()->find_map_at_offset ((intptr_t) pc - (intptr_t) instructions_begin());
↓ open down ↓ 509 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX