diff src/cpu/x86/vm/c1_LIRGenerator_x86.cpp @ 1060:323bd24c6520

6769124: various 64-bit fixes for c1 Reviewed-by: never
author roland
date Mon, 02 Nov 2009 11:17:55 +0100
parents a1423fe86a18
children c18cbe5936b8 87fc6aca31ab
line wrap: on
line diff
--- a/src/cpu/x86/vm/c1_LIRGenerator_x86.cpp	Fri Oct 30 16:22:59 2009 -0700
+++ b/src/cpu/x86/vm/c1_LIRGenerator_x86.cpp	Mon Nov 02 11:17:55 2009 +0100
@@ -755,8 +755,19 @@
   }
 
   LIR_Opr addr = new_pointer_register();
-  __ move(obj.result(), addr);
-  __ add(addr, offset.result(), addr);
+  LIR_Address* a;
+  if(offset.result()->is_constant()) {
+    a = new LIR_Address(obj.result(),
+                        NOT_LP64(offset.result()->as_constant_ptr()->as_jint()) LP64_ONLY((int)offset.result()->as_constant_ptr()->as_jlong()),
+                        as_BasicType(type));
+  } else {
+    a = new LIR_Address(obj.result(),
+                        offset.result(),
+                        LIR_Address::times_1,
+                        0,
+                        as_BasicType(type));
+  }
+  __ leal(LIR_OprFact::address(a), addr);
 
   if (type == objectType) {  // Write-barrier needed for Object fields.
     // Do the pre-write barrier, if any.