Browse Source

Fix XLOAD/XSTORE references.

Mike Pall 14 years ago
parent
commit
5270586a80
1 changed files with 3 additions and 2 deletions
  1. 3 2
      src/lj_asm.c

+ 3 - 2
src/lj_asm.c

@@ -1300,17 +1300,18 @@ static void asm_fusestrref(ASMState *as, IRIns *ir, RegSet allow)
 static void asm_fusexref(ASMState *as, IRRef ref, RegSet allow)
 static void asm_fusexref(ASMState *as, IRRef ref, RegSet allow)
 {
 {
   IRIns *ir = IR(ref);
   IRIns *ir = IR(ref);
+  as->mrm.idx = RID_NONE;
   if (ir->o == IR_KPTR) {
   if (ir->o == IR_KPTR) {
     as->mrm.ofs = ir->i;
     as->mrm.ofs = ir->i;
-    as->mrm.base = as->mrm.idx = RID_NONE;
+    as->mrm.base = RID_NONE;
   } else if (ir->o == IR_STRREF) {
   } else if (ir->o == IR_STRREF) {
     asm_fusestrref(as, ir, allow);
     asm_fusestrref(as, ir, allow);
   } else if (mayfuse(as, ref) && ir->o == IR_ADD &&
   } else if (mayfuse(as, ref) && ir->o == IR_ADD &&
 	     asm_isk32(as, ir->op2, &as->mrm.ofs)) {
 	     asm_isk32(as, ir->op2, &as->mrm.ofs)) {
     /* NYI: gather index and shifts. */
     /* NYI: gather index and shifts. */
-    as->mrm.idx = RID_NONE;
     as->mrm.base = (uint8_t)ra_alloc1(as, ir->op1, allow);
     as->mrm.base = (uint8_t)ra_alloc1(as, ir->op1, allow);
   } else {
   } else {
+    as->mrm.ofs = 0;
     as->mrm.base = (uint8_t)ra_alloc1(as, ref, allow);
     as->mrm.base = (uint8_t)ra_alloc1(as, ref, allow);
   }
   }
 }
 }