method.hpp 45.5 KB
Newer Older
D
duke 已提交
1
/*
2
 * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
D
duke 已提交
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 *
 * This code is free software; you can redistribute it and/or modify it
 * under the terms of the GNU General Public License version 2 only, as
 * published by the Free Software Foundation.
 *
 * This code is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
 * version 2 for more details (a copy is included in the LICENSE file that
 * accompanied this code).
 *
 * You should have received a copy of the GNU General Public License version
 * 2 along with this work; if not, write to the Free Software Foundation,
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
 *
19 20 21
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
 * or visit www.oracle.com if you need additional information or have any
 * questions.
D
duke 已提交
22 23 24
 *
 */

25 26 27 28 29 30 31
#ifndef SHARE_VM_OOPS_METHODOOP_HPP
#define SHARE_VM_OOPS_METHODOOP_HPP

#include "classfile/vmSymbols.hpp"
#include "code/compressedStream.hpp"
#include "compiler/oopMap.hpp"
#include "interpreter/invocationCounter.hpp"
32 33
#include "oops/annotations.hpp"
#include "oops/constantPool.hpp"
34
#include "oops/methodCounters.hpp"
35 36 37 38 39 40
#include "oops/instanceKlass.hpp"
#include "oops/oop.hpp"
#include "oops/typeArrayOop.hpp"
#include "utilities/accessFlags.hpp"
#include "utilities/growableArray.hpp"

J
jwilhelm 已提交
41
// A Method represents a Java method.
D
duke 已提交
42 43 44 45
//
// Memory layout (each line represents a word). Note that most applications load thousands of methods,
// so keeping the size of this structure small has a big impact on footprint.
//
46
// The actual bytecodes are inlined after the end of the Method struct.
D
duke 已提交
47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64
//
// There are bits in the access_flags telling whether inlined tables are present.
// Note that accessing the line number and local variable tables is not performance critical at all.
// Accessing the checked exceptions table is used by reflection, so we put that last to make access
// to it fast.
//
// The line number table is compressed and inlined following the byte codes. It is found as the first
// byte following the byte codes. The checked exceptions table and the local variable table are inlined
// after the line number table, and indexed from the end of the method. We do not compress the checked
// exceptions table since the average length is less than 2, and do not bother to compress the local
// variable table either since it is mostly absent.
//
// Note that native_function and signature_handler has to be at fixed offsets (required by the interpreter)
//
// |------------------------------------------------------|
// | header                                               |
// | klass                                                |
// |------------------------------------------------------|
J
jwilhelm 已提交
65
// | ConstMethod*                   (metadata)            |
D
duke 已提交
66
// |------------------------------------------------------|
J
jwilhelm 已提交
67 68
// | MethodData*                    (metadata)            |
// | MethodCounters                                       |
D
duke 已提交
69 70 71 72 73 74
// |------------------------------------------------------|
// | access_flags                                         |
// | vtable_index                                         |
// |------------------------------------------------------|
// | result_index (C++ interpreter only)                  |
// |------------------------------------------------------|
J
jwilhelm 已提交
75
// | method_size             | intrinsic_id  |   flags    |
D
duke 已提交
76 77 78 79 80 81 82 83 84 85 86 87 88 89 90
// |------------------------------------------------------|
// | code                           (pointer)             |
// | i2i                            (pointer)             |
// | adapter                        (pointer)             |
// | from_compiled_entry            (pointer)             |
// | from_interpreted_entry         (pointer)             |
// |------------------------------------------------------|
// | native_function       (present only if native)       |
// | signature_handler     (present only if native)       |
// |------------------------------------------------------|


class CheckedExceptionElement;
class LocalVariableTableElement;
class AdapterHandlerEntry;
91
class MethodData;
92
class MethodCounters;
93
class ConstMethod;
C
coleenp 已提交
94
class InlineTableSizes;
95
class KlassSizeStats;
D
duke 已提交
96

97
class Method : public Metadata {
D
duke 已提交
98 99
 friend class VMStructs;
 private:
100 101
  ConstMethod*      _constMethod;                // Method read-only data.
  MethodData*       _method_data;
102
  MethodCounters*   _method_counters;
D
duke 已提交
103 104 105 106 107 108 109
  AccessFlags       _access_flags;               // Access flags
  int               _vtable_index;               // vtable index of this method (see VtableIndexFlag)
                                                 // note: can have vtables with >2**16 elements (because of inheritance)
#ifdef CC_INTERP
  int               _result_index;               // C++ interpreter needs for converting results to/from stack
#endif
  u2                _method_size;                // size of this object
110
  u1                _intrinsic_id;               // vmSymbols::intrinsic_id (0 == _none)
111 112 113 114 115 116 117 118 119 120

  // Flags
  enum Flags {
    _jfr_towrite      = 1 << 0,
    _caller_sensitive = 1 << 1,
    _force_inline     = 1 << 2,
    _dont_inline      = 1 << 3,
    _hidden           = 1 << 4
  };
  u1 _flags;
121

D
duke 已提交
122 123 124 125 126
#ifndef PRODUCT
  int               _compiled_invocation_count;  // Number of nmethod invocations so far (for perf. debugging)
#endif
  // Entry point for calling both from and to the interpreter.
  address _i2i_entry;           // All-args-on-stack calling convention
127
  // Adapter blob (i2c/c2i) for this Method*. Set once when method is linked.
D
duke 已提交
128 129 130 131 132 133 134 135 136 137 138 139
  AdapterHandlerEntry* _adapter;
  // Entry point for calling from compiled code, to compiled code if it exists
  // or else the interpreter.
  volatile address _from_compiled_entry;        // Cache of: _code ? _code->entry_point() : _adapter->c2i_entry()
  // The entry point for calling both from and to compiled code is
  // "_code->entry_point()".  Because of tiered compilation and de-opt, this
  // field can come and go.  It can transition from NULL to not-null at any
  // time (whenever a compile completes).  It can transition from not-null to
  // NULL only at safepoints (because of a de-opt).
  nmethod* volatile _code;                       // Points to the corresponding piece of native code
  volatile address           _from_interpreted_entry; // Cache of _code ? _adapter->i2c_entry() : _i2i_entry

140 141
  // Constructor
  Method(ConstMethod* xconst, AccessFlags access_flags, int size);
D
duke 已提交
142
 public:
143

144
  static Method* allocate(ClassLoaderData* loader_data,
145 146
                          int byte_code_size,
                          AccessFlags access_flags,
C
coleenp 已提交
147
                          InlineTableSizes* sizes,
148 149
                          ConstMethod::MethodType method_type,
                          TRAPS);
150

151 152
  // CDS and vtbl checking can create an empty Method to get vtbl pointer.
  Method(){}
153 154 155 156 157 158

