hotspot/src/share/vm/compiler/oopMap.cpp
author coleenp
Sun, 13 Apr 2008 17:43:42 -0400
changeset 360 21d113ecbf6a
parent 347 df859fcca515
child 952 38812d18eec0
child 670 ddf3e9583f2f
permissions -rw-r--r--
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes Summary: Compressed oops in instances, arrays, and headers. Code contributors are coleenp, phh, never, swamyv Reviewed-by: jmasa, kamg, acorn, tbell, kvn, rasbold
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
     1
/*
489c9b5090e2 Initial load
duke
parents:
diff changeset
     2
 * Copyright 1998-2007 Sun Microsystems, Inc.  All Rights Reserved.
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
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
    19
 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
489c9b5090e2 Initial load
duke
parents:
diff changeset
    20
 * CA 95054 USA or visit www.sun.com if you need additional information or
489c9b5090e2 Initial load
duke
parents:
diff changeset
    21
 * have any questions.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    22
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
    23
 */
489c9b5090e2 Initial load
duke
parents:
diff changeset
    24
489c9b5090e2 Initial load
duke
parents:
diff changeset
    25
# include "incls/_precompiled.incl"
489c9b5090e2 Initial load
duke
parents:
diff changeset
    26
# include "incls/_oopMap.cpp.incl"
489c9b5090e2 Initial load
duke
parents:
diff changeset
    27
489c9b5090e2 Initial load
duke
parents:
diff changeset
    28
// OopMapStream
489c9b5090e2 Initial load
duke
parents:
diff changeset
    29
489c9b5090e2 Initial load
duke
parents:
diff changeset
    30
OopMapStream::OopMapStream(OopMap* oop_map) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    31
  if(oop_map->omv_data() == NULL) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    32
    _stream = new CompressedReadStream(oop_map->write_stream()->buffer());
