mirror of
https://github.com/luau-lang/luau.git
synced 2024-12-14 14:11:08 +00:00
Make 32 bit happy and adapt tests
This commit is contained in:
parent
e7bcc0d98b
commit
703a0e3111
2 changed files with 6 additions and 6 deletions
|
@ -232,9 +232,9 @@ static LuaNode* relink(GCObject* o, LuaNode* n, LuaNode* list) {
|
||||||
gkey(n)->extra[0] = static_cast<int>(static_cast<uint32_t>(intptr & 0xFFFFFFFF));
|
gkey(n)->extra[0] = static_cast<int>(static_cast<uint32_t>(intptr & 0xFFFFFFFF));
|
||||||
// Save the link to the next worklist entry in the key extra slot and value tt slot.
|
// Save the link to the next worklist entry in the key extra slot and value tt slot.
|
||||||
// Note: The value tt is saved in the key tt which can be restored from the key GCObject.
|
// Note: The value tt is saved in the key tt which can be restored from the key GCObject.
|
||||||
if (sizeof(uintptr_t) > 4) {
|
if /* constexpr */ (sizeof(uintptr_t) > 4) {
|
||||||
LUAU_ASSERT(sizeof(uintptr_t) <= 8);
|
LUAU_ASSERT(sizeof(uintptr_t) <= 8);
|
||||||
gval(n)->tt = static_cast<int>(static_cast<uint32_t>(intptr >> 32));
|
gval(n)->tt = static_cast<int>(static_cast<uint32_t>(static_cast<uint64_t>(intptr) >> 32));
|
||||||
}
|
}
|
||||||
return n;
|
return n;
|
||||||
}
|
}
|
||||||
|
@ -273,8 +273,8 @@ static LuaNode* nextandrestore(LuaNode* n) {
|
||||||
uintptr_t intptr = static_cast<uint32_t>(gkey(n)->extra[0]);
|
uintptr_t intptr = static_cast<uint32_t>(gkey(n)->extra[0]);
|
||||||
// Rebuild ptr to next element in the worklist which is stored in the key extra value
|
// Rebuild ptr to next element in the worklist which is stored in the key extra value
|
||||||
// and the tt slot of the value.
|
// and the tt slot of the value.
|
||||||
if (sizeof(uintptr_t) > 4) {
|
if /* constexpr */ (sizeof(uintptr_t) > 4) {
|
||||||
intptr |= static_cast<uintptr_t>(static_cast<uint32_t>(gval(n)->tt)) << 32;
|
intptr |= static_cast<uintptr_t>(static_cast<uint64_t>(static_cast<uint32_t>(gval(n)->tt)) << 32);
|
||||||
}
|
}
|
||||||
ttype(gval(n)) = ttype(gkey(n)); // Value tt is saved in the key tt.
|
ttype(gval(n)) = ttype(gkey(n)); // Value tt is saved in the key tt.
|
||||||
ttype(gkey(n)) = gcvalue(gkey(n))->gch.tt; // Key tt can be restored from the key gc value.
|
ttype(gkey(n)) = gcvalue(gkey(n))->gch.tt; // Key tt can be restored from the key gc value.
|
||||||
|
|
|
@ -132,14 +132,14 @@ print('weak tables')
|
||||||
a = {}; setmetatable(a, {__mode = 'k'});
|
a = {}; setmetatable(a, {__mode = 'k'});
|
||||||
-- fill a with some `collectable' indices
|
-- fill a with some `collectable' indices
|
||||||
for i=1,lim do a[{}] = i end
|
for i=1,lim do a[{}] = i end
|
||||||
-- and some non-collectable ones
|
|
||||||
for i=1,lim do local t={}; a[t]=t end
|
for i=1,lim do local t={}; a[t]=t end
|
||||||
|
-- and some non-collectable ones
|
||||||
for i=1,lim do a[i] = i end
|
for i=1,lim do a[i] = i end
|
||||||
for i=1,lim do local s=string.rep('@', i); a[s] = s..'#' end
|
for i=1,lim do local s=string.rep('@', i); a[s] = s..'#' end
|
||||||
collectgarbage()
|
collectgarbage()
|
||||||
local i = 0
|
local i = 0
|
||||||
for k,v in pairs(a) do assert(k==v or k..'#'==v); i=i+1 end
|
for k,v in pairs(a) do assert(k==v or k..'#'==v); i=i+1 end
|
||||||
assert(i == 3*lim)
|
assert(i == 2*lim)
|
||||||
|
|
||||||
a = {}; setmetatable(a, {__mode = 'v'});
|
a = {}; setmetatable(a, {__mode = 'v'});
|
||||||
a[1] = string.rep('b', 21)
|
a[1] = string.rep('b', 21)
|
||||||
|
|
Loading…
Reference in a new issue