Skip to content

Commit

Permalink
fix ssa with trap
Browse files Browse the repository at this point in the history
  • Loading branch information
wangzun66 committed Nov 5, 2024
1 parent 93d368c commit 790ff76
Show file tree
Hide file tree
Showing 3 changed files with 112 additions and 110 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,19 @@

import java.util.Collections;
import java.util.List;
import java.util.stream.Collectors;
import javax.annotation.Nonnull;

public enum BlockAnalysisDirection {
POSTORDERBACKWARD {
@Override
@Nonnull
List<? extends BasicBlock<?>> getPredecessors(BasicBlock<?> block) {
return block.getSuccessors();
List<BasicBlock<?>> getPredecessors(BasicBlock<?> block) {
List<BasicBlock<?>> esuccs =
block.getExceptionalSuccessors().values().stream().collect(Collectors.toList());
List<BasicBlock<?>> succs = (List<BasicBlock<?>>) block.getSuccessors();
succs.addAll(esuccs);
return succs;
}

@Nonnull
Expand All @@ -42,8 +47,8 @@ List<BasicBlock<?>> getSortedBlocks(StmtGraph<?> blockGraph) {
REVERSEPOSTORDERFORWARD {
@Override
@Nonnull
List<? extends BasicBlock<?>> getPredecessors(BasicBlock<?> block) {
return block.getPredecessors();
List<BasicBlock<?>> getPredecessors(BasicBlock<?> block) {
return (List<BasicBlock<?>>) block.getPredecessors();
}

@Nonnull
Expand All @@ -55,7 +60,7 @@ List<BasicBlock<?>> getSortedBlocks(StmtGraph<?> blockGraph) {
};

@Nonnull
abstract List<? extends BasicBlock<?>> getPredecessors(BasicBlock<?> block);
abstract List<BasicBlock<?>> getPredecessors(BasicBlock<?> block);

@Nonnull
abstract List<BasicBlock<?>> getSortedBlocks(StmtGraph<?> blockGraph);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
*/

import java.util.*;
import java.util.stream.Collectors;
import javax.annotation.Nonnull;

public class PostOrderBlockIterator implements BlockIterator {
Expand Down Expand Up @@ -53,7 +54,11 @@ public BasicBlock<?> next() {
if (frame.succIterator.hasNext()) {
BasicBlock<?> succ = frame.succIterator.next();
if (visitNode(succ)) {
stack.push(new Frame(succ, ((List<BasicBlock<?>>) succ.getSuccessors()).iterator()));
List<BasicBlock<?>> esuccs =
succ.getExceptionalSuccessors().values().stream().collect(Collectors.toList());
List<BasicBlock<?>> succs = (List<BasicBlock<?>>) succ.getSuccessors();
succs.addAll(esuccs);
stack.push(new Frame(succ, succs.iterator()));
}
} else {
stack.pop();
Expand Down
Loading

0 comments on commit 790ff76

Please sign in to comment.