  // The Method vtable is restored by this call when the Method is in the
  // shared archive.  See patch_klass_vtables() in metaspaceShared.cpp for
  // all the gory details.  SA, dtrace and pstack helpers distinguish metadata
  // by their vtable.
  void restore_vtable() { guarantee(is_method(), "vtable restored by this call"); }
159
  bool is_method() const volatile { return true; }
160

D
duke 已提交
161
  // accessors for instance variables
162

163 164
  ConstMethod* constMethod() const             { return _constMethod; }
  void set_constMethod(ConstMethod* xconst)    { _constMethod = xconst; }
D
duke 已提交
165 166 167 168 169 170 171 172 173 174 175


  static address make_adapters(methodHandle mh, TRAPS);
  volatile address from_compiled_entry() const   { return (address)OrderAccess::load_ptr_acquire(&_from_compiled_entry); }
  volatile address from_interpreted_entry() const{ return (address)OrderAccess::load_ptr_acquire(&_from_interpreted_entry); }

  // access flag
  AccessFlags access_flags() const               { return _access_flags;  }
  void set_access_flags(AccessFlags flags)       { _access_flags = flags; }

  // name
176
  Symbol* name() const                           { return constants()->symbol_at(name_index()); }
D
duke 已提交
177 178 179 180
  int name_index() const                         { return constMethod()->name_index();         }
  void set_name_index(int index)                 { constMethod()->set_name_index(index);       }

  // signature
181
  Symbol* signature() const                      { return constants()->symbol_at(signature_index()); }
D
duke 已提交
182 183 184 185
  int signature_index() const                    { return constMethod()->signature_index();         }
  void set_signature_index(int index)            { constMethod()->set_signature_index(index);       }

  // generics support
186
  Symbol* generic_signature() const              { int idx = generic_signature_index(); return ((idx != 0) ? constants()->symbol_at(idx) : (Symbol*)NULL); }
D
duke 已提交
187 188 189 190
  int generic_signature_index() const            { return constMethod()->generic_signature_index(); }
  void set_generic_signature_index(int index)    { constMethod()->set_generic_signature_index(index); }

  // annotations support
191
  AnnotationArray* annotations() const           {
C
coleenp 已提交
192
    return constMethod()->method_annotations();
193 194
  }
  AnnotationArray* parameter_annotations() const {
C
coleenp 已提交
195
    return constMethod()->parameter_annotations();
196 197
  }
  AnnotationArray* annotation_default() const    {
C
coleenp 已提交
198 199 200 201
    return constMethod()->default_annotations();
  }
  AnnotationArray* type_annotations() const      {
    return constMethod()->type_annotations();
202
  }
D
duke 已提交
203 204 205 206 207 208 209 210 211 212

#ifdef CC_INTERP
  void set_result_index(BasicType type);
  int  result_index()                            { return _result_index; }
#endif

  // Helper routine: get klass name + "." + method name + signature as
  // C string, for the purpose of providing more useful NoSuchMethodErrors
  // and fatal error handling. The string is allocated in resource
  // area if a buffer is not provided by the caller.
213 214
  char* name_and_sig_as_C_string() const;
  char* name_and_sig_as_C_string(char* buf, int size) const;
D
duke 已提交
215

216
  // Static routine in the situations we don't have a Method*
217 218
  static char* name_and_sig_as_C_string(Klass* klass, Symbol* method_name, Symbol* signature);
  static char* name_and_sig_as_C_string(Klass* klass, Symbol* method_name, Symbol* signature, char* buf, int size);
D
duke 已提交
219

220 221 222 223 224 225 226
  Bytecodes::Code java_code_at(int bci) const {
    return Bytecodes::java_code_at(this, bcp_from(bci));
  }
  Bytecodes::Code code_at(int bci) const {
    return Bytecodes::code_at(this, bcp_from(bci));
  }

D
duke 已提交
227
  // JVMTI breakpoints
228
  Bytecodes::Code orig_bytecode_at(int bci) const;
D
duke 已提交
229 230 231 232 233 234
  void        set_orig_bytecode_at(int bci, Bytecodes::Code code);
  void set_breakpoint(int bci);
  void clear_breakpoint(int bci);
  void clear_all_breakpoints();
  // Tracking number of breakpoints, for fullspeed debugging.
  // Only mutated by VM thread.
235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253
  u2   number_of_breakpoints()             const {
    if (method_counters() == NULL) {
      return 0;
    } else {
      return method_counters()->number_of_breakpoints();
    }
  }
  void incr_number_of_breakpoints(TRAPS)         {
    MethodCounters* mcs = get_method_counters(CHECK);
    if (mcs != NULL) {
      mcs->incr_number_of_breakpoints();
    }
  }
  void decr_number_of_breakpoints(TRAPS)         {
    MethodCounters* mcs = get_method_counters(CHECK);
    if (mcs != NULL) {
      mcs->decr_number_of_breakpoints();
    }
  }
D
duke 已提交
254
  // Initialization only
255 256 257 258 259
  void clear_number_of_breakpoints()             {
    if (method_counters() != NULL) {
      method_counters()->clear_number_of_breakpoints();
    }
  }
D
duke 已提交
260

261
  // index into InstanceKlass methods() array
262
  // note: also used by jfr
D
duke 已提交
263 264 265 266 267 268 269 270 271 272 273 274 275
  u2 method_idnum() const           { return constMethod()->method_idnum(); }
  void set_method_idnum(u2 idnum)   { constMethod()->set_method_idnum(idnum); }

  // code size
  int code_size() const                  { return constMethod()->code_size(); }