489c9b5090e2 Initial load
duke
parents:
diff changeset
    33
  } else {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    34
    _stream = new CompressedReadStream(oop_map->omv_data());
489c9b5090e2 Initial load
duke
parents:
diff changeset
    35
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    36
  _mask = OopMapValue::type_mask_in_place;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    37
  _size = oop_map->omv_count();
489c9b5090e2 Initial load
duke
parents:
diff changeset
    38
  _position = 0;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    39
  _valid_omv = false;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    40
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
    41
489c9b5090e2 Initial load
duke
parents:
diff changeset
    42
489c9b5090e2 Initial load
duke
parents:
diff changeset
    43
OopMapStream::OopMapStream(OopMap* oop_map, int oop_types_mask) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    44
  if(oop_map->omv_data() == NULL) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    45
    _stream = new CompressedReadStream(oop_map->write_stream()->buffer());
489c9b5090e2 Initial load
duke
parents:
diff changeset
    46
  } else {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    47
    _stream = new CompressedReadStream(oop_map->omv_data());
489c9b5090e2 Initial load
duke
parents:
diff changeset
    48
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    49
  _mask = oop_types_mask;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    50
  _size = oop_map->omv_count();
489c9b5090e2 Initial load
duke
parents:
diff changeset
    51
  _position = 0;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    52
  _valid_omv = false;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    53
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
    54
489c9b5090e2 Initial load
duke
parents:
diff changeset
    55
489c9b5090e2 Initial load
duke
parents:
diff changeset
    56
void OopMapStream::find_next() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    57
  while(_position++ < _size) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    58
    _omv.read_from(_stream);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    59
    if(((int)_omv.type() & _mask) > 0) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    60
      _valid_omv = true;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    61
      return;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    62
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    63
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    64
  _valid_omv = false;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    65
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
    66
489c9b5090e2 Initial load
duke
parents:
diff changeset
    67
489c9b5090e2 Initial load
duke
parents:
diff changeset
    68
// OopMap
489c9b5090e2 Initial load
duke
parents:
diff changeset
    69
489c9b5090e2 Initial load
duke
parents:
diff changeset
    70
// frame_size units are stack-slots (4 bytes) NOT intptr_t; we can name odd
489c9b5090e2 Initial load
duke
parents:
diff changeset
    71
// slots to hold 4-byte values like ints and floats in the LP64 build.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    72
OopMap::OopMap(int frame_size, int arg_count) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    73
  // OopMaps are usually quite so small, so pick a small initial size
489c9b5090e2 Initial load
duke
parents:
diff changeset
    74
  set_write_stream(new CompressedWriteStream(32));
489c9b5090e2 Initial load
duke
parents:
diff changeset
    75
  set_omv_data(NULL);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    76
  set_omv_count(0);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    77
489c9b5090e2 Initial load
duke
parents:
diff changeset
    78
#ifdef ASSERT
489c9b5090e2 Initial load
duke
parents:
diff changeset
    79
  _locs_length = VMRegImpl::stack2reg(0)->value() + frame_size + arg_count;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    80
  _locs_used   = NEW_RESOURCE_ARRAY(OopMapValue::oop_types, _locs_length);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    81
  for(int i = 0; i < _locs_length; i++) _locs_used[i] = OopMapValue::unused_value;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    82
#endif
489c9b5090e2 Initial load
duke
parents:
diff changeset
    83
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
    84
489c9b5090e2 Initial load
duke
parents:
diff changeset
    85
489c9b5090e2 Initial load
duke
parents:
diff changeset
    86
OopMap::OopMap(OopMap::DeepCopyToken, OopMap* source) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    87
  // This constructor does a deep copy
489c9b5090e2 Initial load
duke
parents:
diff changeset
    88
  // of the source OopMap.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    89
  set_write_stream(new CompressedWriteStream(source->omv_count() * 2));
489c9b5090e2 Initial load
duke
parents:
diff changeset
    90
  set_omv_data(NULL);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    91
  set_omv_count(0);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    92
  set_offset(source->offset());
489c9b5090e2 Initial load
duke
parents:
diff changeset
    93
489c9b5090e2 Initial load
duke
parents:
diff changeset
    94
#ifdef ASSERT
489c9b5090e2 Initial load
duke
parents:
diff changeset
    95
  _locs_length = source->_locs_length;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    96
  _locs_used = NEW_RESOURCE_ARRAY(OopMapValue::oop_types, _locs_length);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    97
  for(int i = 0; i < _locs_length; i++) _locs_used[i] = OopMapValue::unused_value;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    98
#endif
489c9b5090e2 Initial load
duke
parents:
diff changeset
    99
489c9b5090e2 Initial load
duke
parents:
diff changeset
   100
  // We need to copy the entries too.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   101
  for (OopMapStream oms(source); !oms.is_done(); oms.next()) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   102
    OopMapValue omv = oms.current();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   103
    omv.write_on(write_stream());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   104
    increment_count();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   105
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   106
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   107
489c9b5090e2 Initial load
duke
parents:
diff changeset
   108
489c9b5090e2 Initial load
duke
parents:
diff changeset
   109
OopMap* OopMap::deep_copy() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   110
  return new OopMap(_deep_copy_token, this);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   111
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   112
489c9b5090e2 Initial load
duke
parents:
diff changeset
   113
489c9b5090e2 Initial load
duke
parents:
diff changeset
   114
void OopMap::copy_to(address addr) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   115
  memcpy(addr,this,sizeof(OopMap));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   116
  memcpy(addr + sizeof(OopMap),write_stream()->buffer(),write_stream()->position());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   117
  OopMap* new_oop = (OopMap*)addr;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   118
  new_oop->set_omv_data_size(write_stream()->position());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   119
  new_oop->set_omv_data((unsigned char *)(addr + sizeof(OopMap)));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   120
  new_oop->set_write_stream(NULL);
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
int OopMap::heap_size() const {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   125
  int size = sizeof(OopMap);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   126
  int align = sizeof(void *) - 1;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   127
  if(write_stream() != NULL) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   128
    size += write_stream()->position();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   129
  } else {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   130
    size += omv_data_size();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   131
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   132
  // Align to a reasonable ending point
489c9b5090e2 Initial load
duke
parents:
diff changeset
   133
  size = ((size+align) & ~align);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   134
  return size;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   135
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   136
489c9b5090e2 Initial load
duke
parents:
diff changeset
   137
// frame_size units are stack-slots (4 bytes) NOT intptr_t; we can name odd
489c9b5090e2 Initial load
duke
parents:
diff changeset
   138
// slots to hold 4-byte values like ints and floats in the LP64 build.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   139
void OopMap::set_xxx(VMReg reg, OopMapValue::oop_types x, VMReg optional) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   140
489c9b5090e2 Initial load
duke
parents:
diff changeset
   141
  assert(reg->value() < _locs_length, "too big reg value for stack size");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   142
  assert( _locs_used[reg->value()] == OopMapValue::unused_value, "cannot insert twice" );
489c9b5090e2 Initial load
duke
parents:
diff changeset
   143
  debug_only( _locs_used[reg->value()] = x; )
489c9b5090e2 Initial load
duke
parents:
diff changeset
   144
489c9b5090e2 Initial load
duke
parents:
diff changeset
   145
  OopMapValue o(reg, x);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   146
489c9b5090e2 Initial load
duke
parents:
diff changeset
   147
  if(x == OopMapValue::callee_saved_value) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   148
    // This can never be a stack location, so we don't need to transform it.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   149
    assert(optional->is_reg(), "Trying to callee save a stack location");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   150
    o.set_content_reg(optional);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   151
  } else if(x == OopMapValue::derived_oop_value) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   152
    o.set_content_reg(optional);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   153
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   154
489c9b5090e2 Initial load
duke
parents:
diff changeset
   155
  o.write_on(write_stream());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   156
  increment_count();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   157
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   158
489c9b5090e2 Initial load
duke
parents:
diff changeset
   159
489c9b5090e2 Initial load
duke
parents:
diff changeset
   160
void OopMap::set_oop(VMReg reg) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   161
  set_xxx(reg, OopMapValue::oop_value, VMRegImpl::Bad());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   162
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   163
489c9b5090e2 Initial load
duke
parents:
diff changeset
   164
489c9b5090e2 Initial load
duke
parents:
diff changeset
   165
void OopMap::set_value(VMReg reg) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   166
  // At this time, we only need value entries in our OopMap when ZapDeadCompiledLocals is active.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   167
  if (ZapDeadCompiledLocals)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   168
    set_xxx(reg, OopMapValue::value_value, VMRegImpl::Bad());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   169
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   170
489c9b5090e2 Initial load
duke
parents:
diff changeset
   171
360
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 347
diff changeset
   172
void OopMap::set_narrowoop(VMReg reg) {
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 347
diff changeset
   173
  set_xxx(reg, OopMapValue::narrowoop_value, VMRegImpl::Bad());
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   174
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   175
489c9b5090e2 Initial load
duke
parents:
diff changeset
   176
489c9b5090e2 Initial load
duke
parents:
diff changeset
   177
void OopMap::set_callee_saved(VMReg reg, VMReg caller_machine_register ) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   178
  set_xxx(reg, OopMapValue::callee_saved_value, caller_machine_register);
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
void OopMap::set_derived_oop(VMReg reg, VMReg derived_from_local_register ) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   183
  if( reg == derived_from_local_register ) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   184
    // Actually an oop, derived shares storage with base,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   185
    set_oop(reg);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   186
  } else {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   187
    set_xxx(reg, OopMapValue::derived_oop_value, derived_from_local_register);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   188
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   189
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   190
489c9b5090e2 Initial load
duke
parents:
diff changeset
   191
void OopMap::set_stack_obj(VMReg reg) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   192
  set_xxx(reg, OopMapValue::stack_obj, VMRegImpl::Bad());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   193
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   194
489c9b5090e2 Initial load
duke
parents:
diff changeset
   195
// OopMapSet
489c9b5090e2 Initial load
duke
parents:
diff changeset
   196
489c9b5090e2 Initial load
duke
parents:
diff changeset
   197
OopMapSet::OopMapSet() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   198
  set_om_size(MinOopMapAllocation);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   199
  set_om_count(0);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   200
  OopMap** temp = NEW_RESOURCE_ARRAY(OopMap*, om_size());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   201
  set_om_data(temp);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   202
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   203
489c9b5090e2 Initial load
duke
parents:
diff changeset
   204
489c9b5090e2 Initial load
duke
parents:
diff changeset
   205
void OopMapSet::grow_om_data() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   206
  int new_size = om_size() * 2;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   207
  OopMap** new_data = NEW_RESOURCE_ARRAY(OopMap*, new_size);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   208
  memcpy(new_data,om_data(),om_size() * sizeof(OopMap*));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   209
  set_om_size(new_size);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   210
  set_om_data(new_data);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   211
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   212
489c9b5090e2 Initial load
duke
parents:
diff changeset
   213
489c9b5090e2 Initial load
duke
parents:
diff changeset
   214
void OopMapSet::copy_to(address addr) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   215
  address temp = addr;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   216
  int align = sizeof(void *) - 1;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   217
  // Copy this
489c9b5090e2 Initial load
duke
parents:
diff changeset
   218
  memcpy(addr,this,sizeof(OopMapSet));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   219
  temp += sizeof(OopMapSet);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   220
  temp = (address)((intptr_t)(temp + align) & ~align);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   221
  // Do the needed fixups to the new OopMapSet
489c9b5090e2 Initial load
duke
parents:
diff changeset
   222
  OopMapSet* new_set = (OopMapSet*)addr;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   223
  new_set->set_om_data((OopMap**)temp);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   224
  // Allow enough space for the OopMap pointers
489c9b5090e2 Initial load
duke
parents:
diff changeset
   225
  temp += (om_count() * sizeof(OopMap*));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   226
489c9b5090e2 Initial load
duke
parents:
diff changeset
   227
  for(int i=0; i < om_count(); i++) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   228
    OopMap* map = at(i);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   229
    map->copy_to((address)temp);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   230
    new_set->set(i,(OopMap*)temp);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   231
    temp += map->heap_size();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   232
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   233
  // This "locks" the OopMapSet
489c9b5090e2 Initial load
duke
parents:
diff changeset
   234
  new_set->set_om_size(-1);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   235
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   236
489c9b5090e2 Initial load
duke
parents:
diff changeset
   237
489c9b5090e2 Initial load
duke
parents:
diff changeset
   238
void OopMapSet::add_gc_map(int pc_offset, OopMap *map ) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   239
  assert(om_size() != -1,"Cannot grow a fixed OopMapSet");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   240
489c9b5090e2 Initial load
duke
parents:
diff changeset
   241
  if(om_count() >= om_size()) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   242
    grow_om_data();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   243
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   244
  map->set_offset(pc_offset);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   245
489c9b5090e2 Initial load
duke
parents:
diff changeset
   246
#ifdef ASSERT
489c9b5090e2 Initial load
duke
parents:
diff changeset
   247
  if(om_count() > 0) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   248
    OopMap* last = at(om_count()-1);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   249
    if (last->offset() == map->offset() ) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   250
      fatal("OopMap inserted twice");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   251
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   252
    if(last->offset() > map->offset()) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   253
      tty->print_cr( "WARNING, maps not sorted: pc[%d]=%d, pc[%d]=%d",
489c9b5090e2 Initial load
duke
parents:
diff changeset
   254
                      om_count(),last->offset(),om_count()+1,map->offset());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   255
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   256
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   257
#endif // ASSERT
489c9b5090e2 Initial load
duke
parents:
diff changeset
   258
489c9b5090e2 Initial load
duke
parents:
diff changeset
   259
  set(om_count(),map);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   260
  increment_count();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   261
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   262
489c9b5090e2 Initial load
duke
parents:
diff changeset
   263
489c9b5090e2 Initial load
duke
parents:
diff changeset
   264
int OopMapSet::heap_size() const {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   265
  // The space we use
489c9b5090e2 Initial load
duke
parents:
diff changeset
   266
  int size = sizeof(OopMap);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   267
  int align = sizeof(void *) - 1;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   268
  size = ((size+align) & ~align);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   269
  size += om_count() * sizeof(OopMap*);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   270
489c9b5090e2 Initial load
duke
parents:
diff changeset
   271
  // Now add in the space needed for the indivdiual OopMaps
489c9b5090e2 Initial load
duke
parents:
diff changeset
   272
  for(int i=0; i < om_count(); i++) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   273
    size += at(i)->heap_size();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   274
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   275
  // We don't need to align this, it will be naturally pointer aligned
489c9b5090e2 Initial load
duke
parents:
diff changeset
   276
  return size;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   277
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   278
489c9b5090e2 Initial load
duke
parents:
diff changeset
   279
489c9b5090e2 Initial load
duke
parents:
diff changeset
   280
OopMap* OopMapSet::singular_oop_map() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   281
  guarantee(om_count() == 1, "Make sure we only have a single gc point");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   282
  return at(0);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   283
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   284
489c9b5090e2 Initial load
duke
parents:
diff changeset
   285
489c9b5090e2 Initial load
duke
parents:
diff changeset
   286
OopMap* OopMapSet::find_map_at_offset(int pc_offset) const {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   287
  int i, len = om_count();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   288
  assert( len > 0, "must have pointer maps" );
489c9b5090e2 Initial load
duke
parents:
diff changeset
   289
489c9b5090e2 Initial load
duke
parents:
diff changeset
   290
  // Scan through oopmaps. Stop when current offset is either equal or greater
489c9b5090e2 Initial load
duke
parents:
diff changeset
   291
  // than the one we are looking for.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   292
  for( i = 0; i < len; i++) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   293
    if( at(i)->offset() >= pc_offset )
489c9b5090e2 Initial load
duke
parents:
diff changeset
   294
      break;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   295
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   296
489c9b5090e2 Initial load
duke
parents:
diff changeset
   297
  assert( i < len, "oopmap not found" );
489c9b5090e2 Initial load
duke
parents:
diff changeset
   298
489c9b5090e2 Initial load
duke
parents:
diff changeset
   299
  OopMap* m = at(i);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   300
  assert( m->offset() == pc_offset, "oopmap not found" );
489c9b5090e2 Initial load
duke
parents:
diff changeset
   301
  return m;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   302
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   303
489c9b5090e2 Initial load
duke
parents:
diff changeset
   304
class DoNothingClosure: public OopClosure {
360
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 347
diff changeset
   305
 public:
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 347
diff changeset
   306
  void do_oop(oop* p)       {}
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 347
diff changeset
   307
  void do_oop(narrowOop* p) {}
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   308
};
489c9b5090e2 Initial load
duke
parents:
diff changeset
   309
static DoNothingClosure do_nothing;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   310
489c9b5090e2 Initial load
duke
parents:
diff changeset
   311
static void add_derived_oop(oop* base, oop* derived) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   312
#ifndef TIERED
489c9b5090e2 Initial load
duke
parents:
diff changeset
   313
  COMPILER1_PRESENT(ShouldNotReachHere();)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   314
#endif // TIERED
489c9b5090e2 Initial load
duke
parents:
diff changeset
   315
#ifdef COMPILER2
489c9b5090e2 Initial load
duke
parents:
diff changeset
   316
  DerivedPointerTable::add(derived, base);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   317
#endif // COMPILER2
489c9b5090e2 Initial load
duke
parents:
diff changeset
   318
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   319
489c9b5090e2 Initial load
duke
parents:
diff changeset
   320
489c9b5090e2 Initial load
duke
parents:
diff changeset
   321
#ifndef PRODUCT
489c9b5090e2 Initial load
duke
parents:
diff changeset
   322
static void trace_codeblob_maps(const frame *fr, const RegisterMap *reg_map) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   323
  // Print oopmap and regmap
489c9b5090e2 Initial load
duke
parents:
diff changeset
   324
  tty->print_cr("------ ");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   325
  CodeBlob* cb = fr->cb();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   326
  OopMapSet* maps = cb->oop_maps();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   327
  OopMap* map = cb->oop_map_for_return_address(fr->pc());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   328
  map->print();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   329
  if( cb->is_nmethod() ) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   330
    nmethod* nm = (nmethod*)cb;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   331
    // native wrappers have no scope data, it is implied
489c9b5090e2 Initial load
duke
parents:
diff changeset
   332
    if (nm->is_native_method()) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   333
      tty->print("bci: 0 (native)");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   334
    } else {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   335
      ScopeDesc* scope  = nm->scope_desc_at(fr->pc());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   336
      tty->print("bci: %d ",scope->bci());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   337
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   338
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   339
  tty->cr();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   340
  fr->print_on(tty);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   341
  tty->print("     ");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   342
  cb->print_value_on(tty);  tty->cr();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   343
  reg_map->print();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   344
  tty->print_cr("------ ");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   345
489c9b5090e2 Initial load
duke
parents:
diff changeset
   346
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   347
#endif // PRODUCT
489c9b5090e2 Initial load
duke
parents:
diff changeset
   348
489c9b5090e2 Initial load
duke
parents:
diff changeset
   349
void OopMapSet::oops_do(const frame *fr, const RegisterMap* reg_map, OopClosure* f) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   350
  // add derived oops to a table
360
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 347
diff changeset
   351
  all_do(fr, reg_map, f, add_derived_oop, &do_nothing);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   352
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   353
489c9b5090e2 Initial load
duke
parents:
diff changeset
   354
489c9b5090e2 Initial load
duke
parents:
diff changeset
   355
void OopMapSet::all_do(const frame *fr, const RegisterMap *reg_map,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   356
                       OopClosure* oop_fn, void derived_oop_fn(oop*, oop*),
360
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 347
diff changeset
   357
                       OopClosure* value_fn) {
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   358
  CodeBlob* cb = fr->cb();
360
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 347
diff changeset
   359
  assert(cb != NULL, "no codeblob");
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   360
489c9b5090e2 Initial load
duke
parents:
diff changeset
   361
  NOT_PRODUCT(if (TraceCodeBlobStacks) trace_codeblob_maps(fr, reg_map);)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   362
489c9b5090e2 Initial load
duke
parents:
diff changeset
   363
  OopMapSet* maps = cb->oop_maps();
360
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 347
diff changeset
   364
  OopMap* map = cb->oop_map_for_return_address(fr->pc());
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 347
diff changeset
   365
  assert(map != NULL, "no ptr map found");
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   366
489c9b5090e2 Initial load
duke
parents:
diff changeset
   367
  // handle derived pointers first (otherwise base pointer may be
489c9b5090e2 Initial load
duke
parents:
diff changeset
   368
  // changed before derived pointer offset has been collected)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   369
  OopMapValue omv;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   370
  {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   371
    OopMapStream oms(map,OopMapValue::derived_oop_value);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   372
    if (!oms.is_done()) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   373
#ifndef TIERED
489c9b5090e2 Initial load
duke
parents:
diff changeset
   374
      COMPILER1_PRESENT(ShouldNotReachHere();)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   375
#endif // !TIERED
489c9b5090e2 Initial load
duke
parents:
diff changeset
   376
      // Protect the operation on the derived pointers.  This
489c9b5090e2 Initial load
duke
parents:
diff changeset
   377
      // protects the addition of derived pointers to the shared
489c9b5090e2 Initial load
duke
parents:
diff changeset
   378
      // derived pointer table in DerivedPointerTable::add().
489c9b5090e2 Initial load
duke
parents:
diff changeset
   379
      MutexLockerEx x(DerivedPointerTableGC_lock, Mutex::_no_safepoint_check_flag);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   380
      do {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   381
        omv = oms.current();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   382
        oop* loc = fr->oopmapreg_to_location(omv.reg(),reg_map);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   383
        if ( loc != NULL ) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   384
          oop *base_loc    = fr->oopmapreg_to_location(omv.content_reg(), reg_map);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   385
          oop *derived_loc = loc;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   386
          derived_oop_fn(base_loc, derived_loc);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   387
        }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   388
        oms.next();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   389
      }  while (!oms.is_done());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   390
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   391
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   392
360
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 347
diff changeset
   393
  // We want coop, value and oop oop_types
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 347
diff changeset
   394
  int mask = OopMapValue::oop_value | OopMapValue::value_value | OopMapValue::narrowoop_value;
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   395
  {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   396
    for (OopMapStream oms(map,mask); !oms.is_done(); oms.next()) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   397
      omv = oms.current();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   398
      oop* loc = fr->oopmapreg_to_location(omv.reg(),reg_map);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   399
      if ( loc != NULL ) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   400
        if ( omv.type() == OopMapValue::oop_value ) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   401
#ifdef ASSERT
360
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 347
diff changeset
   402
          if (COMPILER2_PRESENT(!DoEscapeAnalysis &&)
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 347
diff changeset
   403
             (((uintptr_t)loc & (sizeof(*loc)-1)) != 0) ||
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 347
diff changeset
   404
             !Universe::heap()->is_in_or_null(*loc)) {
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   405
            tty->print_cr("# Found non oop pointer.  Dumping state at failure");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   406
            // try to dump out some helpful debugging information
489c9b5090e2 Initial load
duke
parents:
diff changeset
   407
            trace_codeblob_maps(fr, reg_map);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   408
            omv.print();
360
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 347
diff changeset
   409
            tty->print_cr("register r");
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 347
diff changeset
   410
            omv.reg()->print();
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   411
            tty->print_cr("loc = %p *loc = %p\n", loc, (address)*loc);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   412
            // do the real assert.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   413
            assert(Universe::heap()->is_in_or_null(*loc), "found non oop pointer");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   414
          }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   415
#endif // ASSERT
489c9b5090e2 Initial load
duke
parents:
diff changeset
   416
          oop_fn->do_oop(loc);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   417
        } else if ( omv.type() == OopMapValue::value_value ) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   418
          value_fn->do_oop(loc);
360
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 347
diff changeset
   419
        } else if ( omv.type() == OopMapValue::narrowoop_value ) {
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 347
diff changeset
   420
          narrowOop *nl = (narrowOop*)loc;
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 347
diff changeset
   421
#ifndef VM_LITTLE_ENDIAN
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 347
diff changeset
   422
          if (!omv.reg()->is_stack()) {
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 347
diff changeset
   423
            // compressed oops in registers only take up 4 bytes of an
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 347
diff changeset
   424
            // 8 byte register but they are in the wrong part of the
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 347
diff changeset
   425
            // word so adjust loc to point at the right place.
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 347
diff changeset
   426
            nl = (narrowOop*)((address)nl + 4);
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 347
diff changeset
   427
          }
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 347
diff changeset
   428
#endif
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 347
diff changeset
   429
          oop_fn->do_oop(nl);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   430
        }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   431
      }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   432
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   433
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   434
489c9b5090e2 Initial load
duke
parents:
diff changeset
   435
#ifdef COMPILER2
489c9b5090e2 Initial load
duke
parents:
diff changeset
   436
  if (DoEscapeAnalysis) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   437
    for (OopMapStream oms(map, OopMapValue::stack_obj); !oms.is_done(); oms.next()) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   438
      omv = oms.current();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   439
      assert(omv.is_stack_loc(), "should refer to stack location");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   440
      oop loc = (oop) fr->oopmapreg_to_location(omv.reg(),reg_map);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   441
      oop_fn->do_oop(&loc);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   442
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   443
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   444
#endif // COMPILER2
489c9b5090e2 Initial load
duke
parents:
diff changeset
   445
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   446
489c9b5090e2 Initial load
duke
parents:
diff changeset
   447
489c9b5090e2 Initial load
duke
parents:
diff changeset
   448
// Update callee-saved register info for the following frame
489c9b5090e2 Initial load
duke
parents:
diff changeset
   449
void OopMapSet::update_register_map(const frame *fr, RegisterMap *reg_map) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   450
  ResourceMark rm;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   451
  CodeBlob* cb = fr->cb();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   452
  assert(cb != NULL, "no codeblob");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   453
489c9b5090e2 Initial load
duke
parents:
diff changeset
   454
  // Any reg might be saved by a safepoint handler (see generate_handler_blob).
489c9b5090e2 Initial load
duke
parents:
diff changeset
   455
  const int max_saved_on_entry_reg_count = ConcreteRegisterImpl::number_of_registers;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   456
  assert( reg_map->_update_for_id == NULL || fr->is_older(reg_map->_update_for_id),
489c9b5090e2 Initial load
duke
parents:
diff changeset
   457
         "already updated this map; do not 'update' it twice!" );
489c9b5090e2 Initial load
duke
parents:
diff changeset
   458
  debug_only(reg_map->_update_for_id = fr->id());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   459
489c9b5090e2 Initial load
duke
parents:
diff changeset
   460
  // Check if caller must update oop argument
489c9b5090e2 Initial load
duke
parents:
diff changeset
   461
  assert((reg_map->include_argument_oops() ||
489c9b5090e2 Initial load
duke
parents:
diff changeset
   462
          !cb->caller_must_gc_arguments(reg_map->thread())),
489c9b5090e2 Initial load
duke
parents:
diff changeset
   463
         "include_argument_oops should already be set");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   464
489c9b5090e2 Initial load
duke
parents:
diff changeset
   465
  int nof_callee = 0;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   466
  oop*        locs[2*max_saved_on_entry_reg_count+1];
489c9b5090e2 Initial load
duke
parents:
diff changeset
   467
  VMReg regs[2*max_saved_on_entry_reg_count+1];
489c9b5090e2 Initial load
duke
parents:
diff changeset
   468
  // ("+1" because max_saved_on_entry_reg_count might be zero)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   469
489c9b5090e2 Initial load
duke
parents:
diff changeset
   470
  // Scan through oopmap and find location of all callee-saved registers
489c9b5090e2 Initial load
duke
parents:
diff changeset
   471
  // (we do not do update in place, since info could be overwritten)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   472
489c9b5090e2 Initial load
duke
parents:
diff changeset
   473
  address pc = fr->pc();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   474
489c9b5090e2 Initial load
duke
parents:
diff changeset
   475
  OopMap* map  = cb->oop_map_for_return_address(pc);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   476
489c9b5090e2 Initial load
duke
parents:
diff changeset
   477
  assert(map != NULL, " no ptr map found");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   478
489c9b5090e2 Initial load
duke
parents:
diff changeset
   479
  OopMapValue omv;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   480
  for(OopMapStream oms(map,OopMapValue::callee_saved_value); !oms.is_done(); oms.next()) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   481
    omv = oms.current();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   482
    assert(nof_callee < 2*max_saved_on_entry_reg_count, "overflow");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   483
    regs[nof_callee] = omv.content_reg();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   484
    locs[nof_callee] = fr->oopmapreg_to_location(omv.reg(),reg_map);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   485
    nof_callee++;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   486
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   487
489c9b5090e2 Initial load
duke
parents:
diff changeset
   488
  // Check that runtime stubs save all callee-saved registers
489c9b5090e2 Initial load
duke
parents:
diff changeset
   489
#ifdef COMPILER2
489c9b5090e2 Initial load
duke
parents:
diff changeset
   490
  assert(cb->is_compiled_by_c1() || !cb->is_runtime_stub() ||
489c9b5090e2 Initial load
duke
parents:
diff changeset
   491
         (nof_callee >= SAVED_ON_ENTRY_REG_COUNT || nof_callee >= C_SAVED_ON_ENTRY_REG_COUNT),
489c9b5090e2 Initial load
duke
parents:
diff changeset
   492
         "must save all");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   493
#endif // COMPILER2
489c9b5090e2 Initial load
duke
parents:
diff changeset
   494
489c9b5090e2 Initial load
duke
parents:
diff changeset
   495
  // Copy found callee-saved register to reg_map
489c9b5090e2 Initial load
duke
parents:
diff changeset
   496
  for(int i = 0; i < nof_callee; i++) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   497
    reg_map->set_location(regs[i], (address)locs[i]);
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
//=============================================================================
489c9b5090e2 Initial load
duke
parents:
diff changeset
   502
// Non-Product code
489c9b5090e2 Initial load
duke
parents:
diff changeset
   503
489c9b5090e2 Initial load
duke
parents:
diff changeset
   504
#ifndef PRODUCT
489c9b5090e2 Initial load
duke
parents:
diff changeset
   505
489c9b5090e2 Initial load
duke
parents:
diff changeset
   506
bool OopMap::has_derived_pointer() const {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   507
#ifndef TIERED
489c9b5090e2 Initial load
duke
parents:
diff changeset
   508
  COMPILER1_PRESENT(return false);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   509
#endif // !TIERED
489c9b5090e2 Initial load
duke
parents:
diff changeset
   510
#ifdef COMPILER2
489c9b5090e2 Initial load
duke
parents:
diff changeset
   511
  OopMapStream oms((OopMap*)this,OopMapValue::derived_oop_value);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   512
  return oms.is_done();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   513
#else
489c9b5090e2 Initial load
duke
parents:
diff changeset
   514
  return false;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   515
#endif // COMPILER2
489c9b5090e2 Initial load
duke
parents:
diff changeset
   516
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   517
347
df859fcca515 6667042: PrintAssembly option does not work without special plugin
jrose
parents: 198
diff changeset
   518
#endif //PRODUCT
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   519
347
df859fcca515 6667042: PrintAssembly option does not work without special plugin
jrose
parents: 198
diff changeset
   520
// Printing code is present in product build for -XX:+PrintAssembly.
df859fcca515 6667042: PrintAssembly option does not work without special plugin
jrose
parents: 198
diff changeset
   521
df859fcca515 6667042: PrintAssembly option does not work without special plugin
jrose
parents: 198
diff changeset
   522
static
df859fcca515 6667042: PrintAssembly option does not work without special plugin
jrose
parents: 198
diff changeset
   523
void print_register_type(OopMapValue::oop_types x, VMReg optional,
df859fcca515 6667042: PrintAssembly option does not work without special plugin
jrose
parents: 198
diff changeset
   524
                         outputStream* st) {
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   525
  switch( x ) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   526
  case OopMapValue::oop_value:
198
8601165a33c3 6621094: PrintOptoAssembly is broken for oops information in DebugInfo
kvn
parents: 1
diff changeset
   527
    st->print("Oop");
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   528
    break;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   529
  case OopMapValue::value_value:
198
8601165a33c3 6621094: PrintOptoAssembly is broken for oops information in DebugInfo
kvn
parents: 1
diff changeset
   530
    st->print("Value" );
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   531
    break;
360
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 347
diff changeset
   532
  case OopMapValue::narrowoop_value:
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 347
diff changeset
   533
    tty->print("NarrowOop" );
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   534
    break;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   535
  case OopMapValue::callee_saved_value:
198
8601165a33c3 6621094: PrintOptoAssembly is broken for oops information in DebugInfo
kvn
parents: 1
diff changeset
   536
    st->print("Callers_" );
8601165a33c3 6621094: PrintOptoAssembly is broken for oops information in DebugInfo
kvn
parents: 1
diff changeset
   537
    optional->print_on(st);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   538
    break;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   539
  case OopMapValue::derived_oop_value:
198
8601165a33c3 6621094: PrintOptoAssembly is broken for oops information in DebugInfo
kvn
parents: 1
diff changeset
   540
    st->print("Derived_oop_" );
8601165a33c3 6621094: PrintOptoAssembly is broken for oops information in DebugInfo
kvn
parents: 1
diff changeset
   541
    optional->print_on(st);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   542
    break;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   543
  case OopMapValue::stack_obj:
198
8601165a33c3 6621094: PrintOptoAssembly is broken for oops information in DebugInfo
kvn
parents: 1
diff changeset
   544
    st->print("Stack");
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   545
    break;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   546
  default:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   547
    ShouldNotReachHere();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   548
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   549
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   550
489c9b5090e2 Initial load
duke
parents:
diff changeset
   551
198
8601165a33c3 6621094: PrintOptoAssembly is broken for oops information in DebugInfo
kvn
parents: 1
diff changeset
   552
void OopMapValue::print_on(outputStream* st) const {
8601165a33c3 6621094: PrintOptoAssembly is broken for oops information in DebugInfo
kvn
parents: 1
diff changeset
   553
  reg()->print_on(st);
8601165a33c3 6621094: PrintOptoAssembly is broken for oops information in DebugInfo
kvn
parents: 1
diff changeset
   554
  st->print("=");
8601165a33c3 6621094: PrintOptoAssembly is broken for oops information in DebugInfo
kvn
parents: 1
diff changeset
   555
  print_register_type(type(),content_reg(),st);
8601165a33c3 6621094: PrintOptoAssembly is broken for oops information in DebugInfo
kvn
parents: 1
diff changeset
   556
  st->print(" ");
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   557
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   558
489c9b5090e2 Initial load
duke
parents:
diff changeset
   559
489c9b5090e2 Initial load
duke
parents:
diff changeset
   560
void OopMap::print_on(outputStream* st) const {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   561
  OopMapValue omv;
347
df859fcca515 6667042: PrintAssembly option does not work without special plugin
jrose
parents: 198
diff changeset
   562
  st->print("OopMap{");
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   563
  for(OopMapStream oms((OopMap*)this); !oms.is_done(); oms.next()) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   564
    omv = oms.current();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   565
    omv.print_on(st);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   566
  }
347
df859fcca515 6667042: PrintAssembly option does not work without special plugin
jrose
parents: 198
diff changeset
   567
  st->print("off=%d}", (int) offset());
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   568
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   569
489c9b5090e2 Initial load
duke
parents:
diff changeset
   570
489c9b5090e2 Initial load
duke
parents:
diff changeset
   571
void OopMapSet::print_on(outputStream* st) const {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   572
  int i, len = om_count();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   573
489c9b5090e2 Initial load
duke
parents:
diff changeset
   574
  st->print_cr("OopMapSet contains %d OopMaps\n",len);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   575
489c9b5090e2 Initial load
duke
parents:
diff changeset
   576
  for( i = 0; i < len; i++) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   577
    OopMap* m = at(i);
347
df859fcca515 6667042: PrintAssembly option does not work without special plugin
jrose
parents: 198
diff changeset
   578
    st->print_cr("#%d ",i);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   579
    m->print_on(st);
347
df859fcca515 6667042: PrintAssembly option does not work without special plugin
jrose
parents: 198
diff changeset
   580
    st->cr();
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   581
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   582
}
347
df859fcca515 6667042: PrintAssembly option does not work without special plugin
jrose
parents: 198
diff changeset
   583
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   584
489c9b5090e2 Initial load
duke
parents:
diff changeset
   585
489c9b5090e2 Initial load
duke
parents:
diff changeset
   586
//------------------------------DerivedPointerTable---------------------------
489c9b5090e2 Initial load
duke
parents:
diff changeset
   587
489c9b5090e2 Initial load
duke
parents:
diff changeset
   588
#ifdef COMPILER2
489c9b5090e2 Initial load
duke
parents:
diff changeset
   589
489c9b5090e2 Initial load
duke
parents:
diff changeset
   590
class DerivedPointerEntry : public CHeapObj {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   591
 private:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   592
  oop*     _location; // Location of derived pointer (also pointing to the base)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   593
  intptr_t _offset;   // Offset from base pointer
489c9b5090e2 Initial load
duke
parents:
diff changeset
   594
 public:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   595
  DerivedPointerEntry(oop* location, intptr_t offset) { _location = location; _offset = offset; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   596
  oop* location()    { return _location; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   597
  intptr_t  offset() { return _offset; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   598
};
489c9b5090e2 Initial load
duke
parents:
diff changeset
   599
489c9b5090e2 Initial load
duke
parents:
diff changeset
   600
489c9b5090e2 Initial load
duke
parents:
diff changeset
   601
GrowableArray<DerivedPointerEntry*>* DerivedPointerTable::_list = NULL;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   602
bool DerivedPointerTable::_active = false;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   603
489c9b5090e2 Initial load
duke
parents:
diff changeset
   604
489c9b5090e2 Initial load
duke
parents:
diff changeset
   605
void DerivedPointerTable::clear() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   606
  // The first time, we create the list.  Otherwise it should be
489c9b5090e2 Initial load
duke
parents:
diff changeset
   607
  // empty.  If not, then we have probably forgotton to call
489c9b5090e2 Initial load
duke
parents:
diff changeset
   608
  // update_pointers after last GC/Scavenge.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   609
  assert (!_active, "should not be active");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   610
  assert(_list == NULL || _list->length() == 0, "table not empty");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   611
  if (_list == NULL) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   612
    _list = new (ResourceObj::C_HEAP) GrowableArray<DerivedPointerEntry*>(10, true); // Allocated on C heap
489c9b5090e2 Initial load
duke
parents:
diff changeset
   613
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   614
  _active = true;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   615
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   616
489c9b5090e2 Initial load
duke
parents:
diff changeset
   617
489c9b5090e2 Initial load
duke
parents:
diff changeset
   618
// Returns value of location as an int
489c9b5090e2 Initial load
duke
parents:
diff changeset
   619
intptr_t value_of_loc(oop *pointer) { return (intptr_t)(*pointer); }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   620
489c9b5090e2 Initial load
duke
parents:
diff changeset
   621
489c9b5090e2 Initial load
duke
parents:
diff changeset
   622
void DerivedPointerTable::add(oop *derived_loc, oop *base_loc) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   623
  assert(Universe::heap()->is_in_or_null(*base_loc), "not an oop");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   624
  assert(derived_loc != base_loc, "Base and derived in same location");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   625
  if (_active) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   626
    assert(*derived_loc != (oop)base_loc, "location already added");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   627
    assert(_list != NULL, "list must exist");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   628
    intptr_t offset = value_of_loc(derived_loc) - value_of_loc(base_loc);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   629
    assert(offset >= -1000000, "wrong derived pointer info");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   630
489c9b5090e2 Initial load
duke
parents:
diff changeset
   631
    if (TraceDerivedPointers) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   632
      tty->print_cr(
489c9b5090e2 Initial load
duke
parents:
diff changeset
   633
        "Add derived pointer@" INTPTR_FORMAT
489c9b5090e2 Initial load
duke
parents:
diff changeset
   634
        " - Derived: " INTPTR_FORMAT
489c9b5090e2 Initial load
duke
parents:
diff changeset
   635
        " Base: " INTPTR_FORMAT " (@" INTPTR_FORMAT ") (Offset: %d)",
489c9b5090e2 Initial load
duke
parents:
diff changeset
   636
        derived_loc, (address)*derived_loc, (address)*base_loc, base_loc, offset
489c9b5090e2 Initial load
duke
parents:
diff changeset
   637
      );
489c9b5090e2 Initial load
duke
parents:
diff changeset
   638
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   639
    // Set derived oop location to point to base.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   640
    *derived_loc = (oop)base_loc;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   641
    assert_lock_strong(DerivedPointerTableGC_lock);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   642
    DerivedPointerEntry *entry = new DerivedPointerEntry(derived_loc, offset);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   643
    _list->append(entry);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   644
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   645
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   646
489c9b5090e2 Initial load
duke
parents:
diff changeset
   647
489c9b5090e2 Initial load
duke
parents:
diff changeset
   648
void DerivedPointerTable::update_pointers() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   649
  assert(_list != NULL, "list must exist");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   650
  for(int i = 0; i < _list->length(); i++) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   651
    DerivedPointerEntry* entry = _list->at(i);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   652
    oop* derived_loc = entry->location();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   653
    intptr_t offset  = entry->offset();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   654
    // The derived oop was setup to point to location of base
489c9b5090e2 Initial load
duke
parents:
diff changeset
   655
    oop  base        = **(oop**)derived_loc;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   656
    assert(Universe::heap()->is_in_or_null(base), "must be an oop");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   657
489c9b5090e2 Initial load
duke
parents:
diff changeset
   658
    *derived_loc = (oop)(((address)base) + offset);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   659
    assert(value_of_loc(derived_loc) - value_of_loc(&base) == offset, "sanity check");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   660
489c9b5090e2 Initial load
duke
parents:
diff changeset
   661
    if (TraceDerivedPointers) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   662
      tty->print_cr("Updating derived pointer@" INTPTR_FORMAT
489c9b5090e2 Initial load
duke
parents:
diff changeset
   663
                    " - Derived: " INTPTR_FORMAT "  Base: " INTPTR_FORMAT " (Offset: %d)",
489c9b5090e2 Initial load
duke
parents:
diff changeset
   664
          derived_loc, (address)*derived_loc, (address)base, offset);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   665
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   666
489c9b5090e2 Initial load
duke
parents:
diff changeset
   667
    // Delete entry
489c9b5090e2 Initial load
duke
parents:
diff changeset
   668
    delete entry;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   669
    _list->at_put(i, NULL);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   670
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   671
  // Clear list, so it is ready for next traversal (this is an invariant)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   672
  if (TraceDerivedPointers && !_list->is_empty()) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   673
    tty->print_cr("--------------------------");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   674
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   675
  _list->clear();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   676
  _active = false;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   677
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   678
489c9b5090e2 Initial load
duke
parents:
diff changeset
   679
#endif // COMPILER2