src/hotspot/share/ci/ciStreams.hpp
author coleenp
Thu, 10 Jan 2019 15:13:51 -0500
changeset 53244 9807daeb47c4
parent 47216 71c04702a3d5
child 53546 63eb7e38ce84
permissions -rw-r--r--
8216167: Update include guards to reflect correct directories Summary: Use script and some manual fixup to fix directores names in include guards. Reviewed-by: lfoltan, eosterlund, kbarrett
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
     1
/*
53244
9807daeb47c4 8216167: Update include guards to reflect correct directories
coleenp
parents: 47216
diff changeset
     2
 * Copyright (c) 1999, 2019, 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: 4567
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 4567
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: 4567
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
53244
9807daeb47c4 8216167: Update include guards to reflect correct directories
coleenp
parents: 47216
diff changeset
    25
#ifndef SHARE_CI_CISTREAMS_HPP
9807daeb47c4 8216167: Update include guards to reflect correct directories
coleenp
parents: 47216
diff changeset
    26
#define SHARE_CI_CISTREAMS_HPP
7397
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5882
diff changeset
    27
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5882
diff changeset
    28
#include "ci/ciClassList.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5882
diff changeset
    29
#include "ci/ciExceptionHandler.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5882
diff changeset
    30
#include "ci/ciInstanceKlass.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5882
diff changeset
    31
#include "ci/ciMethod.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5882
diff changeset
    32
#include "interpreter/bytecode.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5882
diff changeset
    33
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    34
// ciBytecodeStream
489c9b5090e2 Initial load
duke
parents:
diff changeset
    35
//
489c9b5090e2 Initial load
duke
parents:
diff changeset
    36
// The class is used to iterate over the bytecodes of a method.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    37
// It hides the details of constant pool structure/access by
489c9b5090e2 Initial load
duke
parents:
diff changeset
    38
// providing accessors for constant pool items.  It returns only pure
489c9b5090e2 Initial load
duke
parents:
diff changeset
    39
// Java bytecodes; VM-internal _fast bytecodes are translated back to
489c9b5090e2 Initial load
duke
parents:
diff changeset
    40
// their original form during iteration.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    41
class ciBytecodeStream : StackObj {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    42
private:
5688
9052dc91ea67 6939207: refactor constant pool index processing
jrose
parents: 4567
diff changeset
    43
  // Handling for the weird bytecodes
9052dc91ea67 6939207: refactor constant pool index processing
jrose
parents: 4567
diff changeset
    44
  Bytecodes::Code next_wide_or_table(Bytecodes::Code); // Handle _wide & complicated inline table
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    45
489c9b5090e2 Initial load
duke
parents:
diff changeset
    46
  static Bytecodes::Code check_java(Bytecodes::Code c) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    47
    assert(Bytecodes::is_java_code(c), "should not return _fast bytecodes");
489c9b5090e2 Initial load
duke
parents:
diff changeset
    48
    return c;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    49
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    50
5688
9052dc91ea67 6939207: refactor constant pool index processing
jrose
parents: 4567
diff changeset
    51
  static Bytecodes::Code check_defined(Bytecodes::Code c) {
9052dc91ea67 6939207: refactor constant pool index processing
jrose
parents: 4567
diff changeset
    52
    assert(Bytecodes::is_defined(c), "");
9052dc91ea67 6939207: refactor constant pool index processing
jrose
parents: 4567
diff changeset
    53
    return c;
9052dc91ea67 6939207: refactor constant pool index processing
jrose
parents: 4567
diff changeset
    54
  }
9052dc91ea67 6939207: refactor constant pool index processing
jrose
parents: 4567
diff changeset
    55
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    56
  ciMethod* _method;           // the method
489c9b5090e2 Initial load
duke
parents:
diff changeset
    57
  ciInstanceKlass* _holder;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    58
  address _bc_start;            // Start of current bytecode for table
489c9b5090e2 Initial load
duke
parents:
diff changeset
    59
  address _was_wide;            // Address past last wide bytecode
489c9b5090e2 Initial load
duke
parents:
diff changeset
    60
  jint* _table_base;            // Aligned start of last table or switch
489c9b5090e2 Initial load
duke
parents:
diff changeset
    61
489c9b5090e2 Initial load
duke
parents:
diff changeset
    62
  address _start;                  // Start of bytecodes
489c9b5090e2 Initial load
duke
parents:
diff changeset
    63
  address _end;                    // Past end of bytecodes
489c9b5090e2 Initial load
duke
parents:
diff changeset
    64
  address _pc;                     // Current PC
489c9b5090e2 Initial load
duke
parents:
diff changeset
    65
  Bytecodes::Code _bc;             // Current bytecode
5688
9052dc91ea67 6939207: refactor constant pool index processing
jrose
parents: 4567
diff changeset
    66
  Bytecodes::Code _raw_bc;         // Current bytecode, raw form
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    67
489c9b5090e2 Initial load
duke
parents:
diff changeset
    68
  void reset( address base, unsigned int size ) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    69
    _bc_start =_was_wide = 0;
5882
6b2aecc4f7d8 6939203: JSR 292 needs method handle constants
jrose
parents: 5702
diff changeset
    70
    _start = _pc = base; _end = base + size;
6b2aecc4f7d8 6939203: JSR 292 needs method handle constants
jrose
parents: 5702
diff changeset
    71
  }
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    72
5688
9052dc91ea67 6939207: refactor constant pool index processing
jrose
parents: 4567
diff changeset
    73
  void assert_wide(bool require_wide) const {
9052dc91ea67 6939207: refactor constant pool index processing
jrose
parents: 4567
diff changeset
    74
    if (require_wide)
9052dc91ea67 6939207: refactor constant pool index processing
jrose
parents: 4567
diff changeset
    75
         { assert(is_wide(),  "must be a wide instruction"); }
9052dc91ea67 6939207: refactor constant pool index processing
jrose
parents: 4567
diff changeset
    76
    else { assert(!is_wide(), "must not be a wide instruction"); }
9052dc91ea67 6939207: refactor constant pool index processing
jrose
parents: 4567
diff changeset
    77
  }
9052dc91ea67 6939207: refactor constant pool index processing
jrose
parents: 4567
diff changeset
    78
7913
dd096a83bdbb 4926272: methodOopDesc::method_from_bcp is unsafe
never
parents: 7397
diff changeset
    79
  Bytecode bytecode() const { return Bytecode(this, _bc_start); }
dd096a83bdbb 4926272: methodOopDesc::method_from_bcp is unsafe
never
parents: 7397
diff changeset
    80
  Bytecode next_bytecode() const { return Bytecode(this, _pc); }
5688
9052dc91ea67 6939207: refactor constant pool index processing
jrose
parents: 4567
diff changeset
    81
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    82
public:
489c9b5090e2 Initial load
duke
parents:
diff changeset
    83
  // End-Of-Bytecodes
489c9b5090e2 Initial load
duke
parents:
diff changeset
    84
  static Bytecodes::Code EOBC() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    85
    return Bytecodes::_illegal;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    86
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    87
489c9b5090e2 Initial load
duke
parents:
diff changeset
    88
  ciBytecodeStream(ciMethod* m) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    89
    reset_to_method(m);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    90
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    91
489c9b5090e2 Initial load
duke
parents:
diff changeset
    92
  ciBytecodeStream() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    93
    reset_to_method(NULL);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    94
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    95
489c9b5090e2 Initial load
duke
parents:
diff changeset
    96
  ciMethod* method() const { return _method; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    97
489c9b5090e2 Initial load
duke
parents:
diff changeset
    98
  void reset_to_method(ciMethod* m) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    99
    _method = m;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   100
    if (m == NULL) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   101
      _holder = NULL;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   102
      reset(NULL, 0);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   103
    } else {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   104
      _holder = m->holder();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   105
      reset(m->code(), m->code_size());
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
  void reset_to_bci( int bci );
489c9b5090e2 Initial load
duke
parents:
diff changeset
   110
489c9b5090e2 Initial load
duke
parents:
diff changeset
   111
  // Force the iterator to report a certain bci.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   112
  void force_bci(int bci);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   113
489c9b5090e2 Initial load
duke
parents:
diff changeset
   114
  void set_max_bci( int max ) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   115
    _end = _start + max;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   116
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   117
2570
ecc7862946d4 6655646: dynamic languages need dynamically linked call sites
jrose
parents: 1
diff changeset
   118
  address cur_bcp() const       { return _bc_start; }  // Returns bcp to current instruction
5688
9052dc91ea67 6939207: refactor constant pool index processing
jrose
parents: 4567
diff changeset
   119
  int next_bci() const          { return _pc - _start; }
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   120
  int cur_bci() const           { return _bc_start - _start; }
2570
ecc7862946d4 6655646: dynamic languages need dynamically linked call sites
jrose
parents: 1
diff changeset
   121
  int instruction_size() const  { return _pc - _bc_start; }
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   122
489c9b5090e2 Initial load
duke
parents:
diff changeset
   123
  Bytecodes::Code cur_bc() const{ return check_java(_bc); }
5688
9052dc91ea67 6939207: refactor constant pool index processing
jrose
parents: 4567
diff changeset
   124
  Bytecodes::Code cur_bc_raw() const { return check_defined(_raw_bc); }
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   125
  Bytecodes::Code next_bc()     { return Bytecodes::java_code((Bytecodes::Code)* _pc); }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   126
489c9b5090e2 Initial load
duke
parents:
diff changeset
   127
  // Return current ByteCode and increment PC to next bytecode, skipping all
489c9b5090e2 Initial load
duke
parents:
diff changeset
   128
  // intermediate constants.  Returns EOBC at end.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   129
  // Expected usage:
10506
575ad9bccff5 7078382: JSR 292: don't count method handle adapters against inlining budgets
twisti
parents: 7913
diff changeset
   130
  //     ciBytecodeStream iter(m);
575ad9bccff5 7078382: JSR 292: don't count method handle adapters against inlining budgets
twisti
parents: 7913
diff changeset
   131
  //     while (iter.next() != ciBytecodeStream::EOBC()) { ... }
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   132
  Bytecodes::Code next() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   133
    _bc_start = _pc;                        // Capture start of bc
489c9b5090e2 Initial load
duke
parents:
diff changeset
   134
    if( _pc >= _end ) return EOBC();        // End-Of-Bytecodes
489c9b5090e2 Initial load
duke
parents:
diff changeset
   135
489c9b5090e2 Initial load
duke
parents:
diff changeset
   136
    // Fetch Java bytecode
489c9b5090e2 Initial load
duke
parents:
diff changeset
   137
    // All rewritten bytecodes maintain the size of original bytecode.
5688
9052dc91ea67 6939207: refactor constant pool index processing
jrose
parents: 4567
diff changeset
   138
    _bc = Bytecodes::java_code(_raw_bc = (Bytecodes::Code)*_pc);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   139
    int csize = Bytecodes::length_for(_bc); // Expected size
5688
9052dc91ea67 6939207: refactor constant pool index processing
jrose
parents: 4567
diff changeset
   140
    _pc += csize;                           // Bump PC past bytecode
9052dc91ea67 6939207: refactor constant pool index processing
jrose
parents: 4567
diff changeset
   141
    if (csize == 0) {
9052dc91ea67 6939207: refactor constant pool index processing
jrose
parents: 4567
diff changeset
   142
      _bc = next_wide_or_table(_bc);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   143
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   144
    return check_java(_bc);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   145
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   146
2570
ecc7862946d4 6655646: dynamic languages need dynamically linked call sites
jrose
parents: 1
diff changeset
   147
  bool is_wide() const { return ( _pc == _was_wide ); }
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   148
5688
9052dc91ea67 6939207: refactor constant pool index processing
jrose
parents: 4567
diff changeset
   149
  // Does this instruction contain an index which refes into the CP cache?
5882
6b2aecc4f7d8 6939203: JSR 292 needs method handle constants
jrose
parents: 5702
diff changeset
   150
  bool has_cache_index() const { return Bytecodes::uses_cp_cache(cur_bc_raw()); }
5688
9052dc91ea67 6939207: refactor constant pool index processing
jrose
parents: 4567
diff changeset
   151
13522
5ad4627e792a 7192406: JSR 292: C2 needs exact return type information for invokedynamic and invokehandle call sites
twisti
parents: 13391
diff changeset
   152
  bool has_optional_appendix() { return Bytecodes::has_optional_appendix(cur_bc_raw()); }
5ad4627e792a 7192406: JSR 292: C2 needs exact return type information for invokedynamic and invokehandle call sites
twisti
parents: 13391
diff changeset
   153
5688
9052dc91ea67 6939207: refactor constant pool index processing
jrose
parents: 4567
diff changeset
   154
  int get_index_u1() const {
7913
dd096a83bdbb 4926272: methodOopDesc::method_from_bcp is unsafe
never
parents: 7397
diff changeset
   155
    return bytecode().get_index_u1(cur_bc_raw());
5688
9052dc91ea67 6939207: refactor constant pool index processing
jrose
parents: 4567
diff changeset
   156
  }
9052dc91ea67 6939207: refactor constant pool index processing
jrose
parents: 4567
diff changeset
   157
5882
6b2aecc4f7d8 6939203: JSR 292 needs method handle constants
jrose
parents: 5702
diff changeset
   158
  int get_index_u1_cpcache() const {
7913
dd096a83bdbb 4926272: methodOopDesc::method_from_bcp is unsafe
never
parents: 7397
diff changeset
   159
    return bytecode().get_index_u1_cpcache(cur_bc_raw());
5882
6b2aecc4f7d8 6939203: JSR 292 needs method handle constants
jrose
parents: 5702
diff changeset
   160
  }
6b2aecc4f7d8 6939203: JSR 292 needs method handle constants
jrose
parents: 5702
diff changeset
   161
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   162
  // Get a byte index following this bytecode.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   163
  // If prefixed with a wide bytecode, get a wide index.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   164
  int get_index() const {
5882
6b2aecc4f7d8 6939203: JSR 292 needs method handle constants
jrose
parents: 5702
diff changeset
   165
    assert(!has_cache_index(), "else use cpcache variant");
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   166
    return (_pc == _was_wide)   // was widened?
5688
9052dc91ea67 6939207: refactor constant pool index processing
jrose
parents: 4567
diff changeset
   167
      ? get_index_u2(true)      // yes, return wide index
9052dc91ea67 6939207: refactor constant pool index processing
jrose
parents: 4567
diff changeset
   168
      : get_index_u1();         // no, return narrow index
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   169
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   170
5688
9052dc91ea67 6939207: refactor constant pool index processing
jrose
parents: 4567
diff changeset
   171
  // Get 2-byte index (byte swapping depending on which bytecode)
9052dc91ea67 6939207: refactor constant pool index processing
jrose
parents: 4567
diff changeset
   172
  int get_index_u2(bool is_wide = false) const {
7913
dd096a83bdbb 4926272: methodOopDesc::method_from_bcp is unsafe
never
parents: 7397
diff changeset
   173
    return bytecode().get_index_u2(cur_bc_raw(), is_wide);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   174
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   175
5688
9052dc91ea67 6939207: refactor constant pool index processing
jrose
parents: 4567
diff changeset
   176
  // Get 2-byte index in native byte order.  (Rewriter::rewrite makes these.)
9052dc91ea67 6939207: refactor constant pool index processing
jrose
parents: 4567
diff changeset
   177
  int get_index_u2_cpcache() const {
7913
dd096a83bdbb 4926272: methodOopDesc::method_from_bcp is unsafe
never
parents: 7397
diff changeset
   178
    return bytecode().get_index_u2_cpcache(cur_bc_raw());
2570
ecc7862946d4 6655646: dynamic languages need dynamically linked call sites
jrose
parents: 1
diff changeset
   179
  }
ecc7862946d4 6655646: dynamic languages need dynamically linked call sites
jrose
parents: 1
diff changeset
   180
ecc7862946d4 6655646: dynamic languages need dynamically linked call sites
jrose
parents: 1
diff changeset
   181
  // Get 4-byte index, for invokedynamic.
5688
9052dc91ea67 6939207: refactor constant pool index processing
jrose
parents: 4567
diff changeset
   182
  int get_index_u4() const {
7913
dd096a83bdbb 4926272: methodOopDesc::method_from_bcp is unsafe
never
parents: 7397
diff changeset
   183
    return bytecode().get_index_u4(cur_bc_raw());
2570
ecc7862946d4 6655646: dynamic languages need dynamically linked call sites
jrose
parents: 1
diff changeset
   184
  }
ecc7862946d4 6655646: dynamic languages need dynamically linked call sites
jrose
parents: 1
diff changeset
   185
5688
9052dc91ea67 6939207: refactor constant pool index processing
jrose
parents: 4567
diff changeset
   186
  bool has_index_u4() const {
7913
dd096a83bdbb 4926272: methodOopDesc::method_from_bcp is unsafe
never
parents: 7397
diff changeset
   187
    return bytecode().has_index_u4(cur_bc_raw());
5688
9052dc91ea67 6939207: refactor constant pool index processing
jrose
parents: 4567
diff changeset
   188
  }
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   189
489c9b5090e2 Initial load
duke
parents:
diff changeset
   190
  // Get dimensions byte (multinewarray)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   191
  int get_dimensions() const { return *(unsigned char*)(_pc-1); }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   192
489c9b5090e2 Initial load
duke
parents:
diff changeset
   193
  // Sign-extended index byte/short, no widening
7913
dd096a83bdbb 4926272: methodOopDesc::method_from_bcp is unsafe
never
parents: 7397
diff changeset
   194
  int get_constant_u1()                     const { return bytecode().get_constant_u1(instruction_size()-1, cur_bc_raw()); }
dd096a83bdbb 4926272: methodOopDesc::method_from_bcp is unsafe
never
parents: 7397
diff changeset
   195
  int get_constant_u2(bool is_wide = false) const { return bytecode().get_constant_u2(instruction_size()-2, cur_bc_raw(), is_wide); }
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   196
489c9b5090e2 Initial load
duke
parents:
diff changeset
   197
  // Get a byte signed constant for "iinc".  Invalid for other bytecodes.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   198
  // If prefixed with a wide bytecode, get a wide constant
5688
9052dc91ea67 6939207: refactor constant pool index processing
jrose
parents: 4567
diff changeset
   199
  int get_iinc_con() const {return (_pc==_was_wide) ? (jshort) get_constant_u2(true) : (jbyte) get_constant_u1();}
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   200
489c9b5090e2 Initial load
duke
parents:
diff changeset
   201
  // 2-byte branch offset from current pc
5688
9052dc91ea67 6939207: refactor constant pool index processing
jrose
parents: 4567
diff changeset
   202
  int get_dest() const {
7913
dd096a83bdbb 4926272: methodOopDesc::method_from_bcp is unsafe
never
parents: 7397
diff changeset
   203
    return cur_bci() + bytecode().get_offset_s2(cur_bc_raw());
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   204
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   205
489c9b5090e2 Initial load
duke
parents:
diff changeset
   206
  // 2-byte branch offset from next pc
5688
9052dc91ea67 6939207: refactor constant pool index processing
jrose
parents: 4567
diff changeset
   207
  int next_get_dest() const {
9052dc91ea67 6939207: refactor constant pool index processing
jrose
parents: 4567
diff changeset
   208
    assert(_pc < _end, "");
7913
dd096a83bdbb 4926272: methodOopDesc::method_from_bcp is unsafe
never
parents: 7397
diff changeset
   209
    return next_bci() + next_bytecode().get_offset_s2(Bytecodes::_ifeq);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   210
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   211
489c9b5090e2 Initial load
duke
parents:
diff changeset
   212
  // 4-byte branch offset from current pc
5688
9052dc91ea67 6939207: refactor constant pool index processing
jrose
parents: 4567
diff changeset
   213
  int get_far_dest() const {
7913
dd096a83bdbb 4926272: methodOopDesc::method_from_bcp is unsafe
never
parents: 7397
diff changeset
   214
    return cur_bci() + bytecode().get_offset_s4(cur_bc_raw());
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   215
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   216
489c9b5090e2 Initial load
duke
parents:
diff changeset
   217
  // For a lookup or switch table, return target destination
489c9b5090e2 Initial load
duke
parents:
diff changeset
   218
  int get_int_table( int index ) const {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   219
    return Bytes::get_Java_u4((address)&_table_base[index]); }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   220
489c9b5090e2 Initial load
duke
parents:
diff changeset
   221
  // For tableswitch - get length of offset part
489c9b5090e2 Initial load
duke
parents:
diff changeset
   222
  int get_tableswitch_length()  { return get_int_table(2)-get_int_table(1)+1; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   223
489c9b5090e2 Initial load
duke
parents:
diff changeset
   224
  int get_dest_table( int index ) const {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   225
    return cur_bci() + get_int_table(index); }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   226
489c9b5090e2 Initial load
duke
parents:
diff changeset
   227
  // --- Constant pool access ---
5882
6b2aecc4f7d8 6939203: JSR 292 needs method handle constants
jrose
parents: 5702
diff changeset
   228
  int get_constant_raw_index() const;
6b2aecc4f7d8 6939203: JSR 292 needs method handle constants
jrose
parents: 5702
diff changeset
   229
  int get_constant_pool_index() const;
6b2aecc4f7d8 6939203: JSR 292 needs method handle constants
jrose
parents: 5702
diff changeset
   230
  int get_constant_cache_index() const;
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   231
  int get_field_index();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   232
  int get_method_index();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   233
489c9b5090e2 Initial load
duke
parents:
diff changeset
   234
  // If this bytecode is a new, newarray, multianewarray, instanceof,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   235
  // or checkcast, get the referenced klass.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   236
  ciKlass* get_klass(bool& will_link);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   237
  int get_klass_index() const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   238
489c9b5090e2 Initial load
duke
parents:
diff changeset
   239
  // If this bytecode is one of the ldc variants, get the referenced
5882
6b2aecc4f7d8 6939203: JSR 292 needs method handle constants
jrose
parents: 5702
diff changeset
   240
  // constant.  Do not attempt to resolve it, since that would require
6b2aecc4f7d8 6939203: JSR 292 needs method handle constants
jrose
parents: 5702
diff changeset
   241
  // execution of Java code.  If it is not resolved, return an unloaded
6b2aecc4f7d8 6939203: JSR 292 needs method handle constants
jrose
parents: 5702
diff changeset
   242
  // object (ciConstant.as_object()->is_loaded() == false).
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   243
  ciConstant get_constant();
5882
6b2aecc4f7d8 6939203: JSR 292 needs method handle constants
jrose
parents: 5702
diff changeset
   244
  constantTag get_constant_pool_tag(int index) const;
6b2aecc4f7d8 6939203: JSR 292 needs method handle constants
jrose
parents: 5702
diff changeset
   245
6b2aecc4f7d8 6939203: JSR 292 needs method handle constants
jrose
parents: 5702
diff changeset
   246
  // True if the klass-using bytecode points to an unresolved klass
6b2aecc4f7d8 6939203: JSR 292 needs method handle constants
jrose
parents: 5702
diff changeset
   247
  bool is_unresolved_klass() const {
6b2aecc4f7d8 6939203: JSR 292 needs method handle constants
jrose
parents: 5702
diff changeset
   248
    constantTag tag = get_constant_pool_tag(get_klass_index());
6b2aecc4f7d8 6939203: JSR 292 needs method handle constants
jrose
parents: 5702
diff changeset
   249
    return tag.is_unresolved_klass();
6b2aecc4f7d8 6939203: JSR 292 needs method handle constants
jrose
parents: 5702
diff changeset
   250
  }
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   251
489c9b5090e2 Initial load
duke
parents:
diff changeset
   252
  // If this bytecode is one of get_field, get_static, put_field,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   253
  // or put_static, get the referenced field.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   254
  ciField* get_field(bool& will_link);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   255
489c9b5090e2 Initial load
duke
parents:
diff changeset
   256
  ciInstanceKlass* get_declared_field_holder();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   257
  int      get_field_holder_index();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   258
  int      get_field_signature_index();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   259
13929
8da0dc50a6e4 7200949: JSR 292: rubybench/bench/time/bench_base64.rb fails with jruby.jar not on boot class path
twisti
parents: 13728
diff changeset
   260
  ciMethod*     get_method(bool& will_link, ciSignature* *declared_signature_result);
8da0dc50a6e4 7200949: JSR 292: rubybench/bench/time/bench_base64.rb fails with jruby.jar not on boot class path
twisti
parents: 13728
diff changeset
   261
  bool          has_appendix();
8da0dc50a6e4 7200949: JSR 292: rubybench/bench/time/bench_base64.rb fails with jruby.jar not on boot class path
twisti
parents: 13728
diff changeset
   262
  ciObject*     get_appendix();
8da0dc50a6e4 7200949: JSR 292: rubybench/bench/time/bench_base64.rb fails with jruby.jar not on boot class path
twisti
parents: 13728
diff changeset
   263
  bool          has_method_type();
8da0dc50a6e4 7200949: JSR 292: rubybench/bench/time/bench_base64.rb fails with jruby.jar not on boot class path
twisti
parents: 13728
diff changeset
   264
  ciMethodType* get_method_type();
8da0dc50a6e4 7200949: JSR 292: rubybench/bench/time/bench_base64.rb fails with jruby.jar not on boot class path
twisti
parents: 13728
diff changeset
   265
  ciKlass*      get_declared_method_holder();
8da0dc50a6e4 7200949: JSR 292: rubybench/bench/time/bench_base64.rb fails with jruby.jar not on boot class path
twisti
parents: 13728
diff changeset
   266
  int           get_method_holder_index();
38309
9b8e9c373740 8155951: VM crash in nsk/jvmti/RedefineClasses/StressRedefine: assert failed: Corrupted constant pool
coleenp
parents: 22234
diff changeset
   267
  int           get_method_signature_index(const constantPoolHandle& cpool);
2570
ecc7862946d4 6655646: dynamic languages need dynamically linked call sites
jrose
parents: 1
diff changeset
   268
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 13522
diff changeset
   269
  // Get the resolved references arrays from the constant pool
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 13522
diff changeset
   270
  ciObjArray* get_resolved_references();
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   271
};
489c9b5090e2 Initial load
duke
parents:
diff changeset
   272
489c9b5090e2 Initial load
duke
parents:
diff changeset
   273
489c9b5090e2 Initial load
duke
parents:
diff changeset
   274
// ciSignatureStream
489c9b5090e2 Initial load
duke
parents:
diff changeset
   275
//
489c9b5090e2 Initial load
duke
parents:
diff changeset
   276
// The class is used to iterate over the elements of a method signature.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   277
class ciSignatureStream : public StackObj {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   278
private:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   279
  ciSignature* _sig;
20702
bbe0fcde6e13 8023657: New type profiling points: arguments to call
roland
parents: 13929
diff changeset
   280
  int          _pos;
bbe0fcde6e13 8023657: New type profiling points: arguments to call
roland
parents: 13929
diff changeset
   281
  // holder is a method's holder
bbe0fcde6e13 8023657: New type profiling points: arguments to call
roland
parents: 13929
diff changeset
   282
  ciKlass*     _holder;
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   283
public:
20702
bbe0fcde6e13 8023657: New type profiling points: arguments to call
roland
parents: 13929
diff changeset
   284
  ciSignatureStream(ciSignature* signature, ciKlass* holder = NULL) {
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   285
    _sig = signature;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   286
    _pos = 0;
20702
bbe0fcde6e13 8023657: New type profiling points: arguments to call
roland
parents: 13929
diff changeset
   287
    _holder = holder;
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   288
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   289
489c9b5090e2 Initial load
duke
parents:
diff changeset
   290
  bool at_return_type() { return _pos == _sig->count(); }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   291
489c9b5090e2 Initial load
duke
parents:
diff changeset
   292
  bool is_done() { return _pos > _sig->count(); }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   293
489c9b5090e2 Initial load
duke
parents:
diff changeset
   294
  void next() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   295
    if (_pos <= _sig->count()) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   296
      _pos++;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   297
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   298
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   299
489c9b5090e2 Initial load
duke
parents:
diff changeset
   300
  ciType* type() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   301
    if (at_return_type()) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   302
      return _sig->return_type();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   303
    } else {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   304
      return _sig->type_at(_pos);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   305
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   306
  }
20702
bbe0fcde6e13 8023657: New type profiling points: arguments to call
roland
parents: 13929
diff changeset
   307
bbe0fcde6e13 8023657: New type profiling points: arguments to call
roland
parents: 13929
diff changeset
   308
  // next klass in the signature
bbe0fcde6e13 8023657: New type profiling points: arguments to call
roland
parents: 13929
diff changeset
   309
  ciKlass* next_klass() {
bbe0fcde6e13 8023657: New type profiling points: arguments to call
roland
parents: 13929
diff changeset
   310
    ciKlass* sig_k;
bbe0fcde6e13 8023657: New type profiling points: arguments to call
roland
parents: 13929
diff changeset
   311
    if (_holder != NULL) {
bbe0fcde6e13 8023657: New type profiling points: arguments to call
roland
parents: 13929
diff changeset
   312
      sig_k = _holder;
bbe0fcde6e13 8023657: New type profiling points: arguments to call
roland
parents: 13929
diff changeset
   313
      _holder = NULL;
bbe0fcde6e13 8023657: New type profiling points: arguments to call
roland
parents: 13929
diff changeset
   314
    } else {
bbe0fcde6e13 8023657: New type profiling points: arguments to call
roland
parents: 13929
diff changeset
   315
      while (!type()->is_klass()) {
bbe0fcde6e13 8023657: New type profiling points: arguments to call
roland
parents: 13929
diff changeset
   316
        next();
bbe0fcde6e13 8023657: New type profiling points: arguments to call
roland
parents: 13929
diff changeset
   317
      }
bbe0fcde6e13 8023657: New type profiling points: arguments to call
roland
parents: 13929
diff changeset
   318
      assert(!at_return_type(), "passed end of signature");
bbe0fcde6e13 8023657: New type profiling points: arguments to call
roland
parents: 13929
diff changeset
   319
      sig_k = type()->as_klass();
bbe0fcde6e13 8023657: New type profiling points: arguments to call
roland
parents: 13929
diff changeset
   320
      next();
bbe0fcde6e13 8023657: New type profiling points: arguments to call
roland
parents: 13929
diff changeset
   321
    }
bbe0fcde6e13 8023657: New type profiling points: arguments to call
roland
parents: 13929
diff changeset
   322
    return sig_k;
bbe0fcde6e13 8023657: New type profiling points: arguments to call
roland
parents: 13929
diff changeset
   323
  }
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   324
};
489c9b5090e2 Initial load
duke
parents:
diff changeset
   325
489c9b5090e2 Initial load
duke
parents:
diff changeset
   326
489c9b5090e2 Initial load
duke
parents:
diff changeset
   327
// ciExceptionHandlerStream
489c9b5090e2 Initial load
duke
parents:
diff changeset
   328
//
489c9b5090e2 Initial load
duke
parents:
diff changeset
   329
// The class is used to iterate over the exception handlers of
489c9b5090e2 Initial load
duke
parents:
diff changeset
   330
// a method.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   331
class ciExceptionHandlerStream : public StackObj {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   332
private:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   333
  // The method whose handlers we are traversing
489c9b5090e2 Initial load
duke
parents:
diff changeset
   334
  ciMethod* _method;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   335
489c9b5090e2 Initial load
duke
parents:
diff changeset
   336
  // Our current position in the list of handlers
489c9b5090e2 Initial load
duke
parents:
diff changeset
   337
  int        _pos;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   338
  int        _end;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   339
489c9b5090e2 Initial load
duke
parents:
diff changeset
   340
  ciInstanceKlass*  _exception_klass;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   341
  int        _bci;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   342
  bool       _is_exact;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   343
489c9b5090e2 Initial load
duke
parents:
diff changeset
   344
public:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   345
  ciExceptionHandlerStream(ciMethod* method) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   346
    _method = method;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   347
489c9b5090e2 Initial load
duke
parents:
diff changeset
   348
    // Force loading of method code and handlers.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   349
    _method->code();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   350
489c9b5090e2 Initial load
duke
parents:
diff changeset
   351
    _pos = 0;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   352
    _end = _method->_handler_count;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   353
    _exception_klass = NULL;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   354
    _bci    = -1;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   355
    _is_exact = false;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   356
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   357
489c9b5090e2 Initial load
duke
parents:
diff changeset
   358
  ciExceptionHandlerStream(ciMethod* method, int bci,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   359
                           ciInstanceKlass* exception_klass = NULL,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   360
                           bool is_exact = false) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   361
    _method = method;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   362
489c9b5090e2 Initial load
duke
parents:
diff changeset
   363
    // Force loading of method code and handlers.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   364
    _method->code();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   365
489c9b5090e2 Initial load
duke
parents:
diff changeset
   366
    _pos = -1;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   367
    _end = _method->_handler_count + 1; // include the rethrow handler
489c9b5090e2 Initial load
duke
parents:
diff changeset
   368
    _exception_klass = (exception_klass != NULL && exception_klass->is_loaded()
489c9b5090e2 Initial load
duke
parents:
diff changeset
   369
                          ? exception_klass
489c9b5090e2 Initial load
duke
parents:
diff changeset
   370
                          : NULL);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   371
    _bci = bci;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   372
    assert(_bci >= 0, "bci out of range");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   373
    _is_exact = is_exact;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   374
    next();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   375
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   376
489c9b5090e2 Initial load
duke
parents:
diff changeset
   377
  // These methods are currently implemented in an odd way.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   378
  // Count the number of handlers the iterator has ever produced
489c9b5090e2 Initial load
duke
parents:
diff changeset
   379
  // or will ever produce.  Do not include the final rethrow handler.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   380
  // That is, a trivial exception handler stream will have a count
489c9b5090e2 Initial load
duke
parents:
diff changeset
   381
  // of zero and produce just the rethrow handler.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   382
  int count();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   383
489c9b5090e2 Initial load
duke
parents:
diff changeset
   384
  // Count the number of handlers this stream will produce from now on.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   385
  // Include the current handler, and the final rethrow handler.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   386
  // The remaining count will be zero iff is_done() is true,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   387
  int count_remaining();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   388
489c9b5090e2 Initial load
duke
parents:
diff changeset
   389
  bool is_done() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   390
    return (_pos >= _end);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   391
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   392
489c9b5090e2 Initial load
duke
parents:
diff changeset
   393
  void next() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   394
    _pos++;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   395
    if (_bci != -1) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   396
      // We are not iterating over all handlers...
489c9b5090e2 Initial load
duke
parents:
diff changeset
   397
      while (!is_done()) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   398
        ciExceptionHandler* handler = _method->_exception_handlers[_pos];
489c9b5090e2 Initial load
duke
parents:
diff changeset
   399
        if (handler->is_in_range(_bci)) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   400
          if (handler->is_catch_all()) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   401
            // Found final active catch block.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   402
            _end = _pos+1;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   403
            return;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   404
          } else if (_exception_klass == NULL || !handler->catch_klass()->is_loaded()) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   405
            // We cannot do any type analysis here.  Must conservatively assume
489c9b5090e2 Initial load
duke
parents:
diff changeset
   406
            // catch block is reachable.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   407
            return;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   408
          } else if (_exception_klass->is_subtype_of(handler->catch_klass())) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   409
            // This catch clause will definitely catch the exception.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   410
            // Final candidate.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   411
            _end = _pos+1;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   412
            return;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   413
          } else if (!_is_exact &&
489c9b5090e2 Initial load
duke
parents:
diff changeset
   414
                     handler->catch_klass()->is_subtype_of(_exception_klass)) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   415
            // This catch block may be reachable.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   416
            return;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   417
          }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   418
        }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   419
489c9b5090e2 Initial load
duke
parents:
diff changeset
   420
        // The catch block was not pertinent.  Go on.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   421
        _pos++;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   422
      }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   423
    } else {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   424
      // This is an iteration over all handlers.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   425
      return;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   426
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   427
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   428
489c9b5090e2 Initial load
duke
parents:
diff changeset
   429
  ciExceptionHandler* handler() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   430
    return _method->_exception_handlers[_pos];
489c9b5090e2 Initial load
duke
parents:
diff changeset
   431
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   432
};
7397
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5882
diff changeset
   433
7913
dd096a83bdbb 4926272: methodOopDesc::method_from_bcp is unsafe
never
parents: 7397
diff changeset
   434
dd096a83bdbb 4926272: methodOopDesc::method_from_bcp is unsafe
never
parents: 7397
diff changeset
   435
dd096a83bdbb 4926272: methodOopDesc::method_from_bcp is unsafe
never
parents: 7397
diff changeset
   436
// Implementation for declarations in bytecode.hpp
dd096a83bdbb 4926272: methodOopDesc::method_from_bcp is unsafe
never
parents: 7397
diff changeset
   437
Bytecode::Bytecode(const ciBytecodeStream* stream, address bcp): _bcp(bcp != NULL ? bcp : stream->cur_bcp()), _code(Bytecodes::code_at(NULL, addr_at(0))) {}
dd096a83bdbb 4926272: methodOopDesc::method_from_bcp is unsafe
never
parents: 7397
diff changeset
   438
Bytecode_lookupswitch::Bytecode_lookupswitch(const ciBytecodeStream* stream): Bytecode(stream) { verify(); }
dd096a83bdbb 4926272: methodOopDesc::method_from_bcp is unsafe
never
parents: 7397
diff changeset
   439
Bytecode_tableswitch::Bytecode_tableswitch(const ciBytecodeStream* stream): Bytecode(stream) { verify(); }
dd096a83bdbb 4926272: methodOopDesc::method_from_bcp is unsafe
never
parents: 7397
diff changeset
   440
53244
9807daeb47c4 8216167: Update include guards to reflect correct directories
coleenp
parents: 47216
diff changeset
   441
#endif // SHARE_CI_CISTREAMS_HPP