1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2025-12-05 22:20:24 -08:00

Compare commits

...

3 commits

Author SHA1 Message Date
Helmut Eller
e0517ecbe6 * src/igc.c (process_one_message): Use "GC end:" instead of "GC:"
A comment in mps/code/traceanc.c says:

 * (Note: this should properly be called "trace end", but it's much
 * too late to change it now!)
2025-12-05 08:49:28 +01:00
Helmut Eller
6b6efe2128 * src/igc.h (igc_pin, igc_unpin): Remove redundant declarations. 2025-12-05 08:46:58 +01:00
Jeremy Bryant
c5be680ec3 ; * lisp/emacs-lisp/igc.el: Add docstrings and fix typos
(igc--current-idle-time): Add docstring.
(igc--idle-timer): Fix typo in docstring.
(igc--predict-idle-time): Add docstring.
(igc--on-idle): Fix typo in comment, add docstring.
2025-12-05 08:41:32 +01:00
3 changed files with 10 additions and 9 deletions

View file

@ -468,7 +468,7 @@ This function is called from a timer; see `igc-start-collecting-stats'."
;;; Opportunistic GC ;;; Opportunistic GC
(defvar igc--idle-timer nil (defvar igc--idle-timer nil
"Idle timer to trigger oppurtunistic GC.") "Idle timer to trigger opportunistic GC.")
(defvar igc--idle-delay 1.0 (defvar igc--idle-delay 1.0
"Time, in seconds, to wait for `igc--idle-timer'.") "Time, in seconds, to wait for `igc--idle-timer'.")
@ -490,14 +490,18 @@ This function is called from a timer; see `igc-start-collecting-stats'."
#'igc--on-idle (vector nil) 0))) #'igc--on-idle (vector nil) 0)))
(defun igc--current-idle-time () (defun igc--current-idle-time ()
"Time since the last command finished, in seconds as a float.
See `igc--on-idle'."
(let ((idle-time (current-idle-time))) (let ((idle-time (current-idle-time)))
(if idle-time (float-time idle-time) 0))) (if idle-time (float-time idle-time) 0)))
(defun igc--predict-idle-time () (defun igc--predict-idle-time ()
"Predict available time until the next command starts.
See `igc--on-idle'."
(* (igc--current-idle-time) 0.80)) (* (igc--current-idle-time) 0.80))
;; The igc-idle-timer works a bit like the blink-cursor-timer. It can ;; The igc-idle-timer works a bit like the blink-cursor-timer. It can
;; call 'gc--on-idle' multiple times per idle cycle either until some GC ;; call 'igc--on-idle' multiple times per idle cycle either until some GC
;; work is done or until `igc--idle-repetitions' is reached. We do this ;; work is done or until `igc--idle-repetitions' is reached. We do this
;; because our idle time prediction primarily depends on the ;; because our idle time prediction primarily depends on the
;; `current-idle-time', i.e. our predicted idle time gets larger the ;; `current-idle-time', i.e. our predicted idle time gets larger the
@ -509,6 +513,9 @@ This function is called from a timer; see `igc-start-collecting-stats'."
;; calling 'igc--arena-step' again. ;; calling 'igc--arena-step' again.
(defun igc--on-idle (state repetition) (defun igc--on-idle (state repetition)
"Timer function to do GC in idle Emacs state.
Calls igc--arena-step, wrapper for mps_arena_step for this very purpose.
See `igc-start-idle-timer."
(let ((timer2 (aref state 0))) (let ((timer2 (aref state 0)))
(when timer2 (when timer2
(cancel-timer timer2))) (cancel-timer timer2)))

View file

@ -4137,7 +4137,7 @@ process_one_message (struct igc *gc)
= mps_message_gc_not_condemned_size (gc->arena, msg); = mps_message_gc_not_condemned_size (gc->arena, msg);
mps_clock_t clock = mps_message_clock (gc->arena, msg); mps_clock_t clock = mps_message_clock (gc->arena, msg);
double secs = (double) clock / mps_clocks_per_sec (); double secs = (double) clock / mps_clocks_per_sec ();
message ("[%f] GC: condemned: %" pD "u live: %" pD "u " message ("[%f] GC end: condemned: %" pD "u live: %" pD "u "
"not_condemned: %" pD "u", "not_condemned: %" pD "u",
secs, condemned, live, not_condemned); secs, condemned, live, not_condemned);
} }

View file

@ -182,9 +182,6 @@ void *igc_alloc_dump (size_t nbytes);
bool igc_busy_p (void); bool igc_busy_p (void);
Lisp_Object igc_discard_killed_buffers (Lisp_Object list); Lisp_Object igc_discard_killed_buffers (Lisp_Object list);
ptrdiff_t igc_pin (void *obj);
void igc_unpin (void *obj, ptrdiff_t idx);
# define eassert_not_mps() eassert (false) # define eassert_not_mps() eassert (false)
# define eassert_not_mps() eassert (false) # define eassert_not_mps() eassert (false)
@ -204,9 +201,6 @@ void w32_remove_non_lisp_thread (void *);
extern void igc_assert_not_an_mps_object (void *ptr); extern void igc_assert_not_an_mps_object (void *ptr);
# define eassert_not_mps() eassert (false) # define eassert_not_mps() eassert (false)
ptrdiff_t igc_pin (void *obj);
void igc_unpin (void *obj, ptrdiff_t idx);
#else #else
# define igc_break() (void) 0 # define igc_break() (void) 0
# define eassert_not_mps() (void) 0 # define eassert_not_mps() (void) 0