/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*
*/
#include "utilities/bitMap.hpp"
#include "utilities/growableArray.hpp"
class ciMethod;
private:
bool _is_valid;
public:
, _is_valid(false)
{}
, _is_valid(false)
{}
};
public:
// The BasicBlock class is used to represent a basic block in the
// liveness analysis.
private:
// This class is only used by the MethodLiveness class.
friend class MethodLiveness;
// The analyzer which created this basic block.
// The range of this basic block is [start_bci,limit_bci)
int _start_bci;
int _limit_bci;
// The liveness at the start of the block;
// The summarized liveness effects of our direct successors reached
// by normal control flow
// The summarized liveness effects of our direct successors reached
// by exceptional control flow
// These members hold the results of the last call to
// compute_gen_kill_range(). _gen is the set of locals
// used before they are defined in the range. _kill is the
// set of locals defined before they are used.
int _last_bci;
// A list of all blocks which could come directly before this one
// in normal (non-exceptional) control flow. We propagate liveness
// information to these blocks.
// A list of all blocks which could come directly before this one
// in exceptional control flow.
// The following fields are used to manage a work list used in the
// dataflow.
bool _on_work_list;
// Our successors call this method to merge liveness information into
// our _normal_exit member.
// Our successors call this method to merge liveness information into
// our _exception_exit member.
// the block. It is also used to answer queries.
// Helpers for compute_gen_kill_single.
// -- Accessors
// -- Flow graph construction.
// Add a basic block to our list of normal predecessors.
}
// Add a basic block to our list of exceptional predecessors
}
// Split the basic block at splitBci. This basic block
// becomes the second half. The first half is newly created.
// -- Dataflow.
// Propagate changes from this basic block
// -- Query.
// -- Debugging.
}; // End of MethodLiveness::BasicBlock
private:
// The method we are analyzing.
// The arena for storing structures...
// We cache the length of the method.
int _code_size;
// The size of a BitMap.
int _bit_map_size_bits;
int _bit_map_size_words;
// A list of all BasicBlocks.
// number of blocks
int _block_count;
// Keeps track of bci->block mapping. One entry for each bci. Only block starts are
// recorded.
// Our work list.
#ifdef COMPILER1
// bcis where blocks start are marked
#endif // COMPILER1
// -- Graph construction & Analysis
// Compute ranges and predecessors for basic blocks.
void init_basic_blocks();
void init_gen_kill();
// Perform the dataflow.
void propagate_liveness();
// The class MethodLiveness::BasicBlock needs special access to some
// of our members.
friend class MethodLiveness::BasicBlock;
// And accessors.
// Work list manipulation routines. Called internally by BasicBlock.
// -- Timing and Statistics.
// Timers
#ifndef PRODUCT
// Counts
static long _total_bytes;
static int _total_methods;
static long _total_blocks;
static int _max_method_blocks;
static long _total_edges;
static int _max_block_edges;
static long _total_exc_edges;
static int _max_block_exc_edges;
static long _total_method_locals;
static int _max_method_locals;
static long _total_locals_queried;
static long _total_live_locals_queried;
static long _total_visits;
#endif
public:
// Create a liveness analyzer for a method
// Compute liveness information for the method
void compute_liveness();
// Find out which locals are live at a specific bci.
#ifdef COMPILER1
#endif // COMPILER1
};
#endif // SHARE_VM_COMPILER_METHODLIVENESS_HPP