1 /*
2 * Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
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
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
761 case Bytecodes::_ifeq:
762 case Bytecodes::_ifne:
763 case Bytecodes::_iflt:
764 case Bytecodes::_ifge:
765 case Bytecodes::_ifgt:
766 case Bytecodes::_ifle:
767 case Bytecodes::_if_icmpeq:
768 case Bytecodes::_if_icmpne:
769 case Bytecodes::_if_icmplt:
770 case Bytecodes::_if_icmpge:
771 case Bytecodes::_if_icmpgt:
772 case Bytecodes::_if_icmple:
773 case Bytecodes::_if_acmpeq:
774 case Bytecodes::_if_acmpne:
775 case Bytecodes::_ifnull:
776 case Bytecodes::_ifnonnull:
777 return BranchData::static_cell_count();
778 case Bytecodes::_lookupswitch:
779 case Bytecodes::_tableswitch:
780 return variable_cell_count;
781 }
782 return no_profile_data;
783 }
784
785 // Compute the size of the profiling information corresponding to
786 // the current bytecode.
787 int MethodData::compute_data_size(BytecodeStream* stream) {
788 int cell_count = bytecode_cell_count(stream->code());
789 if (cell_count == no_profile_data) {
790 return 0;
791 }
792 if (cell_count == variable_cell_count) {
793 switch (stream->code()) {
794 case Bytecodes::_lookupswitch:
795 case Bytecodes::_tableswitch:
796 cell_count = MultiBranchData::compute_cell_count(stream);
797 break;
798 case Bytecodes::_invokespecial:
799 case Bytecodes::_invokestatic:
800 case Bytecodes::_invokedynamic:
801 assert(MethodData::profile_arguments() || MethodData::profile_return(), "should be collecting args profile");
802 if (profile_arguments_for_invoke(stream->method(), stream->bci()) ||
1030 case Bytecodes::_ifgt:
1031 case Bytecodes::_ifle:
1032 case Bytecodes::_if_icmpeq:
1033 case Bytecodes::_if_icmpne:
1034 case Bytecodes::_if_icmplt:
1035 case Bytecodes::_if_icmpge:
1036 case Bytecodes::_if_icmpgt:
1037 case Bytecodes::_if_icmple:
1038 case Bytecodes::_if_acmpeq:
1039 case Bytecodes::_if_acmpne:
1040 case Bytecodes::_ifnull:
1041 case Bytecodes::_ifnonnull:
1042 cell_count = BranchData::static_cell_count();
1043 tag = DataLayout::branch_data_tag;
1044 break;
1045 case Bytecodes::_lookupswitch:
1046 case Bytecodes::_tableswitch:
1047 cell_count = MultiBranchData::compute_cell_count(stream);
1048 tag = DataLayout::multi_branch_data_tag;
1049 break;
1050 }
1051 assert(tag == DataLayout::multi_branch_data_tag ||
1052 ((MethodData::profile_arguments() || MethodData::profile_return()) &&
1053 (tag == DataLayout::call_type_data_tag ||
1054 tag == DataLayout::counter_data_tag ||
1055 tag == DataLayout::virtual_call_type_data_tag ||
1056 tag == DataLayout::virtual_call_data_tag)) ||
1057 cell_count == bytecode_cell_count(c), "cell counts must agree");
1058 if (cell_count >= 0) {
1059 assert(tag != DataLayout::no_tag, "bad tag");
1060 assert(bytecode_has_profile(c), "agree w/ BHP");
1061 data_layout->initialize(tag, stream->bci(), cell_count);
1062 return DataLayout::compute_size_in_bytes(cell_count);
1063 } else {
1064 assert(!bytecode_has_profile(c), "agree w/ !BHP");
1065 return 0;
1066 }
1067 }
1068
1069 // Get the data at an arbitrary (sort of) data index.
|
1 /*
2 * Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
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
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
761 case Bytecodes::_ifeq:
762 case Bytecodes::_ifne:
763 case Bytecodes::_iflt:
764 case Bytecodes::_ifge:
765 case Bytecodes::_ifgt:
766 case Bytecodes::_ifle:
767 case Bytecodes::_if_icmpeq:
768 case Bytecodes::_if_icmpne:
769 case Bytecodes::_if_icmplt:
770 case Bytecodes::_if_icmpge:
771 case Bytecodes::_if_icmpgt:
772 case Bytecodes::_if_icmple:
773 case Bytecodes::_if_acmpeq:
774 case Bytecodes::_if_acmpne:
775 case Bytecodes::_ifnull:
776 case Bytecodes::_ifnonnull:
777 return BranchData::static_cell_count();
778 case Bytecodes::_lookupswitch:
779 case Bytecodes::_tableswitch:
780 return variable_cell_count;
781 default:
782 return no_profile_data;
783 }
784 }
785
786 // Compute the size of the profiling information corresponding to
787 // the current bytecode.
788 int MethodData::compute_data_size(BytecodeStream* stream) {
789 int cell_count = bytecode_cell_count(stream->code());
790 if (cell_count == no_profile_data) {
791 return 0;
792 }
793 if (cell_count == variable_cell_count) {
794 switch (stream->code()) {
795 case Bytecodes::_lookupswitch:
796 case Bytecodes::_tableswitch:
797 cell_count = MultiBranchData::compute_cell_count(stream);
798 break;
799 case Bytecodes::_invokespecial:
800 case Bytecodes::_invokestatic:
801 case Bytecodes::_invokedynamic:
802 assert(MethodData::profile_arguments() || MethodData::profile_return(), "should be collecting args profile");
803 if (profile_arguments_for_invoke(stream->method(), stream->bci()) ||
1031 case Bytecodes::_ifgt:
1032 case Bytecodes::_ifle:
1033 case Bytecodes::_if_icmpeq:
1034 case Bytecodes::_if_icmpne:
1035 case Bytecodes::_if_icmplt:
1036 case Bytecodes::_if_icmpge:
1037 case Bytecodes::_if_icmpgt:
1038 case Bytecodes::_if_icmple:
1039 case Bytecodes::_if_acmpeq:
1040 case Bytecodes::_if_acmpne:
1041 case Bytecodes::_ifnull:
1042 case Bytecodes::_ifnonnull:
1043 cell_count = BranchData::static_cell_count();
1044 tag = DataLayout::branch_data_tag;
1045 break;
1046 case Bytecodes::_lookupswitch:
1047 case Bytecodes::_tableswitch:
1048 cell_count = MultiBranchData::compute_cell_count(stream);
1049 tag = DataLayout::multi_branch_data_tag;
1050 break;
1051 default:
1052 break;
1053 }
1054 assert(tag == DataLayout::multi_branch_data_tag ||
1055 ((MethodData::profile_arguments() || MethodData::profile_return()) &&
1056 (tag == DataLayout::call_type_data_tag ||
1057 tag == DataLayout::counter_data_tag ||
1058 tag == DataLayout::virtual_call_type_data_tag ||
1059 tag == DataLayout::virtual_call_data_tag)) ||
1060 cell_count == bytecode_cell_count(c), "cell counts must agree");
1061 if (cell_count >= 0) {
1062 assert(tag != DataLayout::no_tag, "bad tag");
1063 assert(bytecode_has_profile(c), "agree w/ BHP");
1064 data_layout->initialize(tag, stream->bci(), cell_count);
1065 return DataLayout::compute_size_in_bytes(cell_count);
1066 } else {
1067 assert(!bytecode_has_profile(c), "agree w/ !BHP");
1068 return 0;
1069 }
1070 }
1071
1072 // Get the data at an arbitrary (sort of) data index.
|