]> gitweb.factorcode.org Git - factor.git/blob - basis/cpu/architecture/architecture-tests.factor
compiler.*: fix the tests that broke because i removed the stack-frame variable
[factor.git] / basis / cpu / architecture / architecture-tests.factor
1 USING: accessors compiler.cfg compiler.cfg.instructions
2 compiler.cfg.stack-frame compiler.cfg.utilities cpu.architecture
3 cpu.x86 kernel layouts math namespaces system tools.test ;
4 IN: cpu.architecture.tests
5
6 : cfg-w-spill-area-base ( base -- cfg )
7     stack-frame new swap >>spill-area-base
8     { } insns>cfg swap >>stack-frame ;
9
10 : expected-gc-root-offset ( slot-number spill-area-base -- offset )
11     [ spill-slot boa ] [ cfg-w-spill-area-base ] bi*
12     cfg [
13         gc-root-offset reserved-stack-space cell / -
14     ] with-variable ;
15
16 cpu x86.64? [
17     ! The offset is 1, not 0 because the return address occupies the
18     ! first position in the stack frame.
19     { 1 } [ 0 0 expected-gc-root-offset ] unit-test
20
21     { 10 } [ 8 64 expected-gc-root-offset ] unit-test
22
23     { 20 } [ 24 128 expected-gc-root-offset ] unit-test
24 ] when