aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMike Pall <mike>2019-12-08 19:50:36 +0100
committerMike Pall <mike>2019-12-08 19:50:36 +0100
commit1d9a337de6630746e3e8580aa855c0376c67d356 (patch)
tree17789d6e157442c8ec6c400a97bccc057d43be31 /src
parent05898a8824f119d586e5fb079f1e66d8cac38160 (diff)
parentde48d000941f58a8d4d816e9d227de8a4f3c9de6 (diff)
downloadluajit-1d9a337de6630746e3e8580aa855c0376c67d356.tar.gz
luajit-1d9a337de6630746e3e8580aa855c0376c67d356.tar.bz2
luajit-1d9a337de6630746e3e8580aa855c0376c67d356.zip
Merge branch 'master' into v2.1
Diffstat (limited to 'src')
-rw-r--r--src/lib_base.c3
-rw-r--r--src/lj_asm.c1
-rw-r--r--src/lj_clib.c4
-rw-r--r--src/lj_def.h8
-rw-r--r--src/lj_lex.c2
-rw-r--r--src/lj_record.c2
-rw-r--r--src/lj_tab.c9
7 files changed, 16 insertions, 13 deletions
diff --git a/src/lib_base.c b/src/lib_base.c
index 1cd83058..83c7663c 100644
--- a/src/lib_base.c
+++ b/src/lib_base.c
@@ -502,7 +502,8 @@ LJLIB_CF(print)
502 lua_gettable(L, LUA_GLOBALSINDEX); 502 lua_gettable(L, LUA_GLOBALSINDEX);
503 tv = L->top-1; 503 tv = L->top-1;
504 } 504 }
505 shortcut = (tvisfunc(tv) && funcV(tv)->c.ffid == FF_tostring); 505 shortcut = (tvisfunc(tv) && funcV(tv)->c.ffid == FF_tostring)
506 && !gcrefu(basemt_it(G(L), LJ_TNUMX));
506 for (i = 0; i < nargs; i++) { 507 for (i = 0; i < nargs; i++) {
507 cTValue *o = &L->base[i]; 508 cTValue *o = &L->base[i];
508 const char *str; 509 const char *str;
diff --git a/src/lj_asm.c b/src/lj_asm.c
index ff07b7ee..c4c5dfdd 100644
--- a/src/lj_asm.c
+++ b/src/lj_asm.c
@@ -22,7 +22,6 @@
22#include "lj_ircall.h" 22#include "lj_ircall.h"
23#include "lj_iropt.h" 23#include "lj_iropt.h"
24#include "lj_mcode.h" 24#include "lj_mcode.h"
25#include "lj_iropt.h"
26#include "lj_trace.h" 25#include "lj_trace.h"
27#include "lj_snap.h" 26#include "lj_snap.h"
28#include "lj_asm.h" 27#include "lj_asm.h"
diff --git a/src/lj_clib.c b/src/lj_clib.c
index f016b06b..a7df719a 100644
--- a/src/lj_clib.c
+++ b/src/lj_clib.c
@@ -119,12 +119,13 @@ static void *clib_loadlib(lua_State *L, const char *name, int global)
119 RTLD_LAZY | (global?RTLD_GLOBAL:RTLD_LOCAL)); 119 RTLD_LAZY | (global?RTLD_GLOBAL:RTLD_LOCAL));
120 if (!h) { 120 if (!h) {
121 const char *e, *err = dlerror(); 121 const char *e, *err = dlerror();
122 if (*err == '/' && (e = strchr(err, ':')) && 122 if (err && *err == '/' && (e = strchr(err, ':')) &&
123 (name = clib_resolve_lds(L, strdata(lj_str_new(L, err, e-err))))) { 123 (name = clib_resolve_lds(L, strdata(lj_str_new(L, err, e-err))))) {
124 h = dlopen(name, RTLD_LAZY | (global?RTLD_GLOBAL:RTLD_LOCAL)); 124 h = dlopen(name, RTLD_LAZY | (global?RTLD_GLOBAL:RTLD_LOCAL));
125 if (h) return h; 125 if (h) return h;
126 err = dlerror(); 126 err = dlerror();
127 } 127 }
128 if (!err) err = "dlopen failed";
128 lj_err_callermsg(L, err); 129 lj_err_callermsg(L, err);
129 } 130 }
130 return h; 131 return h;
@@ -384,6 +385,7 @@ TValue *lj_clib_index(lua_State *L, CLibrary *cl, GCstr *name)
384 cd = lj_cdata_new(cts, id, CTSIZE_PTR); 385 cd = lj_cdata_new(cts, id, CTSIZE_PTR);
385 *(void **)cdataptr(cd) = p; 386 *(void **)cdataptr(cd) = p;
386 setcdataV(L, tv, cd); 387 setcdataV(L, tv, cd);
388 lj_gc_anybarriert(L, cl->cache);
387 } 389 }
388 } 390 }
389 return tv; 391 return tv;
diff --git a/src/lj_def.h b/src/lj_def.h
index b1208f6b..9d09e846 100644
--- a/src/lj_def.h
+++ b/src/lj_def.h
@@ -262,19 +262,19 @@ static LJ_AINLINE uint32_t lj_fls(uint32_t x)
262 return _CountLeadingZeros(x) ^ 31; 262 return _CountLeadingZeros(x) ^ 31;
263} 263}
264#else 264#else
265unsigned char _BitScanForward(uint32_t *, unsigned long); 265unsigned char _BitScanForward(unsigned long *, unsigned long);
266unsigned char _BitScanReverse(uint32_t *, unsigned long); 266unsigned char _BitScanReverse(unsigned long *, unsigned long);
267#pragma intrinsic(_BitScanForward) 267#pragma intrinsic(_BitScanForward)
268#pragma intrinsic(_BitScanReverse) 268#pragma intrinsic(_BitScanReverse)
269 269
270static LJ_AINLINE uint32_t lj_ffs(uint32_t x) 270static LJ_AINLINE uint32_t lj_ffs(uint32_t x)
271{ 271{
272 uint32_t r; _BitScanForward(&r, x); return r; 272 unsigned long r; _BitScanForward(&r, x); return (uint32_t)r;
273} 273}
274 274
275static LJ_AINLINE uint32_t lj_fls(uint32_t x) 275static LJ_AINLINE uint32_t lj_fls(uint32_t x)
276{ 276{
277 uint32_t r; _BitScanReverse(&r, x); return r; 277 unsigned long r; _BitScanReverse(&r, x); return (uint32_t)r;
278} 278}
279#endif 279#endif
280 280
diff --git a/src/lj_lex.c b/src/lj_lex.c
index 2d2f8194..fb3d95ee 100644
--- a/src/lj_lex.c
+++ b/src/lj_lex.c
@@ -138,7 +138,7 @@ static int lex_skipeq(LexState *ls)
138 int count = 0; 138 int count = 0;
139 LexChar s = ls->c; 139 LexChar s = ls->c;
140 lua_assert(s == '[' || s == ']'); 140 lua_assert(s == '[' || s == ']');
141 while (lex_savenext(ls) == '=') 141 while (lex_savenext(ls) == '=' && count < 0x20000000)
142 count++; 142 count++;
143 return (ls->c == s) ? count : (-count) - 1; 143 return (ls->c == s) ? count : (-count) - 1;
144} 144}
diff --git a/src/lj_record.c b/src/lj_record.c
index 7f37d6c6..4a50de1b 100644
--- a/src/lj_record.c
+++ b/src/lj_record.c
@@ -1860,6 +1860,8 @@ static void rec_varg(jit_State *J, BCReg dst, ptrdiff_t nresults)
1860 lj_trace_err_info(J, LJ_TRERR_NYIBC); 1860 lj_trace_err_info(J, LJ_TRERR_NYIBC);
1861 } 1861 }
1862 } 1862 }
1863 if (J->baseslot + J->maxslot >= LJ_MAX_JSLOTS)
1864 lj_trace_err(J, LJ_TRERR_STACKOV);
1863} 1865}
1864 1866
1865/* -- Record allocations -------------------------------------------------- */ 1867/* -- Record allocations -------------------------------------------------- */
diff --git a/src/lj_tab.c b/src/lj_tab.c
index c51666d3..e77a7af5 100644
--- a/src/lj_tab.c
+++ b/src/lj_tab.c
@@ -486,8 +486,7 @@ TValue *lj_tab_newkey(lua_State *L, GCtab *t, cTValue *key)
486 /* Rechain pseudo-resurrected string keys with colliding hashes. */ 486 /* Rechain pseudo-resurrected string keys with colliding hashes. */
487 while (nextnode(freenode)) { 487 while (nextnode(freenode)) {
488 Node *nn = nextnode(freenode); 488 Node *nn = nextnode(freenode);
489 if (tvisstr(&nn->key) && !tvisnil(&nn->val) && 489 if (!tvisnil(&nn->val) && hashkey(t, &nn->key) == n) {
490 hashstr(t, strV(&nn->key)) == n) {
491 freenode->next = nn->next; 490 freenode->next = nn->next;
492 nn->next = n->next; 491 nn->next = n->next;
493 setmref(n->next, nn); 492 setmref(n->next, nn);
@@ -500,9 +499,9 @@ TValue *lj_tab_newkey(lua_State *L, GCtab *t, cTValue *key)
500 ** any string key that's currently in a non-main positions. 499 ** any string key that's currently in a non-main positions.
501 */ 500 */
502 while ((nn = nextnode(freenode))) { 501 while ((nn = nextnode(freenode))) {
503 if (tvisstr(&nn->key) && !tvisnil(&nn->val)) { 502 if (!tvisnil(&nn->val)) {
504 Node *mn = hashstr(t, strV(&nn->key)); 503 Node *mn = hashkey(t, &nn->key);
505 if (mn != freenode) { 504 if (mn != freenode && mn != nn) {
506 freenode->next = nn->next; 505 freenode->next = nn->next;
507 nn->next = mn->next; 506 nn->next = mn->next;
508 setmref(mn->next, nn); 507 setmref(mn->next, nn);