mirror of
https://github.com/cloudwu/skynet.git
synced 2026-07-24 20:23:06 +00:00
Lua 5.4.4 rc3
This commit is contained in:
@@ -607,7 +607,7 @@ static int luaK_numberK (FuncState *fs, lua_Number r) {
|
|||||||
return addk(fs, &o, &o); /* use number itself as key */
|
return addk(fs, &o, &o); /* use number itself as key */
|
||||||
else { /* must build an alternative key */
|
else { /* must build an alternative key */
|
||||||
const int nbm = l_floatatt(MANT_DIG);
|
const int nbm = l_floatatt(MANT_DIG);
|
||||||
const lua_Number q = l_mathop(ldexp)(1.0, -nbm + 1);
|
const lua_Number q = l_mathop(ldexp)(l_mathop(1.0), -nbm + 1);
|
||||||
const lua_Number k = (ik == 0) ? q : r + r*q; /* new key */
|
const lua_Number k = (ik == 0) ? q : r + r*q; /* new key */
|
||||||
TValue kv;
|
TValue kv;
|
||||||
setfltvalue(&kv, k);
|
setfltvalue(&kv, k);
|
||||||
|
|||||||
@@ -909,7 +909,7 @@ static void GCTM (lua_State *L) {
|
|||||||
int status;
|
int status;
|
||||||
lu_byte oldah = L->allowhook;
|
lu_byte oldah = L->allowhook;
|
||||||
int oldgcstp = g->gcstp;
|
int oldgcstp = g->gcstp;
|
||||||
g->gcstp = GCSTPGC; /* avoid GC steps */
|
g->gcstp |= GCSTPGC; /* avoid GC steps */
|
||||||
L->allowhook = 0; /* stop debug hooks during GC metamethod */
|
L->allowhook = 0; /* stop debug hooks during GC metamethod */
|
||||||
setobj2s(L, L->top++, tm); /* push finalizer... */
|
setobj2s(L, L->top++, tm); /* push finalizer... */
|
||||||
setobj2s(L, L->top++, &v); /* ... and its argument */
|
setobj2s(L, L->top++, &v); /* ... and its argument */
|
||||||
@@ -1013,7 +1013,8 @@ static void correctpointers (global_State *g, GCObject *o) {
|
|||||||
void luaC_checkfinalizer (lua_State *L, GCObject *o, Table *mt) {
|
void luaC_checkfinalizer (lua_State *L, GCObject *o, Table *mt) {
|
||||||
global_State *g = G(L);
|
global_State *g = G(L);
|
||||||
if (tofinalize(o) || /* obj. is already marked... */
|
if (tofinalize(o) || /* obj. is already marked... */
|
||||||
gfasttm(g, mt, TM_GC) == NULL) /* or has no finalizer? */
|
gfasttm(g, mt, TM_GC) == NULL || /* or has no finalizer... */
|
||||||
|
(g->gcstp & GCSTPCLS)) /* or closing state? */
|
||||||
return; /* nothing to be done */
|
return; /* nothing to be done */
|
||||||
else { /* move 'o' to 'finobj' list */
|
else { /* move 'o' to 'finobj' list */
|
||||||
GCObject **p;
|
GCObject **p;
|
||||||
@@ -1508,14 +1509,13 @@ static void deletelist (lua_State *L, GCObject *p, GCObject *limit) {
|
|||||||
*/
|
*/
|
||||||
void luaC_freeallobjects (lua_State *L) {
|
void luaC_freeallobjects (lua_State *L) {
|
||||||
global_State *g = G(L);
|
global_State *g = G(L);
|
||||||
g->gcstp = GCSTPGC;
|
g->gcstp = GCSTPCLS; /* no extra finalizers after here */
|
||||||
luaC_changemode(L, KGC_INC);
|
luaC_changemode(L, KGC_INC);
|
||||||
separatetobefnz(g, 1); /* separate all objects with finalizers */
|
separatetobefnz(g, 1); /* separate all objects with finalizers */
|
||||||
lua_assert(g->finobj == NULL);
|
lua_assert(g->finobj == NULL);
|
||||||
g->gcstp = 0;
|
|
||||||
callallpendingfinalizers(L);
|
callallpendingfinalizers(L);
|
||||||
deletelist(L, g->allgc, obj2gco(g->mainthread));
|
deletelist(L, g->allgc, obj2gco(g->mainthread));
|
||||||
deletelist(L, g->finobj, NULL);
|
lua_assert(g->finobj == NULL); /* no new finalizers */
|
||||||
deletelist(L, g->fixedgc, NULL); /* collect fixed objects */
|
deletelist(L, g->fixedgc, NULL); /* collect fixed objects */
|
||||||
lua_assert(g->strt.nuse == 0);
|
lua_assert(g->strt.nuse == 0);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -159,6 +159,7 @@
|
|||||||
*/
|
*/
|
||||||
#define GCSTPUSR 1 /* bit true when GC stopped by user */
|
#define GCSTPUSR 1 /* bit true when GC stopped by user */
|
||||||
#define GCSTPGC 2 /* bit true when GC stopped by itself */
|
#define GCSTPGC 2 /* bit true when GC stopped by itself */
|
||||||
|
#define GCSTPCLS 4 /* bit true when closing Lua state */
|
||||||
#define gcrunning(g) ((g)->gcstp == 0)
|
#define gcrunning(g) ((g)->gcstp == 0)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -475,7 +475,7 @@ static lua_Number I2d (Rand64 x) {
|
|||||||
|
|
||||||
/* 2^(-FIGS) = 1.0 / 2^30 / 2^3 / 2^(FIGS-33) */
|
/* 2^(-FIGS) = 1.0 / 2^30 / 2^3 / 2^(FIGS-33) */
|
||||||
#define scaleFIG \
|
#define scaleFIG \
|
||||||
((lua_Number)1.0 / (UONE << 30) / 8.0 / (UONE << (FIGS - 33)))
|
(l_mathop(1.0) / (UONE << 30) / l_mathop(8.0) / (UONE << (FIGS - 33)))
|
||||||
|
|
||||||
/*
|
/*
|
||||||
** use FIGS - 32 bits from lower half, throwing out the other
|
** use FIGS - 32 bits from lower half, throwing out the other
|
||||||
@@ -486,7 +486,7 @@ static lua_Number I2d (Rand64 x) {
|
|||||||
/*
|
/*
|
||||||
** higher 32 bits go after those (FIGS - 32) bits: shiftHI = 2^(FIGS - 32)
|
** higher 32 bits go after those (FIGS - 32) bits: shiftHI = 2^(FIGS - 32)
|
||||||
*/
|
*/
|
||||||
#define shiftHI ((lua_Number)(UONE << (FIGS - 33)) * 2.0)
|
#define shiftHI ((lua_Number)(UONE << (FIGS - 33)) * l_mathop(2.0))
|
||||||
|
|
||||||
|
|
||||||
static lua_Number I2d (Rand64 x) {
|
static lua_Number I2d (Rand64 x) {
|
||||||
|
|||||||
@@ -164,7 +164,7 @@ static int isneg (const char **s) {
|
|||||||
*/
|
*/
|
||||||
static lua_Number lua_strx2number (const char *s, char **endptr) {
|
static lua_Number lua_strx2number (const char *s, char **endptr) {
|
||||||
int dot = lua_getlocaledecpoint();
|
int dot = lua_getlocaledecpoint();
|
||||||
lua_Number r = 0.0; /* result (accumulator) */
|
lua_Number r = l_mathop(0.0); /* result (accumulator) */
|
||||||
int sigdig = 0; /* number of significant digits */
|
int sigdig = 0; /* number of significant digits */
|
||||||
int nosigdig = 0; /* number of non-significant digits */
|
int nosigdig = 0; /* number of non-significant digits */
|
||||||
int e = 0; /* exponent correction */
|
int e = 0; /* exponent correction */
|
||||||
@@ -174,7 +174,7 @@ static lua_Number lua_strx2number (const char *s, char **endptr) {
|
|||||||
while (lisspace(cast_uchar(*s))) s++; /* skip initial spaces */
|
while (lisspace(cast_uchar(*s))) s++; /* skip initial spaces */
|
||||||
neg = isneg(&s); /* check sign */
|
neg = isneg(&s); /* check sign */
|
||||||
if (!(*s == '0' && (*(s + 1) == 'x' || *(s + 1) == 'X'))) /* check '0x' */
|
if (!(*s == '0' && (*(s + 1) == 'x' || *(s + 1) == 'X'))) /* check '0x' */
|
||||||
return 0.0; /* invalid format (no '0x') */
|
return l_mathop(0.0); /* invalid format (no '0x') */
|
||||||
for (s += 2; ; s++) { /* skip '0x' and read numeral */
|
for (s += 2; ; s++) { /* skip '0x' and read numeral */
|
||||||
if (*s == dot) {
|
if (*s == dot) {
|
||||||
if (hasdot) break; /* second dot? stop loop */
|
if (hasdot) break; /* second dot? stop loop */
|
||||||
@@ -184,14 +184,14 @@ static lua_Number lua_strx2number (const char *s, char **endptr) {
|
|||||||
if (sigdig == 0 && *s == '0') /* non-significant digit (zero)? */
|
if (sigdig == 0 && *s == '0') /* non-significant digit (zero)? */
|
||||||
nosigdig++;
|
nosigdig++;
|
||||||
else if (++sigdig <= MAXSIGDIG) /* can read it without overflow? */
|
else if (++sigdig <= MAXSIGDIG) /* can read it without overflow? */
|
||||||
r = (r * cast_num(16.0)) + luaO_hexavalue(*s);
|
r = (r * l_mathop(16.0)) + luaO_hexavalue(*s);
|
||||||
else e++; /* too many digits; ignore, but still count for exponent */
|
else e++; /* too many digits; ignore, but still count for exponent */
|
||||||
if (hasdot) e--; /* decimal digit? correct exponent */
|
if (hasdot) e--; /* decimal digit? correct exponent */
|
||||||
}
|
}
|
||||||
else break; /* neither a dot nor a digit */
|
else break; /* neither a dot nor a digit */
|
||||||
}
|
}
|
||||||
if (nosigdig + sigdig == 0) /* no digits? */
|
if (nosigdig + sigdig == 0) /* no digits? */
|
||||||
return 0.0; /* invalid format */
|
return l_mathop(0.0); /* invalid format */
|
||||||
*endptr = cast_charp(s); /* valid up to here */
|
*endptr = cast_charp(s); /* valid up to here */
|
||||||
e *= 4; /* each digit multiplies/divides value by 2^4 */
|
e *= 4; /* each digit multiplies/divides value by 2^4 */
|
||||||
if (*s == 'p' || *s == 'P') { /* exponent part? */
|
if (*s == 'p' || *s == 'P') { /* exponent part? */
|
||||||
@@ -200,7 +200,7 @@ static lua_Number lua_strx2number (const char *s, char **endptr) {
|
|||||||
s++; /* skip 'p' */
|
s++; /* skip 'p' */
|
||||||
neg1 = isneg(&s); /* sign */
|
neg1 = isneg(&s); /* sign */
|
||||||
if (!lisdigit(cast_uchar(*s)))
|
if (!lisdigit(cast_uchar(*s)))
|
||||||
return 0.0; /* invalid; must have at least one digit */
|
return l_mathop(0.0); /* invalid; must have at least one digit */
|
||||||
while (lisdigit(cast_uchar(*s))) /* read exponent */
|
while (lisdigit(cast_uchar(*s))) /* read exponent */
|
||||||
exp1 = exp1 * 10 + *(s++) - '0';
|
exp1 = exp1 * 10 + *(s++) - '0';
|
||||||
if (neg1) exp1 = -exp1;
|
if (neg1) exp1 = -exp1;
|
||||||
|
|||||||
@@ -25,7 +25,7 @@
|
|||||||
|
|
||||||
#define LUA_VERSION "Lua " LUA_VERSION_MAJOR "." LUA_VERSION_MINOR
|
#define LUA_VERSION "Lua " LUA_VERSION_MAJOR "." LUA_VERSION_MINOR
|
||||||
#define LUA_RELEASE LUA_VERSION "." LUA_VERSION_RELEASE
|
#define LUA_RELEASE LUA_VERSION "." LUA_VERSION_RELEASE
|
||||||
#define LUA_COPYRIGHT LUA_RELEASE " Copyright (C) 1994-2021 Lua.org, PUC-Rio"
|
#define LUA_COPYRIGHT LUA_RELEASE " Copyright (C) 1994-2022 Lua.org, PUC-Rio"
|
||||||
#define LUA_AUTHORS "R. Ierusalimschy, L. H. de Figueiredo, W. Celes"
|
#define LUA_AUTHORS "R. Ierusalimschy, L. H. de Figueiredo, W. Celes"
|
||||||
|
|
||||||
|
|
||||||
@@ -496,7 +496,7 @@ struct lua_Debug {
|
|||||||
|
|
||||||
|
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
* Copyright (C) 1994-2021 Lua.org, PUC-Rio.
|
* Copyright (C) 1994-2022 Lua.org, PUC-Rio.
|
||||||
*
|
*
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining
|
* Permission is hereby granted, free of charge, to any person obtaining
|
||||||
* a copy of this software and associated documentation files (the
|
* a copy of this software and associated documentation files (the
|
||||||
|
|||||||
Reference in New Issue
Block a user