mirror of
https://github.com/openjdk/jdk.git
synced 2025-09-20 11:04:34 +02:00
8141501: Problems with BitMap buffer management
Reviewed-by: pliden, kbarrett
This commit is contained in:
parent
46d52062aa
commit
f8be292b88
41 changed files with 539 additions and 319 deletions
|
@ -131,13 +131,13 @@ elapsedTimer MethodLiveness::_time_total;
|
|||
|
||||
MethodLiveness::MethodLiveness(Arena* arena, ciMethod* method)
|
||||
#ifdef COMPILER1
|
||||
: _bci_block_start((uintptr_t*)arena->Amalloc((method->code_size() >> LogBitsPerByte) + 1), method->code_size())
|
||||
: _bci_block_start(arena, method->code_size())
|
||||
#endif
|
||||
{
|
||||
_arena = arena;
|
||||
_method = method;
|
||||
_bit_map_size_bits = method->max_locals();
|
||||
_bit_map_size_words = (_bit_map_size_bits / sizeof(unsigned int)) + 1;
|
||||
|
||||
|
||||
#ifdef COMPILER1
|
||||
_bci_block_start.clear();
|
||||
|
@ -475,7 +475,7 @@ MethodLivenessResult MethodLiveness::get_liveness_at(int entry_bci) {
|
|||
bci = 0;
|
||||
}
|
||||
|
||||
MethodLivenessResult answer((BitMap::bm_word_t*)NULL,0);
|
||||
MethodLivenessResult answer;
|
||||
|
||||
if (_block_count > 0) {
|
||||
if (TimeLivenessAnalysis) _time_total.start();
|
||||
|
@ -574,16 +574,11 @@ void MethodLiveness::print_times() {
|
|||
|
||||
|
||||
MethodLiveness::BasicBlock::BasicBlock(MethodLiveness *analyzer, int start, int limit) :
|
||||
_gen((uintptr_t*)analyzer->arena()->Amalloc(BytesPerWord * analyzer->bit_map_size_words()),
|
||||
analyzer->bit_map_size_bits()),
|
||||
_kill((uintptr_t*)analyzer->arena()->Amalloc(BytesPerWord * analyzer->bit_map_size_words()),
|
||||
analyzer->bit_map_size_bits()),
|
||||
_entry((uintptr_t*)analyzer->arena()->Amalloc(BytesPerWord * analyzer->bit_map_size_words()),
|
||||
analyzer->bit_map_size_bits()),
|
||||
_normal_exit((uintptr_t*)analyzer->arena()->Amalloc(BytesPerWord * analyzer->bit_map_size_words()),
|
||||
analyzer->bit_map_size_bits()),
|
||||
_exception_exit((uintptr_t*)analyzer->arena()->Amalloc(BytesPerWord * analyzer->bit_map_size_words()),
|
||||
analyzer->bit_map_size_bits()),
|
||||
_gen(analyzer->arena(), analyzer->bit_map_size_bits()),
|
||||
_kill(analyzer->arena(), analyzer->bit_map_size_bits()),
|
||||
_entry(analyzer->arena(), analyzer->bit_map_size_bits()),
|
||||
_normal_exit(analyzer->arena(), analyzer->bit_map_size_bits()),
|
||||
_exception_exit(analyzer->arena(), analyzer->bit_map_size_bits()),
|
||||
_last_bci(-1) {
|
||||
_analyzer = analyzer;
|
||||
_start_bci = start;
|
||||
|
@ -991,17 +986,16 @@ void MethodLiveness::BasicBlock::propagate(MethodLiveness *ml) {
|
|||
}
|
||||
}
|
||||
|
||||
bool MethodLiveness::BasicBlock::merge_normal(BitMap other) {
|
||||
bool MethodLiveness::BasicBlock::merge_normal(const BitMap& other) {
|
||||
return _normal_exit.set_union_with_result(other);
|
||||
}
|
||||
|
||||
bool MethodLiveness::BasicBlock::merge_exception(BitMap other) {
|
||||
bool MethodLiveness::BasicBlock::merge_exception(const BitMap& other) {
|
||||
return _exception_exit.set_union_with_result(other);
|
||||
}
|
||||
|
||||
MethodLivenessResult MethodLiveness::BasicBlock::get_liveness_at(ciMethod* method, int bci) {
|
||||
MethodLivenessResult answer(NEW_RESOURCE_ARRAY(BitMap::bm_word_t, _analyzer->bit_map_size_words()),
|
||||
_analyzer->bit_map_size_bits());
|
||||
MethodLivenessResult answer(_analyzer->bit_map_size_bits());
|
||||
answer.set_is_valid();
|
||||
|
||||
#ifndef ASSERT
|
||||
|
@ -1013,8 +1007,8 @@ MethodLivenessResult MethodLiveness::BasicBlock::get_liveness_at(ciMethod* metho
|
|||
|
||||
#ifdef ASSERT
|
||||
ResourceMark rm;
|
||||
BitMap g(_gen.size()); g.set_from(_gen);
|
||||
BitMap k(_kill.size()); k.set_from(_kill);
|
||||
ResourceBitMap g(_gen.size()); g.set_from(_gen);
|
||||
ResourceBitMap k(_kill.size()); k.set_from(_kill);
|
||||
#endif
|
||||
if (_last_bci != bci || trueInDebug) {
|
||||
ciBytecodeStream bytes(method);
|
||||
|
|
|
@ -30,18 +30,18 @@
|
|||
|
||||
class ciMethod;
|
||||
|
||||
class MethodLivenessResult : public BitMap {
|
||||
class MethodLivenessResult : public ResourceBitMap {
|
||||
private:
|
||||
bool _is_valid;
|
||||
|
||||
public:
|
||||
MethodLivenessResult(BitMap::bm_word_t* map, idx_t size_in_bits)
|
||||
: BitMap(map, size_in_bits)
|
||||
MethodLivenessResult()
|
||||
: ResourceBitMap()
|
||||
, _is_valid(false)
|
||||
{}
|
||||
|
||||
MethodLivenessResult(idx_t size_in_bits)
|
||||
: BitMap(size_in_bits)
|
||||
: ResourceBitMap(size_in_bits)
|
||||
, _is_valid(false)
|
||||
{}
|
||||
|
||||
|
@ -66,23 +66,23 @@ class MethodLiveness : public ResourceObj {
|
|||
int _limit_bci;
|
||||
|
||||
// The liveness at the start of the block;
|
||||
BitMap _entry;
|
||||
ArenaBitMap _entry;
|
||||
|
||||
// The summarized liveness effects of our direct successors reached
|
||||
// by normal control flow
|
||||
BitMap _normal_exit;
|
||||
ArenaBitMap _normal_exit;
|
||||
|
||||
// The summarized liveness effects of our direct successors reached
|
||||
// by exceptional control flow
|
||||
BitMap _exception_exit;
|
||||
ArenaBitMap _exception_exit;
|
||||
|
||||
// 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.
|
||||
BitMap _gen;
|
||||
BitMap _kill;
|
||||
int _last_bci;
|
||||
ArenaBitMap _gen;
|
||||
ArenaBitMap _kill;
|
||||
int _last_bci;
|
||||
|
||||
// A list of all blocks which could come directly before this one
|
||||
// in normal (non-exceptional) control flow. We propagate liveness
|
||||
|
@ -100,11 +100,11 @@ class MethodLiveness : public ResourceObj {
|
|||
|
||||
// Our successors call this method to merge liveness information into
|
||||
// our _normal_exit member.
|
||||
bool merge_normal(BitMap other);
|
||||
bool merge_normal(const BitMap& other);
|
||||
|
||||
// Our successors call this method to merge liveness information into
|
||||
// our _exception_exit member.
|
||||
bool merge_exception(BitMap other);
|
||||
bool merge_exception(const BitMap& other);
|
||||
|
||||
// This helper routine is used to help compute the gen/kill pair for
|
||||
// the block. It is also used to answer queries.
|
||||
|
@ -181,7 +181,6 @@ class MethodLiveness : public ResourceObj {
|
|||
|
||||
// The size of a BitMap.
|
||||
int _bit_map_size_bits;
|
||||
int _bit_map_size_words;
|
||||
|
||||
// A list of all BasicBlocks.
|
||||
BasicBlock **_block_list;
|
||||
|
@ -198,7 +197,7 @@ class MethodLiveness : public ResourceObj {
|
|||
|
||||
#ifdef COMPILER1
|
||||
// bcis where blocks start are marked
|
||||
BitMap _bci_block_start;
|
||||
ArenaBitMap _bci_block_start;
|
||||
#endif // COMPILER1
|
||||
|
||||
// -- Graph construction & Analysis
|
||||
|
@ -218,7 +217,6 @@ class MethodLiveness : public ResourceObj {
|
|||
|
||||
// And accessors.
|
||||
int bit_map_size_bits() const { return _bit_map_size_bits; }
|
||||
int bit_map_size_words() const { return _bit_map_size_words; }
|
||||
|
||||
// Work list manipulation routines. Called internally by BasicBlock.
|
||||
BasicBlock *work_list_get();
|
||||
|
@ -270,7 +268,7 @@ class MethodLiveness : public ResourceObj {
|
|||
MethodLivenessResult get_liveness_at(int bci);
|
||||
|
||||
#ifdef COMPILER1
|
||||
const BitMap get_bci_block_start() const { return _bci_block_start; }
|
||||
const BitMap& get_bci_block_start() const { return _bci_block_start; }
|
||||
#endif // COMPILER1
|
||||
|
||||
static void print_times() PRODUCT_RETURN;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue