Skip to content

Commit

Permalink
Exclude invalid values from gc-stat
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
shirok committed Dec 18, 2024
1 parent 2b40927 commit 9068841
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/libeval.scm
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 9068841

Please sign in to comment.