hotspot/src/share/vm/compiler/methodLiveness.hpp
author twisti
Wed, 11 Aug 2010 05:51:21 -0700
changeset 6187 4fa7845f7c14
parent 5547 f4b087cbb361
child 7397 5b173b4ca846
permissions -rw-r--r--
6976186: integrate Shark HotSpot changes Summary: Shark is a JIT compiler for Zero that uses the LLVM compiler infrastructure. Reviewed-by: kvn, twisti Contributed-by: Gary Benson <gbenson@redhat.com>
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
     1
/*
5547
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 1374
diff changeset
     2
 * Copyright (c) 1998, 2006, 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: 1374
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 1374
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: 1374
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
489c9b5090e2 Initial load
duke
parents:
diff changeset
    25
class ciMethod;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    26
489c9b5090e2 Initial load
duke
parents:
diff changeset
    27
class MethodLivenessResult : public BitMap {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    28
 private:
489c9b5090e2 Initial load
duke
parents:
diff changeset
    29
  bool _is_valid;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    30
489c9b5090e2 Initial load
duke
parents:
diff changeset
    31
 public:
1374
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
    32
  MethodLivenessResult(BitMap::bm_word_t* map, idx_t size_in_bits)
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    33
    : BitMap(map, size_in_bits)
489c9b5090e2 Initial load
duke
parents:
diff changeset
    34
    , _is_valid(false)
489c9b5090e2 Initial load
duke
parents:
diff changeset
    35
  {}
489c9b5090e2 Initial load
duke
parents:
diff changeset
    36
489c9b5090e2 Initial load
duke
parents:
diff changeset
    37
  MethodLivenessResult(idx_t size_in_bits)
489c9b5090e2 Initial load
duke
parents:
diff changeset
    38
    : BitMap(size_in_bits)
489c9b5090e2 Initial load
duke
parents:
diff changeset
    39
    , _is_valid(false)
489c9b5090e2 Initial load
duke
parents:
diff changeset
    40
  {}
489c9b5090e2 Initial load
duke
parents:
diff changeset
    41
489c9b5090e2 Initial load
duke
parents:
diff changeset
    42
  void set_is_valid() { _is_valid = true; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    43
  bool is_valid() { return _is_valid; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    44
};
489c9b5090e2 Initial load
duke
parents:
diff changeset
    45
489c9b5090e2 Initial load
duke
parents:
diff changeset
    46
class MethodLiveness : public ResourceObj {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    47
 public:
489c9b5090e2 Initial load
duke
parents:
diff changeset
    48
  // The BasicBlock class is used to represent a basic block in the
489c9b5090e2 Initial load
duke
parents:
diff changeset
    49
  // liveness analysis.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    50
  class BasicBlock : public ResourceObj {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    51
   private:
489c9b5090e2 Initial load
duke
parents:
diff changeset
    52
    // This class is only used by the MethodLiveness class.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    53
    friend class MethodLiveness;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    54
489c9b5090e2 Initial load
duke
parents:
diff changeset
    55
    // The analyzer which created this basic block.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    56
    MethodLiveness* _analyzer;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    57
489c9b5090e2 Initial load
duke
parents:
diff changeset
    58
    // The range of this basic block is [start_bci,limit_bci)
489c9b5090e2 Initial load
duke
parents:
diff changeset
    59
    int _start_bci;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    60
    int _limit_bci;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    61
489c9b5090e2 Initial load
duke
parents:
diff changeset
    62
    // The liveness at the start of the block;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    63
    BitMap _entry;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    64
489c9b5090e2 Initial load
duke
parents:
diff changeset
    65
    // The summarized liveness effects of our direct successors reached
489c9b5090e2 Initial load
duke
parents:
diff changeset
    66
    // by normal control flow
489c9b5090e2 Initial load
duke
parents:
diff changeset
    67
    BitMap _normal_exit;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    68
489c9b5090e2 Initial load
duke
parents:
diff changeset
    69
    // The summarized liveness effects of our direct successors reached
489c9b5090e2 Initial load
duke
parents:
diff changeset
    70
    // by exceptional control flow
489c9b5090e2 Initial load
duke
parents:
diff changeset
    71
    BitMap _exception_exit;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    72
489c9b5090e2 Initial load
duke
parents:
diff changeset
    73
    // These members hold the results of the last call to
489c9b5090e2 Initial load
duke
parents:
diff changeset
    74
    // compute_gen_kill_range().  _gen is the set of locals
489c9b5090e2 Initial load
duke
parents:
diff changeset
    75
    // used before they are defined in the range.  _kill is the
489c9b5090e2 Initial load
duke
parents:
diff changeset
    76
    // set of locals defined before they are used.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    77
    BitMap _gen;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    78
    BitMap _kill;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    79
    int    _last_bci;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    80
489c9b5090e2 Initial load
duke
parents:
diff changeset
    81
    // A list of all blocks which could come directly before this one
489c9b5090e2 Initial load
duke
parents:
diff changeset
    82
    // in normal (non-exceptional) control flow.  We propagate liveness
489c9b5090e2 Initial load
duke
parents:
diff changeset
    83
    // information to these blocks.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    84
    GrowableArray<BasicBlock*>* _normal_predecessors;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    85
489c9b5090e2 Initial load
duke
parents:
diff changeset
    86
    // A list of all blocks which could come directly before this one
489c9b5090e2 Initial load
duke
parents:
diff changeset
    87
    // in exceptional control flow.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    88
    GrowableArray<BasicBlock*>* _exception_predecessors;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    89
489c9b5090e2 Initial load
duke
parents:
diff changeset
    90
    // The following fields are used to manage a work list used in the
489c9b5090e2 Initial load
duke
parents:
diff changeset
    91
    // dataflow.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    92
    BasicBlock *_next;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    93
    bool _on_work_list;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    94
489c9b5090e2 Initial load
duke
parents:
diff changeset
    95
    // Our successors call this method to merge liveness information into
489c9b5090e2 Initial load
duke
parents:
diff changeset
    96
    // our _normal_exit member.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    97
    bool merge_normal(BitMap other);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    98
489c9b5090e2 Initial load
duke
parents:
diff changeset
    99
    // Our successors call this method to merge liveness information into
489c9b5090e2 Initial load
duke
parents:
diff changeset
   100
    // our _exception_exit member.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   101
    bool merge_exception(BitMap other);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   102
489c9b5090e2 Initial load
duke
parents:
diff changeset
   103
    // This helper routine is used to help compute the gen/kill pair for
489c9b5090e2 Initial load
duke
parents:
diff changeset
   104
    // the block.  It is also used to answer queries.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   105
    void compute_gen_kill_range(ciBytecodeStream *bytes);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   106
489c9b5090e2 Initial load
duke
parents:
diff changeset
   107
    // Compute the gen/kill effect of a single instruction.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   108
    void compute_gen_kill_single(ciBytecodeStream *instruction);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   109
489c9b5090e2 Initial load
duke
parents:
diff changeset
   110
    // Helpers for compute_gen_kill_single.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   111
    void load_one(int local);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   112
    void load_two(int local);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   113
    void store_one(int local);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   114
    void store_two(int local);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   115
489c9b5090e2 Initial load
duke
parents:
diff changeset
   116
    BasicBlock(MethodLiveness *analyzer, int start, int limit);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   117
489c9b5090e2 Initial load
duke
parents:
diff changeset
   118
    // -- Accessors
489c9b5090e2 Initial load
duke
parents:
diff changeset
   119
489c9b5090e2 Initial load
duke
parents:
diff changeset
   120
    int start_bci() const { return _start_bci; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   121
489c9b5090e2 Initial load
duke
parents:
diff changeset
   122
    int limit_bci() const { return _limit_bci; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   123
    void set_limit_bci(int limit) { _limit_bci = limit; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   124
489c9b5090e2 Initial load
duke
parents:
diff changeset
   125
    BasicBlock *next() const { return _next; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   126
    void set_next(BasicBlock *next) { _next = next; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   127
489c9b5090e2 Initial load
duke
parents:
diff changeset
   128
    bool on_work_list() const { return _on_work_list; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   129
    void set_on_work_list(bool val) { _on_work_list = val; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   130
489c9b5090e2 Initial load
duke
parents:
diff changeset
   131
    // -- Flow graph construction.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   132
489c9b5090e2 Initial load
duke
parents:
diff changeset
   133
    // Add a basic block to our list of normal predecessors.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   134
    void add_normal_predecessor(BasicBlock *pred) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   135
      _normal_predecessors->append_if_missing(pred);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   136
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   137
489c9b5090e2 Initial load
duke
parents:
diff changeset
   138
    // Add a basic block to our list of exceptional predecessors
489c9b5090e2 Initial load
duke
parents:
diff changeset
   139
    void add_exception_predecessor(BasicBlock *pred) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   140
      _exception_predecessors->append_if_missing(pred);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   141
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   142
489c9b5090e2 Initial load
duke
parents:
diff changeset
   143
    // Split the basic block at splitBci.  This basic block
489c9b5090e2 Initial load
duke
parents:
diff changeset
   144
    // becomes the second half.  The first half is newly created.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   145
    BasicBlock *split(int splitBci);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   146
489c9b5090e2 Initial load
duke
parents:
diff changeset
   147
    // -- Dataflow.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   148
489c9b5090e2 Initial load
duke
parents:
diff changeset
   149
    void compute_gen_kill(ciMethod* method);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   150
489c9b5090e2 Initial load
duke
parents:
diff changeset
   151
    // Propagate changes from this basic block
489c9b5090e2 Initial load
duke
parents:
diff changeset
   152
    void propagate(MethodLiveness *ml);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   153
489c9b5090e2 Initial load
duke
parents:
diff changeset
   154
    // -- Query.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   155
489c9b5090e2 Initial load
duke
parents:
diff changeset
   156
    MethodLivenessResult get_liveness_at(ciMethod* method, int bci);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   157
489c9b5090e2 Initial load
duke
parents:
diff changeset
   158
    // -- Debugging.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   159
489c9b5090e2 Initial load
duke
parents:
diff changeset
   160
    void print_on(outputStream *os) const PRODUCT_RETURN;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   161
489c9b5090e2 Initial load
duke
parents:
diff changeset
   162
  }; // End of MethodLiveness::BasicBlock
489c9b5090e2 Initial load
duke
parents:
diff changeset
   163
489c9b5090e2 Initial load
duke
parents:
diff changeset
   164
 private:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   165
  // The method we are analyzing.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   166
  ciMethod* _method;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   167
  ciMethod* method() const { return _method; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   168
489c9b5090e2 Initial load
duke
parents:
diff changeset
   169
  // The arena for storing structures...
489c9b5090e2 Initial load
duke
parents:
diff changeset
   170
  Arena*       _arena;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   171
  Arena*       arena() const { return _arena; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   172
489c9b5090e2 Initial load
duke
parents:
diff changeset
   173
  // We cache the length of the method.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   174
  int _code_size;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   175
489c9b5090e2 Initial load
duke
parents:
diff changeset
   176
  // The size of a BitMap.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   177
  int _bit_map_size_bits;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   178
  int _bit_map_size_words;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   179
489c9b5090e2 Initial load
duke
parents:
diff changeset
   180
  // A list of all BasicBlocks.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   181
  BasicBlock **_block_list;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   182
489c9b5090e2 Initial load
duke
parents:
diff changeset
   183
  // number of blocks
489c9b5090e2 Initial load
duke
parents:
diff changeset
   184
  int  _block_count;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   185
489c9b5090e2 Initial load
duke
parents:
diff changeset
   186
  // Keeps track of bci->block mapping.  One entry for each bci.  Only block starts are
489c9b5090e2 Initial load
duke
parents:
diff changeset
   187
  // recorded.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   188
  GrowableArray<BasicBlock*>* _block_map;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   189
489c9b5090e2 Initial load
duke
parents:
diff changeset
   190
  // Our work list.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   191
  BasicBlock *_work_list;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   192
489c9b5090e2 Initial load
duke
parents:
diff changeset
   193
#ifdef COMPILER1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   194
  // bcis where blocks start are marked
489c9b5090e2 Initial load
duke
parents:
diff changeset
   195
  BitMap _bci_block_start;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   196
#endif // COMPILER1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   197
489c9b5090e2 Initial load
duke
parents:
diff changeset
   198
  // -- Graph construction & Analysis
489c9b5090e2 Initial load
duke
parents:
diff changeset
   199
489c9b5090e2 Initial load
duke
parents:
diff changeset
   200
  // Compute ranges and predecessors for basic blocks.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   201
  void init_basic_blocks();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   202
489c9b5090e2 Initial load
duke
parents:
diff changeset
   203
  // Compute gen/kill information for all basic blocks.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   204
  void init_gen_kill();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   205
489c9b5090e2 Initial load
duke
parents:
diff changeset
   206
  // Perform the dataflow.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   207
  void propagate_liveness();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   208
489c9b5090e2 Initial load
duke
parents:
diff changeset
   209
 // The class MethodLiveness::BasicBlock needs special access to some
489c9b5090e2 Initial load
duke
parents:
diff changeset
   210
 // of our members.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   211
 friend class MethodLiveness::BasicBlock;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   212
489c9b5090e2 Initial load
duke
parents:
diff changeset
   213
  // And accessors.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   214
  int bit_map_size_bits() const { return _bit_map_size_bits; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   215
  int bit_map_size_words() const { return _bit_map_size_words; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   216
489c9b5090e2 Initial load
duke
parents:
diff changeset
   217
  // Work list manipulation routines.  Called internally by BasicBlock.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   218
  BasicBlock *work_list_get();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   219
  void work_list_add(BasicBlock *block);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   220
489c9b5090e2 Initial load
duke
parents:
diff changeset
   221
  // -- Timing and Statistics.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   222
489c9b5090e2 Initial load
duke
parents:
diff changeset
   223
489c9b5090e2 Initial load
duke
parents:
diff changeset
   224
  // Timers
489c9b5090e2 Initial load
duke
parents:
diff changeset
   225
  static elapsedTimer _time_build_graph;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   226
  static elapsedTimer _time_gen_kill;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   227
  static elapsedTimer _time_flow;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   228
  static elapsedTimer _time_query;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   229
  static elapsedTimer _time_total;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   230
489c9b5090e2 Initial load
duke
parents:
diff changeset
   231
#ifndef PRODUCT
489c9b5090e2 Initial load
duke
parents:
diff changeset
   232
489c9b5090e2 Initial load
duke
parents:
diff changeset
   233
  // Counts
489c9b5090e2 Initial load
duke
parents:
diff changeset
   234
  static long _total_bytes;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   235
  static int  _total_methods;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   236
489c9b5090e2 Initial load
duke
parents:
diff changeset
   237
  static long _total_blocks;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   238
  static int  _max_method_blocks;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   239
489c9b5090e2 Initial load
duke
parents:
diff changeset
   240
  static long _total_edges;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   241
  static int  _max_block_edges;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   242
489c9b5090e2 Initial load
duke
parents:
diff changeset
   243
  static long _total_exc_edges;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   244
  static int  _max_block_exc_edges;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   245
489c9b5090e2 Initial load
duke
parents:
diff changeset
   246
  static long _total_method_locals;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   247
  static int  _max_method_locals;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   248
489c9b5090e2 Initial load
duke
parents:
diff changeset
   249
  static long _total_locals_queried;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   250
  static long _total_live_locals_queried;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   251
489c9b5090e2 Initial load
duke
parents:
diff changeset
   252
  static long _total_visits;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   253
489c9b5090e2 Initial load
duke
parents:
diff changeset
   254
#endif
489c9b5090e2 Initial load
duke
parents:
diff changeset
   255
489c9b5090e2 Initial load
duke
parents:
diff changeset
   256
 public:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   257
  // Create a liveness analyzer for a method
489c9b5090e2 Initial load
duke
parents:
diff changeset
   258
  MethodLiveness(Arena* arena, ciMethod* method);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   259
489c9b5090e2 Initial load
duke
parents:
diff changeset
   260
  // Compute liveness information for the method
489c9b5090e2 Initial load
duke
parents:
diff changeset
   261
  void compute_liveness();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   262
489c9b5090e2 Initial load
duke
parents:
diff changeset
   263
  // Find out which locals are live at a specific bci.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   264
  MethodLivenessResult get_liveness_at(int bci);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   265
489c9b5090e2 Initial load
duke
parents:
diff changeset
   266
#ifdef COMPILER1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   267
  const BitMap get_bci_block_start() const { return _bci_block_start; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   268
#endif // COMPILER1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   269
489c9b5090e2 Initial load
duke
parents:
diff changeset
   270
  static void print_times() PRODUCT_RETURN;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   271
};