hotspot/src/share/vm/code/exceptionHandlerTable.cpp
author david
Tue, 29 Sep 2015 11:02:08 +0200
changeset 33105 294e48b4f704
parent 31592 43f48e165466
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: 7397
diff changeset
     2
 * Copyright (c) 1998, 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/exceptionHandlerTable.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 6418
diff changeset
    27
#include "code/nmethod.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 6418
diff changeset
    28
#include "memory/allocation.inline.hpp"
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    29
24424
2658d7834c6e 8037816: Fix for 8036122 breaks build with Xcode5/clang
drchase
parents: 7397
diff changeset
    30
PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
2658d7834c6e 8037816: Fix for 8036122 breaks build with Xcode5/clang
drchase
parents: 7397
diff changeset
    31
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    32
void ExceptionHandlerTable::add_entry(HandlerTableEntry entry) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    33
  _nesting.check();
489c9b5090e2 Initial load
duke
parents:
diff changeset
    34
  if (_length >= _size) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    35
    // not enough space => grow the table (amortized growth, double its size)
489c9b5090e2 Initial load
duke
parents:
diff changeset
    36
    guarantee(_size > 0, "no space allocated => cannot grow the table since it is part of nmethod");
489c9b5090e2 Initial load
duke
parents:
diff changeset
    37
    int new_size = _size * 2;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    38
    _table = REALLOC_RESOURCE_ARRAY(HandlerTableEntry, _table, _size, new_size);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    39
    _size = new_size;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    40
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    41
  assert(_length < _size, "sanity check");
489c9b5090e2 Initial load
duke
parents:
diff changeset
    42
  _table[_length++] = entry;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    43
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
    44
489c9b5090e2 Initial load
duke
parents:
diff changeset
    45
489c9b5090e2 Initial load
duke
parents:
diff changeset
    46
HandlerTableEntry* ExceptionHandlerTable::subtable_for(int catch_pco) const {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    47
  int i = 0;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    48
  while (i < _length) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    49
    HandlerTableEntry* t = _table + i;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    50
    if (t->pco() == catch_pco) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    51
      // found subtable matching the catch_pco
489c9b5090e2 Initial load
duke
parents:
diff changeset
    52
      return t;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    53
    } else {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    54
      // advance to next subtable
489c9b5090e2 Initial load
duke
parents:
diff changeset
    55
      i += t->len() + 1; // +1 for header
489c9b5090e2 Initial load
duke
parents:
diff changeset
    56
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    57
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    58
  return NULL;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    59
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
    60
489c9b5090e2 Initial load
duke
parents:
diff changeset
    61
489c9b5090e2 Initial load
duke
parents:
diff changeset
    62
ExceptionHandlerTable::ExceptionHandlerTable(int initial_size) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    63
  guarantee(initial_size > 0, "initial size must be > 0");
489c9b5090e2 Initial load
duke
parents:
diff changeset
    64
  _table  = NEW_RESOURCE_ARRAY(HandlerTableEntry, initial_size);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    65
  _length = 0;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    66
  _size   = initial_size;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    67
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
    68
489c9b5090e2 Initial load
duke
parents:
diff changeset
    69
489c9b5090e2 Initial load
duke
parents:
diff changeset
    70
ExceptionHandlerTable::ExceptionHandlerTable(const nmethod* nm) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    71
  _table  = (HandlerTableEntry*)nm->handler_table_begin();
489c9b5090e2 Initial load
duke
parents:
diff changeset
    72
  _length = nm->handler_table_size() / sizeof(HandlerTableEntry);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    73
  _size   = 0; // no space allocated by ExeptionHandlerTable!
489c9b5090e2 Initial load
duke
parents:
diff changeset
    74
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
    75
489c9b5090e2 Initial load
duke
parents:
diff changeset
    76
489c9b5090e2 Initial load
duke
parents:
diff changeset
    77
void ExceptionHandlerTable::add_subtable(
489c9b5090e2 Initial load
duke
parents:
diff changeset
    78
  int                 catch_pco,
489c9b5090e2 Initial load
duke
parents:
diff changeset
    79
  GrowableArray<intptr_t>* handler_bcis,
489c9b5090e2 Initial load
duke
parents:
diff changeset
    80
  GrowableArray<intptr_t>* scope_depths_from_top_scope,
489c9b5090e2 Initial load
duke
parents:
diff changeset
    81
  GrowableArray<intptr_t>* handler_pcos
489c9b5090e2 Initial load
duke
parents:
diff changeset
    82
) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    83
  assert(subtable_for(catch_pco) == NULL, "catch handlers for this catch_pco added twice");
489c9b5090e2 Initial load
duke
parents:
diff changeset
    84
  assert(handler_bcis->length() == handler_pcos->length(), "bci & pc table have different length");
489c9b5090e2 Initial load
duke
parents:
diff changeset
    85
  assert(scope_depths_from_top_scope == NULL || handler_bcis->length() == scope_depths_from_top_scope->length(), "bci & scope_depths table have different length");
489c9b5090e2 Initial load
duke
parents:
diff changeset
    86
  if (handler_bcis->length() > 0) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    87
    // add subtable header
489c9b5090e2 Initial load
duke
parents:
diff changeset
    88
    add_entry(HandlerTableEntry(handler_bcis->length(), catch_pco, 0));
489c9b5090e2 Initial load
duke
parents:
diff changeset
    89
    // add individual entries
489c9b5090e2 Initial load
duke
parents:
diff changeset
    90
    for (int i = 0; i < handler_bcis->length(); i++) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    91
      intptr_t scope_depth = 0;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    92
      if (scope_depths_from_top_scope != NULL) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    93
        scope_depth = scope_depths_from_top_scope->at(i);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    94
      }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    95
      add_entry(HandlerTableEntry(handler_bcis->at(i), handler_pcos->at(i), scope_depth));
