diff --git a/doc/ext_ffi_semantics.html b/doc/ext_ffi_semantics.html index 800b6b18a0..268ac104f5 100644 --- a/doc/ext_ffi_semantics.html +++ b/doc/ext_ffi_semantics.html @@ -864,7 +864,7 @@
The main use for parameterized types are libraries implementing abstract
data types
-(» example),
+(example),
similar to what can be achieved with C++ template metaprogramming.
Another use case are derived types of anonymous structs, which avoids
pollution of the global struct namespace.
diff --git a/dynasm/dasm_x86.h b/dynasm/dasm_x86.h
index bc636357a6..f598da9afd 100644
--- a/dynasm/dasm_x86.h
+++ b/dynasm/dasm_x86.h
@@ -421,7 +421,8 @@ int dasm_encode(Dst_DECL, void *buffer)
}
case DASM_REL_LG: p++; if (n >= 0) goto rel_pc;
b++; n = (int)(ptrdiff_t)D->globals[-n];
- case DASM_REL_A: rel_a: n -= (int)(ptrdiff_t)(cp+4); goto wd; /* !x64 */
+ case DASM_REL_A: rel_a:
+ n -= (unsigned int)(ptrdiff_t)(cp+4); goto wd; /* !x64 */
case DASM_REL_PC: rel_pc: {
int shrink = *b++;
int *pb = DASM_POS2PTR(D, n); if (*pb < 0) { n = pb[1]; goto rel_a; }
diff --git a/src/jit/bcsave.lua b/src/jit/bcsave.lua
index 9ee22a013d..52a90c79cd 100644
--- a/src/jit/bcsave.lua
+++ b/src/jit/bcsave.lua
@@ -275,7 +275,7 @@ typedef struct {
o.sect[2].size = fofs(ofs)
o.sect[3].type = f32(3) -- .strtab
o.sect[3].ofs = fofs(sofs + ofs)
- o.sect[3].size = fofs(#symname+1)
+ o.sect[3].size = fofs(#symname+2)
ffi.copy(o.space+ofs+1, symname)
ofs = ofs + #symname + 2
o.sect[4].type = f32(1) -- .rodata
diff --git a/src/lj_asm.c b/src/lj_asm.c
index 4994858ece..537ee501e5 100644
--- a/src/lj_asm.c
+++ b/src/lj_asm.c
@@ -895,7 +895,7 @@ static uint32_t ir_khash(IRIns *ir)
} else {
lua_assert(irt_isgcv(ir->t));
lo = u32ptr(ir_kgc(ir));
- hi = lo + HASH_BIAS;
+ hi = (uint32_t)(u64ptr(ir_kgc(ir)) >> 32) | (irt_toitype(ir->t) << 15);
}
return hashrot(lo, hi);
}
@@ -989,7 +989,7 @@ static void asm_bufput(ASMState *as, IRIns *ir)
const CCallInfo *ci = &lj_ir_callinfo[IRCALL_lj_buf_putstr];
IRRef args[3];
IRIns *irs;
- int kchar = -1;
+ int kchar = -129;
args[0] = ir->op1; /* SBuf * */
args[1] = ir->op2; /* GCstr * */
irs = IR(ir->op2);
@@ -997,7 +997,7 @@ static void asm_bufput(ASMState *as, IRIns *ir)
if (irs->o == IR_KGC) {
GCstr *s = ir_kstr(irs);
if (s->len == 1) { /* Optimize put of single-char string constant. */
- kchar = strdata(s)[0];
+ kchar = (int8_t)strdata(s)[0]; /* Signed! */
args[1] = ASMREF_TMP1; /* int, truncated to char */
ci = &lj_ir_callinfo[IRCALL_lj_buf_putchar];
}
@@ -1024,7 +1024,7 @@ static void asm_bufput(ASMState *as, IRIns *ir)
asm_gencall(as, ci, args);
if (args[1] == ASMREF_TMP1) {
Reg tmp = ra_releasetmp(as, ASMREF_TMP1);
- if (kchar == -1)
+ if (kchar == -129)
asm_tvptr(as, tmp, irs->op1);
else
ra_allockreg(as, kchar, tmp);
@@ -1798,6 +1798,7 @@ static void asm_setup_regsp(ASMState *as)
for (ir = IR(T->nk), lastir = IR(REF_BASE); ir < lastir; ir++) {
ir->prev = REGSP_INIT;
if (irt_is64(ir->t) && ir->o != IR_KNULL) {
+ /* The false-positive of irt_is64() for ASMREF_L (REF_NIL) is OK here. */
ir->i = 0; /* Will become non-zero only for RIP-relative addresses. */
ir++;
}
diff --git a/src/lj_asm_x86.h b/src/lj_asm_x86.h
index 49e1bcff68..55a3de0077 100644
--- a/src/lj_asm_x86.h
+++ b/src/lj_asm_x86.h
@@ -1348,7 +1348,7 @@ static void asm_sload(ASMState *as, IRIns *ir)
emit_i8(as, irt_toitype(t));
emit_rr(as, XO_ARITHi8, XOg_CMP, tmp);
emit_shifti(as, XOg_SAR|REX_64, tmp, 47);
- emit_rmro(as, XO_MOV, tmp|REX_64, base, ofs+4);
+ emit_rmro(as, XO_MOV, tmp|REX_64, base, ofs);
}
}
}
diff --git a/src/lj_ir.h b/src/lj_ir.h
index 4d6e1fbf5e..ee3373544c 100644
--- a/src/lj_ir.h
+++ b/src/lj_ir.h
@@ -375,10 +375,12 @@ typedef struct IRType1 { uint8_t irt; } IRType1;
#define irt_isaddr(t) (irt_typerange((t), IRT_LIGHTUD, IRT_UDATA))
#define irt_isint64(t) (irt_typerange((t), IRT_I64, IRT_U64))
+/* Include IRT_NIL, so IR(ASMREF_L) (aka REF_NIL) is considered 64 bit. */
#define IRT_IS64 \
((1u<