[Fb-contrib-commit] SF.net SVN: fb-contrib: [720] trunk/fb-contrib/src/com/mebigfatguy/ fbcontrib/
Brought to you by:
dbrosius
From: <dbr...@us...> - 2006-12-10 10:18:42
|
Revision: 720 http://svn.sourceforge.net/fb-contrib/?rev=720&view=rev Author: dbrosius Date: 2006-12-10 02:18:38 -0800 (Sun, 10 Dec 2006) Log Message: ----------- don't report catch block stores Modified Paths: -------------- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/BloatedAssignmentScope.java Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/BloatedAssignmentScope.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/BloatedAssignmentScope.java 2006-12-10 09:25:19 UTC (rev 719) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/BloatedAssignmentScope.java 2006-12-10 10:18:38 UTC (rev 720) @@ -26,6 +26,7 @@ import java.util.Set; import org.apache.bcel.classfile.Code; +import org.apache.bcel.classfile.CodeException; import org.apache.bcel.classfile.Method; import com.mebigfatguy.fbcontrib.utils.RegisterUtils; @@ -45,6 +46,7 @@ BugReporter bugReporter; private Set<Integer> ignoreRegs; private ScopeBlock rootScopeBlock; + private Set<Integer> catchHandlers; private boolean dontReport; /** @@ -65,9 +67,11 @@ public void visitClassContext(ClassContext classContext) { try { ignoreRegs = new HashSet<Integer>(); + catchHandlers = new HashSet<Integer>(); super.visitClassContext(classContext); } finally { ignoreRegs = null; + catchHandlers = null; } } @@ -91,6 +95,15 @@ } rootScopeBlock = new ScopeBlock(0, obj.getLength()); + catchHandlers.clear(); + CodeException[] exceptions = obj.getExceptionTable(); + if (exceptions != null) { + for (CodeException ex : exceptions) { + catchHandlers.add(Integer.valueOf(ex.getHandlerPC())); + } + } + + dontReport = false; super.visitCode(obj); @@ -121,12 +134,15 @@ || ((seen >= FSTORE_0) && (seen <= FSTORE_1)) || ((seen >= DSTORE_0) && (seen <= DSTORE_1))) { int reg = RegisterUtils.getStoreReg(this, seen); - if (!ignoreRegs.contains(Integer.valueOf(reg))) { + Integer iReg = Integer.valueOf(reg); + if (catchHandlers.contains(getPC())) + ignoreRegs.add(iReg); + if (!ignoreRegs.contains(iReg)) { ScopeBlock sb = findScopeBlock(rootScopeBlock, getPC()); if (sb != null) sb.addStore(reg, getPC()); else - ignoreRegs.add(Integer.valueOf(reg)); + ignoreRegs.add(iReg); } } else if ((seen == ALOAD) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |