]> gitweb.factorcode.org Git - factor.git/blob - basis/compiler/cfg/stacks/uninitialized/uninitialized-tests.factor
Delete empty unit tests files, remove 1- and 1+, reorder IN: lines in a lot of places...
[factor.git] / basis / compiler / cfg / stacks / uninitialized / uninitialized-tests.factor
1 USING: compiler.cfg.stacks.uninitialized compiler.cfg.debugger
2 compiler.cfg.registers compiler.cfg.instructions compiler.cfg
3 compiler.cfg.predecessors cpu.architecture tools.test kernel vectors
4 namespaces accessors sequences ;
5 IN: compiler.cfg.stacks.uninitialized.tests
6
7 : test-uninitialized ( -- )
8     cfg new 0 get >>entry
9     compute-uninitialized-sets ;
10
11 V{
12     T{ ##inc-d f 3 }
13 } 0 test-bb
14
15 V{
16     T{ ##replace f 0 D 0 }
17     T{ ##replace f 0 D 1 }
18     T{ ##replace f 0 D 2 }
19     T{ ##inc-r f 1 }
20 } 1 test-bb
21
22 V{
23     T{ ##peek f 0 D 0 }
24     T{ ##inc-d f 1 }
25 } 2 test-bb
26
27 0 1 edge
28 1 2 edge
29
30 [ ] [ test-uninitialized ] unit-test
31
32 [ V{ D 0 D 1 D 2 } ] [ 1 get uninitialized-locs ] unit-test
33 [ V{ R 0 } ] [ 2 get uninitialized-locs ] unit-test
34
35 ! When merging, if a location is uninitialized in one branch and
36 ! initialized in another, we have to consider it uninitialized,
37 ! since it cannot be safely read from by a ##peek, or traced by GC.
38
39 V{ } 0 test-bb
40
41 V{
42     T{ ##inc-d f 1 }
43 } 1 test-bb
44
45 V{
46     T{ ##call f namestack }
47     T{ ##branch }
48 } 2 test-bb
49
50 V{
51     T{ ##return }
52 } 3 test-bb
53
54 0 { 1 2 } edges
55 1 3 edge
56 2 3 edge
57
58 [ ] [ test-uninitialized ] unit-test
59
60 [ V{ D 0 } ] [ 3 get uninitialized-locs ] unit-test