commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kohs...@apache.org
Subject svn commit: r359615 - /jakarta/commons/sandbox/javaflow/trunk/src/java/org/apache/commons/javaflow/bytecode/transformation/bcel/analyser/Subroutines.java
Date Wed, 28 Dec 2005 19:58:27 GMT
Author: kohsuke
Date: Wed Dec 28 11:58:25 2005
New Revision: 359615

URL: http://svn.apache.org/viewcvs?rev=359615&view=rev
Log:
removed pointless allocation of arrays.

Modified:
    jakarta/commons/sandbox/javaflow/trunk/src/java/org/apache/commons/javaflow/bytecode/transformation/bcel/analyser/Subroutines.java

Modified: jakarta/commons/sandbox/javaflow/trunk/src/java/org/apache/commons/javaflow/bytecode/transformation/bcel/analyser/Subroutines.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/sandbox/javaflow/trunk/src/java/org/apache/commons/javaflow/bytecode/transformation/bcel/analyser/Subroutines.java?rev=359615&r1=359614&r2=359615&view=diff
==============================================================================
--- jakarta/commons/sandbox/javaflow/trunk/src/java/org/apache/commons/javaflow/bytecode/transformation/bcel/analyser/Subroutines.java
(original)
+++ jakarta/commons/sandbox/javaflow/trunk/src/java/org/apache/commons/javaflow/bytecode/transformation/bcel/analyser/Subroutines.java
Wed Dec 28 11:58:25 2005
@@ -409,7 +409,7 @@
 			ArrayList Q = new ArrayList();
 			Q.add(actual);
 
-            /* BFS ALGORITHM MODIFICATION: Start out with multiple "root" nodes, as exception
handlers are starting points of top-level code, too. [why top-level? TODO: Refer to the special
JustIce notion of subroutines.]*/
+            /* DFS ALGORITHM MODIFICATION: Start out with multiple "root" nodes, as exception
handlers are starting points of top-level code, too. [why top-level? TODO: Refer to the special
JustIce notion of subroutines.]*/
 			if (actual == all[0]){
 				for (int j=0; j<handlers.length; j++){
 					Q.add(handlers[j].getHandlerPC());
@@ -426,7 +426,7 @@
                     }
                 }
             }
-			// BFS ended above.
+			// DFS ended above.
             ((SubroutineImpl) (actual==all[0]?getTopLevel():getSubroutine(actual))).setInstructions(closure);
 
             for (Iterator itr = closure.iterator(); itr.hasNext();) {
@@ -555,17 +555,16 @@
 	public Subroutine getTopLevel(){
 		return TOPLEVEL;
 	}
-	/**
+
+    static final InstructionHandle[] empty = new InstructionHandle[0];
+
+    /**
 	 * A utility method that calculates the successors of a given InstructionHandle
 	 * <B>in the same subroutine</B>. That means, a RET does not have any successors
 	 * as defined here. A JsrInstruction has its physical successor as its successor
 	 * (opposed to its target) as defined here.
 	 */
 	private static InstructionHandle[] getSuccessors(InstructionHandle instruction){
-		final InstructionHandle[] empty = new InstructionHandle[0];
-		final InstructionHandle[] single = new InstructionHandle[1];
-		final InstructionHandle[] pair = new InstructionHandle[2];
-
 		Instruction inst = instruction.getInstruction();
 
 		if (inst instanceof RET){
@@ -583,7 +582,9 @@
 			return empty;
 		}
 
-		// See method comment.
+        final InstructionHandle[] single = new InstructionHandle[1];
+
+        // See method comment.
 		if (inst instanceof JsrInstruction){
 			single[0] = instruction.getNext();
 			return single;
@@ -605,6 +606,7 @@
 				return ret;
 			}
 			else{
+                final InstructionHandle[] pair = new InstructionHandle[2];
 				pair[0] = instruction.getNext();
 				pair[1] = ((BranchInstruction) inst).getTarget();
 				return pair;



---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Mime
View raw message