mirror of
https://github.com/luau-lang/luau.git
synced 2024-11-15 14:25:44 +08:00
Merge branch 'master' into merge
This commit is contained in:
commit
f4ecf437ba
2
.github/workflows/benchmark.yml
vendored
2
.github/workflows/benchmark.yml
vendored
@ -77,10 +77,12 @@ jobs:
|
||||
valgrind --tool=callgrind ./luau-compile --null -O1 bench/other/LuauPolyfillMap.lua 2>&1 | filter map-O1 | tee -a compile-output.txt
|
||||
valgrind --tool=callgrind ./luau-compile --null -O2 bench/other/LuauPolyfillMap.lua 2>&1 | filter map-O2 | tee -a compile-output.txt
|
||||
valgrind --tool=callgrind ./luau-compile --codegennull -O2 bench/other/LuauPolyfillMap.lua 2>&1 | filter map-O2-codegen | tee -a compile-output.txt
|
||||
valgrind --tool=callgrind ./luau-compile --codegennull -O2 -t1 bench/other/LuauPolyfillMap.lua 2>&1 | filter map-O2-t1-codegen | tee -a compile-output.txt
|
||||
valgrind --tool=callgrind ./luau-compile --null -O0 bench/other/regex.lua 2>&1 | filter regex-O0 | tee -a compile-output.txt
|
||||
valgrind --tool=callgrind ./luau-compile --null -O1 bench/other/regex.lua 2>&1 | filter regex-O1 | tee -a compile-output.txt
|
||||
valgrind --tool=callgrind ./luau-compile --null -O2 bench/other/regex.lua 2>&1 | filter regex-O2 | tee -a compile-output.txt
|
||||
valgrind --tool=callgrind ./luau-compile --codegennull -O2 bench/other/regex.lua 2>&1 | filter regex-O2-codegen | tee -a compile-output.txt
|
||||
valgrind --tool=callgrind ./luau-compile --codegennull -O2 -t1 bench/other/regex.lua 2>&1 | filter regex-O2-t1-codegen | tee -a compile-output.txt
|
||||
|
||||
- name: Checkout benchmark results
|
||||
uses: actions/checkout@v3
|
||||
|
@ -826,7 +826,7 @@ void AssemblyBuilderX64::vcvtss2sd(OperandX64 dst, OperandX64 src1, OperandX64 s
|
||||
else
|
||||
CODEGEN_ASSERT(src2.memSize == SizeX64::dword);
|
||||
|
||||
placeAvx("vcvtsd2ss", dst, src1, src2, 0x5a, false, AVX_0F, AVX_F3);
|
||||
placeAvx("vcvtss2sd", dst, src1, src2, 0x5a, false, AVX_0F, AVX_F3);
|
||||
}
|
||||
|
||||
void AssemblyBuilderX64::vroundsd(OperandX64 dst, OperandX64 src1, OperandX64 src2, RoundingModeX64 roundingMode)
|
||||
|
@ -12,6 +12,7 @@
|
||||
#include "lvm.h"
|
||||
|
||||
LUAU_DYNAMIC_FASTFLAGVARIABLE(LuauFastCrossTableMove, false)
|
||||
LUAU_DYNAMIC_FASTFLAGVARIABLE(LuauFasterConcat, false)
|
||||
|
||||
static int foreachi(lua_State* L)
|
||||
{
|
||||
@ -282,31 +283,42 @@ static int tmove(lua_State* L)
|
||||
return 1;
|
||||
}
|
||||
|
||||
static void addfield(lua_State* L, luaL_Strbuf* b, int i)
|
||||
static void addfield(lua_State* L, luaL_Strbuf* b, int i, Table* t)
|
||||
{
|
||||
if (DFFlag::LuauFasterConcat && t && unsigned(i - 1) < unsigned(t->sizearray) && ttisstring(&t->array[i - 1]))
|
||||
{
|
||||
TString* ts = tsvalue(&t->array[i - 1]);
|
||||
luaL_addlstring(b, getstr(ts), ts->len);
|
||||
}
|
||||
else
|
||||
{
|
||||
int tt = lua_rawgeti(L, 1, i);
|
||||
if (tt != LUA_TSTRING && tt != LUA_TNUMBER)
|
||||
luaL_error(L, "invalid value (%s) at index %d in table for 'concat'", luaL_typename(L, -1), i);
|
||||
luaL_addvalue(b);
|
||||
}
|
||||
}
|
||||
|
||||
static int tconcat(lua_State* L)
|
||||
{
|
||||
luaL_Strbuf b;
|
||||
size_t lsep;
|
||||
int i, last;
|
||||
const char* sep = luaL_optlstring(L, 2, "", &lsep);
|
||||
luaL_checktype(L, 1, LUA_TTABLE);
|
||||
i = luaL_optinteger(L, 3, 1);
|
||||
last = luaL_opt(L, luaL_checkinteger, 4, lua_objlen(L, 1));
|
||||
int i = luaL_optinteger(L, 3, 1);
|
||||
int last = luaL_opt(L, luaL_checkinteger, 4, lua_objlen(L, 1));
|
||||
|
||||
Table* t = DFFlag::LuauFasterConcat ? hvalue(L->base) : NULL;
|
||||
|
||||
luaL_Strbuf b;
|
||||
luaL_buffinit(L, &b);
|
||||
for (; i < last; i++)
|
||||
{
|
||||
addfield(L, &b, i);
|
||||
addfield(L, &b, i, t);
|
||||
if (!DFFlag::LuauFasterConcat || lsep != 0)
|
||||
luaL_addlstring(&b, sep, lsep);
|
||||
}
|
||||
if (i == last) // add last value (if interval was not empty)
|
||||
addfield(L, &b, i);
|
||||
addfield(L, &b, i, t);
|
||||
luaL_pushresult(&b);
|
||||
return 1;
|
||||
}
|
||||
|
@ -412,6 +412,34 @@ do
|
||||
assert(table.find({[(1)] = true}, true) == 1)
|
||||
end
|
||||
|
||||
-- test table.concat
|
||||
do
|
||||
-- regular usage
|
||||
assert(table.concat({}) == "")
|
||||
assert(table.concat({}, ",") == "")
|
||||
assert(table.concat({"a", "b", "c"}, ",") == "a,b,c")
|
||||
assert(table.concat({"a", "b", "c"}, ",", 2) == "b,c")
|
||||
assert(table.concat({"a", "b", "c"}, ",", 1, 2) == "a,b")
|
||||
|
||||
-- hash elements
|
||||
local t = {}
|
||||
t[123] = "a"
|
||||
t[124] = "b"
|
||||
|
||||
assert(table.concat(t) == "")
|
||||
assert(table.concat(t, ",", 123, 124) == "a,b")
|
||||
assert(table.concat(t, ",", 123, 123) == "a")
|
||||
|
||||
-- numeric values
|
||||
assert(table.concat({1, 2, 3}, ",") == "1,2,3")
|
||||
assert(table.concat({"a", 2, "c"}, ",") == "a,2,c")
|
||||
|
||||
-- error cases
|
||||
assert(pcall(table.concat, "") == false)
|
||||
assert(pcall(table.concat, t, false) == false)
|
||||
assert(pcall(table.concat, t, ",", 1, 100) == false)
|
||||
end
|
||||
|
||||
-- test indexing with strings that have zeroes embedded in them
|
||||
do
|
||||
local t = {}
|
||||
|
Loading…
Reference in New Issue
Block a user