8141501: Problems with BitMap buffer management

Reviewed-by: pliden, kbarrett
This commit is contained in:
Stefan Karlsson 2016-05-03 22:45:27 +02:00
parent 46d52062aa
commit f8be292b88
41 changed files with 539 additions and 319 deletions

View file

@ -88,7 +88,7 @@ LinearScan::LinearScan(IR* ir, LIRGenerator* gen, FrameMap* frame_map)
, _has_info(0)
, _has_call(0)
, _scope_value_cache(0) // initialized later with correct length
, _interval_in_loop(0, 0) // initialized later with correct length
, _interval_in_loop(0) // initialized later with correct length
, _cached_blocks(*ir->linear_scan_order())
#ifdef X86
, _fpu_stack_allocator(NULL)
@ -524,8 +524,8 @@ void LinearScan::number_instructions() {
assert(idx == num_instructions, "must match");
assert(idx * 2 == op_id, "must match");
_has_call = BitMap(num_instructions); _has_call.clear();
_has_info = BitMap(num_instructions); _has_info.clear();
_has_call.initialize(num_instructions);
_has_info.initialize(num_instructions);
}
@ -568,8 +568,8 @@ void LinearScan::compute_local_live_sets() {
for (int i = 0; i < num_blocks; i++) {
BlockBegin* block = block_at(i);
BitMap live_gen(live_size); live_gen.clear();
BitMap live_kill(live_size); live_kill.clear();
ResourceBitMap live_gen(live_size); live_gen.clear();
ResourceBitMap live_kill(live_size); live_kill.clear();
if (block->is_set(BlockBegin::exception_entry_flag)) {
// Phi functions at the begin of an exception handler are
@ -715,8 +715,8 @@ void LinearScan::compute_local_live_sets() {
block->set_live_gen (live_gen);
block->set_live_kill(live_kill);
block->set_live_in (BitMap(live_size)); block->live_in().clear();
block->set_live_out (BitMap(live_size)); block->live_out().clear();
block->set_live_in (ResourceBitMap(live_size)); block->live_in().clear();
block->set_live_out (ResourceBitMap(live_size)); block->live_out().clear();
TRACE_LINEAR_SCAN(4, tty->print("live_gen B%d ", block->block_id()); print_bitmap(block->live_gen()));
TRACE_LINEAR_SCAN(4, tty->print("live_kill B%d ", block->block_id()); print_bitmap(block->live_kill()));
@ -741,7 +741,7 @@ void LinearScan::compute_global_live_sets() {
bool change_occurred;
bool change_occurred_in_block;
int iteration_count = 0;
BitMap live_out(live_set_size()); live_out.clear(); // scratch set for calculations
ResourceBitMap live_out(live_set_size()); live_out.clear(); // scratch set for calculations
// Perform a backward dataflow analysis to compute live_out and live_in for each block.
// The loop is executed until a fixpoint is reached (no changes in an iteration)
@ -775,7 +775,7 @@ void LinearScan::compute_global_live_sets() {
if (!block->live_out().is_same(live_out)) {
// A change occurred. Swap the old and new live out sets to avoid copying.
BitMap temp = block->live_out();
ResourceBitMap temp = block->live_out();
block->set_live_out(live_out);
live_out = temp;
@ -787,7 +787,7 @@ void LinearScan::compute_global_live_sets() {
if (iteration_count == 0 || change_occurred_in_block) {
// live_in(block) is the union of live_gen(block) with (live_out(block) & !live_kill(block))
// note: live_in has to be computed only in first iteration or if live_out has changed!
BitMap live_in = block->live_in();
ResourceBitMap live_in = block->live_in();
live_in.set_from(block->live_out());
live_in.set_difference(block->live_kill());
live_in.set_union(block->live_gen());
@ -826,7 +826,7 @@ void LinearScan::compute_global_live_sets() {
#endif
// check that the live_in set of the first block is empty
BitMap live_in_args(ir()->start()->live_in().size());
ResourceBitMap live_in_args(ir()->start()->live_in().size());
live_in_args.clear();
if (!ir()->start()->live_in().is_same(live_in_args)) {
#ifdef ASSERT
@ -1317,7 +1317,7 @@ void LinearScan::build_intervals() {
assert(block_to == instructions->at(instructions->length() - 1)->id(), "must be");
// Update intervals for registers live at the end of this block;
BitMap live = block->live_out();
ResourceBitMap live = block->live_out();
int size = (int)live.size();
for (int number = (int)live.get_next_one_offset(0, size); number < size; number = (int)live.get_next_one_offset(number + 1, size)) {
assert(live.at(number), "should not stop here otherwise");
@ -1717,7 +1717,7 @@ void LinearScan::resolve_collect_mappings(BlockBegin* from_block, BlockBegin* to
const int num_regs = num_virtual_regs();
const int size = live_set_size();
const BitMap live_at_edge = to_block->live_in();
const ResourceBitMap live_at_edge = to_block->live_in();
// visit all registers where the live_at_edge bit is set
for (int r = (int)live_at_edge.get_next_one_offset(0, size); r < size; r = (int)live_at_edge.get_next_one_offset(r + 1, size)) {
@ -1774,8 +1774,8 @@ void LinearScan::resolve_data_flow() {
int num_blocks = block_count();
MoveResolver move_resolver(this);
BitMap block_completed(num_blocks); block_completed.clear();
BitMap already_resolved(num_blocks); already_resolved.clear();
ResourceBitMap block_completed(num_blocks); block_completed.clear();
ResourceBitMap already_resolved(num_blocks); already_resolved.clear();
int i;
for (i = 0; i < num_blocks; i++) {
@ -3397,7 +3397,7 @@ void LinearScan::verify_constants() {
for (int i = 0; i < num_blocks; i++) {
BlockBegin* block = block_at(i);
BitMap live_at_edge = block->live_in();
ResourceBitMap live_at_edge = block->live_in();
// visit all registers where the live_at_edge bit is set
for (int r = (int)live_at_edge.get_next_one_offset(0, size); r < size; r = (int)live_at_edge.get_next_one_offset(r + 1, size)) {
@ -3749,7 +3749,7 @@ void MoveResolver::verify_before_resolve() {
}
BitMap used_regs(LinearScan::nof_regs + allocator()->frame_map()->argcount() + allocator()->max_spills());
ResourceBitMap used_regs(LinearScan::nof_regs + allocator()->frame_map()->argcount() + allocator()->max_spills());
used_regs.clear();
if (!_multiple_reads_allowed) {
for (i = 0; i < _mapping_from.length(); i++) {
@ -6317,7 +6317,7 @@ void ControlFlowOptimizer::delete_unnecessary_jumps(BlockList* code) {
void ControlFlowOptimizer::delete_jumps_to_return(BlockList* code) {
#ifdef ASSERT
BitMap return_converted(BlockBegin::number_of_blocks());
ResourceBitMap return_converted(BlockBegin::number_of_blocks());
return_converted.clear();
#endif