|
|
@ -88,14 +88,18 @@ class OpaquePredicateTransformer : Transformer() { |
|
|
|
// find and fix opaque predicates |
|
|
|
// find and fix opaque predicates |
|
|
|
for (match in OPAQUE_PREDICATE_MATCHER.match(method).filter { isOpaquePredicate(method, it) }) { |
|
|
|
for (match in OPAQUE_PREDICATE_MATCHER.match(method).filter { isOpaquePredicate(method, it) }) { |
|
|
|
val branch = match[1] as JumpInsnNode |
|
|
|
val branch = match[1] as JumpInsnNode |
|
|
|
if (branch.opcode == Opcodes.IFEQ) { |
|
|
|
when (branch.opcode) { |
|
|
|
|
|
|
|
Opcodes.IFEQ -> { |
|
|
|
// branch is always taken |
|
|
|
// branch is always taken |
|
|
|
method.instructions.remove(match[0]) |
|
|
|
method.instructions.remove(match[0]) |
|
|
|
branch.opcode = Opcodes.GOTO |
|
|
|
branch.opcode = Opcodes.GOTO |
|
|
|
} else { // IFNE |
|
|
|
} |
|
|
|
|
|
|
|
Opcodes.IFNE -> { |
|
|
|
// branch is never taken |
|
|
|
// branch is never taken |
|
|
|
match.forEach(method.instructions::remove) |
|
|
|
match.forEach(method.instructions::remove) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
else -> error("Invalid opcode") |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
opaquePredicates++ |
|
|
|
opaquePredicates++ |
|
|
|
} |
|
|
|
} |
|
|
|