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