changeset 25:8ef762f87d0e

Fix bug related to the unsafe ops.
author YANG Yongqiang <yangyongqiang@loongson.cn>
date Mon, 08 Nov 2010 19:53:05 +0800
parents da31f361800f
children 82bf91673f25
files hotspot/src/cpu/mips/vm/c1_LIRAssembler_mips.cpp hotspot/src/cpu/mips/vm/c1_LIRGenerator_mips.cpp
diffstat 2 files changed, 17 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
--- a/hotspot/src/cpu/mips/vm/c1_LIRAssembler_mips.cpp	Fri Nov 05 17:36:30 2010 +0800
+++ b/hotspot/src/cpu/mips/vm/c1_LIRAssembler_mips.cpp	Mon Nov 08 19:53:05 2010 +0800
@@ -2371,6 +2371,7 @@
     Register array = op->array()->as_register();
     Register k_RInfo = op->tmp1()->as_register();
     Register klass_RInfo = op->tmp2()->as_register();
+    Register tmp = op->tmp3()->as_register();
 
     CodeStub* stub = op->stub();
     Label done;
@@ -2387,27 +2388,29 @@
   //for SIGBUS, FIXME, Jerome 
     __ nop(); 
     __ nop(); 
-    __ lw(T9, k_RInfo, sizeof(oopDesc) + Klass::super_check_offset_offset_in_bytes());
+    __ lw(tmp, k_RInfo, sizeof(oopDesc) + Klass::super_check_offset_offset_in_bytes());
 
     // See if we get an immediate positive hit
-    __ add(AT, klass_RInfo, T9);
+    __ add(AT, klass_RInfo, tmp);
+
     __ lw(AT, AT, 0);
     __ beq(k_RInfo, AT, done);
     __ delayed()->nop();
 
     // check for immediate negative hit
     __ move(AT, sizeof(oopDesc) + Klass::secondary_super_cache_offset_in_bytes());
-    __ bne(T9, AT, *stub->entry());     // fail
+    __ bne(tmp, AT, *stub->entry());     // fail
     __ delayed()->nop();
 
     // check for self
     __ beq(klass_RInfo, k_RInfo, done);
     __ delayed()->nop();
 
+    __ push(T8);
     // super type array
     __ lw(T8, klass_RInfo, sizeof(oopDesc) + Klass::secondary_supers_offset_in_bytes());
     // length
-    __ lw(T9, T8, arrayOopDesc::length_offset_in_bytes());
+    __ lw(tmp, T8, arrayOopDesc::length_offset_in_bytes());
 
     // base
     __ addi(T8, T8, arrayOopDesc::base_offset_in_bytes(T_OBJECT));
@@ -2415,22 +2418,24 @@
     Label miss, hit, loop;
     // T9:count, T8:base, k_RInfo: super klass
     __ bind(loop);
-    __ beq(T9, ZERO, miss);
+    __ beq(tmp, ZERO, miss);
     __ delayed()->lw(AT, T8, 0);
     __ beq(AT, k_RInfo, hit);
     __ delayed();
-    __ addiu(T9, T9, -1);
+    __ addiu(tmp, tmp, -1);
     __ b(loop);
     __ delayed();
     __ addi(T8, T8, 1 * wordSize);
 
     __ bind(miss);
+    __ pop(T8);
     __ b(*stub->entry());
     __ delayed()->nop();
 
     __ bind(hit);
     __ sw(k_RInfo, klass_RInfo, sizeof(oopDesc) 
         + Klass::secondary_super_cache_offset_in_bytes());
+    __ pop(T8);
 
     __ bind(done);
 	} else if (op->code() == lir_checkcast) {
--- a/hotspot/src/cpu/mips/vm/c1_LIRGenerator_mips.cpp	Fri Nov 05 17:36:30 2010 +0800
+++ b/hotspot/src/cpu/mips/vm/c1_LIRGenerator_mips.cpp	Mon Nov 08 19:53:05 2010 +0800
@@ -1269,9 +1269,9 @@
 
 void LIRGenerator::get_Object_unsafe(LIR_Opr dst, LIR_Opr src, LIR_Opr offset,
 		BasicType type, bool is_volatile) {
-	__ add(src, src, offset);
+	__ add(src, offset, offset);
 	if (is_volatile && type == T_LONG) {
-		LIR_Address* addr = new LIR_Address(src, 0, T_DOUBLE);
+		LIR_Address* addr = new LIR_Address(offset, 0, T_DOUBLE);
 		LIR_Opr tmp = new_register(T_DOUBLE);
 		__ load(addr, tmp);
 		LIR_Opr spill = new_register(T_LONG);
@@ -1279,7 +1279,7 @@
 		__ move(tmp, spill);
 		__ move(spill, dst);
 	} else {
-		LIR_Address* addr = new LIR_Address(src, 0, type);
+		LIR_Address* addr = new LIR_Address(offset, 0, type);
 		__ load(addr, dst);
 	}
 }
@@ -1287,9 +1287,9 @@
 
 void LIRGenerator::put_Object_unsafe(LIR_Opr src, LIR_Opr offset, LIR_Opr data,
 		BasicType type, bool is_volatile) {
-	__ add(src, src, offset);
+	__ add(src, offset, offset);
 	if (is_volatile && type == T_LONG) {
-		LIR_Address* addr = new LIR_Address(src, 0, T_DOUBLE);
+		LIR_Address* addr = new LIR_Address(offset, 0, T_DOUBLE);
 		LIR_Opr tmp = new_register(T_DOUBLE);
 		LIR_Opr spill = new_register(T_DOUBLE);
 		set_vreg_flag(spill, must_start_in_memory);
@@ -1298,7 +1298,7 @@
 		__ move(tmp, addr);
 
 	} else {
-		LIR_Address* addr = new LIR_Address(src, 0, type);
+		LIR_Address* addr = new LIR_Address(offset, 0, type);
 		bool is_obj = (type == T_ARRAY || type == T_OBJECT);
 		if (is_obj) {
 			// Do the pre-write barrier, if any.