Update lua 5.4.3 rc1

This commit is contained in:
Cloud Wu
2021-03-10 11:53:37 +08:00
parent 600a64327e
commit 072d782651
40 changed files with 1017 additions and 694 deletions

View File

@@ -23,7 +23,7 @@
#include "atomic.h"
static unsigned int STRSEED;
static ATOM_SIZET STRID = 0;
static size_t STRID = 0;
/*
** Maximum size for string table.
@@ -60,7 +60,7 @@ void luaS_share (TString *ts) {
if (ts == NULL || isshared(ts))
return;
makeshared(ts);
ts->id = ATOM_FDEC(&STRID) - 1;
ts->id = ATOM_DEC(&STRID);
}
unsigned int luaS_hash (const char *str, size_t l, unsigned int seed) {
@@ -112,7 +112,7 @@ void luaS_resize (lua_State *L, int nsize) {
if (nsize < osize) /* shrinking table? */
tablerehash(tb->hash, osize, nsize); /* depopulate shrinking part */
newvect = luaM_reallocvector(L, tb->hash, osize, nsize, TString*);
if (unlikely(newvect == NULL)) { /* reallocation failed? */
if (l_unlikely(newvect == NULL)) { /* reallocation failed? */
if (nsize < osize) /* was it shrinking table? */
tablerehash(tb->hash, nsize, osize); /* restore to original size */
/* leave table as it was */
@@ -214,7 +214,7 @@ void luaS_remove (lua_State *L, TString *ts) {
static void growstrtab (lua_State *L, stringtable *tb) {
if (unlikely(tb->nuse == MAX_INT)) { /* too many strings? */
if (l_unlikely(tb->nuse == MAX_INT)) { /* too many strings? */
luaC_fullgc(L, 1); /* try to free some... */
if (tb->nuse == MAX_INT) /* still too many? */
luaM_error(L); /* cannot even create a message... */
@@ -265,7 +265,7 @@ TString *luaS_newlstr (lua_State *L, const char *str, size_t l) {
return internshrstr(L, str, l);
else {
TString *ts;
if (unlikely(l >= (MAX_SIZE - sizeof(TString))/sizeof(char)))
if (l_unlikely(l >= (MAX_SIZE - sizeof(TString))/sizeof(char)))
luaM_toobig(L);
ts = luaS_createlngstrobj(L, l);
memcpy(getstr(ts), str, l * sizeof(char));
@@ -301,7 +301,7 @@ Udata *luaS_newudata (lua_State *L, size_t s, int nuvalue) {
Udata *u;
int i;
GCObject *o;
if (unlikely(s > MAX_SIZE - udatamemoffset(nuvalue)))
if (l_unlikely(s > MAX_SIZE - udatamemoffset(nuvalue)))
luaM_toobig(L);
o = luaC_newobj(L, LUA_VUSERDATA, sizeudata(nuvalue, s));
u = gco2u(o);