hotspot/src/share/vm/code/vtableStubs.cpp
author david
Tue, 29 Sep 2015 11:02:08 +0200
changeset 33105 294e48b4f704
parent 27420 04e6f914cce1
child 33148 68fa8b6c4340
permissions -rw-r--r--
8080775: Better argument formatting for assert() and friends Reviewed-by: kbarrett, pliden
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
     1
/*
24424
2658d7834c6e 8037816: Fix for 8036122 breaks build with Xcode5/clang
drchase
parents: 22747
diff changeset
     2
 * Copyright (c) 1997, 2014, 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: 5403
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 5403
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: 5403
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: 6418
diff changeset
    25
#include "precompiled.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 6418
diff changeset
    26
#include "code/vtableStubs.hpp"
25495
aeb87692dfd0 8022968: Some codecache allocation failures don't result in invoking the sweeper
thartmann
parents: 24424
diff changeset
    27
#include "compiler/compileBroker.hpp"
7397
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 6418
diff changeset
    28
#include "compiler/disassembler.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 6418
diff changeset
    29
#include "memory/allocation.inline.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 6418
diff changeset
    30
#include "memory/resourceArea.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 6418
diff changeset
    31
#include "oops/instanceKlass.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 6418
diff changeset
    32
#include "oops/klassVtable.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 6418
diff changeset
    33
#include "oops/oop.inline.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 6418
diff changeset
    34
#include "prims/forte.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 6418
diff changeset
    35
#include "prims/jvmtiExport.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 6418
diff changeset
    36
#include "runtime/handles.inline.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 6418
diff changeset
    37
#include "runtime/mutexLocker.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 6418
diff changeset
    38
#include "runtime/sharedRuntime.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 6418
diff changeset
    39
#ifdef COMPILER2
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 6418
diff changeset
    40
#include "opto/matcher.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 6418
diff changeset
    41
#endif
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    42
24424
2658d7834c6e 8037816: Fix for 8036122 breaks build with Xcode5/clang
drchase
parents: 22747
diff changeset
    43
PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
2658d7834c6e 8037816: Fix for 8036122 breaks build with Xcode5/clang
drchase
parents: 22747
diff changeset
    44
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    45
// -----------------------------------------------------------------------------------------
489c9b5090e2 Initial load
duke
parents:
diff changeset
    46
// Implementation of VtableStub
489c9b5090e2 Initial load
duke
parents:
diff changeset
    47
489c9b5090e2 Initial load
duke
parents:
diff changeset
    48
address VtableStub::_chunk             = NULL;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    49
address VtableStub::_chunk_end         = NULL;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    50
VMReg   VtableStub::_receiver_location = VMRegImpl::Bad();
489c9b5090e2 Initial load
duke
parents:
diff changeset
    51
489c9b5090e2 Initial load
duke
parents:
diff changeset
    52
19696
bd5a0131bde1 8021954: VM SIGSEGV during classloading on MacOS; hs_err_pid file produced
coleenp
parents: 17087
diff changeset
    53
void* VtableStub::operator new(size_t size, int code_size) throw() {
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    54
  assert(size == sizeof(VtableStub), "mismatched size");
489c9b5090e2 Initial load
duke
parents:
diff changeset
    55
  // compute real VtableStub size (rounded to nearest word)
489c9b5090e2 Initial load
duke
parents:
diff changeset
    56
  const int real_size = round_to(code_size + sizeof(VtableStub), wordSize);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    57
  // malloc them in chunks to minimize header overhead
489c9b5090e2 Initial load
duke
parents:
diff changeset
    58
  const int chunk_factor = 32;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    59
  if (_chunk == NULL || _chunk + real_size > _chunk_end) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    60
    const int bytes = chunk_factor * real_size + pd_code_alignment();
22747
f467c14746f5 8025841: JVMTI: "vtable stub" dynamic code notification is misplaced
sspitsyn
parents: 20072
diff changeset
    61
f467c14746f5 8025841: JVMTI: "vtable stub" dynamic code notification is misplaced
sspitsyn
parents: 20072
diff changeset
    62
   // There is a dependency on the name of the blob in src/share/vm/prims/jvmtiCodeBlobEvents.cpp
f467c14746f5 8025841: JVMTI: "vtable stub" dynamic code notification is misplaced
sspitsyn
parents: 20072
diff changeset
    63
   // If changing the name, update the other file accordingly.
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    64
    BufferBlob* blob = BufferBlob::create("vtable chunks", bytes);
5403
6b0dd9c75dde 6888954: argument formatting for assert() and friends
jcoomes
parents: 3261
diff changeset
    65
    if (blob == NULL) {
20072
6da61000acff 7009641: Don't fail VM when CodeCache is full
anoll
parents: 20017
diff changeset
    66
      return NULL;
5403
6b0dd9c75dde 6888954: argument formatting for assert() and friends
jcoomes
parents: 3261
diff changeset
    67
    }
6418
6671edbd230e 6978355: renaming for 6961697
twisti
parents: 6176
diff changeset
    68
    _chunk = blob->content_begin();
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    69
    _chunk_end = _chunk + bytes;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    70
    Forte::register_stub("vtable stub", _chunk, _chunk_end);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    71
    align_chunk();
489c9b5090e2 Initial load
duke
parents:
diff changeset
    72
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    73
  assert(_chunk + real_size <= _chunk_end, "bad allocation");
489c9b5090e2 Initial load
duke
parents:
diff changeset
    74
  void* res = _chunk;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    75
  _chunk += real_size;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    76
  align_chunk();
489c9b5090e2 Initial load
duke
parents:
diff changeset
    77
 return res;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    78
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
    79
489c9b5090e2 Initial load
duke
parents:
diff changeset
    80
6176
4d9030fe341f 6953477: Increase portability and flexibility of building Hotspot
bobv
parents: 5924
diff changeset
    81
void VtableStub::print_on(outputStream* st) const {
4d9030fe341f 6953477: Increase portability and flexibility of building Hotspot
bobv
parents: 5924
diff changeset
    82
  st->print("vtable stub (index = %d, receiver_location = %d, code = [" INTPTR_FORMAT ", " INTPTR_FORMAT "[)",
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    83
             index(), receiver_location(), code_begin(), code_end());
489c9b5090e2 Initial load
duke
parents:
diff changeset
    84
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
    85
489c9b5090e2 Initial load
duke
parents:
diff changeset
    86
489c9b5090e2 Initial load
duke
parents:
diff changeset
    87
// -----------------------------------------------------------------------------------------
489c9b5090e2 Initial load
duke
parents:
diff changeset
    88
// Implementation of VtableStubs
489c9b5090e2 Initial load
duke
parents:
diff changeset
    89
//
489c9b5090e2 Initial load
duke
parents:
diff changeset
    90
// For each hash value there's a linked list of vtable stubs (with that
489c9b5090e2 Initial load
duke
parents:
diff changeset
    91
// hash value). Each list is anchored in a little hash _table, indexed
489c9b5090e2 Initial load
duke
parents:
diff changeset
    92
// by that hash value.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    93
489c9b5090e2 Initial load
duke
parents:
diff changeset
    94
VtableStub* VtableStubs::_table[VtableStubs::N];
489c9b5090e2 Initial load
duke
parents:
diff changeset
    95
int VtableStubs::_number_of_vtable_stubs = 0;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    96
489c9b5090e2 Initial load
duke
parents:
diff changeset
    97
489c9b5090e2 Initial load
duke
parents:
diff changeset
    98
void VtableStubs::initialize() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    99
  VtableStub::_receiver_location = SharedRuntime::name_for_receiver();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   100
  {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   101
    MutexLocker ml(VtableStubs_lock);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   102
    assert(_number_of_vtable_stubs == 0, "potential performance bug: VtableStubs initialized more than once");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   103
    assert(is_power_of_2(N), "N must be a power of 2");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   104
    for (int i = 0; i < N; i++) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   105
      _table[i] = NULL;
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
489c9b5090e2 Initial load
duke
parents:
diff changeset
   110
20017
81eba62e9048 8014013: CallInfo structure no longer accurately reports the result of a LinkResolver operation
drchase
parents: 19696
diff changeset
   111
address VtableStubs::find_stub(bool is_vtable_stub, int vtable_index) {
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   112
  assert(vtable_index >= 0, "must be positive");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   113
489c9b5090e2 Initial load
duke
parents:
diff changeset
   114
  VtableStub* s = ShareVtableStubs ? lookup(is_vtable_stub, vtable_index) : NULL;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   115
  if (s == NULL) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   116
    if (is_vtable_stub) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   117
      s = create_vtable_stub(vtable_index);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   118
    } else {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   119
      s = create_itable_stub(vtable_index);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   120
    }
20072
6da61000acff 7009641: Don't fail VM when CodeCache is full
anoll
parents: 20017
diff changeset
   121
6da61000acff 7009641: Don't fail VM when CodeCache is full
anoll
parents: 20017
diff changeset
   122
    // Creation of vtable or itable can fail if there is not enough free space in the code cache.
6da61000acff 7009641: Don't fail VM when CodeCache is full
anoll
parents: 20017
diff changeset
   123
    if (s == NULL) {
6da61000acff 7009641: Don't fail VM when CodeCache is full
anoll
parents: 20017
diff changeset
   124
      return NULL;
6da61000acff 7009641: Don't fail VM when CodeCache is full
anoll
parents: 20017
diff changeset
   125
    }
6da61000acff 7009641: Don't fail VM when CodeCache is full
anoll
parents: 20017
diff changeset
   126
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   127
    enter(is_vtable_stub, vtable_index, s);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   128
    if (PrintAdapterHandlers) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   129
      tty->print_cr("Decoding VtableStub %s[%d]@%d",
489c9b5090e2 Initial load
duke
parents:
diff changeset
   130
                    is_vtable_stub? "vtbl": "itbl", vtable_index, VtableStub::receiver_location());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   131
      Disassembler::decode(s->code_begin(), s->code_end());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   132
    }
22747
f467c14746f5 8025841: JVMTI: "vtable stub" dynamic code notification is misplaced
sspitsyn
parents: 20072
diff changeset
   133
    // Notify JVMTI about this stub. The event will be recorded by the enclosing
f467c14746f5 8025841: JVMTI: "vtable stub" dynamic code notification is misplaced
sspitsyn
parents: 20072
diff changeset
   134
    // JvmtiDynamicCodeEventCollector and posted when this thread has released
f467c14746f5 8025841: JVMTI: "vtable stub" dynamic code notification is misplaced
sspitsyn
parents: 20072
diff changeset
   135
    // all locks.
f467c14746f5 8025841: JVMTI: "vtable stub" dynamic code notification is misplaced
sspitsyn
parents: 20072
diff changeset
   136
    if (JvmtiExport::should_post_dynamic_code_generated()) {
f467c14746f5 8025841: JVMTI: "vtable stub" dynamic code notification is misplaced
sspitsyn
parents: 20072
diff changeset
   137
      JvmtiExport::post_dynamic_code_generated_while_holding_locks(is_vtable_stub? "vtable stub": "itable stub",
f467c14746f5 8025841: JVMTI: "vtable stub" dynamic code notification is misplaced
sspitsyn
parents: 20072
diff changeset
   138
                                                                   s->code_begin(), s->code_end());
f467c14746f5 8025841: JVMTI: "vtable stub" dynamic code notification is misplaced
sspitsyn
parents: 20072
diff changeset
   139
    }
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   140
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   141
  return s->entry_point();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   142
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   143
489c9b5090e2 Initial load
duke
parents:
diff changeset
   144
489c9b5090e2 Initial load
duke
parents:
diff changeset
   145
inline uint VtableStubs::hash(bool is_vtable_stub, int vtable_index){
489c9b5090e2 Initial load
duke
parents:
diff changeset
   146
  // Assumption: receiver_location < 4 in most cases.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   147
  int hash = ((vtable_index << 2) ^ VtableStub::receiver_location()->value()) + vtable_index;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   148
  return (is_vtable_stub ? ~hash : hash)  & mask;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   149
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   150
489c9b5090e2 Initial load
duke
parents:
diff changeset
   151
489c9b5090e2 Initial load
duke
parents:
diff changeset
   152
VtableStub* VtableStubs::lookup(bool is_vtable_stub, int vtable_index) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   153
  MutexLocker ml(VtableStubs_lock);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   154
  unsigned hash = VtableStubs::hash(is_vtable_stub, vtable_index);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   155
  VtableStub* s = _table[hash];
489c9b5090e2 Initial load
duke
parents:
diff changeset
   156
  while( s && !s->matches(is_vtable_stub, vtable_index)) s = s->next();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   157
  return s;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   158
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   159
489c9b5090e2 Initial load
duke
parents:
diff changeset
   160
489c9b5090e2 Initial load
duke
parents:
diff changeset
   161
void VtableStubs::enter(bool is_vtable_stub, int vtable_index, VtableStub* s) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   162
  MutexLocker ml(VtableStubs_lock);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   163
  assert(s->matches(is_vtable_stub, vtable_index), "bad vtable stub");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   164
  unsigned int h = VtableStubs::hash(is_vtable_stub, vtable_index);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   165
  // enter s at the beginning of the corresponding list
489c9b5090e2 Initial load
duke
parents:
diff changeset
   166
  s->set_next(_table[h]);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   167
  _table[h] = s;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   168
  _number_of_vtable_stubs++;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   169
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   170
489c9b5090e2 Initial load
duke
parents:
diff changeset
   171
489c9b5090e2 Initial load
duke
parents:
diff changeset
   172
bool VtableStubs::is_entry_point(address pc) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   173
  MutexLocker ml(VtableStubs_lock);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   174
  VtableStub* stub = (VtableStub*)(pc - VtableStub::entry_offset());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   175
  uint hash = VtableStubs::hash(stub->is_vtable_stub(), stub->index());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   176
  VtableStub* s;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   177
  for (s = _table[hash]; s != NULL && s != stub; s = s->next()) {}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   178
  return s == stub;
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
bool VtableStubs::contains(address pc) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   183
  // simple solution for now - we may want to use
489c9b5090e2 Initial load
duke
parents:
diff changeset
   184
  // a faster way if this function is called often
489c9b5090e2 Initial load
duke
parents:
diff changeset
   185
  return stub_containing(pc) != NULL;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   186
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   187
489c9b5090e2 Initial load
duke
parents:
diff changeset
   188
489c9b5090e2 Initial load
duke
parents:
diff changeset
   189
VtableStub* VtableStubs::stub_containing(address pc) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   190
  // Note: No locking needed since any change to the data structure
489c9b5090e2 Initial load
duke
parents:
diff changeset
   191
  //       happens with an atomic store into it (we don't care about
489c9b5090e2 Initial load
duke
parents:
diff changeset
   192
  //       consistency with the _number_of_vtable_stubs counter).
489c9b5090e2 Initial load
duke
parents:
diff changeset
   193
  for (int i = 0; i < N; i++) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   194
    for (VtableStub* s = _table[i]; s != NULL; s = s->next()) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   195
      if (s->contains(pc)) return s;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   196
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   197
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   198
  return NULL;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   199
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   200
489c9b5090e2 Initial load
duke
parents:
diff changeset
   201
void vtableStubs_init() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   202
  VtableStubs::initialize();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   203
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   204
22747
f467c14746f5 8025841: JVMTI: "vtable stub" dynamic code notification is misplaced
sspitsyn
parents: 20072
diff changeset
   205
void VtableStubs::vtable_stub_do(void f(VtableStub*)) {
f467c14746f5 8025841: JVMTI: "vtable stub" dynamic code notification is misplaced
sspitsyn
parents: 20072
diff changeset
   206
    for (int i = 0; i < N; i++) {
f467c14746f5 8025841: JVMTI: "vtable stub" dynamic code notification is misplaced
sspitsyn
parents: 20072
diff changeset
   207
        for (VtableStub* s = _table[i]; s != NULL; s = s->next()) {
f467c14746f5 8025841: JVMTI: "vtable stub" dynamic code notification is misplaced
sspitsyn
parents: 20072
diff changeset
   208
            f(s);
f467c14746f5 8025841: JVMTI: "vtable stub" dynamic code notification is misplaced
sspitsyn
parents: 20072
diff changeset
   209
        }
f467c14746f5 8025841: JVMTI: "vtable stub" dynamic code notification is misplaced
sspitsyn
parents: 20072
diff changeset
   210
    }
f467c14746f5 8025841: JVMTI: "vtable stub" dynamic code notification is misplaced
sspitsyn
parents: 20072
diff changeset
   211
}
f467c14746f5 8025841: JVMTI: "vtable stub" dynamic code notification is misplaced
sspitsyn
parents: 20072
diff changeset
   212
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   213
489c9b5090e2 Initial load
duke
parents:
diff changeset
   214
//-----------------------------------------------------------------------------------------------------
489c9b5090e2 Initial load
duke
parents:
diff changeset
   215
// Non-product code
489c9b5090e2 Initial load
duke
parents:
diff changeset
   216
#ifndef PRODUCT
489c9b5090e2 Initial load
duke
parents:
diff changeset
   217
489c9b5090e2 Initial load
duke
parents:
diff changeset
   218
extern "C" void bad_compiled_vtable_index(JavaThread* thread, oop receiver, int index) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   219
  ResourceMark rm;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   220
  HandleMark hm;
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 7397
diff changeset
   221
  Klass* klass = receiver->klass();
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 7397
diff changeset
   222
  InstanceKlass* ik = InstanceKlass::cast(klass);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   223
  klassVtable* vt = ik->vtable();
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 7397
diff changeset
   224
  ik->print();
33105
294e48b4f704 8080775: Better argument formatting for assert() and friends
david
parents: 27420
diff changeset
   225
  fatal("bad compiled vtable dispatch: receiver " INTPTR_FORMAT ", "
294e48b4f704 8080775: Better argument formatting for assert() and friends
david
parents: 27420
diff changeset
   226
        "index %d (vtable length %d)",
294e48b4f704 8080775: Better argument formatting for assert() and friends
david
parents: 27420
diff changeset
   227
        (address)receiver, index, vt->length());
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   228
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   229
33105
294e48b4f704 8080775: Better argument formatting for assert() and friends
david
parents: 27420
diff changeset
   230
#endif // PRODUCT