  // method size
  int method_size() const                        { return _method_size; }
  void set_method_size(int size) {
    assert(0 <= size && size < (1 << 16), "invalid method size");
    _method_size = size;
  }

276 277 278
  // constant pool for Klass* holding this method
  ConstantPool* constants() const              { return constMethod()->constants(); }
  void set_constants(ConstantPool* c)          { constMethod()->set_constants(c); }
D
duke 已提交
279 280

  // max stack
281
  // return original max stack size for method verification
282 283 284
  int  verifier_max_stack() const                { return constMethod()->max_stack(); }
  int           max_stack() const                { return constMethod()->max_stack() + extra_stack_entries(); }
  void      set_max_stack(int size)              {        constMethod()->set_max_stack(size); }
D
duke 已提交
285 286

  // max locals
287 288
  int  max_locals() const                        { return constMethod()->max_locals(); }
  void set_max_locals(int size)                  { constMethod()->set_max_locals(size); }
I
iveresov 已提交
289 290 291 292 293

  int highest_comp_level() const;
  void set_highest_comp_level(int level);
  int highest_osr_comp_level() const;
  void set_highest_osr_comp_level(int level);
D
duke 已提交
294 295

  // Count of times method was exited via exception while interpreting
296 297 298 299
  void interpreter_throwout_increment(TRAPS) {
    MethodCounters* mcs = get_method_counters(CHECK);
    if (mcs != NULL) {
      mcs->interpreter_throwout_increment();
D
duke 已提交
300 301 302
    }
  }

303 304 305 306 307 308 309
  int  interpreter_throwout_count() const        {
    if (method_counters() == NULL) {
      return 0;
    } else {
      return method_counters()->interpreter_throwout_count();
    }
  }
D
duke 已提交
310 311

  // size of parameters
312 313
  int  size_of_parameters() const                { return constMethod()->size_of_parameters(); }
  void set_size_of_parameters(int size)          { constMethod()->set_size_of_parameters(size); }
D
duke 已提交
314 315 316 317 318

  bool has_stackmap_table() const {
    return constMethod()->has_stackmap_table();
  }

319
  Array<u1>* stackmap_data() const {
D
duke 已提交
320 321 322
    return constMethod()->stackmap_data();
  }

323
  void set_stackmap_data(Array<u1>* sd) {
324 325 326
    constMethod()->set_stackmap_data(sd);
  }

D
duke 已提交
327 328 329
  // exception handler table
  bool has_exception_handler() const
                             { return constMethod()->has_exception_handler(); }
330 331 332 333
  int exception_table_length() const
                             { return constMethod()->exception_table_length(); }
  ExceptionTableElement* exception_table_start() const
                             { return constMethod()->exception_table_start(); }
D
duke 已提交
334 335 336 337 338 339 340 341 342 343 344 345 346

  // Finds the first entry point bci of an exception handler for an
  // exception of klass ex_klass thrown at throw_bci. A value of NULL
  // for ex_klass indicates that the exception klass is not known; in
  // this case it matches any constraint class. Returns -1 if the
  // exception cannot be handled in this method. The handler
  // constraint classes are loaded if necessary. Note that this may
  // throw an exception if loading of the constraint classes causes
  // an IllegalAccessError (bugid 4307310) or an OutOfMemoryError.
  // If an exception is thrown, returns the bci of the
  // exception handler which caused the exception to be thrown, which
  // is needed for proper retries. See, for example,
  // InterpreterRuntime::exception_handler_for_exception.
347
  static int fast_exception_handler_bci_for(methodHandle mh, KlassHandle ex_klass, int throw_bci, TRAPS);
D
duke 已提交
348 349

  // method data access
350
  MethodData* method_data() const              {
D
duke 已提交
351 352
    return _method_data;
  }
353

354
  void set_method_data(MethodData* data)       {
355 356 357 358
    // The store into method must be released. On platforms without
    // total store order (TSO) the reference may become visible before
    // the initialization of data otherwise.
    OrderAccess::release_store_ptr((volatile void *)&_method_data, data);
D
duke 已提交
359 360
  }

361 362 363 364 365
  MethodCounters* method_counters() const {
    return _method_counters;
  }

  void set_method_counters(MethodCounters* counters) {
366 367 368 369
    // The store into method must be released. On platforms without
    // total store order (TSO) the reference may become visible before
    // the initialization of data otherwise.
    OrderAccess::release_store_ptr((volatile void *)&_method_counters, counters);
370
  }
I
iveresov 已提交
371

372 373 374
#ifdef TIERED
  // We are reusing interpreter_invocation_count as a holder for the previous event count!
  // We can do that since interpreter_invocation_count is not used in tiered.
375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405
  int prev_event_count() const                   {
    if (method_counters() == NULL) {
      return 0;
    } else {
      return method_counters()->interpreter_invocation_count();
    }
  }
  void set_prev_event_count(int count, TRAPS)    {
    MethodCounters* mcs = get_method_counters(CHECK);
    if (mcs != NULL) {
      mcs->set_interpreter_invocation_count(count);
    }
  }
  jlong prev_time() const                        {
    return method_counters() == NULL ? 0 : method_counters()->prev_time();
  }
  void set_prev_time(jlong time, TRAPS)          {
    MethodCounters* mcs = get_method_counters(CHECK);
    if (mcs != NULL) {
      mcs->set_prev_time(time);
    }
  }
  float rate() const                             {
    return method_counters() == NULL ? 0 : method_counters()->rate();
  }
  void set_rate(float rate, TRAPS) {
    MethodCounters* mcs = get_method_counters(CHECK);
    if (mcs != NULL) {
      mcs->set_rate(rate);
    }
  }
406 407
#endif

I
iveresov 已提交
408 409 410 411 412
  int invocation_count();
  int backedge_count();

  bool was_executed_more_than(int n);
  bool was_never_executed()                      { return !was_executed_more_than(0); }
D
duke 已提交
413 414 415

