changeset 6:0e269e2d5a9c

Fix the bug of object allocation. After fixing this bug, the verification in the debug version is correct at the end of the program running.
author Cai Songsong <caisongsong@loongson.cn>
date Sat, 09 Oct 2010 18:06:39 +0800
parents 4c7a7a2a3caa
children 3053c0d361b6
files hotspot/src/cpu/mips/vm/c1_Runtime1_mips.cpp hotspot/src/cpu/mips/vm/templateTable_mips.cpp
diffstat 2 files changed, 4 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/hotspot/src/cpu/mips/vm/c1_Runtime1_mips.cpp	Sat Oct 09 17:52:56 2010 +0800
+++ b/hotspot/src/cpu/mips/vm/c1_Runtime1_mips.cpp	Sat Oct 09 18:06:39 2010 +0800
@@ -932,7 +932,6 @@
           
           // get the instance size
           __ lw(obj_size, klass, klassOopDesc::header_size() * HeapWordSize + Klass::layout_helper_offset_in_bytes());
-          __ sll(obj_size, obj_size, LogHeapWordSize);
           __ tlab_allocate(obj, obj_size, 0, t1, t2, slow_path);
           __ initialize_object(obj, klass, obj_size, 0, t1, t2);
           __ verify_oop(obj);
@@ -943,7 +942,6 @@
 
           // get the instance size  
           __ lw(obj_size, klass, klassOopDesc::header_size() * HeapWordSize + Klass::layout_helper_offset_in_bytes());
-          __ sll(obj_size, obj_size, LogHeapWordSize);
           __ eden_allocate(obj, obj_size, 0, t1, t2, slow_path);
           __ initialize_object(obj, klass, obj_size, 0, t1, t2);
           __ verify_oop(obj);
--- a/hotspot/src/cpu/mips/vm/templateTable_mips.cpp	Sat Oct 09 17:52:56 2010 +0800
+++ b/hotspot/src/cpu/mips/vm/templateTable_mips.cpp	Sat Oct 09 18:06:39 2010 +0800
@@ -4279,8 +4279,7 @@
 #endif
 		// get tlab_top
 		__ lw(FSR, thread, in_bytes(JavaThread::tlab_top_offset()));
-		__ sll(AT, T4, 2);
-		__ add(T2, FSR, AT);
+		__ add(T2, FSR, T4);
 		// get tlab_end
 		__ lw(AT, thread, in_bytes(JavaThread::tlab_end_offset()));
 		__ slt(AT, AT, T2);
@@ -4318,8 +4317,7 @@
 
 		__ lw(FSR, heap_top);
 		__ bind(retry);
-		__ sll(AT, T4, 2);
-		__ add(T2, FSR, AT);
+		__ add(T2, FSR, T4);
 		__ lui(AT, Assembler::split_high((int)Universe::heap()->end_addr()));
 		__ lw(AT, AT, Assembler::split_low((int)Universe::heap()->end_addr()));
 		__ slt(AT, AT, T2);
@@ -4345,7 +4343,7 @@
 		// The object is initialized before the header.  If the object size is
 		// zero, go directly to the header initialization.
 		__ bind(initialize_object);
-		__ addiu(T4, T4, - sizeof(oopDesc) / oopSize);
+		__ addiu(T4, T4, - sizeof(oopDesc));
 		__ beq(T4, ZERO, initialize_header);
 		__ delayed()->nop();
 
@@ -4362,12 +4360,10 @@
 		// edx must be > 0, no extra check needed here
 #endif
 
-		__ shr(T4, 1);
 		// initialize remaining object fields: T4 is a multiple of 2
 		{ 
 			Label loop;
-			__ sll(T1, T4, 3);
-			__ add(T1, FSR, T1);
+			__ add(T1, FSR, T4);
 			__ addi(T1, T1, -8);
 
 			__ bind(loop);