27 Commits

Author SHA1 Message Date
Mitchell Hashimoto
4d0bf303c6 ci: zig fmt check
This adds a CI test to ensure that all Zig files are properly formatted.
This avoids unrelated diff noise in future PRs.
2025-03-18 13:58:49 -07:00
Mitchell Hashimoto
7e2286eb8c Zig 0.14 2025-03-11 14:39:04 -07:00
Qwerasd
a1b682d0da fix(terminal): properly lookup hyperlinks when cloning rows across pages
Before this we were doing bad things with the memory, looking at
`PageEntry`s for links not actually in the page we were reading the
strings from.
2025-02-10 15:52:40 -05:00
Qwerasd
56cbbd940b perf(RefCountedSet): make swap metric prioritize high refcount items
This experimentally yields a ~20% performance improvement as measured by
running DOOM-fire-zig, which is honestly a lot more than I expected.
2024-12-23 21:41:51 -05:00
Qwerasd
cb60f9d1da fix(RefCountedSet): Gracefully handle pathological cases
Poor hash uniformity and/or a crafted or unlucky input could cause the
bounds of the PSL stats array to be exceeded, which caused memory
corruption (not good!) -- we avoid such cases now by returning an
OutOfMemory error if we're about to insert and there's an item with a
PSL in the last slot.
2024-12-23 16:03:26 -05:00
Qwerasd
a51871a3f7 RefCountedSet: simplify insert logic, cleanup, improve comments
Previous logic had multiple issues that were hiding in edge cases of
edge cases with the ressurected item handling among other things; the
added assertIntegrity method finds these issues, the primary one being
an edge case where an ID is present in two different buckets.

Added more comments to explain logic in more detail and fixed a couple
little things like always using `+%` when incrementing the probe pos,
and replacing a silent return on an integrity issue that should be
impossible (`table[item.meta.bucket] != id`) with an assert.
2024-12-23 15:43:57 -05:00
Qwerasd
3bc2dbfa72 RefCountedSet: make lookup public 2024-08-30 13:30:40 -04:00
Qwerasd
0c11d256c8 RefCountedSet: use usize for living count to avoid overflow 2024-08-15 16:28:27 -04:00
Łukasz Niemier
f9be02a20f chore: clean up typos 2024-08-05 13:56:57 +02:00
Mitchell Hashimoto
54034468b7 terminal: remove errdefer deleted call for refcountedset 2024-07-09 09:07:28 -07:00
Qwerasd
a9aef11b4b RefCountedSet: add some missing context delete callbacks 2024-07-08 22:15:31 -04:00
Mitchell Hashimoto
eed9c23acd terminal: RefCountedSet checks for existence prior to cap check 2024-07-05 21:40:39 -07:00
Mitchell Hashimoto
d7e089e2aa terminal: simplify hyperlink capacity 2024-07-05 21:40:38 -07:00
Mitchell Hashimoto
548850e453 terminal: RefCountedSet should call deleted on upsert 2024-07-05 21:39:56 -07:00
Mitchell Hashimoto
d1f41e2035 terminal: hyperlink start/end on screen 2024-07-05 21:39:55 -07:00
Mitchell Hashimoto
51c05aeb99 terminal: RefCountedSet doesn't need to pass base anymore 2024-07-05 21:39:07 -07:00
Mitchell Hashimoto
2e41afc787 terminal: RefCountedSet has Context variant methods 2024-07-05 21:39:07 -07:00
Mitchell Hashimoto
cb1caff018 terminal: refcountedset passes base memory to all context funcs
This enables these funcs to access memory offsets that may be present in
set items, which is possible since the set itself is in an offset-based
structure.
2024-07-05 21:39:07 -07:00
Mitchell Hashimoto
b62806360b terminal: add test for pagelist to clear styles 2024-06-24 20:58:11 -07:00
Mitchell Hashimoto
368960d76a use +% for overflow 2024-06-24 20:37:11 -07:00
Mitchell Hashimoto
44c75931b4 terminal: ref counted set count is const 2024-06-24 20:33:28 -07:00
Qwerasd
93b038f490 fix(RefCountedSet): add NeedsRehash error and fix PSL counting bug
Prevent bad input from causing repeated OutOfMemory errors by erroring
with NeedsRehash instead when there are unused dead IDs available.

Additionally, properly decrement PSL stats when reviving dead IDs.
2024-06-24 20:32:22 -07:00
Qwerasd
6f732cca55 RefCountedSet: use usize for cap to allow up to max Id+1 2024-06-24 20:32:22 -07:00
Mitchell Hashimoto
d019bacb18 terminal: RefCountedSize should use usize for byte math
Related to #1873
2024-06-24 10:39:55 -07:00
Mitchell Hashimoto
eebc7d4c3a small stylistic changes 2024-06-23 09:44:54 -07:00
Mitchell Hashimoto
9271fd50b6 cache_table and ref_counted_set work on 32-bit machines 2024-06-22 20:45:30 -07:00
Qwerasd
9741b3a18c perf: introduce RefCountedSet structure, use it for Style.Set 2024-06-13 22:59:03 -04:00