1 USING: accessors compiler.cfg.instructions compiler.cfg.stack-frame
2 cpu.architecture cpu.x86 kernel layouts math namespaces system tools.test ;
3 IN: cpu.architecture.tests
5 : expected-gc-root-offset ( slot-number spill-area-base -- offset )
6 [ spill-slot boa ] [ stack-frame new swap >>spill-area-base ] bi*
8 gc-root-offset reserved-stack-space cell / -
12 ! The offset is 1, not 0 because the return address occupies the
13 ! first position in the stack frame.
14 { 1 } [ 0 0 expected-gc-root-offset ] unit-test
16 { 10 } [ 8 64 expected-gc-root-offset ] unit-test
18 { 20 } [ 24 128 expected-gc-root-offset ] unit-test