Thread: [Fb-contrib-commit] SF.net SVN: fb-contrib: [401] trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/det
Brought to you by:
dbrosius
From: <dbr...@us...> - 2006-04-06 14:25:48
|
Revision: 401 Author: dbrosius Date: 2006-04-06 07:25:39 -0700 (Thu, 06 Apr 2006) ViewCVS: http://svn.sourceforge.net/fb-contrib/?rev=401&view=rev Log Message: ----------- Add aload/astore reg checking... starting to limp along, altho too many bugs found Modified Paths: -------------- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/NonOwnedSynchronization.java Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/NonOwnedSynchronization.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/NonOwnedSynchronization.java 2006-04-06 14:19:34 UTC (rev 400) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/NonOwnedSynchronization.java 2006-04-06 14:25:39 UTC (rev 401) @@ -92,7 +92,11 @@ tosIsPriority = OWNED; break; - case ALOAD: { + case ALOAD: + case ALOAD_0: + case ALOAD_1: + case ALOAD_2: + case ALOAD_3: { int reg = RegisterUtils.getALoadReg(this, seen); if (getMethod().isStatic() && (reg == 0)) tosIsPriority = LOW_PRIORITY; @@ -104,7 +108,11 @@ } break; - case ASTORE: { + case ASTORE: + case ASTORE_0: + case ASTORE_1: + case ASTORE_2: + case ASTORE_3: { if (stack.getStackDepth() > 0) { OpcodeStack.Item item = stack.getStackItem(0); Integer priority = (Integer)item.getUserValue(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dbr...@us...> - 2006-04-06 14:26:57
|
Revision: 402 Author: dbrosius Date: 2006-04-06 07:26:33 -0700 (Thu, 06 Apr 2006) ViewCVS: http://svn.sourceforge.net/fb-contrib/?rev=402&view=rev Log Message: ----------- no autoboxing Modified Paths: -------------- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/NonOwnedSynchronization.java Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/NonOwnedSynchronization.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/NonOwnedSynchronization.java 2006-04-06 14:25:39 UTC (rev 401) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/NonOwnedSynchronization.java 2006-04-06 14:26:33 UTC (rev 402) @@ -99,7 +99,7 @@ case ALOAD_3: { int reg = RegisterUtils.getALoadReg(this, seen); if (getMethod().isStatic() && (reg == 0)) - tosIsPriority = LOW_PRIORITY; + tosIsPriority = LOW; else { tosIsPriority = regPriorities.get(new Integer(reg)); if (tosIsPriority == null) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dbr...@us...> - 2006-04-07 12:28:22
|
Revision: 406 Author: dbrosius Date: 2006-04-07 05:28:07 -0700 (Fri, 07 Apr 2006) ViewCVS: http://svn.sourceforge.net/fb-contrib/?rev=406&view=rev Log Message: ----------- allow to transition to the new getBytecodeSet by using reflection for now Modified Paths: -------------- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/NonOwnedSynchronization.java Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/NonOwnedSynchronization.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/NonOwnedSynchronization.java 2006-04-07 02:01:50 UTC (rev 405) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/NonOwnedSynchronization.java 2006-04-07 12:28:07 UTC (rev 406) @@ -1,5 +1,6 @@ package com.mebigfatguy.fbcontrib.detect; +import java.lang.reflect.Member; import java.util.BitSet; import java.util.HashMap; import java.util.Map; @@ -50,6 +51,17 @@ return super.clone(); } + private static java.lang.reflect.Method gbs; + private static BitSet transition_getBytecodeSet(ClassContext classContext, Method m) { + try { + if (gbs == null) + gbs = ClassContext.class.getMethod("getBytecodeSet", new Class[] { Method.class }); + return (BitSet)gbs.invoke(classContext, new Object[] { m }); + } catch (Exception e) { + return new BitSet(); + } + } + /** * looks for methods that contain a MONITORENTER opcode * @@ -57,7 +69,7 @@ * @return if the class uses synchronization */ public boolean prescreen(Method method) { - BitSet bytecodeSet = ClassContext.getBytecodeSet(method); + BitSet bytecodeSet = transition_getBytecodeSet(getClassContext(), method); return bytecodeSet != null && (bytecodeSet.get(Constants.MONITORENTER)); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dbr...@us...> - 2006-04-09 03:36:50
|
Revision: 421 Author: dbrosius Date: 2006-04-08 20:29:38 -0700 (Sat, 08 Apr 2006) ViewCVS: http://svn.sourceforge.net/fb-contrib/?rev=421&view=rev Log Message: ----------- no autoboxing Modified Paths: -------------- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/NonOwnedSynchronization.java Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/NonOwnedSynchronization.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/NonOwnedSynchronization.java 2006-04-09 03:22:17 UTC (rev 420) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/NonOwnedSynchronization.java 2006-04-09 03:29:38 UTC (rev 421) @@ -26,7 +26,7 @@ * the current class and synchronization on 'this' should be avoided as well. */ public class NonOwnedSynchronization extends BytecodeScanningDetector implements StatelessDetector { - private static final Integer OWNED = Integer.MAX_VALUE; + private static final Integer OWNED = new Integer(Integer.MAX_VALUE); private static final Integer LOW = new Integer(LOW_PRIORITY); private static final Integer NORMAL = new Integer(NORMAL_PRIORITY); private BugReporter bugReporter; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dbr...@us...> - 2006-04-18 22:26:44
|
Revision: 478 Author: dbrosius Date: 2006-04-18 15:26:38 -0700 (Tue, 18 Apr 2006) ViewCVS: http://svn.sourceforge.net/fb-contrib/?rev=478&view=rev Log Message: ----------- Manually cleanup memory now that StatelessDetector is removed. Modified Paths: -------------- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/NonOwnedSynchronization.java Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/NonOwnedSynchronization.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/NonOwnedSynchronization.java 2006-04-18 22:24:26 UTC (rev 477) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/NonOwnedSynchronization.java 2006-04-18 22:26:38 UTC (rev 478) @@ -15,7 +15,7 @@ import edu.umd.cs.findbugs.BugReporter; import edu.umd.cs.findbugs.BytecodeScanningDetector; import edu.umd.cs.findbugs.OpcodeStack; -import edu.umd.cs.findbugs.StatelessDetector; +import edu.umd.cs.findbugs.ba.ClassContext; /** * looks for methods that synchronize on variables that are not owned by the @@ -24,13 +24,14 @@ * synchronize on private fields of the class. Note that 'this' is not owned by * the current class and synchronization on 'this' should be avoided as well. */ -public class NonOwnedSynchronization extends BytecodeScanningDetector implements StatelessDetector { +public class NonOwnedSynchronization extends BytecodeScanningDetector +{ private static final Integer OWNED = new Integer(Integer.MAX_VALUE); private static final Integer LOW = new Integer(LOW_PRIORITY); private static final Integer NORMAL = new Integer(NORMAL_PRIORITY); private BugReporter bugReporter; - private OpcodeStack stack = new OpcodeStack(); - private Map<Integer, Integer> regPriorities = new HashMap<Integer, Integer>(); + private OpcodeStack stack; + private Map<Integer, Integer> regPriorities; /** * constructs a NOS detector given the reporter to report bugs on @@ -38,18 +39,23 @@ */ public NonOwnedSynchronization(BugReporter bugReporter) { this.bugReporter = bugReporter; } + + /** + * implements the visitor to set and clear the stack and priorities + */ + @Override + public void visitClassContext(ClassContext classContext) { + try { + stack = new OpcodeStack(); + regPriorities = new HashMap<Integer, Integer>(); + super.visitClassContext(classContext); + } finally { + stack = null; + regPriorities = null; + } + } /** - * clone this detector so that it can be a StatelessDetector - * - * @return a clone of this object - */ - @Override - public Object clone() throws CloneNotSupportedException { - return super.clone(); - } - - /** * looks for methods that contain a MONITORENTER opcode * * @param method the context object of the current method This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |