[Tarantool-patches] [PATCH luajit 02/36] test: enable <alias_alloc.lua> LuaJIT test
Sergey Kaplun
skaplun at tarantool.org
Wed Aug 14 16:55:43 MSK 2024
This patch moves the <alias_alloc.lua> test from the <misc> to the
created <opt/mem> directory, includes it in <index>, and names subtests.
Testing optimizations in <lj_opt_mem.c> requires CSE, DCE, FOLD, and FWD
optimizations enabled. Hence, the corresponding flags are used for the
<mem> directory in <index>.
Part of tarantool/tarantool#9398
---
test/LuaJIT-tests/opt/index | 1 +
.../{misc => opt/mem}/alias_alloc.lua | 30 +++++++++----------
test/LuaJIT-tests/opt/mem/index | 1 +
3 files changed, 16 insertions(+), 16 deletions(-)
rename test/LuaJIT-tests/{misc => opt/mem}/alias_alloc.lua (53%)
create mode 100644 test/LuaJIT-tests/opt/mem/index
diff --git a/test/LuaJIT-tests/opt/index b/test/LuaJIT-tests/opt/index
index 94d50aec..8c43b56e 100644
--- a/test/LuaJIT-tests/opt/index
+++ b/test/LuaJIT-tests/opt/index
@@ -3,4 +3,5 @@ fold +fold
fwd +fwd
fuse.lua +fuse
loop +loop
+mem +cse +dse +fold +fwd
sink +sink
diff --git a/test/LuaJIT-tests/misc/alias_alloc.lua b/test/LuaJIT-tests/opt/mem/alias_alloc.lua
similarity index 53%
rename from test/LuaJIT-tests/misc/alias_alloc.lua
rename to test/LuaJIT-tests/opt/mem/alias_alloc.lua
index 02fe618d..a9627b55 100644
--- a/test/LuaJIT-tests/misc/alias_alloc.lua
+++ b/test/LuaJIT-tests/opt/mem/alias_alloc.lua
@@ -1,8 +1,7 @@
-
-do
+do --- ALOAD forwarding, same table.
local t = {1}
local x
- for i=1,100 do
+ for i = 1, 100 do
local v = {i}
t[1] = v[1]
x = v[1]
@@ -10,45 +9,44 @@ do
assert(x == 100 and t[1] == 100)
end
-do
+do --- ALOAD forwarding, different tables.
local t = {1}
local x,y
- for i=1,100 do
+ for i = 1, 100 do
local v = {i}
- local w = {i+1}
+ local w = {i + 1}
x = v[1]
y = w[1]
end
assert(x == 100 and y == 101)
end
-do
+do --- FLOAD forwarding.
local mt = {}
local t = setmetatable({}, mt)
local x
- for i=1,100 do
+ for _ = 1, 100 do
local v = {}
setmetatable(v, getmetatable(t))
assert(getmetatable(v) == mt)
end
end
--- See also sink_alloc.lua
-do
- local x,k={1,2},{3,4}
- for i=1,100 do x = {x[1]+k[1], x[2]+k[2]} end
+-- See also <opt/sink/alloc.lua>.
+do --- Forwarding the constant-on-trace table in the complex add.
+ local x, k = {1, 2}, {3, 4}
+ for _ = 1, 100 do x = {x[1] + k[1], x[2] + k[2]} end
assert(x[1] == 301)
assert(x[2] == 402)
end
--- FLOAD for tab.asize/tab.array crossing NEWREF.
-do
+
+do --- FLOAD forwarding for tab.asize/tab.array crossing NEWREF.
local t = {1}
- for i=1,100 do
+ for _ = 1, 100 do
local v = {}
local w = {}
v[1] = t[1]
w[1] = t[1]
end
end
-
diff --git a/test/LuaJIT-tests/opt/mem/index b/test/LuaJIT-tests/opt/mem/index
new file mode 100644
index 00000000..0b1856ed
--- /dev/null
+++ b/test/LuaJIT-tests/opt/mem/index
@@ -0,0 +1 @@
+alias_alloc.lua
--
2.45.2
More information about the Tarantool-patches
mailing list