static boolean checkForBranchExit(byte[] codeBytes, int pos) { if (pos < 0 || pos + 2 >= codeBytes.length) { return false; } switch (0xff & codeBytes[pos]) { case Const.IF_ACMPEQ: case Const.IF_ACMPNE: case Const.IF_ICMPEQ: case Const.IF_ICMPGE: case Const.IF_ICMPGT: case Const.IF_ICMPLE: case Const.IF_ICMPLT: case Const.IF_ICMPNE: break; default: return false; } int branchTarget = pos + getBranchOffset(codeBytes, pos + 1); if (branchTarget - 3 < pos || branchTarget >= codeBytes.length) { return false; } if ((codeBytes[branchTarget - 3] & 0xff) != Const.GOTO) { return false; } int backBranchTarget = branchTarget + getBranchOffset(codeBytes, branchTarget - 2); if (backBranchTarget <= pos && backBranchTarget + 12 >= pos) { return true; } return false; }
static boolean checkForBranchExit(byte[] codeBytes, int pos) { if (pos < 0 || pos + 2 >= codeBytes.length) { return false; } switch (0xff & codeBytes[pos]) { case Constants.IF_ACMPEQ: case Constants.IF_ACMPNE: case Constants.IF_ICMPEQ: case Constants.IF_ICMPGE: case Constants.IF_ICMPGT: case Constants.IF_ICMPLE: case Constants.IF_ICMPLT: case Constants.IF_ICMPNE: break; default: return false; } int branchTarget = pos + getBranchOffset(codeBytes, pos + 1); if (branchTarget - 3 < pos || branchTarget >= codeBytes.length) { return false; } if ((codeBytes[branchTarget - 3] & 0xff) != Constants.GOTO) { return false; } int backBranchTarget = branchTarget + getBranchOffset(codeBytes, branchTarget - 2); if (backBranchTarget <= pos && backBranchTarget + 12 >= pos) { return true; } return false; }