src/share/vm/c1/c1_LIR.cpp
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File hotspot Sdiff src/share/vm/c1

src/share/vm/c1/c1_LIR.cpp

Print this page
rev 5349 : 8023657: New type profiling points: arguments to call
Summary: x86 interpreter and c1 type profiling for arguments at calls
Reviewed-by:


 984       if (opAllocArray->_len->is_valid())             do_input(opAllocArray->_len);   do_temp(opAllocArray->_len);
 985       if (opAllocArray->_tmp1->is_valid())            do_temp(opAllocArray->_tmp1);
 986       if (opAllocArray->_tmp2->is_valid())            do_temp(opAllocArray->_tmp2);
 987       if (opAllocArray->_tmp3->is_valid())            do_temp(opAllocArray->_tmp3);
 988       if (opAllocArray->_tmp4->is_valid())            do_temp(opAllocArray->_tmp4);
 989       if (opAllocArray->_result->is_valid())          do_output(opAllocArray->_result);
 990                                                       do_stub(opAllocArray->_stub);
 991       break;
 992     }
 993 
 994 // LIR_OpProfileCall:
 995     case lir_profile_call: {
 996       assert(op->as_OpProfileCall() != NULL, "must be");
 997       LIR_OpProfileCall* opProfileCall = (LIR_OpProfileCall*)op;
 998 
 999       if (opProfileCall->_recv->is_valid())              do_temp(opProfileCall->_recv);
1000       assert(opProfileCall->_mdo->is_valid(), "used");   do_temp(opProfileCall->_mdo);
1001       assert(opProfileCall->_tmp1->is_valid(), "used");  do_temp(opProfileCall->_tmp1);
1002       break;
1003     }











