< prev index next >

src/hotspot/cpu/ppc/interp_masm_ppc_64.cpp

Print this page
rev 55858 : 8228649: [PPC64] SA reads wrong slots from interpreter frames
Summary: Make frame layout consistent between dbg and product build and implement offsets accordingly.
Reviewed-by: goetz, gromero


 751       unlock_object(Rmonitor_addr);
 752       if (install_monitor_exception) {
 753         call_VM(noreg, CAST_FROM_FN_PTR(address, InterpreterRuntime::new_illegal_monitor_state_exception));
 754       }
 755       b(Lrestart);
 756     }
 757   }
 758 
 759   align(32, 12);
 760   bind(Lno_unlock);
 761   pop(state);
 762 }
 763 
 764 // Support function for remove_activation & Co.
 765 void InterpreterMacroAssembler::merge_frames(Register Rsender_sp, Register return_pc,
 766                                              Register Rscratch1, Register Rscratch2) {
 767   // Pop interpreter frame.
 768   ld(Rscratch1, 0, R1_SP); // *SP
 769   ld(Rsender_sp, _ijava_state_neg(sender_sp), Rscratch1); // top_frame_sp
 770   ld(Rscratch2, 0, Rscratch1); // **SP
 771 #ifdef ASSERT
 772   {
 773     Label Lok;
 774     ld(R0, _ijava_state_neg(ijava_reserved), Rscratch1);
 775     cmpdi(CCR0, R0, 0x5afe);
 776     beq(CCR0, Lok);
 777     stop("frame corrupted (remove activation)", 0x5afe);
 778     bind(Lok);
 779   }
 780 #endif
 781   if (return_pc!=noreg) {
 782     ld(return_pc, _abi(lr), Rscratch1); // LR
 783   }
 784 
 785   // Merge top frames.
 786   subf(Rscratch1, R1_SP, Rsender_sp); // top_frame_sp - SP
 787   stdux(Rscratch2, R1_SP, Rscratch1); // atomically set *(SP = top_frame_sp) = **SP
 788 }
 789 
 790 void InterpreterMacroAssembler::narrow(Register result) {
 791   Register ret_type = R11_scratch1;
 792   ld(R11_scratch1, in_bytes(Method::const_offset()), R19_method);
 793   lbz(ret_type, in_bytes(ConstMethod::result_type_offset()), R11_scratch1);
 794 
 795   Label notBool, notByte, notChar, done;
 796 
 797   // common case first
 798   cmpwi(CCR0, ret_type, T_INT);
 799   beq(CCR0, done);
 800 


2244 void InterpreterMacroAssembler::restore_interpreter_state(Register scratch, bool bcp_and_mdx_only) {
2245   ld(scratch, 0, R1_SP);
2246   ld(R14_bcp, _ijava_state_neg(bcp), scratch); // Changed by VM code (exception).
2247   if (ProfileInterpreter) { ld(R28_mdx, _ijava_state_neg(mdx), scratch); } // Changed by VM code.
2248   if (!bcp_and_mdx_only) {
2249     // Following ones are Metadata.
2250     ld(R19_method, _ijava_state_neg(method), scratch);
2251     ld(R27_constPoolCache, _ijava_state_neg(cpoolCache), scratch);
2252     // Following ones are stack addresses and don't require reload.
2253     ld(R15_esp, _ijava_state_neg(esp), scratch);
2254     ld(R18_locals, _ijava_state_neg(locals), scratch);
2255     ld(R26_monitor, _ijava_state_neg(monitors), scratch);
2256   }
2257 #ifdef ASSERT
2258   {
2259     Label Lok;
2260     subf(R0, R1_SP, scratch);
2261     cmpdi(CCR0, R0, frame::abi_reg_args_size + frame::ijava_state_size);
2262     bge(CCR0, Lok);
2263     stop("frame too small (restore istate)", 0x5432);
2264     bind(Lok);
2265   }
2266   {
2267     Label Lok;
2268     ld(R0, _ijava_state_neg(ijava_reserved), scratch);
2269     cmpdi(CCR0, R0, 0x5afe);
2270     beq(CCR0, Lok);
2271     stop("frame corrupted (restore istate)", 0x5afe);
2272     bind(Lok);
2273   }
2274 #endif
2275 }
2276 
2277 void InterpreterMacroAssembler::get_method_counters(Register method,
2278                                                     Register Rcounters,
2279                                                     Label& skip) {
2280   BLOCK_COMMENT("Load and ev. allocate counter object {");
2281   Label has_counters;
2282   ld(Rcounters, in_bytes(Method::method_counters_offset()), method);
2283   cmpdi(CCR0, Rcounters, 0);
2284   bne(CCR0, has_counters);
2285   call_VM(noreg, CAST_FROM_FN_PTR(address,
2286                                   InterpreterRuntime::build_method_counters), method, false);
2287   ld(Rcounters, in_bytes(Method::method_counters_offset()), method);
2288   cmpdi(CCR0, Rcounters, 0);
2289   beq(CCR0, skip); // No MethodCounters, OutOfMemory.
2290   BLOCK_COMMENT("} Load and ev. allocate counter object");
2291 




 751       unlock_object(Rmonitor_addr);
 752       if (install_monitor_exception) {
 753         call_VM(noreg, CAST_FROM_FN_PTR(address, InterpreterRuntime::new_illegal_monitor_state_exception));
 754       }
 755       b(Lrestart);
 756     }
 757   }
 758 
 759   align(32, 12);
 760   bind(Lno_unlock);
 761   pop(state);
 762 }
 763 
 764 // Support function for remove_activation & Co.
 765 void InterpreterMacroAssembler::merge_frames(Register Rsender_sp, Register return_pc,
 766                                              Register Rscratch1, Register Rscratch2) {
 767   // Pop interpreter frame.
 768   ld(Rscratch1, 0, R1_SP); // *SP
 769   ld(Rsender_sp, _ijava_state_neg(sender_sp), Rscratch1); // top_frame_sp
 770   ld(Rscratch2, 0, Rscratch1); // **SP










 771   if (return_pc!=noreg) {
 772     ld(return_pc, _abi(lr), Rscratch1); // LR
 773   }
 774 
 775   // Merge top frames.
 776   subf(Rscratch1, R1_SP, Rsender_sp); // top_frame_sp - SP
 777   stdux(Rscratch2, R1_SP, Rscratch1); // atomically set *(SP = top_frame_sp) = **SP
 778 }
 779 
 780 void InterpreterMacroAssembler::narrow(Register result) {
 781   Register ret_type = R11_scratch1;
 782   ld(R11_scratch1, in_bytes(Method::const_offset()), R19_method);
 783   lbz(ret_type, in_bytes(ConstMethod::result_type_offset()), R11_scratch1);
 784 
 785   Label notBool, notByte, notChar, done;
 786 
 787   // common case first
 788   cmpwi(CCR0, ret_type, T_INT);
 789   beq(CCR0, done);
 790 


2234 void InterpreterMacroAssembler::restore_interpreter_state(Register scratch, bool bcp_and_mdx_only) {
2235   ld(scratch, 0, R1_SP);
2236   ld(R14_bcp, _ijava_state_neg(bcp), scratch); // Changed by VM code (exception).
2237   if (ProfileInterpreter) { ld(R28_mdx, _ijava_state_neg(mdx), scratch); } // Changed by VM code.
2238   if (!bcp_and_mdx_only) {
2239     // Following ones are Metadata.
2240     ld(R19_method, _ijava_state_neg(method), scratch);
2241     ld(R27_constPoolCache, _ijava_state_neg(cpoolCache), scratch);
2242     // Following ones are stack addresses and don't require reload.
2243     ld(R15_esp, _ijava_state_neg(esp), scratch);
2244     ld(R18_locals, _ijava_state_neg(locals), scratch);
2245     ld(R26_monitor, _ijava_state_neg(monitors), scratch);
2246   }
2247 #ifdef ASSERT
2248   {
2249     Label Lok;
2250     subf(R0, R1_SP, scratch);
2251     cmpdi(CCR0, R0, frame::abi_reg_args_size + frame::ijava_state_size);
2252     bge(CCR0, Lok);
2253     stop("frame too small (restore istate)", 0x5432);








2254     bind(Lok);
2255   }
2256 #endif
2257 }
2258 
2259 void InterpreterMacroAssembler::get_method_counters(Register method,
2260                                                     Register Rcounters,
2261                                                     Label& skip) {
2262   BLOCK_COMMENT("Load and ev. allocate counter object {");
2263   Label has_counters;
2264   ld(Rcounters, in_bytes(Method::method_counters_offset()), method);
2265   cmpdi(CCR0, Rcounters, 0);
2266   bne(CCR0, has_counters);
2267   call_VM(noreg, CAST_FROM_FN_PTR(address,
2268                                   InterpreterRuntime::build_method_counters), method, false);
2269   ld(Rcounters, in_bytes(Method::method_counters_offset()), method);
2270   cmpdi(CCR0, Rcounters, 0);
2271   beq(CCR0, skip); // No MethodCounters, OutOfMemory.
2272   BLOCK_COMMENT("} Load and ev. allocate counter object");
2273 


< prev index next >