]> gitweb.factorcode.org Git - factor.git/blob - basis/compiler/cfg/write-barrier/write-barrier-tests.factor
Merge branch 'master' of git://factorcode.org/git/factor
[factor.git] / basis / compiler / cfg / write-barrier / write-barrier-tests.factor
1 USING: compiler.cfg.write-barrier compiler.cfg.instructions
2 compiler.cfg.registers compiler.cfg.debugger cpu.architecture
3 arrays tools.test vectors compiler.cfg kernel accessors
4 compiler.cfg.utilities ;
5 IN: compiler.cfg.write-barrier.tests
6
7 : test-write-barrier ( insns -- insns )
8     <simple-block> dup write-barriers-step instructions>> ;
9
10 [
11     V{
12         T{ ##peek f V int-regs 4 D 0 f }
13         T{ ##allot f V int-regs 7 24 array V int-regs 8 f }
14         T{ ##load-immediate f V int-regs 9 8 f }
15         T{ ##set-slot-imm f V int-regs 9 V int-regs 7 1 3 f }
16         T{ ##set-slot-imm f V int-regs 4 V int-regs 7 2 3 f }
17         T{ ##replace f V int-regs 7 D 0 f }
18         T{ ##branch }
19     }
20 ] [
21     {
22         T{ ##peek f V int-regs 4 D 0 }
23         T{ ##allot f V int-regs 7 24 array V int-regs 8 }
24         T{ ##load-immediate f V int-regs 9 8 }
25         T{ ##set-slot-imm f V int-regs 9 V int-regs 7 1 3 }
26         T{ ##write-barrier f V int-regs 7 V int-regs 10 V int-regs 11 }
27         T{ ##set-slot-imm f V int-regs 4 V int-regs 7 2 3 }
28         T{ ##write-barrier f V int-regs 7 V int-regs 12 V int-regs 13 }
29         T{ ##replace f V int-regs 7 D 0 }
30     } test-write-barrier
31 ] unit-test
32
33 [
34     V{
35         T{ ##load-immediate f V int-regs 4 24 }
36         T{ ##peek f V int-regs 5 D -1 }
37         T{ ##peek f V int-regs 6 D -2 }
38         T{ ##set-slot-imm f V int-regs 5 V int-regs 6 3 2 }
39         T{ ##write-barrier f V int-regs 6 V int-regs 7 V int-regs 8 }
40         T{ ##branch }
41     }
42 ] [
43     {
44         T{ ##load-immediate f V int-regs 4 24 }
45         T{ ##peek f V int-regs 5 D -1 }
46         T{ ##peek f V int-regs 6 D -2 }
47         T{ ##set-slot-imm f V int-regs 5 V int-regs 6 3 2 }
48         T{ ##write-barrier f V int-regs 6 V int-regs 7 V int-regs 8 }
49     } test-write-barrier
50 ] unit-test
51
52 [
53     V{
54         T{ ##peek f V int-regs 19 D -3 }
55         T{ ##peek f V int-regs 22 D -2 }
56         T{ ##set-slot-imm f V int-regs 22 V int-regs 19 3 2 }
57         T{ ##write-barrier f V int-regs 19 V int-regs 24 V int-regs 25 }
58         T{ ##peek f V int-regs 28 D -1 }
59         T{ ##set-slot-imm f V int-regs 28 V int-regs 19 4 2 }
60         T{ ##branch }
61     }
62 ] [
63     {
64         T{ ##peek f V int-regs 19 D -3 }
65         T{ ##peek f V int-regs 22 D -2 }
66         T{ ##set-slot-imm f V int-regs 22 V int-regs 19 3 2 }
67         T{ ##write-barrier f V int-regs 19 V int-regs 24 V int-regs 25 }
68         T{ ##peek f V int-regs 28 D -1 }
69         T{ ##set-slot-imm f V int-regs 28 V int-regs 19 4 2 }
70         T{ ##write-barrier f V int-regs 19 V int-regs 30 V int-regs 3 }
71     } test-write-barrier
72 ] unit-test