Mercurial > hg > graal-jvmci-8
comparison src/cpu/x86/vm/interp_masm_x86_32.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 |
---|---|
1044 update_mdp_by_constant(mdp, in_bytes(BranchData::branch_data_size())); | 1044 update_mdp_by_constant(mdp, in_bytes(BranchData::branch_data_size())); |
1045 bind (profile_continue); | 1045 bind (profile_continue); |
1046 } | 1046 } |
1047 } | 1047 } |
1048 | 1048 |
1049 void InterpreterMacroAssembler::profile_obj_type(Register obj, const Address& mdo_addr) { | |
1050 Label update, next, none; | |
1051 | |
1052 verify_oop(obj); | |
1053 | |
1054 testptr(obj, obj); | |
1055 jccb(Assembler::notZero, update); | |
1056 orptr(mdo_addr, TypeEntries::null_seen); | |
1057 jmpb(next); | |
1058 | |
1059 bind(update); | |
1060 load_klass(obj, obj); | |
1061 | |
1062 xorptr(obj, mdo_addr); | |
1063 testptr(obj, TypeEntries::type_klass_mask); | |
1064 jccb(Assembler::zero, next); // klass seen before, nothing to | |
1065 // do. The unknown bit may have been | |
1066 // set already but no need to check. | |
1067 | |
1068 testptr(obj, TypeEntries::type_unknown); | |
1069 jccb(Assembler::notZero, next); // already unknown. Nothing to do anymore. | |
1070 | |
1071 cmpptr(mdo_addr, 0); | |
1072 jccb(Assembler::equal, none); | |
1073 cmpptr(mdo_addr, TypeEntries::null_seen); | |
1074 jccb(Assembler::equal, none); | |
1075 // There is a chance that the checks above (re-reading profiling | |
1076 // data from memory) fail if another thread has just set the | |
1077 // profiling to this obj's klass | |
1078 xorptr(obj, mdo_addr); | |
1079 testptr(obj, TypeEntries::type_klass_mask); | |
1080 jccb(Assembler::zero, next); | |
1081 | |
1082 // different than before. Cannot keep accurate profile. | |
1083 orptr(mdo_addr, TypeEntries::type_unknown); | |
1084 jmpb(next); | |
1085 | |
1086 bind(none); | |
1087 // first time here. Set profile type. | |
1088 movptr(mdo_addr, obj); | |
1089 | |
1090 bind(next); | |
1091 } | |
1092 | |
1093 void InterpreterMacroAssembler::profile_arguments_type(Register mdp, Register callee, Register tmp, bool is_virtual) { | |
1094 if (!ProfileInterpreter) { | |
1095 return; | |
1096 } | |
1097 | |
1098 if (MethodData::profile_arguments()) { | |
1099 Label profile_continue; | |
1100 | |
1101 test_method_data_pointer(mdp, profile_continue); | |
1102 | |
1103 int off_to_start = is_virtual ? in_bytes(VirtualCallData::virtual_call_data_size()) : in_bytes(CounterData::counter_data_size()); | |
1104 | |
1105 cmpb(Address(mdp, in_bytes(DataLayout::tag_offset()) - off_to_start), is_virtual ? DataLayout::virtual_call_type_data_tag : DataLayout::call_type_data_tag); | |
1106 jcc(Assembler::notEqual, profile_continue); | |
1107 | |
1108 Label done; | |
1109 int off_to_args = in_bytes(TypeStackSlotEntries::args_data_offset()); | |
1110 addptr(mdp, off_to_args); | |
1111 | |
1112 for (int i = 0; i < TypeProfileArgsLimit; i++) { | |
1113 if (i > 0) { | |
1114 movl(tmp, Address(mdp, in_bytes(TypeStackSlotEntries::cell_count_offset())-off_to_args)); | |
1115 subl(tmp, i*TypeStackSlotEntries::per_arg_count()); | |
1116 cmpl(tmp, TypeStackSlotEntries::per_arg_count()); | |
1117 jcc(Assembler::less, done); | |
1118 } | |
1119 movptr(tmp, Address(callee, Method::const_offset())); | |
1120 load_unsigned_short(tmp, Address(tmp, ConstMethod::size_of_parameters_offset())); | |
1121 subl(tmp, Address(mdp, in_bytes(TypeStackSlotEntries::stack_slot_offset(i))-off_to_args)); | |
1122 subl(tmp, 1); | |
1123 Address arg_addr = argument_address(tmp); | |
1124 movptr(tmp, arg_addr); | |
1125 | |
1126 Address mdo_arg_addr(mdp, in_bytes(TypeStackSlotEntries::type_offset(i))-off_to_args); | |
1127 profile_obj_type(tmp, mdo_arg_addr); | |
1128 | |
1129 int to_add = in_bytes(TypeStackSlotEntries::per_arg_size()); | |
1130 addptr(mdp, to_add); | |
1131 off_to_args += to_add; | |
1132 } | |
1133 | |
1134 bind(done); | |
1135 | |
1136 movptr(Address(rbp, frame::interpreter_frame_mdx_offset * wordSize), mdp); | |
1137 | |
1138 bind(profile_continue); | |
1139 } | |
1140 } | |
1049 | 1141 |
1050 void InterpreterMacroAssembler::profile_call(Register mdp) { | 1142 void InterpreterMacroAssembler::profile_call(Register mdp) { |
1051 if (ProfileInterpreter) { | 1143 if (ProfileInterpreter) { |
1052 Label profile_continue; | 1144 Label profile_continue; |
1053 | 1145 |