  static void build_interpreter_method_data(methodHandle method, TRAPS);

416 417
  static MethodCounters* build_method_counters(Method* m, TRAPS);

I
iveresov 已提交
418 419
  int interpreter_invocation_count() {
    if (TieredCompilation) return invocation_count();
420 421
    else return (method_counters() == NULL) ? 0 :
                 method_counters()->interpreter_invocation_count();
I
iveresov 已提交
422
  }
423
  int increment_interpreter_invocation_count(TRAPS) {
I
iveresov 已提交
424
    if (TieredCompilation) ShouldNotReachHere();
425 426
    MethodCounters* mcs = get_method_counters(CHECK_0);
    return (mcs == NULL) ? 0 : mcs->increment_interpreter_invocation_count();
I
iveresov 已提交
427
  }
D
duke 已提交
428 429

#ifndef PRODUCT
I
iveresov 已提交
430
  int  compiled_invocation_count() const         { return _compiled_invocation_count;  }
D
duke 已提交
431 432 433
  void set_compiled_invocation_count(int count)  { _compiled_invocation_count = count; }
#endif // not PRODUCT

T
twisti 已提交
434
  // Clear (non-shared space) pointers which could not be relevant
D
duke 已提交
435 436 437 438 439 440 441 442
  // if this (shared) method were mapped into another JVM.
  void remove_unshareable_info();

  // nmethod/verified compiler entry
  address verified_code_entry();
  bool check_code() const;      // Not inline to avoid circular ref
  nmethod* volatile code() const                 { assert( check_code(), "" ); return (nmethod *)OrderAccess::load_ptr_acquire(&_code); }
  void clear_code();            // Clear out any compiled code
443
  static void set_code(methodHandle mh, nmethod* code);
D
duke 已提交
444 445 446 447 448 449 450 451 452 453 454 455 456 457
  void set_adapter_entry(AdapterHandlerEntry* adapter) {  _adapter = adapter; }
  address get_i2c_entry();
  address get_c2i_entry();
  address get_c2i_unverified_entry();
  AdapterHandlerEntry* adapter() {  return _adapter; }
  // setup entry points
  void link_method(methodHandle method, TRAPS);
  // clear entry points. Used by sharing code
  void unlink_method();

  // vtable index
  enum VtableIndexFlag {
    // Valid vtable indexes are non-negative (>= 0).
    // These few negative values are used as sentinels.
458 459
    itable_index_max        = -10, // first itable index, growing downward
    pending_itable_index    = -9,  // itable index will be assigned
D
duke 已提交
460 461 462 463 464 465
    invalid_vtable_index    = -4,  // distinct from any valid vtable index
    garbage_vtable_index    = -3,  // not yet linked; no vtable layout yet
    nonvirtual_vtable_index = -2   // there is no need for vtable dispatch
    // 6330203 Note:  Do not use -1, which was overloaded with many meanings.
  };
  DEBUG_ONLY(bool valid_vtable_index() const     { return _vtable_index >= nonvirtual_vtable_index; })
466 467
  bool has_vtable_index() const                  { return _vtable_index >= 0; }
  int  vtable_index() const                      { return _vtable_index; }
D
duke 已提交
468
  void set_vtable_index(int index)               { _vtable_index = index; }
469 470 471 472 473
  DEBUG_ONLY(bool valid_itable_index() const     { return _vtable_index <= pending_itable_index; })
  bool has_itable_index() const                  { return _vtable_index <= itable_index_max; }
  int  itable_index() const                      { assert(valid_itable_index(), "");
                                                   return itable_index_max - _vtable_index; }
  void set_itable_index(int index)               { _vtable_index = itable_index_max - index; assert(valid_itable_index(), ""); }
D
duke 已提交
474 475 476 477 478 479 480 481 482 483 484

  // interpreter entry
  address interpreter_entry() const              { return _i2i_entry; }
  // Only used when first initialize so we can set _i2i_entry and _from_interpreted_entry
  void set_interpreter_entry(address entry)      { _i2i_entry = entry;  _from_interpreted_entry = entry; }

  // native function (used for native methods only)
  enum {
    native_bind_event_is_interesting = true
  };
  address native_function() const                { return *(native_function_addr()); }
485 486
  address critical_native_function();

D
duke 已提交
487 488 489 490 491 492 493 494 495 496 497 498 499 500 501
  // Must specify a real function (not NULL).
  // Use clear_native_function() to unregister.
  void set_native_function(address function, bool post_event_flag);
  bool has_native_function() const;
  void clear_native_function();

  // signature handler (used for native methods only)
  address signature_handler() const              { return *(signature_handler_addr()); }
  void set_signature_handler(address handler);

  // Interpreter oopmap support
  void mask_for(int bci, InterpreterOopMap* mask);

#ifndef PRODUCT
  // operations on invocation counter
I
iveresov 已提交
502
  void print_invocation_count();
D
duke 已提交
503 504 505
#endif

  // byte codes
506
  void    set_code(address code)      { return constMethod()->set_code(code); }
D
duke 已提交
507 508 509 510 511 512 513 514
  address code_base() const           { return constMethod()->code_base(); }
  bool    contains(address bcp) const { return constMethod()->contains(bcp); }

  // prints byte codes
  void print_codes() const            { print_codes_on(tty); }
  void print_codes_on(outputStream* st) const                      PRODUCT_RETURN;
  void print_codes_on(int from, int to, outputStream* st) const    PRODUCT_RETURN;

515
  // method parameters
516 517
  bool has_method_parameters() const
                         { return constMethod()->has_method_parameters(); }
518 519 520 521 522
  int method_parameters_length() const
                         { return constMethod()->method_parameters_length(); }
  MethodParametersElement* method_parameters_start() const
                          { return constMethod()->method_parameters_start(); }

D
duke 已提交
523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541
  // checked exceptions
  int checked_exceptions_length() const
                         { return constMethod()->checked_exceptions_length(); }
  CheckedExceptionElement* checked_exceptions_start() const
                          { return constMethod()->checked_exceptions_start(); }

  // localvariable table
  bool has_localvariable_table() const
                          { return constMethod()->has_localvariable_table(); }
  int localvariable_table_length() const
                        { return constMethod()->localvariable_table_length(); }
  LocalVariableTableElement* localvariable_table_start() const
                         { return constMethod()->localvariable_table_start(); }

  bool has_linenumber_table() const
                              { return constMethod()->has_linenumber_table(); }
  u_char* compressed_linenumber_table() const
                       { return constMethod()->compressed_linenumber_table(); }

542
  // method holder (the Klass* holding this method)
543
  InstanceKlass* method_holder() const         { return constants()->pool_holder(); }
D
duke 已提交
544 545

