src/cpu/x86/vm/interp_masm_x86_32.cpp
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File hotspot Sdiff src/cpu/x86/vm

src/cpu/x86/vm/interp_masm_x86_32.cpp

Print this page
rev 5240 : 8023657: New type profiling points: arguments to call
Summary: x86 interpreter and c1 type profiling for arguments at calls
Reviewed-by:


1029   }
1030 }
1031 
1032 
1033 void InterpreterMacroAssembler::profile_not_taken_branch(Register mdp) {
1034   if (ProfileInterpreter) {
1035     Label profile_continue;
1036 
1037     // If no method data exists, go to profile_continue.
1038     test_method_data_pointer(mdp, profile_continue);
1039 
1040     // We are taking a branch.  Increment the not taken count.
1041     increment_mdp_data_at(mdp, in_bytes(BranchData::not_taken_offset()));
1042 
1043     // The method data pointer needs to be updated to correspond to the next bytecode
1044     update_mdp_by_constant(mdp, in_bytes(BranchData::branch_data_size()));
1045     bind (profile_continue);
1046   }
1047 }
1048 




























































































1049 
1050 void InterpreterMacroAssembler::profile_call(Register mdp) {
1051   if (ProfileInterpreter) {
1052     Label profile_continue;
1053 
1054     // If no method data exists, go to profile_continue.
1055     test_method_data_pointer(mdp, profile_continue);
1056 
1057     // We are making a call.  Increment the count.
1058     increment_mdp_data_at(mdp, in_bytes(CounterData::count_offset()));
1059 
1060     // The method data pointer needs to be updated to reflect the new target.
1061     update_mdp_by_constant(mdp, in_bytes(CounterData::counter_data_size()));
1062     bind (profile_continue);
1063   }
1064 }
1065 
1066 
1067 void InterpreterMacroAssembler::profile_final_call(Register mdp) {
1068   if (ProfileInterpreter) {




1029   }
1030 }
1031 
1032 
1033 void InterpreterMacroAssembler::profile_not_taken_branch(Register mdp) {
1034   if (ProfileInterpreter) {
1035     Label profile_continue;
1036 
1037     // If no method data exists, go to profile_continue.
1038     test_method_data_pointer(mdp, profile_continue);
1039 
1040     // We are taking a branch.  Increment the not taken count.
1041     increment_mdp_data_at(mdp, in_bytes(BranchData::not_taken_offset()));
1042 
1043     // The method data pointer needs to be updated to correspond to the next bytecode
1044     update_mdp_by_constant(mdp, in_bytes(BranchData::branch_data_size()));
1045     bind (profile_continue);
1046   }
1047 }
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 }
1141 
1142 void InterpreterMacroAssembler::profile_call(Register mdp) {
1143   if (ProfileInterpreter) {
1144     Label profile_continue;
1145 
1146     // If no method data exists, go to profile_continue.
1147     test_method_data_pointer(mdp, profile_continue);
1148 
1149     // We are making a call.  Increment the count.
1150     increment_mdp_data_at(mdp, in_bytes(CounterData::count_offset()));
1151 
1152     // The method data pointer needs to be updated to reflect the new target.
1153     update_mdp_by_constant(mdp, in_bytes(CounterData::counter_data_size()));
1154     bind (profile_continue);
1155   }
1156 }
1157 
1158 
1159 void InterpreterMacroAssembler::profile_final_call(Register mdp) {
1160   if (ProfileInterpreter) {


src/cpu/x86/vm/interp_masm_x86_32.cpp
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File