an experiment: clearing the C stack in gc tests

* test-suite/lib.scm (clear-stale-stack-references): New helper.
* test-suite/tests/gc.test:
* test-suite/tests/threads.test: Use the new helper.

I removed the "unresolved" throw, as I'd like to see what the bots do
with this.
This commit is contained in:
Andy Wingo 2012-01-31 17:57:13 +01:00
commit 5270a001ad
3 changed files with 20 additions and 32 deletions

View file

@ -49,13 +49,6 @@
;;;
;;;
(define (stack-cleanup depth)
;; Clean up stack space for DEPTH words. This is defined here so that
;; `peval' doesn't inline it.
(let cleanup ((i depth))
(and (> i 0)
(begin (cleanup (1- i)) i))))
(with-test-prefix "gc"
(pass-if "after-gc-hook gets called"
@ -73,7 +66,7 @@
(for-each (lambda (x) (guard (make-module))) (iota total))
;; Avoid false references to the modules on the stack.
(stack-cleanup 20)
(clear-stale-stack-references)
(gc)
(gc) ;; twice: have to kill the weak vectors.
@ -92,21 +85,9 @@
(define guardian (make-guardian))
(let ((f (list 'foo)))
(guardian f))
;; See below.
;; ((lambda () #t))
((@ (test-suite lib) clear-stale-stack-references))
(gc)(gc)(gc)
(guardian))
;; Prevent the optimizer from propagating f.
#:opts '(#:partial-eval? #f))))
(if (not l)
;; We think that something on the C stack in the VM is holding
;; on to a reference to the list. This happens on
;; register-poor architectures, where more locals are spilled
;; to the stack. If more code runs before the (gc) is run,
;; like a ((lambda () #t)), then the test passes. So given
;; that at some point, the reference will be dropped, we will
;; count these cases as "unresolved" instead of "fail".
;;
;; See http://debbugs.gnu.org/cgi/bugreport.cgi?bug=10336.
(throw 'unresolved)
(equal? l '(foo))))))
(equal? l '(foo)))))

View file

@ -1,6 +1,6 @@
;;;; threads.test --- Tests for Guile threading. -*- scheme -*-
;;;;
;;;; Copyright 2003, 2006, 2007, 2009, 2010, 2011 Free Software Foundation, Inc.
;;;; Copyright 2003, 2006, 2007, 2009, 2010, 2011, 2012 Free Software Foundation, Inc.
;;;;
;;;; This library is free software; you can redistribute it and/or
;;;; modify it under the terms of the GNU Lesser General Public
@ -36,13 +36,6 @@
(equal? '(a b c) '(a b c))
a))
(define (stack-cleanup depth)
;; Clean up stack space for DEPTH words. This is defined here so that
;; `peval' doesn't inline it.
(let cleanup ((i depth))
(and (> i 0)
(begin (cleanup (1- i)) i))))
(if (provided? 'threads)
(begin
@ -410,7 +403,7 @@
(g (let ((m (make-mutex))) (lock-mutex m) m))
;; Avoid false references to M on the stack.
(stack-cleanup 20)
(clear-stale-stack-references)
(gc) (gc)
(let ((m (g)))