wmls/optim.pm

filter: Statementstmt 2.4% 20 / 808 Branchbran 0.0% 0 / 696 Conditioncond 0.0% 0 / 162 MC/DCmcdc 0.0% 0 / 86 Subroutinesub 15.7% 6 / 38 Podpod 0.0% 0 / 30 totaltotal 1.4% 26 / 1820 CC 404 SCAR 71.4
CC
404
Cov
1%
optIdtLeftInteger
3422.0
optIdtRightInteger
3422.0
optEvalExpr
1560.0
CRAP 1266.3
↑ Summary wmls/lexer.pm »
1
2 package WAP::wmls::parser;
3
4 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 1 ▶use bigint;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 1 ▶use bignum;
Subroutine BEGIN: called CC=1 SCAR=0.0
8
9 1 ▶use Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
10
11 1 my $OneMoreTime;
12 my $OneMoreExpr;
13
14 0 ▶sub optWarning {
Subroutine optWarning: not called CC=5 SCAR=34.0
Pod undocumented
15 0 my $parser = shift;
16 0 my ($node, $msg) = @_;
17
18 0 ▶ $msg ||= ".\n";
Condition0%0/2
$msg ||= ".\n"
l!l
00
MC/DC0%0/1
$msg ||= ".\n"
$msg
Truth table0%0/2
A
A= $msg
Aresult
11
00
19
20 0 ▶ if (exists $parser->YYData->{nb_warning}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $parser->YYData->{'nb_warning'}) { } 0 0 0
21 0 $parser->YYData->{nb_warning} ++;
22 }
23 else {
24 0 $parser->YYData->{nb_warning} = 1;
25 }
26
27 print STDOUT '#',$parser->YYData->{filename},':',$node->{OpCode}->{Lineno},'#Warning: ',$msg
28 if ( exists $parser->YYData->{verbose_warning}
29 0 ▶ and $parser->YYData->{verbose_warning});
Branch: 1 branch
BranchTrueFalseTotal
if exists $parser->YYData->{"verbose_warning"} and $parser->YYData->{"verbose_warning"} 0 0 0
Condition0%0/3
exists $parser->YYData->{"verbose_warning"} and $parser->YYData->{"verbose_warning"}
!ll&&!rl&&r
000
MC/DC0%0/2
exists $parser->YYData->{"verbose_warning"} and $parser->YYData->{"verbose_warning"}
exists $parser->YYData->{"verbose_warning"} $parser->YYData->{"verbose_warning"}
Truth table0%0/3
A and B
A= exists $parser->YYData->{"verbose_warning"}B= $parser->YYData->{"verbose_warning"}
ABresult
0X0
100
111
30 0 return;
31 }
32
33 0 ▶sub optInfo {
Subroutine optInfo: not called CC=5 SCAR=34.0
Pod undocumented
34 0 my $parser = shift;
35 0 my ($node, $msg) = @_;
36
37 0 ▶ $msg ||= ".\n";
Condition0%0/2
$msg ||= ".\n"
l!l
00
MC/DC0%0/1
$msg ||= ".\n"
$msg
Truth table0%0/2
A
A= $msg
Aresult
11
00
38
39 0 ▶ if (exists $parser->YYData->{nb_info}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $parser->YYData->{'nb_info'}) { } 0 0 0
40 0 $parser->YYData->{nb_info} ++;
41 } else {
42 0 $parser->YYData->{nb_info} = 1;
43 }
44
45 print STDOUT '#',$parser->YYData->{filename},':',$node->{OpCode}->{Lineno},'#Info: ',$msg
46 if ( exists $parser->YYData->{verbose_info}
47 0 ▶ and $parser->YYData->{verbose_info});
Branch: 1 branch
BranchTrueFalseTotal
if exists $parser->YYData->{"verbose_info"} and $parser->YYData->{"verbose_info"} 0 0 0
Condition0%0/3
exists $parser->YYData->{"verbose_info"} and $parser->YYData->{"verbose_info"}
!ll&&!rl&&r
000
MC/DC0%0/2
exists $parser->YYData->{"verbose_info"} and $parser->YYData->{"verbose_info"}
exists $parser->YYData->{"verbose_info"} $parser->YYData->{"verbose_info"}
Truth table0%0/3
A and B
A= exists $parser->YYData->{"verbose_info"}B= $parser->YYData->{"verbose_info"}
ABresult
0X0
100
111
48 0 return;
49 }
50
51 0 ▶sub optDebug {
Subroutine optDebug: not called CC=4 SCAR=30.0
Pod undocumented
52 0 my $parser = shift;
53 0 my ($node, $msg) = @_;
54
55 0 ▶ $msg ||= ".\n";
Condition0%0/2
$msg ||= ".\n"
l!l
00
MC/DC0%0/1
$msg ||= ".\n"
$msg
Truth table0%0/2
A
A= $msg
Aresult
11
00
56
57 print STDOUT '#',$parser->YYData->{filename},':',$node->{OpCode}->{Lineno},'#Debug: ',$msg
58 if ( exists $parser->YYData->{verbose_debug}
59 0 ▶ and $parser->YYData->{verbose_debug});
Branch: 1 branch
BranchTrueFalseTotal
if exists $parser->YYData->{"verbose_debug"} and $parser->YYData->{"verbose_debug"} 0 0 0
Condition0%0/3
exists $parser->YYData->{"verbose_debug"} and $parser->YYData->{"verbose_debug"}
!ll&&!rl&&r
000
MC/DC0%0/2
exists $parser->YYData->{"verbose_debug"} and $parser->YYData->{"verbose_debug"}
exists $parser->YYData->{"verbose_debug"} $parser->YYData->{"verbose_debug"}
Truth table0%0/3
A and B
A= exists $parser->YYData->{"verbose_debug"}B= $parser->YYData->{"verbose_debug"}
ABresult
0X0
100
111
60 0 return;
61 }
62
63 0 ▶sub checkRangeInteger {
Subroutine checkRangeInteger: not called CC=3 SCAR=24.8
Pod undocumented
64 0 my $parser = shift;
65 0 my ($opcode) = @_;
66 0 my $value = $opcode->{Value};
67 0 ▶ if ($value > 2147483647 or $value < -2147483648) {
Branch: 1 branch
BranchTrueFalseTotal
if ($value > bless( {"sign" => "+","value" => bless( [147483647,2], 'Math::BigInt::Calc' )}, 'Math::BigInt' ) or $value < bless( {"sign" => "-","value" => bless( [147483648,2], 'Math::BigInt::Calc' )}, 'Math::BigInt' )) 0 0 0
Condition0%0/3
$value > bless( {"sign" => "+","value" => bless( [147483647,2], 'Math::BigInt::Calc' )}, 'Math::BigInt' ) or $value < bless( {"sign" => "-","value" => bless( [147483648,2], 'Math::BigInt::Calc' )}, 'Math::BigInt' )
l!l&&r!l&&!r
000
MC/DC0%0/2
$value > bless( {"sign" => "+","value" => bless( [147483647,2], 'Math::BigInt::Calc' )}, 'Math::BigInt' ) or $value < bless( {"sign" => "-","value" => bless( [147483648,2], 'Math::BigInt::Calc' )}, 'Math::BigInt' )
$value > bless( {"sign" => "+","value" => bless( [147483647,2], 'Math::BigInt::Calc' )}, 'Math::BigInt' ) $value < bless( {"sign" => "-","value" => bless( [147483648,2], 'Math::BigInt::Calc' )}, 'Math::BigInt' )
Truth table0%0/3
A or B
A= $value > bless( {"sign" => "+","value" => bless( [147483647,2], 'Math::BigInt::Calc' )}, 'Math::BigInt' )B= $value < bless( {"sign" => "-","value" => bless( [147483648,2], 'Math::BigInt::Calc' )}, 'Math::BigInt' )
ABresult
1X1
011
000
68 0 $parser->Error("Integer $value is out of range.\n");
69 0 $opcode->{TypeDef} = 'TYPE_INVALID';
70 }
71 0 return;
72 }
73
74 0 ▶sub checkRangeFloat {
Subroutine checkRangeFloat: not called CC=3 SCAR=24.8
Pod undocumented
75 0 my $parser = shift;
76 0 my ($opcode) = @_;
77 0 my $value = $opcode->{Value};
78 0 my $abs_v = abs $value;
79 0 ▶ if ($abs_v > 3.40282347e+38) {
Branch: 2 branches
BranchTrueFalseTotal
if ($abs_v > {sign => '+', value => [0, 0, 0, 282347000, 340]}) { } 0 0 0
elsif ($abs_v < {_e => [46], _es => '-', _m => ['117549435'], sign => '+'}) { } 0 0 0
80 0 $parser->Error("Float $value is out of range.\n");
81 0 $opcode->{TypeDef} = 'TYPE_INVALID';
82 }
83 elsif ($abs_v < 1.17549435e-38) {
84 0 $parser->Warning("Float $value is underflow.\n");
85 0 $opcode->{Value} = 0.0;
86 }
87 0 return;
88 }
89
90 0 ▶sub evalUnopInteger {
Subroutine evalUnopInteger: not called CC=9 SCAR=45.0
Pod undocumented
91 0 my $parser = shift;
92 0 my ($op, $cst) = @_;
93 0 my $opcode = $cst->{OpCode};
94 0 my $oper = $op->{OpCode}->{Operator};
95 0 ▶ if ($oper eq 'typeof') {
Branch: 7 branches
BranchTrueFalseTotal
if ($oper eq 'typeof') { } 0 0 0
elsif ($oper eq 'isvalid') { } 0 0 0
elsif ($oper eq '-') { } 0 0 0
elsif ($oper eq '~') { } 0 0 0
elsif ($oper eq '!') { } 0 0 0
elsif ($oper eq '++') { } 0 0 0
elsif ($oper eq '--') { } 0 0 0
96 0 $opcode->{TypeDef} = 'TYPE_INTEGER';
97 0 $opcode->{Value} = 0;
98 0 $op->del();
99 0 $OneMoreExpr = 1;
100 }
101 elsif ($oper eq 'isvalid') {
102 0 $opcode->{TypeDef} = 'TYPE_BOOLEAN';
103 0 $opcode->{Value} = 1;
104 0 $op->del();
105 0 $OneMoreExpr = 1;
106 }
107 elsif ($oper eq '-') {
108 0 $opcode->{Value} = - $opcode->{Value};
109 0 $parser->checkRangeInteger($opcode);
110 0 $op->del();
111 0 $OneMoreExpr = 1;
112 }
113 elsif ($oper eq '~') {
114 0 $opcode->{Value} = ~ $opcode->{Value};
115 0 $parser->checkRangeInteger($opcode);
116 0 $op->del();
117 0 $OneMoreExpr = 1;
118 }
119 elsif ($oper eq '!') {
120 0 ▶ $opcode->{Value} = ($opcode->{Value}) ? 0 : 1;
Branch: 1 branch
BranchTrueFalseTotal
$opcode->{'Value'} ? : 0 0 0
121 0 $opcode->{TypeDef} = 'TYPE_BOOLEAN';
122 0 $op->del();
123 0 $OneMoreExpr = 1;
124 }
125 elsif ($oper eq '++') {
126 0 $opcode->{Value} ++;
127 0 $parser->checkRangeInteger($opcode);
128 0 $op->del();
129 0 $OneMoreExpr = 1;
130 }
131 elsif ($oper eq '--') {
132 0 $opcode->{Value} --;
133 0 $parser->checkRangeInteger($opcode);
134 0 $op->del();
135 0 $OneMoreExpr = 1;
136 }
137 else {
138 0 croak "INTERNAL ERROR evalUnopInteger (op:$oper)\n";
139 }
140 0 return;
141 }
142
143 0 ▶sub evalUnopFloat {
Subroutine evalUnopFloat: not called CC=8 SCAR=42.8
Pod undocumented
144 0 my $parser = shift;
145 0 my ($op, $cst) = @_;
146 0 my $opcode = $cst->{OpCode};
147 0 my $oper = $op->{OpCode}->{Operator};
148 0 ▶ if ($oper eq 'typeof') {
Branch: 7 branches
BranchTrueFalseTotal
if ($oper eq 'typeof') { } 0 0 0
elsif ($oper eq 'isvalid') { } 0 0 0
elsif ($oper eq '-') { } 0 0 0
elsif ($oper eq '~') { } 0 0 0
elsif ($oper eq '!') { } 0 0 0
elsif ($oper eq '++') { } 0 0 0
elsif ($oper eq '--') { } 0 0 0
149 # if (interpreter supports float)
150 # integer(1)
151 # else
152 # invalid
153 }
154 elsif ($oper eq 'isvalid') {
155 # if (interpreter supports float)
156 # boolean(true)
157 # else
158 # invalid
159 }
160 elsif ($oper eq '-') {
161 0 $opcode->{Value} = - $opcode->{Value};
162 0 $parser->checkRangeFloat($opcode);
163 0 $op->del();
164 0 $OneMoreExpr = 1;
165 }
166 elsif ($oper eq '~') {
167 }
168 elsif ($oper eq '!') {
169 # if (interpreter supports float)
170 # boolean
171 # else
172 # invalid
173 }
174 elsif ($oper eq '++') {
175 0 $opcode->{Value} ++;
176 0 $parser->checkRangeFloat($opcode);
177 0 $op->del();
178 0 $OneMoreExpr = 1;
179 }
180 elsif ($oper eq '--') {
181 0 $opcode->{Value} --;
182 0 $parser->checkRangeFloat($opcode);
183 0 $op->del();
184 0 $OneMoreExpr = 1;
185 }
186 else {
187 0 croak "INTERNAL ERROR evalUnopFloat (op:$oper)\n";
188 }
189 0 return;
190 }
191
192 0 ▶sub evalUnopString {
Subroutine evalUnopString: not called CC=9 SCAR=45.0
Pod undocumented
193 0 my $parser = shift;
194 0 my ($op, $cst) = @_;
195 0 my $opcode = $cst->{OpCode};
196 0 my $oper = $op->{OpCode}->{Operator};
197 0 ▶ if ($oper eq 'typeof') {
Branch: 7 branches
BranchTrueFalseTotal
if ($oper eq 'typeof') { } 0 0 0
elsif ($oper eq 'isvalid') { } 0 0 0
elsif ($oper eq '-') { } 0 0 0
elsif ($oper eq '~') { } 0 0 0
elsif ($oper eq '!') { } 0 0 0
elsif ($oper eq '++') { } 0 0 0
elsif ($oper eq '--') { } 0 0 0
198 0 $opcode->{TypeDef} = 'TYPE_INTEGER';
199 0 $opcode->{Value} = 2;
200 0 $op->del();
201 0 $OneMoreExpr = 1;
202 }
203 elsif ($oper eq 'isvalid') {
204 0 $opcode->{TypeDef} = 'TYPE_BOOLEAN';
205 0 $opcode->{Value} = 1;
206 0 $op->del();
207 0 $OneMoreExpr = 1;
208 }
209 elsif ($oper eq '-') {
210 }
211 elsif ($oper eq '~') {
212 }
213 elsif ($oper eq '!') {
214 0 ▶ $opcode->{Value} = (length $opcode->{Value}) ? 0 : 1;
Branch: 1 branch
BranchTrueFalseTotal
length $opcode->{'Value'} ? : 0 0 0
215 0 $opcode->{TypeDef} = 'TYPE_BOOLEAN';
216 0 $op->del();
217 0 $OneMoreExpr = 1;
218 }
219 elsif ($oper eq '++') {
220 }
221 elsif ($oper eq '--') {
222 }
223 else {
224 0 croak "INTERNAL ERROR evalUnopString (op:$oper)\n";
225 }
226 0 return;
227 }
228
229 0 ▶sub evalUnopBoolean {
Subroutine evalUnopBoolean: not called CC=9 SCAR=45.0
Pod undocumented
230 0 my $parser = shift;
231 0 my ($op, $cst) = @_;
232 0 my $opcode = $cst->{OpCode};
233 0 my $oper = $op->{OpCode}->{Operator};
234 0 ▶ if ($oper eq 'typeof') {
Branch: 7 branches
BranchTrueFalseTotal
if ($oper eq 'typeof') { } 0 0 0
elsif ($oper eq 'isvalid') { } 0 0 0
elsif ($oper eq '-') { } 0 0 0
elsif ($oper eq '~') { } 0 0 0
elsif ($oper eq '!') { } 0 0 0
elsif ($oper eq '++') { } 0 0 0
elsif ($oper eq '--') { } 0 0 0
235 0 $opcode->{TypeDef} = 'TYPE_INTEGER';
236 0 $opcode->{Value} = 3;
237 0 $op->del();
238 0 $OneMoreExpr = 1;
239 }
240 elsif ($oper eq 'isvalid') {
241 0 $opcode->{Value} = 1;
242 0 $op->del();
243 0 $OneMoreExpr = 1;
244 }
245 elsif ($oper eq '-') {
246 }
247 elsif ($oper eq '~') {
248 }
249 elsif ($oper eq '!') {
250 0 ▶ $opcode->{Value} = ($opcode->{Value}) ? 0 : 1;
Branch: 1 branch
BranchTrueFalseTotal
$opcode->{'Value'} ? : 0 0 0
251 0 $op->del();
252 0 $OneMoreExpr = 1;
253 }
254 elsif ($oper eq '++') {
255 }
256 elsif ($oper eq '--') {
257 }
258 else {
259 0 croak "INTERNAL ERROR evalUnopBoolean (op:$oper)\n";
260 }
261 0 return;
262 }
263
264 0 ▶sub evalUnopInvalid {
Subroutine evalUnopInvalid: not called CC=8 SCAR=42.8
Pod undocumented
265 0 my $parser = shift;
266 0 my ($op, $cst) = @_;
267 0 my $opcode = $cst->{OpCode};
268 0 my $oper = $op->{OpCode}->{Operator};
269 0 ▶ if ($oper eq 'typeof') {
Branch: 7 branches
BranchTrueFalseTotal
if ($oper eq 'typeof') { } 0 0 0
elsif ($oper eq 'isvalid') { } 0 0 0
elsif ($oper eq '-') { } 0 0 0
elsif ($oper eq '~') { } 0 0 0
elsif ($oper eq '!') { } 0 0 0
elsif ($oper eq '++') { } 0 0 0
elsif ($oper eq '--') { } 0 0 0
270 0 $opcode->{TypeDef} = 'TYPE_INTEGER';
271 0 $opcode->{Value} = 4;
272 0 $op->del();
273 0 $OneMoreExpr = 1;
274 }
275 elsif ($oper eq 'isvalid') {
276 0 $opcode->{TypeDef} = 'TYPE_BOOLEAN';
277 0 $opcode->{Value} = 0;
278 0 $op->del();
279 0 $OneMoreExpr = 1;
280 }
281 elsif ($oper eq '-') {
282 0 $op->del();
283 0 $OneMoreExpr = 1;
284 }
285 elsif ($oper eq '~') {
286 0 $op->del();
287 0 $OneMoreExpr = 1;
288 }
289 elsif ($oper eq '!') {
290 0 $op->del();
291 0 $OneMoreExpr = 1;
292 }
293 elsif ($oper eq '++') {
294 0 $op->del();
295 0 $OneMoreExpr = 1;
296 }
297 elsif ($oper eq '--') {
298 0 $op->del();
299 0 $OneMoreExpr = 1;
300 }
301 else {
302 0 croak "INTERNAL ERROR evalUnopInvalid (op:$oper)\n";
303 }
304 0 return;
305 }
306
307 0 ▶sub evalBinopInteger {
Subroutine evalBinopInteger: not called CC=28 SCAR=66.5
Pod undocumented
308 0 my $parser = shift;
309 0 my ($op, $left, $right) = @_;
310 0 my $oper = $op->{OpCode}->{Operator};
311 0 ▶ if ($oper eq '+') {
Branch: 18 branches
BranchTrueFalseTotal
if ($oper eq '+') { } 0 0 0
elsif ($oper eq '-') { } 0 0 0
elsif ($oper eq '*') { } 0 0 0
elsif ($oper eq '/') { } 0 0 0
elsif ($oper eq 'div') { } 0 0 0
elsif ($oper eq '%') { } 0 0 0
elsif ($oper eq '<<') { } 0 0 0
elsif ($oper eq '>>') { } 0 0 0
elsif ($oper eq '>>>') { } 0 0 0
elsif ($oper eq '<') { } 0 0 0
elsif ($oper eq '>') { } 0 0 0
elsif ($oper eq '<=') { } 0 0 0
elsif ($oper eq '>=') { } 0 0 0
elsif ($oper eq '==') { } 0 0 0
elsif ($oper eq '!=') { } 0 0 0
elsif ($oper eq '&') { } 0 0 0
elsif ($oper eq '^') { } 0 0 0
elsif ($oper eq '|') { } 0 0 0
312 0 $left->{OpCode}->{Value} += $right->{OpCode}->{Value};
313 0 $parser->checkRangeInteger($left->{OpCode});
314 0 $right->del();
315 0 $op->del();
316 0 $OneMoreExpr = 1;
317 }
318 elsif ($oper eq '-') {
319 0 $left->{OpCode}->{Value} -= $right->{OpCode}->{Value};
320 0 $parser->checkRangeInteger($left->{OpCode});
321 0 $right->del();
322 0 $op->del();
323 0 $OneMoreExpr = 1;
324 }
325 elsif ($oper eq '*') {
326 0 $left->{OpCode}->{Value} *= $right->{OpCode}->{Value};
327 0 $parser->checkRangeInteger($left->{OpCode});
328 0 $right->del();
329 0 $op->del();
330 0 $OneMoreExpr = 1;
331 }
332 elsif ($oper eq '/') {
333 0 ▶ if ($right->{OpCode}->{Value} == 0) {
Branch: 1 branch
BranchTrueFalseTotal
if ($right->{"OpCode"}{"Value"} == bless( {"sign" => "+","value" => bless( [0], 'Math::BigInt::Calc' )}, 'Math::BigInt' )) 0 0 0
334 0 $left->{OpCode}->{TypeDef} = 'TYPE_INVALID';
335 0 delete $left->{OpCode}->{Value};
336 0 $parser->optWarning($op, "Division by zero.\n");
337 0 $right->del();
338 0 $op->del();
339 0 $OneMoreExpr = 1;
340 }
341 }
342 elsif ($oper eq 'div') {
343 0 ▶ if ($right->{OpCode}->{Value} == 0) {
Branch: 1 branch
BranchTrueFalseTotal
if ($right->{'OpCode'}{'Value'} == {sign => '+', value => ['0']}) { } 0 0 0
344 0 $left->{OpCode}->{TypeDef} = 'TYPE_INVALID';
345 0 delete $left->{OpCode}->{Value};
346 0 $parser->optWarning($op, "Integer division by zero.\n");
347 }
348 else {
349 1 ▶ use integer;
Subroutine BEGIN: called CC=1 SCAR=0.0
350 0 $left->{OpCode}->{Value} /= $right->{OpCode}->{Value};
351 0 $parser->checkRangeInteger($left->{OpCode});
352 }
353 0 $right->del();
354 0 $op->del();
355 0 $OneMoreExpr = 1;
356 }
357 elsif ($oper eq '%') {
358 0 ▶ if ($right->{OpCode}->{Value} == 0) {
Branch: 1 branch
BranchTrueFalseTotal
if ($right->{'OpCode'}{'Value'} == {sign => '+', value => ['0']}) { } 0 0 0
359 0 $left->{OpCode}->{TypeDef} = 'TYPE_INVALID';
360 0 delete $left->{OpCode}->{Value};
361 0 $parser->optWarning($op, "Reminder by zero.\n");
362 }
363 else {
364 0 $left->{OpCode}->{Value} %= $right->{OpCode}->{Value};
365 0 $parser->checkRangeInteger($left->{OpCode});
366 }
367 0 $right->del();
368 0 $op->del();
369 0 $OneMoreExpr = 1;
370 }
371 elsif ($oper eq '<<') {
372 0 $left->{OpCode}->{Value} <<= $right->{OpCode}->{Value};
373 0 $parser->checkRangeInteger($left->{OpCode});
374 0 $right->del();
375 0 $op->del();
376 0 $OneMoreExpr = 1;
377 }
378 elsif ($oper eq '>>') {
379 0 $left->{OpCode}->{Value} >>= $right->{OpCode}->{Value};
380 0 $parser->checkRangeInteger($left->{OpCode});
381 0 $right->del();
382 0 $op->del();
383 0 $OneMoreExpr = 1;
384 }
385 elsif ($oper eq '>>>') {
386 0 my $bit = $left->{OpCode}->{Value} & 0x80000000;
387 0 $left->{OpCode}->{Value} >>= $right->{OpCode}->{Value};
388 0 $left->{OpCode}->{Value} |= $bit;
389 0 $parser->checkRangeInteger($left->{OpCode});
390 0 $right->del();
391 0 $op->del();
392 0 $OneMoreExpr = 1;
393 }
394 elsif ($oper eq '<') {
395 0 ▶ $left->{OpCode}->{Value} = ($left->{OpCode}->{Value} < $right->{OpCode}->{Value}) ? 1 : 0;
Branch: 1 branch
BranchTrueFalseTotal
$left->{'OpCode'}{'Value'} < $right->{'OpCode'}{'Value'} ? : 0 0 0
396 0 $left->{OpCode}->{TypeDef} = 'TYPE_BOOLEAN';
397 0 $right->del();
398 0 $op->del();
399 0 $OneMoreExpr = 1;
400 }
401 elsif ($oper eq '>') {
402 0 ▶ $left->{OpCode}->{Value} = ($left->{OpCode}->{Value} > $right->{OpCode}->{Value}) ? 1 : 0;
Branch: 1 branch
BranchTrueFalseTotal
$left->{'OpCode'}{'Value'} > $right->{'OpCode'}{'Value'} ? : 0 0 0
403 0 $left->{OpCode}->{TypeDef} = 'TYPE_BOOLEAN';
404 0 $right->del();
405 0 $op->del();
406 0 $OneMoreExpr = 1;
407 }
408 elsif ($oper eq '<=') {
409 0 ▶ $left->{OpCode}->{Value} = ($left->{OpCode}->{Value} <= $right->{OpCode}->{Value}) ? 1 : 0;
Branch: 1 branch
BranchTrueFalseTotal
$left->{'OpCode'}{'Value'} <= $right->{'OpCode'}{'Value'} ? : 0 0 0
410 0 $left->{OpCode}->{TypeDef} = 'TYPE_BOOLEAN';
411 0 $right->del();
412 0 $op->del();
413 0 $OneMoreExpr = 1;
414 }
415 elsif ($oper eq '>=') {
416 0 ▶ $left->{OpCode}->{Value} = ($left->{OpCode}->{Value} >= $right->{OpCode}->{Value}) ? 1 : 0;
Branch: 1 branch
BranchTrueFalseTotal
$left->{'OpCode'}{'Value'} >= $right->{'OpCode'}{'Value'} ? : 0 0 0
417 0 $left->{OpCode}->{TypeDef} = 'TYPE_BOOLEAN';
418 0 $right->del();
419 0 $op->del();
420 0 $OneMoreExpr = 1;
421 }
422 elsif ($oper eq '==') {
423 0 ▶ $left->{OpCode}->{Value} = ($left->{OpCode}->{Value} == $right->{OpCode}->{Value}) ? 1 : 0;
Branch: 1 branch
BranchTrueFalseTotal
$left->{'OpCode'}{'Value'} == $right->{'OpCode'}{'Value'} ? : 0 0 0
424 0 $left->{OpCode}->{TypeDef} = 'TYPE_BOOLEAN';
425 0 $right->del();
426 0 $op->del();
427 0 $OneMoreExpr = 1;
428 }
429 elsif ($oper eq '!=') {
430 0 ▶ $left->{OpCode}->{Value} = ($left->{OpCode}->{Value} != $right->{OpCode}->{Value}) ? 1 : 0;
Branch: 1 branch
BranchTrueFalseTotal
$left->{'OpCode'}{'Value'} != $right->{'OpCode'}{'Value'} ? : 0 0 0
431 0 $left->{OpCode}->{TypeDef} = 'TYPE_BOOLEAN';
432 0 $right->del();
433 0 $op->del();
434 0 $OneMoreExpr = 1;
435 }
436 elsif ($oper eq '&') {
437 0 $left->{OpCode}->{Value} &= $right->{OpCode}->{Value};
438 0 $parser->checkRangeInteger($left->{OpCode});
439 0 $right->del();
440 0 $op->del();
441 0 $OneMoreExpr = 1;
442 }
443 elsif ($oper eq '^') {
444 0 $left->{OpCode}->{Value} ^= $right->{OpCode}->{Value};
445 0 $parser->checkRangeInteger($left->{OpCode});
446 0 $right->del();
447 0 $op->del();
448 0 $OneMoreExpr = 1;
449 }
450 elsif ($oper eq '|') {
451 0 $left->{OpCode}->{Value} |= $right->{OpCode}->{Value};
452 0 $parser->checkRangeInteger($left->{OpCode});
453 0 $right->del();
454 0 $op->del();
455 0 $OneMoreExpr = 1;
456 }
457 else {
458 0 croak "INTERNAL ERROR evalBinopInteger (oper:$oper)\n";
459 }
460 0 return;
461 }
462
463 0 ▶sub evalBinopFloat {
Subroutine evalBinopFloat: not called CC=20 SCAR=60.4
Pod undocumented
464 0 my $parser = shift;
465 0 my ($op, $left, $right) = @_;
466 0 my $oper = $op->{OpCode}->{Operator};
467 0 ▶ if ($oper eq '+') {
Branch: 18 branches
BranchTrueFalseTotal
if ($oper eq '+') { } 0 0 0
elsif ($oper eq '-') { } 0 0 0
elsif ($oper eq '*') { } 0 0 0
elsif ($oper eq '/') { } 0 0 0
elsif ($oper eq 'div') { } 0 0 0
elsif ($oper eq '%') { } 0 0 0
elsif ($oper eq '<<') { } 0 0 0
elsif ($oper eq '>>') { } 0 0 0
elsif ($oper eq '>>>') { } 0 0 0
elsif ($oper eq '<') { } 0 0 0
elsif ($oper eq '>') { } 0 0 0
elsif ($oper eq '<=') { } 0 0 0
elsif ($oper eq '>=') { } 0 0 0
elsif ($oper eq '==') { } 0 0 0
elsif ($oper eq '!=') { } 0 0 0
elsif ($oper eq '&') { } 0 0 0
elsif ($oper eq '^') { } 0 0 0
elsif ($oper eq '|') { } 0 0 0
468 0 $left->{OpCode}->{Value} += $right->{OpCode}->{Value};
469 0 $parser->checkRangeFloat($left->{OpCode});
470 0 $right->del();
471 0 $op->del();
472 0 $OneMoreExpr = 1;
473 }
474 elsif ($oper eq '-') {
475 0 $left->{OpCode}->{Value} -= $right->{OpCode}->{Value};
476 0 $parser->checkRangeFloat($left->{OpCode});
477 0 $right->del();
478 0 $op->del();
479 0 $OneMoreExpr = 1;
480 }
481 elsif ($oper eq '*') {
482 0 $left->{OpCode}->{Value} *= $right->{OpCode}->{Value};
483 0 $parser->checkRangeFloat($left->{OpCode});
484 0 $right->del();
485 0 $op->del();
486 0 $OneMoreExpr = 1;
487 }
488 elsif ($oper eq '/') {
489 0 ▶ if ($right->{OpCode}->{Value} == 0) {
Branch: 1 branch
BranchTrueFalseTotal
if ($right->{'OpCode'}{'Value'} == {sign => '+', value => ['0']}) { } 0 0 0
490 0 $left->{OpCode}->{TypeDef} = 'TYPE_INVALID';
491 0 delete $left->{OpCode}->{Value};
492 0 $parser->optWarning($op, "Division by zero.\n");
493 }
494 else {
495 0 $left->{OpCode}->{Value} /= $right->{OpCode}->{Value};
496 0 $parser->checkRangeFloat($left->{OpCode});
497 }
498 0 $right->del();
499 0 $op->del();
500 0 $OneMoreExpr = 1;
501 }
502 elsif ($oper eq 'div') {
503 }
504 elsif ($oper eq '%') {
505 }
506 elsif ($oper eq '<<') {
507 }
508 elsif ($oper eq '>>') {
509 }
510 elsif ($oper eq '>>>') {
511 }
512 elsif ($oper eq '<') {
513 }
514 elsif ($oper eq '>') {
515 }
516 elsif ($oper eq '<=') {
517 }
518 elsif ($oper eq '>=') {
519 }
520 elsif ($oper eq '==') {
521 }
522 elsif ($oper eq '!=') {
523 }
524 elsif ($oper eq '&') {
525 }
526 elsif ($oper eq '^') {
527 }
528 elsif ($oper eq '|') {
529 }
530 else {
531 0 croak "INTERNAL ERROR evalBinopFloat (oper:$oper)\n";
532 }
533 0 return;
534 }
535
536 0 ▶sub optIdtLeftInteger {
Subroutine optIdtLeftInteger: not called CC=58 SCAR=81.4
Pod undocumented
537 0 my $parser = shift;
538 0 my ($op, $left, $right) = @_;
539 0 my $val = $left->{OpCode}->{Value};
540 0 my $oper = $op->{OpCode}->{Operator};
541 0 ▶ if ($val == 0) {
Branch: 3 branches
BranchTrueFalseTotal
if ($val == {sign => '+', value => ['0']}) { } 0 0 0
elsif ($val == {sign => '+', value => ['1']}) { } 0 0 0
elsif ($val == {sign => '-', value => [1]}) { } 0 0 0
542 0 ▶ if ($oper eq '+') {
Branch: 18 branches
BranchTrueFalseTotal
if ($oper eq '+') { } 0 0 0
elsif ($oper eq '-') { } 0 0 0
elsif ($oper eq '*') { } 0 0 0
elsif ($oper eq '/') { } 0 0 0
elsif ($oper eq 'div') { } 0 0 0
elsif ($oper eq '%') { } 0 0 0
elsif ($oper eq '<<') { } 0 0 0
elsif ($oper eq '>>') { } 0 0 0
elsif ($oper eq '>>>') { } 0 0 0
elsif ($oper eq '<') { } 0 0 0
elsif ($oper eq '>') { } 0 0 0
elsif ($oper eq '<=') { } 0 0 0
elsif ($oper eq '>=') { } 0 0 0
elsif ($oper eq '==') { } 0 0 0
elsif ($oper eq '!=') { } 0 0 0
elsif ($oper eq '&') { } 0 0 0
elsif ($oper eq '^') { } 0 0 0
elsif ($oper eq '|') { } 0 0 0
543 0 $op->del();
544 0 $left->del();
545 0 $OneMoreExpr = 1;
546 }
547 elsif ($oper eq '-') {
548 0 $left->del();
549 0 bless($op->{OpCode}, 'UnaryOp');
550 0 $OneMoreExpr = 1;
551 }
552 elsif ($oper eq '*') {
553 0 $op->del();
554 0 $right->insert(new Pop($parser));
555 0 $OneMoreExpr = 1;
556 }
557 elsif ($oper eq '/') {
558 }
559 elsif ($oper eq 'div') {
560 0 $op->del();
561 0 $right->insert(new Pop($parser));
562 0 $OneMoreExpr = 1;
563 }
564 elsif ($oper eq '%') {
565 0 $op->del();
566 0 $right->insert(new Pop($parser));
567 0 $OneMoreExpr = 1;
568 }
569 elsif ($oper eq '<<') {
570 0 $op->del();
571 0 $op->insert(new Pop($parser));
572 0 $OneMoreExpr = 1;
573 }
574 elsif ($oper eq '>>') {
575 0 $op->del();
576 0 $op->insert(new Pop($parser));
577 0 $OneMoreExpr = 1;
578 }
579 elsif ($oper eq '>>>') {
580 0 $op->del();
581 0 $op->insert(new Pop($parser));
582 0 $OneMoreExpr = 1;
583 }
584 elsif ($oper eq '<') {
585 }
586 elsif ($oper eq '>') {
587 }
588 elsif ($oper eq '<=') {
589 }
590 elsif ($oper eq '>=') {
591 }
592 elsif ($oper eq '==') {
593 }
594 elsif ($oper eq '!=') {
595 }
596 elsif ($oper eq '&') {
597 0 $op->del();
598 0 $right->insert(new Pop($parser));
599 0 $OneMoreExpr = 1;
600 }
601 elsif ($oper eq '^') {
602 0 $op->del();
603 0 $left->del();
604 0 $OneMoreExpr = 1;
605 }
606 elsif ($oper eq '|') {
607 0 $op->del();
608 0 $left->del();
609 0 $OneMoreExpr = 1;
610 }
611 else {
612 0 croak "INTERNAL ERROR optIdtLeftInteger (oper:$oper)\n";
613 }
614 }
615 elsif ($val == 1) {
616 0 ▶ if ($oper eq '+') {
Branch: 18 branches
BranchTrueFalseTotal
if ($oper eq '+') { } 0 0 0
elsif ($oper eq '-') { } 0 0 0
elsif ($oper eq '*') { } 0 0 0
elsif ($oper eq '/') { } 0 0 0
elsif ($oper eq 'div') { } 0 0 0
elsif ($oper eq '%') { } 0 0 0
elsif ($oper eq '<<') { } 0 0 0
elsif ($oper eq '>>') { } 0 0 0
elsif ($oper eq '>>>') { } 0 0 0
elsif ($oper eq '<') { } 0 0 0
elsif ($oper eq '>') { } 0 0 0
elsif ($oper eq '<=') { } 0 0 0
elsif ($oper eq '>=') { } 0 0 0
elsif ($oper eq '==') { } 0 0 0
elsif ($oper eq '!=') { } 0 0 0
elsif ($oper eq '&') { } 0 0 0
elsif ($oper eq '^') { } 0 0 0
elsif ($oper eq '|') { } 0 0 0
617 0 $left->del();
618 0 bless($op->{OpCode}, 'UnaryOp');
619 0 $op->{OpCode}->{Operator} = '++';
620 0 $OneMoreExpr = 1;
621 }
622 elsif ($oper eq '-') {
623 }
624 elsif ($oper eq '*') {
625 0 $left->del();
626 0 $op->del();
627 0 $OneMoreExpr = 1;
628 }
629 elsif ($oper eq '/') {
630 }
631 elsif ($oper eq 'div') {
632 }
633 elsif ($oper eq '%') {
634 }
635 elsif ($oper eq '<<') {
636 }
637 elsif ($oper eq '>>') {
638 }
639 elsif ($oper eq '>>>') {
640 }
641 elsif ($oper eq '<') {
642 }
643 elsif ($oper eq '>') {
644 }
645 elsif ($oper eq '<=') {
646 }
647 elsif ($oper eq '>=') {
648 }
649 elsif ($oper eq '==') {
650 }
651 elsif ($oper eq '!=') {
652 }
653 elsif ($oper eq '&') {
654 }
655 elsif ($oper eq '^') {
656 }
657 elsif ($oper eq '|') {
658 }
659 else {
660 0 croak "INTERNAL ERROR optIdtLeftInteger (oper:$oper)\n";
661 }
662 }
663 elsif ($val == -1) {
664 0 ▶ if ($oper eq '+') {
Branch: 18 branches
BranchTrueFalseTotal
if ($oper eq '+') { } 0 0 0
elsif ($oper eq '-') { } 0 0 0
elsif ($oper eq '*') { } 0 0 0
elsif ($oper eq '/') { } 0 0 0
elsif ($oper eq 'div') { } 0 0 0
elsif ($oper eq '%') { } 0 0 0
elsif ($oper eq '<<') { } 0 0 0
elsif ($oper eq '>>') { } 0 0 0
elsif ($oper eq '>>>') { } 0 0 0
elsif ($oper eq '<') { } 0 0 0
elsif ($oper eq '>') { } 0 0 0
elsif ($oper eq '<=') { } 0 0 0
elsif ($oper eq '>=') { } 0 0 0
elsif ($oper eq '==') { } 0 0 0
elsif ($oper eq '!=') { } 0 0 0
elsif ($oper eq '&') { } 0 0 0
elsif ($oper eq '^') { } 0 0 0
elsif ($oper eq '|') { } 0 0 0
665 0 $left->del();
666 0 bless($op->{OpCode}, 'UnaryOp');
667 0 $op->{OpCode}->{Operator} = '--';
668 0 $OneMoreExpr = 1;
669 }
670 elsif ($oper eq '-') {
671 }
672 elsif ($oper eq '*') {
673 0 $left->del();
674 0 bless($op->{OpCode}, 'UnaryOp');
675 0 $op->{OpCode}->{Operator} = '-';
676 0 $OneMoreExpr = 1;
677 }
678 elsif ($oper eq '/') {
679 }
680 elsif ($oper eq 'div') {
681 }
682 elsif ($oper eq '%') {
683 }
684 elsif ($oper eq '<<') {
685 }
686 elsif ($oper eq '>>') {
687 }
688 elsif ($oper eq '>>>') {
689 }
690 elsif ($oper eq '<') {
691 }
692 elsif ($oper eq '>') {
693 }
694 elsif ($oper eq '<=') {
695 }
696 elsif ($oper eq '>=') {
697 }
698 elsif ($oper eq '==') {
699 }
700 elsif ($oper eq '!=') {
701 }
702 elsif ($oper eq '&') {
703 }
704 elsif ($oper eq '^') {
705 }
706 elsif ($oper eq '|') {
707 }
708 else {
709 0 croak "INTERNAL ERROR optIdtLeftInteger (oper:$oper)\n";
710 }
711 }
712 0 return;
713 }
714
715 0 ▶sub optIdtRightInteger {
Subroutine optIdtRightInteger: not called CC=58 SCAR=81.4
Pod undocumented
716 0 my $parser = shift;
717 0 my ($op, $left, $right) = @_;
718 0 my $val = $right->{OpCode}->{Value};
719 0 my $oper = $op->{OpCode}->{Operator};
720 0 ▶ if ($val == 0) {
Branch: 3 branches
BranchTrueFalseTotal
if ($val == {sign => '+', value => ['0']}) { } 0 0 0
elsif ($val == {sign => '+', value => ['1']}) { } 0 0 0
elsif ($val == {sign => '-', value => [1]}) { } 0 0 0
721 0 ▶ if ($oper eq '+') {
Branch: 18 branches
BranchTrueFalseTotal
if ($oper eq '+') { } 0 0 0
elsif ($oper eq '-') { } 0 0 0
elsif ($oper eq '*') { } 0 0 0
elsif ($oper eq '/') { } 0 0 0
elsif ($oper eq 'div') { } 0 0 0
elsif ($oper eq '%') { } 0 0 0
elsif ($oper eq '<<') { } 0 0 0
elsif ($oper eq '>>') { } 0 0 0
elsif ($oper eq '>>>') { } 0 0 0
elsif ($oper eq '<') { } 0 0 0
elsif ($oper eq '>') { } 0 0 0
elsif ($oper eq '<=') { } 0 0 0
elsif ($oper eq '>=') { } 0 0 0
elsif ($oper eq '==') { } 0 0 0
elsif ($oper eq '!=') { } 0 0 0
elsif ($oper eq '&') { } 0 0 0
elsif ($oper eq '^') { } 0 0 0
elsif ($oper eq '|') { } 0 0 0
722 0 $op->del();
723 0 $right->del();
724 0 $OneMoreExpr = 1;
725 }
726 elsif ($oper eq '-') {
727 0 $op->del();
728 0 $right->del();
729 0 $OneMoreExpr = 1;
730 }
731 elsif ($oper eq '*') {
732 0 $op->del();
733 0 $left->insert(new Pop($parser));
734 0 $OneMoreExpr = 1;
735 }
736 elsif ($oper eq '/') {
737 0 $op->del();
738 0 $left->insert(new Pop($parser));
739 0 $right->{OpCode}->{TypeDef} = 'TYPE_INVALID';
740 0 $OneMoreExpr = 1;
741 0 $parser->optWarning($op, "Division by zero.\n");
742 }
743 elsif ($oper eq 'div') {
744 0 $op->del();
745 0 $left->insert(new Pop($parser));
746 0 $right->{OpCode}->{TypeDef} = 'TYPE_INVALID';
747 0 $OneMoreExpr = 1;
748 0 $parser->optWarning($op, "Integer division by zero.\n");
749 }
750 elsif ($oper eq '%') {
751 0 $op->del();
752 0 $left->insert(new Pop($parser));
753 0 $right->{OpCode}->{TypeDef} = 'TYPE_INVALID';
754 0 $OneMoreExpr = 1;
755 0 $parser->optWarning($op, "Reminder by zero.\n");
756 }
757 elsif ($oper eq '<<') {
758 0 $op->del();
759 0 $right->del();
760 0 $OneMoreExpr = 1;
761 }
762 elsif ($oper eq '>>') {
763 0 $op->del();
764 0 $right->del();
765 0 $OneMoreExpr = 1;
766 }
767 elsif ($oper eq '>>>') {
768 0 $op->del();
769 0 $right->del();
770 0 $OneMoreExpr = 1;
771 }
772 elsif ($oper eq '<') {
773 }
774 elsif ($oper eq '>') {
775 }
776 elsif ($oper eq '<=') {
777 }
778 elsif ($oper eq '>=') {
779 }
780 elsif ($oper eq '==') {
781 }
782 elsif ($oper eq '!=') {
783 }
784 elsif ($oper eq '&') {
785 0 $op->del();
786 0 $left->insert(new Pop($parser));
787 0 $OneMoreExpr = 1;
788 }
789 elsif ($oper eq '^') {
790 0 $op->del();
791 0 $right->del();
792 0 $OneMoreExpr = 1;
793 }
794 elsif ($oper eq '|') {
795 0 $op->del();
796 0 $right->del();
797 0 $OneMoreExpr = 1;
798 }
799 else {
800 0 croak "INTERNAL ERROR optIdtRightInteger (oper:$oper)\n";
801 }
802 }
803 elsif ($val == 1) {
804 0 ▶ if ($oper eq '+') {
Branch: 18 branches
BranchTrueFalseTotal
if ($oper eq '+') { } 0 0 0
elsif ($oper eq '-') { } 0 0 0
elsif ($oper eq '*') { } 0 0 0
elsif ($oper eq '/') { } 0 0 0
elsif ($oper eq 'div') { } 0 0 0
elsif ($oper eq '%') { } 0 0 0
elsif ($oper eq '<<') { } 0 0 0
elsif ($oper eq '>>') { } 0 0 0
elsif ($oper eq '>>>') { } 0 0 0
elsif ($oper eq '<') { } 0 0 0
elsif ($oper eq '>') { } 0 0 0
elsif ($oper eq '<=') { } 0 0 0
elsif ($oper eq '>=') { } 0 0 0
elsif ($oper eq '==') { } 0 0 0
elsif ($oper eq '!=') { } 0 0 0
elsif ($oper eq '&') { } 0 0 0
elsif ($oper eq '^') { } 0 0 0
elsif ($oper eq '|') { } 0 0 0
805 0 $right->del();
806 0 bless($op->{OpCode}, 'UnaryOp');
807 0 $op->{OpCode}->{Operator} = '++';
808 0 $OneMoreExpr = 1;
809 }
810 elsif ($oper eq '-') {
811 0 $right->del();
812 0 bless($op->{OpCode}, 'UnaryOp');
813 0 $op->{OpCode}->{Operator} = '--';
814 0 $OneMoreExpr = 1;
815 }
816 elsif ($oper eq '*') {
817 0 $right->del();
818 0 $op->del();
819 0 $OneMoreExpr = 1;
820 }
821 elsif ($oper eq '/') {
822 }
823 elsif ($oper eq 'div') {
824 0 $right->del();
825 0 $op->del();
826 0 $OneMoreExpr = 1;
827 }
828 elsif ($oper eq '%') {
829 0 $op->del();
830 0 $left->insert(new Pop($parser));
831 0 $right->{OpCode}->{Value} = 0;
832 0 $OneMoreExpr = 1;
833 }
834 elsif ($oper eq '<<') {
835 }
836 elsif ($oper eq '>>') {
837 }
838 elsif ($oper eq '>>>') {
839 }
840 elsif ($oper eq '<') {
841 }
842 elsif ($oper eq '>') {
843 }
844 elsif ($oper eq '<=') {
845 }
846 elsif ($oper eq '>=') {
847 }
848 elsif ($oper eq '==') {
849 }
850 elsif ($oper eq '!=') {
851 }
852 elsif ($oper eq '&') {
853 }
854 elsif ($oper eq '^') {
855 }
856 elsif ($oper eq '|') {
857 }
858 else {
859 0 croak "INTERNAL ERROR optIdtRightInteger (oper:$oper)\n";
860 }
861 }
862 elsif ($val == -1) {
863 0 ▶ if ($oper eq '+') {
Branch: 18 branches
BranchTrueFalseTotal
if ($oper eq '+') { } 0 0 0
elsif ($oper eq '-') { } 0 0 0
elsif ($oper eq '*') { } 0 0 0
elsif ($oper eq '/') { } 0 0 0
elsif ($oper eq 'div') { } 0 0 0
elsif ($oper eq '%') { } 0 0 0
elsif ($oper eq '<<') { } 0 0 0
elsif ($oper eq '>>') { } 0 0 0
elsif ($oper eq '>>>') { } 0 0 0
elsif ($oper eq '<') { } 0 0 0
elsif ($oper eq '>') { } 0 0 0
elsif ($oper eq '<=') { } 0 0 0
elsif ($oper eq '>=') { } 0 0 0
elsif ($oper eq '==') { } 0 0 0
elsif ($oper eq '!=') { } 0 0 0
elsif ($oper eq '&') { } 0 0 0
elsif ($oper eq '^') { } 0 0 0
elsif ($oper eq '|') { } 0 0 0
864 0 $right->del();
865 0 bless($op->{OpCode}, 'UnaryOp');
866 0 $op->{OpCode}->{Operator} = '--';
867 0 $OneMoreExpr = 1;
868 }
869 elsif ($oper eq '-') {
870 0 $right->del();
871 0 bless($op->{OpCode}, 'UnaryOp');
872 0 $op->{OpCode}->{Operator} = '++';
873 0 $OneMoreExpr = 1;
874 }
875 elsif ($oper eq '*') {
876 0 $right->del();
877 0 bless($op->{OpCode}, 'UnaryOp');
878 0 $op->{OpCode}->{Operator} = '-';
879 0 $OneMoreExpr = 1;
880 }
881 elsif ($oper eq '/') {
882 }
883 elsif ($oper eq 'div') {
884 0 $right->del();
885 0 bless($op->{OpCode}, 'UnaryOp');
886 0 $op->{OpCode}->{Operator} = '-';
887 0 $OneMoreExpr = 1;
888 }
889 elsif ($oper eq '%') {
890 0 $op->del();
891 0 $left->insert(new Pop($parser));
892 0 $right->{OpCode}->{Value} = 0;
893 0 $OneMoreExpr = 1;
894 }
895 elsif ($oper eq '<<') {
896 }
897 elsif ($oper eq '>>') {
898 }
899 elsif ($oper eq '>>>') {
900 }
901 elsif ($oper eq '<') {
902 }
903 elsif ($oper eq '>') {
904 }
905 elsif ($oper eq '<=') {
906 }
907 elsif ($oper eq '>=') {
908 }
909 elsif ($oper eq '==') {
910 }
911 elsif ($oper eq '!=') {
912 }
913 elsif ($oper eq '&') {
914 }
915 elsif ($oper eq '^') {
916 }
917 elsif ($oper eq '|') {
918 }
919 else {
920 0 croak "INTERNAL ERROR optIdtRightInteger (oper:$oper)\n";
921 }
922 }
923 0 return;
924 }
925
926 0 ▶sub optIdtRightFloat {
Subroutine optIdtRightFloat: not called CC=20 SCAR=60.4
Pod undocumented
927 0 my $parser = shift;
928 0 my ($op, $left, $right) = @_;
929 0 my $val = $right->{OpCode}->{Value};
930 0 my $oper = $op->{OpCode}->{Operator};
931 0 ▶ if ($val == 0) {
Branch: 1 branch
BranchTrueFalseTotal
if ($val == bless( {"sign" => "+","value" => bless( [0], 'Math::BigInt::Calc' )}, 'Math::BigInt' )) 0 0 0
932 0 ▶ if ($oper eq '+') {
Branch: 18 branches
BranchTrueFalseTotal
if ($oper eq '+') { } 0 0 0
elsif ($oper eq '-') { } 0 0 0
elsif ($oper eq '*') { } 0 0 0
elsif ($oper eq '/') { } 0 0 0
elsif ($oper eq 'div') { } 0 0 0
elsif ($oper eq '%') { } 0 0 0
elsif ($oper eq '<<') { } 0 0 0
elsif ($oper eq '>>') { } 0 0 0
elsif ($oper eq '>>>') { } 0 0 0
elsif ($oper eq '<') { } 0 0 0
elsif ($oper eq '>') { } 0 0 0
elsif ($oper eq '<=') { } 0 0 0
elsif ($oper eq '>=') { } 0 0 0
elsif ($oper eq '==') { } 0 0 0
elsif ($oper eq '!=') { } 0 0 0
elsif ($oper eq '&') { } 0 0 0
elsif ($oper eq '^') { } 0 0 0
elsif ($oper eq '|') { } 0 0 0
933 }
934 elsif ($oper eq '-') {
935 }
936 elsif ($oper eq '*') {
937 }
938 elsif ($oper eq '/') {
939 0 $op->del();
940 0 $left->insert(new Pop($parser));
941 0 $right->{OpCode}->{TypeDef} = 'TYPE_INVALID';
942 0 $OneMoreExpr = 1;
943 0 $parser->optWarning($op, "Division by zero.\n");
944 }
945 elsif ($oper eq 'div') {
946 }
947 elsif ($oper eq '%') {
948 }
949 elsif ($oper eq '<<') {
950 }
951 elsif ($oper eq '>>') {
952 }
953 elsif ($oper eq '>>>') {
954 }
955 elsif ($oper eq '<') {
956 }
957 elsif ($oper eq '>') {
958 }
959 elsif ($oper eq '<=') {
960 }
961 elsif ($oper eq '>=') {
962 }
963 elsif ($oper eq '==') {
964 }
965 elsif ($oper eq '!=') {
966 }
967 elsif ($oper eq '&') {
968 }
969 elsif ($oper eq '^') {
970 }
971 elsif ($oper eq '|') {
972 }
973 else {
974 0 croak "INTERNAL ERROR optIdtRightFloat (oper:$oper)\n";
975 }
976 }
977 0 return;
978 }
979
980 0 ▶sub _optAddAsg {
Subroutine _optAddAsg: not called CC=4 SCAR=30.0
981 0 my ($asg, $cst) = @_;
982 0 my $val = $cst->{OpCode}->{Value};
983 0 ▶ if ($val == 1) {
Branch: 3 branches
BranchTrueFalseTotal
if ($val == {sign => '+', value => ['1']}) { } 0 0 0
elsif ($val == {sign => '+', value => ['0']}) { } 0 0 0
elsif ($val == {sign => '-', value => [1]}) { } 0 0 0
984 0 $cst->del();
985 0 bless($asg->{OpCode}, 'IncrVar');
986 }
987 elsif ($val == 0) {
988 0 $cst->del();
989 0 $asg->del();
990 0 $OneMoreExpr = 1;
991 }
992 elsif ($val == -1) {
993 0 $cst->del();
994 0 bless($asg->{OpCode}, 'DecrVar');
995 }
996 0 return;
997 }
998
999 0 ▶sub _optSubAsg {
Subroutine _optSubAsg: not called CC=4 SCAR=30.0
1000 0 my ($asg, $cst) = @_;
1001 0 my $val = $cst->{OpCode}->{Value};
1002 0 ▶ if ($val == 1) {
Branch: 3 branches
BranchTrueFalseTotal
if ($val == {sign => '+', value => ['1']}) { } 0 0 0
elsif ($val == {sign => '+', value => ['0']}) { } 0 0 0
elsif ($val == {sign => '-', value => [1]}) { } 0 0 0
1003 0 $cst->del();
1004 0 bless($asg->{OpCode}, 'DecrVar');
1005 }
1006 elsif ($val == 0) {
1007 0 $cst->del();
1008 0 $asg->del();
1009 0 $OneMoreExpr = 1;
1010 }
1011 elsif ($val == -1) {
1012 0 $cst->del();
1013 0 bless($asg->{OpCode}, 'IncrVar');
1014 }
1015 0 return;
1016 }
1017
1018 0 ▶sub optEvalExpr {
Subroutine optEvalExpr: not called CC=39 SCAR=73.5
Pod undocumented
1019 0 my $parser = shift;
1020 0 my ($expr) = @_;
1021
1022 0 my $cnt = 0;
1023 0 ▶ do {
Branch: 1 branch
BranchTrueFalseTotal
$OneMoreExpr and do { do { ++$cnt; $OneMoreExpr = bless( {"sign" => "+","value" => bless( [0], 'Math::BigInt::Calc' )}, 'Math::BigInt' ); for (my $node = $expr->getLastActive; defined $node; $node = $node->getPrevActive) { my $opcode = $node->{"OpCode"}; if ($opcode->isa("UnaryOp")) { my $prev = $node->getPrevActive; croak("INTERNAL ERROR optEvalExpr\n") unless defined $prev; if ($prev->{"OpCode"}->isa("LoadConst")) { my $type = $expr->{"OpCode"}{"TypeDef"}; if ($type eq "TYPE_INTEGER") { $parser->evalUnopInteger($node, $prev); } elsif ($type eq "TYPE_FLOAT") { $parser->evalUnopFloat($node, $prev); } elsif ($type eq "TYPE_STRING" or $type eq "TYPE_UTF8_STRING") { $parser->evalUnopString($node, $prev); } elsif ($type eq "TYPE_BOOLEAN") { $parser->evalUnopBoolean($node, $prev); } elsif ($type eq "TYPE_INVALID") { $parser->evalUnopInvalid($node, $prev); } else { croak("INTERNAL ERROR optEvalExpr (type:$type)\n"); } ; } ; } elsif ($opcode->isa("BinaryOp")) { my $right = $node->getPrevActive; croak("INTERNAL ERROR optEvalExpr\n") unless defined $right; my $left = $node->{"OpCode"}{"Left"}; croak("INTERNAL ERROR optEvalExpr (left)\n") unless defined $left; if ($left->{"OpCode"}->isa("LoadConst") and $left->{"OpCode"}{"TypeDef"} eq "TYPE_INVALID") { $right->del; $node->del; $OneMoreExpr = bless( {"sign" => "+","value" => bless( [1], 'Math::BigInt::Calc' )}, 'Math::BigInt' ); } elsif ($right->{"OpCode"}->isa("LoadConst") and $right->{"OpCode"}{"TypeDef"} eq "TYPE_INVALID") { $left->del; $node->del; $OneMoreExpr = bless( {"sign" => "+","value" => bless( [1], 'Math::BigInt::Calc' )}, 'Math::BigInt' ); } elsif ($left->{"OpCode"}->isa("LoadConst") and $right->{"OpCode"}->isa("LoadConst")) { my $type_l = $left->{"OpCode"}{"TypeDef"}; my $type_r = $right->{"OpCode"}{"TypeDef"}; if ($type_l eq $type_r) { if ($type_r eq "TYPE_INTEGER") { $parser->evalBinopInteger($node, $left, $right); } elsif ($type_r eq "TYPE_FLOAT") { $parser->evalBinopFloat($node, $left, $right); } ; } ; } elsif ($left->{"OpCode"}->isa("LoadConst")) { my $type = $left->{"OpCode"}{"TypeDef"}; if ($type eq "TYPE_INTEGER") { $parser->optIdtLeftInteger($node, $left, $right); } ; } elsif ($right->{"OpCode"}->isa("LoadConst")) { my $type = $right->{"OpCode"}{"TypeDef"}; if ($type eq "TYPE_INTEGER") { $parser->optIdtRightInteger($node, $left, $right); } elsif ($type eq "TYPE_FLOAT") { $parser->optIdtRightFloat($node, $left, $right); } ; } ; } elsif ($opcode->isa("AddAsg")) { my $prev = $node->getPrevActive; croak("INTERNAL ERROR optEvalExpr\n") unless defined $prev; if ($prev->{"OpCode"}->isa("LoadConst")) { if ($prev->{"OpCode"}{"TypeDef"} eq "TYPE_INTEGER" or $prev->{"OpCode"}{"TypeDef"} eq "TYPE_FLOAT") { _optAddAsg($node, $prev); } ; } ; } elsif ($opcode->isa("SubAsg")) { my $prev = $node->getPrevActive; croak("INTERNAL ERROR optEvalExpr\n") unless defined $prev; if ($prev->{"OpCode"}->isa("LoadConst")) { if ($prev->{"OpCode"}{"TypeDef"} eq "TYPE_INTEGER" or $prev->{"OpCode"}{"TypeDef"} eq "TYPE_FLOAT") { _optSubAsg($node, $prev); } ; } ; } ; } } } 0 0 0
1024 0 $cnt ++;
1025 # print "optim Expr $cnt\n";
1026 0 $OneMoreExpr = 0;
1027 0 ▶ for (my $node = $expr->getLastActive(); defined $node; $node = $node->getPrevActive()) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $node) 0 0 0
1028 0 my $opcode = $node->{OpCode};
1029 0 ▶ if ($opcode->isa('UnaryOp')) {
Branch: 4 branches
BranchTrueFalseTotal
if ($opcode->isa('UnaryOp')) { } 0 0 0
elsif ($opcode->isa('BinaryOp')) { } 0 0 0
elsif ($opcode->isa('AddAsg')) { } 0 0 0
elsif ($opcode->isa('SubAsg')) { } 0 0 0
1030 0 my $prev = $node->getPrevActive();
1031 0 ▶ croak "INTERNAL ERROR optEvalExpr\n"
Branch: 1 branch
BranchTrueFalseTotal
unless defined $prev 0 0 0
1032 unless (defined $prev);
1033 0 ▶ if ($prev->{OpCode}->isa('LoadConst')) {
Branch: 1 branch
BranchTrueFalseTotal
if ($prev->{"OpCode"}->isa("LoadConst")) 0 0 0
1034 0 my $type = $expr->{OpCode}->{TypeDef};
1035 0 ▶ if ($type eq 'TYPE_INTEGER') {
Branch: 5 branches
BranchTrueFalseTotal
if ($type eq 'TYPE_INTEGER') { } 0 0 0
elsif ($type eq 'TYPE_FLOAT') { } 0 0 0
elsif ($type eq 'TYPE_STRING' or $type eq 'TYPE_UTF8_STRING') { } 0 0 0
elsif ($type eq 'TYPE_BOOLEAN') { } 0 0 0
elsif ($type eq 'TYPE_INVALID') { } 0 0 0
1036 0 $parser->evalUnopInteger($node, $prev);
1037 }
1038 elsif ($type eq 'TYPE_FLOAT') {
1039 0 $parser->evalUnopFloat($node, $prev);
1040 }
1041 ▶ elsif ($type eq 'TYPE_STRING' or $type eq 'TYPE_UTF8_STRING') {
Condition0%0/3
$type eq "TYPE_STRING" or $type eq "TYPE_UTF8_STRING"
l!l&&r!l&&!r
000
MC/DC0%0/2
$type eq "TYPE_STRING" or $type eq "TYPE_UTF8_STRING"
$type eq "TYPE_STRING" $type eq "TYPE_UTF8_STRING"
Truth table0%0/3
A or B
A= $type eq "TYPE_STRING"B= $type eq "TYPE_UTF8_STRING"
ABresult
1X1
011
000
1042 0 $parser->evalUnopString($node, $prev);
1043 }
1044 elsif ($type eq 'TYPE_BOOLEAN') {
1045 0 $parser->evalUnopBoolean($node, $prev);
1046 }
1047 elsif ($type eq 'TYPE_INVALID') {
1048 0 $parser->evalUnopInvalid($node, $prev);
1049 }
1050 else {
1051 0 croak "INTERNAL ERROR optEvalExpr (type:$type)\n";
1052 }
1053 }
1054 }
1055 elsif ($opcode->isa('BinaryOp')) {
1056 0 my $right = $node->getPrevActive();
1057 0 ▶ croak "INTERNAL ERROR optEvalExpr\n"
Branch: 1 branch
BranchTrueFalseTotal
unless defined $right 0 0 0
1058 unless (defined $right);
1059 0 my $left = $node->{OpCode}->{Left};
1060 0 ▶ croak "INTERNAL ERROR optEvalExpr (left)\n"
Branch: 1 branch
BranchTrueFalseTotal
unless defined $left 0 0 0
1061 unless (defined $left);
1062 0 ▶ if ( $left->{OpCode}->isa('LoadConst')
Branch: 5 branches
BranchTrueFalseTotal
if ($left->{'OpCode'}->isa('LoadConst') and $left->{'OpCode'}{'TypeDef'} eq 'TYPE_INVALID') { } 0 0 0
elsif ($right->{'OpCode'}->isa('LoadConst') and $right->{'OpCode'}{'TypeDef'} eq 'TYPE_INVALID') { } 0 0 0
elsif ($left->{'OpCode'}->isa('LoadConst') and $right->{'OpCode'}->isa('LoadConst')) { } 0 0 0
elsif ($left->{'OpCode'}->isa('LoadConst')) { } 0 0 0
elsif ($right->{'OpCode'}->isa('LoadConst')) { } 0 0 0
Condition0%0/3
$left->{"OpCode"}->isa("LoadConst") and $left->{"OpCode"}{"TypeDef"} eq "TYPE_INVALID"
!ll&&!rl&&r
000
MC/DC0%0/2
$left->{"OpCode"}->isa("LoadConst") and $left->{"OpCode"}{"TypeDef"} eq "TYPE_INVALID"
$left->{"OpCode"}->isa("LoadConst") $left->{"OpCode"}{"TypeDef"} eq "TYPE_INVALID"
Truth table0%0/3
A and B
A= $left->{"OpCode"}->isa("LoadConst")B= $left->{"OpCode"}{"TypeDef"} eq "TYPE_INVALID"
ABresult
0X0
100
111
1063 and $left->{OpCode}->{TypeDef} eq 'TYPE_INVALID' ) {
1064 0 $right->del();
1065 0 $node->del();
1066 0 $OneMoreExpr = 1;
1067 }
1068 ▶ elsif ( $right->{OpCode}->isa('LoadConst')
Condition0%0/3
$right->{"OpCode"}->isa("LoadConst") and $right->{"OpCode"}{"TypeDef"} eq "TYPE_INVALID"
!ll&&!rl&&r
000
MC/DC0%0/2
$right->{"OpCode"}->isa("LoadConst") and $right->{"OpCode"}{"TypeDef"} eq "TYPE_INVALID"
$right->{"OpCode"}->isa("LoadConst") $right->{"OpCode"}{"TypeDef"} eq "TYPE_INVALID"
Truth table0%0/3
A and B
A= $right->{"OpCode"}->isa("LoadConst")B= $right->{"OpCode"}{"TypeDef"} eq "TYPE_INVALID"
ABresult
0X0
100
111
1069 and $right->{OpCode}->{TypeDef} eq 'TYPE_INVALID' ) {
1070 0 $left->del();
1071 0 $node->del();
1072 0 $OneMoreExpr = 1;
1073 }
1074 ▶ elsif ( $left->{OpCode}->isa('LoadConst')
Condition0%0/3
$left->{"OpCode"}->isa("LoadConst") and $right->{"OpCode"}->isa("LoadConst")
!ll&&!rl&&r
000
MC/DC0%0/2
$left->{"OpCode"}->isa("LoadConst") and $right->{"OpCode"}->isa("LoadConst")
$left->{"OpCode"}->isa("LoadConst") $right->{"OpCode"}->isa("LoadConst")
Truth table0%0/3
A and B
A= $left->{"OpCode"}->isa("LoadConst")B= $right->{"OpCode"}->isa("LoadConst")
ABresult
0X0
100
111
1075 and $right->{OpCode}->isa('LoadConst') ) {
1076 0 my $type_l = $left->{OpCode}->{TypeDef};
1077 0 my $type_r = $right->{OpCode}->{TypeDef};
1078 0 ▶ if ($type_l eq $type_r) {
Branch: 1 branch
BranchTrueFalseTotal
if ($type_l eq $type_r) 0 0 0
1079 0 ▶ if ($type_r eq 'TYPE_INTEGER') {
Branch: 2 branches
BranchTrueFalseTotal
if ($type_r eq 'TYPE_INTEGER') { } 0 0 0
elsif ($type_r eq 'TYPE_FLOAT') { } 0 0 0
1080 0 $parser->evalBinopInteger($node, $left, $right);
1081 }
1082 elsif ($type_r eq 'TYPE_FLOAT') {
1083 0 $parser->evalBinopFloat($node, $left, $right);
1084 }
1085 }
1086 }
1087 elsif ( $left->{OpCode}->isa('LoadConst') ) {
1088 0 my $type = $left->{OpCode}->{TypeDef};
1089 0 ▶ if ($type eq 'TYPE_INTEGER') {
Branch: 1 branch
BranchTrueFalseTotal
if ($type eq "TYPE_INTEGER") 0 0 0
1090 0 $parser->optIdtLeftInteger($node, $left, $right);
1091 }
1092 }
1093 elsif ( $right->{OpCode}->isa('LoadConst') ) {
1094 0 my $type = $right->{OpCode}->{TypeDef};
1095 0 ▶ if ($type eq 'TYPE_INTEGER') {
Branch: 2 branches
BranchTrueFalseTotal
if ($type eq 'TYPE_INTEGER') { } 0 0 0
elsif ($type eq 'TYPE_FLOAT') { } 0 0 0
1096 0 $parser->optIdtRightInteger($node, $left, $right);
1097 }
1098 elsif ($type eq 'TYPE_FLOAT') {
1099 0 $parser->optIdtRightFloat($node, $left, $right);
1100 }
1101 }
1102 }
1103 elsif ($opcode->isa('AddAsg')) {
1104 0 my $prev = $node->getPrevActive();
1105 0 ▶ croak "INTERNAL ERROR optEvalExpr\n"
Branch: 1 branch
BranchTrueFalseTotal
unless defined $prev 0 0 0
1106 unless (defined $prev);
1107 0 ▶ if ($prev->{OpCode}->isa('LoadConst')) {
Branch: 1 branch
BranchTrueFalseTotal
if ($prev->{"OpCode"}->isa("LoadConst")) 0 0 0
1108 0 ▶ if ( $prev->{OpCode}->{TypeDef} eq 'TYPE_INTEGER'
Branch: 1 branch
BranchTrueFalseTotal
if ($prev->{"OpCode"}{"TypeDef"} eq "TYPE_INTEGER" or $prev->{"OpCode"}{"TypeDef"} eq "TYPE_FLOAT") 0 0 0
Condition0%0/3
$prev->{"OpCode"}{"TypeDef"} eq "TYPE_INTEGER" or $prev->{"OpCode"}{"TypeDef"} eq "TYPE_FLOAT"
l!l&&r!l&&!r
000
MC/DC0%0/2
$prev->{"OpCode"}{"TypeDef"} eq "TYPE_INTEGER" or $prev->{"OpCode"}{"TypeDef"} eq "TYPE_FLOAT"
$prev->{"OpCode"}{"TypeDef"} eq "TYPE_INTEGER" $prev->{"OpCode"}{"TypeDef"} eq "TYPE_FLOAT"
Truth table0%0/3
A or B
A= $prev->{"OpCode"}{"TypeDef"} eq "TYPE_INTEGER"B= $prev->{"OpCode"}{"TypeDef"} eq "TYPE_FLOAT"
ABresult
1X1
011
000
1109 or $prev->{OpCode}->{TypeDef} eq 'TYPE_FLOAT' ) {
1110 0 _optAddAsg($node,$prev);
1111 }
1112 }
1113 }
1114 elsif ($opcode->isa('SubAsg')) {
1115 0 my $prev = $node->getPrevActive();
1116 0 ▶ croak "INTERNAL ERROR optEvalExpr\n"
Branch: 1 branch
BranchTrueFalseTotal
unless defined $prev 0 0 0
1117 unless (defined $prev);
1118 0 ▶ if ($prev->{OpCode}->isa('LoadConst')) {
Branch: 1 branch
BranchTrueFalseTotal
if ($prev->{"OpCode"}->isa("LoadConst")) 0 0 0
1119 0 ▶ if ( $prev->{OpCode}->{TypeDef} eq 'TYPE_INTEGER'
Branch: 1 branch
BranchTrueFalseTotal
if ($prev->{"OpCode"}{"TypeDef"} eq "TYPE_INTEGER" or $prev->{"OpCode"}{"TypeDef"} eq "TYPE_FLOAT") 0 0 0
Condition0%0/3
$prev->{"OpCode"}{"TypeDef"} eq "TYPE_INTEGER" or $prev->{"OpCode"}{"TypeDef"} eq "TYPE_FLOAT"
l!l&&r!l&&!r
000
MC/DC0%0/2
$prev->{"OpCode"}{"TypeDef"} eq "TYPE_INTEGER" or $prev->{"OpCode"}{"TypeDef"} eq "TYPE_FLOAT"
$prev->{"OpCode"}{"TypeDef"} eq "TYPE_INTEGER" $prev->{"OpCode"}{"TypeDef"} eq "TYPE_FLOAT"
Truth table0%0/3
A or B
A= $prev->{"OpCode"}{"TypeDef"} eq "TYPE_INTEGER"B= $prev->{"OpCode"}{"TypeDef"} eq "TYPE_FLOAT"
ABresult
1X1
011
000
1120 or $prev->{OpCode}->{TypeDef} eq 'TYPE_FLOAT' ) {
1121 0 _optSubAsg($node, $prev);
1122 }
1123 }
1124 }
1125 }
1126 }
1127 while ($OneMoreExpr);
1128 0 return $cnt > 1;
1129 }
1130
1131 0 ▶sub optLoadVarPop {
Subroutine optLoadVarPop: not called CC=9 SCAR=45.0
Pod undocumented
1132 0 my $parser = shift;
1133 0 my ($func) = @_;
1134
1135 0 ▶ for (my $node = $func->getFirstActive(); defined $node; $node = $node->getNextActive()) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $node) 0 0 0
1136 0 ▶ if ($node->{OpCode}->isa('LoadVar')) {
Branch: 1 branch
BranchTrueFalseTotal
if ($node->{"OpCode"}->isa("LoadVar")) 0 0 0
1137 0 my $next = $node->getNextActive();
1138 0 ▶ if (defined $next) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $next) 0 0 0
1139 0 my $opcode = $next->{OpCode};
1140 0 ▶ if ($opcode->isa('Pop')) {
Branch: 2 branches
BranchTrueFalseTotal
if ($opcode->isa('Pop')) { } 0 0 0
elsif ($opcode->isa('IncrVar') or $opcode->isa('DecrVar')) { } 0 0 0
1141 0 $node->del();
1142 0 $next->del();
1143 }
1144 ▶ elsif ( $opcode->isa('IncrVar') or $opcode->isa('DecrVar') ) {
Condition0%0/3
$opcode->isa("IncrVar") or $opcode->isa("DecrVar")
l!l&&r!l&&!r
000
MC/DC0%0/2
$opcode->isa("IncrVar") or $opcode->isa("DecrVar")
$opcode->isa("IncrVar") $opcode->isa("DecrVar")
Truth table0%0/3
A or B
A= $opcode->isa("IncrVar")B= $opcode->isa("DecrVar")
ABresult
1X1
011
000
1145 0 $next = $next->getNextActive();
1146 0 ▶ if (defined $next) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $next) 0 0 0
1147 0 ▶ if ($next->{OpCode}->isa('Pop')) {
Branch: 1 branch
BranchTrueFalseTotal
if ($next->{"OpCode"}->isa("Pop")) 0 0 0
1148 0 $node->del();
1149 0 $next->del();
1150 }
1151 }
1152 }
1153 }
1154 }
1155 }
1156 0 return;
1157 }
1158
1159 0 ▶sub optTobool {
Subroutine optTobool: not called CC=10 SCAR=47.0
Pod undocumented
1160 0 my $parser = shift;
1161 0 my ($func) = @_;
1162
1163 0 ▶ for (my $node = $func->getFirstActive(); defined $node; $node = $node->getNextActive()) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $node) 0 0 0
1164 0 ▶ if ($node->{OpCode}->isa('ToBool')) {
Branch: 1 branch
BranchTrueFalseTotal
if ($node->{"OpCode"}->isa("ToBool")) 0 0 0
1165 0 my $next = $node->getNextActive();
1166 0 ▶ if (defined $next) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $next) 0 0 0
1167 0 my $opcode = $next->{OpCode};
1168 0 ▶ if ( $opcode->isa('FalseJump')
Branch: 1 branch
BranchTrueFalseTotal
if ($opcode->isa("FalseJump") or $opcode->isa("ScAnd") or $opcode->isa("ScOr") or $opcode->isa("ToBool") or $opcode->isa("UnaryOp") and $opcode->{"Operator"} eq "!") 0 0 0
Condition0%0/15
$opcode->isa("FalseJump") or $opcode->isa("ScAnd") or $opcode->isa("ScOr") or $opcode->isa("ToBool") or $opcode->isa("UnaryOp") and $opcode->{"Operator"} eq "!"
l!l&&r!l&&!r
000
$opcode->isa("FalseJump") or $opcode->isa("ScAnd") or $opcode->isa("ScOr") or $opcode->isa("ToBool")
l!l&&r!l&&!r
000
$opcode->isa("FalseJump") or $opcode->isa("ScAnd") or $opcode->isa("ScOr")
l!l&&r!l&&!r
000
$opcode->isa("FalseJump") or $opcode->isa("ScAnd")
l!l&&r!l&&!r
000
$opcode->isa("UnaryOp") and $opcode->{"Operator"} eq "!"
!ll&&!rl&&r
000
MC/DC0%0/6
$opcode->isa("FalseJump") or $opcode->isa("ScAnd") or $opcode->isa("ScOr") or $opcode->isa("ToBool") or $opcode->isa("UnaryOp") and $opcode->{"Operator"} eq "!"
$opcode->isa("FalseJump") $opcode->isa("ScAnd") $opcode->isa("ScOr") $opcode->isa("ToBool") $opcode->isa("UnaryOp") $opcode->{"Operator"} eq "!"
Truth table0%0/7
A or B or C or D or E and F
A= $opcode->isa("FalseJump")B= $opcode->isa("ScAnd")C= $opcode->isa("ScOr")D= $opcode->isa("ToBool")E= $opcode->isa("UnaryOp")F= $opcode->{"Operator"} eq "!"
ABCDEFresult
1XXXXX1
01XXXX1
001XXX1
0001XX1
0000111
00000X0
0000100
1169 or $opcode->isa('ScAnd')
1170 or $opcode->isa('ScOr')
1171 or $opcode->isa('ToBool')
1172 or ($opcode->isa('UnaryOp') and $opcode->{Operator} eq '!') ) {
1173 0 $node->del();
1174 }
1175 }
1176 }
1177 }
1178 0 return;
1179 }
1180
1181 0 ▶sub optUnopNot {
Subroutine optUnopNot: not called CC=14 SCAR=53.5
Pod undocumented
1182 0 my $parser = shift;
1183 0 my ($func) = @_;
1184
1185 0 ▶ for (my $node = $func->getLastActive(); defined $node; $node = $node->getPrevActive()) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $node) 0 0 0
1186 0 ▶ if ( $node->{OpCode}->isa('UnaryOp')
Branch: 1 branch
BranchTrueFalseTotal
if ($node->{"OpCode"}->isa("UnaryOp") and $node->{"OpCode"}{"Operator"} eq "!") 0 0 0
Condition0%0/3
$node->{"OpCode"}->isa("UnaryOp") and $node->{"OpCode"}{"Operator"} eq "!"
!ll&&!rl&&r
000
MC/DC0%0/2
$node->{"OpCode"}->isa("UnaryOp") and $node->{"OpCode"}{"Operator"} eq "!"
$node->{"OpCode"}->isa("UnaryOp") $node->{"OpCode"}{"Operator"} eq "!"
Truth table0%0/3
A and B
A= $node->{"OpCode"}->isa("UnaryOp")B= $node->{"OpCode"}{"Operator"} eq "!"
ABresult
0X0
100
111
1187 and $node->{OpCode}->{Operator} eq '!' ) {
1188 0 my $prev = $node->getPrevActive();
1189 0 ▶ croak "INTERNAL ERROR optUnopNot\n"
Branch: 1 branch
BranchTrueFalseTotal
unless defined $prev 0 0 0
1190 unless (defined $prev);
1191 0 my $opcode = $prev->{OpCode};
1192 0 ▶ if ($opcode->isa('BinaryOp')) {
Branch: 2 branches
BranchTrueFalseTotal
if ($opcode->isa('BinaryOp')) { } 0 0 0
elsif ($opcode->isa('UnaryOp')) { } 0 0 0
1193 0 ▶ if ($opcode->{Operator} eq '<') {
Branch: 6 branches
BranchTrueFalseTotal
if ($opcode->{'Operator'} eq '<') { } 0 0 0
elsif ($opcode->{'Operator'} eq '>') { } 0 0 0
elsif ($opcode->{'Operator'} eq '<=') { } 0 0 0
elsif ($opcode->{'Operator'} eq '>=') { } 0 0 0
elsif ($opcode->{'Operator'} eq '==') { } 0 0 0
elsif ($opcode->{'Operator'} eq '!=') { } 0 0 0
1194 0 $opcode->{Operator} = '>=';
1195 0 $node->del();
1196 0 $OneMoreTime = 1;
1197 }
1198 elsif ($opcode->{Operator} eq '>') {
1199 0 $opcode->{Operator} = '<=';
1200 0 $node->del();
1201 0 $OneMoreTime = 1;
1202 }
1203 elsif ($opcode->{Operator} eq '<=') {
1204 0 $opcode->{Operator} = '>';
1205 0 $node->del();
1206 0 $OneMoreTime = 1;
1207 }
1208 elsif ($opcode->{Operator} eq '>=') {
1209 0 $opcode->{Operator} = '<';
1210 0 $node->del();
1211 0 $OneMoreTime = 1;
1212 }
1213 elsif ($opcode->{Operator} eq '==') {
1214 0 $opcode->{Operator} = '!=';
1215 0 $node->del();
1216 0 $OneMoreTime = 1;
1217 }
1218 elsif ($opcode->{Operator} eq '!=') {
1219 0 $opcode->{Operator} = '==';
1220 0 $node->del();
1221 0 $OneMoreTime = 1;
1222 }
1223 }
1224 elsif ($opcode->isa('UnaryOp')) {
1225 0 ▶ if ($opcode->{Operator} eq '!') {
Branch: 1 branch
BranchTrueFalseTotal
if ($opcode->{"Operator"} eq "!") 0 0 0
1226 0 bless($prev->{Opcode}, 'ToBool');
1227 0 $node->del();
1228 0 $OneMoreTime = 1;
1229 }
1230 }
1231 }
1232 }
1233 0 return;
1234 }
1235
1236 0 ▶sub optLabel {
Subroutine optLabel: not called CC=4 SCAR=30.0
Pod undocumented
1237 0 my $parser = shift;
1238 0 my ($func) = @_;
1239
1240 0 ▶ for (my $node = $func->getFirstActive(); defined $node; $node = $node->getNextActive()) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $node) 0 0 0
1241 0 ▶ if ($node->{OpCode}->isa('Label')) {
Branch: 1 branch
BranchTrueFalseTotal
if ($node->{"OpCode"}->isa("Label")) 0 0 0
1242 0 ▶ if ($node->{OpCode}->{Definition}->{NbUse} == 0) {
Branch: 1 branch
BranchTrueFalseTotal
if ($node->{"OpCode"}{"Definition"}{"NbUse"} == bless( {"sign" => "+","value" => bless( [0], 'Math::BigInt::Calc' )}, 'Math::BigInt' )) 0 0 0
1243 0 $node->del();
1244 0 $OneMoreTime = 1;
1245 }
1246 }
1247 }
1248 0 return;
1249 }
1250
1251 0 ▶sub optTestJump {
Subroutine optTestJump: not called CC=6 SCAR=37.4
Pod undocumented
1252 0 my $parser = shift;
1253 0 my ($func) = @_;
1254
1255 0 ▶ for (my $node = $func->getFirstActive(); defined $node; $node = $node->getNextActive()) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $node) 0 0 0
1256 0 ▶ if ($node->{OpCode}->isa('FalseJump')) {
Branch: 1 branch
BranchTrueFalseTotal
if ($node->{"OpCode"}->isa("FalseJump")) 0 0 0
1257 0 my $prev = $node->getPrevActive();
1258 0 ▶ if (defined $prev and $prev->{OpCode}->isa('LoadConst')) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $prev and $prev->{"OpCode"}->isa("LoadConst")) 0 0 0
Condition0%0/3
defined $prev and $prev->{"OpCode"}->isa("LoadConst")
!ll&&!rl&&r
000
MC/DC0%0/2
defined $prev and $prev->{"OpCode"}->isa("LoadConst")
defined $prev $prev->{"OpCode"}->isa("LoadConst")
Truth table0%0/3
A and B
A= defined $prevB= $prev->{"OpCode"}->isa("LoadConst")
ABresult
0X0
100
111
1259 0 ▶ if ($prev->{OpCode}->{Value}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($prev->{'OpCode'}{'Value'}) { } 0 0 0
1260 0 $parser->optInfo($node, "Condition always TRUE.\n");
1261 0 $node->del();
1262 0 $prev->del();
1263 0 $node->{OpCode}->{Definition}->{NbUse} --;
1264 }
1265 else {
1266 0 $parser->optInfo($node, "Condition always FALSE.\n");
1267 0 bless($node->{OpCode}, 'Jump');
1268 0 $prev->del(); # OK
1269 }
1270 0 $OneMoreTime = 1;
1271 }
1272 }
1273 }
1274 0 return;
1275 }
1276
1277 0 ▶sub optReJump {
Subroutine optReJump: not called CC=6 SCAR=37.4
Pod undocumented
1278 0 my $parser = shift;
1279 0 my ($func) = @_;
1280
1281 0 ▶ for (my $node = $func->getFirstActive(); defined $node; $node = $node->getNextActive()) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $node) 0 0 0
1282 0 my $opcode = $node->{OpCode};
1283 0 ▶ if ($opcode->isa('Jump') or $opcode->isa('FalseJump')) {
Branch: 1 branch
BranchTrueFalseTotal
if ($opcode->isa("Jump") or $opcode->isa("FalseJump")) 0 0 0
Condition0%0/3
$opcode->isa("Jump") or $opcode->isa("FalseJump")
l!l&&r!l&&!r
000
MC/DC0%0/2
$opcode->isa("Jump") or $opcode->isa("FalseJump")
$opcode->isa("Jump") $opcode->isa("FalseJump")
Truth table0%0/3
A or B
A= $opcode->isa("Jump")B= $opcode->isa("FalseJump")
ABresult
1X1
011
000
1284 0 my $label1 = $opcode->{Definition};
1285 0 my $dest = $label1->{Node}->getNextActive();
1286 0 ▶ if (defined $dest and $dest->{OpCode}->isa('Jump')) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $dest and $dest->{"OpCode"}->isa("Jump")) 0 0 0
Condition0%0/3
defined $dest and $dest->{"OpCode"}->isa("Jump")
!ll&&!rl&&r
000
MC/DC0%0/2
defined $dest and $dest->{"OpCode"}->isa("Jump")
defined $dest $dest->{"OpCode"}->isa("Jump")
Truth table0%0/3
A and B
A= defined $destB= $dest->{"OpCode"}->isa("Jump")
ABresult
0X0
100
111
1287 0 my $label2 = $dest->{OpCode}->{Definition};
1288 0 $opcode->{Definition} = $label2;
1289 0 $label1->{NbUse} --;
1290 0 $label2->{NbUse} ++;
1291 }
1292 }
1293 }
1294 0 return;
1295 }
1296
1297 0 ▶sub optFalseJumpJump {
Subroutine optFalseJumpJump: not called CC=8 SCAR=42.8
Pod undocumented
1298 0 my $parser = shift;
1299 0 my ($func) = @_;
1300
1301 0 ▶ for (my $node = $func->getFirstActive(); defined $node; $node = $node->getNextActive()) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $node) 0 0 0
1302 0 ▶ if ($node->{OpCode}->isa('FalseJump')) {
Branch: 1 branch
BranchTrueFalseTotal
if ($node->{"OpCode"}->isa("FalseJump")) 0 0 0
1303 0 my $next = $node->getNextActive();
1304 0 ▶ if (defined $next and $next->{OpCode}->isa('Jump')) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $next and $next->{"OpCode"}->isa("Jump")) 0 0 0
Condition0%0/3
defined $next and $next->{"OpCode"}->isa("Jump")
!ll&&!rl&&r
000
MC/DC0%0/2
defined $next and $next->{"OpCode"}->isa("Jump")
defined $next $next->{"OpCode"}->isa("Jump")
Truth table0%0/3
A and B
A= defined $nextB= $next->{"OpCode"}->isa("Jump")
ABresult
0X0
100
111
1305 0 my $next2 = $next->getNextActive();
1306 0 ▶ if ( defined $next2
Branch: 1 branch
BranchTrueFalseTotal
if (defined $next2 and $next2->{"OpCode"}->isa("Label") and $node->{"OpCode"}{"Definition"} == $next2->{"OpCode"}{"Definition"}) 0 0 0
Condition0%0/6
defined $next2 and $next2->{"OpCode"}->isa("Label") and $node->{"OpCode"}{"Definition"} == $next2->{"OpCode"}{"Definition"}
!ll&&!rl&&r
000
defined $next2 and $next2->{"OpCode"}->isa("Label")
!ll&&!rl&&r
000
MC/DC0%0/3
defined $next2 and $next2->{"OpCode"}->isa("Label") and $node->{"OpCode"}{"Definition"} == $next2->{"OpCode"}{"Definition"}
defined $next2 $next2->{"OpCode"}->isa("Label") $node->{"OpCode"}{"Definition"} == $next2->{"OpCode"}{"Definition"}
Truth table0%0/4
A and B and C
A= defined $next2B= $next2->{"OpCode"}->isa("Label")C= $node->{"OpCode"}{"Definition"} == $next2->{"OpCode"}{"Definition"}
ABCresult
0XX0
10X0
1100
1111
1307 and $next2->{OpCode}->isa('Label')
1308 and $node->{OpCode}->{Definition} == $next2->{OpCode}->{Definition} ) {
1309 0 $node->{OpCode}->{Definition}->{NbUse} --;
1310 0 bless($node->{OpCode}, 'UnaryOp');
1311 0 $node->{OpCode}->{Operator} = '!';
1312 0 bless($next->{OpCode}, 'FalseJump');
1313 0 $parser->optDebug($node, "reverse FalseJump.\n");
1314 }
1315 }
1316 }
1317 }
1318 0 return;
1319 }
1320
1321 0 ▶sub optNullJump {
Subroutine optNullJump: not called CC=8 SCAR=42.8
Pod undocumented
1322 0 my $parser = shift;
1323 0 my ($func) = @_;
1324
1325 0 ▶ for (my $node = $func->getFirstActive(); defined $node; $node = $node->getNextActive()) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $node) 0 0 0
1326 0 my $opcode = $node->{OpCode};
1327 0 ▶ if ($opcode->isa('Jump') or $opcode->isa('FalseJump')) {
Branch: 1 branch
BranchTrueFalseTotal
if ($opcode->isa("Jump") or $opcode->isa("FalseJump")) 0 0 0
Condition0%0/3
$opcode->isa("Jump") or $opcode->isa("FalseJump")
l!l&&r!l&&!r
000
MC/DC0%0/2
$opcode->isa("Jump") or $opcode->isa("FalseJump")
$opcode->isa("Jump") $opcode->isa("FalseJump")
Truth table0%0/3
A or B
A= $opcode->isa("Jump")B= $opcode->isa("FalseJump")
ABresult
1X1
011
000
1328 0 my $label = $opcode->{Definition};
1329 0 my $next = $node->getNextActive();
1330 0 ▶ if ( defined $next
Branch: 1 branch
BranchTrueFalseTotal
if (defined $next and $next->{"OpCode"}->isa("Label") and $label == $next->{"OpCode"}{"Definition"}) 0 0 0
Condition0%0/6
defined $next and $next->{"OpCode"}->isa("Label") and $label == $next->{"OpCode"}{"Definition"}
!ll&&!rl&&r
000
defined $next and $next->{"OpCode"}->isa("Label")
!ll&&!rl&&r
000
MC/DC0%0/3
defined $next and $next->{"OpCode"}->isa("Label") and $label == $next->{"OpCode"}{"Definition"}
defined $next $next->{"OpCode"}->isa("Label") $label == $next->{"OpCode"}{"Definition"}
Truth table0%0/4
A and B and C
A= defined $nextB= $next->{"OpCode"}->isa("Label")C= $label == $next->{"OpCode"}{"Definition"}
ABCresult
0XX0
10X0
1100
1111
1331 and $next->{OpCode}->isa('Label')
1332 and $label == $next->{OpCode}->{Definition} ) {
1333 0 ▶ if ($opcode->isa('Jump')) {
Branch: 1 branch
BranchTrueFalseTotal
if ($opcode->isa('Jump')) { } 0 0 0
1334 0 $node->del();
1335 0 $parser->optDebug($node, "null Jump.\n");
1336 }
1337 else { # FalseJump
1338 0 bless($node->{OpCode}, 'Pop');
1339 0 $OneMoreTime = 1;
1340 0 $parser->optDebug($node, "null FalseJump.\n");
1341 }
1342 }
1343 }
1344 }
1345 0 return;
1346 }
1347
1348 0 ▶sub killVar {
Subroutine killVar: not called CC=9 SCAR=45.0
Pod undocumented
1349 0 my $parser = shift;
1350 0 my ($func, $def) = @_;
1351
1352 0 ▶ for (my $node = $func->getFirstActive(); defined $node; $node = $node->getNextActive()) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $node) 0 0 0
1353 0 my $opcode = $node->{OpCode};
1354 0 ▶ if ( $opcode->isa('StoreVar')
Branch: 2 branches
BranchTrueFalseTotal
if ($opcode->isa('StoreVar') or $opcode->isa('AddAsg') or $opcode->isa('SubAsg')) { } 0 0 0
elsif ($opcode->isa('IncrVar') or $opcode->isa('DecrVar')) { } 0 0 0
Condition0%0/6
$opcode->isa("StoreVar") or $opcode->isa("AddAsg") or $opcode->isa("SubAsg")
l!l&&r!l&&!r
000
$opcode->isa("StoreVar") or $opcode->isa("AddAsg")
l!l&&r!l&&!r
000
MC/DC0%0/3
$opcode->isa("StoreVar") or $opcode->isa("AddAsg") or $opcode->isa("SubAsg")
$opcode->isa("StoreVar") $opcode->isa("AddAsg") $opcode->isa("SubAsg")
Truth table0%0/4
A or B or C
A= $opcode->isa("StoreVar")B= $opcode->isa("AddAsg")C= $opcode->isa("SubAsg")
ABCresult
1XX1
01X1
0011
0000
1355 or $opcode->isa('AddAsg')
1356 or $opcode->isa('SubAsg') ) {
1357 0 my $expr = $node->getPrevActive();
1358 0 ▶ croak "INTERNAL ERROR killVar\n"
Branch: 1 branch
BranchTrueFalseTotal
unless defined $expr 0 0 0
1359 unless (defined $expr);
1360 0 $expr->insert(new Pop($parser));
1361 0 $node->del();
1362 }
1363 ▶ elsif ( $opcode->isa('IncrVar')
Condition0%0/3
$opcode->isa("IncrVar") or $opcode->isa("DecrVar")
l!l&&r!l&&!r
000
MC/DC0%0/2
$opcode->isa("IncrVar") or $opcode->isa("DecrVar")
$opcode->isa("IncrVar") $opcode->isa("DecrVar")
Truth table0%0/3
A or B
A= $opcode->isa("IncrVar")B= $opcode->isa("DecrVar")
ABresult
1X1
011
000
1364 or $opcode->isa('DecrVar') ) {
1365 0 ▶ if ($def == $node->{OpCode}->{Definition}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($def == $node->{"OpCode"}{"Definition"}) 0 0 0
1366 0 $node->del();
1367 }
1368 }
1369 }
1370 0 return;
1371 }
1372
1373 0 ▶sub killDeadExpr {
Subroutine killDeadExpr: not called CC=11 SCAR=48.8
Pod undocumented
1374 0 my $parser = shift;
1375 0 my ($func) = @_;
1376
1377 0 ▶ for (my $node = $func->getLastActive(); defined $node; $node = $node->getPrevActive()) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $node) 0 0 0
1378 0 ▶ if ($node->{OpCode}->isa('Pop')) {
Branch: 1 branch
BranchTrueFalseTotal
if ($node->{"OpCode"}->isa("Pop")) 0 0 0
1379 0 my $prev = $node->getPrevActive();
1380 0 ▶ croak "INTERNAL ERROR killDeadExpr\n"
Branch: 1 branch
BranchTrueFalseTotal
unless defined $prev 0 0 0
1381 unless (defined $prev);
1382 0 my $opcode =$prev->{OpCode};
1383 0 ▶ if ($opcode->isa('LoadConst')) {
Branch: 4 branches
BranchTrueFalseTotal
if ($opcode->isa('LoadConst')) { } 0 0 0
elsif ($opcode->isa('LoadVar')) { } 0 0 0
elsif ($opcode->isa('UnaryOp')) { } 0 0 0
elsif ($opcode->isa('BinaryOp')) { } 0 0 0
1384 0 $prev->del();
1385 0 $node->del();
1386 0 $parser->optDebug($node, "del LOAD_CONST.\n");
1387 }
1388 elsif ($opcode->isa('LoadVar')) {
1389 0 $prev->del();
1390 0 $node->del();
1391 0 $OneMoreTime = 1;
1392 0 $parser->optDebug($node, "del LOAD_VAR.\n");
1393 }
1394 elsif ($opcode->isa('UnaryOp')) {
1395 0 my $expr = $prev->getPrevActive();
1396 0 ▶ croak "INTERNAL ERROR killDeadExpr (expr)\n"
Branch: 1 branch
BranchTrueFalseTotal
unless defined $expr 0 0 0
1397 unless (defined $expr);
1398 0 $expr->insert(new Pop($parser));
1399 0 $prev->del();
1400 0 $node->del();
1401 0 $parser->optDebug($node, "del UNOP.\n");
1402 }
1403 elsif ($opcode->isa('BinaryOp')) {
1404 0 my $left = $prev->{OpCode}->{Left};
1405 0 my $right = $prev->getPrevActive();
1406 0 ▶ croak "INTERNAL ERROR killDeadExpr (right)\n"
Branch: 1 branch
BranchTrueFalseTotal
unless defined $right 0 0 0
1407 unless (defined $right);
1408 0 ▶ croak "INTERNAL ERROR killDeadExpr (left)\n"
Branch: 1 branch
BranchTrueFalseTotal
unless defined $left 0 0 0
1409 unless (defined $left);
1410 0 $left->insert(new Pop($parser));
1411 0 $right->insert(new Pop($parser));
1412 0 $prev->del();
1413 0 $node->del();
1414 0 $parser->optDebug($node, "del BINOP.\n");
1415 }
1416 }
1417 }
1418 0 return;
1419 }
1420
1421 0 ▶sub killDeadCode {
Subroutine killDeadCode: not called CC=9 SCAR=45.0
Pod undocumented
1422 0 my $parser = shift;
1423 0 my ($func) = @_;
1424
1425 0 ▶ for (my $node = $func->getFirstActive(); defined $node; $node = $node->getNextActive()) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $node) 0 0 0
1426 0 ▶ if ( $node->{OpCode}->isa('Jump')
Branch: 1 branch
BranchTrueFalseTotal
if ($node->{"OpCode"}->isa("Jump") or $node->{"OpCode"}->isa("Return") or $node->{"OpCode"}->isa("ReturnES")) 0 0 0
Condition0%0/6
$node->{"OpCode"}->isa("Jump") or $node->{"OpCode"}->isa("Return") or $node->{"OpCode"}->isa("ReturnES")
l!l&&r!l&&!r
000
$node->{"OpCode"}->isa("Jump") or $node->{"OpCode"}->isa("Return")
l!l&&r!l&&!r
000
MC/DC0%0/3
$node->{"OpCode"}->isa("Jump") or $node->{"OpCode"}->isa("Return") or $node->{"OpCode"}->isa("ReturnES")
$node->{"OpCode"}->isa("Jump") $node->{"OpCode"}->isa("Return") $node->{"OpCode"}->isa("ReturnES")
Truth table0%0/4
A or B or C
A= $node->{"OpCode"}->isa("Jump")B= $node->{"OpCode"}->isa("Return")C= $node->{"OpCode"}->isa("ReturnES")
ABCresult
1XX1
01X1
0011
0000
1427 or $node->{OpCode}->isa('Return')
1428 or $node->{OpCode}->isa('ReturnES') ) {
1429 0 my $first = 1;
1430 0 ▶ for (my $next = $node->getNextActive(); defined $next; $next = $next->getNextActive()) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $next) 0 0 0
1431 0 my $opcode = $next->{OpCode};
1432 0 ▶ last if ($opcode->isa('Label') and $opcode->{Definition}->{Index} > 0);
Branch: 1 branch
BranchTrueFalseTotal
if $opcode->isa("Label") and $opcode->{"Definition"}{"Index"} > bless( {"sign" => "+","value" => bless( [0], 'Math::BigInt::Calc' )}, 'Math::BigInt' ) 0 0 0
Condition0%0/3
$opcode->isa("Label") and $opcode->{"Definition"}{"Index"} > bless( {"sign" => "+","value" => bless( [0], 'Math::BigInt::Calc' )}, 'Math::BigInt' )
!ll&&!rl&&r
000
MC/DC0%0/2
$opcode->isa("Label") and $opcode->{"Definition"}{"Index"} > bless( {"sign" => "+","value" => bless( [0], 'Math::BigInt::Calc' )}, 'Math::BigInt' )
$opcode->isa("Label") $opcode->{"Definition"}{"Index"} > bless( {"sign" => "+","value" => bless( [0], 'Math::BigInt::Calc' )}, 'Math::BigInt' )
Truth table0%0/3
A and B
A= $opcode->isa("Label")B= $opcode->{"Definition"}{"Index"} > bless( {"sign" => "+","value" => bless( [0], 'Math::BigInt::Calc' )}, 'Math::BigInt' )
ABresult
0X0
100
111
1433 0 $next->del();
1434 0 ▶ if ($first) {
Branch: 1 branch
BranchTrueFalseTotal
if ($first) 0 0 0
1435 0 $first = 0;
1436 0 $parser->optWarning($next, "Code unreachable.\n");
1437 }
1438 }
1439 }
1440 }
1441 0 return;
1442 }
1443
1444 0 ▶sub convVar2Const {
Subroutine convVar2Const: not called CC=4 SCAR=30.0
Pod undocumented
1445 0 my $parser = shift;
1446 0 my ($func, $def, $name, $cst) = @_;
1447
1448 0 ▶ for (my $node = $func->getFirstActive(); defined $node; $node = $node->getNextActive()) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $node) 0 0 0
1449 0 my $opcode = $node->{OpCode};
1450 0 ▶ if ($opcode->isa('LoadVar') and $def == $opcode->{Definition}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($opcode->isa("LoadVar") and $def == $opcode->{"Definition"}) 0 0 0
Condition0%0/3
$opcode->isa("LoadVar") and $def == $opcode->{"Definition"}
!ll&&!rl&&r
000
MC/DC0%0/2
$opcode->isa("LoadVar") and $def == $opcode->{"Definition"}
$opcode->isa("LoadVar") $def == $opcode->{"Definition"}
Truth table0%0/3
A and B
A= $opcode->isa("LoadVar")B= $def == $opcode->{"Definition"}
ABresult
0X0
100
111
1451 0 $parser->optInfo($node, "Implemented by a constant - $name.\n");
1452 0 bless($node->{OpCode}, 'LoadConst');
1453 0 $opcode->{Value} = $cst->{Value};
1454 0 $opcode->{TypeDef} = $cst->{TypeDef};
1455 }
1456 }
1457 0 return;
1458 }
1459
1460 0 ▶sub optVar {
Subroutine optVar: not called CC=36 SCAR=71.9
Pod undocumented
1461 0 my $parser = shift;
1462 0 my ($func) = @_;
1463
1464 0 ▶ for (my $node = $func->getFirstActive(); defined $node; $node = $node->getNextActive()) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $node) 0 0 0
1465 0 my $opcode = $node->{OpCode};
1466 0 ▶ if ( $opcode->isa('Argument')
Branch: 1 branch
BranchTrueFalseTotal
if ($opcode->isa("Argument") or $opcode->isa("LoadVar") or $opcode->isa("StoreVar") or $opcode->isa("IncrVar") or $opcode->isa("DecrVar") or $opcode->isa("AddAsg") or $opcode->isa("SubAsg")) 0 0 0
Condition0%0/18
$opcode->isa("Argument") or $opcode->isa("LoadVar") or $opcode->isa("StoreVar") or $opcode->isa("IncrVar") or $opcode->isa("DecrVar") or $opcode->isa("AddAsg") or $opcode->isa("SubAsg")
l!l&&r!l&&!r
000
$opcode->isa("Argument") or $opcode->isa("LoadVar") or $opcode->isa("StoreVar") or $opcode->isa("IncrVar") or $opcode->isa("DecrVar") or $opcode->isa("AddAsg")
l!l&&r!l&&!r
000
$opcode->isa("Argument") or $opcode->isa("LoadVar") or $opcode->isa("StoreVar") or $opcode->isa("IncrVar") or $opcode->isa("DecrVar")
l!l&&r!l&&!r
000
$opcode->isa("Argument") or $opcode->isa("LoadVar") or $opcode->isa("StoreVar") or $opcode->isa("IncrVar")
l!l&&r!l&&!r
000
$opcode->isa("Argument") or $opcode->isa("LoadVar") or $opcode->isa("StoreVar")
l!l&&r!l&&!r
000
$opcode->isa("Argument") or $opcode->isa("LoadVar")
l!l&&r!l&&!r
000
MC/DC0%0/7
$opcode->isa("Argument") or $opcode->isa("LoadVar") or $opcode->isa("StoreVar") or $opcode->isa("IncrVar") or $opcode->isa("DecrVar") or $opcode->isa("AddAsg") or $opcode->isa("SubAsg")
$opcode->isa("Argument") $opcode->isa("LoadVar") $opcode->isa("StoreVar") $opcode->isa("IncrVar") $opcode->isa("DecrVar") $opcode->isa("AddAsg") $opcode->isa("SubAsg")
Truth table0%0/8
A or B or C or D or E or F or G
A= $opcode->isa("Argument")B= $opcode->isa("LoadVar")C= $opcode->isa("StoreVar")D= $opcode->isa("IncrVar")E= $opcode->isa("DecrVar")F= $opcode->isa("AddAsg")G= $opcode->isa("SubAsg")
ABCDEFGresult
1XXXXXX1
01XXXXX1
001XXXX1
0001XXX1
00001XX1
000001X1
00000011
00000000
1467 or $opcode->isa('LoadVar')
1468 or $opcode->isa('StoreVar')
1469 or $opcode->isa('IncrVar')
1470 or $opcode->isa('DecrVar')
1471 or $opcode->isa('AddAsg')
1472 or $opcode->isa('SubAsg') ) {
1473 0 $opcode->{Definition}->{Index} = 0; # clear flag
1474 }
1475 }
1476 0 ▶ for (my $node = $func->getFirstActive(); defined $node; $node = $node->getNextActive()) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $node) 0 0 0
1477 0 my $opcode = $node->{OpCode};
1478 0 ▶ if ( $opcode->isa('Argument')
Branch: 1 branch
BranchTrueFalseTotal
if ($opcode->isa("Argument") or $opcode->isa("LoadVar") or $opcode->isa("StoreVar") or $opcode->isa("IncrVar") or $opcode->isa("DecrVar") or $opcode->isa("AddAsg") or $opcode->isa("SubAsg")) 0 0 0
Condition0%0/18
$opcode->isa("Argument") or $opcode->isa("LoadVar") or $opcode->isa("StoreVar") or $opcode->isa("IncrVar") or $opcode->isa("DecrVar") or $opcode->isa("AddAsg") or $opcode->isa("SubAsg")
l!l&&r!l&&!r
000
$opcode->isa("Argument") or $opcode->isa("LoadVar") or $opcode->isa("StoreVar") or $opcode->isa("IncrVar") or $opcode->isa("DecrVar") or $opcode->isa("AddAsg")
l!l&&r!l&&!r
000
$opcode->isa("Argument") or $opcode->isa("LoadVar") or $opcode->isa("StoreVar") or $opcode->isa("IncrVar") or $opcode->isa("DecrVar")
l!l&&r!l&&!r
000
$opcode->isa("Argument") or $opcode->isa("LoadVar") or $opcode->isa("StoreVar") or $opcode->isa("IncrVar")
l!l&&r!l&&!r
000
$opcode->isa("Argument") or $opcode->isa("LoadVar") or $opcode->isa("StoreVar")
l!l&&r!l&&!r
000
$opcode->isa("Argument") or $opcode->isa("LoadVar")
l!l&&r!l&&!r
000
MC/DC0%0/7
$opcode->isa("Argument") or $opcode->isa("LoadVar") or $opcode->isa("StoreVar") or $opcode->isa("IncrVar") or $opcode->isa("DecrVar") or $opcode->isa("AddAsg") or $opcode->isa("SubAsg")
$opcode->isa("Argument") $opcode->isa("LoadVar") $opcode->isa("StoreVar") $opcode->isa("IncrVar") $opcode->isa("DecrVar") $opcode->isa("AddAsg") $opcode->isa("SubAsg")
Truth table0%0/8
A or B or C or D or E or F or G
A= $opcode->isa("Argument")B= $opcode->isa("LoadVar")C= $opcode->isa("StoreVar")D= $opcode->isa("IncrVar")E= $opcode->isa("DecrVar")F= $opcode->isa("AddAsg")G= $opcode->isa("SubAsg")
ABCDEFGresult
1XXXXXX1
01XXXXX1
001XXXX1
0001XXX1
00001XX1
000001X1
00000011
00000000
1479 or $opcode->isa('LoadVar')
1480 or $opcode->isa('StoreVar')
1481 or $opcode->isa('IncrVar')
1482 or $opcode->isa('DecrVar')
1483 or $opcode->isa('AddAsg')
1484 or $opcode->isa('SubAsg') ) {
1485 0 my $def = $opcode->{Definition};
1486 0 ▶ if ($def->{Index} == 0 and $def->{NbUse} != 0) {
Branch: 1 branch
BranchTrueFalseTotal
if ($def->{"Index"} == bless( {"sign" => "+","value" => bless( [0], 'Math::BigInt::Calc' )}, 'Math::BigInt' ) and $def->{"NbUse"} != bless( {"sign" => "+","value" => bless( [0], 'Math::BigInt::Calc' )}, 'Math::BigInt' )) 0 0 0
Condition0%0/3
$def->{"Index"} == bless( {"sign" => "+","value" => bless( [0], 'Math::BigInt::Calc' )}, 'Math::BigInt' ) and $def->{"NbUse"} != bless( {"sign" => "+","value" => bless( [0], 'Math::BigInt::Calc' )}, 'Math::BigInt' )
!ll&&!rl&&r
000
MC/DC0%0/2
$def->{"Index"} == bless( {"sign" => "+","value" => bless( [0], 'Math::BigInt::Calc' )}, 'Math::BigInt' ) and $def->{"NbUse"} != bless( {"sign" => "+","value" => bless( [0], 'Math::BigInt::Calc' )}, 'Math::BigInt' )
$def->{"Index"} == bless( {"sign" => "+","value" => bless( [0], 'Math::BigInt::Calc' )}, 'Math::BigInt' ) $def->{"NbUse"} != bless( {"sign" => "+","value" => bless( [0], 'Math::BigInt::Calc' )}, 'Math::BigInt' )
Truth table0%0/3
A and B
A= $def->{"Index"} == bless( {"sign" => "+","value" => bless( [0], 'Math::BigInt::Calc' )}, 'Math::BigInt' )B= $def->{"NbUse"} != bless( {"sign" => "+","value" => bless( [0], 'Math::BigInt::Calc' )}, 'Math::BigInt' )
ABresult
0X0
100
111
1487 0 my $load = undef;
1488 0 my $store = undef;
1489 0 my $nb_load = 0;
1490 0 my $nb_store = 0;
1491 0 my $nb_modif = 0;
1492 0 my $name = $def->{Symbol};
1493 0 $def->{Index} = 1; # set flag
1494 0 ▶ for (my $next = $node; defined $next; $next = $next->getNextActive()) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $next) 0 0 0
1495 0 ▶ if ($next->{OpCode}->isa('LoadVar')) {
Branch: 3 branches
BranchTrueFalseTotal
if ($next->{'OpCode'}->isa('LoadVar')) { } 0 0 0
elsif ($next->{'OpCode'}->isa('StoreVar')) { } 0 0 0
elsif ($next->{'OpCode'}->isa('IncrVar') or $next->{'OpCode'}->isa('DecrVar') or $next->{'OpCode'}->isa('AddAsg') or $next->{'OpCode'}->isa('SubAsg')) { } 0 0 0
1496 0 ▶ if ($def == $next->{OpCode}->{Definition}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($def == $next->{"OpCode"}{"Definition"}) 0 0 0
1497 0 $nb_load ++;
1498 0 $load = $next;
1499 }
1500 }
1501 elsif ($next->{OpCode}->isa('StoreVar')) {
1502 0 ▶ if ($def == $next->{OpCode}->{Definition}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($def == $next->{"OpCode"}{"Definition"}) 0 0 0
1503 0 $nb_store ++;
1504 0 $store = $next;
1505 }
1506 }
1507 ▶ elsif ( $next->{OpCode}->isa('IncrVar')
Condition0%0/9
$next->{"OpCode"}->isa("IncrVar") or $next->{"OpCode"}->isa("DecrVar") or $next->{"OpCode"}->isa("AddAsg") or $next->{"OpCode"}->isa("SubAsg")
l!l&&r!l&&!r
000
$next->{"OpCode"}->isa("IncrVar") or $next->{"OpCode"}->isa("DecrVar") or $next->{"OpCode"}->isa("AddAsg")
l!l&&r!l&&!r
000
$next->{"OpCode"}->isa("IncrVar") or $next->{"OpCode"}->isa("DecrVar")
l!l&&r!l&&!r
000
MC/DC0%0/4
$next->{"OpCode"}->isa("IncrVar") or $next->{"OpCode"}->isa("DecrVar") or $next->{"OpCode"}->isa("AddAsg") or $next->{"OpCode"}->isa("SubAsg")
$next->{"OpCode"}->isa("IncrVar") $next->{"OpCode"}->isa("DecrVar") $next->{"OpCode"}->isa("AddAsg") $next->{"OpCode"}->isa("SubAsg")
Truth table0%0/5
A or B or C or D
A= $next->{"OpCode"}->isa("IncrVar")B= $next->{"OpCode"}->isa("DecrVar")C= $next->{"OpCode"}->isa("AddAsg")D= $next->{"OpCode"}->isa("SubAsg")
ABCDresult
1XXX1
01XX1
001X1
00011
00000
1508 or $next->{OpCode}->isa('DecrVar')
1509 or $next->{OpCode}->isa('AddAsg')
1510 or $next->{OpCode}->isa('SubAsg') ) {
1511 0 ▶ if ($def == $next->{OpCode}->{Definition}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($def == $next->{"OpCode"}{"Definition"}) 0 0 0
1512 0 $nb_modif ++;
1513 }
1514 }
1515 }
1516 # print "var:",$name," nb_load:",$nb_load," nb_store:",$nb_store," nb_modif:",$nb_modif,"\n";
1517 0 ▶ if ($nb_load == 0) {
Branch: 2 branches
BranchTrueFalseTotal
if ($nb_load == {sign => '+', value => ['0']}) { } 0 0 0
elsif (not $opcode->isa('Argument') and $nb_modif == {sign => '+', value => ['0']} and $nb_store == {sign => '+', value => ['1']}) { } 0 0 0
1518 0 $parser->optWarning($node, "Unaccessed variable - $name.\n");
1519 0 $parser->killVar($node, $def);
1520 }
1521 ▶ elsif ( ! $opcode->isa('Argument') and $nb_modif == 0 and $nb_store == 1) {
Condition0%0/6
not $opcode->isa("Argument") and $nb_modif == bless( {"sign" => "+","value" => bless( [0], 'Math::BigInt::Calc' )}, 'Math::BigInt' ) and $nb_store == bless( {"sign" => "+","value" => bless( [1], 'Math::BigInt::Calc' )}, 'Math::BigInt' )
!ll&&!rl&&r
000
not $opcode->isa("Argument") and $nb_modif == bless( {"sign" => "+","value" => bless( [0], 'Math::BigInt::Calc' )}, 'Math::BigInt' )
!ll&&!rl&&r
000
MC/DC0%0/3
not $opcode->isa("Argument") and $nb_modif == bless( {"sign" => "+","value" => bless( [0], 'Math::BigInt::Calc' )}, 'Math::BigInt' ) and $nb_store == bless( {"sign" => "+","value" => bless( [1], 'Math::BigInt::Calc' )}, 'Math::BigInt' )
not $opcode->isa("Argument") $nb_modif == bless( {"sign" => "+","value" => bless( [0], 'Math::BigInt::Calc' )}, 'Math::BigInt' ) $nb_store == bless( {"sign" => "+","value" => bless( [1], 'Math::BigInt::Calc' )}, 'Math::BigInt' )
Truth table0%0/4
not(A) and B and C
A= not $opcode->isa("Argument")B= $nb_modif == bless( {"sign" => "+","value" => bless( [0], 'Math::BigInt::Calc' )}, 'Math::BigInt' )C= $nb_store == bless( {"sign" => "+","value" => bless( [1], 'Math::BigInt::Calc' )}, 'Math::BigInt' )
ABCresult
0XX0
10X0
1100
1111
1522 0 my $prev = $store->getPrevActive();
1523 0 ▶ if ($prev->{OpCode}->isa('LoadConst')) {
Branch: 2 branches
BranchTrueFalseTotal
if ($prev->{'OpCode'}->isa('LoadConst')) { } 0 0 0
elsif ($nb_load == {sign => '+', value => ['1']} and $store->getNextActive == $load) { } 0 0 0
1524 0 $parser->convVar2Const($node, $def, $name, $prev->{OpCode});
1525 0 $store->del();
1526 0 $prev->del();
1527 }
1528 ▶ elsif ($nb_load == 1 and $store->getNextActive() == $load) {
Condition0%0/3
$nb_load == bless( {"sign" => "+","value" => bless( [1], 'Math::BigInt::Calc' )}, 'Math::BigInt' ) and $store->getNextActive == $load
!ll&&!rl&&r
000
MC/DC0%0/2
$nb_load == bless( {"sign" => "+","value" => bless( [1], 'Math::BigInt::Calc' )}, 'Math::BigInt' ) and $store->getNextActive == $load
$nb_load == bless( {"sign" => "+","value" => bless( [1], 'Math::BigInt::Calc' )}, 'Math::BigInt' ) $store->getNextActive == $load
Truth table0%0/3
A and B
A= $nb_load == bless( {"sign" => "+","value" => bless( [1], 'Math::BigInt::Calc' )}, 'Math::BigInt' )B= $store->getNextActive == $load
ABresult
0X0
100
111
1529 0 $store->del();
1530 0 $load->del();
1531 0 $parser->optDebug($load, "store/load deleted - $name.\n");
1532 }
1533 }
1534 }
1535 }
1536 }
1537 0 return;
1538 }
1539
1540 0 ▶sub Optimize {
Subroutine Optimize: not called CC=7 SCAR=40.3
Pod undocumented
1541 0 my $parser = shift;
1542 0 my ($OptExpr) = @_;
1543 # my $visitor = new WAP::wmls::printVisitor();
1544
1545 0 ▶ for (my $node = $parser->YYData->{FunctionList}; defined $node; $node = $node->{Next}) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $node) 0 0 0
1546 croak "INTERNAL ERROR in Optimize\n"
1547 0 ▶ unless ($node->{OpCode}->isa('Function'));
Branch: 1 branch
BranchTrueFalseTotal
unless $node->{"OpCode"}->isa("Function") 0 0 0
1548 0 my $func = $node->{OpCode}->{Value};
1549 0 ▶ next unless (defined $func);
Branch: 1 branch
BranchTrueFalseTotal
unless defined $func 0 0 0
1550
1551 0 my $cnt = 0;
1552 # $func->visit($visitor);
1553 0 $parser->optLoadVarPop($func);
1554 0 ▶ do {
Branch: 1 branch
BranchTrueFalseTotal
$OneMoreTime and do { do { ++$cnt; $OneMoreTime = bless( {"sign" => "+","value" => bless( [0], 'Math::BigInt::Calc' )}, 'Math::BigInt' ); $parser->optTobool($func); $parser->optVar($func); $parser->killDeadExpr($func); if ($OptExpr) { if ($parser->optEvalExpr($func)) { $OneMoreTime = bless( {"sign" => "+","value" => bless( [1], 'Math::BigInt::Calc' )}, 'Math::BigInt' ); } ; } ; $parser->optTestJump($func); $parser->optReJump($func); $parser->killDeadCode($func); $parser->optFalseJumpJump($func); $parser->optNullJump($func); $parser->optLabel($func); $parser->optUnopNot($func) } } 0 0 0
1555 0 $cnt ++;
1556 # print "optim $cnt\n";
1557 0 $OneMoreTime = 0;
1558 0 $parser->optTobool($func);
1559 0 $parser->optVar($func);
1560 0 $parser->killDeadExpr($func);
1561 # $func->visit($visitor);
1562 0 ▶ if ($OptExpr) {
Branch: 1 branch
BranchTrueFalseTotal
if ($OptExpr) 0 0 0
1563 0 ▶ if ($parser->optEvalExpr($func)) {
Branch: 1 branch
BranchTrueFalseTotal
if ($parser->optEvalExpr($func)) 0 0 0
1564 0 $OneMoreTime = 1;
1565 }
1566 }
1567 # $func->visit($visitor);
1568 0 $parser->optTestJump($func);
1569 0 $parser->optReJump($func);
1570 0 $parser->killDeadCode($func);
1571 0 $parser->optFalseJumpJump($func);
1572 0 $parser->optNullJump($func);
1573 0 $parser->optLabel($func);
1574 0 $parser->optUnopNot($func);
1575 # $func->visit($visitor);
1576 }
1577 while ($OneMoreTime);
1578 }
1579 0 return;
1580 }
1581
1582 1 1;
1583
↑ Summary wmls/lexer.pm »