From: adam Date: Mon, 27 Jun 2005 08:55:26 +0000 (+0000) Subject: more reformatting X-Git-Url: http://git.megacz.com/?p=org.ibex.classgen.git;a=commitdiff_plain;h=80f8c407ea8a178bdef7dd351d2ece8719d85147 more reformatting darcs-hash:20050627085526-5007d-bd95507e6c0286409f197fa168bafc0c7c86fc73.gz --- 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)); + } + } + + }