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