From 663631f0456fcc245dd835889f86541d75161c53 Mon Sep 17 00:00:00 2001 From: Roman Shevchenko Date: Thu, 28 Aug 2014 20:52:43 +0400 Subject: java-decompiler: post-import cleanup (classes moved) --- .../decompiler/code/optinstructions/ALOAD.java | 56 ++++++++++++++++++++++ .../decompiler/code/optinstructions/ANEWARRAY.java | 33 +++++++++++++ .../decompiler/code/optinstructions/ASTORE.java | 56 ++++++++++++++++++++++ .../decompiler/code/optinstructions/BIPUSH.java | 44 +++++++++++++++++ .../decompiler/code/optinstructions/CHECKCAST.java | 34 +++++++++++++ .../decompiler/code/optinstructions/DLOAD.java | 56 ++++++++++++++++++++++ .../decompiler/code/optinstructions/DSTORE.java | 55 +++++++++++++++++++++ .../decompiler/code/optinstructions/FLOAD.java | 56 ++++++++++++++++++++++ .../decompiler/code/optinstructions/FSTORE.java | 55 +++++++++++++++++++++ .../decompiler/code/optinstructions/GETFIELD.java | 32 +++++++++++++ .../decompiler/code/optinstructions/GETSTATIC.java | 33 +++++++++++++ .../java/decompiler/code/optinstructions/GOTO.java | 44 +++++++++++++++++ .../decompiler/code/optinstructions/GOTO_W.java | 33 +++++++++++++ .../java/decompiler/code/optinstructions/IINC.java | 42 ++++++++++++++++ .../decompiler/code/optinstructions/ILOAD.java | 52 ++++++++++++++++++++ .../code/optinstructions/INSTANCEOF.java | 33 +++++++++++++ .../code/optinstructions/INVOKEDYNAMIC.java | 20 ++++++++ .../code/optinstructions/INVOKEINTERFACE.java | 35 ++++++++++++++ .../code/optinstructions/INVOKESPECIAL.java | 33 +++++++++++++ .../code/optinstructions/INVOKESTATIC.java | 33 +++++++++++++ .../code/optinstructions/INVOKEVIRTUAL.java | 33 +++++++++++++ .../decompiler/code/optinstructions/ISTORE.java | 52 ++++++++++++++++++++ .../java/decompiler/code/optinstructions/JSR.java | 44 +++++++++++++++++ .../decompiler/code/optinstructions/JSR_W.java | 33 +++++++++++++ .../java/decompiler/code/optinstructions/LDC.java | 33 +++++++++++++ .../decompiler/code/optinstructions/LDC2_W.java | 33 +++++++++++++ .../decompiler/code/optinstructions/LDC_W.java | 33 +++++++++++++ .../decompiler/code/optinstructions/LLOAD.java | 52 ++++++++++++++++++++ .../code/optinstructions/LOOKUPSWITCH.java | 42 ++++++++++++++++ .../decompiler/code/optinstructions/LSTORE.java | 52 ++++++++++++++++++++ .../code/optinstructions/MULTIANEWARRAY.java | 34 +++++++++++++ .../java/decompiler/code/optinstructions/NEW.java | 33 +++++++++++++ .../decompiler/code/optinstructions/NEWARRAY.java | 33 +++++++++++++ .../decompiler/code/optinstructions/PUTFIELD.java | 33 +++++++++++++ .../decompiler/code/optinstructions/PUTSTATIC.java | 33 +++++++++++++ .../java/decompiler/code/optinstructions/RET.java | 40 ++++++++++++++++ .../decompiler/code/optinstructions/SIPUSH.java | 33 +++++++++++++ .../code/optinstructions/TABLESWITCH.java | 43 +++++++++++++++++ 38 files changed, 1524 insertions(+) create mode 100644 src/org/jetbrains/java/decompiler/code/optinstructions/ALOAD.java create mode 100644 src/org/jetbrains/java/decompiler/code/optinstructions/ANEWARRAY.java create mode 100644 src/org/jetbrains/java/decompiler/code/optinstructions/ASTORE.java create mode 100644 src/org/jetbrains/java/decompiler/code/optinstructions/BIPUSH.java create mode 100644 src/org/jetbrains/java/decompiler/code/optinstructions/CHECKCAST.java create mode 100644 src/org/jetbrains/java/decompiler/code/optinstructions/DLOAD.java create mode 100644 src/org/jetbrains/java/decompiler/code/optinstructions/DSTORE.java create mode 100644 src/org/jetbrains/java/decompiler/code/optinstructions/FLOAD.java create mode 100644 src/org/jetbrains/java/decompiler/code/optinstructions/FSTORE.java create mode 100644 src/org/jetbrains/java/decompiler/code/optinstructions/GETFIELD.java create mode 100644 src/org/jetbrains/java/decompiler/code/optinstructions/GETSTATIC.java create mode 100644 src/org/jetbrains/java/decompiler/code/optinstructions/GOTO.java create mode 100644 src/org/jetbrains/java/decompiler/code/optinstructions/GOTO_W.java create mode 100644 src/org/jetbrains/java/decompiler/code/optinstructions/IINC.java create mode 100644 src/org/jetbrains/java/decompiler/code/optinstructions/ILOAD.java create mode 100644 src/org/jetbrains/java/decompiler/code/optinstructions/INSTANCEOF.java create mode 100644 src/org/jetbrains/java/decompiler/code/optinstructions/INVOKEDYNAMIC.java create mode 100644 src/org/jetbrains/java/decompiler/code/optinstructions/INVOKEINTERFACE.java create mode 100644 src/org/jetbrains/java/decompiler/code/optinstructions/INVOKESPECIAL.java create mode 100644 src/org/jetbrains/java/decompiler/code/optinstructions/INVOKESTATIC.java create mode 100644 src/org/jetbrains/java/decompiler/code/optinstructions/INVOKEVIRTUAL.java create mode 100644 src/org/jetbrains/java/decompiler/code/optinstructions/ISTORE.java create mode 100644 src/org/jetbrains/java/decompiler/code/optinstructions/JSR.java create mode 100644 src/org/jetbrains/java/decompiler/code/optinstructions/JSR_W.java create mode 100644 src/org/jetbrains/java/decompiler/code/optinstructions/LDC.java create mode 100644 src/org/jetbrains/java/decompiler/code/optinstructions/LDC2_W.java create mode 100644 src/org/jetbrains/java/decompiler/code/optinstructions/LDC_W.java create mode 100644 src/org/jetbrains/java/decompiler/code/optinstructions/LLOAD.java create mode 100644 src/org/jetbrains/java/decompiler/code/optinstructions/LOOKUPSWITCH.java create mode 100644 src/org/jetbrains/java/decompiler/code/optinstructions/LSTORE.java create mode 100644 src/org/jetbrains/java/decompiler/code/optinstructions/MULTIANEWARRAY.java create mode 100644 src/org/jetbrains/java/decompiler/code/optinstructions/NEW.java create mode 100644 src/org/jetbrains/java/decompiler/code/optinstructions/NEWARRAY.java create mode 100644 src/org/jetbrains/java/decompiler/code/optinstructions/PUTFIELD.java create mode 100644 src/org/jetbrains/java/decompiler/code/optinstructions/PUTSTATIC.java create mode 100644 src/org/jetbrains/java/decompiler/code/optinstructions/RET.java create mode 100644 src/org/jetbrains/java/decompiler/code/optinstructions/SIPUSH.java create mode 100644 src/org/jetbrains/java/decompiler/code/optinstructions/TABLESWITCH.java (limited to 'src/org/jetbrains/java/decompiler/code/optinstructions') diff --git a/src/org/jetbrains/java/decompiler/code/optinstructions/ALOAD.java b/src/org/jetbrains/java/decompiler/code/optinstructions/ALOAD.java new file mode 100644 index 0000000..b2727cf --- /dev/null +++ b/src/org/jetbrains/java/decompiler/code/optinstructions/ALOAD.java @@ -0,0 +1,56 @@ +/* + * Fernflower - The Analytical Java Decompiler + * http://www.reversed-java.com + * + * (C) 2008 - 2010, Stiver + * + * This software is NEITHER public domain NOR free software + * as per GNU License. See license.txt for more details. + * + * This software is distributed WITHOUT ANY WARRANTY; without + * even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. + */ + +package org.jetbrains.java.decompiler.code.optinstructions; + +import java.io.DataOutputStream; +import java.io.IOException; + +import org.jetbrains.java.decompiler.code.Instruction; + +public class ALOAD extends Instruction { + + private static int[] opcodes = new int[] {opc_aload_0,opc_aload_1,opc_aload_2,opc_aload_3}; + + public void writeToStream(DataOutputStream out, int offset) throws IOException { + int index = getOperand(0); + if(index>3) { + if(wide) { + out.writeByte(opc_wide); + } + out.writeByte(opc_aload); + if(wide) { + out.writeShort(index); + } else { + out.writeByte(index); + } + } else { + out.writeByte(opcodes[index]); + } + } + + public int length() { + int index = getOperand(0); + if(index>3) { + if(wide) { + return 4; + } else { + return 2; + } + } else { + return 1; + } + } + +} diff --git a/src/org/jetbrains/java/decompiler/code/optinstructions/ANEWARRAY.java b/src/org/jetbrains/java/decompiler/code/optinstructions/ANEWARRAY.java new file mode 100644 index 0000000..1e0d4ff --- /dev/null +++ b/src/org/jetbrains/java/decompiler/code/optinstructions/ANEWARRAY.java @@ -0,0 +1,33 @@ +/* + * Fernflower - The Analytical Java Decompiler + * http://www.reversed-java.com + * + * (C) 2008 - 2010, Stiver + * + * This software is NEITHER public domain NOR free software + * as per GNU License. See license.txt for more details. + * + * This software is distributed WITHOUT ANY WARRANTY; without + * even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. + */ + +package org.jetbrains.java.decompiler.code.optinstructions; + +import java.io.DataOutputStream; +import java.io.IOException; + +import org.jetbrains.java.decompiler.code.Instruction; + +public class ANEWARRAY extends Instruction { + + public void writeToStream(DataOutputStream out, int offset) throws IOException { + out.writeByte(opc_anewarray); + out.writeShort(getOperand(0)); + } + + public int length() { + return 3; + } + +} diff --git a/src/org/jetbrains/java/decompiler/code/optinstructions/ASTORE.java b/src/org/jetbrains/java/decompiler/code/optinstructions/ASTORE.java new file mode 100644 index 0000000..475df11 --- /dev/null +++ b/src/org/jetbrains/java/decompiler/code/optinstructions/ASTORE.java @@ -0,0 +1,56 @@ +/* + * Fernflower - The Analytical Java Decompiler + * http://www.reversed-java.com + * + * (C) 2008 - 2010, Stiver + * + * This software is NEITHER public domain NOR free software + * as per GNU License. See license.txt for more details. + * + * This software is distributed WITHOUT ANY WARRANTY; without + * even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. + */ + +package org.jetbrains.java.decompiler.code.optinstructions; + +import java.io.DataOutputStream; +import java.io.IOException; + +import org.jetbrains.java.decompiler.code.Instruction; + +public class ASTORE extends Instruction { + + private static int[] opcodes = new int[] {opc_astore_0,opc_astore_1,opc_astore_2,opc_astore_3}; + + public void writeToStream(DataOutputStream out, int offset) throws IOException { + int index = getOperand(0); + if(index>3) { + if(wide) { + out.writeByte(opc_wide); + } + out.writeByte(opc_astore); + if(wide) { + out.writeShort(index); + } else { + out.writeByte(index); + } + } else { + out.writeByte(opcodes[index]); + } + } + + public int length() { + int index = getOperand(0); + if(index>3) { + if(wide) { + return 4; + } else { + return 2; + } + } else { + return 1; + } + } + +} diff --git a/src/org/jetbrains/java/decompiler/code/optinstructions/BIPUSH.java b/src/org/jetbrains/java/decompiler/code/optinstructions/BIPUSH.java new file mode 100644 index 0000000..2fb2db5 --- /dev/null +++ b/src/org/jetbrains/java/decompiler/code/optinstructions/BIPUSH.java @@ -0,0 +1,44 @@ +/* + * Fernflower - The Analytical Java Decompiler + * http://www.reversed-java.com + * + * (C) 2008 - 2010, Stiver + * + * This software is NEITHER public domain NOR free software + * as per GNU License. See license.txt for more details. + * + * This software is distributed WITHOUT ANY WARRANTY; without + * even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. + */ + +package org.jetbrains.java.decompiler.code.optinstructions; + +import java.io.DataOutputStream; +import java.io.IOException; + +import org.jetbrains.java.decompiler.code.Instruction; + +public class BIPUSH extends Instruction { + + private static int[] opcodes = new int[] {opc_iconst_m1,opc_iconst_0,opc_iconst_1,opc_iconst_2,opc_iconst_3,opc_iconst_4,opc_iconst_5}; + + public void writeToStream(DataOutputStream out, int offset) throws IOException { + int value = getOperand(0); + if(value<-1 || value > 5) { + out.writeByte(opc_bipush); + out.writeByte(value); + } else { + out.writeByte(opcodes[value+1]); + } + } + + public int length() { + int value = getOperand(0); + if(value<-1 || value > 5) { + return 2; + } else { + return 1; + } + } +} diff --git a/src/org/jetbrains/java/decompiler/code/optinstructions/CHECKCAST.java b/src/org/jetbrains/java/decompiler/code/optinstructions/CHECKCAST.java new file mode 100644 index 0000000..73417de --- /dev/null +++ b/src/org/jetbrains/java/decompiler/code/optinstructions/CHECKCAST.java @@ -0,0 +1,34 @@ +/* + * Fernflower - The Analytical Java Decompiler + * http://www.reversed-java.com + * + * (C) 2008 - 2010, Stiver + * + * This software is NEITHER public domain NOR free software + * as per GNU License. See license.txt for more details. + * + * This software is distributed WITHOUT ANY WARRANTY; without + * even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. + */ + +package org.jetbrains.java.decompiler.code.optinstructions; + +import java.io.DataOutputStream; +import java.io.IOException; + +import org.jetbrains.java.decompiler.code.Instruction; + +public class CHECKCAST extends Instruction { + + public void writeToStream(DataOutputStream out, int offset) throws IOException { + out.writeByte(opc_checkcast); + out.writeShort(getOperand(0)); + } + + public int length() { + return 3; + } + +} + diff --git a/src/org/jetbrains/java/decompiler/code/optinstructions/DLOAD.java b/src/org/jetbrains/java/decompiler/code/optinstructions/DLOAD.java new file mode 100644 index 0000000..96d5449 --- /dev/null +++ b/src/org/jetbrains/java/decompiler/code/optinstructions/DLOAD.java @@ -0,0 +1,56 @@ +/* + * Fernflower - The Analytical Java Decompiler + * http://www.reversed-java.com + * + * (C) 2008 - 2010, Stiver + * + * This software is NEITHER public domain NOR free software + * as per GNU License. See license.txt for more details. + * + * This software is distributed WITHOUT ANY WARRANTY; without + * even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. + */ + +package org.jetbrains.java.decompiler.code.optinstructions; + +import java.io.DataOutputStream; +import java.io.IOException; + +import org.jetbrains.java.decompiler.code.Instruction; + +public class DLOAD extends Instruction { + + private static int[] opcodes = new int[] {opc_dload_0,opc_dload_1,opc_dload_2,opc_dload_3}; + + public void writeToStream(DataOutputStream out, int offset) throws IOException { + int index = getOperand(0); + if(index>3) { + if(wide) { + out.writeByte(opc_wide); + } + out.writeByte(opc_dload); + if(wide) { + out.writeShort(index); + } else { + out.writeByte(index); + } + } else { + out.writeByte(opcodes[index]); + } + } + + public int length() { + int index = getOperand(0); + if(index>3) { + if(wide) { + return 4; + } else { + return 2; + } + } else { + return 1; + } + } + +} diff --git a/src/org/jetbrains/java/decompiler/code/optinstructions/DSTORE.java b/src/org/jetbrains/java/decompiler/code/optinstructions/DSTORE.java new file mode 100644 index 0000000..61a8776 --- /dev/null +++ b/src/org/jetbrains/java/decompiler/code/optinstructions/DSTORE.java @@ -0,0 +1,55 @@ +/* + * Fernflower - The Analytical Java Decompiler + * http://www.reversed-java.com + * + * (C) 2008 - 2010, Stiver + * + * This software is NEITHER public domain NOR free software + * as per GNU License. See license.txt for more details. + * + * This software is distributed WITHOUT ANY WARRANTY; without + * even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. + */ + +package org.jetbrains.java.decompiler.code.optinstructions; + +import java.io.DataOutputStream; +import java.io.IOException; + +import org.jetbrains.java.decompiler.code.Instruction; + +public class DSTORE extends Instruction { + + private static int[] opcodes = new int[] {opc_dstore_0,opc_dstore_1,opc_dstore_2,opc_dstore_3}; + + public void writeToStream(DataOutputStream out, int offset) throws IOException { + int index = getOperand(0); + if(index>3) { + if(wide) { + out.writeByte(opc_wide); + } + out.writeByte(opc_dstore); + if(wide) { + out.writeShort(index); + } else { + out.writeByte(index); + } + } else { + out.writeByte(opcodes[index]); + } + } + + public int length() { + int index = getOperand(0); + if(index>3) { + if(wide) { + return 4; + } else { + return 2; + } + } else { + return 1; + } + } +} diff --git a/src/org/jetbrains/java/decompiler/code/optinstructions/FLOAD.java b/src/org/jetbrains/java/decompiler/code/optinstructions/FLOAD.java new file mode 100644 index 0000000..5c8fe26 --- /dev/null +++ b/src/org/jetbrains/java/decompiler/code/optinstructions/FLOAD.java @@ -0,0 +1,56 @@ +/* + * Fernflower - The Analytical Java Decompiler + * http://www.reversed-java.com + * + * (C) 2008 - 2010, Stiver + * + * This software is NEITHER public domain NOR free software + * as per GNU License. See license.txt for more details. + * + * This software is distributed WITHOUT ANY WARRANTY; without + * even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. + */ + +package org.jetbrains.java.decompiler.code.optinstructions; + +import java.io.DataOutputStream; +import java.io.IOException; + +import org.jetbrains.java.decompiler.code.Instruction; + +public class FLOAD extends Instruction { + + private static int[] opcodes = new int[] {opc_fload_0,opc_fload_1,opc_fload_2,opc_fload_3}; + + public void writeToStream(DataOutputStream out, int offset) throws IOException { + int index = getOperand(0); + if(index>3) { + if(wide) { + out.writeByte(opc_wide); + } + out.writeByte(opc_fload); + if(wide) { + out.writeShort(index); + } else { + out.writeByte(index); + } + } else { + out.writeByte(opcodes[index]); + } + } + + public int length() { + int index = getOperand(0); + if(index>3) { + if(wide) { + return 4; + } else { + return 2; + } + } else { + return 1; + } + } + +} diff --git a/src/org/jetbrains/java/decompiler/code/optinstructions/FSTORE.java b/src/org/jetbrains/java/decompiler/code/optinstructions/FSTORE.java new file mode 100644 index 0000000..3685254 --- /dev/null +++ b/src/org/jetbrains/java/decompiler/code/optinstructions/FSTORE.java @@ -0,0 +1,55 @@ +/* + * Fernflower - The Analytical Java Decompiler + * http://www.reversed-java.com + * + * (C) 2008 - 2010, Stiver + * + * This software is NEITHER public domain NOR free software + * as per GNU License. See license.txt for more details. + * + * This software is distributed WITHOUT ANY WARRANTY; without + * even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. + */ + +package org.jetbrains.java.decompiler.code.optinstructions; + +import java.io.DataOutputStream; +import java.io.IOException; + +import org.jetbrains.java.decompiler.code.Instruction; + +public class FSTORE extends Instruction { + + private static int[] opcodes = new int[] {opc_fstore_0,opc_fstore_1,opc_fstore_2,opc_fstore_3}; + + public void writeToStream(DataOutputStream out, int offset) throws IOException { + int index = getOperand(0); + if(index>3) { + if(wide) { + out.writeByte(opc_wide); + } + out.writeByte(opc_fstore); + if(wide) { + out.writeShort(index); + } else { + out.writeByte(index); + } + } else { + out.writeByte(opcodes[index]); + } + } + + public int length() { + int index = getOperand(0); + if(index>3) { + if(wide) { + return 4; + } else { + return 2; + } + } else { + return 1; + } + } +} diff --git a/src/org/jetbrains/java/decompiler/code/optinstructions/GETFIELD.java b/src/org/jetbrains/java/decompiler/code/optinstructions/GETFIELD.java new file mode 100644 index 0000000..b9a8ab5 --- /dev/null +++ b/src/org/jetbrains/java/decompiler/code/optinstructions/GETFIELD.java @@ -0,0 +1,32 @@ +/* + * Fernflower - The Analytical Java Decompiler + * http://www.reversed-java.com + * + * (C) 2008 - 2010, Stiver + * + * This software is NEITHER public domain NOR free software + * as per GNU License. See license.txt for more details. + * + * This software is distributed WITHOUT ANY WARRANTY; without + * even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. + */ + +package org.jetbrains.java.decompiler.code.optinstructions; + +import java.io.DataOutputStream; +import java.io.IOException; + +import org.jetbrains.java.decompiler.code.Instruction; + +public class GETFIELD extends Instruction { + + public void writeToStream(DataOutputStream out, int offset) throws IOException { + out.writeByte(opc_getfield); + out.writeShort(getOperand(0)); + } + + public int length() { + return 3; + } +} diff --git a/src/org/jetbrains/java/decompiler/code/optinstructions/GETSTATIC.java b/src/org/jetbrains/java/decompiler/code/optinstructions/GETSTATIC.java new file mode 100644 index 0000000..1890bc0 --- /dev/null +++ b/src/org/jetbrains/java/decompiler/code/optinstructions/GETSTATIC.java @@ -0,0 +1,33 @@ +/* + * Fernflower - The Analytical Java Decompiler + * http://www.reversed-java.com + * + * (C) 2008 - 2010, Stiver + * + * This software is NEITHER public domain NOR free software + * as per GNU License. See license.txt for more details. + * + * This software is distributed WITHOUT ANY WARRANTY; without + * even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. + */ + +package org.jetbrains.java.decompiler.code.optinstructions; + +import java.io.DataOutputStream; +import java.io.IOException; + +import org.jetbrains.java.decompiler.code.Instruction; + +public class GETSTATIC extends Instruction { + + public void writeToStream(DataOutputStream out, int offset) throws IOException { + out.writeByte(opc_getstatic); + out.writeShort(getOperand(0)); + } + + public int length() { + return 3; + } + +} diff --git a/src/org/jetbrains/java/decompiler/code/optinstructions/GOTO.java b/src/org/jetbrains/java/decompiler/code/optinstructions/GOTO.java new file mode 100644 index 0000000..3a81194 --- /dev/null +++ b/src/org/jetbrains/java/decompiler/code/optinstructions/GOTO.java @@ -0,0 +1,44 @@ +/* + * Fernflower - The Analytical Java Decompiler + * http://www.reversed-java.com + * + * (C) 2008 - 2010, Stiver + * + * This software is NEITHER public domain NOR free software + * as per GNU License. See license.txt for more details. + * + * This software is distributed WITHOUT ANY WARRANTY; without + * even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. + */ + +package org.jetbrains.java.decompiler.code.optinstructions; + +import java.io.DataOutputStream; +import java.io.IOException; + +import org.jetbrains.java.decompiler.code.JumpInstruction; + +public class GOTO extends JumpInstruction { + + public void writeToStream(DataOutputStream out, int offset) throws IOException { + int operand = getOperand(0); + if(operand < -32768 || operand > 32767) { + out.writeByte(opc_goto_w); + out.writeInt(operand); + } else { + out.writeByte(opc_goto); + out.writeShort(operand); + } + } + + public int length() { + int operand = getOperand(0); + if(operand < -32768 || operand > 32767) { + return 5; + } else { + return 3; + } + } + +} diff --git a/src/org/jetbrains/java/decompiler/code/optinstructions/GOTO_W.java b/src/org/jetbrains/java/decompiler/code/optinstructions/GOTO_W.java new file mode 100644 index 0000000..6e1f6e7 --- /dev/null +++ b/src/org/jetbrains/java/decompiler/code/optinstructions/GOTO_W.java @@ -0,0 +1,33 @@ +/* + * Fernflower - The Analytical Java Decompiler + * http://www.reversed-java.com + * + * (C) 2008 - 2010, Stiver + * + * This software is NEITHER public domain NOR free software + * as per GNU License. See license.txt for more details. + * + * This software is distributed WITHOUT ANY WARRANTY; without + * even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. + */ + +package org.jetbrains.java.decompiler.code.optinstructions; + +import java.io.DataOutputStream; +import java.io.IOException; + +import org.jetbrains.java.decompiler.code.JumpInstruction; + +public class GOTO_W extends JumpInstruction { + + public void writeToStream(DataOutputStream out, int offset) throws IOException { + out.writeByte(opc_goto_w); + out.writeInt(getOperand(0)); + } + + public int length() { + return 5; + } + +} diff --git a/src/org/jetbrains/java/decompiler/code/optinstructions/IINC.java b/src/org/jetbrains/java/decompiler/code/optinstructions/IINC.java new file mode 100644 index 0000000..e945969 --- /dev/null +++ b/src/org/jetbrains/java/decompiler/code/optinstructions/IINC.java @@ -0,0 +1,42 @@ +/* + * Fernflower - The Analytical Java Decompiler + * http://www.reversed-java.com + * + * (C) 2008 - 2010, Stiver + * + * This software is NEITHER public domain NOR free software + * as per GNU License. See license.txt for more details. + * + * This software is distributed WITHOUT ANY WARRANTY; without + * even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. + */ + +package org.jetbrains.java.decompiler.code.optinstructions; + +import java.io.DataOutputStream; +import java.io.IOException; + +import org.jetbrains.java.decompiler.code.Instruction; + +public class IINC extends Instruction { + + public void writeToStream(DataOutputStream out, int offset) throws IOException { + if(wide) { + out.writeByte(opc_wide); + } + out.writeByte(opc_iinc); + if(wide) { + out.writeShort(getOperand(0)); + out.writeShort(getOperand(1)); + } else { + out.writeByte(getOperand(0)); + out.writeByte(getOperand(1)); + } + } + + public int length() { + return wide?6:3; + } + +} diff --git a/src/org/jetbrains/java/decompiler/code/optinstructions/ILOAD.java b/src/org/jetbrains/java/decompiler/code/optinstructions/ILOAD.java new file mode 100644 index 0000000..40bfa4d --- /dev/null +++ b/src/org/jetbrains/java/decompiler/code/optinstructions/ILOAD.java @@ -0,0 +1,52 @@ +/* + * Fernflower - The Analytical Java Decompiler + * http://www.reversed-java.com + * + * (C) 2008 - 2010, Stiver + * + * This software is NEITHER public domain NOR free software + * as per GNU License. See license.txt for more details. + * + * This software is distributed WITHOUT ANY WARRANTY; without + * even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. + */ + +package org.jetbrains.java.decompiler.code.optinstructions; + +import java.io.DataOutputStream; +import java.io.IOException; + +import org.jetbrains.java.decompiler.code.Instruction; + +public class ILOAD extends Instruction { + + private static int[] opcodes = new int[] {opc_iload_0,opc_iload_1,opc_iload_2,opc_iload_3}; + + public void writeToStream(DataOutputStream out, int offset) throws IOException { + int index = getOperand(0); + if(index>3) { + if(wide) { + out.writeByte(opc_wide); + } + out.writeByte(opc_iload); + if(wide) { + out.writeShort(index); + } else { + out.writeByte(index); + } + } else { + out.writeByte(opcodes[index]); + } + } + + public int length() { + int index = getOperand(0); + if(index>3) { + return wide?4:2; + } else { + return 1; + } + } + +} diff --git a/src/org/jetbrains/java/decompiler/code/optinstructions/INSTANCEOF.java b/src/org/jetbrains/java/decompiler/code/optinstructions/INSTANCEOF.java new file mode 100644 index 0000000..f02dfc6 --- /dev/null +++ b/src/org/jetbrains/java/decompiler/code/optinstructions/INSTANCEOF.java @@ -0,0 +1,33 @@ +/* + * Fernflower - The Analytical Java Decompiler + * http://www.reversed-java.com + * + * (C) 2008 - 2010, Stiver + * + * This software is NEITHER public domain NOR free software + * as per GNU License. See license.txt for more details. + * + * This software is distributed WITHOUT ANY WARRANTY; without + * even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. + */ + +package org.jetbrains.java.decompiler.code.optinstructions; + +import java.io.DataOutputStream; +import java.io.IOException; + +import org.jetbrains.java.decompiler.code.Instruction; + +public class INSTANCEOF extends Instruction { + + public void writeToStream(DataOutputStream out, int offset) throws IOException { + out.writeByte(opc_instanceof); + out.writeShort(getOperand(0)); + } + + public int length() { + return 3; + } + +} diff --git a/src/org/jetbrains/java/decompiler/code/optinstructions/INVOKEDYNAMIC.java b/src/org/jetbrains/java/decompiler/code/optinstructions/INVOKEDYNAMIC.java new file mode 100644 index 0000000..ee8c785 --- /dev/null +++ b/src/org/jetbrains/java/decompiler/code/optinstructions/INVOKEDYNAMIC.java @@ -0,0 +1,20 @@ +package org.jetbrains.java.decompiler.code.optinstructions; + +import java.io.DataOutputStream; +import java.io.IOException; + +import org.jetbrains.java.decompiler.code.Instruction; + +public class INVOKEDYNAMIC extends Instruction { + + public void writeToStream(DataOutputStream out, int offset) throws IOException { + out.writeByte(opc_invokedynamic); + out.writeShort(getOperand(0)); + out.writeByte(0); + out.writeByte(0); + } + + public int length() { + return 5; + } +} diff --git a/src/org/jetbrains/java/decompiler/code/optinstructions/INVOKEINTERFACE.java b/src/org/jetbrains/java/decompiler/code/optinstructions/INVOKEINTERFACE.java new file mode 100644 index 0000000..e4f06f2 --- /dev/null +++ b/src/org/jetbrains/java/decompiler/code/optinstructions/INVOKEINTERFACE.java @@ -0,0 +1,35 @@ +/* + * Fernflower - The Analytical Java Decompiler + * http://www.reversed-java.com + * + * (C) 2008 - 2010, Stiver + * + * This software is NEITHER public domain NOR free software + * as per GNU License. See license.txt for more details. + * + * This software is distributed WITHOUT ANY WARRANTY; without + * even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. + */ + +package org.jetbrains.java.decompiler.code.optinstructions; + +import java.io.DataOutputStream; +import java.io.IOException; + +import org.jetbrains.java.decompiler.code.Instruction; + +public class INVOKEINTERFACE extends Instruction { + + public void writeToStream(DataOutputStream out, int offset) throws IOException { + out.writeByte(opc_invokeinterface); + out.writeShort(getOperand(0)); + out.writeByte(getOperand(1)); + out.writeByte(0); + } + + public int length() { + return 5; + } + +} diff --git a/src/org/jetbrains/java/decompiler/code/optinstructions/INVOKESPECIAL.java b/src/org/jetbrains/java/decompiler/code/optinstructions/INVOKESPECIAL.java new file mode 100644 index 0000000..6b9b559 --- /dev/null +++ b/src/org/jetbrains/java/decompiler/code/optinstructions/INVOKESPECIAL.java @@ -0,0 +1,33 @@ +/* + * Fernflower - The Analytical Java Decompiler + * http://www.reversed-java.com + * + * (C) 2008 - 2010, Stiver + * + * This software is NEITHER public domain NOR free software + * as per GNU License. See license.txt for more details. + * + * This software is distributed WITHOUT ANY WARRANTY; without + * even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. + */ + +package org.jetbrains.java.decompiler.code.optinstructions; + +import java.io.DataOutputStream; +import java.io.IOException; + +import org.jetbrains.java.decompiler.code.Instruction; + +public class INVOKESPECIAL extends Instruction { + + public void writeToStream(DataOutputStream out, int offset) throws IOException { + out.writeByte(opc_invokespecial); + out.writeShort(getOperand(0)); + } + + public int length() { + return 3; + } + +} diff --git a/src/org/jetbrains/java/decompiler/code/optinstructions/INVOKESTATIC.java b/src/org/jetbrains/java/decompiler/code/optinstructions/INVOKESTATIC.java new file mode 100644 index 0000000..0f1ad16 --- /dev/null +++ b/src/org/jetbrains/java/decompiler/code/optinstructions/INVOKESTATIC.java @@ -0,0 +1,33 @@ +/* + * Fernflower - The Analytical Java Decompiler + * http://www.reversed-java.com + * + * (C) 2008 - 2010, Stiver + * + * This software is NEITHER public domain NOR free software + * as per GNU License. See license.txt for more details. + * + * This software is distributed WITHOUT ANY WARRANTY; without + * even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. + */ + +package org.jetbrains.java.decompiler.code.optinstructions; + +import java.io.DataOutputStream; +import java.io.IOException; + +import org.jetbrains.java.decompiler.code.Instruction; + +public class INVOKESTATIC extends Instruction { + + public void writeToStream(DataOutputStream out, int offset) throws IOException { + out.writeByte(opc_invokestatic); + out.writeShort(getOperand(0)); + } + + public int length() { + return 3; + } + +} diff --git a/src/org/jetbrains/java/decompiler/code/optinstructions/INVOKEVIRTUAL.java b/src/org/jetbrains/java/decompiler/code/optinstructions/INVOKEVIRTUAL.java new file mode 100644 index 0000000..f4537f3 --- /dev/null +++ b/src/org/jetbrains/java/decompiler/code/optinstructions/INVOKEVIRTUAL.java @@ -0,0 +1,33 @@ +/* + * Fernflower - The Analytical Java Decompiler + * http://www.reversed-java.com + * + * (C) 2008 - 2010, Stiver + * + * This software is NEITHER public domain NOR free software + * as per GNU License. See license.txt for more details. + * + * This software is distributed WITHOUT ANY WARRANTY; without + * even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. + */ + +package org.jetbrains.java.decompiler.code.optinstructions; + +import java.io.DataOutputStream; +import java.io.IOException; + +import org.jetbrains.java.decompiler.code.Instruction; + +public class INVOKEVIRTUAL extends Instruction { + + public void writeToStream(DataOutputStream out, int offset) throws IOException { + out.writeByte(opc_invokevirtual); + out.writeShort(getOperand(0)); + } + + public int length() { + return 3; + } + +} diff --git a/src/org/jetbrains/java/decompiler/code/optinstructions/ISTORE.java b/src/org/jetbrains/java/decompiler/code/optinstructions/ISTORE.java new file mode 100644 index 0000000..0ced128 --- /dev/null +++ b/src/org/jetbrains/java/decompiler/code/optinstructions/ISTORE.java @@ -0,0 +1,52 @@ +/* + * Fernflower - The Analytical Java Decompiler + * http://www.reversed-java.com + * + * (C) 2008 - 2010, Stiver + * + * This software is NEITHER public domain NOR free software + * as per GNU License. See license.txt for more details. + * + * This software is distributed WITHOUT ANY WARRANTY; without + * even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. + */ + +package org.jetbrains.java.decompiler.code.optinstructions; + +import java.io.DataOutputStream; +import java.io.IOException; + +import org.jetbrains.java.decompiler.code.Instruction; + +public class ISTORE extends Instruction { + + private static int[] opcodes = new int[] {opc_istore_0,opc_istore_1,opc_istore_2,opc_istore_3}; + + public void writeToStream(DataOutputStream out, int offset) throws IOException { + int index = getOperand(0); + if(index>3) { + if(wide) { + out.writeByte(opc_wide); + } + out.writeByte(opc_istore); + if(wide) { + out.writeShort(index); + } else { + out.writeByte(index); + } + } else { + out.writeByte(opcodes[index]); + } + } + + public int length() { + int index = getOperand(0); + if(index>3) { + return wide?4:2; + } else { + return 1; + } + } + +} diff --git a/src/org/jetbrains/java/decompiler/code/optinstructions/JSR.java b/src/org/jetbrains/java/decompiler/code/optinstructions/JSR.java new file mode 100644 index 0000000..ef6c2ad --- /dev/null +++ b/src/org/jetbrains/java/decompiler/code/optinstructions/JSR.java @@ -0,0 +1,44 @@ +/* + * Fernflower - The Analytical Java Decompiler + * http://www.reversed-java.com + * + * (C) 2008 - 2010, Stiver + * + * This software is NEITHER public domain NOR free software + * as per GNU License. See license.txt for more details. + * + * This software is distributed WITHOUT ANY WARRANTY; without + * even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. + */ + +package org.jetbrains.java.decompiler.code.optinstructions; + +import java.io.DataOutputStream; +import java.io.IOException; + +import org.jetbrains.java.decompiler.code.JumpInstruction; + +public class JSR extends JumpInstruction { + + public void writeToStream(DataOutputStream out, int offset) throws IOException { + int operand = getOperand(0); + if(operand < -32768 || operand > 32767) { + out.writeByte(opc_jsr_w); + out.writeInt(operand); + } else { + out.writeByte(opc_jsr); + out.writeShort(operand); + } + } + + public int length() { + int operand = getOperand(0); + if(operand < -32768 || operand > 32767) { + return 5; + } else { + return 3; + } + } + +} diff --git a/src/org/jetbrains/java/decompiler/code/optinstructions/JSR_W.java b/src/org/jetbrains/java/decompiler/code/optinstructions/JSR_W.java new file mode 100644 index 0000000..bc7ae59 --- /dev/null +++ b/src/org/jetbrains/java/decompiler/code/optinstructions/JSR_W.java @@ -0,0 +1,33 @@ +/* + * Fernflower - The Analytical Java Decompiler + * http://www.reversed-java.com + * + * (C) 2008 - 2010, Stiver + * + * This software is NEITHER public domain NOR free software + * as per GNU License. See license.txt for more details. + * + * This software is distributed WITHOUT ANY WARRANTY; without + * even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. + */ + +package org.jetbrains.java.decompiler.code.optinstructions; + +import java.io.DataOutputStream; +import java.io.IOException; + +import org.jetbrains.java.decompiler.code.JumpInstruction; + +public class JSR_W extends JumpInstruction { + + public void writeToStream(DataOutputStream out, int offset) throws IOException { + out.writeByte(opc_jsr_w); + out.writeInt(getOperand(0)); + } + + public int length() { + return 5; + } + +} diff --git a/src/org/jetbrains/java/decompiler/code/optinstructions/LDC.java b/src/org/jetbrains/java/decompiler/code/optinstructions/LDC.java new file mode 100644 index 0000000..4b1a715 --- /dev/null +++ b/src/org/jetbrains/java/decompiler/code/optinstructions/LDC.java @@ -0,0 +1,33 @@ +/* + * Fernflower - The Analytical Java Decompiler + * http://www.reversed-java.com + * + * (C) 2008 - 2010, Stiver + * + * This software is NEITHER public domain NOR free software + * as per GNU License. See license.txt for more details. + * + * This software is distributed WITHOUT ANY WARRANTY; without + * even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. + */ + +package org.jetbrains.java.decompiler.code.optinstructions; + +import java.io.DataOutputStream; +import java.io.IOException; + +import org.jetbrains.java.decompiler.code.Instruction; + +public class LDC extends Instruction { + + public void writeToStream(DataOutputStream out, int offset) throws IOException { + out.writeByte(opc_ldc); + out.writeByte(getOperand(0)); + } + + public int length() { + return 2; + } + +} diff --git a/src/org/jetbrains/java/decompiler/code/optinstructions/LDC2_W.java b/src/org/jetbrains/java/decompiler/code/optinstructions/LDC2_W.java new file mode 100644 index 0000000..4b7ea0b --- /dev/null +++ b/src/org/jetbrains/java/decompiler/code/optinstructions/LDC2_W.java @@ -0,0 +1,33 @@ +/* + * Fernflower - The Analytical Java Decompiler + * http://www.reversed-java.com + * + * (C) 2008 - 2010, Stiver + * + * This software is NEITHER public domain NOR free software + * as per GNU License. See license.txt for more details. + * + * This software is distributed WITHOUT ANY WARRANTY; without + * even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. + */ + +package org.jetbrains.java.decompiler.code.optinstructions; + +import java.io.DataOutputStream; +import java.io.IOException; + +import org.jetbrains.java.decompiler.code.Instruction; + +public class LDC2_W extends Instruction { + + public void writeToStream(DataOutputStream out, int offset) throws IOException { + out.writeByte(opc_ldc2_w); + out.writeShort(getOperand(0)); + } + + public int length() { + return 3; + } + +} diff --git a/src/org/jetbrains/java/decompiler/code/optinstructions/LDC_W.java b/src/org/jetbrains/java/decompiler/code/optinstructions/LDC_W.java new file mode 100644 index 0000000..6a4e3a6 --- /dev/null +++ b/src/org/jetbrains/java/decompiler/code/optinstructions/LDC_W.java @@ -0,0 +1,33 @@ +/* + * Fernflower - The Analytical Java Decompiler + * http://www.reversed-java.com + * + * (C) 2008 - 2010, Stiver + * + * This software is NEITHER public domain NOR free software + * as per GNU License. See license.txt for more details. + * + * This software is distributed WITHOUT ANY WARRANTY; without + * even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. + */ + +package org.jetbrains.java.decompiler.code.optinstructions; + +import java.io.DataOutputStream; +import java.io.IOException; + +import org.jetbrains.java.decompiler.code.Instruction; + +public class LDC_W extends Instruction { + + public void writeToStream(DataOutputStream out, int offset) throws IOException { + out.writeByte(opc_ldc_w); + out.writeShort(getOperand(0)); + } + + public int length() { + return 3; + } + +} diff --git a/src/org/jetbrains/java/decompiler/code/optinstructions/LLOAD.java b/src/org/jetbrains/java/decompiler/code/optinstructions/LLOAD.java new file mode 100644 index 0000000..52f2b5c --- /dev/null +++ b/src/org/jetbrains/java/decompiler/code/optinstructions/LLOAD.java @@ -0,0 +1,52 @@ +/* + * Fernflower - The Analytical Java Decompiler + * http://www.reversed-java.com + * + * (C) 2008 - 2010, Stiver + * + * This software is NEITHER public domain NOR free software + * as per GNU License. See license.txt for more details. + * + * This software is distributed WITHOUT ANY WARRANTY; without + * even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. + */ + +package org.jetbrains.java.decompiler.code.optinstructions; + +import java.io.DataOutputStream; +import java.io.IOException; + +import org.jetbrains.java.decompiler.code.Instruction; + +public class LLOAD extends Instruction { + + private static int[] opcodes = new int[] {opc_lload_0,opc_lload_1,opc_lload_2,opc_lload_3}; + + public void writeToStream(DataOutputStream out, int offset) throws IOException { + int index = getOperand(0); + if(index>3) { + if(wide) { + out.writeByte(opc_wide); + } + out.writeByte(opc_lload); + if(wide) { + out.writeShort(index); + } else { + out.writeByte(index); + } + } else { + out.writeByte(opcodes[index]); + } + } + + public int length() { + int index = getOperand(0); + if(index>3) { + return wide?4:2; + } else { + return 1; + } + } + +} diff --git a/src/org/jetbrains/java/decompiler/code/optinstructions/LOOKUPSWITCH.java b/src/org/jetbrains/java/decompiler/code/optinstructions/LOOKUPSWITCH.java new file mode 100644 index 0000000..1654622 --- /dev/null +++ b/src/org/jetbrains/java/decompiler/code/optinstructions/LOOKUPSWITCH.java @@ -0,0 +1,42 @@ +/* + * Fernflower - The Analytical Java Decompiler + * http://www.reversed-java.com + * + * (C) 2008 - 2010, Stiver + * + * This software is NEITHER public domain NOR free software + * as per GNU License. See license.txt for more details. + * + * This software is distributed WITHOUT ANY WARRANTY; without + * even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. + */ + +package org.jetbrains.java.decompiler.code.optinstructions; + +import java.io.DataOutputStream; +import java.io.IOException; + +import org.jetbrains.java.decompiler.code.SwitchInstruction; + +public class LOOKUPSWITCH extends SwitchInstruction { + + public void writeToStream(DataOutputStream out, int offset) throws IOException { + + out.writeByte(opc_lookupswitch); + + int padding = 3 - (offset%4); + for(int i=0;i3) { + if(wide) { + out.writeByte(opc_wide); + } + out.writeByte(opc_lstore); + if(wide) { + out.writeShort(index); + } else { + out.writeByte(index); + } + } else { + out.writeByte(opcodes[index]); + } + } + + public int length() { + int index = getOperand(0); + if(index>3) { + return wide?4:2; + } else { + return 1; + } + } + +} diff --git a/src/org/jetbrains/java/decompiler/code/optinstructions/MULTIANEWARRAY.java b/src/org/jetbrains/java/decompiler/code/optinstructions/MULTIANEWARRAY.java new file mode 100644 index 0000000..c7eb0b9 --- /dev/null +++ b/src/org/jetbrains/java/decompiler/code/optinstructions/MULTIANEWARRAY.java @@ -0,0 +1,34 @@ +/* + * Fernflower - The Analytical Java Decompiler + * http://www.reversed-java.com + * + * (C) 2008 - 2010, Stiver + * + * This software is NEITHER public domain NOR free software + * as per GNU License. See license.txt for more details. + * + * This software is distributed WITHOUT ANY WARRANTY; without + * even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. + */ + +package org.jetbrains.java.decompiler.code.optinstructions; + +import java.io.DataOutputStream; +import java.io.IOException; + +import org.jetbrains.java.decompiler.code.Instruction; + +public class MULTIANEWARRAY extends Instruction { + + public void writeToStream(DataOutputStream out, int offset) throws IOException { + out.writeByte(opc_multianewarray); + out.writeShort(getOperand(0)); + out.writeByte(getOperand(1)); + } + + public int length() { + return 4; + } + +} diff --git a/src/org/jetbrains/java/decompiler/code/optinstructions/NEW.java b/src/org/jetbrains/java/decompiler/code/optinstructions/NEW.java new file mode 100644 index 0000000..eafe17c --- /dev/null +++ b/src/org/jetbrains/java/decompiler/code/optinstructions/NEW.java @@ -0,0 +1,33 @@ +/* + * Fernflower - The Analytical Java Decompiler + * http://www.reversed-java.com + * + * (C) 2008 - 2010, Stiver + * + * This software is NEITHER public domain NOR free software + * as per GNU License. See license.txt for more details. + * + * This software is distributed WITHOUT ANY WARRANTY; without + * even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. + */ + +package org.jetbrains.java.decompiler.code.optinstructions; + +import java.io.DataOutputStream; +import java.io.IOException; + +import org.jetbrains.java.decompiler.code.Instruction; + +public class NEW extends Instruction { + + public void writeToStream(DataOutputStream out, int offset) throws IOException { + out.writeByte(opc_new); + out.writeShort(getOperand(0)); + } + + public int length() { + return 3; + } + +} diff --git a/src/org/jetbrains/java/decompiler/code/optinstructions/NEWARRAY.java b/src/org/jetbrains/java/decompiler/code/optinstructions/NEWARRAY.java new file mode 100644 index 0000000..8764a6f --- /dev/null +++ b/src/org/jetbrains/java/decompiler/code/optinstructions/NEWARRAY.java @@ -0,0 +1,33 @@ +/* + * Fernflower - The Analytical Java Decompiler + * http://www.reversed-java.com + * + * (C) 2008 - 2010, Stiver + * + * This software is NEITHER public domain NOR free software + * as per GNU License. See license.txt for more details. + * + * This software is distributed WITHOUT ANY WARRANTY; without + * even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. + */ + +package org.jetbrains.java.decompiler.code.optinstructions; + +import java.io.DataOutputStream; +import java.io.IOException; + +import org.jetbrains.java.decompiler.code.Instruction; + +public class NEWARRAY extends Instruction { + + public void writeToStream(DataOutputStream out, int offset) throws IOException { + out.writeByte(opc_newarray); + out.writeByte(getOperand(0)); + } + + public int length() { + return 2; + } + +} diff --git a/src/org/jetbrains/java/decompiler/code/optinstructions/PUTFIELD.java b/src/org/jetbrains/java/decompiler/code/optinstructions/PUTFIELD.java new file mode 100644 index 0000000..096da07 --- /dev/null +++ b/src/org/jetbrains/java/decompiler/code/optinstructions/PUTFIELD.java @@ -0,0 +1,33 @@ +/* + * Fernflower - The Analytical Java Decompiler + * http://www.reversed-java.com + * + * (C) 2008 - 2010, Stiver + * + * This software is NEITHER public domain NOR free software + * as per GNU License. See license.txt for more details. + * + * This software is distributed WITHOUT ANY WARRANTY; without + * even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. + */ + +package org.jetbrains.java.decompiler.code.optinstructions; + +import java.io.DataOutputStream; +import java.io.IOException; + +import org.jetbrains.java.decompiler.code.Instruction; + +public class PUTFIELD extends Instruction { + + public void writeToStream(DataOutputStream out, int offset) throws IOException { + out.writeByte(opc_putfield); + out.writeShort(getOperand(0)); + } + + public int length() { + return 3; + } + +} diff --git a/src/org/jetbrains/java/decompiler/code/optinstructions/PUTSTATIC.java b/src/org/jetbrains/java/decompiler/code/optinstructions/PUTSTATIC.java new file mode 100644 index 0000000..e543c88 --- /dev/null +++ b/src/org/jetbrains/java/decompiler/code/optinstructions/PUTSTATIC.java @@ -0,0 +1,33 @@ +/* + * Fernflower - The Analytical Java Decompiler + * http://www.reversed-java.com + * + * (C) 2008 - 2010, Stiver + * + * This software is NEITHER public domain NOR free software + * as per GNU License. See license.txt for more details. + * + * This software is distributed WITHOUT ANY WARRANTY; without + * even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. + */ + +package org.jetbrains.java.decompiler.code.optinstructions; + +import java.io.DataOutputStream; +import java.io.IOException; + +import org.jetbrains.java.decompiler.code.Instruction; + +public class PUTSTATIC extends Instruction { + + public void writeToStream(DataOutputStream out, int offset) throws IOException { + out.writeByte(opc_putstatic); + out.writeShort(getOperand(0)); + } + + public int length() { + return 3; + } + +} diff --git a/src/org/jetbrains/java/decompiler/code/optinstructions/RET.java b/src/org/jetbrains/java/decompiler/code/optinstructions/RET.java new file mode 100644 index 0000000..d52d2a2 --- /dev/null +++ b/src/org/jetbrains/java/decompiler/code/optinstructions/RET.java @@ -0,0 +1,40 @@ +/* + * Fernflower - The Analytical Java Decompiler + * http://www.reversed-java.com + * + * (C) 2008 - 2010, Stiver + * + * This software is NEITHER public domain NOR free software + * as per GNU License. See license.txt for more details. + * + * This software is distributed WITHOUT ANY WARRANTY; without + * even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. + */ + +package org.jetbrains.java.decompiler.code.optinstructions; + +import java.io.DataOutputStream; +import java.io.IOException; + +import org.jetbrains.java.decompiler.code.Instruction; + +public class RET extends Instruction { + + public void writeToStream(DataOutputStream out, int offset) throws IOException { + if(wide) { + out.writeByte(opc_wide); + } + out.writeByte(opc_ret); + if(wide) { + out.writeShort(getOperand(0)); + } else { + out.writeByte(getOperand(0)); + } + } + + public int length() { + return wide?4:2; + } + +} diff --git a/src/org/jetbrains/java/decompiler/code/optinstructions/SIPUSH.java b/src/org/jetbrains/java/decompiler/code/optinstructions/SIPUSH.java new file mode 100644 index 0000000..5bac32f --- /dev/null +++ b/src/org/jetbrains/java/decompiler/code/optinstructions/SIPUSH.java @@ -0,0 +1,33 @@ +/* + * Fernflower - The Analytical Java Decompiler + * http://www.reversed-java.com + * + * (C) 2008 - 2010, Stiver + * + * This software is NEITHER public domain NOR free software + * as per GNU License. See license.txt for more details. + * + * This software is distributed WITHOUT ANY WARRANTY; without + * even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. + */ + +package org.jetbrains.java.decompiler.code.optinstructions; + +import java.io.DataOutputStream; +import java.io.IOException; + +import org.jetbrains.java.decompiler.code.Instruction; + +public class SIPUSH extends Instruction { + + public void writeToStream(DataOutputStream out, int offset) throws IOException { + out.writeByte(opc_sipush); + out.writeShort(getOperand(0)); + } + + public int length() { + return 3; + } + +} diff --git a/src/org/jetbrains/java/decompiler/code/optinstructions/TABLESWITCH.java b/src/org/jetbrains/java/decompiler/code/optinstructions/TABLESWITCH.java new file mode 100644 index 0000000..ca2eae5 --- /dev/null +++ b/src/org/jetbrains/java/decompiler/code/optinstructions/TABLESWITCH.java @@ -0,0 +1,43 @@ +/* + * Fernflower - The Analytical Java Decompiler + * http://www.reversed-java.com + * + * (C) 2008 - 2010, Stiver + * + * This software is NEITHER public domain NOR free software + * as per GNU License. See license.txt for more details. + * + * This software is distributed WITHOUT ANY WARRANTY; without + * even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. + */ + +package org.jetbrains.java.decompiler.code.optinstructions; + +import java.io.DataOutputStream; +import java.io.IOException; + +import org.jetbrains.java.decompiler.code.SwitchInstruction; + +public class TABLESWITCH extends SwitchInstruction { + + public void writeToStream(DataOutputStream out, int offset) throws IOException { + + out.writeByte(opc_tableswitch); + + int padding = 3 - (offset%4); + for(int i=0;i