  void compute_size_of_parameters(Thread *thread); // word size of parameters (receiver if any + arguments)
546
  Symbol* klass_name() const;                    // returns the name of the method holder
D
duke 已提交
547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575
  BasicType result_type() const;                 // type of the method result
  int result_type_index() const;                 // type index of the method result
  bool is_returning_oop() const                  { BasicType r = result_type(); return (r == T_OBJECT || r == T_ARRAY); }
  bool is_returning_fp() const                   { BasicType r = result_type(); return (r == T_FLOAT || r == T_DOUBLE); }

  // Checked exceptions thrown by this method (resolved to mirrors)
  objArrayHandle resolved_checked_exceptions(TRAPS) { return resolved_checked_exceptions_impl(this, THREAD); }

  // Access flags
  bool is_public() const                         { return access_flags().is_public();      }
  bool is_private() const                        { return access_flags().is_private();     }
  bool is_protected() const                      { return access_flags().is_protected();   }
  bool is_package_private() const                { return !is_public() && !is_private() && !is_protected(); }
  bool is_static() const                         { return access_flags().is_static();      }
  bool is_final() const                          { return access_flags().is_final();       }
  bool is_synchronized() const                   { return access_flags().is_synchronized();}
  bool is_native() const                         { return access_flags().is_native();      }
  bool is_abstract() const                       { return access_flags().is_abstract();    }
  bool is_strict() const                         { return access_flags().is_strict();      }
  bool is_synthetic() const                      { return access_flags().is_synthetic();   }

  // returns true if contains only return operation
  bool is_empty_method() const;

  // returns true if this is a vanilla constructor
  bool is_vanilla_constructor() const;

  // checks method and its method holder
  bool is_final_method() const;
576
  bool is_final_method(AccessFlags class_access_flags) const;
577
  bool is_default_method() const;
D
duke 已提交
578 579 580

  // true if method needs no dynamic dispatch (final and/or no vtable entry)
  bool can_be_statically_bound() const;
581
  bool can_be_statically_bound(AccessFlags class_access_flags) const;
D
duke 已提交
582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614

  // returns true if the method has any backward branches.
  bool has_loops() {
    return access_flags().loops_flag_init() ? access_flags().has_loops() : compute_has_loops_flag();
  };

  bool compute_has_loops_flag();

  bool has_jsrs() {
    return access_flags().has_jsrs();
  };
  void set_has_jsrs() {
    _access_flags.set_has_jsrs();
  }

  // returns true if the method has any monitors.
  bool has_monitors() const                      { return is_synchronized() || access_flags().has_monitor_bytecodes(); }
  bool has_monitor_bytecodes() const             { return access_flags().has_monitor_bytecodes(); }

  void set_has_monitor_bytecodes()               { _access_flags.set_has_monitor_bytecodes(); }

  // monitor matching. This returns a conservative estimate of whether the monitorenter/monitorexit bytecodes
  // propererly nest in the method. It might return false, even though they actually nest properly, since the info.
  // has not been computed yet.
  bool guaranteed_monitor_matching() const       { return access_flags().is_monitor_matching(); }
  void set_guaranteed_monitor_matching()         { _access_flags.set_monitor_matching(); }

  // returns true if the method is an accessor function (setter/getter).
  bool is_accessor() const;

  // returns true if the method is an initializer (<init> or <clinit>).
  bool is_initializer() const;

615 616 617 618 619 620 621
  // returns true if the method is static OR if the classfile version < 51
  bool has_valid_initializer_flags() const;

  // returns true if the method name is <clinit> and the method has
  // valid static initializer flags.
  bool is_static_initializer() const;

D
duke 已提交
622 623 624 625 626 627
  // compiled code support
  // NOTE: code() is inherently racy as deopt can be clearing code
  // simultaneously. Use with caution.
  bool has_compiled_code() const                 { return code() != NULL; }

  // sizing
628 629 630
  static int header_size()                       { return sizeof(Method)/HeapWordSize; }
  static int size(bool is_native);
  int size() const                               { return method_size(); }
631 632 633
#if INCLUDE_SERVICES
  void collect_statistics(KlassSizeStats *sz) const;
#endif
D
duke 已提交
634 635

  // interpreter support
636 637
  static ByteSize const_offset()                 { return byte_offset_of(Method, _constMethod       ); }
  static ByteSize access_flags_offset()          { return byte_offset_of(Method, _access_flags      ); }
D
duke 已提交
638
#ifdef CC_INTERP
639
  static ByteSize result_index_offset()          { return byte_offset_of(Method, _result_index ); }
D
duke 已提交
640
#endif /* CC_INTERP */
641 642
  static ByteSize from_compiled_offset()         { return byte_offset_of(Method, _from_compiled_entry); }
  static ByteSize code_offset()                  { return byte_offset_of(Method, _code); }
D
duke 已提交
643
  static ByteSize method_data_offset()           {
644
    return byte_offset_of(Method, _method_data);
D
duke 已提交
645
  }
646 647 648
  static ByteSize method_counters_offset()       {
    return byte_offset_of(Method, _method_counters);
  }
D
duke 已提交
649
#ifndef PRODUCT
650
  static ByteSize compiled_invocation_counter_offset() { return byte_offset_of(Method, _compiled_invocation_count); }
D
duke 已提交
651
#endif // not PRODUCT
652 653 654 655
  static ByteSize native_function_offset()       { return in_ByteSize(sizeof(Method));                 }
  static ByteSize from_interpreted_offset()      { return byte_offset_of(Method, _from_interpreted_entry ); }
  static ByteSize interpreter_entry_offset()     { return byte_offset_of(Method, _i2i_entry ); }
  static ByteSize signature_handler_offset()     { return in_ByteSize(sizeof(Method) + wordSize);      }
D
duke 已提交
656 657

  // for code generation
658 659
  static int method_data_offset_in_bytes()       { return offset_of(Method, _method_data); }
  static int intrinsic_id_offset_in_bytes()      { return offset_of(Method, _intrinsic_id); }
660
  static int intrinsic_id_size_in_bytes()        { return sizeof(u1); }
D
duke 已提交
661 662 663

