]> gitweb.factorcode.org Git - factor.git/blob - basis/compiler/cfg/save-contexts/save-contexts-tests.factor
87ae39e580a1123a433d0bafaea4415969769788
[factor.git] / basis / compiler / cfg / save-contexts / save-contexts-tests.factor
1 USING: accessors compiler.cfg.debugger
2 compiler.cfg.instructions compiler.cfg.registers
3 compiler.cfg.save-contexts kernel namespaces tools.test
4 cpu.x86.assembler.operands cpu.architecture ;
5 IN: compiler.cfg.save-contexts.tests
6
7 H{ } clone representations set
8
9 V{
10     T{ ##add f 1 2 3 }
11     T{ ##branch }
12 } 0 test-bb
13
14 0 get [ insert-save-context ] change-instructions drop
15
16 {
17     V{
18         T{ ##add f 1 2 3 }
19         T{ ##branch }
20     }
21 } [
22     0 get instructions>>
23 ] unit-test
24
25 4 vreg-counter set-global
26
27 V{
28     T{ ##inc f D 3 }
29     T{ ##box f 4 3 "from_signed_4" int-rep
30         T{ gc-map { scrub-d B{ 0 0 0 } } { scrub-r B{ } } { gc-roots { } } }
31     }
32 } 0 test-bb
33
34 0 get [ insert-save-context ] change-instructions drop
35
36 {
37     V{
38         T{ ##inc f D 3 }
39         T{ ##save-context f 5 6 }
40         T{ ##box f 4 3 "from_signed_4" int-rep
41             T{ gc-map { scrub-d B{ 0 0 0 } } { scrub-r B{ } } { gc-roots { } } }
42         }
43     }
44 } [
45     0 get instructions>>
46 ] unit-test
47
48 V{
49     T{ ##phi }
50     T{ ##box }
51 } 0 test-bb
52
53 0 get [ insert-save-context ] change-instructions drop
54
55 {
56     V{
57         T{ ##phi }
58         T{ ##save-context f 7 8 }
59         T{ ##box }
60     }
61 } [
62     0 get instructions>>
63 ] unit-test
64
65 { 3 } [
66     V{
67         T{ ##phi }
68         T{ ##phi }
69         T{ ##phi }
70         T{ insn }
71     } save-context-offset
72 ] unit-test