1 | Index: t/op/gc.t |
---|
2 | =================================================================== |
---|
3 | --- t/op/gc.t (revision 40789) |
---|
4 | +++ t/op/gc.t (working copy) |
---|
5 | @@ -23,22 +23,26 @@ |
---|
6 | |
---|
7 | =cut |
---|
8 | |
---|
9 | -pasm_output_is( <<'CODE', '1', "sweep 1" ); |
---|
10 | - interpinfo I1, 2 # How many GC mark runs have we done already? |
---|
11 | +pir_output_is( <<'CODE', '1', "sweep 1" ); |
---|
12 | +.include 'interpinfo.pasm' |
---|
13 | +.sub main :main |
---|
14 | + $I1 = interpinfo .INTERPINFO_GC_MARK_RUNS # How many GC mark runs have we done already? |
---|
15 | sweep 1 |
---|
16 | - interpinfo I2, 2 # Should be one more now |
---|
17 | - sub I3, I2, I1 |
---|
18 | - print I3 |
---|
19 | - end |
---|
20 | + $I2 = interpinfo .INTERPINFO_GC_MARK_RUNS # Should be one more now |
---|
21 | + $I3 = $I2 - $I1 |
---|
22 | + print $I3 |
---|
23 | +.end |
---|
24 | CODE |
---|
25 | |
---|
26 | -pasm_output_is( <<'CODE', '0', "sweep 0" ); |
---|
27 | - interpinfo I1, 2 # How many GC mark runs have we done already? |
---|
28 | +pir_output_is( <<'CODE', '0', "sweep 0" ); |
---|
29 | +.include 'interpinfo.pasm' |
---|
30 | +.sub main :main |
---|
31 | + $I1 = interpinfo .INTERPINFO_GC_MARK_RUNS # How many GC mark runs have we done already? |
---|
32 | sweep 0 |
---|
33 | - interpinfo I2, 2 # Should be same |
---|
34 | - sub I3, I2, I1 |
---|
35 | - print I3 |
---|
36 | - end |
---|
37 | + $I2 = interpinfo .INTERPINFO_GC_MARK_RUNS # Should be same |
---|
38 | + $I3 = $I2 - $I1 |
---|
39 | + print $I3 |
---|
40 | +.end |
---|
41 | CODE |
---|
42 | |
---|
43 | pasm_output_is( <<'CODE', '1', "sweep 0, with object that need destroy" ); |
---|
44 | @@ -68,13 +72,15 @@ |
---|
45 | end |
---|
46 | CODE |
---|
47 | |
---|
48 | -pasm_output_is( <<'CODE', '1', "collect" ); |
---|
49 | - interpinfo I1, 3 # How many garbage collections have we done already? |
---|
50 | +pir_output_is( <<'CODE', '1', "collect" ); |
---|
51 | +.include 'interpinfo.pasm' |
---|
52 | +.sub main :main |
---|
53 | + $I1 = interpinfo .INTERPINFO_GC_COLLECT_RUNS # How many garbage collections have we done already? |
---|
54 | collect |
---|
55 | - interpinfo I2, 3 # Should be one more now |
---|
56 | - sub I3, I2, I1 |
---|
57 | - print I3 |
---|
58 | - end |
---|
59 | + $I2 = interpinfo .INTERPINFO_GC_COLLECT_RUNS # Should be one more now |
---|
60 | + $I3 = $I2 - $I1 |
---|
61 | + print $I3 |
---|
62 | +.end |
---|
63 | CODE |
---|
64 | |
---|
65 | pasm_output_is( <<'CODE', <<'OUTPUT', "collectoff/on" ); |
---|
66 | @@ -123,33 +129,33 @@ |
---|
67 | 1 |
---|
68 | OUTPUT |
---|
69 | |
---|
70 | -pasm_output_is( <<'CODE', <<OUTPUT, "vanishing singleton PMC" ); |
---|
71 | -_main: |
---|
72 | - .const 'Sub' P0 = "_rand" |
---|
73 | - new P16, 'Env' |
---|
74 | - set P16['Foo'], 'bar' |
---|
75 | - set I16, 100 |
---|
76 | - set I17, 0 |
---|
77 | -loop: |
---|
78 | - sweep 1 |
---|
79 | - invokecc P0 |
---|
80 | - inc I17 |
---|
81 | - lt I17, I16, loop |
---|
82 | - print "ok\n" |
---|
83 | - end |
---|
84 | +pir_output_is( <<'CODE', <<OUTPUT, "vanishing singleton PMC" ); |
---|
85 | +.sub main :main |
---|
86 | + $P16 = new 'Env' |
---|
87 | + $P16['Foo'] = 'bar' |
---|
88 | + $I16 = 100 |
---|
89 | + $I17 = 0 |
---|
90 | |
---|
91 | -.pcc_sub _rand: |
---|
92 | - new P16, 'Env' |
---|
93 | - set P5, P16['Foo'] |
---|
94 | - ne P5, 'bar', err |
---|
95 | - returncc |
---|
96 | -err: |
---|
97 | - print "singleton destroyed .Env = ." |
---|
98 | - new P16, 'Env' |
---|
99 | - typeof S16, P16 |
---|
100 | - print S16 |
---|
101 | - print "\n" |
---|
102 | - end |
---|
103 | + loop: |
---|
104 | + sweep 1 |
---|
105 | + _rand() |
---|
106 | + $I17 += 1 |
---|
107 | + if $I17 <= $I16 goto loop |
---|
108 | + say "ok" |
---|
109 | +.end |
---|
110 | + |
---|
111 | +.sub _rand |
---|
112 | + $P16 = new 'Env' |
---|
113 | + $P5 = $P16['Foo'] |
---|
114 | + if $P5 != 'bar' goto err |
---|
115 | + .return() |
---|
116 | + err: |
---|
117 | + say "singleton destroyed .Env = ." |
---|
118 | + $P16 = new 'Env' |
---|
119 | + $S16 = typeof $P16 |
---|
120 | + say $S16 |
---|
121 | +.end |
---|
122 | + |
---|
123 | CODE |
---|
124 | ok |
---|
125 | OUTPUT |
---|