|
1127 | 1127 | (let loop ()
|
1128 | 1128 | (unless (check)
|
1129 | 1129 | (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)))]) |
1131 | 1133 | (mutex-acquire m)
|
1132 | 1134 | (let* ([th-code
|
1133 | 1135 | ;; we'll measure the difference between data reachable by this
|
|
1150 | 1152 | ;; Wait for thread to become inactive, blocked on the mutex
|
1151 | 1153 | (pause-until (lambda () (= 1 (#%$top-level-value '$active-threads))))
|
1152 | 1154 | ;; 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))))]) |
1154 | 1162 | (mutex-release m)
|
1155 | 1163 | ;; Wait for bytevector to be discarded in the thread
|
1156 | 1164 | (pause-until (lambda () (unbox saved)))
|
|
1162 | 1170 | ;; Get thread's size, which shouldn't include bstr
|
1163 | 1171 | (let ([post-sizes (compute-size-increments (list th-code
|
1164 | 1172 | 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))))]) |
1170 | 1174 | (printf "SIZES ~s\n" (list pre-sizes N post-sizes))
|
1171 | 1175 | (mutex-release m)
|
1172 | 1176 | ;; Wait for thread to exit
|
1173 | 1177 | (thread-join th)
|
1174 | 1178 | ;; Make sure `compute-size-increments` doesn't crash on a
|
1175 | 1179 | ;; terminated thread:
|
1176 | 1180 | (compute-size-increments (list th))
|
| 1181 | + ;; drop extra bytevector from the current thread: |
| 1182 | + (new-param #f) |
1177 | 1183 | ;; Main result: detected size of `bstr` in the thread
|
1178 | 1184 | ;; while it was part of the continuation
|
1179 | 1185 | (or (eq? (current-eval) interpret) ; interpreter continuation is not precise enough
|
|
0 commit comments