X-Git-Url: http://git.megacz.com/?p=org.ibex.classgen.git;a=blobdiff_plain;f=src%2Forg%2Fibex%2Fclassgen%2FMethodGen.java;h=3d59a12d0cb33e06f4fb32f8422225dc21d5dcfd;hp=baf7fe3f4e79842af1741c592987e7ac48e5cf94;hb=80f8c407ea8a178bdef7dd351d2ece8719d85147;hpb=72cc9664e25a90f5241c9f4c39319889cd36ed15
diff --git a/src/org/ibex/classgen/MethodGen.java b/src/org/ibex/classgen/MethodGen.java
index baf7fe3..3d59a12 100644
--- a/src/org/ibex/classgen/MethodGen.java
+++ b/src/org/ibex/classgen/MethodGen.java
@@ -291,7 +291,8 @@ public class MethodGen implements CGConst {
}
/** Adds a exception type that can be thrown from this method
- NOTE: This isn't enforced by the JVM. This is for reference only. A method can throw exceptions not declared to be thrown
+ NOTE: This isn't enforced by the JVM. This is for reference
+ only. A method can throw exceptions not declared to be thrown
@param type The type of exception that can be thrown
*/
public final void addThrow(Type.Class type) { thrownExceptions.put(type, type); }
@@ -547,30 +548,6 @@ public class MethodGen implements CGConst {
// Emitting Bits //////////////////////////////////////////////////////////////////////////////
- /** Negates the IF* instruction, op (IF_ICMPGT -> IF_ICMPLE, IFNE -> IFEQ, etc)
- @exception IllegalArgumentException if op isn't an IF* instruction */
- public static byte negate(byte op) {
- switch(op) {
- case IFEQ: return IFNE;
- case IFNE: return IFEQ;
- case IFLT: return IFGE;
- case IFGE: return IFLT;
- case IFGT: return IFLE;
- case IFLE: return IFGT;
- case IF_ICMPEQ: return IF_ICMPNE;
- case IF_ICMPNE: return IF_ICMPEQ;
- case IF_ICMPLT: return IF_ICMPGE;
- case IF_ICMPGE: return IF_ICMPLT;
- case IF_ICMPGT: return IF_ICMPLE;
- case IF_ICMPLE: return IF_ICMPGT;
- case IF_ACMPEQ: return IF_ACMPNE;
- case IF_ACMPNE: return IF_ACMPEQ;
-
- default:
- throw new IllegalArgumentException("Can't negate " + Integer.toHexString(op));
- }
- }
-
private Object resolveTarget(Object arg) {
int target;
if (arg instanceof PhantomTarget) {
@@ -1044,4 +1021,31 @@ public class MethodGen implements CGConst {
}
}
+ // Unused //////////////////////////////////////////////////////////////////////////////
+
+ /** Negates the IF* instruction, op (IF_ICMPGT -> IF_ICMPLE, IFNE -> IFEQ, etc)
+ @exception IllegalArgumentException if op isn't an IF* instruction */
+ public static byte negate(byte op) {
+ switch(op) {
+ case IFEQ: return IFNE;
+ case IFNE: return IFEQ;
+ case IFLT: return IFGE;
+ case IFGE: return IFLT;
+ case IFGT: return IFLE;
+ case IFLE: return IFGT;
+ case IF_ICMPEQ: return IF_ICMPNE;
+ case IF_ICMPNE: return IF_ICMPEQ;
+ case IF_ICMPLT: return IF_ICMPGE;
+ case IF_ICMPGE: return IF_ICMPLT;
+ case IF_ICMPGT: return IF_ICMPLE;
+ case IF_ICMPLE: return IF_ICMPGT;
+ case IF_ACMPEQ: return IF_ACMPNE;
+ case IF_ACMPNE: return IF_ACMPEQ;
+
+ default:
+ throw new IllegalArgumentException("Can't negate " + Integer.toHexString(op));
+ }
+ }
+
+
}