]> git.ipfire.org Git - thirdparty/LuaJIT.git/commitdiff
Merge branch 'master' into v2.1
authorMike Pall <mike>
Mon, 23 May 2016 04:47:01 +0000 (06:47 +0200)
committerMike Pall <mike>
Mon, 23 May 2016 04:47:01 +0000 (06:47 +0200)
1  2 
src/lj_asm_x86.h

index 7d07336a6463c9b930a091aef2304eebdfcbc7f5,a380094bbdae26ee97c76f7cb8b178076f3f0971..26705e2c67d62817a550ead6c4acc93b1b87dd94
@@@ -420,13 -320,19 +420,26 @@@ static Reg asm_fuseload(ASMState *as, I
    if (ir->o == IR_KNUM) {
      RegSet avail = as->freeset & ~as->modset & RSET_FPR;
      lua_assert(allow != RSET_EMPTY);
 -    if (!(avail & (avail-1))) {  /* Fuse if less than two regs available. */
 -      as->mrm.ofs = ptr2addr(ir_knum(ir));
 -      as->mrm.base = as->mrm.idx = RID_NONE;
 -      return RID_MRM;
 -    }
 +    if (!(avail & (avail-1)))  /* Fuse if less than two regs available. */
 +      return asm_fuseloadk64(as, ir);
-   } else if (ir->o == IR_KINT64) {
+   } else if (ref == REF_BASE || ir->o == IR_KINT64) {
      RegSet avail = as->freeset & ~as->modset & RSET_GPR;
      lua_assert(allow != RSET_EMPTY);
-     if (!(avail & (avail-1)))  /* Fuse if less than two regs available. */
-       return asm_fuseloadk64(as, ir);
+     if (!(avail & (avail-1))) {  /* Fuse if less than two regs available. */
 -      as->mrm.ofs = ptr2addr(ref == REF_BASE ? (void *)&J2G(as->J)->jit_base : (void *)ir_kint64(ir));
 -      as->mrm.base = as->mrm.idx = RID_NONE;
 -      return RID_MRM;
++      if (ref == REF_BASE) {
++#if LJ_GC64
++      as->mrm.ofs = (int32_t)dispofs(as, &J2G(as->J)->jit_base);
++      as->mrm.base = RID_DISPATCH;
++#else
++      as->mrm.ofs = ptr2addr(&J2G(as->J)->jit_base);
++      as->mrm.base = RID_NONE;
++#endif
++      as->mrm.idx = RID_NONE;
++      return RID_MRM;
++      } else {
++      return asm_fuseloadk64(as, ir);
++      }
+     }
    } else if (mayfuse(as, ref)) {
      RegSet xallow = (allow & RSET_GPR) ? allow : RSET_GPR;
      if (ir->o == IR_SLOAD) {
        return RID_MRM;
      }
    }
-   if (!(as->freeset & allow) && !irref_isk(ref) &&
 +  if (ir->o == IR_FLOAD && ir->op1 == REF_NIL) {
 +    asm_fusefref(as, ir, RSET_EMPTY);
 +    return RID_MRM;
 +  }
+   if (!(as->freeset & allow) && !emit_canremat(ref) &&
        (allow == RSET_EMPTY || ra_hasspill(ir->s) || iscrossref(as, ref)))
      goto fusespill;
    return ra_allocref(as, ref, allow);