diff 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
line wrap: on
line diff
--- a/src/cpu/sparc/vm/sharedRuntime_sparc.cpp	Tue Oct 06 02:11:49 2009 -0700
+++ b/src/cpu/sparc/vm/sharedRuntime_sparc.cpp	Tue Oct 06 10:15:38 2009 -0700
@@ -107,7 +107,7 @@
   // are saved in register windows - I's and L's in the caller's frame and O's in the stub frame
   // (as the stub's I's) when the runtime routine called by the stub creates its frame.
   int i;
-  // Always make the frame size 16 bytr aligned.
+  // Always make the frame size 16 byte aligned.
   int frame_size = round_to(additional_frame_words + register_save_size, 16);
   // OopMap frame size is in c2 stack slots (sizeof(jint)) not bytes or words
   int frame_size_in_slots = frame_size / sizeof(jint);
@@ -201,15 +201,14 @@
   __ stx(G5, SP, ccr_offset+STACK_BIAS);
   __ stxfsr(SP, fsr_offset+STACK_BIAS);
 
-  // Save all the FP registers
+  // Save all the FP registers: 32 doubles (32 floats correspond to the 2 halves of the first 16 doubles)
   int offset = d00_offset;
-  for( int i=0; i<64; i+=2 ) {
+  for( int i=0; i<FloatRegisterImpl::number_of_registers; i+=2 ) {
     FloatRegister f = as_FloatRegister(i);
     __ stf(FloatRegisterImpl::D,  f, SP, offset+STACK_BIAS);
+    // Record as callee saved both halves of double registers (2 float registers).
     map->set_callee_saved(VMRegImpl::stack2reg(offset>>2), f->as_VMReg());
-    if (true) {
-      map->set_callee_saved(VMRegImpl::stack2reg((offset + sizeof(float))>>2), f->as_VMReg()->next());
-    }
+    map->set_callee_saved(VMRegImpl::stack2reg((offset + sizeof(float))>>2), f->as_VMReg()->next());
     offset += sizeof(double);
   }
 
@@ -224,7 +223,7 @@
 void RegisterSaver::restore_live_registers(MacroAssembler* masm) {
 
   // Restore all the FP registers
-  for( int i=0; i<64; i+=2 ) {
+  for( int i=0; i<FloatRegisterImpl::number_of_registers; i+=2 ) {
     __ ldf(FloatRegisterImpl::D, SP, d00_offset+i*sizeof(float)+STACK_BIAS, as_FloatRegister(i));
   }