< prev index next >

src/share/vm/c1/c1_LinearScan.cpp

Print this page
rev 10979 : 8140594: Various minor code improvements (compiler)


5504   if (max_reg != any_reg && _block_pos[max_reg] <= interval_to) {
5505     *need_split = true;
5506   }
5507 
5508   return max_reg;
5509 }
5510 
5511 int LinearScanWalker::find_locked_double_reg(int reg_needed_until, int interval_to, int hint_reg, bool* need_split) {
5512   assert((_last_reg - _first_reg + 1) % 2 == 0, "adjust algorithm");
5513 
5514   int max_reg = any_reg;
5515 
5516   for (int i = _first_reg; i < _last_reg; i+=2) {
5517     if (_use_pos[i] > reg_needed_until && _use_pos[i + 1] > reg_needed_until) {
5518       if (max_reg == any_reg || _use_pos[i] > _use_pos[max_reg]) {
5519         max_reg = i;
5520       }
5521     }
5522   }
5523 
5524   if (_block_pos[max_reg] <= interval_to || _block_pos[max_reg + 1] <= interval_to) {

5525     *need_split = true;
5526   }
5527 
5528   return max_reg;
5529 }
5530 
5531 void LinearScanWalker::split_and_spill_intersecting_intervals(int reg, int regHi) {
5532   assert(reg != any_reg, "no register assigned");
5533 
5534   for (int i = 0; i < _spill_intervals[reg]->length(); i++) {
5535     Interval* it = _spill_intervals[reg]->at(i);
5536     remove_from_list(it);
5537     split_and_spill_interval(it);
5538   }
5539 
5540   if (regHi != any_reg) {
5541     IntervalList* processed = _spill_intervals[reg];
5542     for (int i = 0; i < _spill_intervals[regHi]->length(); i++) {
5543       Interval* it = _spill_intervals[regHi]->at(i);
5544       if (processed->find(it) == -1) {


6480 
6481 }
6482 
6483 // add the method-local numbers to the total sum
6484 void LinearScanStatistic::sum_up(LinearScanStatistic &method_statistic) {
6485   for (int i = 0; i < number_of_counters; i++) {
6486     _counters_sum[i] += method_statistic._counters_sum[i];
6487     _counters_max[i] = MAX2(_counters_max[i], method_statistic._counters_sum[i]);
6488   }
6489 }
6490 
6491 void LinearScanStatistic::print(const char* title) {
6492   if (CountLinearScan || TraceLinearScanLevel > 0) {
6493     tty->cr();
6494     tty->print_cr("***** LinearScan statistic - %s *****", title);
6495 
6496     for (int i = 0; i < number_of_counters; i++) {
6497       if (_counters_sum[i] > 0 || _counters_max[i] >= 0) {
6498         tty->print("%25s: %8d", counter_name(i), _counters_sum[i]);
6499 
6500         if (base_counter(i) != invalid_counter) {
6501           tty->print("  (%5.1f%%) ", _counters_sum[i] * 100.0 / _counters_sum[base_counter(i)]);

6502         } else {
6503           tty->print("           ");
6504         }
6505 
6506         if (_counters_max[i] >= 0) {
6507           tty->print("%8d", _counters_max[i]);
6508         }
6509       }
6510       tty->cr();
6511     }
6512   }
6513 }
6514 
6515 void LinearScanStatistic::collect(LinearScan* allocator) {
6516   inc_counter(counter_method);
6517   if (allocator->has_fpu_registers()) {
6518     inc_counter(counter_fpu_method);
6519   }
6520   if (allocator->num_loops() > 0) {
6521     inc_counter(counter_loop_method);




5504   if (max_reg != any_reg && _block_pos[max_reg] <= interval_to) {
5505     *need_split = true;
5506   }
5507 
5508   return max_reg;
5509 }
5510 
5511 int LinearScanWalker::find_locked_double_reg(int reg_needed_until, int interval_to, int hint_reg, bool* need_split) {
5512   assert((_last_reg - _first_reg + 1) % 2 == 0, "adjust algorithm");
5513 
5514   int max_reg = any_reg;
5515 
5516   for (int i = _first_reg; i < _last_reg; i+=2) {
5517     if (_use_pos[i] > reg_needed_until && _use_pos[i + 1] > reg_needed_until) {
5518       if (max_reg == any_reg || _use_pos[i] > _use_pos[max_reg]) {
5519         max_reg = i;
5520       }
5521     }
5522   }
5523 
5524   if (max_reg != any_reg &&
5525       (_block_pos[max_reg] <= interval_to || _block_pos[max_reg + 1] <= interval_to)) {
5526     *need_split = true;
5527   }
5528 
5529   return max_reg;
5530 }
5531 
5532 void LinearScanWalker::split_and_spill_intersecting_intervals(int reg, int regHi) {
5533   assert(reg != any_reg, "no register assigned");
5534 
5535   for (int i = 0; i < _spill_intervals[reg]->length(); i++) {
5536     Interval* it = _spill_intervals[reg]->at(i);
5537     remove_from_list(it);
5538     split_and_spill_interval(it);
5539   }
5540 
5541   if (regHi != any_reg) {
5542     IntervalList* processed = _spill_intervals[reg];
5543     for (int i = 0; i < _spill_intervals[regHi]->length(); i++) {
5544       Interval* it = _spill_intervals[regHi]->at(i);
5545       if (processed->find(it) == -1) {


6481 
6482 }
6483 
6484 // add the method-local numbers to the total sum
6485 void LinearScanStatistic::sum_up(LinearScanStatistic &method_statistic) {
6486   for (int i = 0; i < number_of_counters; i++) {
6487     _counters_sum[i] += method_statistic._counters_sum[i];
6488     _counters_max[i] = MAX2(_counters_max[i], method_statistic._counters_sum[i]);
6489   }
6490 }
6491 
6492 void LinearScanStatistic::print(const char* title) {
6493   if (CountLinearScan || TraceLinearScanLevel > 0) {
6494     tty->cr();
6495     tty->print_cr("***** LinearScan statistic - %s *****", title);
6496 
6497     for (int i = 0; i < number_of_counters; i++) {
6498       if (_counters_sum[i] > 0 || _counters_max[i] >= 0) {
6499         tty->print("%25s: %8d", counter_name(i), _counters_sum[i]);
6500 
6501         LinearScanStatistic::Counter cntr = base_counter(i);
6502         if (cntr != invalid_counter) {
6503           tty->print("  (%5.1f%%) ", _counters_sum[i] * 100.0 / _counters_sum[cntr]);
6504         } else {
6505           tty->print("           ");
6506         }
6507 
6508         if (_counters_max[i] >= 0) {
6509           tty->print("%8d", _counters_max[i]);
6510         }
6511       }
6512       tty->cr();
6513     }
6514   }
6515 }
6516 
6517 void LinearScanStatistic::collect(LinearScan* allocator) {
6518   inc_counter(counter_method);
6519   if (allocator->has_fpu_registers()) {
6520     inc_counter(counter_fpu_method);
6521   }
6522   if (allocator->num_loops() > 0) {
6523     inc_counter(counter_loop_method);


< prev index next >