[Tarantool-patches] [PATCH v2 luajit 04/45] test: refactor <alias_alloc.lua> LuaJIT test
Sergey Kaplun
skaplun at tarantool.org
Wed Aug 21 11:58:07 MSK 2024
This patch refactors the aforementioned test to make its code style
closer to ours.
Relates to tarantool/tarantool#9398
---
test/LuaJIT-tests/opt/mem/alias_alloc.lua | 15 ++++++++-------
1 file changed, 8 insertions(+), 7 deletions(-)
diff --git a/test/LuaJIT-tests/opt/mem/alias_alloc.lua b/test/LuaJIT-tests/opt/mem/alias_alloc.lua
index 7347169a..a9627b55 100644
--- a/test/LuaJIT-tests/opt/mem/alias_alloc.lua
+++ b/test/LuaJIT-tests/opt/mem/alias_alloc.lua
@@ -1,7 +1,7 @@
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]
@@ -12,9 +12,9 @@ end
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
@@ -25,7 +25,7 @@ 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)
@@ -34,15 +34,16 @@ 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 i=1,100 do x = {x[1]+k[1], x[2]+k[2]} end
+ 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
+
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]
--
2.45.2
More information about the Tarantool-patches
mailing list