  // Static methods that are used to implement member methods where an exposed this pointer
  // is needed due to possible GCs
664
  static objArrayHandle resolved_checked_exceptions_impl(Method* this_oop, TRAPS);
D
duke 已提交
665 666 667 668 669 670 671 672 673 674 675

  // Returns the byte code index from the byte code pointer
  int     bci_from(address bcp) const;
  address bcp_from(int     bci) const;
  int validate_bci_from_bcx(intptr_t bcx) const;

  // Returns the line number for a bci if debugging information for the method is prowided,
  // -1 is returned otherwise.
  int line_number_from_bci(int bci) const;

  // Reflection support
676
  bool is_overridden_in(Klass* k) const;
D
duke 已提交
677

678 679 680
  // Stack walking support
  bool is_ignored_by_security_stack_walk() const;

681
  // JSR 292 support
682 683 684 685 686 687
  bool is_method_handle_intrinsic() const;          // MethodHandles::is_signature_polymorphic_intrinsic(intrinsic_id)
  bool is_compiled_lambda_form() const;             // intrinsic_id() == vmIntrinsics::_compiledLambdaForm
  bool has_member_arg() const;                      // intrinsic_id() == vmIntrinsics::_linkToSpecial, etc.
  static methodHandle make_method_handle_intrinsic(vmIntrinsics::ID iid, // _invokeBasic, _linkToVirtual
                                                   Symbol* signature, //anything at all
                                                   TRAPS);
688
  static Klass* check_non_bcp_klass(Klass* klass);
689 690 691 692 693

  // How many extra stack entries for invokedynamic when it's enabled
  static const int extra_stack_entries_for_jsr292 = 1;

  // this operates only on invoke methods:
694
  // presize interpreter frames for extra interpreter stack entries, if needed
695 696 697
  // Account for the extra appendix argument for invokehandle/invokedynamic
  static int extra_stack_entries() { return EnableInvokeDynamic ? extra_stack_entries_for_jsr292 : 0; }
  static int extra_stack_words();  // = extra_stack_entries() * Interpreter::stackElementSize
698

D
duke 已提交
699 700 701 702 703
  // RedefineClasses() support:
  bool is_old() const                               { return access_flags().is_old(); }
  void set_is_old()                                 { _access_flags.set_is_old(); }
  bool is_obsolete() const                          { return access_flags().is_obsolete(); }
  void set_is_obsolete()                            { _access_flags.set_is_obsolete(); }
704 705 706 707
  bool on_stack() const                             { return access_flags().on_stack(); }
  void set_on_stack(const bool value);

  // see the definition in Method*.cpp for the gory details
708
  bool should_not_be_cached() const;
D
duke 已提交
709 710 711 712 713 714 715 716 717

  // JVMTI Native method prefixing support:
  bool is_prefixed_native() const                   { return access_flags().is_prefixed_native(); }
  void set_is_prefixed_native()                     { _access_flags.set_is_prefixed_native(); }

  // Rewriting support
  static methodHandle clone_with_new_data(methodHandle m, u_char* new_code, int new_code_length,
                                          u_char* new_compressed_linenumber_table, int new_compressed_linenumber_size, TRAPS);

718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746
  // jmethodID handling
  // Because the useful life-span of a jmethodID cannot be determined,
  // once created they are never reclaimed.  The methods to which they refer,
  // however, can be GC'ed away if the class is unloaded or if the method is
  // made obsolete or deleted -- in these cases, the jmethodID
  // refers to NULL (as is the case for any weak reference).
  static jmethodID make_jmethod_id(ClassLoaderData* loader_data, Method* mh);
  static void destroy_jmethod_id(ClassLoaderData* loader_data, jmethodID mid);

  // Use resolve_jmethod_id() in situations where the caller is expected
  // to provide a valid jmethodID; the only sanity checks are in asserts;
  // result guaranteed not to be NULL.
  inline static Method* resolve_jmethod_id(jmethodID mid) {
    assert(mid != NULL, "JNI method id should not be null");
    return *((Method**)mid);
  }

  // Use checked_resolve_jmethod_id() in situations where the caller
  // should provide a valid jmethodID, but might not. NULL is returned
  // when the jmethodID does not refer to a valid method.
  static Method* checked_resolve_jmethod_id(jmethodID mid);

  static void change_method_associated_with_jmethod_id(jmethodID old_jmid_ptr, Method* new_method);
  static bool is_method_id(jmethodID mid);

  // Clear methods
  static void clear_jmethod_ids(ClassLoaderData* loader_data);
  static void print_jmethod_ids(ClassLoaderData* loader_data, outputStream* out) PRODUCT_RETURN;

D
duke 已提交
747 748
  // Get this method's jmethodID -- allocate if it doesn't exist
  jmethodID jmethod_id()                            { methodHandle this_h(this);
749
                                                      return InstanceKlass::get_jmethod_id(method_holder(), this_h); }
D
duke 已提交
750 751 752 753 754 755

  // Lookup the jmethodID for this method.  Return NULL if not found.
  // NOTE that this function can be called from a signal handler
  // (see AsyncGetCallTrace support for Forte Analyzer) and this
  // needs to be async-safe. No allocation should be done and
  // so handles are not used to avoid deadlock.
756
  jmethodID find_jmethod_id_or_null()               { return method_holder()->jmethod_id_or_null(this); }
D
duke 已提交
757 758

  // Support for inlining of intrinsic methods
759 760 761 762 763
  vmIntrinsics::ID intrinsic_id() const          { return (vmIntrinsics::ID) _intrinsic_id;           }
  void     set_intrinsic_id(vmIntrinsics::ID id) {                           _intrinsic_id = (u1) id; }

  // Helper routines for intrinsic_id() and vmIntrinsics::method().
  void init_intrinsic_id();     // updates from _none if a match
764
  static vmSymbols::SID klass_id_for_intrinsics(Klass* holder);
D
duke 已提交
765

766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800
  bool jfr_towrite() {
    return (_flags & _jfr_towrite) != 0;
  }
  void set_jfr_towrite(bool x) {
    _flags = x ? (_flags | _jfr_towrite) : (_flags & ~_jfr_towrite);
  }

