[Fb-contrib-commit] fb-contrib/src/com/mebigfatguy/fbcontrib/detect ListIndexedIterating.java,1.9,1.
Brought to you by:
dbrosius
|
From: Dave B. <dbr...@us...> - 2005-12-06 06:56:02
|
Update of /cvsroot/fb-contrib/fb-contrib/src/com/mebigfatguy/fbcontrib/detect In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26665/src/com/mebigfatguy/fbcontrib/detect Modified Files: ListIndexedIterating.java Log Message: javadoc Index: ListIndexedIterating.java =================================================================== RCS file: /cvsroot/fb-contrib/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ListIndexedIterating.java,v retrieving revision 1.9 retrieving revision 1.10 diff -u -d -r1.9 -r1.10 --- ListIndexedIterating.java 5 Dec 2005 05:21:15 -0000 1.9 +++ ListIndexedIterating.java 6 Dec 2005 06:55:53 -0000 1.10 @@ -71,6 +71,11 @@ return super.clone(); } + /** + * overrides the visitor to reset the opcode stack + * + * @param obj the code object for the currently parsed Code + */ @Override public void visitCode(final Code obj) { sawListSize = false; @@ -88,6 +93,11 @@ } } + /** + * overrides the visitor to find list indexed iterating + * + * @param seen the currently parsed opcode + */ @Override public void sawOpcode(final int seen) { if (stage == FIND_LOOP_STAGE) @@ -96,6 +106,11 @@ sawOpcodeBug(seen); } + /** + * the first pass of the method opcode to collet for loops information + * + * @param seen the currently parsed opcode + */ private void sawOpcodeLoop(final int seen) { try { switch (state) { @@ -129,6 +144,11 @@ } } + /** + * the second pass to look for get methods on the for loop reg + * + * @param seen the currently parsed opcode + */ private void sawOpcodeBug(final int seen) { try { Iterator<ForLoop> it = possibleForLoops.iterator(); @@ -214,12 +234,24 @@ } } + /** + * get the register operand from the passed in opcode + * + * @param seen the currently parsed opcode + * @param generalOp the standard non numbered operand + * @param zeroOp the base opcode from which to calculate the register + * + * @return the register operand for the instruction + */ private int getReg(final int seen, final int generalOp, final int zeroOp) { if (seen == generalOp) return getRegisterOperand(); return seen - zeroOp; } + /** + * represents a for loop + */ static class ForLoop { private int loopStart; @@ -229,6 +261,13 @@ private boolean loopRegLoaded; private OpcodeStack.Item loopCollectionItem; + /** + * constructs a for loop information block + * + * @param start the start of the for loop + * @param end the end of the for loop + * @param reg the loop register + */ public ForLoop( final int start, final int end, final int reg) { loopStart = start; loopEnd = end; @@ -238,34 +277,76 @@ loopCollectionItem = null; } + /** + * get the start pc of the loop + * + * @return the start pc of the loop + */ public int getLoopStart() { return loopStart; } + /** + * get the end pc of the loop + * + * @return the end pc of the loop + */ public int getLoopEnd() { return loopEnd; } + /** + * get the loop register + * + * @return the loop register + */ public int getLoopReg() { return loopReg; } + /** + * sets the current state of the for loop + * + * @param state the new state + */ public void setLoopState(final int state) { loopState = state; } + /** + * get the current phase of the for loop + * + * @return the current state + */ public int getLoopState() { return loopState; } + /** + * mark that the loop register has been loaded with an iload instruction + * + * @param loaded the flag of whether the loop register is loaded + */ public void setLoopRegLoaded(final boolean loaded) { loopRegLoaded = loaded; } + /** + * returns whether the loop register is on the top of the stack + * + * @return whether the loop register is on the top of the stack + */ public boolean getLoopRegLoaded() { return loopRegLoaded; } + /** + * returns whether this is the second time the loop register is found + * + * @param itm the item on the stack + * + * @return whether this is the second time the loop register is found + */ public boolean isSecondItem(OpcodeStack.Item itm) { if (loopCollectionItem == null) { loopCollectionItem = itm; |