Unverified Commit ea346145 authored by skylot's avatar skylot Committed by GitHub

Merge pull request #194 from wuyongzheng/master

fixed a few bugs resulting program hang
parents a01c379c 23305421
......@@ -66,9 +66,9 @@ public final class JadxDecompiler {
private BinaryXMLParser xmlParser;
private Map<ClassNode, JavaClass> classesMap = new HashMap<ClassNode, JavaClass>();
private Map<MethodNode, JavaMethod> methodsMap = new HashMap<MethodNode, JavaMethod>();
private Map<FieldNode, JavaField> fieldsMap = new HashMap<FieldNode, JavaField>();
private Map<ClassNode, JavaClass> classesMap = new java.util.concurrent.ConcurrentHashMap<ClassNode, JavaClass>();
private Map<MethodNode, JavaMethod> methodsMap = new java.util.concurrent.ConcurrentHashMap<MethodNode, JavaMethod>();
private Map<FieldNode, JavaField> fieldsMap = new java.util.concurrent.ConcurrentHashMap<FieldNode, JavaField>();
public JadxDecompiler() {
this(new JadxArgs());
......
......@@ -23,7 +23,7 @@ import org.slf4j.LoggerFactory;
public class ClspGraph {
private static final Logger LOG = LoggerFactory.getLogger(ClspGraph.class);
private final Map<String, Set<String>> ancestorCache = new WeakHashMap<String, Set<String>>();
private final Map<String, Set<String>> ancestorCache = Collections.synchronizedMap(new WeakHashMap<String, Set<String>>());
private Map<String, NClass> nameMap;
private final Set<String> missingClasses = new HashSet<String>();
......
......@@ -453,15 +453,18 @@ public class BlockUtils {
*/
public static List<BlockNode> collectBlocksDominatedBy(BlockNode dominator, BlockNode start) {
List<BlockNode> result = new ArrayList<BlockNode>();
collectWhileDominates(dominator, start, result);
HashSet<BlockNode> visited = new HashSet<BlockNode>();
collectWhileDominates(dominator, start, result, visited);
return result;
}
private static void collectWhileDominates(BlockNode dominator, BlockNode child, List<BlockNode> result) {
private static void collectWhileDominates(BlockNode dominator, BlockNode child, List<BlockNode> result, HashSet<BlockNode> visited) {
if (visited.contains(child)) return;
visited.add(child);
for (BlockNode node : child.getCleanSuccessors()) {
if (node.isDominator(dominator)) {
result.add(node);
collectWhileDominates(dominator, node, result);
collectWhileDominates(dominator, node, result, visited);
}
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment