[Fb-contrib-commit] SF.net SVN: fb-contrib:[1154] trunk/fb-contrib/src/com/mebigfatguy/ fbcontrib/
Brought to you by:
dbrosius
From: <dbr...@us...> - 2009-04-11 14:04:46
|
Revision: 1154 http://fb-contrib.svn.sourceforge.net/fb-contrib/?rev=1154&view=rev Author: dbrosius Date: 2009-04-11 14:04:37 +0000 (Sat, 11 Apr 2009) Log Message: ----------- clear allocationRegs at key points Modified Paths: -------------- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/UnnecessaryNewNullCheck.java Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/UnnecessaryNewNullCheck.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/UnnecessaryNewNullCheck.java 2009-04-11 02:50:18 UTC (rev 1153) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/UnnecessaryNewNullCheck.java 2009-04-11 14:04:37 UTC (rev 1154) @@ -27,7 +27,7 @@ private final BugReporter bugReporter; private OpcodeStack stack; private Set<Integer> allocationRegs; - private Set<Integer> handlerStarts; + private Set<Integer> transitionPoints; public UnnecessaryNewNullCheck(BugReporter bugReporter) { this.bugReporter = bugReporter; @@ -38,12 +38,12 @@ try { stack = new OpcodeStack(); allocationRegs = new HashSet<Integer>(); - handlerStarts = new HashSet<Integer>(); + transitionPoints = new HashSet<Integer>(); super.visitClassContext(classContext); } finally { stack = null; allocationRegs = null; - handlerStarts = null; + transitionPoints = null; } } @@ -52,12 +52,12 @@ if (prescreen()) { stack.resetForMethodEntry(this); allocationRegs.clear(); - handlerStarts.clear(); + transitionPoints.clear(); CodeException[] ce = obj.getExceptionTable(); if (ce != null) { for (CodeException element : ce) { - handlerStarts.add(Integer14.valueOf(element.getHandlerPC())); + transitionPoints.add(Integer14.valueOf(element.getHandlerPC())); } } super.visitCode(obj); @@ -114,9 +114,38 @@ } } break; + + case IFEQ: + case IFNE: + case IFLT: + case IFGE: + case IFGT: + case IFLE: + case IF_ICMPEQ: + case IF_ICMPNE: + case IF_ICMPLT: + case IF_ICMPGE: + case IF_ICMPGT: + case IF_ICMPLE: + case IF_ACMPEQ: + case IF_ACMPNE: + transitionPoints.add(Integer14.valueOf(getBranchTarget())); + allocationRegs.clear(); + break; + + case IRETURN: + case LRETURN: + case FRETURN: + case DRETURN: + case ARETURN: + case RETURN: + case GOTO: + case GOTO_W: + allocationRegs.clear(); + break; } - if (handlerStarts.contains(Integer14.valueOf(getPC()))) + if (transitionPoints.contains(Integer14.valueOf(getPC()))) allocationRegs.clear(); } finally { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |