comparison src/cpu/x86/vm/interp_masm_x86_64.cpp @ 12875:d13d7aba8c12

8023657: New type profiling points: arguments to call Summary: x86 interpreter and c1 type profiling for arguments at calls Reviewed-by: kvn, twisti
author roland
date Wed, 09 Oct 2013 16:32:21 +0200
parents aeaca88565e6
children ce0cc25bc5e2
comparison
equal deleted inserted replaced
12874:46ef27bcacb3 12875:d13d7aba8c12
1065 update_mdp_by_constant(mdp, in_bytes(BranchData::branch_data_size())); 1065 update_mdp_by_constant(mdp, in_bytes(BranchData::branch_data_size()));
1066 bind(profile_continue); 1066 bind(profile_continue);
1067 } 1067 }
1068 } 1068 }
1069 1069
1070 void InterpreterMacroAssembler::profile_obj_type(Register obj, const Address& mdo_addr) {
1071 Label update, next, none;
1072
1073 verify_oop(obj);
1074
1075 testptr(obj, obj);
1076 jccb(Assembler::notZero, update);
1077 orptr(mdo_addr, TypeEntries::null_seen);
1078 jmpb(next);
1079
1080 bind(update);
1081 load_klass(obj, obj);
1082
1083 xorptr(obj, mdo_addr);
1084 testptr(obj, TypeEntries::type_klass_mask);
1085 jccb(Assembler::zero, next); // klass seen before, nothing to
1086 // do. The unknown bit may have been
1087 // set already but no need to check.
1088
1089 testptr(obj, TypeEntries::type_unknown);
1090 jccb(Assembler::notZero, next); // already unknown. Nothing to do anymore.
1091
1092 // There is a chance that by the time we do these checks (re-reading
1093 // profiling data from memory) another thread has set the profling
1094 // to this obj's klass and we set the profiling as unknow
1095 // erroneously
1096 cmpptr(mdo_addr, 0);
1097 jccb(Assembler::equal, none);
1098 cmpptr(mdo_addr, TypeEntries::null_seen);
1099 jccb(Assembler::equal, none);
1100 // There is a chance that the checks above (re-reading profiling
1101 // data from memory) fail if another thread has just set the
1102 // profiling to this obj's klass
1103 xorptr(obj, mdo_addr);
1104 testptr(obj, TypeEntries::type_klass_mask);
1105 jccb(Assembler::zero, next);
1106
1107 // different than before. Cannot keep accurate profile.
1108 orptr(mdo_addr, TypeEntries::type_unknown);
1109 jmpb(next);
1110
1111 bind(none);
1112 // first time here. Set profile type.
1113 movptr(mdo_addr, obj);
1114
1115 bind(next);
1116 }
1117
1118 void InterpreterMacroAssembler::profile_arguments_type(Register mdp, Register callee, Register tmp, bool is_virtual) {
1119 if (!ProfileInterpreter) {
1120 return;
1121 }
1122
1123 if (MethodData::profile_arguments()) {
1124 Label profile_continue;
1125
1126 test_method_data_pointer(mdp, profile_continue);
1127
1128 int off_to_start = is_virtual ? in_bytes(VirtualCallData::virtual_call_data_size()) : in_bytes(CounterData::counter_data_size());
1129
1130 cmpb(Address(mdp, in_bytes(DataLayout::tag_offset()) - off_to_start), is_virtual ? DataLayout::virtual_call_type_data_tag : DataLayout::call_type_data_tag);
1131 jcc(Assembler::notEqual, profile_continue);
1132
1133 Label done;
1134 int off_to_args = in_bytes(TypeStackSlotEntries::args_data_offset());
1135 addptr(mdp, off_to_args);
1136
1137 for (int i = 0; i < TypeProfileArgsLimit; i++) {
1138 if (i > 0) {
1139 movq(tmp, Address(mdp, in_bytes(TypeStackSlotEntries::cell_count_offset())-off_to_args));
1140 subl(tmp, i*TypeStackSlotEntries::per_arg_count());
1141 cmpl(tmp, TypeStackSlotEntries::per_arg_count());
1142 jcc(Assembler::less, done);
1143 }
1144 movptr(tmp, Address(callee, Method::const_offset()));
1145 load_unsigned_short(tmp, Address(tmp, ConstMethod::size_of_parameters_offset()));
1146 subq(tmp, Address(mdp, in_bytes(TypeStackSlotEntries::stack_slot_offset(i))-off_to_args));
1147 subl(tmp, 1);
1148 Address arg_addr = argument_address(tmp);
1149 movptr(tmp, arg_addr);
1150
1151 Address mdo_arg_addr(mdp, in_bytes(TypeStackSlotEntries::type_offset(i))-off_to_args);
1152 profile_obj_type(tmp, mdo_arg_addr);
1153
1154 int to_add = in_bytes(TypeStackSlotEntries::per_arg_size());
1155 addptr(mdp, to_add);
1156 off_to_args += to_add;
1157 }
1158
1159 bind(done);
1160
1161 movptr(Address(rbp, frame::interpreter_frame_mdx_offset * wordSize), mdp);
1162
1163 bind(profile_continue);
1164 }
1165 }
1070 1166
1071 void InterpreterMacroAssembler::profile_call(Register mdp) { 1167 void InterpreterMacroAssembler::profile_call(Register mdp) {
1072 if (ProfileInterpreter) { 1168 if (ProfileInterpreter) {
1073 Label profile_continue; 1169 Label profile_continue;
1074 1170