  bool caller_sensitive() {
    return (_flags & _caller_sensitive) != 0;
  }
  void set_caller_sensitive(bool x) {
    _flags = x ? (_flags | _caller_sensitive) : (_flags & ~_caller_sensitive);
  }

  bool force_inline() {
    return (_flags & _force_inline) != 0;
  }
  void set_force_inline(bool x) {
    _flags = x ? (_flags | _force_inline) : (_flags & ~_force_inline);
  }

  bool dont_inline() {
    return (_flags & _dont_inline) != 0;
  }
  void set_dont_inline(bool x) {
    _flags = x ? (_flags | _dont_inline) : (_flags & ~_dont_inline);
  }

  bool is_hidden() {
    return (_flags & _hidden) != 0;
  }
  void set_hidden(bool x) {
    _flags = x ? (_flags | _hidden) : (_flags & ~_hidden);
  }

801 802 803 804
  ConstMethod::MethodType method_type() const {
      return _constMethod->method_type();
  }
  bool is_overpass() const { return method_type() == ConstMethod::OVERPASS; }
805

D
duke 已提交
806
  // On-stack replacement support
I
iveresov 已提交
807
  bool has_osr_nmethod(int level, bool match_level) {
808
   return method_holder()->lookup_osr_nmethod(this, InvocationEntryBci, level, match_level) != NULL;
I
iveresov 已提交
809 810 811
  }

  nmethod* lookup_osr_nmethod_for(int bci, int level, bool match_level) {
812
    return method_holder()->lookup_osr_nmethod(this, bci, level, match_level);
I
iveresov 已提交
813
  }
D
duke 已提交
814 815 816 817 818 819 820 821 822 823 824

  // Inline cache support
  void cleanup_inline_caches();

  // Find if klass for method is loaded
  bool is_klass_loaded_by_klass_index(int klass_index) const;
  bool is_klass_loaded(int refinfo_index, bool must_be_resolved = false) const;

  // Indicates whether compilation failed earlier for this method, or
  // whether it is not compilable for another reason like having a
  // breakpoint set in it.
825
  bool  is_not_compilable(int comp_level = CompLevel_any) const;
826
  void set_not_compilable(int comp_level = CompLevel_all, bool report = true, const char* reason = NULL);
I
iveresov 已提交
827
  void set_not_compilable_quietly(int comp_level = CompLevel_all) {
828 829
    set_not_compilable(comp_level, false);
  }
830
  bool  is_not_osr_compilable(int comp_level = CompLevel_any) const;
831
  void set_not_osr_compilable(int comp_level = CompLevel_all, bool report = true, const char* reason = NULL);
832 833
  void set_not_osr_compilable_quietly(int comp_level = CompLevel_all) {
    set_not_osr_compilable(comp_level, false);
I
iveresov 已提交
834
  }
835
  bool is_always_compilable() const;
836 837

 private:
838
  void print_made_not_compilable(int comp_level, bool is_osr, bool report, const char* reason);
839

840
 public:
841 842 843 844 845 846 847
  MethodCounters* get_method_counters(TRAPS) {
    if (_method_counters == NULL) {
      build_method_counters(this, CHECK_AND_CLEAR_NULL);
    }
    return _method_counters;
  }

848 849 850 851 852 853 854 855 856 857 858 859 860
  bool   is_not_c1_compilable() const         { return access_flags().is_not_c1_compilable();  }
  void  set_not_c1_compilable()               {       _access_flags.set_not_c1_compilable();   }
  void clear_not_c1_compilable()              {       _access_flags.clear_not_c1_compilable(); }
  bool   is_not_c2_compilable() const         { return access_flags().is_not_c2_compilable();  }
  void  set_not_c2_compilable()               {       _access_flags.set_not_c2_compilable();   }
  void clear_not_c2_compilable()              {       _access_flags.clear_not_c2_compilable(); }

  bool    is_not_c1_osr_compilable() const    { return is_not_c1_compilable(); }  // don't waste an accessFlags bit
  void   set_not_c1_osr_compilable()          {       set_not_c1_compilable(); }  // don't waste an accessFlags bit
  void clear_not_c1_osr_compilable()          {     clear_not_c1_compilable(); }  // don't waste an accessFlags bit
  bool   is_not_c2_osr_compilable() const     { return access_flags().is_not_c2_osr_compilable();  }
  void  set_not_c2_osr_compilable()           {       _access_flags.set_not_c2_osr_compilable();   }
  void clear_not_c2_osr_compilable()          {       _access_flags.clear_not_c2_osr_compilable(); }
D
duke 已提交
861 862

  // Background compilation support
I
iveresov 已提交
863 864 865
  bool queued_for_compilation() const  { return access_flags().queued_for_compilation(); }
  void set_queued_for_compilation()    { _access_flags.set_queued_for_compilation();     }
  void clear_queued_for_compilation()  { _access_flags.clear_queued_for_compilation();   }
D
duke 已提交
866 867 868 869 870 871 872 873

  // Resolve all classes in signature, return 'true' if successful
  static bool load_signature_classes(methodHandle m, TRAPS);

  // Return if true if not all classes references in signature, including return type, has been loaded
  static bool has_unloaded_classes_in_signature(methodHandle m, TRAPS);

  // Printing
874 875 876 877
  void print_short_name(outputStream* st = tty); // prints as klassname::methodname; Exposed so field engineers can debug VM
#if INCLUDE_JVMTI
  void print_name(outputStream* st = tty); // prints as "virtual void foo(int)"; exposed for TraceRedefineClasses
#else
878
  void print_name(outputStream* st = tty)        PRODUCT_RETURN; // prints as "virtual void foo(int)"
879
#endif
D
duke 已提交
880 881

  // Helper routine used for method sorting
882
  static void sort_methods(Array<Method*>* methods, bool idempotent = false, bool set_idnums = true);
D
duke 已提交
883

884 885 886 887 888 889 890 891 892 893 894
  // Deallocation function for redefine classes or if an error occurs
  void deallocate_contents(ClassLoaderData* loader_data);

  // Printing
#ifndef PRODUCT
  void print_on(outputStream* st) const;
#endif
  void print_value_on(outputStream* st) const;

