Update LuaJIT to the latest 2.1.0 source (f3c8569)

This commit is contained in:
Alex Szpakowski
2021-12-03 20:50:23 -04:00
parent 4f24e5473f
commit c3986a9541
216 changed files with 6026 additions and 1838 deletions
+7 -11
View File
@@ -1,6 +1,6 @@
/*
** Lexical analyzer.
** Copyright (C) 2005-2020 Mike Pall. See Copyright Notice in luajit.h
** Copyright (C) 2005-2021 Mike Pall. See Copyright Notice in luajit.h
**
** Major portions taken verbatim or adapted from the Lua interpreter.
** Copyright (C) 1994-2008 Lua.org, PUC-Rio. See Copyright Notice in lua.h
@@ -105,7 +105,7 @@ static void lex_number(LexState *ls, TValue *tv)
lex_savenext(ls);
}
lex_save(ls, '\0');
fmt = lj_strscan_scan((const uint8_t *)sbufB(&ls->sb), sbuflen(&ls->sb)-1, tv,
fmt = lj_strscan_scan((const uint8_t *)ls->sb.b, sbuflen(&ls->sb)-1, tv,
(LJ_DUALNUM ? STRSCAN_OPT_TOINT : STRSCAN_OPT_TONUM) |
(LJ_HASFFI ? (STRSCAN_OPT_LL|STRSCAN_OPT_IMAG) : 0));
if (LJ_DUALNUM && fmt == STRSCAN_INT) {
@@ -118,11 +118,7 @@ static void lex_number(LexState *ls, TValue *tv)
GCcdata *cd;
lj_assertLS(fmt == STRSCAN_I64 || fmt == STRSCAN_U64 || fmt == STRSCAN_IMAG,
"unexpected number format %d", fmt);
if (!ctype_ctsG(G(L))) {
ptrdiff_t oldtop = savestack(L, L->top);
luaopen_ffi(L); /* Load FFI library on-demand. */
L->top = restorestack(L, oldtop);
}
ctype_loadffi(L);
if (fmt == STRSCAN_IMAG) {
cd = lj_cdata_new_(L, CTID_COMPLEX_DOUBLE, 2*sizeof(double));
((double *)cdataptr(cd))[0] = 0;
@@ -180,7 +176,7 @@ static void lex_longstring(LexState *ls, TValue *tv, int sep)
}
} endloop:
if (tv) {
GCstr *str = lj_parse_keepstr(ls, sbufB(&ls->sb) + (2 + (MSize)sep),
GCstr *str = lj_parse_keepstr(ls, ls->sb.b + (2 + (MSize)sep),
sbuflen(&ls->sb) - 2*(2 + (MSize)sep));
setstrV(ls->L, tv, str);
}
@@ -286,7 +282,7 @@ static void lex_string(LexState *ls, TValue *tv)
}
lex_savenext(ls); /* Skip trailing delimiter. */
setstrV(ls->L, tv,
lj_parse_keepstr(ls, sbufB(&ls->sb)+1, sbuflen(&ls->sb)-2));
lj_parse_keepstr(ls, ls->sb.b+1, sbuflen(&ls->sb)-2));
}
/* -- Main lexical scanner ------------------------------------------------ */
@@ -306,7 +302,7 @@ static LexToken lex_scan(LexState *ls, TValue *tv)
do {
lex_savenext(ls);
} while (lj_char_isident(ls->c));
s = lj_parse_keepstr(ls, sbufB(&ls->sb), sbuflen(&ls->sb));
s = lj_parse_keepstr(ls, ls->sb.b, sbuflen(&ls->sb));
setstrV(ls->L, tv, s);
if (s->reserved > 0) /* Reserved word? */
return TK_OFS + s->reserved;
@@ -496,7 +492,7 @@ void lj_lex_error(LexState *ls, LexToken tok, ErrMsg em, ...)
tokstr = NULL;
} else if (tok == TK_name || tok == TK_string || tok == TK_number) {
lex_save(ls, '\0');
tokstr = sbufB(&ls->sb);
tokstr = ls->sb.b;
} else {
tokstr = lj_lex_token2str(ls, tok);
}