From 90688418c3143017446bbbd37e939296601c3e5f Mon Sep 17 00:00:00 2001 From: Shiro Kawai Date: Tue, 17 Dec 2024 23:16:17 -1000 Subject: [PATCH] Exclude invalid values from gc-stat GC_get_prof_stats may fill the struct's field with -1 if the runtime does not support that field. We exclude such values from output. --- src/libeval.scm | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/libeval.scm b/src/libeval.scm index d89d71f27..b5c6dd958 100644 --- a/src/libeval.scm +++ b/src/libeval.scm @@ -570,7 +570,11 @@ (define-cise-stmt add-gc-info ;; assuming variable h, t ([_ key val] - `(SCM_APPEND1 h t (list ',key (Scm_MakeIntegerFromUI (cast u_long ,val)))))) + ;; The field of GC_prof_stats_s may be -1 if the runtime doesn't + ;; provide the value. We exclude it. + `(let* ([vv::long (cast long ,val)]) + (when (>= vv 0) + (SCM_APPEND1 h t (list ',key (Scm_MakeInteger vv))))))) (define-cise-stmt add-gc-stat ;; assuming variable st, size, i, h, t