1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2026-03-26 08:41:47 -07:00

Fix igc tests on MS-Windows

* src/igc.c (Figc_info): Fix "commit-limit" value when there's no
limit, and 'size_t' is narrower than 'intmax_t'.  Doc fix.

* test/src/igc-tests.el (set-commit-limit-test): Fix test for
32-bit builds.
This commit is contained in:
Eli Zaretskii 2025-09-25 11:31:27 +03:00
parent 3c48ba7b87
commit d2cf8d0afb
2 changed files with 12 additions and 4 deletions

View file

@ -4796,7 +4796,8 @@ form (NAME NOBJECTS NBYTES LARGEST), where:
In addition, there are several pseudo-objects which provide overall
IGC statistics:
- committed -- the amount of committed memory in bytes
- commit-limit -- max amount of memory the arena is allowed to commit
- commit-limit -- max amount of memory the arena is allowed to commit;
the value -1 means no limit
- spare-committed -- memory which remains committed and which the
arena is managing as free memory
- reserved -- total address space reserved by the arena
@ -4833,7 +4834,11 @@ IGC statistics:
result = Fcons (e, result);
e = make_entry ("spare-committed", 1, mps_arena_spare_committed (gc->arena), 0);
result = Fcons (e, result);
e = make_entry ("commit-limit", 1, mps_arena_commit_limit (gc->arena), 0);
size_t commit_limit = mps_arena_commit_limit (gc->arena);
/* Don't assume size_t and intmax_t are of the same width. */
e = make_entry ("commit-limit", 1,
commit_limit == SIZE_MAX ? (intmax_t) -1 : commit_limit,
0);
result = Fcons (e, result);
e = make_entry ("committed", 1, mps_arena_committed (gc->arena), 0);
result = Fcons (e, result);

View file

@ -32,8 +32,11 @@
'("commit-limit" 1 1073741824 0)))
(should-error (igc--set-commit-limit -1)
:type 'args-out-of-range)
(should-error (igc--set-commit-limit (- (ash 1 64) 1))
:type 'args-out-of-range)
(should-error (igc--set-commit-limit
(if (< #x1fffffff most-positive-fixnum)
(- (ash 1 64) 1)
(- (ash 1 32) 1))
:type 'args-out-of-range))
(should (equal (igc--set-commit-limit nil) nil))
(should (equal (assoc-string "commit-limit" (igc-info))
'("commit-limit" 1 -1 0))))