mirror of
https://github.com/LuaJIT/LuaJIT.git
synced 2025-02-07 23:24:09 +00:00
Merge branch 'master' into v2.1
This commit is contained in:
commit
d3e36e7920
@ -209,7 +209,7 @@ TARGET_CC= $(STATIC_CC)
|
|||||||
TARGET_STCC= $(STATIC_CC)
|
TARGET_STCC= $(STATIC_CC)
|
||||||
TARGET_DYNCC= $(DYNAMIC_CC)
|
TARGET_DYNCC= $(DYNAMIC_CC)
|
||||||
TARGET_LD= $(CROSS)$(CC)
|
TARGET_LD= $(CROSS)$(CC)
|
||||||
TARGET_AR= $(CROSS)ar rcus
|
TARGET_AR= $(CROSS)ar rcus 2>/dev/null
|
||||||
TARGET_STRIP= $(CROSS)strip
|
TARGET_STRIP= $(CROSS)strip
|
||||||
|
|
||||||
TARGET_LIBPATH= $(or $(PREFIX),/usr/local)/$(or $(MULTILIB),lib)
|
TARGET_LIBPATH= $(or $(PREFIX),/usr/local)/$(or $(MULTILIB),lib)
|
||||||
@ -313,7 +313,6 @@ ifeq (Darwin,$(TARGET_SYS))
|
|||||||
export MACOSX_DEPLOYMENT_TARGET=10.4
|
export MACOSX_DEPLOYMENT_TARGET=10.4
|
||||||
endif
|
endif
|
||||||
TARGET_STRIP+= -x
|
TARGET_STRIP+= -x
|
||||||
TARGET_AR+= 2>/dev/null
|
|
||||||
TARGET_XSHLDFLAGS= -dynamiclib -single_module -undefined dynamic_lookup -fPIC
|
TARGET_XSHLDFLAGS= -dynamiclib -single_module -undefined dynamic_lookup -fPIC
|
||||||
TARGET_DYNXLDOPTS=
|
TARGET_DYNXLDOPTS=
|
||||||
TARGET_XSHLDFLAGS+= -install_name $(TARGET_DYLIBPATH) -compatibility_version $(MAJVER).$(MINVER) -current_version $(MAJVER).$(MINVER).$(RELVER)
|
TARGET_XSHLDFLAGS+= -install_name $(TARGET_DYLIBPATH) -compatibility_version $(MAJVER).$(MINVER) -current_version $(MAJVER).$(MINVER).$(RELVER)
|
||||||
@ -324,7 +323,6 @@ ifeq (Darwin,$(TARGET_SYS))
|
|||||||
else
|
else
|
||||||
ifeq (iOS,$(TARGET_SYS))
|
ifeq (iOS,$(TARGET_SYS))
|
||||||
TARGET_STRIP+= -x
|
TARGET_STRIP+= -x
|
||||||
TARGET_AR+= 2>/dev/null
|
|
||||||
TARGET_XSHLDFLAGS= -dynamiclib -single_module -undefined dynamic_lookup -fPIC
|
TARGET_XSHLDFLAGS= -dynamiclib -single_module -undefined dynamic_lookup -fPIC
|
||||||
TARGET_DYNXLDOPTS=
|
TARGET_DYNXLDOPTS=
|
||||||
TARGET_XSHLDFLAGS+= -install_name $(TARGET_DYLIBPATH) -compatibility_version $(MAJVER).$(MINVER) -current_version $(MAJVER).$(MINVER).$(RELVER)
|
TARGET_XSHLDFLAGS+= -install_name $(TARGET_DYLIBPATH) -compatibility_version $(MAJVER).$(MINVER) -current_version $(MAJVER).$(MINVER).$(RELVER)
|
||||||
|
@ -829,7 +829,7 @@ static GCtab *ffi_finalizer(lua_State *L)
|
|||||||
settabV(L, L->top++, t);
|
settabV(L, L->top++, t);
|
||||||
setgcref(t->metatable, obj2gco(t));
|
setgcref(t->metatable, obj2gco(t));
|
||||||
setstrV(L, lj_tab_setstr(L, t, lj_str_newlit(L, "__mode")),
|
setstrV(L, lj_tab_setstr(L, t, lj_str_newlit(L, "__mode")),
|
||||||
lj_str_newlit(L, "K"));
|
lj_str_newlit(L, "k"));
|
||||||
t->nomm = (uint8_t)(~(1u<<MM_mode));
|
t->nomm = (uint8_t)(~(1u<<MM_mode));
|
||||||
return t;
|
return t;
|
||||||
}
|
}
|
||||||
|
11
src/lj_gc.c
11
src/lj_gc.c
@ -169,14 +169,21 @@ static int gc_traverse_tab(global_State *g, GCtab *t)
|
|||||||
while ((c = *modestr++)) {
|
while ((c = *modestr++)) {
|
||||||
if (c == 'k') weak |= LJ_GC_WEAKKEY;
|
if (c == 'k') weak |= LJ_GC_WEAKKEY;
|
||||||
else if (c == 'v') weak |= LJ_GC_WEAKVAL;
|
else if (c == 'v') weak |= LJ_GC_WEAKVAL;
|
||||||
else if (c == 'K') weak = (int)(~0u & ~LJ_GC_WEAKVAL);
|
|
||||||
}
|
}
|
||||||
if (weak > 0) { /* Weak tables are cleared in the atomic phase. */
|
if (weak) { /* Weak tables are cleared in the atomic phase. */
|
||||||
|
#if LJ_HASFFI
|
||||||
|
CTState *cts = ctype_ctsG(g);
|
||||||
|
if (cts && cts->finalizer == t) {
|
||||||
|
weak = (int)(~0u & ~LJ_GC_WEAKVAL);
|
||||||
|
} else
|
||||||
|
#endif
|
||||||
|
{
|
||||||
t->marked = (uint8_t)((t->marked & ~LJ_GC_WEAK) | weak);
|
t->marked = (uint8_t)((t->marked & ~LJ_GC_WEAK) | weak);
|
||||||
setgcrefr(t->gclist, g->gc.weak);
|
setgcrefr(t->gclist, g->gc.weak);
|
||||||
setgcref(g->gc.weak, obj2gco(t));
|
setgcref(g->gc.weak, obj2gco(t));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if (weak == LJ_GC_WEAK) /* Nothing to mark if both keys/values are weak. */
|
if (weak == LJ_GC_WEAK) /* Nothing to mark if both keys/values are weak. */
|
||||||
return 1;
|
return 1;
|
||||||
if (!(weak & LJ_GC_WEAKVAL)) { /* Mark array part. */
|
if (!(weak & LJ_GC_WEAKVAL)) { /* Mark array part. */
|
||||||
|
@ -204,10 +204,7 @@ static void mcode_protect(jit_State *J, int prot)
|
|||||||
|
|
||||||
/* -- MCode area allocation ----------------------------------------------- */
|
/* -- MCode area allocation ----------------------------------------------- */
|
||||||
|
|
||||||
#if LJ_TARGET_X64
|
#if LJ_64
|
||||||
#define mcode_validptr(p) ((p) && (uintptr_t)(p) < (uintptr_t)1<<47)
|
|
||||||
#elif LJ_TARGET_ARM64 || LJ_TARGET_MIPS64
|
|
||||||
/* We have no clue about the valid VA range. It could be 39 - 52 bits. */
|
|
||||||
#define mcode_validptr(p) (p)
|
#define mcode_validptr(p) (p)
|
||||||
#else
|
#else
|
||||||
#define mcode_validptr(p) ((p) && (uintptr_t)(p) < 0xffff0000)
|
#define mcode_validptr(p) ((p) && (uintptr_t)(p) < 0xffff0000)
|
||||||
@ -233,7 +230,8 @@ static void *mcode_alloc(jit_State *J, size_t sz)
|
|||||||
/* First try a contiguous area below the last one. */
|
/* First try a contiguous area below the last one. */
|
||||||
uintptr_t hint = J->mcarea ? (uintptr_t)J->mcarea - sz : 0;
|
uintptr_t hint = J->mcarea ? (uintptr_t)J->mcarea - sz : 0;
|
||||||
int i;
|
int i;
|
||||||
for (i = 0; i < 32; i++) { /* 32 attempts ought to be enough ... */
|
/* Limit probing iterations, depending on the available pool size. */
|
||||||
|
for (i = 0; i < LJ_TARGET_JUMPRANGE; i++) {
|
||||||
if (mcode_validptr(hint)) {
|
if (mcode_validptr(hint)) {
|
||||||
void *p = mcode_alloc_at(J, hint, sz, MCPROT_GEN);
|
void *p = mcode_alloc_at(J, hint, sz, MCPROT_GEN);
|
||||||
|
|
||||||
@ -242,11 +240,11 @@ static void *mcode_alloc(jit_State *J, size_t sz)
|
|||||||
return p;
|
return p;
|
||||||
if (p) mcode_free(J, p, sz); /* Free badly placed area. */
|
if (p) mcode_free(J, p, sz); /* Free badly placed area. */
|
||||||
}
|
}
|
||||||
/* Next try probing pseudo-random addresses. */
|
/* Next try probing 64K-aligned pseudo-random addresses. */
|
||||||
do {
|
do {
|
||||||
hint = (0x78fb ^ LJ_PRNG_BITS(J, 15)) << 16; /* 64K aligned. */
|
hint = LJ_PRNG_BITS(J, LJ_TARGET_JUMPRANGE-16) << 16;
|
||||||
} while (!(hint + sz < range));
|
} while (!(hint + sz < range+range));
|
||||||
hint = target + hint - (range>>1);
|
hint = target + hint - range;
|
||||||
}
|
}
|
||||||
lj_trace_err(J, LJ_TRERR_MCODEAL); /* Give up. OS probably ignores hints? */
|
lj_trace_err(J, LJ_TRERR_MCODEAL); /* Give up. OS probably ignores hints? */
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -1282,12 +1282,14 @@ static void fscope_end(FuncState *fs)
|
|||||||
MSize idx = gola_new(ls, NAME_BREAK, VSTACK_LABEL, fs->pc);
|
MSize idx = gola_new(ls, NAME_BREAK, VSTACK_LABEL, fs->pc);
|
||||||
ls->vtop = idx; /* Drop break label immediately. */
|
ls->vtop = idx; /* Drop break label immediately. */
|
||||||
gola_resolve(ls, bl, idx);
|
gola_resolve(ls, bl, idx);
|
||||||
return;
|
} else { /* Need the fixup step to propagate the breaks. */
|
||||||
} /* else: need the fixup step to propagate the breaks. */
|
gola_fixup(ls, bl);
|
||||||
} else if (!(bl->flags & FSCOPE_GOLA)) {
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
if ((bl->flags & FSCOPE_GOLA)) {
|
||||||
gola_fixup(ls, bl);
|
gola_fixup(ls, bl);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Mark scope as having an upvalue. */
|
/* Mark scope as having an upvalue. */
|
||||||
|
Loading…
Reference in New Issue
Block a user