[jboss-cvs] javassist SVN: r632 - in trunk: src/test/test/javassist/bytecode/analysis and 1 other directory.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Tue Jun 5 12:03:49 EDT 2012
Author: chiba
Date: 2012-06-05 12:03:48 -0400 (Tue, 05 Jun 2012)
New Revision: 632
Modified:
trunk/Readme.html
trunk/src/test/test/javassist/bytecode/analysis/DomTreeTest.java
Log:
fixed JASSIST-168
Modified: trunk/Readme.html
===================================================================
--- trunk/Readme.html 2012-06-05 14:53:58 UTC (rev 631)
+++ trunk/Readme.html 2012-06-05 16:03:48 UTC (rev 632)
@@ -282,6 +282,9 @@
<h2>Changes</h2>
<p>-version 3.17
+<ul>
+ <li>JIRA JASSIST-168.
+</ul>
<p>-version 3.16.1 on March 6, 2012
<ul>
Modified: trunk/src/test/test/javassist/bytecode/analysis/DomTreeTest.java
===================================================================
--- trunk/src/test/test/javassist/bytecode/analysis/DomTreeTest.java 2012-06-05 14:53:58 UTC (rev 631)
+++ trunk/src/test/test/javassist/bytecode/analysis/DomTreeTest.java 2012-06-05 16:03:48 UTC (rev 632)
@@ -36,10 +36,12 @@
}
private void testBlock(Block b, int[] incoming, int[] outgoing) {
+ assertEquals(incoming.length, b.incomings());
int i = 0;
for (int index: incoming)
assertEquals(index, b.incoming(i++).position());
i = 0;
+ assertEquals(outgoing.length, b.exits());
for (int index: outgoing)
assertEquals(index, b.exit(i++).position());
}
@@ -56,4 +58,35 @@
k = 3 ;
}
}
+
+ public void testDomtree2() throws Exception {
+ ControlFlow cf = new ControlFlow(pool.get(DomTreeTest.class.getName()).getDeclaredMethod("test2"));
+ Block[] blocks = cf.basicBlocks();
+ // for (int i = 0; i < blocks.length; i++)
+ // System.out.println(i + ": " + blocks[i]);
+ testBlock(blocks[0], new int[] { 7 }, new int[] { 14, 7 } );
+ testBlock(blocks[1], new int[] { 0 }, new int[] { 0, 12 } );
+ testBlock(blocks[2], new int[] { 7 }, new int[] {});
+ testBlock(blocks[3], new int[] { 0 }, new int[] {});
+
+ Node[] dom = cf.dominatorTree();
+ assertNull(dom[0].parent());
+ assertEquals(0, dom[1].parent().block().position());
+ assertEquals(7, dom[2].parent().block().position());
+ assertEquals(0, dom[3].parent().block().position());
+
+ Node[] pdom = cf.postDominatorTree();
+ assertNull(pdom[0].parent());
+ assertNull(pdom[1].parent());
+ assertNull(pdom[2].parent());
+ assertNull(pdom[3].parent());
+ }
+
+ public int test2(int i){
+ while (i-- > 0)
+ if (i == 3)
+ return 1;
+
+ return i + 3;
+ }
}
More information about the jboss-cvs-commits
mailing list