c1_IR.cpp revision 1504
1472N/A * or visit www.oracle.com if you need additional information or have any
0N/A if (!type_is_exact) {
0N/A assert(entry_block() == other->entry_block(), "entry_block must be equal when entry_pco is equal");
0N/AIRScope::IRScope(Compilation* compilation, IRScope* caller, int caller_bci, ciMethod* method, int osr_bci, bool create_graph)
0N/A _number_of_locks = 0;
0N/A int callee_max = 0;
0N/A for (int i = 0; i < number_of_callees(); i++) {
0N/A _lock_stack_size = 0;
1484N/A , _is_method_handle_invoke(false) {
0N/A assert(_bci == SynchronizationEntryBCI || Bytecodes::is_defined(scope()->method()->java_code_at_bci(_bci)), "make sure bci points at a real bytecode");
0N/A if (lock_stack_only) {
1484N/A _scope_debug_info->record_debug_info(recorder, pc_offset, true/*topmost*/, _is_method_handle_invoke);
0N/A , _num_loops(0) {
0N/A if (EliminateBlocks) {
0N/A if (EliminateNullChecks) {
0N/A void split_edges() {
0N/A (*n)->_use_count++;
1504N/A (*n)->input_values_do(this);
1504N/A (*n)->state_values_do(this);
0N/A void set_visited(BlockBegin* b) { assert(!is_visited(b), "already set"); _visited_blocks.set_bit(b->block_id()); }
0N/A void set_active(BlockBegin* b) { assert(!is_active(b), "already set"); _active_blocks.set_bit(b->block_id()); }
0N/A void clear_active(BlockBegin* b) { assert(is_active(b), "not already"); _active_blocks.clear_bit(b->block_id()); }
0N/A void inc_forward_branches(BlockBegin* b) { _forward_branches.at_put(b->block_id(), _forward_branches.at(b->block_id()) + 1); }
0N/A int dec_forward_branches(BlockBegin* b) { _forward_branches.at_put(b->block_id(), _forward_branches.at(b->block_id()) - 1); return _forward_branches.at(b->block_id()); }
0N/A bool is_block_in_loop (int loop_idx, BlockBegin* b) const { return _loop_map.at(loop_idx, b->block_id()); }
0N/A void set_block_in_loop (int loop_idx, BlockBegin* b) { _loop_map.set_bit(loop_idx, b->block_id()); }
0N/A void clear_block_in_loop(int loop_idx, int block_id) { _loop_map.clear_bit(loop_idx, block_id); }
0N/A void mark_loops();
0N/A bool compute_dominators_iter();
0N/A void compute_dominators();
0N/A _num_blocks(0),
0N/A _num_loops(0),
0N/A _iterative_dominators(false),
0N/A init_visited();
0N/A if (_num_loops > 0) {
0N/A mark_loops();
0N/A TRACE_LINEAR_SCAN(3, tty->print_cr("Enter count_edges for block B%d coming from B%d", cur->block_id(), parent != NULL ? parent->block_id() : -1));
428N/A // an exception edge. Because such edges are usually critical edges which cannot be split, the
428N/A _iterative_dominators = true;
0N/A _num_blocks++;
0N/A TRACE_LINEAR_SCAN(3, tty->print_cr("Block B%d is loop header of loop %d", cur->block_id(), _num_loops));
0N/A _num_loops++;
0N/A TRACE_LINEAR_SCAN(3, tty->print_cr("Processing loop from B%d to B%d (loop %d):", loop_start->block_id(), loop_end->block_id(), loop_idx));
0N/A assert(loop_start->is_set(BlockBegin::linear_scan_loop_header_flag), "loop header flag must be set");
0N/A assert(is_block_in_loop(loop_idx, cur), "bit in loop map must be set when block is in work list");
0N/A _iterative_dominators = true;
0N/A init_visited();
0N/A int loop_depth = 0;
0N/A loop_depth++;
0N/A min_loop_idx = i;
0N/A assert(a->dominator() != NULL || a == _linear_scan_order->at(0), "dominator must be initialized");
0N/A assert(b->dominator() != NULL || b == _linear_scan_order->at(0), "dominator must be initialized");
0N/A TRACE_LINEAR_SCAN(4, tty->print_cr("DOM: initializing dominator of B%d to B%d", cur->block_id(), parent->block_id()));
0N/A } else if (!(cur->is_set(BlockBegin::linear_scan_loop_header_flag) && parent->is_set(BlockBegin::linear_scan_loop_end_flag))) {
0N/A TRACE_LINEAR_SCAN(4, tty->print_cr("DOM: computing dominator of B%d: common dominator of B%d and B%d is B%d", cur->block_id(), parent->block_id(), cur->dominator()->block_id(), common_dominator(cur->dominator(), parent)->block_id()));
0N/A INC_WEIGHT_IF(cur->end()->as_Throw() == NULL && (single_sux == NULL || single_sux->end()->as_Throw() == NULL));
0N/A INC_WEIGHT_IF(cur->end()->as_Return() == NULL && (single_sux == NULL || single_sux->end()->as_Return() == NULL));
0N/A assert(_linear_scan_order->index_of(cur) == -1, "block already processed (block can be ready only once)");
0N/A assert(_work_list.index_of(cur) == -1, "block already in work-list (block can be ready only once)");
0N/A if (StressLinearScan) {
0N/A insert_idx--;
0N/A TRACE_LINEAR_SCAN(3, tty->print_cr("Sorted B%d into worklist. new worklist:", cur->block_id()));
0N/A TRACE_LINEAR_SCAN(3, for (int i = 0; i < _work_list.length(); i++) tty->print_cr("%8d B%2d weight:%6x", i, _work_list.at(i)->block_id(), _work_list.at(i)->linear_scan_number()));
0N/A assert(i == 0 || _work_list.at(i - 1)->linear_scan_number() <= _work_list.at(i)->linear_scan_number(), "incorrect order in worklist");
0N/A TRACE_LINEAR_SCAN(3, tty->print_cr("appending block B%d (weight 0x%6x) to linear-scan order", cur->block_id(), cur->linear_scan_number()));
0N/A assert(osr_entry->sux_at(0)->number_of_preds() >= 2, "sucessor of osr entry must have two predecessors (otherwise it is not present in normal control flow");
0N/A _iterative_dominators = true;
0N/A assert(false, "the std_entry must be ready for processing (otherwise, the method has no start block)");
0N/A TRACE_LINEAR_SCAN(4, tty->print_cr("DOM: updating dominator of B%d from B%d to B%d", block->block_id(), block->dominator()->block_id(), dominator->block_id()));
0N/A TRACE_LINEAR_SCAN(3, tty->print_cr("----- computing dominators (iterative computation reqired: %d)", _iterative_dominators));
0N/A if (_iterative_dominators) {
0N/A } while (compute_dominators_iter());
0N/A tty->print("%4d: B%2d loop: %2d depth: %2d", cur->linear_scan_number(), cur->block_id(), cur->loop_index(), cur->loop_depth());
0N/A if (StressLinearScan) {
0N/A assert(cur->linear_scan_number() >= 0 && cur->linear_scan_number() == _linear_scan_order->index_of(cur), "incorrect linear_scan_number");
0N/A assert(sux->linear_scan_number() >= 0 && sux->linear_scan_number() == _linear_scan_order->index_of(sux), "incorrect linear_scan_number");
0N/A assert(cur->loop_index() == sux->loop_index() || sux->is_set(BlockBegin::linear_scan_loop_header_flag), "successing blocks with same loop depth must have same loop index");
0N/A assert(pred->linear_scan_number() >= 0 && pred->linear_scan_number() == _linear_scan_order->index_of(pred), "incorrect linear_scan_number");
0N/A assert(cur->loop_index() == pred->loop_index() || cur->is_set(BlockBegin::linear_scan_loop_header_flag), "successing blocks with same loop depth must have same loop index");
0N/A assert(cur->dominator()->linear_scan_number() <= cur->pred_at(j)->linear_scan_number(), "dominator must be before predecessors");
0N/A assert(cur->number_of_preds() != 1 || cur->dominator() == cur->pred_at(0), "Single predecessor must also be dominator");
0N/A assert(!is_block_in_loop(loop_idx, _linear_scan_order->at(block_idx)), "the first block must not be present in any loop");
0N/A while (block_idx < _num_blocks && !is_block_in_loop(loop_idx, _linear_scan_order->at(block_idx))) {
0N/A while (block_idx < _num_blocks && is_block_in_loop(loop_idx, _linear_scan_order->at(block_idx))) {
0N/A assert(!is_block_in_loop(loop_idx, _linear_scan_order->at(block_idx)), "loop not continuous in linear-scan order");
0N/A for (int i = 0; i < num_blocks; i++) {
0N/A bool _live_only;