3 ;;;; This software is part of the SBCL system. See the README file for
6 ;;;; While most of SBCL is derived from the CMU CL system, the test
7 ;;;; files (like this one) were written from scratch after the fork
10 ;;;; This software is in the public domain and is provided with
11 ;;;; absoluely no warranty. See the COPYING and CREDITS files for
12 ;;;; more information.
16 ;;; Make sure MAP-REFERENCING-OBJECTS doesn't spuriously treat raw bits as
17 ;;; potential pointers. Also make sure it sees the SYMBOL-INFO slot.
18 (defstruct afoo
(slot nil
:type sb-ext
:word
))
19 (defvar *afoo
* (make-afoo :slot
(sb-kernel:get-lisp-obj-address
'*posix-argv
*)))
20 (with-test (:name
:map-referencing-objs
)
21 (sb-vm::map-referencing-objects
(lambda (x) (assert (not (typep x
'afoo
))))
22 :dynamic
'*posix-argv
*)
23 (let ((v (sb-kernel:symbol-info
'satisfies
)) referers
)
24 (sb-vm::map-referencing-objects
(lambda (referer) (push referer referers
))
25 #+gencgc
:dynamic
#-gencgc
:static v
)
26 (assert (member 'satisfies referers
))))
32 (setq *x
* (make-string 100000))))
34 ;; check that WITHOUT-INTERRUPTS doesn't block the gc trigger
35 (sb-sys:without-interrupts
(cons-madly))
37 ;; check that WITHOUT-INTERRUPTS doesn't block SIG_STOP_FOR_GC
39 (sb-sys:without-interrupts
40 (let ((thread (sb-thread:make-thread
(lambda () (sb-ext:gc
)))))
41 (loop while
(sb-thread:thread-alive-p thread
))))
43 (let ((gc-happend nil
))
44 (push (lambda () (setq gc-happend t
)) sb-ext
:*after-gc-hooks
*)
46 ;; check that WITHOUT-GCING defers explicit gc
49 (assert (not gc-happend
)))
52 ;; check that WITHOUT-GCING defers SIG_STOP_FOR_GC
54 (let ((in-without-gcing nil
))
56 (sb-thread:make-thread
(lambda ()
57 (loop while
(not in-without-gcing
))
60 (setq in-without-gcing t
)
62 (assert (not gc-happend
)))
63 ;; give the hook time to run
67 ;;; SB-EXT:GENERATION-* accessors returned bogus values for generation > 0
68 (with-test (:name
:bug-529014
:skipped-on
'(not :gencgc
))
69 (loop for i from
0 to sb-vm
:+pseudo-static-generation
+
70 do
(assert (= (sb-ext:generation-bytes-consed-between-gcs i
)
71 (truncate (sb-ext:bytes-consed-between-gcs
)
72 sb-vm
:+highest-normal-generation
+)))
73 ;; FIXME: These parameters are a) tunable in the source and b)
74 ;; duplicated multiple times there and now here. It would be good to
75 ;; OAOO-ify them (probably to src/compiler/generic/params.lisp).
76 (assert (= (sb-ext:generation-minimum-age-before-gc i
) 0.75))
77 (assert (= (sb-ext:generation-number-of-gcs-before-promotion i
) 1))))
80 ;; Kludge or not? I don't know whether the smaller allocation size
81 ;; for sb-safepoint is a legitimate correction to the test case, or
82 ;; rather hides the actual bug this test is checking for... It's also
83 ;; not clear to me whether the issue is actually safepoint-specific.
84 ;; But the main problem safepoint-related bugs tend to introduce is a
85 ;; delay in the GC triggering -- and if bug-936304 fails, it also
86 ;; causes bug-981106 to fail, even though there is a full GC in
87 ;; between, which makes it seem unlikely to me that the problem is
88 ;; delay- (and hence safepoint-) related. --DFL
89 (let* ((x (make-array (truncate #-sb-safepoint
(* 0.2 (dynamic-space-size))
90 #+sb-safepoint
(* 0.1 (dynamic-space-size))
91 sb-vm
:n-word-bytes
))))
94 (with-test (:name
:bug-936304
)
97 (assert (eq :ok
(handler-case
99 (loop repeat
50 do
(stress-gc))
101 (storage-condition ()
104 (with-test (:name
:bug-981106
)
109 (dotimes (runs 100 :ok
)
110 (let* ((n (truncate (dynamic-space-size) 1200))
112 (with-output-to-string (string)
114 (write-sequence "hi there!" string
))))))
115 (assert (eql len
(* n
(length "hi there!"))))))
116 (storage-condition ()
119 (with-test (:name
:gc-logfile
:skipped-on
'(not :gencgc
))
120 (assert (not (gc-logfile)))
121 (let ((p #p
"gc.log"))
122 (assert (not (probe-file p
)))
123 (assert (equal p
(setf (gc-logfile) p
)))
125 (let ((p2 (gc-logfile)))
126 (assert (equal (truename p2
) (truename p
))))
127 (assert (not (setf (gc-logfile) nil
)))
128 (assert (not (gc-logfile)))