{{ message }}
Repository navigation
Commit 89c158f
committed
Compile no line events for the arms a literal predicate rules out
MRI folds a conditional on a literal away (`if false`, `unless true`,
`x = 1 unless true`): it compiles neither the arm that cannot run nor,
when only literals decide it, the predicate, and a statement made of
such a conditional starts with the first instruction of the arm that
runs. JRuby marked every one of those lines and counted the predicate's,
so the folded `if` line read 1 and the dead arm's lines 0 where MRI
reports nil, and a void `if false ... end` read as a statement that ran.
new_if now records whether the predicate folds and unmarks the dead
arm, LineEvents starts a folded conditional at its live arm, and a
folded conditional whose live arm compiles to nothing compiles to
nothing itself. A constant predicate that still runs code, as in
`if x and false`, keeps its line event. The constant predicate is now
found once, in new_if, so markBranch no longer needs the predicate.1 parent 6fa7726 commit 89c158f
6 files changed
Lines changed: 105 additions & 31 deletions
File tree
- core/src/main/java/org/jruby
- ast
- util
- parser
- test/jruby
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
57 | 57 | | |
58 | 58 | | |
59 | 59 | | |
60 | | - | |
| 60 | + | |
61 | 61 | | |
62 | 62 | | |
63 | 63 | | |
| |||
77 | 77 | | |
78 | 78 | | |
79 | 79 | | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
80 | 90 | | |
81 | 91 | | |
82 | 92 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2216 | 2216 | | |
2217 | 2217 | | |
2218 | 2218 | | |
2219 | | - | |
| 2219 | + | |
2220 | 2220 | | |
2221 | 2221 | | |
2222 | 2222 | | |
| |||
2225 | 2225 | | |
2226 | 2226 | | |
2227 | 2227 | | |
2228 | | - | |
| 2228 | + | |
2229 | 2229 | | |
2230 | 2230 | | |
2231 | 2231 | | |
| |||
3732 | 3732 | | |
3733 | 3733 | | |
3734 | 3734 | | |
3735 | | - | |
| 3735 | + | |
3736 | 3736 | | |
3737 | 3737 | | |
3738 | 3738 | | |
| |||
4240 | 4240 | | |
4241 | 4241 | | |
4242 | 4242 | | |
4243 | | - | |
| 4243 | + | |
4244 | 4244 | | |
4245 | 4245 | | |
4246 | 4246 | | |
4247 | 4247 | | |
4248 | 4248 | | |
4249 | 4249 | | |
4250 | 4250 | | |
4251 | | - | |
| 4251 | + | |
4252 | 4252 | | |
4253 | 4253 | | |
4254 | 4254 | | |
| |||
4564 | 4564 | | |
4565 | 4565 | | |
4566 | 4566 | | |
4567 | | - | |
| 4567 | + | |
4568 | 4568 | | |
4569 | 4569 | | |
4570 | 4570 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
628 | 628 | | |
629 | 629 | | |
630 | 630 | | |
631 | | - | |
| 631 | + | |
632 | 632 | | |
633 | 633 | | |
634 | 634 | | |
635 | 635 | | |
636 | 636 | | |
637 | 637 | | |
638 | 638 | | |
639 | | - | |
| 639 | + | |
640 | 640 | | |
641 | 641 | | |
642 | 642 | | |
| |||
1956 | 1956 | | |
1957 | 1957 | | |
1958 | 1958 | | |
1959 | | - | |
| 1959 | + | |
1960 | 1960 | | |
1961 | 1961 | | |
1962 | 1962 | | |
| |||
2428 | 2428 | | |
2429 | 2429 | | |
2430 | 2430 | | |
2431 | | - | |
| 2431 | + | |
2432 | 2432 | | |
2433 | 2433 | | |
2434 | 2434 | | |
2435 | 2435 | | |
2436 | 2436 | | |
2437 | 2437 | | |
2438 | | - | |
| 2438 | + | |
2439 | 2439 | | |
2440 | 2440 | | |
2441 | 2441 | | |
| |||
2724 | 2724 | | |
2725 | 2725 | | |
2726 | 2726 | | |
2727 | | - | |
| 2727 | + | |
2728 | 2728 | | |
2729 | 2729 | | |
2730 | 2730 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
618 | 618 | | |
619 | 619 | | |
620 | 620 | | |
621 | | - | |
622 | | - | |
623 | | - | |
624 | | - | |
| 621 | + | |
| 622 | + | |
| 623 | + | |
| 624 | + | |
| 625 | + | |
| 626 | + | |
| 627 | + | |
| 628 | + | |
625 | 629 | | |
| 630 | + | |
| 631 | + | |
| 632 | + | |
| 633 | + | |
| 634 | + | |
| 635 | + | |
626 | 636 | | |
627 | 637 | | |
628 | 638 | | |
629 | | - | |
630 | | - | |
| 639 | + | |
| 640 | + | |
631 | 641 | | |
632 | 642 | | |
633 | 643 | | |
| |||
638 | 648 | | |
639 | 649 | | |
640 | 650 | | |
641 | | - | |
642 | | - | |
| 651 | + | |
| 652 | + | |
643 | 653 | | |
644 | 654 | | |
645 | 655 | | |
646 | 656 | | |
647 | | - | |
648 | | - | |
| 657 | + | |
| 658 | + | |
649 | 659 | | |
650 | 660 | | |
651 | 661 | | |
652 | 662 | | |
653 | | - | |
654 | | - | |
| 663 | + | |
| 664 | + | |
655 | 665 | | |
656 | 666 | | |
657 | 667 | | |
658 | 668 | | |
659 | | - | |
660 | | - | |
| 669 | + | |
| 670 | + | |
661 | 671 | | |
662 | 672 | | |
663 | 673 | | |
| |||
1274 | 1284 | | |
1275 | 1285 | | |
1276 | 1286 | | |
1277 | | - | |
| 1287 | + | |
1278 | 1288 | | |
1279 | 1289 | | |
1280 | 1290 | | |
| |||
1286 | 1296 | | |
1287 | 1297 | | |
1288 | 1298 | | |
| 1299 | + | |
| 1300 | + | |
1289 | 1301 | | |
1290 | 1302 | | |
1291 | 1303 | | |
| |||
1433 | 1445 | | |
1434 | 1446 | | |
1435 | 1447 | | |
| 1448 | + | |
| 1449 | + | |
1436 | 1450 | | |
1437 | 1451 | | |
1438 | 1452 | | |
| 1453 | + | |
| 1454 | + | |
| 1455 | + | |
| 1456 | + | |
| 1457 | + | |
| 1458 | + | |
1439 | 1459 | | |
1440 | | - | |
1441 | | - | |
1442 | | - | |
| 1460 | + | |
| 1461 | + | |
| 1462 | + | |
| 1463 | + | |
| 1464 | + | |
| 1465 | + | |
| 1466 | + | |
| 1467 | + | |
1443 | 1468 | | |
1444 | 1469 | | |
1445 | 1470 | | |
| |||

0 commit comments