Cleanup (warnings; formatting)
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
// Copyright 2000-2017 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
package org.jetbrains.java.decompiler.modules.decompiler;
|
||||
|
||||
import org.jetbrains.java.decompiler.code.CodeConstants;
|
||||
@@ -64,18 +64,11 @@ public class SimplifyExprentsHelper {
|
||||
for (Statement st : stat.getStats()) {
|
||||
res |= simplifyStackVarsStatement(st, setReorderedIfs, ssa, cl);
|
||||
|
||||
// collapse composed if's
|
||||
if (changed = IfHelper.mergeIfs(st, setReorderedIfs)) {
|
||||
break;
|
||||
}
|
||||
changed = IfHelper.mergeIfs(st, setReorderedIfs) || // collapse composed if's
|
||||
buildIff(st, ssa) || // collapse iff ?: statement
|
||||
processClass14 && collapseInlinedClass14(st); // collapse inlined .class property in version 1.4 and before
|
||||
|
||||
// collapse iff ?: statement
|
||||
if (changed = buildIff(st, ssa)) {
|
||||
break;
|
||||
}
|
||||
|
||||
// collapse inlined .class property in version 1.4 and before
|
||||
if (processClass14 && (changed = collapseInlinedClass14(st))) {
|
||||
if (changed) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -459,7 +452,6 @@ public class SimplifyExprentsHelper {
|
||||
}
|
||||
|
||||
private static boolean isIPPorIMM2(Exprent first, Exprent second) {
|
||||
|
||||
if (first.type != Exprent.EXPRENT_ASSIGNMENT || second.type != Exprent.EXPRENT_ASSIGNMENT) {
|
||||
return false;
|
||||
}
|
||||
@@ -485,8 +477,11 @@ public class SimplifyExprentsHelper {
|
||||
econst = func.getLstOperands().get(0);
|
||||
}
|
||||
|
||||
if(econst.type == Exprent.EXPRENT_CONST && ((ConstExprent)econst).hasValueOne()) {
|
||||
if(af.getLeft().equals(econd) && af.getRight().equals(as.getLeft()) && (af.getLeft().getExprentUse() & Exprent.MULTIPLE_USES) != 0) {
|
||||
if (econst.type == Exprent.EXPRENT_CONST &&
|
||||
((ConstExprent)econst).hasValueOne() &&
|
||||
af.getLeft().equals(econd) &&
|
||||
af.getRight().equals(as.getLeft()) &&
|
||||
(af.getLeft().getExprentUse() & Exprent.MULTIPLE_USES) != 0) {
|
||||
int type = func.getFuncType() == FunctionExprent.FUNCTION_ADD ? FunctionExprent.FUNCTION_IPP : FunctionExprent.FUNCTION_IMM;
|
||||
|
||||
FunctionExprent ret = new FunctionExprent(type, af.getRight(), func.bytecode);
|
||||
@@ -495,7 +490,6 @@ public class SimplifyExprentsHelper {
|
||||
af.setRight(ret);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -311,12 +311,13 @@ public class ExceptionDeobfuscator {
|
||||
}
|
||||
|
||||
public static boolean handleMultipleEntryExceptionRanges(ControlFlowGraph graph) {
|
||||
|
||||
GenericDominatorEngine engine = new GenericDominatorEngine(new IGraph() {
|
||||
@Override
|
||||
public List<? extends IGraphNode> getReversePostOrderList() {
|
||||
return graph.getReversePostOrder();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<? extends IGraphNode> getRoots() {
|
||||
return new HashSet<>(Collections.singletonList(graph.getFirst()));
|
||||
}
|
||||
@@ -324,7 +325,7 @@ public class ExceptionDeobfuscator {
|
||||
|
||||
engine.initialize();
|
||||
|
||||
boolean found = false;
|
||||
boolean found;
|
||||
|
||||
while (true) {
|
||||
found = false;
|
||||
@@ -352,7 +353,6 @@ public class ExceptionDeobfuscator {
|
||||
}
|
||||
|
||||
private static Set<BasicBlock> getRangeEntries(ExceptionRangeCFG range) {
|
||||
|
||||
Set<BasicBlock> setEntries = new HashSet<>();
|
||||
Set<BasicBlock> setRange = new HashSet<>(range.getProtectedRange());
|
||||
|
||||
@@ -368,8 +368,10 @@ public class ExceptionDeobfuscator {
|
||||
return setEntries;
|
||||
}
|
||||
|
||||
private static boolean splitExceptionRange(ExceptionRangeCFG range, Set<BasicBlock> setEntries, ControlFlowGraph graph, GenericDominatorEngine engine) {
|
||||
|
||||
private static boolean splitExceptionRange(ExceptionRangeCFG range,
|
||||
Set<BasicBlock> setEntries,
|
||||
ControlFlowGraph graph,
|
||||
GenericDominatorEngine engine) {
|
||||
for (BasicBlock entry : setEntries) {
|
||||
List<BasicBlock> lstSubrangeBlocks = getReachableBlocksRestricted(entry, range, engine);
|
||||
if (!lstSubrangeBlocks.isEmpty() && lstSubrangeBlocks.size() < range.getProtectedRange().size()) {
|
||||
@@ -379,7 +381,8 @@ public class ExceptionDeobfuscator {
|
||||
// shrink the original range
|
||||
range.getProtectedRange().removeAll(lstSubrangeBlocks);
|
||||
return true;
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
// should not happen
|
||||
DecompilerContext.getLogger().writeMessage("Inconsistency found while splitting protected range", IFernflowerLogger.Severity.WARN);
|
||||
}
|
||||
@@ -389,7 +392,6 @@ public class ExceptionDeobfuscator {
|
||||
}
|
||||
|
||||
public static void insertDummyExceptionHandlerBlocks(ControlFlowGraph graph, int bytecode_version) {
|
||||
|
||||
Map<BasicBlock, Set<ExceptionRangeCFG>> mapRanges = new HashMap<>();
|
||||
for (ExceptionRangeCFG range : graph.getExceptions()) {
|
||||
mapRanges.computeIfAbsent(range.getHandler(), k -> new HashSet<>()).add(range);
|
||||
@@ -443,5 +445,4 @@ public class ExceptionDeobfuscator {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user