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
1d9a337de6
@ -502,7 +502,8 @@ LJLIB_CF(print)
|
||||
lua_gettable(L, LUA_GLOBALSINDEX);
|
||||
tv = L->top-1;
|
||||
}
|
||||
shortcut = (tvisfunc(tv) && funcV(tv)->c.ffid == FF_tostring);
|
||||
shortcut = (tvisfunc(tv) && funcV(tv)->c.ffid == FF_tostring)
|
||||
&& !gcrefu(basemt_it(G(L), LJ_TNUMX));
|
||||
for (i = 0; i < nargs; i++) {
|
||||
cTValue *o = &L->base[i];
|
||||
const char *str;
|
||||
|
@ -22,7 +22,6 @@
|
||||
#include "lj_ircall.h"
|
||||
#include "lj_iropt.h"
|
||||
#include "lj_mcode.h"
|
||||
#include "lj_iropt.h"
|
||||
#include "lj_trace.h"
|
||||
#include "lj_snap.h"
|
||||
#include "lj_asm.h"
|
||||
|
@ -119,12 +119,13 @@ static void *clib_loadlib(lua_State *L, const char *name, int global)
|
||||
RTLD_LAZY | (global?RTLD_GLOBAL:RTLD_LOCAL));
|
||||
if (!h) {
|
||||
const char *e, *err = dlerror();
|
||||
if (*err == '/' && (e = strchr(err, ':')) &&
|
||||
if (err && *err == '/' && (e = strchr(err, ':')) &&
|
||||
(name = clib_resolve_lds(L, strdata(lj_str_new(L, err, e-err))))) {
|
||||
h = dlopen(name, RTLD_LAZY | (global?RTLD_GLOBAL:RTLD_LOCAL));
|
||||
if (h) return h;
|
||||
err = dlerror();
|
||||
}
|
||||
if (!err) err = "dlopen failed";
|
||||
lj_err_callermsg(L, err);
|
||||
}
|
||||
return h;
|
||||
@ -384,6 +385,7 @@ TValue *lj_clib_index(lua_State *L, CLibrary *cl, GCstr *name)
|
||||
cd = lj_cdata_new(cts, id, CTSIZE_PTR);
|
||||
*(void **)cdataptr(cd) = p;
|
||||
setcdataV(L, tv, cd);
|
||||
lj_gc_anybarriert(L, cl->cache);
|
||||
}
|
||||
}
|
||||
return tv;
|
||||
|
@ -262,19 +262,19 @@ static LJ_AINLINE uint32_t lj_fls(uint32_t x)
|
||||
return _CountLeadingZeros(x) ^ 31;
|
||||
}
|
||||
#else
|
||||
unsigned char _BitScanForward(uint32_t *, unsigned long);
|
||||
unsigned char _BitScanReverse(uint32_t *, unsigned long);
|
||||
unsigned char _BitScanForward(unsigned long *, unsigned long);
|
||||
unsigned char _BitScanReverse(unsigned long *, unsigned long);
|
||||
#pragma intrinsic(_BitScanForward)
|
||||
#pragma intrinsic(_BitScanReverse)
|
||||
|
||||
static LJ_AINLINE uint32_t lj_ffs(uint32_t x)
|
||||
{
|
||||
uint32_t r; _BitScanForward(&r, x); return r;
|
||||
unsigned long r; _BitScanForward(&r, x); return (uint32_t)r;
|
||||
}
|
||||
|
||||
static LJ_AINLINE uint32_t lj_fls(uint32_t x)
|
||||
{
|
||||
uint32_t r; _BitScanReverse(&r, x); return r;
|
||||
unsigned long r; _BitScanReverse(&r, x); return (uint32_t)r;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -138,7 +138,7 @@ static int lex_skipeq(LexState *ls)
|
||||
int count = 0;
|
||||
LexChar s = ls->c;
|
||||
lua_assert(s == '[' || s == ']');
|
||||
while (lex_savenext(ls) == '=')
|
||||
while (lex_savenext(ls) == '=' && count < 0x20000000)
|
||||
count++;
|
||||
return (ls->c == s) ? count : (-count) - 1;
|
||||
}
|
||||
|
@ -1860,6 +1860,8 @@ static void rec_varg(jit_State *J, BCReg dst, ptrdiff_t nresults)
|
||||
lj_trace_err_info(J, LJ_TRERR_NYIBC);
|
||||
}
|
||||
}
|
||||
if (J->baseslot + J->maxslot >= LJ_MAX_JSLOTS)
|
||||
lj_trace_err(J, LJ_TRERR_STACKOV);
|
||||
}
|
||||
|
||||
/* -- Record allocations -------------------------------------------------- */
|
||||
|
@ -486,8 +486,7 @@ TValue *lj_tab_newkey(lua_State *L, GCtab *t, cTValue *key)
|
||||
/* Rechain pseudo-resurrected string keys with colliding hashes. */
|
||||
while (nextnode(freenode)) {
|
||||
Node *nn = nextnode(freenode);
|
||||
if (tvisstr(&nn->key) && !tvisnil(&nn->val) &&
|
||||
hashstr(t, strV(&nn->key)) == n) {
|
||||
if (!tvisnil(&nn->val) && hashkey(t, &nn->key) == n) {
|
||||
freenode->next = nn->next;
|
||||
nn->next = n->next;
|
||||
setmref(n->next, nn);
|
||||
@ -500,9 +499,9 @@ TValue *lj_tab_newkey(lua_State *L, GCtab *t, cTValue *key)
|
||||
** any string key that's currently in a non-main positions.
|
||||
*/
|
||||
while ((nn = nextnode(freenode))) {
|
||||
if (tvisstr(&nn->key) && !tvisnil(&nn->val)) {
|
||||
Node *mn = hashstr(t, strV(&nn->key));
|
||||
if (mn != freenode) {
|
||||
if (!tvisnil(&nn->val)) {
|
||||
Node *mn = hashkey(t, &nn->key);
|
||||
if (mn != freenode && mn != nn) {
|
||||
freenode->next = nn->next;
|
||||
nn->next = mn->next;
|
||||
setmref(mn->next, nn);
|
||||
|
Loading…
Reference in New Issue
Block a user