[Fb-contrib-commit] SF.net SVN: fb-contrib:[1521] trunk/fb-contrib/src/com/mebigfatguy/ fbcontrib/d
Brought to you by:
dbrosius
|
From: <dbr...@us...> - 2010-03-13 21:15:51
|
Revision: 1521
http://fb-contrib.svn.sourceforge.net/fb-contrib/?rev=1521&view=rev
Author: dbrosius
Date: 2010-03-13 21:15:44 +0000 (Sat, 13 Mar 2010)
Log Message:
-----------
clean up some fps with MAC
Modified Paths:
--------------
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ManualArrayCopy.java
Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ManualArrayCopy.java
===================================================================
--- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ManualArrayCopy.java 2010-03-13 20:52:37 UTC (rev 1520)
+++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ManualArrayCopy.java 2010-03-13 21:15:44 UTC (rev 1521)
@@ -33,7 +33,7 @@
*/
public class ManualArrayCopy extends BytecodeScanningDetector
{
- enum State {SAW_NOTHING, SAW_ARRAY1_LOAD, SAW_ARRAY1_INDEX, SAW_ARRAY2_LOAD, SAW_ARRAY2_INDEX, SAW_ELEM_LOAD}
+ enum State {SAW_NOTHING, SAW_ICMP, SAW_ARRAY1_LOAD, SAW_ARRAY1_INDEX, SAW_ARRAY2_LOAD, SAW_ARRAY2_INDEX, SAW_ELEM_LOAD, SAW_ELEM_STORE}
private static final BitSet arrayLoadOps = new BitSet();
static {
arrayLoadOps.set(AALOAD);
@@ -85,7 +85,12 @@
@Override
public void sawOpcode(int seen) {
switch (state) {
- case SAW_NOTHING:
+ case SAW_NOTHING:
+ if ((seen == IF_ICMPGE) || (seen == IF_ICMPGT))
+ state = State.SAW_ICMP;
+ break;
+
+ case SAW_ICMP:
if ((seen == ALOAD) || ((seen >= ALOAD_0) && (seen <= ALOAD_3)))
state = State.SAW_ARRAY1_LOAD;
break;
@@ -149,12 +154,22 @@
|| (seen == DASTORE)
|| (seen == FASTORE)) {
if (similarArrayInstructions(loadInstruction, seen)) {
- bugReporter.reportBug( new BugInstance( this, "MAC_MANUAL_ARRAY_COPY", NORMAL_PRIORITY)
- .addClass(this)
- .addMethod(this)
- .addSourceLine(this));
+ state = State.SAW_ELEM_STORE;
+ } else {
+ state = State.SAW_NOTHING;
}
+ } else {
+ state = State.SAW_NOTHING;
}
+ break;
+
+ case SAW_ELEM_STORE:
+ if (seen == IINC) {
+ bugReporter.reportBug( new BugInstance( this, "MAC_MANUAL_ARRAY_COPY", NORMAL_PRIORITY)
+ .addClass(this)
+ .addMethod(this)
+ .addSourceLine(this));
+ }
state = State.SAW_NOTHING;
break;
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|