aboutsummaryrefslogtreecommitdiff
path: root/src/lj_asm.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/lj_asm.c')
-rw-r--r--src/lj_asm.c23
1 files changed, 10 insertions, 13 deletions
diff --git a/src/lj_asm.c b/src/lj_asm.c
index 6ff32940..73df6850 100644
--- a/src/lj_asm.c
+++ b/src/lj_asm.c
@@ -1039,20 +1039,18 @@ static void asm_tvptr(ASMState *as, Reg dest, IRRef ref);
1039 1039
1040static void asm_bufhdr(ASMState *as, IRIns *ir) 1040static void asm_bufhdr(ASMState *as, IRIns *ir)
1041{ 1041{
1042 if (ra_used(ir)) { 1042 Reg sb = ra_dest(as, ir, RSET_GPR);
1043 Reg sb = ra_dest(as, ir, RSET_GPR); 1043 if (!(ir->op2 & IRBUFHDR_APPEND)) {
1044 if (!(ir->op2 & IRBUFHDR_APPEND)) { 1044 Reg tmp = ra_scratch(as, rset_exclude(RSET_GPR, sb));
1045 Reg tmp = ra_scratch(as, rset_exclude(RSET_GPR, sb)); 1045 /* Passing ir isn't strictly correct, but it's an IRT_P32, too. */
1046 /* Passing ir isn't strictly correct, but it's an IRT_P32, too. */ 1046 emit_storeofs(as, ir, tmp, sb, offsetof(SBuf, p));
1047 emit_storeofs(as, ir, tmp, sb, offsetof(SBuf, p)); 1047 emit_loadofs(as, ir, tmp, sb, offsetof(SBuf, b));
1048 emit_loadofs(as, ir, tmp, sb, offsetof(SBuf, b)); 1048 }
1049 }
1050#if LJ_TARGET_X86ORX64 1049#if LJ_TARGET_X86ORX64
1051 ra_left(as, sb, ir->op1); 1050 ra_left(as, sb, ir->op1);
1052#else 1051#else
1053 ra_leftov(as, sb, ir->op1); 1052 ra_leftov(as, sb, ir->op1);
1054#endif 1053#endif
1055 }
1056} 1054}
1057 1055
1058static void asm_bufput(ASMState *as, IRIns *ir) 1056static void asm_bufput(ASMState *as, IRIns *ir)
@@ -1061,7 +1059,6 @@ static void asm_bufput(ASMState *as, IRIns *ir)
1061 IRRef args[3]; 1059 IRRef args[3];
1062 IRIns *irs; 1060 IRIns *irs;
1063 int kchar = -1; 1061 int kchar = -1;
1064 if (!ra_used(ir)) return;
1065 args[0] = ir->op1; /* SBuf * */ 1062 args[0] = ir->op1; /* SBuf * */
1066 args[1] = ir->op2; /* GCstr * */ 1063 args[1] = ir->op2; /* GCstr * */
1067 irs = IR(ir->op2); 1064 irs = IR(ir->op2);
@@ -1107,7 +1104,7 @@ static void asm_bufstr(ASMState *as, IRIns *ir)
1107{ 1104{
1108 const CCallInfo *ci = &lj_ir_callinfo[IRCALL_lj_buf_tostr]; 1105 const CCallInfo *ci = &lj_ir_callinfo[IRCALL_lj_buf_tostr];
1109 IRRef args[1]; 1106 IRRef args[1];
1110 args[0] = ir->op2; /* SBuf *sb */ 1107 args[0] = ir->op1; /* SBuf *sb */
1111 as->gcsteps++; 1108 as->gcsteps++;
1112 asm_setupresult(as, ir, ci); /* GCstr * */ 1109 asm_setupresult(as, ir, ci); /* GCstr * */
1113 asm_gencall(as, ci, args); 1110 asm_gencall(as, ci, args);