mirror of
https://github.com/ghostty-org/ghostty.git
synced 2026-07-12 04:09:40 +00:00
terminal: reschedule compression after page replacement
Compaction and capacity growth publish fresh page generations, so an active incremental traversal can detect them. They did not update the separate activity token, however, and a completed compressor could remain idle after either operation restored or replaced a cold page. Mark successful replacements as compression activity without resetting the exact continuation marker. The next scheduled step can retain valid progress or restart through the existing generation checks.
This commit is contained in:
@@ -3179,6 +3179,7 @@ pub fn compact(self: *PageList, node: *List.Node) Allocator.Error!?*List.Node {
|
||||
self.pages.insertBefore(node, new_node);
|
||||
self.pages.remove(node);
|
||||
self.destroyNode(node);
|
||||
self.page_compression.markActivity();
|
||||
|
||||
new_page.assertIntegrity();
|
||||
return new_node;
|
||||
@@ -3722,6 +3723,7 @@ pub fn increaseCapacity(
|
||||
self.pages.insertBefore(node, new_node);
|
||||
self.pages.remove(node);
|
||||
self.destroyNode(node);
|
||||
self.page_compression.markActivity();
|
||||
|
||||
new_page.assertIntegrity();
|
||||
return new_node;
|
||||
@@ -6765,6 +6767,34 @@ test "PageList owns incremental compression state" {
|
||||
);
|
||||
}
|
||||
|
||||
test "PageList replacements preserve compression continuation and mark activity" {
|
||||
const testing = std.testing;
|
||||
|
||||
var s = try init(testing.allocator, 80, 24, null);
|
||||
defer s.deinit();
|
||||
|
||||
const state: IncrementalCompressionState = .{
|
||||
.flags = .{ .verifying = true },
|
||||
.activity_serial = 42,
|
||||
.last_serial = 7,
|
||||
.next_serial = 8,
|
||||
};
|
||||
const expected: IncrementalCompressionState = .{
|
||||
.flags = .{ .verifying = true },
|
||||
.activity_serial = 43,
|
||||
.last_serial = 7,
|
||||
.next_serial = 8,
|
||||
};
|
||||
|
||||
s.page_compression = state;
|
||||
const replacement = try s.increaseCapacity(s.pages.first.?, null);
|
||||
try testing.expectEqual(expected, s.page_compression);
|
||||
|
||||
s.page_compression = state;
|
||||
_ = (try s.compact(replacement)).?;
|
||||
try testing.expectEqual(expected, s.page_compression);
|
||||
}
|
||||
|
||||
test "PageList incremental compression bounds inspected pages" {
|
||||
const testing = std.testing;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user