restore DataFlowRunner instruction logging and commented printlns
authorpeter <peter@jetbrains.com>
Mon, 22 Aug 2016 13:23:25 +0000 (15:23 +0200)
committerpeter <peter@jetbrains.com>
Mon, 22 Aug 2016 13:23:25 +0000 (15:23 +0200)
java/java-analysis-impl/src/com/intellij/codeInspection/dataFlow/DataFlowRunner.java

index 6f0f02b69860f872910fea234bc4af7be516472a..c92b268f8cded204406ac5aabd3c9813fe79e0d7 100644 (file)
@@ -127,6 +127,13 @@ public class DataFlowRunner {
         }
       }
 
+      if (LOG.isTraceEnabled()) {
+        LOG.debug("Analyzing code block: " + psiBlock.getText());
+        for (int i = 0; i < myInstructions.length; i++) {
+          LOG.trace(i + ": " + myInstructions[i]);
+        }
+      }
+
       Integer tooExpensiveHash = psiBlock.getUserData(TOO_EXPENSIVE_HASH);
       if (tooExpensiveHash != null && tooExpensiveHash == psiBlock.getText().hashCode()) {
         LOG.debug("Too complex because hasn't changed since being too complex already");
@@ -154,6 +161,12 @@ public class DataFlowRunner {
           }
           ProgressManager.checkCanceled();
 
+          if (LOG.isTraceEnabled()) {
+            LOG.trace(instructionState.toString());
+          }
+          // useful for quick debugging by uncommenting and hot-swapping
+          //System.out.println(instructionState.toString());
+
           Instruction instruction = instructionState.getInstruction();
 
           if (instruction instanceof BranchingInstruction) {
@@ -180,7 +193,7 @@ public class DataFlowRunner {
             handleStepOutOfLoop(instruction, nextInstruction, loopNumber, processedStates, incomingStates, states, after, queue);
             if (nextInstruction instanceof BranchingInstruction) {
               BranchingInstruction branching = (BranchingInstruction)nextInstruction;
-              if (processedStates.get(branching).contains(state.getMemoryState()) || 
+              if (processedStates.get(branching).contains(state.getMemoryState()) ||
                   incomingStates.get(branching).contains(state.getMemoryState())) {
                 continue;
               }
@@ -194,6 +207,7 @@ public class DataFlowRunner {
       }
 
       psiBlock.putUserData(TOO_EXPENSIVE_HASH, null);
+      LOG.trace("Analysis ok");
       return RunnerResult.OK;
     }
     catch (ArrayIndexOutOfBoundsException | EmptyStackException e) {