  const char* internal_name() const { return "{method}"; }

895 896 897
  // Check for valid method pointer
  bool is_valid_method() const;

898 899 900 901
  // Verify
  void verify() { verify_on(tty); }
  void verify_on(outputStream* st);

D
duke 已提交
902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947
 private:

  // Inlined elements
  address* native_function_addr() const          { assert(is_native(), "must be native"); return (address*) (this+1); }
  address* signature_handler_addr() const        { return native_function_addr() + 1; }
};


// Utility class for compressing line number tables

class CompressedLineNumberWriteStream: public CompressedWriteStream {
 private:
  int _bci;
  int _line;
 public:
  // Constructor
  CompressedLineNumberWriteStream(int initial_size) : CompressedWriteStream(initial_size), _bci(0), _line(0) {}
  CompressedLineNumberWriteStream(u_char* buffer, int initial_size) : CompressedWriteStream(buffer, initial_size), _bci(0), _line(0) {}

  // Write (bci, line number) pair to stream
  void write_pair_regular(int bci_delta, int line_delta);

  inline void write_pair_inline(int bci, int line) {
    int bci_delta = bci - _bci;
    int line_delta = line - _line;
    _bci = bci;
    _line = line;
    // Skip (0,0) deltas - they do not add information and conflict with terminator.
    if (bci_delta == 0 && line_delta == 0) return;
    // Check if bci is 5-bit and line number 3-bit unsigned.
    if (((bci_delta & ~0x1F) == 0) && ((line_delta & ~0x7) == 0)) {
      // Compress into single byte.
      jubyte value = ((jubyte) bci_delta << 3) | (jubyte) line_delta;
      // Check that value doesn't match escape character.
      if (value != 0xFF) {
        write_byte(value);
        return;
      }
    }
    write_pair_regular(bci_delta, line_delta);
  }

// Windows AMD64 + Apr 2005 PSDK with /O2 generates bad code for write_pair.
// Disabling optimization doesn't work for methods in header files
// so we force it to call through the non-optimized version in the .cpp.
// It's gross, but it's the only way we can ensure that all callers are
948 949
// fixed.  _MSC_VER is defined by the windows compiler
#if defined(_M_AMD64) && _MSC_VER >= 1400
D
duke 已提交
950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986
  void write_pair(int bci, int line);
#else
  void write_pair(int bci, int line) { write_pair_inline(bci, line); }
#endif

  // Write end-of-stream marker
  void write_terminator()                        { write_byte(0); }
};


// Utility class for decompressing line number tables

class CompressedLineNumberReadStream: public CompressedReadStream {
 private:
  int _bci;
  int _line;
 public:
  // Constructor
  CompressedLineNumberReadStream(u_char* buffer);
  // Read (bci, line number) pair from stream. Returns false at end-of-stream.
  bool read_pair();
  // Accessing bci and line number (after calling read_pair)
  int bci() const                               { return _bci; }
  int line() const                              { return _line; }
};


/// Fast Breakpoints.

// If this structure gets more complicated (because bpts get numerous),
// move it into its own header.

// There is presently no provision for concurrent access
// to breakpoint lists, which is only OK for JVMTI because
// breakpoints are written only at safepoints, and are read
// concurrently only outside of safepoints.

Z
zgu 已提交
987
class BreakpointInfo : public CHeapObj<mtClass> {
D
duke 已提交
988 989 990 991 992 993 994 995 996
  friend class VMStructs;
 private:
  Bytecodes::Code  _orig_bytecode;
  int              _bci;
  u2               _name_index;       // of method
  u2               _signature_index;  // of method
  BreakpointInfo*  _next;             // simple storage allocation

 public:
997
  BreakpointInfo(Method* m, int bci);
D
duke 已提交
998 999 1000 1001 1002 1003 1004 1005 1006 1007

  // accessors
  Bytecodes::Code orig_bytecode()                     { return _orig_bytecode; }
  void        set_orig_bytecode(Bytecodes::Code code) { _orig_bytecode = code; }
  int         bci()                                   { return _bci; }

  BreakpointInfo*          next() const               { return _next; }
  void                 set_next(BreakpointInfo* n)    { _next = n; }

  // helps for searchers
1008
  bool match(const Method* m, int bci) {
D
duke 已提交
1009 1010 1011
    return bci == _bci && match(m);
  }

1012
  bool match(const Method* m) {
D
duke 已提交
1013 1014 1015 1016
    return _name_index == m->name_index() &&
      _signature_index == m->signature_index();
  }

1017 1018
  void set(Method* method);
  void clear(Method* method);
D
duke 已提交
1019
};
1020

1021 1022 1023 1024 1025 1026 1027
// Utility class for access exception handlers
class ExceptionTable : public StackObj {
 private:
  ExceptionTableElement* _table;
  u2  _length;

 public:
1028
  ExceptionTable(const Method* m) {
1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082
    if (m->has_exception_handler()) {
      _table = m->exception_table_start();
      _length = m->exception_table_length();
    } else {
      _table = NULL;
      _length = 0;
    }
  }

  int length() const {
    return _length;
  }

  u2 start_pc(int idx) const {
    assert(idx < _length, "out of bounds");
    return _table[idx].start_pc;
  }

  void set_start_pc(int idx, u2 value) {
    assert(idx < _length, "out of bounds");
    _table[idx].start_pc = value;
  }

  u2 end_pc(int idx) const {
    assert(idx < _length, "out of bounds");
    return _table[idx].end_pc;
  }

  void set_end_pc(int idx, u2 value) {
    assert(idx < _length, "out of bounds");
    _table[idx].end_pc = value;
  }

  u2 handler_pc(int idx) const {
    assert(idx < _length, "out of bounds");
    return _table[idx].handler_pc;
  }

  void set_handler_pc(int idx, u2 value) {
    assert(idx < _length, "out of bounds");
    _table[idx].handler_pc = value;
  }

  u2 catch_type_index(int idx) const {
    assert(idx < _length, "out of bounds");
    return _table[idx].catch_type_index;
  }

  void set_catch_type_index(int idx, u2 value) {
    assert(idx < _length, "out of bounds");
    _table[idx].catch_type_index = value;
  }
};

1083
#endif // SHARE_VM_OOPS_METHODOOP_HPP