1004   default:
1005     ShouldNotReachHere();
1006   }
1007 }
1008 
1009 
1010 void LIR_OpVisitState::do_stub(CodeStub* stub) {
1011   if (stub != NULL) {
1012     stub->visit(this);
1013   }
1014 }
1015 
1016 XHandlers* LIR_OpVisitState::all_xhandler() {
1017   XHandlers* result = NULL;
1018 
1019   int i;
1020   for (i = 0; i < info_count(); i++) {
1021     if (info_at(i)->exception_handlers() != NULL) {
1022       result = info_at(i)->exception_handlers();
1023       break;


1134   masm->emit_lock(this);
1135   if (stub()) {
1136     masm->emit_code_stub(stub());
1137   }
1138 }
1139 
1140 #ifdef ASSERT
1141 void LIR_OpAssert::emit_code(LIR_Assembler* masm) {
1142   masm->emit_assert(this);
1143 }
1144 #endif
1145 
1146 void LIR_OpDelay::emit_code(LIR_Assembler* masm) {
1147   masm->emit_delay(this);
1148 }
1149 
1150 void LIR_OpProfileCall::emit_code(LIR_Assembler* masm) {
1151   masm->emit_profile_call(this);
1152 }
1153 




1154 // LIR_List
1155 LIR_List::LIR_List(Compilation* compilation, BlockBegin* block)
1156   : _operations(8)
1157   , _compilation(compilation)
1158 #ifndef PRODUCT
1159   , _block(block)
1160 #endif
1161 #ifdef ASSERT
1162   , _file(NULL)
1163   , _line(0)
1164 #endif
1165 { }
1166 
1167 
1168 #ifdef ASSERT
1169 void LIR_List::set_file_and_line(const char * file, int line) {
1170   const char * f = strrchr(file, '/');
1171   if (f == NULL) f = strrchr(file, '\\');
1172   if (f == NULL) {
1173     f = file;


1786      case lir_dynamic_call:          s = "dynamic";       break;
1787      // LIR_OpArrayCopy
1788      case lir_arraycopy:             s = "arraycopy";     break;
1789      // LIR_OpUpdateCRC32
1790      case lir_updatecrc32:           s = "updatecrc32";   break;
1791      // LIR_OpLock
1792      case lir_lock:                  s = "lock";          break;
1793      case lir_unlock:                s = "unlock";        break;
1794      // LIR_OpDelay
1795      case lir_delay_slot:            s = "delay";         break;
1796      // LIR_OpTypeCheck
1797      case lir_instanceof:            s = "instanceof";    break;
1798      case lir_checkcast:             s = "checkcast";     break;
1799      case lir_store_check:           s = "store_check";   break;
1800      // LIR_OpCompareAndSwap
1801      case lir_cas_long:              s = "cas_long";      break;
1802      case lir_cas_obj:               s = "cas_obj";      break;
1803      case lir_cas_int:               s = "cas_int";      break;
1804      // LIR_OpProfileCall
1805      case lir_profile_call:          s = "profile_call";  break;


1806      // LIR_OpAssert
1807 #ifdef ASSERT
1808      case lir_assert:                s = "assert";        break;
1809 #endif
1810      case lir_none:                  ShouldNotReachHere();break;
1811     default:                         s = "illegal_op";    break;
1812   }
1813   return s;
1814 }
1815 
1816 // LIR_OpJavaCall
1817 void LIR_OpJavaCall::print_instr(outputStream* out) const {
1818   out->print("call: ");
1819   out->print("[addr: 0x%x]", address());
1820   if (receiver()->is_valid()) {
1821     out->print(" [recv: ");   receiver()->print(out);   out->print("]");
1822   }
1823   if (result_opr()->is_valid()) {
1824     out->print(" [result: "); result_opr()->print(out); out->print("]");
1825   }


2067   in_opr2()->print(out);             out->print(", \"");
2068   out->print(msg());                 out->print("\"");
2069 }
2070 #endif
2071 
2072 
2073 void LIR_OpDelay::print_instr(outputStream* out) const {
2074   _op->print_on(out);
2075 }
2076 
2077 
2078 // LIR_OpProfileCall
2079 void LIR_OpProfileCall::print_instr(outputStream* out) const {
2080   profiled_method()->name()->print_symbol_on(out);
2081   out->print(".");
2082   profiled_method()->holder()->name()->print_symbol_on(out);
2083   out->print(" @ %d ", profiled_bci());
2084   mdo()->print(out);           out->print(" ");
2085   recv()->print(out);          out->print(" ");
2086   tmp1()->print(out);          out->print(" ");









2087 }
2088 
2089 #endif // PRODUCT
2090 
2091 // Implementation of LIR_InsertionBuffer
2092 
2093 void LIR_InsertionBuffer::append(int index, LIR_Op* op) {
2094   assert(_index_and_count.length() % 2 == 0, "must have a count for each index");
2095 
2096   int i = number_of_insertion_points() - 1;
2097   if (i < 0 || index_at(i) < index) {
2098     append_new(index, 1);
2099   } else {
2100     assert(index_at(i) == index, "can append LIR_Ops in ascending order only");
2101     assert(count_at(i) > 0, "check");
2102     set_count_at(i, count_at(i) + 1);
2103   }
2104   _ops.push(op);
2105 
2106   DEBUG_ONLY(verify());


 984       if (opAllocArray->_len->is_valid())             do_input(opAllocArray->_len);   do_temp(opAllocArray->_len);
 985       if (opAllocArray->_tmp1->is_valid())            do_temp(opAllocArray->_tmp1);
 986       if (opAllocArray->_tmp2->is_valid())            do_temp(opAllocArray->_tmp2);
 987       if (opAllocArray->_tmp3->is_valid())            do_temp(opAllocArray->_tmp3);
 988       if (opAllocArray->_tmp4->is_valid())            do_temp(opAllocArray->_tmp4);
 989       if (opAllocArray->_result->is_valid())          do_output(opAllocArray->_result);
 990                                                       do_stub(opAllocArray->_stub);
 991       break;
 992     }
 993 
 994 // LIR_OpProfileCall:
 995     case lir_profile_call: {
 996       assert(op->as_OpProfileCall() != NULL, "must be");
 997       LIR_OpProfileCall* opProfileCall = (LIR_OpProfileCall*)op;
 998 
 999       if (opProfileCall->_recv->is_valid())              do_temp(opProfileCall->_recv);
1000       assert(opProfileCall->_mdo->is_valid(), "used");   do_temp(opProfileCall->_mdo);
1001       assert(opProfileCall->_tmp1->is_valid(), "used");  do_temp(opProfileCall->_tmp1);
1002       break;
1003     }
1004 
1005 // LIR_OpProfileType:
1006     case lir_profile_type: {
1007       assert(op->as_OpProfileType() != NULL, "must be");
1008       LIR_OpProfileType* opProfileType = (LIR_OpProfileType*)op;
1009 
1010       do_input(opProfileType->_mdp); do_temp(opProfileType->_mdp);
1011       do_input(opProfileType->_obj);
1012       do_temp(opProfileType->_tmp);
1013       break;
1014     }
1015   default:
1016     ShouldNotReachHere();
1017   }
1018 }
1019 
1020 
1021 void LIR_OpVisitState::do_stub(CodeStub* stub) {
1022   if (stub != NULL) {
1023     stub->visit(this);
1024   }
1025 }
1026 
1027 XHandlers* LIR_OpVisitState::all_xhandler() {
1028   XHandlers* result = NULL;
1029 
1030   int i;
1031   for (i = 0; i < info_count(); i++) {
1032     if (info_at(i)->exception_handlers() != NULL) {
1033       result = info_at(i)->exception_handlers();
1034       break;


1145   masm->emit_lock(this);
1146   if (stub()) {
1147     masm->emit_code_stub(stub());
1148   }
1149 }
1150 
1151 #ifdef ASSERT
1152 void LIR_OpAssert::emit_code(LIR_Assembler* masm) {
1153   masm->emit_assert(this);
1154 }
1155 #endif
1156 
1157 void LIR_OpDelay::emit_code(LIR_Assembler* masm) {
1158   masm->emit_delay(this);
1159 }
1160 
1161 void LIR_OpProfileCall::emit_code(LIR_Assembler* masm) {
1162   masm->emit_profile_call(this);
1163 }
1164 
1165 void LIR_OpProfileType::emit_code(LIR_Assembler* masm) {
1166   masm->emit_profile_type(this);
1167 }
1168 
1169 // LIR_List
1170 LIR_List::LIR_List(Compilation* compilation, BlockBegin* block)
1171   : _operations(8)
1172   , _compilation(compilation)
1173 #ifndef PRODUCT
1174   , _block(block)
1175 #endif
1176 #ifdef ASSERT
1177   , _file(NULL)
1178   , _line(0)
1179 #endif
1180 { }
1181 
1182 
1183 #ifdef ASSERT
1184 void LIR_List::set_file_and_line(const char * file, int line) {
1185   const char * f = strrchr(file, '/');
1186   if (f == NULL) f = strrchr(file, '\\');
1187   if (f == NULL) {
1188     f = file;


1801      case lir_dynamic_call:          s = "dynamic";       break;
1802      // LIR_OpArrayCopy
1803      case lir_arraycopy:             s = "arraycopy";     break;
1804      // LIR_OpUpdateCRC32
1805      case lir_updatecrc32:           s = "updatecrc32";   break;
1806      // LIR_OpLock
1807      case lir_lock:                  s = "lock";          break;
1808      case lir_unlock:                s = "unlock";        break;
1809      // LIR_OpDelay
1810      case lir_delay_slot:            s = "delay";         break;
1811      // LIR_OpTypeCheck
1812      case lir_instanceof:            s = "instanceof";    break;
1813      case lir_checkcast:             s = "checkcast";     break;
1814      case lir_store_check:           s = "store_check";   break;
1815      // LIR_OpCompareAndSwap
1816      case lir_cas_long:              s = "cas_long";      break;
1817      case lir_cas_obj:               s = "cas_obj";      break;
1818      case lir_cas_int:               s = "cas_int";      break;
1819      // LIR_OpProfileCall
1820      case lir_profile_call:          s = "profile_call";  break;
1821      // LIR_OpProfileType
1822      case lir_profile_type:          s = "profile_type";  break;
1823      // LIR_OpAssert
1824 #ifdef ASSERT
1825      case lir_assert:                s = "assert";        break;
1826 #endif
1827      case lir_none:                  ShouldNotReachHere();break;
1828     default:                         s = "illegal_op";    break;
1829   }
1830   return s;
1831 }
1832 
1833 // LIR_OpJavaCall
1834 void LIR_OpJavaCall::print_instr(outputStream* out) const {
1835   out->print("call: ");
1836   out->print("[addr: 0x%x]", address());
1837   if (receiver()->is_valid()) {
1838     out->print(" [recv: ");   receiver()->print(out);   out->print("]");
1839   }
1840   if (result_opr()->is_valid()) {
1841     out->print(" [result: "); result_opr()->print(out); out->print("]");
1842   }


2084   in_opr2()->print(out);             out->print(", \"");
2085   out->print(msg());                 out->print("\"");
2086 }
2087 #endif
2088 
2089 
2090 void LIR_OpDelay::print_instr(outputStream* out) const {
2091   _op->print_on(out);
2092 }
2093 
2094 
2095 // LIR_OpProfileCall
2096 void LIR_OpProfileCall::print_instr(outputStream* out) const {
2097   profiled_method()->name()->print_symbol_on(out);
2098   out->print(".");
2099   profiled_method()->holder()->name()->print_symbol_on(out);
2100   out->print(" @ %d ", profiled_bci());
2101   mdo()->print(out);           out->print(" ");
2102   recv()->print(out);          out->print(" ");
2103   tmp1()->print(out);          out->print(" ");
2104 }
2105 
2106 // LIR_OpProfileType
2107 void LIR_OpProfileType::print_instr(outputStream* out) const {
2108   out->print("exact = "); exact_klass()->print_name_on(out);
2109   out->print("current = "); ciTypeEntries::print_ciklass(out, current_klass());
2110   mdp()->print(out);          out->print(" ");
2111   obj()->print(out);          out->print(" ");
2112   tmp()->print(out);          out->print(" ");
2113 }
2114 
2115 #endif // PRODUCT
2116 
2117 // Implementation of LIR_InsertionBuffer
2118 
2119 void LIR_InsertionBuffer::append(int index, LIR_Op* op) {
2120   assert(_index_and_count.length() % 2 == 0, "must have a count for each index");
2121 
2122   int i = number_of_insertion_points() - 1;
2123   if (i < 0 || index_at(i) < index) {
2124     append_new(index, 1);
2125   } else {
2126     assert(index_at(i) == index, "can append LIR_Ops in ascending order only");
2127     assert(count_at(i) > 0, "check");
2128     set_count_at(i, count_at(i) + 1);
2129   }
2130   _ops.push(op);
2131 
2132   DEBUG_ONLY(verify());
src/share/vm/c1/c1_LIR.cpp
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File