Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

yet another attempt to fix an unreliable test #774

Merged
merged 1 commit into from
Dec 1, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 13 additions & 7 deletions mats/misc.ms
Original file line number Diff line number Diff line change
Expand Up @@ -1127,7 +1127,9 @@
(let loop ()
(unless (check)
(sleep (make-time 'time-duration 10000 0))
(loop))))])
(loop))))]
;; to make sure a thread parameter's content is not counted:
[new-param (make-thread-parameter (make-bytevector (* 3 N)))])
(mutex-acquire m)
(let* ([th-code
;; we'll measure the difference between data reachable by this
Expand All @@ -1150,7 +1152,13 @@
;; Wait for thread to become inactive, blocked on the mutex
(pause-until (lambda () (= 1 (#%$top-level-value '$active-threads))))
;; Get thread's size, which should include bstr
(let ([pre-sizes (compute-size-increments (list th-code th))])
(let ([pre-sizes (compute-size-increments (list th-code
th
;; don't count parameters towards the thread's
;; size; in particular, the `$tt-fat` parameter
;; from a "thread.ms" test can have random symbols,
;; some of which may be bound to large values
(#%$tc-field 'parameters (#%$thread-tc th))))])
(mutex-release m)
;; Wait for bytevector to be discarded in the thread
(pause-until (lambda () (unbox saved)))
Expand All @@ -1162,18 +1170,16 @@
;; Get thread's size, which shouldn't include bstr
(let ([post-sizes (compute-size-increments (list th-code
th
;; don't count parameters towards te thread's
;; size; in particluar, the `$tt-fat` parameter
;; from a "thread.ms" test can have random symbols,
;; some of which may be bound to large values
(#%$tc-field 'parameters (#%$tc))))])
(#%$tc-field 'parameters (#%$thread-tc th))))])
(printf "SIZES ~s\n" (list pre-sizes N post-sizes))
(mutex-release m)
;; Wait for thread to exit
(thread-join th)
;; Make sure `compute-size-increments` doesn't crash on a
;; terminated thread:
(compute-size-increments (list th))
;; drop extra bytevector from the current thread:
(new-param #f)
;; Main result: detected size of `bstr` in the thread
;; while it was part of the continuation
(or (eq? (current-eval) interpret) ; interpreter continuation is not precise enough
Expand Down