Skip to content

Commit

Permalink
feat(objectionary#540): handle goto instructions properly
Browse files Browse the repository at this point in the history
  • Loading branch information
volodya-lombrozo committed Oct 8, 2024
1 parent 8b59cfb commit bd15c5a
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -523,8 +523,6 @@ public boolean isConditionalBranchInstruction() {
case IF_ACMPNE:
case IFNULL:
case IFNONNULL:
case TABLESWITCH:
case LOOKUPSWITCH:
return true;
default:
return false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -458,31 +458,30 @@ private int computeStack() {
final List<Label> offsets = var.offsets();
for (Label offset : offsets) {
final int target = this.index(offset);
if (visited.get(target) == null) {
if (visited.get(target) == null || visited.get(target) < stack) {
worklist.add(target);
}
}
// if (var.isConditionalBranchInstruction()) {
// final int next = current + 1;
// if (visited.get(next) == null || visited.get(next) < stack) {
// worklist.add(next);
// }
// }
break;
} else {
} else if (var.isConditionalBranchInstruction()) {
final int jump = this.index(var.offset());
if (visited.get(jump) == null) {
if (visited.get(jump) == null || visited.get(jump) < stack) {
worklist.add(jump);
if (var.isConditionalBranchInstruction()) {
final int next = current + 1;
if (visited.get(next) == null) {
if (visited.get(next) == null || visited.get(next) < stack) {
worklist.add(next);
}
}
break;
}
}
if (var.isReturnInstruction()) {
break;
} else if (var.isReturnInstruction()) {
break;
} else {
final int jump = this.index(var.offset());
if (visited.get(jump) == null || visited.get(jump) < stack) {
worklist.add(jump);
}
break;
}
}
Expand Down

0 comments on commit bd15c5a

Please sign in to comment.