Hi! > On 20 Sep 2021, at 11:38, Sergey Kaplun wrote: > > Hi, Sergos! > > Thanks for the review! > > On 15.09.21, sergos wrote: [...] >>> +++ b/test/tarantool-tests/lj-727-lightuserdata-itern.test.lua >>> @@ -0,0 +1,48 @@ >>> +local tap = require('tap') >>> + >>> +-- Test file to demonstrate next FF incorrect behaviour on LJ_64. >>> +-- See also, https://github.com/LuaJIT/LuaJIT/issues/727. >>> + >>> +local test = tap.test('lj-727-lightuserdata-itern') >>> +test:plan(1) >>> + >>> +local ud = require('lightuserdata').craft_ptr_wp() >>> + >>> +-- We now have the tagged lightuuserdata pointer >>> +-- 0xFFFE7FFF00000002 in the up before this patch (after the patch >>> +-- the maximum available lightuserdata segment is 0xffe). >> >> Shall we end the test here with just an expectation of an error? >> I believe you can make a way simpler test: pcall(craft_ptr()) should work >> successfully 254 times and error on an 255th one, isn’t it? > > Not exactly, I think. > The main idea of the test -- generate as much lightuserdata objects as > we can, and save them in the same table. After that we check that > iteration by them is correct. > > Test you suggested doesn't show up the possible issue with ITERN, does > it? Exactly. I don’t see any reason to force the situation showing that you can’t use the LUD segment beyond particular value. The test can be that simple showing the max segment is 254, not 255 - exactly the functionality that is added to the code. So, it should fail at creation of 255th segment and it will be the positive outcome of the test. If there’s no error - the test fails. It will simplify the test considerably. Also, you should not have such long explanation of ITERN/ITERC - just say "the 255th segment is forbidden, since its encoding is overlapped with control variable used by ISNEXT”. I would recommend to wait for the 2nd reviewer here - especially if you discussed the patch before submit. Regards, Sergos