Reduce spare capacity for large executor address tables
Build check / check (push) Failing after 27m14s

This commit is contained in:
waozi committed 2026-11-20 17:10:22 -03:00
1 parent fc11f5cefb
commit 5462fe2ebf
2 files changed
+9 -7

No files matched your search

+7 -5
View File
@@ -1973,16 +1973,18 @@ ExecAddressSlots :: 2097151
ExecAddressVersions :: 268435455
// Large VM vectors can stay near their peak for the lifetime of a guest.
// Leave some geometric headroom for repeated growth, capped at one eighth
// of the old capacity. The caller has already checked count against maximum.
ExecGrowthCeiling :: (count: s64, capacity: s64, maximum: s64, small: s64) -> s64 #inline {
// Limit geometric growth to a fraction of the old capacity. The caller
// has already checked count against maximum.
ExecGrowthCeiling :: (count: s64, capacity: s64, maximum: s64, small: s64, growth_divisor: s64 = 8) -> s64 #inline {
if count <= capacity || count <= small { return maximum }
spare := capacity / 8
spare := capacity / growth_divisor
return count + (ifx spare < maximum - count then spare else maximum - count)
}
ExecResizeAddresses :: (instance: *LirExecInstance, count: s64, maximum: s64) -> bool {
ceiling := ExecGrowthCeiling(count, instance.addresses.capacity, maximum, 1024)
// Address records are large and realloc may hold both tables at once.
// Keep some geometric headroom without needing a much larger free block.
ceiling := ExecGrowthCeiling(count, instance.addresses.capacity, maximum, 1024, 64)
if VecResizeBounded(instance.addresses, count, ceiling) { return true }
return count > instance.addresses.capacity && count < ceiling &&
VecResizeBounded(instance.addresses, count, count)
+2 -2
View File
@@ -1109,7 +1109,7 @@ HeapResize :: () -> bool {
// A frame holds a fresh address on each iteration. Reusing the same
// instance recycles those slots and keeps the backing capacity stable.
AddressGrowthAndChurn :: () -> bool {
count := cast(s64)3500
count := cast(s64)7000
types: [4]LirType = .[.{.kind = .Void}, .{.kind = .Integer, .bits = 32, .is_signed = true},
.{.kind = .Bool, .bits = 1}, .{.kind = .Pointer, .element = 1}]
constants: [3]LirConstant = .[
@@ -1150,7 +1150,7 @@ AddressGrowthAndChurn :: () -> bool {
first := LirExecRun(*instance)
capacity := instance.addresses.capacity
if first.problem != .None || first.value.bits != 1 || instance.addresses.count != count ||
capacity < count || capacity > count + count / 8 { return false }
capacity < count || capacity > count + count / 64 { return false }
for attempt: 1..4 {
reused := LirExecRun(*instance)
if reused.problem != .None || reused.value.bits != 1 || instance.addresses.count != count ||