Merge branch 'master' into merge

This commit is contained in:
Vighnesh 2024-06-14 09:40:20 -07:00
commit 91790efb8d
3 changed files with 9 additions and 11 deletions

View file

@ -23,11 +23,10 @@
#define GCSsweep 4 #define GCSsweep 4
/* /*
** macro to tell when main invariant (white objects cannot point to black ** The main invariant of the garbage collector, while marking objects,
** ones) must be kept. During a collection, the sweep ** is that a black object can never point to a white one. This invariant
** phase may break the invariant, as objects turned white may point to ** is not being enforced during a sweep phase, and is restored when sweep
** still-black objects. The invariant is restored when sweep ends and ** ends.
** all objects are white again.
*/ */
#define keepinvariant(g) ((g)->gcstate == GCSpropagate || (g)->gcstate == GCSpropagateagain || (g)->gcstate == GCSatomic) #define keepinvariant(g) ((g)->gcstate == GCSpropagate || (g)->gcstate == GCSpropagateagain || (g)->gcstate == GCSatomic)

View file

@ -726,16 +726,15 @@ assert((function()
return sum return sum
end)() == 15) end)() == 15)
-- the reason why this test is interesting is that the table created here has arraysize=0 and a single hash element with key = 1.0 -- ipairs will not iterate through hash part
-- ipairs must iterate through that
assert((function() assert((function()
local arr = { [1] = 42 } local arr = { [1] = 1, [42] = 42, x = 10 }
local sum = 0 local sum = 0
for i,v in ipairs(arr) do for i,v in ipairs(arr) do
sum = sum + v sum = sum + v
end end
return sum return sum
end)() == 42) end)() == 1)
-- the reason why this test is interesting is it ensures we do correct mutability analysis for locals -- the reason why this test is interesting is it ensures we do correct mutability analysis for locals
local function chainTest(n) local function chainTest(n)

View file

@ -412,8 +412,8 @@ do
assert(table.find({false, true}, true) == 2) assert(table.find({false, true}, true) == 2)
-- make sure table.find checks the hash portion as well by constructing a table literal that forces the value into the hash part -- make sure table.find checks the hash portion as well
assert(table.find({[(1)] = true}, true) == 1) assert(table.find({[(2)] = true}, true, 2) == 2)
end end
-- test table.concat -- test table.concat