changeset 24:da31f361800f

Fix a bug in the register allocator. In MIPS, float registers containing double-precision operands must be both adjacent physically and aligned. A single-precision operand takes up two float registers temporarily. Thus, one of them is wasted.
author YANG Yongqiang <yangyongqiang@loongson.cn>
date Fri, 05 Nov 2010 17:36:30 +0800
parents 388ae1bd0bdd
children 8ef762f87d0e
files hotspot/src/cpu/mips/vm/c1_LIRAssembler_mips.cpp hotspot/src/cpu/mips/vm/c1_LinearScan_mips.hpp hotspot/src/share/vm/runtime/reflection.cpp
diffstat 3 files changed, 67 insertions(+), 143 deletions(-) [+]
line wrap: on
line diff
--- a/hotspot/src/cpu/mips/vm/c1_LIRAssembler_mips.cpp	Thu Nov 04 11:15:53 2010 +0800
+++ b/hotspot/src/cpu/mips/vm/c1_LIRAssembler_mips.cpp	Fri Nov 05 17:36:30 2010 +0800
@@ -2367,72 +2367,72 @@
 void LIR_Assembler::emit_opTypeCheck(LIR_OpTypeCheck* op) {
 	LIR_Code code = op->code();
 	if (code == lir_store_check) {
-		Register value = op->object()->as_register();
-		Register array = op->array()->as_register();
-		Register k_RInfo = op->tmp1()->as_register();
-		Register klass_RInfo = op->tmp2()->as_register();
-
-		CodeStub* stub = op->stub();
-		Label done;
-
-		__ beq(value, ZERO, done);
-		__ delayed()->nop();
-		add_debug_info_for_null_check_here(op->info_for_exception());
-		
-		__ lw(k_RInfo, array, oopDesc::klass_offset_in_bytes());
-		__ lw(klass_RInfo, value, oopDesc::klass_offset_in_bytes());
-
-		__ lw(k_RInfo, k_RInfo,  objArrayKlass::element_klass_offset_in_bytes() + sizeof(oopDesc)); 
-		// get super_check_offset
-  	//for SIGBUS, FIXME, Jerome	
-		__ nop();	
-		__ nop();	
-		__ lw(T9, k_RInfo, sizeof(oopDesc) + Klass::super_check_offset_offset_in_bytes());
-
-		// See if we get an immediate positive hit
-		__ add(AT, klass_RInfo, T9);
-		__ 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
-		__ delayed()->nop();
-
-		// check for self
-		__ beq(klass_RInfo, k_RInfo, done);
-		__ delayed()->nop();
-
-		// super type array
-		__ lw(T8, klass_RInfo, sizeof(oopDesc) + Klass::secondary_supers_offset_in_bytes());
-		// length
-		__ lw(T9, T8, arrayOopDesc::length_offset_in_bytes());
-
-		// base
-		__ addi(T8, T8, arrayOopDesc::base_offset_in_bytes(T_OBJECT));
-
-		Label miss, hit, loop;
-		// T9:count, T8:base, k_RInfo: super klass
-		__ bind(loop);
-		__ beq(T9, ZERO, miss);
-		__ delayed()->lw(AT, T8, 0);
-		__ beq(AT, k_RInfo, hit);
-		__ delayed();
-		__ addiu(T9, T9, -1);
-		__ b(loop);
-		__ delayed();
-		__ addi(T8, T8, 1 * wordSize);
-
-		__ bind(miss);
-		__ b(*stub->entry());
-		__ delayed()->nop();
-
-		__ bind(hit);
-		__ sw(k_RInfo, klass_RInfo, sizeof(oopDesc) 
-				+ Klass::secondary_super_cache_offset_in_bytes());
-
-		__ bind(done);
+    Register value = op->object()->as_register();
+    Register array = op->array()->as_register();
+    Register k_RInfo = op->tmp1()->as_register();
+    Register klass_RInfo = op->tmp2()->as_register();
+
+    CodeStub* stub = op->stub();
+    Label done;
+
+    __ beq(value, ZERO, done);
+    __ delayed()->nop();
+    add_debug_info_for_null_check_here(op->info_for_exception());
+    
+    __ lw(k_RInfo, array, oopDesc::klass_offset_in_bytes());
+    __ lw(klass_RInfo, value, oopDesc::klass_offset_in_bytes());
+
+    __ lw(k_RInfo, k_RInfo,  objArrayKlass::element_klass_offset_in_bytes() + sizeof(oopDesc)); 
+    // get super_check_offset
+  //for SIGBUS, FIXME, Jerome 
+    __ nop(); 
+    __ nop(); 
+    __ lw(T9, k_RInfo, sizeof(oopDesc) + Klass::super_check_offset_offset_in_bytes());
+
+    // See if we get an immediate positive hit
+    __ add(AT, klass_RInfo, T9);
+    __ 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
+    __ delayed()->nop();
+
+    // check for self
+    __ beq(klass_RInfo, k_RInfo, done);
+    __ delayed()->nop();
+
+    // super type array
+    __ lw(T8, klass_RInfo, sizeof(oopDesc) + Klass::secondary_supers_offset_in_bytes());
+    // length
+    __ lw(T9, T8, arrayOopDesc::length_offset_in_bytes());
+
+    // base
+    __ addi(T8, T8, arrayOopDesc::base_offset_in_bytes(T_OBJECT));
+
+    Label miss, hit, loop;
+    // T9:count, T8:base, k_RInfo: super klass
+    __ bind(loop);
+    __ beq(T9, ZERO, miss);
+    __ delayed()->lw(AT, T8, 0);
+    __ beq(AT, k_RInfo, hit);
+    __ delayed();
+    __ addiu(T9, T9, -1);
+    __ b(loop);
+    __ delayed();
+    __ addi(T8, T8, 1 * wordSize);
+
+    __ bind(miss);
+    __ b(*stub->entry());
+    __ delayed()->nop();
+
+    __ bind(hit);
+    __ sw(k_RInfo, klass_RInfo, sizeof(oopDesc) 
+        + Klass::secondary_super_cache_offset_in_bytes());
+
+    __ bind(done);
 	} else if (op->code() == lir_checkcast) {
 		// we always need a stub for the failure case.
 		CodeStub* stub = op->stub();
--- a/hotspot/src/cpu/mips/vm/c1_LinearScan_mips.hpp	Thu Nov 04 11:15:53 2010 +0800
+++ b/hotspot/src/cpu/mips/vm/c1_LinearScan_mips.hpp	Fri Nov 05 17:36:30 2010 +0800
@@ -36,7 +36,7 @@
 
 
 inline bool LinearScan::requires_adjacent_regs(BasicType type) {
-	return false;
+	return type == T_FLOAT || type == T_DOUBLE;
 }
 
 inline bool LinearScan::is_caller_save(int assigned_reg) {
@@ -68,78 +68,3 @@
 	}
 	return false;
 }
-
-/*
-class FpuStackAllocator VALUE_OBJ_CLASS_SPEC {
- private:
-  Compilation* _compilation;
-  LinearScan* _allocator;
-
-  LIR_OpVisitState visitor;
-
-  LIR_List* _lir;
-  int _pos;
-  FpuStackSim _sim;
-  FpuStackSim _temp_sim;
-
-  bool _debug_information_computed;
-
-  LinearScan*   allocator()                      { return _allocator; }
-  Compilation*  compilation() const              { return _compilation; }
-
-  // unified bailout support
-  void          bailout(const char* msg) const   { compilation()->bailout(msg); }
-  bool          bailed_out() const               { return compilation()->bailed_out(); }
-
-  int pos() { return _pos; }
-  void set_pos(int pos) { _pos = pos; }
-  LIR_Op* cur_op() { return lir()->instructions_list()->at(pos()); }
-  LIR_List* lir() { return _lir; }
-  void set_lir(LIR_List* lir) { _lir = lir; }
-  FpuStackSim* sim() { return &_sim; }
-  FpuStackSim* temp_sim() { return &_temp_sim; }
-
-  int fpu_num(LIR_Opr opr);
-  int tos_offset(LIR_Opr opr);
-  LIR_Opr to_fpu_stack_top(LIR_Opr opr, bool dont_check_offset = false);
-
-  // Helper functions for handling operations
-  void insert_op(LIR_Op* op);
-  void insert_exchange(int offset);
-  void insert_exchange(LIR_Opr opr);
-  void insert_free(int offset);
-  void insert_free_if_dead(LIR_Opr opr);
-  void insert_free_if_dead(LIR_Opr opr, LIR_Opr ignore);
-  void insert_copy(LIR_Opr from, LIR_Opr to);
-  void do_rename(LIR_Opr from, LIR_Opr to);
-  void do_push(LIR_Opr opr);
-  void pop_if_last_use(LIR_Op* op, LIR_Opr opr);
-  void pop_always(LIR_Op* op, LIR_Opr opr);
-  void clear_fpu_stack(LIR_Opr preserve);
-  void handle_op1(LIR_Op1* op1);
-  void handle_op2(LIR_Op2* op2);
-  void handle_opCall(LIR_OpCall* opCall);
-  void compute_debug_information(LIR_Op* op);
-  void allocate_exception_handler(XHandler* xhandler);
-  void allocate_block(BlockBegin* block);
-
-#ifndef PRODUCT
-  void check_invalid_lir_op(LIR_Op* op);
-#endif
-
-  // Helper functions for merging of fpu stacks
-  void merge_insert_add(LIR_List* instrs, FpuStackSim* cur_sim, int reg);
-  void merge_insert_xchg(LIR_List* instrs, FpuStackSim* cur_sim, int slot);
-  void merge_insert_pop(LIR_List* instrs, FpuStackSim* cur_sim);
-  bool merge_rename(FpuStackSim* cur_sim, FpuStackSim* sux_sim, int start_slot, int change_slot);
-  void merge_fpu_stack(LIR_List* instrs, FpuStackSim* cur_sim, FpuStackSim* sux_sim);
-  void merge_cleanup_fpu_stack(LIR_List* instrs, FpuStackSim* cur_sim, BitMap& live_fpu_regs);
-  bool merge_fpu_stack_with_successors(BlockBegin* block);
-
- public:
-  LIR_Opr to_fpu_stack(LIR_Opr opr); // used by LinearScan for creation of debug information
-
-  FpuStackAllocator(Compilation* compilation, LinearScan* allocator);
-  void allocate();
-};
-*/
--- a/hotspot/src/share/vm/runtime/reflection.cpp	Thu Nov 04 11:15:53 2010 +0800
+++ b/hotspot/src/share/vm/runtime/reflection.cpp	Fri Nov 05 17:36:30 2010 +0800
@@ -862,7 +862,6 @@
       // resolve based on the receiver
       if (instanceKlass::cast(reflected_method->method_holder())->is_interface()) {
         // resolve interface call
-        tty->print_cr("resolve interface call");
         if (ReflectionWrapResolutionErrors) {
           // new default: 6531596
           // Match resolution errors with those thrown due to reflection inlining