comparison src/cpu/sparc/vm/sharedRuntime_sparc.cpp @ 1007:1ce3281a8e93

6880034: SIGBUS during deoptimisation at a safepoint on 64bit-SPARC Summary: Fix problem with the double register encodings in sparc.ad Reviewed-by: never, jrose Contributed-by: volker.simonis@gmail.com
author kvn
date Tue, 06 Oct 2009 10:15:38 -0700
parents dcf03e02b020
children 0a46d0c5dccb
comparison
equal deleted inserted replaced
1006:dcf03e02b020 1007:1ce3281a8e93
105 // propagated to the caller frame's RegisterMap during StackFrameStream construction (needed for 105 // propagated to the caller frame's RegisterMap during StackFrameStream construction (needed for
106 // deoptimization; see compiledVFrame::create_stack_value). The caller's I, L and O registers 106 // deoptimization; see compiledVFrame::create_stack_value). The caller's I, L and O registers
107 // are saved in register windows - I's and L's in the caller's frame and O's in the stub frame 107 // are saved in register windows - I's and L's in the caller's frame and O's in the stub frame
108 // (as the stub's I's) when the runtime routine called by the stub creates its frame. 108 // (as the stub's I's) when the runtime routine called by the stub creates its frame.
109 int i; 109 int i;
110 // Always make the frame size 16 bytr aligned. 110 // Always make the frame size 16 byte aligned.
111 int frame_size = round_to(additional_frame_words + register_save_size, 16); 111 int frame_size = round_to(additional_frame_words + register_save_size, 16);
112 // OopMap frame size is in c2 stack slots (sizeof(jint)) not bytes or words 112 // OopMap frame size is in c2 stack slots (sizeof(jint)) not bytes or words
113 int frame_size_in_slots = frame_size / sizeof(jint); 113 int frame_size_in_slots = frame_size / sizeof(jint);
114 // CodeBlob frame size is in words. 114 // CodeBlob frame size is in words.
115 *total_frame_words = frame_size / wordSize; 115 *total_frame_words = frame_size / wordSize;
199 // Save the flags 199 // Save the flags
200 __ rdccr( G5 ); 200 __ rdccr( G5 );
201 __ stx(G5, SP, ccr_offset+STACK_BIAS); 201 __ stx(G5, SP, ccr_offset+STACK_BIAS);
202 __ stxfsr(SP, fsr_offset+STACK_BIAS); 202 __ stxfsr(SP, fsr_offset+STACK_BIAS);
203 203
204 // Save all the FP registers 204 // Save all the FP registers: 32 doubles (32 floats correspond to the 2 halves of the first 16 doubles)
205 int offset = d00_offset; 205 int offset = d00_offset;
206 for( int i=0; i<64; i+=2 ) { 206 for( int i=0; i<FloatRegisterImpl::number_of_registers; i+=2 ) {
207 FloatRegister f = as_FloatRegister(i); 207 FloatRegister f = as_FloatRegister(i);
208 __ stf(FloatRegisterImpl::D, f, SP, offset+STACK_BIAS); 208 __ stf(FloatRegisterImpl::D, f, SP, offset+STACK_BIAS);
209 // Record as callee saved both halves of double registers (2 float registers).
209 map->set_callee_saved(VMRegImpl::stack2reg(offset>>2), f->as_VMReg()); 210 map->set_callee_saved(VMRegImpl::stack2reg(offset>>2), f->as_VMReg());
210 if (true) { 211 map->set_callee_saved(VMRegImpl::stack2reg((offset + sizeof(float))>>2), f->as_VMReg()->next());
211 map->set_callee_saved(VMRegImpl::stack2reg((offset + sizeof(float))>>2), f->as_VMReg()->next());
212 }
213 offset += sizeof(double); 212 offset += sizeof(double);
214 } 213 }
215 214
216 // And we're done. 215 // And we're done.
217 216
222 // Pop the current frame and restore all the registers that we 221 // Pop the current frame and restore all the registers that we
223 // saved. 222 // saved.
224 void RegisterSaver::restore_live_registers(MacroAssembler* masm) { 223 void RegisterSaver::restore_live_registers(MacroAssembler* masm) {
225 224
226 // Restore all the FP registers 225 // Restore all the FP registers
227 for( int i=0; i<64; i+=2 ) { 226 for( int i=0; i<FloatRegisterImpl::number_of_registers; i+=2 ) {
228 __ ldf(FloatRegisterImpl::D, SP, d00_offset+i*sizeof(float)+STACK_BIAS, as_FloatRegister(i)); 227 __ ldf(FloatRegisterImpl::D, SP, d00_offset+i*sizeof(float)+STACK_BIAS, as_FloatRegister(i));
229 } 228 }
230 229
231 __ ldx(SP, ccr_offset+STACK_BIAS, G1); 230 __ ldx(SP, ccr_offset+STACK_BIAS, G1);
232 __ wrccr (G1) ; 231 __ wrccr (G1) ;