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

src/share/vm/oops/methodData.cpp

Print this page
rev 6139 : 8031755: Type speculation should be used to optimize explicit null checks
Summary: feed profiling data about reference nullness to type speculation.
Reviewed-by:


 784     default:
 785       fatal("unexpected bytecode for var length profile data");
 786     }
 787   }
 788   // Note:  cell_count might be zero, meaning that there is just
 789   //        a DataLayout header, with no extra cells.
 790   assert(cell_count >= 0, "sanity");
 791   return DataLayout::compute_size_in_bytes(cell_count);
 792 }
 793 
 794 bool MethodData::is_speculative_trap_bytecode(Bytecodes::Code code) {
 795   // Bytecodes for which we may use speculation
 796   switch (code) {
 797   case Bytecodes::_checkcast:
 798   case Bytecodes::_instanceof:
 799   case Bytecodes::_aastore:
 800   case Bytecodes::_invokevirtual:
 801   case Bytecodes::_invokeinterface:
 802   case Bytecodes::_if_acmpeq:
 803   case Bytecodes::_if_acmpne:


 804   case Bytecodes::_invokestatic:
 805 #ifdef COMPILER2
 806     return UseTypeSpeculation;
 807 #endif
 808   default:
 809     return false;
 810   }
 811   return false;
 812 }
 813 
 814 int MethodData::compute_extra_data_count(int data_size, int empty_bc_count, bool needs_speculative_traps) {
 815   if (ProfileTraps) {
 816     // Assume that up to 3% of BCIs with no MDP will need to allocate one.
 817     int extra_data_count = (uint)(empty_bc_count * 3) / 128 + 1;
 818     // If the method is large, let the extra BCIs grow numerous (to ~1%).
 819     int one_percent_of_data
 820       = (uint)data_size / (DataLayout::header_size_in_bytes()*128);
 821     if (extra_data_count < one_percent_of_data)
 822       extra_data_count = one_percent_of_data;
 823     if (extra_data_count > empty_bc_count)




 784     default:
 785       fatal("unexpected bytecode for var length profile data");
 786     }
 787   }
 788   // Note:  cell_count might be zero, meaning that there is just
 789   //        a DataLayout header, with no extra cells.
 790   assert(cell_count >= 0, "sanity");
 791   return DataLayout::compute_size_in_bytes(cell_count);
 792 }
 793 
 794 bool MethodData::is_speculative_trap_bytecode(Bytecodes::Code code) {
 795   // Bytecodes for which we may use speculation
 796   switch (code) {
 797   case Bytecodes::_checkcast:
 798   case Bytecodes::_instanceof:
 799   case Bytecodes::_aastore:
 800   case Bytecodes::_invokevirtual:
 801   case Bytecodes::_invokeinterface:
 802   case Bytecodes::_if_acmpeq:
 803   case Bytecodes::_if_acmpne:
 804   case Bytecodes::_ifnull:
 805   case Bytecodes::_ifnonnull:
 806   case Bytecodes::_invokestatic:
 807 #ifdef COMPILER2
 808     return UseTypeSpeculation;
 809 #endif
 810   default:
 811     return false;
 812   }
 813   return false;
 814 }
 815 
 816 int MethodData::compute_extra_data_count(int data_size, int empty_bc_count, bool needs_speculative_traps) {
 817   if (ProfileTraps) {
 818     // Assume that up to 3% of BCIs with no MDP will need to allocate one.
 819     int extra_data_count = (uint)(empty_bc_count * 3) / 128 + 1;
 820     // If the method is large, let the extra BCIs grow numerous (to ~1%).
 821     int one_percent_of_data
 822       = (uint)data_size / (DataLayout::header_size_in_bytes()*128);
 823     if (extra_data_count < one_percent_of_data)
 824       extra_data_count = one_percent_of_data;
 825     if (extra_data_count > empty_bc_count)


src/share/vm/oops/methodData.cpp
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File