Skip to content

Commit a8c93ed

Browse files
authored
fix repair to unreliable test (#774)
Commit 612b7ad did not adjust a `compute-size-increments` test in the intended way, because it used the current thread's parameter vector instead of the measured thread's parameter vector. This new attempt adds an extra thread parameter, so it checks the intended repair without having to be lucky with a "thread.ms" test.
1 parent 0702c8d commit a8c93ed

File tree

1 file changed

+13
-7
lines changed

1 file changed

+13
-7
lines changed

mats/misc.ms

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1127,7 +1127,9 @@
11271127
(let loop ()
11281128
(unless (check)
11291129
(sleep (make-time 'time-duration 10000 0))
1130-
(loop))))])
1130+
(loop))))]
1131+
;; to make sure a thread parameter's content is not counted:
1132+
[new-param (make-thread-parameter (make-bytevector (* 3 N)))])
11311133
(mutex-acquire m)
11321134
(let* ([th-code
11331135
;; we'll measure the difference between data reachable by this
@@ -1150,7 +1152,13 @@
11501152
;; Wait for thread to become inactive, blocked on the mutex
11511153
(pause-until (lambda () (= 1 (#%$top-level-value '$active-threads))))
11521154
;; Get thread's size, which should include bstr
1153-
(let ([pre-sizes (compute-size-increments (list th-code th))])
1155+
(let ([pre-sizes (compute-size-increments (list th-code
1156+
th
1157+
;; don't count parameters towards the thread's
1158+
;; size; in particular, the `$tt-fat` parameter
1159+
;; from a "thread.ms" test can have random symbols,
1160+
;; some of which may be bound to large values
1161+
(#%$tc-field 'parameters (#%$thread-tc th))))])
11541162
(mutex-release m)
11551163
;; Wait for bytevector to be discarded in the thread
11561164
(pause-until (lambda () (unbox saved)))
@@ -1162,18 +1170,16 @@
11621170
;; Get thread's size, which shouldn't include bstr
11631171
(let ([post-sizes (compute-size-increments (list th-code
11641172
th
1165-
;; don't count parameters towards te thread's
1166-
;; size; in particluar, the `$tt-fat` parameter
1167-
;; from a "thread.ms" test can have random symbols,
1168-
;; some of which may be bound to large values
1169-
(#%$tc-field 'parameters (#%$tc))))])
1173+
(#%$tc-field 'parameters (#%$thread-tc th))))])
11701174
(printf "SIZES ~s\n" (list pre-sizes N post-sizes))
11711175
(mutex-release m)
11721176
;; Wait for thread to exit
11731177
(thread-join th)
11741178
;; Make sure `compute-size-increments` doesn't crash on a
11751179
;; terminated thread:
11761180
(compute-size-increments (list th))
1181+
;; drop extra bytevector from the current thread:
1182+
(new-param #f)
11771183
;; Main result: detected size of `bstr` in the thread
11781184
;; while it was part of the continuation
11791185
(or (eq? (current-eval) interpret) ; interpreter continuation is not precise enough

0 commit comments

Comments
 (0)