improve performance of logical conjunction (IDEA-182226)
This commit is contained in:
@@ -216,14 +216,14 @@ public class DeadCodeHelper {
|
|||||||
|
|
||||||
for (int i = 0; i < node.getPreds().size(); i++) {
|
for (int i = 0; i < node.getPreds().size(); i++) {
|
||||||
BasicBlock pred = node.getPreds().get(i);
|
BasicBlock pred = node.getPreds().get(i);
|
||||||
if (!marked.contains(pred) && pred != dom) {
|
if (pred != dom && !marked.contains(pred)) {
|
||||||
lstNodes.add(pred);
|
lstNodes.add(pred);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < node.getPredExceptions().size(); i++) {
|
for (int i = 0; i < node.getPredExceptions().size(); i++) {
|
||||||
BasicBlock pred = node.getPredExceptions().get(i);
|
BasicBlock pred = node.getPredExceptions().get(i);
|
||||||
if (!marked.contains(pred) && pred != dom) {
|
if (pred != dom && !marked.contains(pred)) {
|
||||||
lstNodes.add(pred);
|
lstNodes.add(pred);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,7 +4,10 @@ package org.jetbrains.java.decompiler.modules.decompiler;
|
|||||||
import org.jetbrains.java.decompiler.modules.decompiler.exps.Exprent;
|
import org.jetbrains.java.decompiler.modules.decompiler.exps.Exprent;
|
||||||
import org.jetbrains.java.decompiler.modules.decompiler.stats.Statement;
|
import org.jetbrains.java.decompiler.modules.decompiler.stats.Statement;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashSet;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
|
|
||||||
public class DecHelper {
|
public class DecHelper {
|
||||||
@@ -145,7 +148,7 @@ public class DecHelper {
|
|||||||
if (head == statd) {
|
if (head == statd) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!setDest.contains(statd) && post != statd) {
|
if (post != statd && !setDest.contains(statd)) {
|
||||||
if (post != null) {
|
if (post != null) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,10 @@
|
|||||||
// 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-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.
|
||||||
package org.jetbrains.java.decompiler.modules.decompiler;
|
package org.jetbrains.java.decompiler.modules.decompiler;
|
||||||
|
|
||||||
import org.jetbrains.java.decompiler.code.*;
|
import org.jetbrains.java.decompiler.code.CodeConstants;
|
||||||
|
import org.jetbrains.java.decompiler.code.Instruction;
|
||||||
|
import org.jetbrains.java.decompiler.code.InstructionSequence;
|
||||||
|
import org.jetbrains.java.decompiler.code.SimpleInstructionSequence;
|
||||||
import org.jetbrains.java.decompiler.code.cfg.BasicBlock;
|
import org.jetbrains.java.decompiler.code.cfg.BasicBlock;
|
||||||
import org.jetbrains.java.decompiler.code.cfg.ControlFlowGraph;
|
import org.jetbrains.java.decompiler.code.cfg.ControlFlowGraph;
|
||||||
import org.jetbrains.java.decompiler.code.cfg.ExceptionRangeCFG;
|
import org.jetbrains.java.decompiler.code.cfg.ExceptionRangeCFG;
|
||||||
@@ -321,7 +324,7 @@ public class FinallyProcessor {
|
|||||||
|
|
||||||
for (BasicBlock dest : lstSucc) {
|
for (BasicBlock dest : lstSucc) {
|
||||||
// break out
|
// break out
|
||||||
if (!setCopy.contains(dest) && dest != graph.getLast()) {
|
if (dest != graph.getLast() && !setCopy.contains(dest)) {
|
||||||
// disable semaphore
|
// disable semaphore
|
||||||
SimpleInstructionSequence seq = new SimpleInstructionSequence();
|
SimpleInstructionSequence seq = new SimpleInstructionSequence();
|
||||||
seq.addInstruction(Instruction.create(CodeConstants.opc_bipush, false, CodeConstants.GROUP_GENERAL, bytecode_version, new int[]{0}), -1);
|
seq.addInstruction(Instruction.create(CodeConstants.opc_bipush, false, CodeConstants.GROUP_GENERAL, bytecode_version, new int[]{0}), -1);
|
||||||
|
|||||||
@@ -5,7 +5,6 @@ package org.jetbrains.java.decompiler.modules.decompiler.stats;
|
|||||||
|
|
||||||
import org.jetbrains.java.decompiler.code.CodeConstants;
|
import org.jetbrains.java.decompiler.code.CodeConstants;
|
||||||
import org.jetbrains.java.decompiler.main.DecompilerContext;
|
import org.jetbrains.java.decompiler.main.DecompilerContext;
|
||||||
import org.jetbrains.java.decompiler.util.TextBuffer;
|
|
||||||
import org.jetbrains.java.decompiler.main.collectors.BytecodeMappingTracer;
|
import org.jetbrains.java.decompiler.main.collectors.BytecodeMappingTracer;
|
||||||
import org.jetbrains.java.decompiler.main.collectors.CounterContainer;
|
import org.jetbrains.java.decompiler.main.collectors.CounterContainer;
|
||||||
import org.jetbrains.java.decompiler.modules.decompiler.DecHelper;
|
import org.jetbrains.java.decompiler.modules.decompiler.DecHelper;
|
||||||
@@ -13,8 +12,12 @@ import org.jetbrains.java.decompiler.modules.decompiler.ExprProcessor;
|
|||||||
import org.jetbrains.java.decompiler.modules.decompiler.StatEdge;
|
import org.jetbrains.java.decompiler.modules.decompiler.StatEdge;
|
||||||
import org.jetbrains.java.decompiler.modules.decompiler.exps.VarExprent;
|
import org.jetbrains.java.decompiler.modules.decompiler.exps.VarExprent;
|
||||||
import org.jetbrains.java.decompiler.struct.gen.VarType;
|
import org.jetbrains.java.decompiler.struct.gen.VarType;
|
||||||
|
import org.jetbrains.java.decompiler.util.TextBuffer;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
public class CatchAllStatement extends Statement {
|
public class CatchAllStatement extends Statement {
|
||||||
|
|
||||||
@@ -75,7 +78,7 @@ public class CatchAllStatement extends Statement {
|
|||||||
for (StatEdge edge : head.getSuccessorEdges(StatEdge.TYPE_EXCEPTION)) {
|
for (StatEdge edge : head.getSuccessorEdges(StatEdge.TYPE_EXCEPTION)) {
|
||||||
Statement exc = edge.getDestination();
|
Statement exc = edge.getDestination();
|
||||||
|
|
||||||
if (edge.getExceptions() == null && setHandlers.contains(exc) && exc.getLastBasicType() == LASTBASICTYPE_GENERAL) {
|
if (edge.getExceptions() == null && exc.getLastBasicType() == LASTBASICTYPE_GENERAL && setHandlers.contains(exc)) {
|
||||||
List<StatEdge> lstSuccs = exc.getSuccessorEdges(STATEDGE_DIRECT_ALL);
|
List<StatEdge> lstSuccs = exc.getSuccessorEdges(STATEDGE_DIRECT_ALL);
|
||||||
if (lstSuccs.isEmpty() || lstSuccs.get(0).getType() != StatEdge.TYPE_REGULAR) {
|
if (lstSuccs.isEmpty() || lstSuccs.get(0).getType() != StatEdge.TYPE_REGULAR) {
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user