|
36 | 36 | import org.apache.commons.cli.Options; |
37 | 37 | import org.apache.commons.cli.ParseException; |
38 | 38 | import org.apache.commons.collections4.SetUtils; |
39 | | -import org.apache.commons.collections4.SetUtils.SetView; |
40 | 39 | import org.apache.logging.log4j.LogManager; |
41 | 40 | import org.apache.logging.log4j.Logger; |
42 | 41 |
|
@@ -234,7 +233,7 @@ else if (cmd.hasOption("bytecode")) { |
234 | 233 | } |
235 | 234 |
|
236 | 235 | EVMLiSA.analyzeContract(contract); |
237 | | - System.err.println(contract); |
| 236 | + // System.err.println(contract); |
238 | 237 | EVMLiSAExecutor.shutdown(); |
239 | 238 | } |
240 | 239 |
|
@@ -571,27 +570,27 @@ private static StatisticsObject<?> computeJumps(JumpSolver checker, Set<Statemen |
571 | 570 | } |
572 | 571 | if (topStackValuesPerJump == null) { |
573 | 572 | // If all stacks are bottom, then we have a |
574 | | - // maybeFakeMissedJump |
| 573 | + // definitelyUnreachable |
575 | 574 | definitelyUnreachable++; |
576 | 575 | continue; |
577 | 576 | } |
578 | 577 | if (!topStackValuesPerJump.contains(StackElement.TOP)) { |
579 | 578 | // If the elements at the top of the stacks are all |
580 | | - // different from NUMERIC_TOP, then we are sure that it |
581 | | - // is definitelyFakeMissedJumps |
| 579 | + // different from TOP, then we are sure that it |
| 580 | + // is resolved |
582 | 581 | resolvedJumps++; |
583 | 582 | continue; |
584 | 583 | } |
585 | | - if (soundlySolved != null && !soundlySolved.contains(jumpNode)) { |
| 584 | + if (checker.getMaybeUnsoundJumps().contains(jumpNode)) { |
| 585 | + maybeUnsoundJumps++; |
| 586 | + continue; |
| 587 | + } |
| 588 | + if (!soundlySolved.contains(jumpNode)) { |
586 | 589 | unsoundJumps++; |
587 | 590 | log.error("{} not solved", jumpNode); |
588 | 591 | log.error("getTopStackValuesPerJump: {}", topStackValuesPerJump); |
589 | 592 | continue; |
590 | 593 | } |
591 | | - if (checker.getMaybeUnsoundJumps().contains(jumpNode)) { |
592 | | - maybeUnsoundJumps++; |
593 | | - continue; |
594 | | - } |
595 | 594 |
|
596 | 595 | resolvedJumps++; |
597 | 596 | } |
@@ -642,23 +641,28 @@ private static StatisticsObject<?> computePaperJumps(JumpSolver checker, Set<Sta |
642 | 641 | if (cfg.getAllPushedJumps().contains(jumpNode)) |
643 | 642 | // stacks of pushed jumps are not stored for optimization |
644 | 643 | resolved++; |
645 | | - else if (!cfg.reachableFrom(entryPoint, jumpNode) || checker.getUnreachableJumps().contains(jumpNode)) |
646 | | - // getUnreachableJumps() contains jumps where the whole value state went to bottom |
647 | | - unreachable++; |
648 | | - else if (checker.getMaybeUnsoundJumps().contains(jumpNode)) |
| 644 | + else if (soundlySolved.contains(jumpNode)) |
| 645 | + // soundlySolved contains getMaybeUnsoundJumps() (whole value state went to top) |
| 646 | + // and getUnsoundJumps() (at least one stack has top on front) |
| 647 | + unknown++; |
| 648 | + else if (checker.getUnsoundJumps().contains(jumpNode) || checker.getMaybeUnsoundJumps().contains(jumpNode)) |
| 649 | + // getUnsoundJumps() contains jumps where at least one top stack is top |
649 | 650 | // getMaybeUnsoundJumps() contains jumps where the whole value state went to top |
650 | 651 | unknown++; |
| 652 | + else if (!cfg.reachableFrom(entryPoint, jumpNode) || checker.getUnreachableJumps().contains(jumpNode)) |
| 653 | + // getUnreachableJumps() contains jumps where the whole value state went to bottom |
| 654 | + unreachable++; |
651 | 655 | else { |
652 | 656 | Set<StackElement> topStacks = checker.getTopStackValuesPerJump(jumpNode); |
653 | | - if (topStacks.isEmpty()) |
| 657 | + if (topStacks.isEmpty()) |
654 | 658 | unreachable++; |
655 | | - else if (topStacks.stream().allMatch(StackElement::isBottom)) |
| 659 | + else if (topStacks.stream().allMatch(StackElement::isBottom)) |
656 | 660 | erroneous++; |
657 | | - else if (topStacks.stream().anyMatch(StackElement::isTop)) |
| 661 | + else if (topStacks.stream().anyMatch(StackElement::isTop)) |
658 | 662 | unknown++; |
659 | | - else |
| 663 | + else |
660 | 664 | resolved++; |
661 | | - } |
| 665 | + } |
662 | 666 |
|
663 | 667 | PaperStatisticsObject stats = PaperStatisticsObject.newStatisticsObject() |
664 | 668 | .totalOpcodes(cfg.getOpcodeCount()) |
|
0 commit comments