]> source.dussan.org Git - javassist.git/commitdiff
added javassist.bytecode.analysis.ControlFlow
authorchiba <chiba@30ef5769-5b8d-40dd-aea6-55b5d6557bb3>
Sat, 12 Nov 2011 16:06:24 +0000 (16:06 +0000)
committerchiba <chiba@30ef5769-5b8d-40dd-aea6-55b5d6557bb3>
Sat, 12 Nov 2011 16:06:24 +0000 (16:06 +0000)
git-svn-id: http://anonsvn.jboss.org/repos/javassist/trunk@601 30ef5769-5b8d-40dd-aea6-55b5d6557bb3

src/main/javassist/bytecode/analysis/ControlFlow.java
src/test/test/javassist/bytecode/analysis/DomTreePrinter.java

index 5b3027aa05df377f223da8c9c724df7419107c4a..3f50182a7a62de8204256346541b4f6e3dc58095 100644 (file)
@@ -175,6 +175,13 @@ public class ControlFlow {
      * we deal with <code>JSR</code> as a non-branch instruction.
      */
     public static class Block extends BasicBlock {
+        /**
+         * A field that can be freely used for storing extra data.
+         * A client program of this control-flow analyzer can append
+         * an additional attribute to a <code>Block</code> object.
+         */
+        public Object clientData = null;
+
         int index;
         MethodInfo method;
         Block[] entrances;
index f5418c507786a34f451c3c637a146bf3a4c77276..7c2c8bddc4e0d2ceecda5babe2b8948ff539ab9b 100644 (file)
@@ -24,4 +24,30 @@ public class DomTreePrinter {
         }
         return array[0];
     }
+
+    public int dummy2(int n, int[] array) {
+        int i = 0;
+        while (i < n) {
+            if (array[i] > 0)
+                break;
+            if (array[i++] > -1)
+                continue;
+            array[0]++;
+            array[1]++;
+        }
+        return array[0];
+    }
+
+    public int dummy3(int n, int[] array) {
+        int i = 0;
+        do {
+            if (array[i] > 0)
+                break;
+            if (array[i++] > -1)
+                continue;
+            array[0]++;
+            array[1]++;
+        } while (i < n);
+        return array[0];
+    }
 }