Ticket #948: gc.t.patch
File gc.t.patch, 3.0 KB (added by jrtayloriv, 12 years ago) |
---|
-
t/op/gc.t
23 23 24 24 =cut 25 25 26 pasm_output_is( <<'CODE', '1', "sweep 1" ); 27 interpinfo I1, 2 # How many GC mark runs have we done already? 26 pir_output_is( <<'CODE', '1', "sweep 1" ); 27 .include 'interpinfo.pasm' 28 .sub main :main 29 $I1 = interpinfo .INTERPINFO_GC_MARK_RUNS # How many GC mark runs have we done already? 28 30 sweep 1 29 interpinfo I2, 2# Should be one more now30 sub I3, I2,I131 print I332 31 $I2 = interpinfo .INTERPINFO_GC_MARK_RUNS # Should be one more now 32 $I3 = $I2 - $I1 33 print $I3 34 .end 33 35 CODE 34 36 35 pasm_output_is( <<'CODE', '0', "sweep 0" ); 36 interpinfo I1, 2 # How many GC mark runs have we done already? 37 pir_output_is( <<'CODE', '0', "sweep 0" ); 38 .include 'interpinfo.pasm' 39 .sub main :main 40 $I1 = interpinfo .INTERPINFO_GC_MARK_RUNS # How many GC mark runs have we done already? 37 41 sweep 0 38 interpinfo I2, 2 # Should be same39 sub I3, I2,I140 print I341 42 $I2 = interpinfo .INTERPINFO_GC_MARK_RUNS # Should be one more now 43 $I3 = $I2 - $I1 44 print $I3 45 .end 42 46 CODE 43 47 44 48 pasm_output_is( <<'CODE', '1', "sweep 0, with object that need destroy" ); … … 68 72 end 69 73 CODE 70 74 71 pasm_output_is( <<'CODE', '1', "collect" ); 72 interpinfo I1, 3 # How many garbage collections have we done already? 75 pir_output_is( <<'CODE', '1', "collect" ); 76 .include 'interpinfo.pasm' 77 .sub main :main 78 $I1 = interpinfo .INTERPINFO_GC_COLLECT_RUNS # How many garbage collections have we done already? 73 79 collect 74 interpinfo I2, 3# Should be one more now75 sub I3, I2,I176 print I377 80 $I2 = interpinfo .INTERPINFO_GC_COLLECT_RUNS # Should be one more now 81 $I3 = $I2 - $I1 82 print $I3 83 .end 78 84 CODE 79 85 80 86 pasm_output_is( <<'CODE', <<'OUTPUT', "collectoff/on" ); … … 123 129 1 124 130 OUTPUT 125 131 126 pasm_output_is( <<'CODE', <<OUTPUT, "vanishing singleton PMC" ); 127 _main: 128 .const 'Sub' P0 = "_rand" 129 new P16, 'Env' 130 set P16['Foo'], 'bar' 131 set I16, 100 132 set I17, 0 133 loop: 134 sweep 1 135 invokecc P0 136 inc I17 137 lt I17, I16, loop 138 print "ok\n" 139 end 132 pir_output_is( <<'CODE', <<OUTPUT, "vanishing singleton PMC" ); 133 .sub main :main 134 $P16 = new 'Env' 135 $P16['Foo'] = 'bar' 136 $I16 = 100 137 $I17 = 0 140 138 141 .pcc_sub _rand: 142 new P16, 'Env' 143 set P5, P16['Foo'] 144 ne P5, 'bar', err 145 returncc 146 err: 147 print "singleton destroyed .Env = ." 148 new P16, 'Env' 149 typeof S16, P16 150 print S16 151 print "\n" 152 end 139 loop: 140 sweep 1 141 _rand() 142 $I17 += 1 143 if $I17 <= $I16 goto loop 144 say "ok" 145 .end 146 147 .sub _rand 148 $P16 = new 'Env' 149 $P5 = $P16['Foo'] 150 if $P5 != 'bar' goto err 151 .return() 152 err: 153 say "singleton destroyed .Env = ." 154 $P16 = new 'Env' 155 $S16 = typeof $P16 156 say $S16 157 .end 158 153 159 CODE 154 160 ok 155 161 OUTPUT