489c9b5090e2 Initial load
duke
parents:
diff changeset
    96
      assert(entry_for(catch_pco, handler_bcis->at(i), scope_depth)->pco() == handler_pcos->at(i), "entry not added correctly (1)");
489c9b5090e2 Initial load
duke
parents:
diff changeset
    97
      assert(entry_for(catch_pco, handler_bcis->at(i), scope_depth)->scope_depth() == scope_depth, "entry not added correctly (2)");
489c9b5090e2 Initial load
duke
parents:
diff changeset
    98
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    99
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   100
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   101
489c9b5090e2 Initial load
duke
parents:
diff changeset
   102
489c9b5090e2 Initial load
duke
parents:
diff changeset
   103
void ExceptionHandlerTable::copy_to(nmethod* nm) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   104
  assert(size_in_bytes() == nm->handler_table_size(), "size of space allocated in nmethod incorrect");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   105
  memmove(nm->handler_table_begin(), _table, size_in_bytes());
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
HandlerTableEntry* ExceptionHandlerTable::entry_for(int catch_pco, int handler_bci, int scope_depth) const {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   110
  HandlerTableEntry* t = subtable_for(catch_pco);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   111
  if (t != NULL) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   112
    int l = t->len();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   113
    while (l-- > 0) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   114
      t++;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   115
      if (t->bci() == handler_bci && t->scope_depth() == scope_depth) return t;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   116
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   117
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   118
  return NULL;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   119
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   120
489c9b5090e2 Initial load
duke
parents:
diff changeset
   121
489c9b5090e2 Initial load
duke
parents:
diff changeset
   122
void ExceptionHandlerTable::print_subtable(HandlerTableEntry* t) const {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   123
  int l = t->len();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   124
  tty->print_cr("catch_pco = %d (%d entries)", t->pco(), l);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   125
  while (l-- > 0) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   126
    t++;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   127
    tty->print_cr("  bci %d at scope depth %d -> pco %d", t->bci(), t->scope_depth(), t->pco());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   128
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   129
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   130
489c9b5090e2 Initial load
duke
parents:
diff changeset
   131
489c9b5090e2 Initial load
duke
parents:
diff changeset
   132
void ExceptionHandlerTable::print() const {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   133
  tty->print_cr("ExceptionHandlerTable (size = %d bytes)", size_in_bytes());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   134
  int i = 0;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   135
  while (i < _length) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   136
    HandlerTableEntry* t = _table + i;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   137
    print_subtable(t);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   138
    // advance to next subtable
489c9b5090e2 Initial load
duke
parents:
diff changeset
   139
    i += t->len() + 1; // +1 for header
489c9b5090e2 Initial load
duke
parents:
diff changeset
   140
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   141
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   142
489c9b5090e2 Initial load
duke
parents:
diff changeset
   143
void ExceptionHandlerTable::print_subtable_for(int catch_pco) const {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   144
  HandlerTableEntry* subtable = subtable_for(catch_pco);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   145
489c9b5090e2 Initial load
duke
parents:
diff changeset
   146
  if( subtable != NULL ) { print_subtable( subtable ); }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   147
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   148
489c9b5090e2 Initial load
duke
parents:
diff changeset
   149
// ----------------------------------------------------------------------------
489c9b5090e2 Initial load
duke
parents:
diff changeset
   150
// Implicit null exception tables.  Maps an exception PC offset to a
489c9b5090e2 Initial load
duke
parents:
diff changeset
   151
// continuation PC offset.  During construction it's a variable sized
489c9b5090e2 Initial load
duke
parents:
diff changeset
   152
// array with a max size and current length.  When stored inside an
489c9b5090e2 Initial load
duke
parents:
diff changeset
   153
// nmethod a zero length table takes no space.  This is detected by
489c9b5090e2 Initial load
duke
parents:
diff changeset
   154
// nul_chk_table_size() == 0.  Otherwise the table has a length word
489c9b5090e2 Initial load
duke
parents:
diff changeset
   155
// followed by pairs of <excp-offset, const-offset>.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   156
void ImplicitExceptionTable::set_size( uint size ) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   157
  _size = size;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   158
  _data = NEW_RESOURCE_ARRAY(implicit_null_entry, (size*2));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   159
  _len = 0;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   160
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   161
489c9b5090e2 Initial load
duke
parents:
diff changeset
   162
void ImplicitExceptionTable::append( uint exec_off, uint cont_off ) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   163
  assert( (sizeof(implicit_null_entry) >= 4) || (exec_off < 65535), "" );
489c9b5090e2 Initial load
duke
parents:
diff changeset
   164
  assert( (sizeof(implicit_null_entry) >= 4) || (cont_off < 65535), "" );
489c9b5090e2 Initial load
duke
parents:
diff changeset
   165
  uint l = len();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   166
  if (l == _size) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   167
    uint old_size_in_elements = _size*2;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   168
    if (_size == 0) _size = 4;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   169
    _size *= 2;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   170
    uint new_size_in_elements = _size*2;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   171
    _data = REALLOC_RESOURCE_ARRAY(uint, _data, old_size_in_elements, new_size_in_elements);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   172
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   173
  *(adr(l)  ) = exec_off;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   174
  *(adr(l)+1) = cont_off;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   175
  _len = l+1;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   176
};
489c9b5090e2 Initial load
duke
parents:
diff changeset
   177
489c9b5090e2 Initial load
duke
parents:
diff changeset
   178
uint ImplicitExceptionTable::at( uint exec_off ) const {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   179
  uint l = len();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   180
  for( uint i=0; i<l; i++ )
489c9b5090e2 Initial load
duke
parents:
diff changeset
   181
    if( *adr(i) == exec_off )
489c9b5090e2 Initial load
duke
parents:
diff changeset
   182
      return *(adr(i)+1);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   183
  return 0;                     // Failed to find any execption offset
489c9b5090e2 Initial load
duke
parents:
diff changeset
   184
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   185
489c9b5090e2 Initial load
duke
parents:
diff changeset
   186
void ImplicitExceptionTable::print(address base) const {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   187
  tty->print("{");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   188
  for( uint i=0; i<len(); i++ )
31592
43f48e165466 8081202: Hotspot compile warning: "Invalid suffix on literal; C++11 requires a space between literal and identifier"
bpittore
parents: 24424
diff changeset
   189
    tty->print("< " INTPTR_FORMAT ", " INTPTR_FORMAT " > ",base + *adr(i), base + *(adr(i)+1));
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   190
  tty->print_cr("}");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   191
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   192
489c9b5090e2 Initial load
duke
parents:
diff changeset
   193
ImplicitExceptionTable::ImplicitExceptionTable(const nmethod* nm) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   194
  if (nm->nul_chk_table_size() == 0) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   195
    _len = 0;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   196
    _data = NULL;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   197
  } else {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   198
    // the first word is the length if non-zero, so read it out and
489c9b5090e2 Initial load
duke
parents:
diff changeset
   199
    // skip to the next word to get the table.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   200
    _data  = (implicit_null_entry*)nm->nul_chk_table_begin();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   201
    _len = _data[0];
489c9b5090e2 Initial load
duke
parents:
diff changeset
   202
    _data++;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   203
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   204
  _size = len();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   205
  assert(size_in_bytes() <= nm->nul_chk_table_size(), "size of space allocated in nmethod incorrect");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   206
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   207
489c9b5090e2 Initial load
duke
parents:
diff changeset
   208
void ImplicitExceptionTable::copy_to( nmethod* nm ) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   209
  assert(size_in_bytes() <= nm->nul_chk_table_size(), "size of space allocated in nmethod incorrect");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   210
  if (len() != 0) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   211
    implicit_null_entry* nmdata = (implicit_null_entry*)nm->nul_chk_table_begin();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   212
    // store the length in the first uint
489c9b5090e2 Initial load
duke
parents:
diff changeset
   213
    nmdata[0] = _len;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   214
    nmdata++;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   215
    // copy the table after the length
489c9b5090e2 Initial load
duke
parents:
diff changeset
   216
    memmove( nmdata, _data, 2 * len() * sizeof(implicit_null_entry));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   217
  } else {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   218
    // zero length table takes zero bytes
489c9b5090e2 Initial load
duke
parents:
diff changeset
   219
    assert(size_in_bytes() == 0, "bad size");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   220
    assert(nm->nul_chk_table_size() == 0, "bad size");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   221
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   222
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   223
489c9b5090e2 Initial load
duke
parents:
diff changeset
   224
void ImplicitExceptionTable::verify(nmethod *nm) const {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   225
  for (uint i = 0; i < len(); i++) {
6418
6671edbd230e 6978355: renaming for 6961697
twisti
parents: 5547
diff changeset
   226
     if ((*adr(i) > (unsigned int)nm->insts_size()) ||
6671edbd230e 6978355: renaming for 6961697
twisti
parents: 5547
diff changeset
   227
         (*(adr(i)+1) > (unsigned int)nm->insts_size()))
33105
294e48b4f704 8080775: Better argument formatting for assert() and friends
david
parents: 31592
diff changeset
   228
       fatal("Invalid offset in ImplicitExceptionTable at " PTR_FORMAT, _data);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   229
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   230
}