hotspot/src/share/vm/c1/c1_RangeCheckElimination.cpp
changeset 24424 2658d7834c6e
parent 22234 da823d78ad65
child 38031 e0b822facc03
equal deleted inserted replaced
24358:8528b67f6562 24424:2658d7834c6e
     1 /*
     1 /*
     2  * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 2012, 2014, Oracle and/or its affiliates. All rights reserved.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     4  *
     5  * This code is free software; you can redistribute it and/or modify it
     5  * This code is free software; you can redistribute it and/or modify it
     6  * under the terms of the GNU General Public License version 2 only, as
     6  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.
     7  * published by the Free Software Foundation.
    60   _ir = ir;
    60   _ir = ir;
    61   _number_of_instructions = Instruction::number_of_instructions();
    61   _number_of_instructions = Instruction::number_of_instructions();
    62   _optimistic = ir->compilation()->is_optimistic();
    62   _optimistic = ir->compilation()->is_optimistic();
    63 
    63 
    64   TRACE_RANGE_CHECK_ELIMINATION(
    64   TRACE_RANGE_CHECK_ELIMINATION(
    65     tty->print_cr("");
    65     tty->cr();
    66     tty->print_cr("Range check elimination");
    66     tty->print_cr("Range check elimination");
    67     ir->method()->print_name(tty);
    67     ir->method()->print_name(tty);
    68     tty->print_cr("");
    68     tty->cr();
    69   );
    69   );
    70 
    70 
    71   TRACE_RANGE_CHECK_ELIMINATION(
    71   TRACE_RANGE_CHECK_ELIMINATION(
    72     tty->print_cr("optimistic=%d", (int)_optimistic);
    72     tty->print_cr("optimistic=%d", (int)_optimistic);
    73   );
    73   );
  1022                        if ((bound->has_lower() || bound->has_upper()) && (bound->lower_instr() != phi || bound->upper_instr() != phi || bound->lower() != 0 || bound->upper() != 0)) {
  1022                        if ((bound->has_lower() || bound->has_upper()) && (bound->lower_instr() != phi || bound->upper_instr() != phi || bound->lower() != 0 || bound->upper() != 0)) {
  1023                            TRACE_RANGE_CHECK_ELIMINATION(tty->fill_to(2*block->dominator_depth());
  1023                            TRACE_RANGE_CHECK_ELIMINATION(tty->fill_to(2*block->dominator_depth());
  1024                                                          tty->print("i%d", phi->id());
  1024                                                          tty->print("i%d", phi->id());
  1025                                                          tty->print(": ");
  1025                                                          tty->print(": ");
  1026                                                          bound->print();
  1026                                                          bound->print();
  1027                                                          tty->print_cr("");
  1027                                                          tty->cr();
  1028                            );
  1028                            );
  1029                          }
  1029                          }
  1030                      });
  1030                      });
  1031 
  1031 
  1032     while (!instr->as_BlockEnd()) {
  1032     while (!instr->as_BlockEnd()) {
  1037           if ((bound->has_lower() || bound->has_upper()) && (bound->lower_instr() != instr || bound->upper_instr() != instr || bound->lower() != 0 || bound->upper() != 0)) {
  1037           if ((bound->has_lower() || bound->has_upper()) && (bound->lower_instr() != instr || bound->upper_instr() != instr || bound->lower() != 0 || bound->upper() != 0)) {
  1038               TRACE_RANGE_CHECK_ELIMINATION(tty->fill_to(2*block->dominator_depth());
  1038               TRACE_RANGE_CHECK_ELIMINATION(tty->fill_to(2*block->dominator_depth());
  1039                                             tty->print("i%d", instr->id());
  1039                                             tty->print("i%d", instr->id());
  1040                                             tty->print(": ");
  1040                                             tty->print(": ");
  1041                                             bound->print();
  1041                                             bound->print();
  1042                                             tty->print_cr("");
  1042                                             tty->cr();
  1043               );
  1043               );
  1044           }
  1044           }
  1045         }
  1045         }
  1046       }
  1046       }
  1047       instr = instr->next();
  1047       instr = instr->next();
  1398   return _lower_instr;
  1398   return _lower_instr;
  1399 }
  1399 }
  1400 
  1400 
  1401 // print
  1401 // print
  1402 void RangeCheckEliminator::Bound::print() {
  1402 void RangeCheckEliminator::Bound::print() {
  1403   tty->print("");
  1403   tty->print("%s", "");
  1404   if (this->_lower_instr || this->_lower != min_jint) {
  1404   if (this->_lower_instr || this->_lower != min_jint) {
  1405     if (this->_lower_instr) {
  1405     if (this->_lower_instr) {
  1406       tty->print("i%d", this->_lower_instr->id());
  1406       tty->print("i%d", this->_lower_instr->id());
  1407       if (this->_lower > 0) {
  1407       if (this->_lower > 0) {
  1408         tty->print("+%d", _lower);
  1408         tty->print("+%d", _lower);