1 ;;;; tests of the compiler vm internal consistency intended to be
2 ;;;; executed as soon as the cross-compiler is built.
4 ;;;; This software is part of the SBCL system. See the README file for
7 ;;;; While most of SBCL is derived from the CMU CL system, the test
8 ;;;; files (like this one) were written from scratch after the fork
11 ;;;; This software is in the public domain and is provided with
12 ;;;; absolutely no warranty. See the COPYING and CREDITS files for
13 ;;;; more information.
17 (/show
"beginning tests/vm.before-xc.lisp")
21 (not (immediate-constant-sc x
)))))
22 (no #.
(1+ most-positive-fixnum
))
23 (no #.
(1- most-negative-fixnum
)))
25 ;; Assert that DO-PACKED-TNS has unsurprising behavior if the body RETURNs.
26 ;; This isn't a test in the problem domain of CL - it's of an internal macro,
27 ;; and x86-64-specific not because of broken-ness, but because it uses
28 ;; known random TNs to play with.
31 (dotimes (i (ash 1 6))
32 (labels ((make-tns (n)
33 (mapcar 'copy-structure
34 (subseq `(,sb-vm
::rax-tn
,sb-vm
::rbx-tn
,sb-vm
::rcx-tn
) 0 n
)))
37 (setf (sb-c::tn-next
(car list
)) (link (cdr list
)))
39 (let* ((normal (make-tns (ldb (byte 2 0) i
)))
40 (restricted (make-tns (ldb (byte 2 2) i
)))
41 (wired (make-tns (ldb (byte 2 4) i
)))
42 (expect (append normal restricted wired
))
43 (comp (sb-c::make-empty-component
))
44 (ir2-comp (sb-c::make-ir2-component
)))
45 (setf (sb-c:component-info comp
) ir2-comp
46 (sb-c::ir2-component-normal-tns ir2-comp
) (link normal
)
47 (sb-c::ir2-component-restricted-tns ir2-comp
) (link restricted
)
48 (sb-c::ir2-component-wired-tns ir2-comp
) (link wired
))
50 (result (sb-c::do-packed-tns
(tn comp
42) (push tn list
))))
51 (assert (eq result
42))
52 (assert (equal expect
(nreverse list
))))
54 (result (sb-c::do-packed-tns
(tn comp
'bar
)
56 (if (= (incf n
) 4) (return 'foo
)))))
57 (assert (eq result
(if (>= (length expect
) 4) 'foo
'bar
)))
58 (assert (equal (subseq expect
0 (min 4 (length expect
)))
61 (/show
"done with tests/vm.before-xc.lisp")