]> gitweb.factorcode.org Git - factor.git/blob - basis/compiler/cfg/save-contexts/save-contexts-tests.factor
compiler.*: Remove the scrubbing part of the GC maps
[factor.git] / basis / compiler / cfg / save-contexts / save-contexts-tests.factor
1 USING: accessors compiler.cfg.instructions compiler.cfg.registers
2 compiler.cfg.save-contexts compiler.test cpu.architecture kernel
3 namespaces tools.test ;
4 IN: compiler.cfg.save-contexts.tests
5
6 ! insns-needs-save-context?
7 { f f t } [
8     {
9         T{ ##call-gc }
10     } insns-needs-save-context?
11     {
12         T{ ##add f 1 2 3 }
13         T{ ##branch }
14     } insns-needs-save-context?
15     { T{ ##alien-invoke } } insns-needs-save-context?
16 ] unit-test
17
18 H{ } clone representations set
19
20 V{
21     T{ ##add f 1 2 3 }
22     T{ ##branch }
23 } 0 test-bb
24
25 0 get [ insert-save-context ] change-instructions drop
26
27 {
28     V{
29         T{ ##add f 1 2 3 }
30         T{ ##branch }
31     }
32 } [
33     0 get instructions>>
34 ] unit-test
35
36 4 vreg-counter set-global
37
38 V{
39     T{ ##inc f D: 3 }
40     T{ ##box f 4 3 "from_signed_4" int-rep
41        T{ gc-map { gc-roots { } } }
42     }
43 } 0 test-bb
44
45 0 get [ insert-save-context ] change-instructions drop
46
47 {
48     V{
49         T{ ##inc f D: 3 }
50         T{ ##save-context f 5 6 }
51         T{ ##box f 4 3 "from_signed_4" int-rep
52             T{ gc-map { gc-roots { } } }
53         }
54     }
55 } [
56     0 get instructions>>
57 ] unit-test
58
59 V{
60     T{ ##phi }
61     T{ ##box }
62 } 0 test-bb
63
64 0 get [ insert-save-context ] change-instructions drop
65
66 {
67     V{
68         T{ ##phi }
69         T{ ##save-context f 7 8 }
70         T{ ##box }
71     }
72 } [
73     0 get instructions>>
74 ] unit-test
75
76 { 3 } [
77     V{
78         T{ ##phi }
79         T{ ##phi }
80         T{ ##phi }
81         T{ insn }
82     } save-context-offset
83 ] unit-test