|
 |
006bc1 |
From 58d0dde0a2df49abc991decbabff15230010829a Mon Sep 17 00:00:00 2001
|
|
 |
006bc1 |
From: Mike Pall <mike>
|
|
 |
006bc1 |
Date: Sun, 14 Jan 2018 13:57:00 +0100
|
|
 |
006bc1 |
Subject: [PATCH 26/72] Fix IR_BUFPUT assembly.
|
|
 |
006bc1 |
|
|
 |
006bc1 |
Thanks to Peter Cawley.
|
|
 |
006bc1 |
---
|
|
 |
006bc1 |
src/lj_asm.c | 6 +++---
|
|
 |
006bc1 |
1 file changed, 3 insertions(+), 3 deletions(-)
|
|
 |
006bc1 |
|
|
 |
006bc1 |
diff --git a/src/lj_asm.c b/src/lj_asm.c
|
|
 |
006bc1 |
index 753fe6b..5f83779 100644
|
|
 |
006bc1 |
--- a/src/lj_asm.c
|
|
 |
006bc1 |
+++ b/src/lj_asm.c
|
|
 |
006bc1 |
@@ -1119,7 +1119,7 @@ static void asm_bufput(ASMState *as, IRIns *ir)
|
|
 |
006bc1 |
const CCallInfo *ci = &lj_ir_callinfo[IRCALL_lj_buf_putstr];
|
|
 |
006bc1 |
IRRef args[3];
|
|
 |
006bc1 |
IRIns *irs;
|
|
 |
006bc1 |
- int kchar = -1;
|
|
 |
006bc1 |
+ int kchar = -129;
|
|
 |
006bc1 |
args[0] = ir->op1; /* SBuf * */
|
|
 |
006bc1 |
args[1] = ir->op2; /* GCstr * */
|
|
 |
006bc1 |
irs = IR(ir->op2);
|
|
 |
006bc1 |
@@ -1127,7 +1127,7 @@ static void asm_bufput(ASMState *as, IRIns *ir)
|
|
 |
006bc1 |
if (irs->o == IR_KGC) {
|
|
 |
006bc1 |
GCstr *s = ir_kstr(irs);
|
|
 |
006bc1 |
if (s->len == 1) { /* Optimize put of single-char string constant. */
|
|
 |
006bc1 |
- kchar = strdata(s)[0];
|
|
 |
006bc1 |
+ kchar = (int8_t)strdata(s)[0]; /* Signed! */
|
|
 |
006bc1 |
args[1] = ASMREF_TMP1; /* int, truncated to char */
|
|
 |
006bc1 |
ci = &lj_ir_callinfo[IRCALL_lj_buf_putchar];
|
|
 |
006bc1 |
}
|
|
 |
006bc1 |
@@ -1154,7 +1154,7 @@ static void asm_bufput(ASMState *as, IRIns *ir)
|
|
 |
006bc1 |
asm_gencall(as, ci, args);
|
|
 |
006bc1 |
if (args[1] == ASMREF_TMP1) {
|
|
 |
006bc1 |
Reg tmp = ra_releasetmp(as, ASMREF_TMP1);
|
|
 |
006bc1 |
- if (kchar == -1)
|
|
 |
006bc1 |
+ if (kchar == -129)
|
|
 |
006bc1 |
asm_tvptr(as, tmp, irs->op1);
|
|
 |
006bc1 |
else
|
|
 |
006bc1 |
ra_allockreg(as, kchar, tmp);
|
|
 |
006bc1 |
--
|
|
 |
006bc1 |
2.20.1
|
|
 |
006bc1 |
|