java-decompiler: post-import cleanup (formatting and copyright)

master
Roman Shevchenko 10 years ago
parent 663631f045
commit 076e4393f2
  1. 21
      src/org/jetbrains/java/decompiler/code/CodeConstants.java
  2. 77
      src/org/jetbrains/java/decompiler/code/ConstantsUtil.java
  3. 33
      src/org/jetbrains/java/decompiler/code/ExceptionHandler.java
  4. 37
      src/org/jetbrains/java/decompiler/code/ExceptionTable.java
  5. 22
      src/org/jetbrains/java/decompiler/code/FullInstructionSequence.java
  6. 20
      src/org/jetbrains/java/decompiler/code/IfInstruction.java
  7. 60
      src/org/jetbrains/java/decompiler/code/Instruction.java
  8. 94
      src/org/jetbrains/java/decompiler/code/InstructionSequence.java
  9. 23
      src/org/jetbrains/java/decompiler/code/JumpInstruction.java
  10. 24
      src/org/jetbrains/java/decompiler/code/SimpleInstructionSequence.java
  11. 44
      src/org/jetbrains/java/decompiler/code/SwitchInstruction.java
  12. 71
      src/org/jetbrains/java/decompiler/code/cfg/BasicBlock.java
  13. 344
      src/org/jetbrains/java/decompiler/code/cfg/ControlFlowGraph.java
  14. 57
      src/org/jetbrains/java/decompiler/code/cfg/ExceptionRangeCFG.java
  15. 15
      src/org/jetbrains/java/decompiler/code/instructions/AALOAD.java
  16. 15
      src/org/jetbrains/java/decompiler/code/instructions/AASTORE.java
  17. 15
      src/org/jetbrains/java/decompiler/code/instructions/ACONST_NULL.java
  18. 45
      src/org/jetbrains/java/decompiler/code/instructions/ALOAD.java
  19. 20
      src/org/jetbrains/java/decompiler/code/instructions/ANEWARRAY.java
  20. 15
      src/org/jetbrains/java/decompiler/code/instructions/ARETURN.java
  21. 15
      src/org/jetbrains/java/decompiler/code/instructions/ARRAYLENGTH.java
  22. 44
      src/org/jetbrains/java/decompiler/code/instructions/ASTORE.java
  23. 15
      src/org/jetbrains/java/decompiler/code/instructions/ATHROW.java
  24. 15
      src/org/jetbrains/java/decompiler/code/instructions/BALOAD.java
  25. 15
      src/org/jetbrains/java/decompiler/code/instructions/BASTORE.java
  26. 34
      src/org/jetbrains/java/decompiler/code/instructions/BIPUSH.java
  27. 15
      src/org/jetbrains/java/decompiler/code/instructions/CALOAD.java
  28. 15
      src/org/jetbrains/java/decompiler/code/instructions/CASTORE.java
  29. 20
      src/org/jetbrains/java/decompiler/code/instructions/CHECKCAST.java
  30. 15
      src/org/jetbrains/java/decompiler/code/instructions/D2F.java
  31. 15
      src/org/jetbrains/java/decompiler/code/instructions/D2I.java
  32. 15
      src/org/jetbrains/java/decompiler/code/instructions/D2L.java
  33. 15
      src/org/jetbrains/java/decompiler/code/instructions/DADD.java
  34. 15
      src/org/jetbrains/java/decompiler/code/instructions/DALOAD.java
  35. 15
      src/org/jetbrains/java/decompiler/code/instructions/DASTORE.java
  36. 15
      src/org/jetbrains/java/decompiler/code/instructions/DCMPG.java
  37. 15
      src/org/jetbrains/java/decompiler/code/instructions/DCMPL.java
  38. 15
      src/org/jetbrains/java/decompiler/code/instructions/DCONST_0.java
  39. 15
      src/org/jetbrains/java/decompiler/code/instructions/DCONST_1.java
  40. 15
      src/org/jetbrains/java/decompiler/code/instructions/DDIV.java
  41. 44
      src/org/jetbrains/java/decompiler/code/instructions/DLOAD.java
  42. 15
      src/org/jetbrains/java/decompiler/code/instructions/DMUL.java
  43. 15
      src/org/jetbrains/java/decompiler/code/instructions/DNEG.java
  44. 15
      src/org/jetbrains/java/decompiler/code/instructions/DREM.java
  45. 15
      src/org/jetbrains/java/decompiler/code/instructions/DRETURN.java
  46. 43
      src/org/jetbrains/java/decompiler/code/instructions/DSTORE.java
  47. 15
      src/org/jetbrains/java/decompiler/code/instructions/DSUB.java
  48. 15
      src/org/jetbrains/java/decompiler/code/instructions/DUP.java
  49. 15
      src/org/jetbrains/java/decompiler/code/instructions/DUP2.java
  50. 15
      src/org/jetbrains/java/decompiler/code/instructions/DUP2_X1.java
  51. 15
      src/org/jetbrains/java/decompiler/code/instructions/DUP2_X2.java
  52. 15
      src/org/jetbrains/java/decompiler/code/instructions/DUP_X1.java
  53. 15
      src/org/jetbrains/java/decompiler/code/instructions/DUP_X2.java
  54. 15
      src/org/jetbrains/java/decompiler/code/instructions/F2D.java
  55. 15
      src/org/jetbrains/java/decompiler/code/instructions/F2I.java
  56. 15
      src/org/jetbrains/java/decompiler/code/instructions/F2L.java
  57. 15
      src/org/jetbrains/java/decompiler/code/instructions/FADD.java
  58. 15
      src/org/jetbrains/java/decompiler/code/instructions/FALOAD.java
  59. 15
      src/org/jetbrains/java/decompiler/code/instructions/FASTORE.java
  60. 15
      src/org/jetbrains/java/decompiler/code/instructions/FCMPG.java
  61. 15
      src/org/jetbrains/java/decompiler/code/instructions/FCMPL.java
  62. 15
      src/org/jetbrains/java/decompiler/code/instructions/FCONST_0.java
  63. 15
      src/org/jetbrains/java/decompiler/code/instructions/FCONST_1.java
  64. 15
      src/org/jetbrains/java/decompiler/code/instructions/FCONST_2.java
  65. 15
      src/org/jetbrains/java/decompiler/code/instructions/FDIV.java
  66. 44
      src/org/jetbrains/java/decompiler/code/instructions/FLOAD.java
  67. 15
      src/org/jetbrains/java/decompiler/code/instructions/FMUL.java
  68. 15
      src/org/jetbrains/java/decompiler/code/instructions/FNEG.java
  69. 15
      src/org/jetbrains/java/decompiler/code/instructions/FREM.java
  70. 15
      src/org/jetbrains/java/decompiler/code/instructions/FRETURN.java
  71. 43
      src/org/jetbrains/java/decompiler/code/instructions/FSTORE.java
  72. 15
      src/org/jetbrains/java/decompiler/code/instructions/FSUB.java
  73. 19
      src/org/jetbrains/java/decompiler/code/instructions/GETFIELD.java
  74. 20
      src/org/jetbrains/java/decompiler/code/instructions/GETSTATIC.java
  75. 30
      src/org/jetbrains/java/decompiler/code/instructions/GOTO.java
  76. 20
      src/org/jetbrains/java/decompiler/code/instructions/GOTO_W.java
  77. 15
      src/org/jetbrains/java/decompiler/code/instructions/I2B.java
  78. 15
      src/org/jetbrains/java/decompiler/code/instructions/I2C.java
  79. 15
      src/org/jetbrains/java/decompiler/code/instructions/I2D.java
  80. 15
      src/org/jetbrains/java/decompiler/code/instructions/I2F.java
  81. 15
      src/org/jetbrains/java/decompiler/code/instructions/I2L.java
  82. 15
      src/org/jetbrains/java/decompiler/code/instructions/I2S.java
  83. 15
      src/org/jetbrains/java/decompiler/code/instructions/IADD.java
  84. 15
      src/org/jetbrains/java/decompiler/code/instructions/IALOAD.java
  85. 15
      src/org/jetbrains/java/decompiler/code/instructions/IAND.java
  86. 15
      src/org/jetbrains/java/decompiler/code/instructions/IASTORE.java
  87. 15
      src/org/jetbrains/java/decompiler/code/instructions/IDIV.java
  88. 20
      src/org/jetbrains/java/decompiler/code/instructions/IFEQ.java
  89. 20
      src/org/jetbrains/java/decompiler/code/instructions/IFGE.java
  90. 20
      src/org/jetbrains/java/decompiler/code/instructions/IFGT.java
  91. 20
      src/org/jetbrains/java/decompiler/code/instructions/IFLE.java
  92. 20
      src/org/jetbrains/java/decompiler/code/instructions/IFLT.java
  93. 20
      src/org/jetbrains/java/decompiler/code/instructions/IFNE.java
  94. 20
      src/org/jetbrains/java/decompiler/code/instructions/IFNONNULL.java
  95. 20
      src/org/jetbrains/java/decompiler/code/instructions/IFNULL.java
  96. 20
      src/org/jetbrains/java/decompiler/code/instructions/IF_ACMPEQ.java
  97. 20
      src/org/jetbrains/java/decompiler/code/instructions/IF_ACMPNE.java
  98. 20
      src/org/jetbrains/java/decompiler/code/instructions/IF_ICMPEQ.java
  99. 20
      src/org/jetbrains/java/decompiler/code/instructions/IF_ICMPGE.java
  100. 20
      src/org/jetbrains/java/decompiler/code/instructions/IF_ICMPGT.java
  101. Some files were not shown because too many files have changed in this diff Show More

@ -1,17 +1,18 @@
/* /*
* Fernflower - The Analytical Java Decompiler * Copyright 2000-2014 JetBrains s.r.o.
* http://www.reversed-java.com
* *
* (C) 2008 - 2010, Stiver * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* *
* This software is NEITHER public domain NOR free software * http://www.apache.org/licenses/LICENSE-2.0
* as per GNU License. See license.txt for more details.
* *
* This software is distributed WITHOUT ANY WARRANTY; without * Unless required by applicable law or agreed to in writing, software
* even the implied warranty of MERCHANTABILITY or FITNESS FOR * distributed under the License is distributed on an "AS IS" BASIS,
* A PARTICULAR PURPOSE. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/ */
package org.jetbrains.java.decompiler.code; package org.jetbrains.java.decompiler.code;
public interface CodeConstants { public interface CodeConstants {
@ -366,6 +367,4 @@ public interface CodeConstants {
public final static int opc_ifnonnull = 199; public final static int opc_ifnonnull = 199;
public final static int opc_goto_w = 200; public final static int opc_goto_w = 200;
public final static int opc_jsr_w = 201; public final static int opc_jsr_w = 201;
} }

@ -1,57 +1,21 @@
/* /*
* Fernflower - The Analytical Java Decompiler * Copyright 2000-2014 JetBrains s.r.o.
* http://www.reversed-java.com
* *
* (C) 2008 - 2010, Stiver * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* *
* This software is NEITHER public domain NOR free software * http://www.apache.org/licenses/LICENSE-2.0
* as per GNU License. See license.txt for more details.
* *
* This software is distributed WITHOUT ANY WARRANTY; without * Unless required by applicable law or agreed to in writing, software
* even the implied warranty of MERCHANTABILITY or FITNESS FOR * distributed under the License is distributed on an "AS IS" BASIS,
* A PARTICULAR PURPOSE. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/ */
package org.jetbrains.java.decompiler.code; package org.jetbrains.java.decompiler.code;
import org.jetbrains.java.decompiler.code.optinstructions.ALOAD; import org.jetbrains.java.decompiler.code.optinstructions.*;
import org.jetbrains.java.decompiler.code.optinstructions.ANEWARRAY;
import org.jetbrains.java.decompiler.code.optinstructions.ASTORE;
import org.jetbrains.java.decompiler.code.optinstructions.BIPUSH;
import org.jetbrains.java.decompiler.code.optinstructions.CHECKCAST;
import org.jetbrains.java.decompiler.code.optinstructions.DLOAD;
import org.jetbrains.java.decompiler.code.optinstructions.DSTORE;
import org.jetbrains.java.decompiler.code.optinstructions.FLOAD;
import org.jetbrains.java.decompiler.code.optinstructions.FSTORE;
import org.jetbrains.java.decompiler.code.optinstructions.GETFIELD;
import org.jetbrains.java.decompiler.code.optinstructions.GETSTATIC;
import org.jetbrains.java.decompiler.code.optinstructions.GOTO;
import org.jetbrains.java.decompiler.code.optinstructions.GOTO_W;
import org.jetbrains.java.decompiler.code.optinstructions.IINC;
import org.jetbrains.java.decompiler.code.optinstructions.ILOAD;
import org.jetbrains.java.decompiler.code.optinstructions.INSTANCEOF;
import org.jetbrains.java.decompiler.code.optinstructions.INVOKEDYNAMIC;
import org.jetbrains.java.decompiler.code.optinstructions.INVOKEINTERFACE;
import org.jetbrains.java.decompiler.code.optinstructions.INVOKESPECIAL;
import org.jetbrains.java.decompiler.code.optinstructions.INVOKESTATIC;
import org.jetbrains.java.decompiler.code.optinstructions.INVOKEVIRTUAL;
import org.jetbrains.java.decompiler.code.optinstructions.ISTORE;
import org.jetbrains.java.decompiler.code.optinstructions.JSR;
import org.jetbrains.java.decompiler.code.optinstructions.JSR_W;
import org.jetbrains.java.decompiler.code.optinstructions.LDC;
import org.jetbrains.java.decompiler.code.optinstructions.LDC2_W;
import org.jetbrains.java.decompiler.code.optinstructions.LDC_W;
import org.jetbrains.java.decompiler.code.optinstructions.LLOAD;
import org.jetbrains.java.decompiler.code.optinstructions.LOOKUPSWITCH;
import org.jetbrains.java.decompiler.code.optinstructions.LSTORE;
import org.jetbrains.java.decompiler.code.optinstructions.MULTIANEWARRAY;
import org.jetbrains.java.decompiler.code.optinstructions.NEW;
import org.jetbrains.java.decompiler.code.optinstructions.NEWARRAY;
import org.jetbrains.java.decompiler.code.optinstructions.PUTFIELD;
import org.jetbrains.java.decompiler.code.optinstructions.PUTSTATIC;
import org.jetbrains.java.decompiler.code.optinstructions.RET;
import org.jetbrains.java.decompiler.code.optinstructions.SIPUSH;
import org.jetbrains.java.decompiler.code.optinstructions.TABLESWITCH;
public class ConstantsUtil { public class ConstantsUtil {
@ -74,32 +38,34 @@ public class ConstantsUtil {
try { try {
Instruction instr; Instruction instr;
if((opcode >= CodeConstants.opc_ifeq && if ((opcode >= CodeConstants.opc_ifeq &&
opcode <= CodeConstants.opc_if_acmpne) || opcode <= CodeConstants.opc_if_acmpne) ||
opcode == CodeConstants.opc_ifnull || opcode == CodeConstants.opc_ifnull ||
opcode == CodeConstants.opc_ifnonnull) { opcode == CodeConstants.opc_ifnonnull) {
instr = new IfInstruction(); instr = new IfInstruction();
} else { }
else {
Class cl = opcodeClasses[opcode]; Class cl = opcodeClasses[opcode];
if(opcode == CodeConstants.opc_invokedynamic && bytecode_version < CodeConstants.BYTECODE_JAVA_7) { if (opcode == CodeConstants.opc_invokedynamic && bytecode_version < CodeConstants.BYTECODE_JAVA_7) {
cl = null; // instruction unused in Java 6 and before cl = null; // instruction unused in Java 6 and before
} }
if(cl == null) { if (cl == null) {
instr = new Instruction(); instr = new Instruction();
} else { }
else {
instr = (Instruction)cl.newInstance(); instr = (Instruction)cl.newInstance();
} }
} }
instr.opcode = opcode; instr.opcode = opcode;
return instr; return instr;
} catch (Exception ex) { }
catch (Exception ex) {
return null; return null;
} }
} }
@ -513,7 +479,4 @@ public class ConstantsUtil {
GOTO_W.class, // "goto_w", GOTO_W.class, // "goto_w",
JSR_W.class // "jsr_w" JSR_W.class // "jsr_w"
}; };
} }

@ -1,24 +1,25 @@
/* /*
* Fernflower - The Analytical Java Decompiler * Copyright 2000-2014 JetBrains s.r.o.
* http://www.reversed-java.com
* *
* (C) 2008 - 2010, Stiver * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* *
* This software is NEITHER public domain NOR free software * http://www.apache.org/licenses/LICENSE-2.0
* as per GNU License. See license.txt for more details.
* *
* This software is distributed WITHOUT ANY WARRANTY; without * Unless required by applicable law or agreed to in writing, software
* even the implied warranty of MERCHANTABILITY or FITNESS FOR * distributed under the License is distributed on an "AS IS" BASIS,
* A PARTICULAR PURPOSE. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/ */
package org.jetbrains.java.decompiler.code; package org.jetbrains.java.decompiler.code;
import org.jetbrains.java.decompiler.main.DecompilerContext;
import java.io.DataOutputStream; import java.io.DataOutputStream;
import java.io.IOException; import java.io.IOException;
import org.jetbrains.java.decompiler.main.DecompilerContext;
public class ExceptionHandler { public class ExceptionHandler {
public int from = 0; public int from = 0;
@ -32,7 +33,8 @@ public class ExceptionHandler {
public int class_index = 0; public int class_index = 0;
public String exceptionClass = null; public String exceptionClass = null;
public ExceptionHandler(){} public ExceptionHandler() {
}
public ExceptionHandler(int from_raw, int to_raw, int handler_raw, String exceptionClass) { public ExceptionHandler(int from_raw, int to_raw, int handler_raw, String exceptionClass) {
this.from = from_raw; this.from = from_raw;
@ -53,10 +55,9 @@ public class ExceptionHandler {
String new_line_separator = DecompilerContext.getNewLineSeparator(); String new_line_separator = DecompilerContext.getNewLineSeparator();
StringBuffer buf = new StringBuffer(); StringBuffer buf = new StringBuffer();
buf.append("from: "+from+" to: "+to+" handler: "+handler+new_line_separator); buf.append("from: " + from + " to: " + to + " handler: " + handler + new_line_separator);
buf.append("from_instr: "+from_instr+" to_instr: "+to_instr+" handler_instr: "+handler_instr+new_line_separator); buf.append("from_instr: " + from_instr + " to_instr: " + to_instr + " handler_instr: " + handler_instr + new_line_separator);
buf.append("exceptionClass: "+exceptionClass+new_line_separator); buf.append("exceptionClass: " + exceptionClass + new_line_separator);
return buf.toString(); return buf.toString();
} }
} }

@ -1,30 +1,32 @@
/* /*
* Fernflower - The Analytical Java Decompiler * Copyright 2000-2014 JetBrains s.r.o.
* http://www.reversed-java.com
* *
* (C) 2008 - 2010, Stiver * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* *
* This software is NEITHER public domain NOR free software * http://www.apache.org/licenses/LICENSE-2.0
* as per GNU License. See license.txt for more details.
* *
* This software is distributed WITHOUT ANY WARRANTY; without * Unless required by applicable law or agreed to in writing, software
* even the implied warranty of MERCHANTABILITY or FITNESS FOR * distributed under the License is distributed on an "AS IS" BASIS,
* A PARTICULAR PURPOSE. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/ */
package org.jetbrains.java.decompiler.code; package org.jetbrains.java.decompiler.code;
import java.util.ArrayList;
import java.util.List;
import org.jetbrains.java.decompiler.code.interpreter.Util; import org.jetbrains.java.decompiler.code.interpreter.Util;
import org.jetbrains.java.decompiler.struct.StructContext; import org.jetbrains.java.decompiler.struct.StructContext;
import java.util.ArrayList;
import java.util.List;
public class ExceptionTable { public class ExceptionTable {
private List<ExceptionHandler> handlers = new ArrayList<ExceptionHandler>(); private List<ExceptionHandler> handlers = new ArrayList<ExceptionHandler>();
public ExceptionTable() {} public ExceptionTable() {
}
public ExceptionTable(List<ExceptionHandler> handlers) { public ExceptionTable(List<ExceptionHandler> handlers) {
this.handlers = handlers; this.handlers = handlers;
@ -35,12 +37,12 @@ public class ExceptionTable {
ExceptionHandler res = null; // no handler found ExceptionHandler res = null; // no handler found
for(ExceptionHandler handler : handlers) { for (ExceptionHandler handler : handlers) {
if(handler.from<=line && handler.to>line) { if (handler.from <= line && handler.to > line) {
String name = handler.exceptionClass; String name = handler.exceptionClass;
if((withany && name==null) || // any -> finally or synchronized handler if ((withany && name == null) || // any -> finally or synchronized handler
(name!=null && Util.instanceOf(context, valclass, name))) { (name != null && Util.instanceOf(context, valclass, name))) {
res = handler; res = handler;
break; break;
} }
@ -53,5 +55,4 @@ public class ExceptionTable {
public List<ExceptionHandler> getHandlers() { public List<ExceptionHandler> getHandlers() {
return handlers; return handlers;
} }
} }

@ -1,17 +1,18 @@
/* /*
* Fernflower - The Analytical Java Decompiler * Copyright 2000-2014 JetBrains s.r.o.
* http://www.reversed-java.com
* *
* (C) 2008 - 2010, Stiver * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* *
* This software is NEITHER public domain NOR free software * http://www.apache.org/licenses/LICENSE-2.0
* as per GNU License. See license.txt for more details.
* *
* This software is distributed WITHOUT ANY WARRANTY; without * Unless required by applicable law or agreed to in writing, software
* even the implied warranty of MERCHANTABILITY or FITNESS FOR * distributed under the License is distributed on an "AS IS" BASIS,
* A PARTICULAR PURPOSE. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/ */
package org.jetbrains.java.decompiler.code; package org.jetbrains.java.decompiler.code;
import org.jetbrains.java.decompiler.util.VBStyleCollection; import org.jetbrains.java.decompiler.util.VBStyleCollection;
@ -28,11 +29,10 @@ public class FullInstructionSequence extends InstructionSequence {
this.exceptionTable = extable; this.exceptionTable = extable;
// translate raw exception handlers to instr // translate raw exception handlers to instr
for(ExceptionHandler handler : extable.getHandlers()) { for (ExceptionHandler handler : extable.getHandlers()) {
handler.from_instr = this.getPointerByAbsOffset(handler.from); handler.from_instr = this.getPointerByAbsOffset(handler.from);
handler.to_instr = this.getPointerByAbsOffset(handler.to); handler.to_instr = this.getPointerByAbsOffset(handler.to);
handler.handler_instr = this.getPointerByAbsOffset(handler.handler); handler.handler_instr = this.getPointerByAbsOffset(handler.handler);
} }
} }
} }

@ -1,17 +1,18 @@
/* /*
* Fernflower - The Analytical Java Decompiler * Copyright 2000-2014 JetBrains s.r.o.
* http://www.reversed-java.com
* *
* (C) 2008 - 2010, Stiver * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* *
* This software is NEITHER public domain NOR free software * http://www.apache.org/licenses/LICENSE-2.0
* as per GNU License. See license.txt for more details.
* *
* This software is distributed WITHOUT ANY WARRANTY; without * Unless required by applicable law or agreed to in writing, software
* even the implied warranty of MERCHANTABILITY or FITNESS FOR * distributed under the License is distributed on an "AS IS" BASIS,
* A PARTICULAR PURPOSE. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/ */
package org.jetbrains.java.decompiler.code; package org.jetbrains.java.decompiler.code;
import java.io.DataOutputStream; import java.io.DataOutputStream;
@ -32,5 +33,4 @@ public class IfInstruction extends JumpInstruction {
public int length() { public int length() {
return 3; return 3;
} }
} }

@ -1,17 +1,18 @@
/* /*
* Fernflower - The Analytical Java Decompiler * Copyright 2000-2014 JetBrains s.r.o.
* http://www.reversed-java.com
* *
* (C) 2008 - 2010, Stiver * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* *
* This software is NEITHER public domain NOR free software * http://www.apache.org/licenses/LICENSE-2.0
* as per GNU License. See license.txt for more details.
* *
* This software is distributed WITHOUT ANY WARRANTY; without * Unless required by applicable law or agreed to in writing, software
* even the implied warranty of MERCHANTABILITY or FITNESS FOR * distributed under the License is distributed on an "AS IS" BASIS,
* A PARTICULAR PURPOSE. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/ */
package org.jetbrains.java.decompiler.code; package org.jetbrains.java.decompiler.code;
import java.io.DataOutputStream; import java.io.DataOutputStream;
@ -41,14 +42,15 @@ public class Instruction implements CodeConstants {
// public methods // public methods
// ***************************************************************************** // *****************************************************************************
public Instruction() {} public Instruction() {
}
public int length() { public int length() {
return 1; return 1;
} }
public int operandsCount() { public int operandsCount() {
return (operands==null)?0:operands.length; return (operands == null) ? 0 : operands.length;
} }
public int getOperand(int index) { public int getOperand(int index) {
@ -56,43 +58,43 @@ public class Instruction implements CodeConstants {
} }
public Instruction clone() { public Instruction clone() {
return ConstantsUtil.getInstructionInstance(opcode, wide, group, bytecode_version, operands==null?null:(int[])operands.clone()); return ConstantsUtil.getInstructionInstance(opcode, wide, group, bytecode_version, operands == null ? null : (int[])operands.clone());
} }
public String toString() { public String toString() {
String res = wide?"@wide ":""; String res = wide ? "@wide " : "";
res+="@"+ConstantsUtil.getName(opcode); res += "@" + ConstantsUtil.getName(opcode);
int len = operandsCount(); int len = operandsCount();
for(int i=0;i<len;i++) { for (int i = 0; i < len; i++) {
int op = operands[i]; int op = operands[i];
if(op<0) { if (op < 0) {
res+=" -"+Integer.toHexString(-op); res += " -" + Integer.toHexString(-op);
} else { }
res+=" "+Integer.toHexString(op); else {
res += " " + Integer.toHexString(op);
} }
} }
return res; return res;
} }
public boolean canFallthrough() { public boolean canFallthrough() {
return opcode!=opc_goto && opcode!=opc_goto_w && opcode!=opc_ret && return opcode != opc_goto && opcode != opc_goto_w && opcode != opc_ret &&
!(opcode>=opc_ireturn && opcode<=opc_return) && opcode!=opc_athrow !(opcode >= opc_ireturn && opcode <= opc_return) && opcode != opc_athrow
&& opcode!=opc_jsr && opcode!=opc_tableswitch && opcode!=opc_lookupswitch; && opcode != opc_jsr && opcode != opc_tableswitch && opcode != opc_lookupswitch;
} }
public boolean equalsInstruction(Instruction instr) { public boolean equalsInstruction(Instruction instr) {
if(opcode != instr.opcode || wide != instr.wide if (opcode != instr.opcode || wide != instr.wide
|| operandsCount() != instr.operandsCount()) { || operandsCount() != instr.operandsCount()) {
return false; return false;
} }
if(operands != null) { if (operands != null) {
for(int i=0;i<operands.length;i++) { for (int i = 0; i < operands.length; i++) {
if(operands[i] != instr.getOperand(i)) { if (operands[i] != instr.getOperand(i)) {
return false; return false;
} }
} }
@ -102,7 +104,8 @@ public class Instruction implements CodeConstants {
} }
// should be overwritten by subclasses // should be overwritten by subclasses
public void initInstruction(InstructionSequence seq) {} public void initInstruction(InstructionSequence seq) {
}
// should be overwritten by subclasses // should be overwritten by subclasses
public void writeToStream(DataOutputStream out, int offset) throws IOException { public void writeToStream(DataOutputStream out, int offset) throws IOException {
@ -120,5 +123,4 @@ public class Instruction implements CodeConstants {
public void setOperands(int[] operands) { public void setOperands(int[] operands) {
this.operands = operands; this.operands = operands;
} }
} }

@ -1,31 +1,32 @@
/* /*
* Fernflower - The Analytical Java Decompiler * Copyright 2000-2014 JetBrains s.r.o.
* http://www.reversed-java.com
* *
* (C) 2008 - 2010, Stiver * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* *
* This software is NEITHER public domain NOR free software * http://www.apache.org/licenses/LICENSE-2.0
* as per GNU License. See license.txt for more details.
* *
* This software is distributed WITHOUT ANY WARRANTY; without * Unless required by applicable law or agreed to in writing, software
* even the implied warranty of MERCHANTABILITY or FITNESS FOR * distributed under the License is distributed on an "AS IS" BASIS,
* A PARTICULAR PURPOSE. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/ */
package org.jetbrains.java.decompiler.code; package org.jetbrains.java.decompiler.code;
import java.io.DataOutputStream;
import java.io.IOException;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
import org.jetbrains.java.decompiler.code.interpreter.Util; import org.jetbrains.java.decompiler.code.interpreter.Util;
import org.jetbrains.java.decompiler.main.DecompilerContext; import org.jetbrains.java.decompiler.main.DecompilerContext;
import org.jetbrains.java.decompiler.struct.StructContext; import org.jetbrains.java.decompiler.struct.StructContext;
import org.jetbrains.java.decompiler.util.InterpreterUtil; import org.jetbrains.java.decompiler.util.InterpreterUtil;
import org.jetbrains.java.decompiler.util.VBStyleCollection; import org.jetbrains.java.decompiler.util.VBStyleCollection;
import java.io.DataOutputStream;
import java.io.IOException;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
public abstract class InstructionSequence { public abstract class InstructionSequence {
@ -44,7 +45,9 @@ public abstract class InstructionSequence {
// ***************************************************************************** // *****************************************************************************
// to nbe overwritten // to nbe overwritten
public InstructionSequence clone() {return null;} public InstructionSequence clone() {
return null;
}
public void clear() { public void clear() {
collinstr.clear(); collinstr.clear();
@ -52,16 +55,16 @@ public abstract class InstructionSequence {
exceptionTable = new ExceptionTable(); exceptionTable = new ExceptionTable();
} }
public void addInstruction(Instruction inst, int offset){ public void addInstruction(Instruction inst, int offset) {
collinstr.addWithKey(inst, offset); collinstr.addWithKey(inst, offset);
} }
public void addInstruction(int index, Instruction inst, int offset){ public void addInstruction(int index, Instruction inst, int offset) {
collinstr.addWithKeyAndIndex(index, inst, offset); collinstr.addWithKeyAndIndex(index, inst, offset);
} }
public void addSequence(InstructionSequence seq){ public void addSequence(InstructionSequence seq) {
for(int i=0;i<seq.length();i++) { for (int i = 0; i < seq.length(); i++) {
addInstruction(seq.getInstr(i), -1); // TODO: any sensible value possible? addInstruction(seq.getInstr(i), -1); // TODO: any sensible value possible?
} }
} }
@ -92,25 +95,27 @@ public abstract class InstructionSequence {
public int getPointerByAbsOffset(int offset) { public int getPointerByAbsOffset(int offset) {
Integer absoffset = new Integer(offset); Integer absoffset = new Integer(offset);
if(collinstr.containsKey(absoffset)) { if (collinstr.containsKey(absoffset)) {
return collinstr.getIndexByKey(absoffset); return collinstr.getIndexByKey(absoffset);
} else { }
else {
return -1; return -1;
} }
} }
public int getPointerByRelOffset(int offset) { public int getPointerByRelOffset(int offset) {
Integer absoffset = new Integer(((Integer)collinstr.getKey(pointer)).intValue()+offset); Integer absoffset = new Integer(((Integer)collinstr.getKey(pointer)).intValue() + offset);
if(collinstr.containsKey(absoffset)) { if (collinstr.containsKey(absoffset)) {
return collinstr.getIndexByKey(absoffset); return collinstr.getIndexByKey(absoffset);
} else { }
else {
return -1; return -1;
} }
} }
public void setPointerByAbsOffset(int offset) { public void setPointerByAbsOffset(int offset) {
Integer absoffset = new Integer(((Integer)collinstr.getKey(pointer)).intValue()+offset); Integer absoffset = new Integer(((Integer)collinstr.getKey(pointer)).intValue() + offset);
if(collinstr.containsKey(absoffset)) { if (collinstr.containsKey(absoffset)) {
pointer = collinstr.getIndexByKey(absoffset); pointer = collinstr.getIndexByKey(absoffset);
} }
} }
@ -137,7 +142,7 @@ public abstract class InstructionSequence {
StringBuffer buf = new StringBuffer(); StringBuffer buf = new StringBuffer();
for(int i=0;i<collinstr.size();i++) { for (int i = 0; i < collinstr.size(); i++) {
buf.append(InterpreterUtil.getIndentString(indent)); buf.append(InterpreterUtil.getIndentString(indent));
buf.append(((Integer)collinstr.getKey(i)).intValue()); buf.append(((Integer)collinstr.getKey(i)).intValue());
buf.append(": "); buf.append(": ");
@ -150,7 +155,7 @@ public abstract class InstructionSequence {
public void writeCodeToStream(DataOutputStream out) throws IOException { public void writeCodeToStream(DataOutputStream out) throws IOException {
for(int i=0;i<collinstr.size();i++) { for (int i = 0; i < collinstr.size(); i++) {
((Instruction)collinstr.get(i)).writeToStream(out, ((Integer)collinstr.getKey(i)).intValue()); ((Instruction)collinstr.get(i)).writeToStream(out, ((Integer)collinstr.getKey(i)).intValue());
} }
} }
@ -160,7 +165,7 @@ public abstract class InstructionSequence {
List<ExceptionHandler> handlers = exceptionTable.getHandlers(); List<ExceptionHandler> handlers = exceptionTable.getHandlers();
out.writeShort(handlers.size()); out.writeShort(handlers.size());
for(int i=0;i<handlers.size();i++) { for (int i = 0; i < handlers.size(); i++) {
((ExceptionHandler)handlers.get(i)).writeToStream(out); ((ExceptionHandler)handlers.get(i)).writeToStream(out);
} }
} }
@ -171,28 +176,32 @@ public abstract class InstructionSequence {
public int compare(ExceptionHandler handler0, ExceptionHandler handler1) { public int compare(ExceptionHandler handler0, ExceptionHandler handler1) {
if(handler0.to == handler1.to) { if (handler0.to == handler1.to) {
if(handler0.exceptionClass == null) { if (handler0.exceptionClass == null) {
return 1; return 1;
} else { }
if(handler1.exceptionClass == null) { else {
if (handler1.exceptionClass == null) {
return -1; return -1;
} else if(handler0.exceptionClass.equals(handler1.exceptionClass)){ }
return (handler0.from > handler1.from)?-1:1; // invalid code else if (handler0.exceptionClass.equals(handler1.exceptionClass)) {
} else { return (handler0.from > handler1.from) ? -1 : 1; // invalid code
if(Util.instanceOf(context, handler0.exceptionClass, handler1.exceptionClass)) { }
else {
if (Util.instanceOf(context, handler0.exceptionClass, handler1.exceptionClass)) {
return -1; return -1;
} else { }
else {
return 1; return 1;
} }
} }
} }
} else { }
return (handler0.to > handler1.to)?1:-1; else {
return (handler0.to > handler1.to) ? 1 : -1;
} }
} }
}); });
} }
@ -215,5 +224,4 @@ public abstract class InstructionSequence {
public void setExceptionTable(ExceptionTable exceptionTable) { public void setExceptionTable(ExceptionTable exceptionTable) {
this.exceptionTable = exceptionTable; this.exceptionTable = exceptionTable;
} }
} }

@ -1,17 +1,18 @@
/* /*
* Fernflower - The Analytical Java Decompiler * Copyright 2000-2014 JetBrains s.r.o.
* http://www.reversed-java.com
* *
* (C) 2008 - 2010, Stiver * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* *
* This software is NEITHER public domain NOR free software * http://www.apache.org/licenses/LICENSE-2.0
* as per GNU License. See license.txt for more details.
* *
* This software is distributed WITHOUT ANY WARRANTY; without * Unless required by applicable law or agreed to in writing, software
* even the implied warranty of MERCHANTABILITY or FITNESS FOR * distributed under the License is distributed on an "AS IS" BASIS,
* A PARTICULAR PURPOSE. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/ */
package org.jetbrains.java.decompiler.code; package org.jetbrains.java.decompiler.code;
/* /*
@ -25,7 +26,8 @@ public class JumpInstruction extends Instruction {
public int destination; public int destination;
public JumpInstruction() {} public JumpInstruction() {
}
public void initInstruction(InstructionSequence seq) { public void initInstruction(InstructionSequence seq) {
destination = seq.getPointerByRelOffset(this.getOperand(0)); destination = seq.getPointerByRelOffset(this.getOperand(0));
@ -37,5 +39,4 @@ public class JumpInstruction extends Instruction {
newinstr.destination = destination; newinstr.destination = destination;
return newinstr; return newinstr;
} }
} }

@ -1,24 +1,26 @@
/* /*
* Fernflower - The Analytical Java Decompiler * Copyright 2000-2014 JetBrains s.r.o.
* http://www.reversed-java.com
* *
* (C) 2008 - 2010, Stiver * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* *
* This software is NEITHER public domain NOR free software * http://www.apache.org/licenses/LICENSE-2.0
* as per GNU License. See license.txt for more details.
* *
* This software is distributed WITHOUT ANY WARRANTY; without * Unless required by applicable law or agreed to in writing, software
* even the implied warranty of MERCHANTABILITY or FITNESS FOR * distributed under the License is distributed on an "AS IS" BASIS,
* A PARTICULAR PURPOSE. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/ */
package org.jetbrains.java.decompiler.code; package org.jetbrains.java.decompiler.code;
import org.jetbrains.java.decompiler.util.VBStyleCollection; import org.jetbrains.java.decompiler.util.VBStyleCollection;
public class SimpleInstructionSequence extends InstructionSequence { public class SimpleInstructionSequence extends InstructionSequence {
public SimpleInstructionSequence() {} public SimpleInstructionSequence() {
}
public SimpleInstructionSequence(VBStyleCollection<Instruction, Integer> collinstr) { public SimpleInstructionSequence(VBStyleCollection<Instruction, Integer> collinstr) {
this.collinstr = collinstr; this.collinstr = collinstr;
@ -34,6 +36,4 @@ public class SimpleInstructionSequence extends InstructionSequence {
public void removeInstruction(int index) { public void removeInstruction(int index) {
collinstr.remove(index); collinstr.remove(index);
} }
} }

@ -1,17 +1,18 @@
/* /*
* Fernflower - The Analytical Java Decompiler * Copyright 2000-2014 JetBrains s.r.o.
* http://www.reversed-java.com
* *
* (C) 2008 - 2010, Stiver * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* *
* This software is NEITHER public domain NOR free software * http://www.apache.org/licenses/LICENSE-2.0
* as per GNU License. See license.txt for more details.
* *
* This software is distributed WITHOUT ANY WARRANTY; without * Unless required by applicable law or agreed to in writing, software
* even the implied warranty of MERCHANTABILITY or FITNESS FOR * distributed under the License is distributed on an "AS IS" BASIS,
* A PARTICULAR PURPOSE. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/ */
package org.jetbrains.java.decompiler.code; package org.jetbrains.java.decompiler.code;
/* /*
@ -26,34 +27,37 @@ public class SwitchInstruction extends Instruction {
private int defaultdest; private int defaultdest;
public SwitchInstruction() {} public SwitchInstruction() {
}
public void initInstruction(InstructionSequence seq) { public void initInstruction(InstructionSequence seq) {
int pref = (opcode==CodeConstants.opc_tableswitch?3:2); int pref = (opcode == CodeConstants.opc_tableswitch ? 3 : 2);
int len = this.getOperands().length - pref; int len = this.getOperands().length - pref;
defaultdest = seq.getPointerByRelOffset(this.getOperand(0)); defaultdest = seq.getPointerByRelOffset(this.getOperand(0));
int low = 0; int low = 0;
if(opcode==CodeConstants.opc_lookupswitch) { if (opcode == CodeConstants.opc_lookupswitch) {
len/=2; len /= 2;
} else { }
else {
low = this.getOperand(1); low = this.getOperand(1);
} }
destinations = new int[len]; destinations = new int[len];
values = new int[len]; values = new int[len];
for(int i=0,k=0;i<len;i++,k++) { for (int i = 0, k = 0; i < len; i++, k++) {
if(opcode==CodeConstants.opc_lookupswitch){ if (opcode == CodeConstants.opc_lookupswitch) {
values[i] = this.getOperand(pref+k); values[i] = this.getOperand(pref + k);
k++; k++;
} else {
values[i] = low+k;
} }
destinations[i] = seq.getPointerByRelOffset(this.getOperand(pref+k)); else {
values[i] = low + k;
}
destinations[i] = seq.getPointerByRelOffset(this.getOperand(pref + k));
} }
} }

@ -1,28 +1,29 @@
/* /*
* Fernflower - The Analytical Java Decompiler * Copyright 2000-2014 JetBrains s.r.o.
* http://www.reversed-java.com
* *
* (C) 2008 - 2010, Stiver * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* *
* This software is NEITHER public domain NOR free software * http://www.apache.org/licenses/LICENSE-2.0
* as per GNU License. See license.txt for more details.
* *
* This software is distributed WITHOUT ANY WARRANTY; without * Unless required by applicable law or agreed to in writing, software
* even the implied warranty of MERCHANTABILITY or FITNESS FOR * distributed under the License is distributed on an "AS IS" BASIS,
* A PARTICULAR PURPOSE. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/ */
package org.jetbrains.java.decompiler.code.cfg; package org.jetbrains.java.decompiler.code.cfg;
import java.util.ArrayList;
import java.util.List;
import org.jetbrains.java.decompiler.code.Instruction; import org.jetbrains.java.decompiler.code.Instruction;
import org.jetbrains.java.decompiler.code.InstructionSequence; import org.jetbrains.java.decompiler.code.InstructionSequence;
import org.jetbrains.java.decompiler.code.SimpleInstructionSequence; import org.jetbrains.java.decompiler.code.SimpleInstructionSequence;
import org.jetbrains.java.decompiler.main.DecompilerContext; import org.jetbrains.java.decompiler.main.DecompilerContext;
import org.jetbrains.java.decompiler.modules.decompiler.decompose.IGraphNode; import org.jetbrains.java.decompiler.modules.decompiler.decompose.IGraphNode;
import java.util.ArrayList;
import java.util.List;
public class BasicBlock implements IGraphNode { public class BasicBlock implements IGraphNode {
// ***************************************************************************** // *****************************************************************************
@ -50,8 +51,8 @@ public class BasicBlock implements IGraphNode {
private List<BasicBlock> succExceptions = new ArrayList<BasicBlock>(); private List<BasicBlock> succExceptions = new ArrayList<BasicBlock>();
public BasicBlock() {
public BasicBlock() {} }
public BasicBlock(int id) { public BasicBlock(int id) {
this.id = id; this.id = id;
@ -84,9 +85,10 @@ public class BasicBlock implements IGraphNode {
} }
public Instruction getLastInstruction() { public Instruction getLastInstruction() {
if(seq.isEmpty()) { if (seq.isEmpty()) {
return null; return null;
} else { }
else {
return seq.getLastInstr(); return seq.getLastInstr();
} }
} }
@ -100,7 +102,7 @@ public class BasicBlock implements IGraphNode {
} }
public void removePredecessor(BasicBlock block) { public void removePredecessor(BasicBlock block) {
while(preds.remove(block)); while (preds.remove(block)) ;
} }
public void addSuccessor(BasicBlock block) { public void addSuccessor(BasicBlock block) {
@ -109,22 +111,22 @@ public class BasicBlock implements IGraphNode {
} }
public void removeSuccessor(BasicBlock block) { public void removeSuccessor(BasicBlock block) {
while(succs.remove(block)); while (succs.remove(block)) ;
block.removePredecessor(this); block.removePredecessor(this);
} }
// FIXME: unify block comparisons: id or direkt equality // FIXME: unify block comparisons: id or direkt equality
public void replaceSuccessor(BasicBlock oldBlock, BasicBlock newBlock) { public void replaceSuccessor(BasicBlock oldBlock, BasicBlock newBlock) {
for(int i=0;i<succs.size();i++) { for (int i = 0; i < succs.size(); i++) {
if(succs.get(i).id == oldBlock.id) { if (succs.get(i).id == oldBlock.id) {
succs.set(i, newBlock); succs.set(i, newBlock);
oldBlock.removePredecessor(this); oldBlock.removePredecessor(this);
newBlock.addPredecessor(this); newBlock.addPredecessor(this);
} }
} }
for(int i=0;i<succExceptions.size();i++) { for (int i = 0; i < succExceptions.size(); i++) {
if(succExceptions.get(i).id == oldBlock.id) { if (succExceptions.get(i).id == oldBlock.id) {
succExceptions.set(i, newBlock); succExceptions.set(i, newBlock);
oldBlock.removePredecessorException(this); oldBlock.removePredecessorException(this);
newBlock.addPredecessorException(this); newBlock.addPredecessorException(this);
@ -137,18 +139,18 @@ public class BasicBlock implements IGraphNode {
} }
public void removePredecessorException(BasicBlock block) { public void removePredecessorException(BasicBlock block) {
while(predExceptions.remove(block)); while (predExceptions.remove(block)) ;
} }
public void addSuccessorException(BasicBlock block) { public void addSuccessorException(BasicBlock block) {
if(!succExceptions.contains(block)) { if (!succExceptions.contains(block)) {
succExceptions.add(block); succExceptions.add(block);
block.addPredecessorException(this); block.addPredecessorException(this);
} }
} }
public void removeSuccessorException(BasicBlock block) { public void removeSuccessorException(BasicBlock block) {
while(succExceptions.remove(block)); while (succExceptions.remove(block)) ;
block.removePredecessorException(this); block.removePredecessorException(this);
} }
@ -160,7 +162,7 @@ public class BasicBlock implements IGraphNode {
String new_line_separator = DecompilerContext.getNewLineSeparator(); String new_line_separator = DecompilerContext.getNewLineSeparator();
return id+":" + new_line_separator +seq.toString(indent); return id + ":" + new_line_separator + seq.toString(indent);
} }
public String toStringOldIndices() { public String toStringOldIndices() {
@ -169,10 +171,11 @@ public class BasicBlock implements IGraphNode {
StringBuffer buf = new StringBuffer(); StringBuffer buf = new StringBuffer();
for(int i=0;i<seq.length();i++) { for (int i = 0; i < seq.length(); i++) {
if(i<instrOldOffsets.size()) { if (i < instrOldOffsets.size()) {
buf.append(instrOldOffsets.get(i)); buf.append(instrOldOffsets.get(i));
} else { }
else {
buf.append("-1"); buf.append("-1");
} }
buf.append(": "); buf.append(": ");
@ -184,8 +187,8 @@ public class BasicBlock implements IGraphNode {
} }
public boolean isSuccessor(BasicBlock block) { public boolean isSuccessor(BasicBlock block) {
for(BasicBlock succ : succs) { for (BasicBlock succ : succs) {
if(succ.id == block.id) { if (succ.id == block.id) {
return true; return true;
} }
} }
@ -193,8 +196,8 @@ public class BasicBlock implements IGraphNode {
} }
public boolean isPredecessor(BasicBlock block) { public boolean isPredecessor(BasicBlock block) {
for(int i=0;i<preds.size();i++) { for (int i = 0; i < preds.size(); i++) {
if(preds.get(i).id == block.id) { if (preds.get(i).id == block.id) {
return true; return true;
} }
} }
@ -260,6 +263,4 @@ public class BasicBlock implements IGraphNode {
public void setPredExceptions(List<BasicBlock> predExceptions) { public void setPredExceptions(List<BasicBlock> predExceptions) {
this.predExceptions = predExceptions; this.predExceptions = predExceptions;
} }
} }

@ -1,37 +1,21 @@
/* /*
* Fernflower - The Analytical Java Decompiler * Copyright 2000-2014 JetBrains s.r.o.
* http://www.reversed-java.com
* *
* (C) 2008 - 2010, Stiver * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* *
* This software is NEITHER public domain NOR free software * http://www.apache.org/licenses/LICENSE-2.0
* as per GNU License. See license.txt for more details.
* *
* This software is distributed WITHOUT ANY WARRANTY; without * Unless required by applicable law or agreed to in writing, software
* even the implied warranty of MERCHANTABILITY or FITNESS FOR * distributed under the License is distributed on an "AS IS" BASIS,
* A PARTICULAR PURPOSE. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/ */
package org.jetbrains.java.decompiler.code.cfg; package org.jetbrains.java.decompiler.code.cfg;
import java.util.ArrayList; import org.jetbrains.java.decompiler.code.*;
import java.util.Arrays;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
import org.jetbrains.java.decompiler.code.CodeConstants;
import org.jetbrains.java.decompiler.code.ExceptionHandler;
import org.jetbrains.java.decompiler.code.Instruction;
import org.jetbrains.java.decompiler.code.InstructionSequence;
import org.jetbrains.java.decompiler.code.JumpInstruction;
import org.jetbrains.java.decompiler.code.SimpleInstructionSequence;
import org.jetbrains.java.decompiler.code.SwitchInstruction;
import org.jetbrains.java.decompiler.code.interpreter.InstructionImpact; import org.jetbrains.java.decompiler.code.interpreter.InstructionImpact;
import org.jetbrains.java.decompiler.main.DecompilerContext; import org.jetbrains.java.decompiler.main.DecompilerContext;
import org.jetbrains.java.decompiler.modules.code.DeadCodeHelper; import org.jetbrains.java.decompiler.modules.code.DeadCodeHelper;
@ -42,6 +26,9 @@ import org.jetbrains.java.decompiler.struct.gen.VarType;
import org.jetbrains.java.decompiler.util.ListStack; import org.jetbrains.java.decompiler.util.ListStack;
import org.jetbrains.java.decompiler.util.VBStyleCollection; import org.jetbrains.java.decompiler.util.VBStyleCollection;
import java.util.*;
import java.util.Map.Entry;
public class ControlFlowGraph implements CodeConstants { public class ControlFlowGraph implements CodeConstants {
public int last_id = 0; public int last_id = 0;
@ -77,7 +64,7 @@ public class ControlFlowGraph implements CodeConstants {
public void free() { public void free() {
for(BasicBlock block: blocks) { for (BasicBlock block : blocks) {
block.free(); block.free();
} }
@ -89,7 +76,7 @@ public class ControlFlowGraph implements CodeConstants {
} }
public void removeMarkers() { public void removeMarkers() {
for(BasicBlock block: blocks) { for (BasicBlock block : blocks) {
block.mark = 0; block.mark = 0;
} }
} }
@ -100,39 +87,39 @@ public class ControlFlowGraph implements CodeConstants {
StringBuffer buf = new StringBuffer(); StringBuffer buf = new StringBuffer();
for(BasicBlock block: blocks) { for (BasicBlock block : blocks) {
buf.append("----- Block "+block.id+" -----" + new_line_separator); buf.append("----- Block " + block.id + " -----" + new_line_separator);
buf.append(block.toString()); buf.append(block.toString());
buf.append("----- Edges -----" + new_line_separator); buf.append("----- Edges -----" + new_line_separator);
List<BasicBlock> suc = block.getSuccs(); List<BasicBlock> suc = block.getSuccs();
for(int j=0;j<suc.size();j++) { for (int j = 0; j < suc.size(); j++) {
buf.append(">>>>>>>>(regular) Block "+((BasicBlock)suc.get(j)).id+new_line_separator); buf.append(">>>>>>>>(regular) Block " + ((BasicBlock)suc.get(j)).id + new_line_separator);
} }
suc = block.getSuccExceptions(); suc = block.getSuccExceptions();
for(int j=0;j<suc.size();j++) { for (int j = 0; j < suc.size(); j++) {
BasicBlock handler = (BasicBlock)suc.get(j); BasicBlock handler = (BasicBlock)suc.get(j);
ExceptionRangeCFG range = getExceptionRange(handler, block); ExceptionRangeCFG range = getExceptionRange(handler, block);
if(range == null) { if (range == null) {
buf.append(">>>>>>>>(exception) Block "+handler.id+"\t"+"ERROR: range not found!"+new_line_separator); buf.append(">>>>>>>>(exception) Block " + handler.id + "\t" + "ERROR: range not found!" + new_line_separator);
} else { }
else {
List<String> exceptionTypes = range.getExceptionTypes(); List<String> exceptionTypes = range.getExceptionTypes();
if(exceptionTypes == null) { if (exceptionTypes == null) {
buf.append(">>>>>>>>(exception) Block "+handler.id+"\t"+"NULL"+new_line_separator); buf.append(">>>>>>>>(exception) Block " + handler.id + "\t" + "NULL" + new_line_separator);
} else { }
for(String exceptionType : exceptionTypes) { else {
buf.append(">>>>>>>>(exception) Block "+handler.id+"\t"+exceptionType+new_line_separator); for (String exceptionType : exceptionTypes) {
buf.append(">>>>>>>>(exception) Block " + handler.id + "\t" + exceptionType + new_line_separator);
} }
} }
} }
} }
buf.append("----- ----- -----" + new_line_separator); buf.append("----- ----- -----" + new_line_separator);
} }
return buf.toString(); return buf.toString();
} }
public void inlineJsr(StructMethod mt) { public void inlineJsr(StructMethod mt) {
@ -146,19 +133,19 @@ public class ControlFlowGraph implements CodeConstants {
public void removeBlock(BasicBlock block) { public void removeBlock(BasicBlock block) {
while(block.getSuccs().size()>0) { while (block.getSuccs().size() > 0) {
block.removeSuccessor((BasicBlock)block.getSuccs().get(0)); block.removeSuccessor((BasicBlock)block.getSuccs().get(0));
} }
while(block.getSuccExceptions().size()>0) { while (block.getSuccExceptions().size() > 0) {
block.removeSuccessorException((BasicBlock)block.getSuccExceptions().get(0)); block.removeSuccessorException((BasicBlock)block.getSuccExceptions().get(0));
} }
while(block.getPreds().size()>0) { while (block.getPreds().size() > 0) {
((BasicBlock)block.getPreds().get(0)).removeSuccessor(block); ((BasicBlock)block.getPreds().get(0)).removeSuccessor(block);
} }
while(block.getPredExceptions().size()>0) { while (block.getPredExceptions().size() > 0) {
((BasicBlock)block.getPredExceptions().get(0)).removeSuccessorException(block); ((BasicBlock)block.getPredExceptions().get(0)).removeSuccessorException(block);
} }
@ -166,37 +153,37 @@ public class ControlFlowGraph implements CodeConstants {
blocks.removeWithKey(block.id); blocks.removeWithKey(block.id);
for(int i=exceptions.size()-1;i>=0;i--) { for (int i = exceptions.size() - 1; i >= 0; i--) {
ExceptionRangeCFG range = (ExceptionRangeCFG)exceptions.get(i); ExceptionRangeCFG range = (ExceptionRangeCFG)exceptions.get(i);
if(range.getHandler() == block) { if (range.getHandler() == block) {
exceptions.remove(i); exceptions.remove(i);
} else { }
else {
List<BasicBlock> lstRange = range.getProtectedRange(); List<BasicBlock> lstRange = range.getProtectedRange();
lstRange.remove(block); lstRange.remove(block);
if(lstRange.isEmpty()) { if (lstRange.isEmpty()) {
exceptions.remove(i); exceptions.remove(i);
} }
} }
} }
Iterator<Entry<BasicBlock, BasicBlock>> it = subroutines.entrySet().iterator(); Iterator<Entry<BasicBlock, BasicBlock>> it = subroutines.entrySet().iterator();
while(it.hasNext()) { while (it.hasNext()) {
Entry<BasicBlock, BasicBlock> ent = it.next(); Entry<BasicBlock, BasicBlock> ent = it.next();
if(ent.getKey() == block || ent.getValue() == block) { if (ent.getKey() == block || ent.getValue() == block) {
it.remove(); it.remove();
} }
} }
} }
public ExceptionRangeCFG getExceptionRange(BasicBlock handler, BasicBlock block) { public ExceptionRangeCFG getExceptionRange(BasicBlock handler, BasicBlock block) {
//List<ExceptionRangeCFG> ranges = new ArrayList<ExceptionRangeCFG>(); //List<ExceptionRangeCFG> ranges = new ArrayList<ExceptionRangeCFG>();
for(int i=exceptions.size()-1;i>=0;i--) { for (int i = exceptions.size() - 1; i >= 0; i--) {
ExceptionRangeCFG range = exceptions.get(i); ExceptionRangeCFG range = exceptions.get(i);
if(range.getHandler() == handler && range.getProtectedRange().contains(block)) { if (range.getHandler() == handler && range.getProtectedRange().contains(block)) {
return range; return range;
//ranges.add(range); //ranges.add(range);
} }
@ -206,26 +193,26 @@ public class ControlFlowGraph implements CodeConstants {
//return ranges.isEmpty() ? null : ranges; //return ranges.isEmpty() ? null : ranges;
} }
// public String getExceptionsUniqueString(BasicBlock handler, BasicBlock block) { // public String getExceptionsUniqueString(BasicBlock handler, BasicBlock block) {
// //
// List<ExceptionRangeCFG> ranges = getExceptionRange(handler, block); // List<ExceptionRangeCFG> ranges = getExceptionRange(handler, block);
// //
// if(ranges == null) { // if(ranges == null) {
// return null; // return null;
// } else { // } else {
// Set<String> setExceptionStrings = new HashSet<String>(); // Set<String> setExceptionStrings = new HashSet<String>();
// for(ExceptionRangeCFG range : ranges) { // for(ExceptionRangeCFG range : ranges) {
// setExceptionStrings.add(range.getExceptionType()); // setExceptionStrings.add(range.getExceptionType());
// } // }
// //
// String ret = ""; // String ret = "";
// for(String exception : setExceptionStrings) { // for(String exception : setExceptionStrings) {
// ret += exception; // ret += exception;
// } // }
// //
// return ret; // return ret;
// } // }
// } // }
// ***************************************************************************** // *****************************************************************************
@ -257,38 +244,38 @@ public class ControlFlowGraph implements CodeConstants {
HashSet<Integer> excSet = new HashSet<Integer>(); HashSet<Integer> excSet = new HashSet<Integer>();
for(ExceptionHandler handler : seq.getExceptionTable().getHandlers()) { for (ExceptionHandler handler : seq.getExceptionTable().getHandlers()) {
excSet.add(handler.from_instr); excSet.add(handler.from_instr);
excSet.add(handler.to_instr); excSet.add(handler.to_instr);
excSet.add(handler.handler_instr); excSet.add(handler.handler_instr);
} }
for(int i=0;i<len;i++) { for (int i = 0; i < len; i++) {
// exception blocks // exception blocks
if(excSet.contains(new Integer(i))) { if (excSet.contains(new Integer(i))) {
inststates[i] = 1; inststates[i] = 1;
} }
Instruction instr = seq.getInstr(i); Instruction instr = seq.getInstr(i);
switch(instr.group){ switch (instr.group) {
case GROUP_JUMP: case GROUP_JUMP:
inststates[((JumpInstruction)instr).destination] = 1; inststates[((JumpInstruction)instr).destination] = 1;
case GROUP_RETURN: case GROUP_RETURN:
if(i+1 < len) { if (i + 1 < len) {
inststates[i+1] = 1; inststates[i + 1] = 1;
} }
break; break;
case GROUP_SWITCH: case GROUP_SWITCH:
SwitchInstruction swinstr = (SwitchInstruction)instr; SwitchInstruction swinstr = (SwitchInstruction)instr;
int[] dests = swinstr.getDestinations(); int[] dests = swinstr.getDestinations();
for(int j=dests.length-1;j>=0;j--) { for (int j = dests.length - 1; j >= 0; j--) {
inststates[dests[j]] = 1; inststates[dests[j]] = 1;
} }
inststates[swinstr.getDefaultdest()] = 1; inststates[swinstr.getDefaultdest()] = 1;
if(i+1 < len) { if (i + 1 < len) {
inststates[i+1] = 1; inststates[i + 1] = 1;
} }
} }
} }
@ -313,7 +300,7 @@ public class ControlFlowGraph implements CodeConstants {
int blockoffset = 0; int blockoffset = 0;
BasicBlock currentBlock = null; BasicBlock currentBlock = null;
for(int i=0;i<len;i++) { for (int i = 0; i < len; i++) {
if (startblock[i] == 1) { if (startblock[i] == 1) {
currentBlock = new BasicBlock(); currentBlock = new BasicBlock();
@ -332,7 +319,7 @@ public class ControlFlowGraph implements CodeConstants {
startblock[i] = counter; startblock[i] = counter;
mapInstrBlocks.put(i, currentBlock); mapInstrBlocks.put(i, currentBlock);
currseq.addInstruction(instrseq.getInstr(i), instrseq.getOffset(i)-blockoffset); currseq.addInstruction(instrseq.getInstr(i), instrseq.getOffset(i) - blockoffset);
lstOffs.add(instrseq.getOffset(i)); lstOffs.add(instrseq.getOffset(i));
} }
@ -344,7 +331,7 @@ public class ControlFlowGraph implements CodeConstants {
private void connectBlocks(List<BasicBlock> lstbb, HashMap<Integer, BasicBlock> mapInstrBlocks) { private void connectBlocks(List<BasicBlock> lstbb, HashMap<Integer, BasicBlock> mapInstrBlocks) {
for(int i=0;i<lstbb.size();i++) { for (int i = 0; i < lstbb.size(); i++) {
BasicBlock block = lstbb.get(i); BasicBlock block = lstbb.get(i);
Instruction instr = block.getLastInstruction(); Instruction instr = block.getLastInstruction();
@ -352,7 +339,7 @@ public class ControlFlowGraph implements CodeConstants {
boolean fallthrough = instr.canFallthrough(); boolean fallthrough = instr.canFallthrough();
BasicBlock bTemp; BasicBlock bTemp;
switch(instr.group) { switch (instr.group) {
case GROUP_JUMP: case GROUP_JUMP:
int dest = ((JumpInstruction)instr).destination; int dest = ((JumpInstruction)instr).destination;
bTemp = mapInstrBlocks.get(dest); bTemp = mapInstrBlocks.get(dest);
@ -365,18 +352,17 @@ public class ControlFlowGraph implements CodeConstants {
bTemp = mapInstrBlocks.get(((SwitchInstruction)instr).getDefaultdest()); bTemp = mapInstrBlocks.get(((SwitchInstruction)instr).getDefaultdest());
block.addSuccessor(bTemp); block.addSuccessor(bTemp);
for(int j=0;j<dests.length;j++) { for (int j = 0; j < dests.length; j++) {
bTemp = mapInstrBlocks.get(dests[j]); bTemp = mapInstrBlocks.get(dests[j]);
block.addSuccessor(bTemp); block.addSuccessor(bTemp);
} }
} }
if(fallthrough && i<lstbb.size()-1) { if (fallthrough && i < lstbb.size() - 1) {
BasicBlock defaultBlock = lstbb.get(i+1); BasicBlock defaultBlock = lstbb.get(i + 1);
block.addSuccessor(defaultBlock); block.addSuccessor(defaultBlock);
} }
} }
} }
private void setExceptionEdges(InstructionSequence instrseq, HashMap<Integer, BasicBlock> instrBlocks) { private void setExceptionEdges(InstructionSequence instrseq, HashMap<Integer, BasicBlock> instrBlocks) {
@ -385,7 +371,7 @@ public class ControlFlowGraph implements CodeConstants {
Map<String, ExceptionRangeCFG> mapRanges = new HashMap<String, ExceptionRangeCFG>(); Map<String, ExceptionRangeCFG> mapRanges = new HashMap<String, ExceptionRangeCFG>();
for(ExceptionHandler handler : instrseq.getExceptionTable().getHandlers()) { for (ExceptionHandler handler : instrseq.getExceptionTable().getHandlers()) {
BasicBlock from = instrBlocks.get(handler.from_instr); BasicBlock from = instrBlocks.get(handler.from_instr);
BasicBlock to = instrBlocks.get(handler.to_instr); BasicBlock to = instrBlocks.get(handler.to_instr);
@ -393,19 +379,22 @@ public class ControlFlowGraph implements CodeConstants {
String key = from.id + ":" + to.id + ":" + handle.id; String key = from.id + ":" + to.id + ":" + handle.id;
if(mapRanges.containsKey(key)) { if (mapRanges.containsKey(key)) {
ExceptionRangeCFG range = mapRanges.get(key); ExceptionRangeCFG range = mapRanges.get(key);
range.addExceptionType(handler.exceptionClass); range.addExceptionType(handler.exceptionClass);
} else { }
else {
List<BasicBlock> protectedRange = new ArrayList<BasicBlock>(); List<BasicBlock> protectedRange = new ArrayList<BasicBlock>();
for(int j=from.id;j<to.id;j++) { for (int j = from.id; j < to.id; j++) {
BasicBlock block = blocks.getWithKey(j); BasicBlock block = blocks.getWithKey(j);
protectedRange.add(block); protectedRange.add(block);
block.addSuccessorException(handle); block.addSuccessorException(handle);
} }
ExceptionRangeCFG range = new ExceptionRangeCFG(protectedRange, handle, handler.exceptionClass == null ? null : Arrays.asList(new String[]{handler.exceptionClass})); ExceptionRangeCFG range = new ExceptionRangeCFG(protectedRange, handle, handler.exceptionClass == null
? null
: Arrays.asList(new String[]{handler.exceptionClass}));
mapRanges.put(key, range); mapRanges.put(key, range);
exceptions.add(range); exceptions.add(range);
@ -417,9 +406,9 @@ public class ControlFlowGraph implements CodeConstants {
final HashMap<BasicBlock, BasicBlock> subroutines = new HashMap<BasicBlock, BasicBlock>(); final HashMap<BasicBlock, BasicBlock> subroutines = new HashMap<BasicBlock, BasicBlock>();
for(BasicBlock block : blocks) { for (BasicBlock block : blocks) {
if(block.getSeq().getLastInstr().opcode == CodeConstants.opc_jsr) { if (block.getSeq().getLastInstr().opcode == CodeConstants.opc_jsr) {
LinkedList<BasicBlock> stack = new LinkedList<BasicBlock>(); LinkedList<BasicBlock> stack = new LinkedList<BasicBlock>();
LinkedList<LinkedList<BasicBlock>> stackJsrStacks = new LinkedList<LinkedList<BasicBlock>>(); LinkedList<LinkedList<BasicBlock>> stackJsrStacks = new LinkedList<LinkedList<BasicBlock>>();
@ -429,14 +418,14 @@ public class ControlFlowGraph implements CodeConstants {
stack.add(block); stack.add(block);
stackJsrStacks.add(new LinkedList<BasicBlock>()); stackJsrStacks.add(new LinkedList<BasicBlock>());
while(!stack.isEmpty()) { while (!stack.isEmpty()) {
BasicBlock node = stack.removeFirst(); BasicBlock node = stack.removeFirst();
LinkedList<BasicBlock> jsrstack = stackJsrStacks.removeFirst(); LinkedList<BasicBlock> jsrstack = stackJsrStacks.removeFirst();
setVisited.add(node); setVisited.add(node);
switch(node.getSeq().getLastInstr().opcode) { switch (node.getSeq().getLastInstr().opcode) {
case CodeConstants.opc_jsr: case CodeConstants.opc_jsr:
jsrstack.add(node); jsrstack.add(node);
break; break;
@ -444,20 +433,21 @@ public class ControlFlowGraph implements CodeConstants {
BasicBlock enter = jsrstack.getLast(); BasicBlock enter = jsrstack.getLast();
BasicBlock exit = blocks.getWithKey(enter.id + 1); // FIXME: find successor in a better way BasicBlock exit = blocks.getWithKey(enter.id + 1); // FIXME: find successor in a better way
if(exit!=null) { if (exit != null) {
if(!node.isSuccessor(exit)) { if (!node.isSuccessor(exit)) {
node.addSuccessor(exit); node.addSuccessor(exit);
} }
jsrstack.removeLast(); jsrstack.removeLast();
subroutines.put(enter, exit); subroutines.put(enter, exit);
} else { }
else {
throw new RuntimeException("ERROR: last instruction jsr"); throw new RuntimeException("ERROR: last instruction jsr");
} }
} }
if(!jsrstack.isEmpty()) { if (!jsrstack.isEmpty()) {
for(BasicBlock succ : node.getSuccs()) { for (BasicBlock succ : node.getSuccs()) {
if(!setVisited.contains(succ)) { if (!setVisited.contains(succ)) {
stack.add(succ); stack.add(succ);
stackJsrStacks.add(new LinkedList<BasicBlock>(jsrstack)); stackJsrStacks.add(new LinkedList<BasicBlock>(jsrstack));
} }
@ -472,7 +462,7 @@ public class ControlFlowGraph implements CodeConstants {
private void processJsr() { private void processJsr() {
while(processJsrRanges()!=0); while (processJsrRanges() != 0) ;
} }
private int processJsrRanges() { private int processJsrRanges() {
@ -480,7 +470,7 @@ public class ControlFlowGraph implements CodeConstants {
List<Object[]> lstJsrAll = new ArrayList<Object[]>(); List<Object[]> lstJsrAll = new ArrayList<Object[]>();
// get all jsr ranges // get all jsr ranges
for(Entry<BasicBlock, BasicBlock> ent : subroutines.entrySet()){ for (Entry<BasicBlock, BasicBlock> ent : subroutines.entrySet()) {
BasicBlock jsr = ent.getKey(); BasicBlock jsr = ent.getKey();
BasicBlock ret = ent.getValue(); BasicBlock ret = ent.getValue();
@ -490,12 +480,12 @@ public class ControlFlowGraph implements CodeConstants {
// sort ranges // sort ranges
// FIXME: better sort order // FIXME: better sort order
List<Object[]> lstJsr = new ArrayList<Object[]>(); List<Object[]> lstJsr = new ArrayList<Object[]>();
for(Object[] arr : lstJsrAll) { for (Object[] arr : lstJsrAll) {
int i=0; int i = 0;
for(;i<lstJsr.size();i++) { for (; i < lstJsr.size(); i++) {
Object[] arrJsr = lstJsr.get(i); Object[] arrJsr = lstJsr.get(i);
if(((HashSet<BasicBlock>)arrJsr[1]).contains(arr[0])) { if (((HashSet<BasicBlock>)arrJsr[1]).contains(arr[0])) {
break; break;
} }
} }
@ -504,19 +494,19 @@ public class ControlFlowGraph implements CodeConstants {
} }
// find the first intersection // find the first intersection
for(int i=0;i<lstJsr.size();i++) { for (int i = 0; i < lstJsr.size(); i++) {
Object[] arr = (Object[])lstJsr.get(i); Object[] arr = (Object[])lstJsr.get(i);
HashSet<BasicBlock> set = (HashSet<BasicBlock>)arr[1]; HashSet<BasicBlock> set = (HashSet<BasicBlock>)arr[1];
for(int j=i+1;j<lstJsr.size();j++) { for (int j = i + 1; j < lstJsr.size(); j++) {
Object[] arr1 = (Object[])lstJsr.get(j); Object[] arr1 = (Object[])lstJsr.get(j);
HashSet<BasicBlock> set1 = (HashSet<BasicBlock>)arr1[1]; HashSet<BasicBlock> set1 = (HashSet<BasicBlock>)arr1[1];
if(!set.contains(arr1[0]) && !set1.contains(arr[0])) { // rang 0 doesn't contain entry 1 and vice versa if (!set.contains(arr1[0]) && !set1.contains(arr[0])) { // rang 0 doesn't contain entry 1 and vice versa
HashSet<BasicBlock> setc = new HashSet<BasicBlock>(set); HashSet<BasicBlock> setc = new HashSet<BasicBlock>(set);
setc.retainAll(set1); setc.retainAll(set1);
if(!setc.isEmpty()) { if (!setc.isEmpty()) {
splitJsrRange((BasicBlock)arr[0], (BasicBlock)arr[2], setc); splitJsrRange((BasicBlock)arr[0], (BasicBlock)arr[2], setc);
return 1; return 1;
} }
@ -536,48 +526,49 @@ public class ControlFlowGraph implements CodeConstants {
BasicBlock dom = jsr.getSuccs().get(0); BasicBlock dom = jsr.getSuccs().get(0);
while(!lstNodes.isEmpty()) { while (!lstNodes.isEmpty()) {
BasicBlock node = lstNodes.remove(0); BasicBlock node = lstNodes.remove(0);
for(int j=0;j<2;j++) { for (int j = 0; j < 2; j++) {
List<BasicBlock> lst; List<BasicBlock> lst;
if(j==0) { if (j == 0) {
if(node.getLastInstruction().opcode == CodeConstants.opc_ret) { if (node.getLastInstruction().opcode == CodeConstants.opc_ret) {
if(node.getSuccs().contains(ret)) { if (node.getSuccs().contains(ret)) {
continue; continue;
} }
} }
lst = node.getSuccs(); lst = node.getSuccs();
} else { }
if(node == jsr) { else {
if (node == jsr) {
continue; continue;
} }
lst = node.getSuccExceptions(); lst = node.getSuccExceptions();
} }
CHILD: CHILD:
for(int i=lst.size()-1;i>=0;i--) { for (int i = lst.size() - 1; i >= 0; i--) {
BasicBlock child = lst.get(i); BasicBlock child = lst.get(i);
if(!blocks.contains(child)) { if (!blocks.contains(child)) {
if(node != jsr) { if (node != jsr) {
for(int k=0;k<child.getPreds().size();k++) { for (int k = 0; k < child.getPreds().size(); k++) {
if(!DeadCodeHelper.isDominator(this, child.getPreds().get(k), dom)) { if (!DeadCodeHelper.isDominator(this, child.getPreds().get(k), dom)) {
continue CHILD; continue CHILD;
} }
} }
for(int k=0;k<child.getPredExceptions().size();k++) { for (int k = 0; k < child.getPredExceptions().size(); k++) {
if(!DeadCodeHelper.isDominator(this, child.getPredExceptions().get(k), dom)) { if (!DeadCodeHelper.isDominator(this, child.getPredExceptions().get(k), dom)) {
continue CHILD; continue CHILD;
} }
} }
} }
// last block is a dummy one // last block is a dummy one
if(child!=last) { if (child != last) {
blocks.add(child); blocks.add(child);
} }
@ -598,69 +589,72 @@ public class ControlFlowGraph implements CodeConstants {
lstNodes.add(jsr); lstNodes.add(jsr);
mapNewNodes.put(jsr.id, jsr); mapNewNodes.put(jsr.id, jsr);
while(!lstNodes.isEmpty()) { while (!lstNodes.isEmpty()) {
BasicBlock node = lstNodes.remove(0); BasicBlock node = lstNodes.remove(0);
for(int j=0;j<2;j++) { for (int j = 0; j < 2; j++) {
List<BasicBlock> lst; List<BasicBlock> lst;
if(j==0) { if (j == 0) {
if(node.getLastInstruction().opcode == CodeConstants.opc_ret) { if (node.getLastInstruction().opcode == CodeConstants.opc_ret) {
if(node.getSuccs().contains(ret)) { if (node.getSuccs().contains(ret)) {
continue; continue;
} }
} }
lst = node.getSuccs(); lst = node.getSuccs();
} else { }
if(node == jsr) { else {
if (node == jsr) {
continue; continue;
} }
lst = node.getSuccExceptions(); lst = node.getSuccExceptions();
} }
for(int i=lst.size()-1;i>=0;i--) { for (int i = lst.size() - 1; i >= 0; i--) {
BasicBlock child = (BasicBlock)lst.get(i); BasicBlock child = (BasicBlock)lst.get(i);
Integer childid = child.id; Integer childid = child.id;
if(mapNewNodes.containsKey(childid)) { if (mapNewNodes.containsKey(childid)) {
node.replaceSuccessor(child, (BasicBlock)mapNewNodes.get(childid)); node.replaceSuccessor(child, (BasicBlock)mapNewNodes.get(childid));
} else if(common_blocks.contains(child)) { }
else if (common_blocks.contains(child)) {
// make a copy of the current block // make a copy of the current block
BasicBlock copy = (BasicBlock)child.clone(); BasicBlock copy = (BasicBlock)child.clone();
copy.id = ++last_id; copy.id = ++last_id;
// copy all successors // copy all successors
if(copy.getLastInstruction().opcode == CodeConstants.opc_ret && if (copy.getLastInstruction().opcode == CodeConstants.opc_ret &&
child.getSuccs().contains(ret)) { child.getSuccs().contains(ret)) {
copy.addSuccessor(ret); copy.addSuccessor(ret);
child.removeSuccessor(ret); child.removeSuccessor(ret);
} else { }
for(int k=0;k<child.getSuccs().size();k++) { else {
for (int k = 0; k < child.getSuccs().size(); k++) {
copy.addSuccessor((BasicBlock)child.getSuccs().get(k)); copy.addSuccessor((BasicBlock)child.getSuccs().get(k));
} }
} }
for(int k=0;k<child.getSuccExceptions().size();k++) { for (int k = 0; k < child.getSuccExceptions().size(); k++) {
copy.addSuccessorException((BasicBlock)child.getSuccExceptions().get(k)); copy.addSuccessorException((BasicBlock)child.getSuccExceptions().get(k));
} }
lstNodes.add(copy); lstNodes.add(copy);
mapNewNodes.put(childid, copy); mapNewNodes.put(childid, copy);
if(last.getPreds().contains(child)) { if (last.getPreds().contains(child)) {
last.addPredecessor(copy); last.addPredecessor(copy);
} }
node.replaceSuccessor(child, copy); node.replaceSuccessor(child, copy);
blocks.addWithKey(copy, copy.id); blocks.addWithKey(copy, copy.id);
} else { }
else {
// stop at the first fixed node // stop at the first fixed node
//lstNodes.add(child); //lstNodes.add(child);
mapNewNodes.put(childid, child); mapNewNodes.put(childid, child);
} }
} }
} }
} }
@ -670,7 +664,7 @@ public class ControlFlowGraph implements CodeConstants {
private void splitJsrExceptionRanges(HashSet<BasicBlock> common_blocks, HashMap<Integer, BasicBlock> mapNewNodes) { private void splitJsrExceptionRanges(HashSet<BasicBlock> common_blocks, HashMap<Integer, BasicBlock> mapNewNodes) {
for(int i=exceptions.size()-1;i>=0;i--) { for (int i = exceptions.size() - 1; i >= 0; i--) {
ExceptionRangeCFG range = (ExceptionRangeCFG)exceptions.get(i); ExceptionRangeCFG range = (ExceptionRangeCFG)exceptions.get(i);
List<BasicBlock> lstRange = range.getProtectedRange(); List<BasicBlock> lstRange = range.getProtectedRange();
@ -678,24 +672,24 @@ public class ControlFlowGraph implements CodeConstants {
HashSet<BasicBlock> setBoth = new HashSet<BasicBlock>(common_blocks); HashSet<BasicBlock> setBoth = new HashSet<BasicBlock>(common_blocks);
setBoth.retainAll(lstRange); setBoth.retainAll(lstRange);
if(setBoth.size()>0) { if (setBoth.size() > 0) {
List<BasicBlock> lstNewRange; List<BasicBlock> lstNewRange;
if(setBoth.size()==lstRange.size()) { if (setBoth.size() == lstRange.size()) {
lstNewRange = new ArrayList<BasicBlock>(); lstNewRange = new ArrayList<BasicBlock>();
ExceptionRangeCFG newRange = new ExceptionRangeCFG(lstNewRange, ExceptionRangeCFG newRange = new ExceptionRangeCFG(lstNewRange,
(BasicBlock)mapNewNodes.get(range.getHandler().id),range.getExceptionTypes()); (BasicBlock)mapNewNodes.get(range.getHandler().id), range.getExceptionTypes());
exceptions.add(newRange); exceptions.add(newRange);
} else { }
else {
lstNewRange = lstRange; lstNewRange = lstRange;
} }
for(BasicBlock block : setBoth) { for (BasicBlock block : setBoth) {
lstNewRange.add(mapNewNodes.get(block.id)); lstNewRange.add(mapNewNodes.get(block.id));
} }
} }
} }
} }
private void removeJsr(StructMethod mt) { private void removeJsr(StructMethod mt) {
@ -707,17 +701,17 @@ public class ControlFlowGraph implements CodeConstants {
ListStack<VarType> stack = data.getStack(); ListStack<VarType> stack = data.getStack();
InstructionSequence seq = block.getSeq(); InstructionSequence seq = block.getSeq();
for(int i=0;i<seq.length();i++) { for (int i = 0; i < seq.length(); i++) {
Instruction instr = seq.getInstr(i); Instruction instr = seq.getInstr(i);
VarType var = null; VarType var = null;
if(instr.opcode == CodeConstants.opc_astore || instr.opcode == CodeConstants.opc_pop) { if (instr.opcode == CodeConstants.opc_astore || instr.opcode == CodeConstants.opc_pop) {
var = stack.getByOffset(-1); var = stack.getByOffset(-1);
} }
InstructionImpact.stepTypes(data, instr, pool); InstructionImpact.stepTypes(data, instr, pool);
switch(instr.opcode) { switch (instr.opcode) {
case CodeConstants.opc_jsr: case CodeConstants.opc_jsr:
case CodeConstants.opc_ret: case CodeConstants.opc_ret:
seq.removeInstruction(i); seq.removeInstruction(i);
@ -725,26 +719,25 @@ public class ControlFlowGraph implements CodeConstants {
break; break;
case CodeConstants.opc_astore: case CodeConstants.opc_astore:
case CodeConstants.opc_pop: case CodeConstants.opc_pop:
if(var.type == CodeConstants.TYPE_ADDRESS) { if (var.type == CodeConstants.TYPE_ADDRESS) {
seq.removeInstruction(i); seq.removeInstruction(i);
i--; i--;
} }
} }
} }
block.mark = 1; block.mark = 1;
for(int i=0;i<block.getSuccs().size();i++) { for (int i = 0; i < block.getSuccs().size(); i++) {
BasicBlock suc = (BasicBlock)block.getSuccs().get(i); BasicBlock suc = (BasicBlock)block.getSuccs().get(i);
if(suc.mark != 1) { if (suc.mark != 1) {
removeJsrInstructions(pool, suc, data.copy()); removeJsrInstructions(pool, suc, data.copy());
} }
} }
for(int i=0;i<block.getSuccExceptions().size();i++) { for (int i = 0; i < block.getSuccExceptions().size(); i++) {
BasicBlock suc = (BasicBlock)block.getSuccExceptions().get(i); BasicBlock suc = (BasicBlock)block.getSuccExceptions().get(i);
if(suc.mark != 1) { if (suc.mark != 1) {
DataPoint point = new DataPoint(); DataPoint point = new DataPoint();
point.setLocalVariables(new ArrayList<VarType>(data.getLocalVariables())); point.setLocalVariables(new ArrayList<VarType>(data.getLocalVariables()));
@ -753,7 +746,6 @@ public class ControlFlowGraph implements CodeConstants {
removeJsrInstructions(pool, suc, point); removeJsrInstructions(pool, suc, point);
} }
} }
} }
private void setFirstAndLastBlocks() { private void setFirstAndLastBlocks() {
@ -764,8 +756,8 @@ public class ControlFlowGraph implements CodeConstants {
last.id = ++last_id; last.id = ++last_id;
last.setSeq(new SimpleInstructionSequence()); last.setSeq(new SimpleInstructionSequence());
for(BasicBlock block: blocks) { for (BasicBlock block : blocks) {
if(block.getSuccs().isEmpty()) { if (block.getSuccs().isEmpty()) {
last.addPredecessor(block); last.addPredecessor(block);
} }
} }
@ -789,7 +781,7 @@ public class ControlFlowGraph implements CodeConstants {
stackNode.add(root); stackNode.add(root);
stackIndex.add(0); stackIndex.add(0);
while(!stackNode.isEmpty()) { while (!stackNode.isEmpty()) {
BasicBlock node = stackNode.getLast(); BasicBlock node = stackNode.getLast();
int index = stackIndex.removeLast(); int index = stackIndex.removeLast();
@ -799,11 +791,11 @@ public class ControlFlowGraph implements CodeConstants {
List<BasicBlock> lstSuccs = new ArrayList<BasicBlock>(node.getSuccs()); List<BasicBlock> lstSuccs = new ArrayList<BasicBlock>(node.getSuccs());
lstSuccs.addAll(node.getSuccExceptions()); lstSuccs.addAll(node.getSuccExceptions());
for(;index<lstSuccs.size();index++) { for (; index < lstSuccs.size(); index++) {
BasicBlock succ = lstSuccs.get(index); BasicBlock succ = lstSuccs.get(index);
if(!setVisited.contains(succ)) { if (!setVisited.contains(succ)) {
stackIndex.add(index+1); stackIndex.add(index + 1);
stackNode.add(succ); stackNode.add(succ);
stackIndex.add(0); stackIndex.add(0);
@ -812,13 +804,12 @@ public class ControlFlowGraph implements CodeConstants {
} }
} }
if(index == lstSuccs.size()) { if (index == lstSuccs.size()) {
lst.add(0, node); lst.add(0, node);
stackNode.removeLast(); stackNode.removeLast();
} }
} }
} }
@ -883,5 +874,4 @@ public class ControlFlowGraph implements CodeConstants {
public void setFinallyExits(HashSet<BasicBlock> finallyExits) { public void setFinallyExits(HashSet<BasicBlock> finallyExits) {
this.finallyExits = finallyExits; this.finallyExits = finallyExits;
} }
} }

@ -1,26 +1,27 @@
/* /*
* Fernflower - The Analytical Java Decompiler * Copyright 2000-2014 JetBrains s.r.o.
* http://www.reversed-java.com
* *
* (C) 2008 - 2010, Stiver * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* *
* This software is NEITHER public domain NOR free software * http://www.apache.org/licenses/LICENSE-2.0
* as per GNU License. See license.txt for more details.
* *
* This software is distributed WITHOUT ANY WARRANTY; without * Unless required by applicable law or agreed to in writing, software
* even the implied warranty of MERCHANTABILITY or FITNESS FOR * distributed under the License is distributed on an "AS IS" BASIS,
* A PARTICULAR PURPOSE. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/ */
package org.jetbrains.java.decompiler.code.cfg; package org.jetbrains.java.decompiler.code.cfg;
import org.jetbrains.java.decompiler.main.DecompilerContext;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashSet; import java.util.HashSet;
import java.util.List; import java.util.List;
import java.util.Set; import java.util.Set;
import org.jetbrains.java.decompiler.main.DecompilerContext;
public class ExceptionRangeCFG { public class ExceptionRangeCFG {
private List<BasicBlock> protectedRange = new ArrayList<BasicBlock>(); // FIXME: replace with set private List<BasicBlock> protectedRange = new ArrayList<BasicBlock>(); // FIXME: replace with set
@ -33,7 +34,7 @@ public class ExceptionRangeCFG {
this.protectedRange = protectedRange; this.protectedRange = protectedRange;
this.handler = handler; this.handler = handler;
if(exceptionType != null) { if (exceptionType != null) {
this.exceptionTypes = new ArrayList<String>(exceptionType); this.exceptionTypes = new ArrayList<String>(exceptionType);
} }
} }
@ -49,15 +50,15 @@ public class ExceptionRangeCFG {
StringBuffer buf = new StringBuffer(); StringBuffer buf = new StringBuffer();
buf.append("exceptionType:"); buf.append("exceptionType:");
for(String exception_type : exceptionTypes) { for (String exception_type : exceptionTypes) {
buf.append(" "+exception_type); buf.append(" " + exception_type);
} }
buf.append(new_line_separator); buf.append(new_line_separator);
buf.append("handler: "+handler.id+new_line_separator); buf.append("handler: " + handler.id + new_line_separator);
buf.append("range: "); buf.append("range: ");
for(int i=0;i<protectedRange.size();i++) { for (int i = 0; i < protectedRange.size(); i++) {
buf.append(protectedRange.get(i).id+" "); buf.append(protectedRange.get(i).id + " ");
} }
buf.append(new_line_separator); buf.append(new_line_separator);
@ -86,32 +87,33 @@ public class ExceptionRangeCFG {
public void addExceptionType(String exceptionType) { public void addExceptionType(String exceptionType) {
if(this.exceptionTypes == null) { if (this.exceptionTypes == null) {
return; return;
} }
if(exceptionType == null) { if (exceptionType == null) {
this.exceptionTypes = null; this.exceptionTypes = null;
} else { }
else {
this.exceptionTypes.add(exceptionType); this.exceptionTypes.add(exceptionType);
} }
} }
public String getUniqueExceptionsString() { public String getUniqueExceptionsString() {
if(exceptionTypes == null) { if (exceptionTypes == null) {
return null; return null;
} }
Set<String> setExceptionStrings = new HashSet<String>(); Set<String> setExceptionStrings = new HashSet<String>();
for(String exceptionType : exceptionTypes) { // normalize order for (String exceptionType : exceptionTypes) { // normalize order
setExceptionStrings.add(exceptionType); setExceptionStrings.add(exceptionType);
} }
String ret = ""; String ret = "";
for(String exception : setExceptionStrings) { for (String exception : setExceptionStrings) {
if(!ret.isEmpty()) { if (!ret.isEmpty()) {
ret += ":"; ret += ":";
} }
ret += exception; ret += exception;
@ -121,8 +123,7 @@ public class ExceptionRangeCFG {
} }
// public void setExceptionType(String exceptionType) { // public void setExceptionType(String exceptionType) {
// this.exceptionType = exceptionType; // this.exceptionType = exceptionType;
// } // }
} }

@ -1,3 +1,18 @@
/*
* Copyright 2000-2014 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jetbrains.java.decompiler.code.instructions; package org.jetbrains.java.decompiler.code.instructions;
import org.jetbrains.java.decompiler.code.Instruction; import org.jetbrains.java.decompiler.code.Instruction;

@ -1,3 +1,18 @@
/*
* Copyright 2000-2014 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jetbrains.java.decompiler.code.instructions; package org.jetbrains.java.decompiler.code.instructions;
import org.jetbrains.java.decompiler.code.Instruction; import org.jetbrains.java.decompiler.code.Instruction;

@ -1,3 +1,18 @@
/*
* Copyright 2000-2014 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jetbrains.java.decompiler.code.instructions; package org.jetbrains.java.decompiler.code.instructions;
import org.jetbrains.java.decompiler.code.Instruction; import org.jetbrains.java.decompiler.code.Instruction;

@ -1,43 +1,60 @@
/*
* Copyright 2000-2014 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jetbrains.java.decompiler.code.instructions; package org.jetbrains.java.decompiler.code.instructions;
import org.jetbrains.java.decompiler.code.Instruction;
import java.io.DataOutputStream; import java.io.DataOutputStream;
import java.io.IOException; import java.io.IOException;
import org.jetbrains.java.decompiler.code.Instruction;
public class ALOAD extends Instruction { public class ALOAD extends Instruction {
private static int[] opcodes = new int[] {opc_aload_0,opc_aload_1,opc_aload_2,opc_aload_3}; 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 { public void writeToStream(DataOutputStream out, int offset) throws IOException {
int index = getOperand(0); int index = getOperand(0);
if(index>3) { if (index > 3) {
if(wide) { if (wide) {
out.writeByte(opc_wide); out.writeByte(opc_wide);
} }
out.writeByte(opc_aload); out.writeByte(opc_aload);
if(wide) { if (wide) {
out.writeShort(index); out.writeShort(index);
} else { }
else {
out.writeByte(index); out.writeByte(index);
} }
} else { }
else {
out.writeByte(opcodes[index]); out.writeByte(opcodes[index]);
} }
} }
public int length() { public int length() {
int index = getOperand(0); int index = getOperand(0);
if(index>3) { if (index > 3) {
if(wide) { if (wide) {
return 4; return 4;
} else { }
else {
return 2; return 2;
} }
} else { }
else {
return 1; return 1;
} }
} }
} }

@ -1,10 +1,25 @@
/*
* Copyright 2000-2014 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jetbrains.java.decompiler.code.instructions; package org.jetbrains.java.decompiler.code.instructions;
import org.jetbrains.java.decompiler.code.Instruction;
import java.io.DataOutputStream; import java.io.DataOutputStream;
import java.io.IOException; import java.io.IOException;
import org.jetbrains.java.decompiler.code.Instruction;
public class ANEWARRAY extends Instruction { public class ANEWARRAY extends Instruction {
public void writeToStream(DataOutputStream out, int offset) throws IOException { public void writeToStream(DataOutputStream out, int offset) throws IOException {
@ -15,5 +30,4 @@ public class ANEWARRAY extends Instruction {
public int length() { public int length() {
return 3; return 3;
} }
} }

@ -1,3 +1,18 @@
/*
* Copyright 2000-2014 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jetbrains.java.decompiler.code.instructions; package org.jetbrains.java.decompiler.code.instructions;
import org.jetbrains.java.decompiler.code.Instruction; import org.jetbrains.java.decompiler.code.Instruction;

@ -1,3 +1,18 @@
/*
* Copyright 2000-2014 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jetbrains.java.decompiler.code.instructions; package org.jetbrains.java.decompiler.code.instructions;
import org.jetbrains.java.decompiler.code.Instruction; import org.jetbrains.java.decompiler.code.Instruction;

@ -1,42 +1,60 @@
/*
* Copyright 2000-2014 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jetbrains.java.decompiler.code.instructions; package org.jetbrains.java.decompiler.code.instructions;
import org.jetbrains.java.decompiler.code.Instruction;
import java.io.DataOutputStream; import java.io.DataOutputStream;
import java.io.IOException; import java.io.IOException;
import org.jetbrains.java.decompiler.code.Instruction;
public class ASTORE extends Instruction { public class ASTORE extends Instruction {
private static int[] opcodes = new int[] {opc_astore_0,opc_astore_1,opc_astore_2,opc_astore_3}; 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 { public void writeToStream(DataOutputStream out, int offset) throws IOException {
int index = getOperand(0); int index = getOperand(0);
if(index>3) { if (index > 3) {
if(wide) { if (wide) {
out.writeByte(opc_wide); out.writeByte(opc_wide);
} }
out.writeByte(opc_astore); out.writeByte(opc_astore);
if(wide) { if (wide) {
out.writeShort(index); out.writeShort(index);
} else { }
else {
out.writeByte(index); out.writeByte(index);
} }
} else { }
else {
out.writeByte(opcodes[index]); out.writeByte(opcodes[index]);
} }
} }
public int length() { public int length() {
int index = getOperand(0); int index = getOperand(0);
if(index>3) { if (index > 3) {
if(wide) { if (wide) {
return 4; return 4;
} else { }
else {
return 2; return 2;
} }
} else { }
else {
return 1; return 1;
} }
} }
} }

@ -1,3 +1,18 @@
/*
* Copyright 2000-2014 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jetbrains.java.decompiler.code.instructions; package org.jetbrains.java.decompiler.code.instructions;
import org.jetbrains.java.decompiler.code.Instruction; import org.jetbrains.java.decompiler.code.Instruction;

@ -1,3 +1,18 @@
/*
* Copyright 2000-2014 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jetbrains.java.decompiler.code.instructions; package org.jetbrains.java.decompiler.code.instructions;
import org.jetbrains.java.decompiler.code.Instruction; import org.jetbrains.java.decompiler.code.Instruction;

@ -1,3 +1,18 @@
/*
* Copyright 2000-2014 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jetbrains.java.decompiler.code.instructions; package org.jetbrains.java.decompiler.code.instructions;
import org.jetbrains.java.decompiler.code.Instruction; import org.jetbrains.java.decompiler.code.Instruction;

@ -1,29 +1,47 @@
/*
* Copyright 2000-2014 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jetbrains.java.decompiler.code.instructions; package org.jetbrains.java.decompiler.code.instructions;
import org.jetbrains.java.decompiler.code.Instruction;
import java.io.DataOutputStream; import java.io.DataOutputStream;
import java.io.IOException; import java.io.IOException;
import org.jetbrains.java.decompiler.code.Instruction;
public class BIPUSH extends 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}; 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 { public void writeToStream(DataOutputStream out, int offset) throws IOException {
int value = getOperand(0); int value = getOperand(0);
if(value<-1 || value > 5) { if (value < -1 || value > 5) {
out.writeByte(opc_bipush); out.writeByte(opc_bipush);
out.writeByte(value); out.writeByte(value);
} else { }
out.writeByte(opcodes[value+1]); else {
out.writeByte(opcodes[value + 1]);
} }
} }
public int length() { public int length() {
int value = getOperand(0); int value = getOperand(0);
if(value<-1 || value > 5) { if (value < -1 || value > 5) {
return 2; return 2;
} else { }
else {
return 1; return 1;
} }
} }

@ -1,3 +1,18 @@
/*
* Copyright 2000-2014 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jetbrains.java.decompiler.code.instructions; package org.jetbrains.java.decompiler.code.instructions;
import org.jetbrains.java.decompiler.code.Instruction; import org.jetbrains.java.decompiler.code.Instruction;

@ -1,3 +1,18 @@
/*
* Copyright 2000-2014 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jetbrains.java.decompiler.code.instructions; package org.jetbrains.java.decompiler.code.instructions;
import org.jetbrains.java.decompiler.code.Instruction; import org.jetbrains.java.decompiler.code.Instruction;

@ -1,10 +1,25 @@
/*
* Copyright 2000-2014 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jetbrains.java.decompiler.code.instructions; package org.jetbrains.java.decompiler.code.instructions;
import org.jetbrains.java.decompiler.code.Instruction;
import java.io.DataOutputStream; import java.io.DataOutputStream;
import java.io.IOException; import java.io.IOException;
import org.jetbrains.java.decompiler.code.Instruction;
public class CHECKCAST extends Instruction { public class CHECKCAST extends Instruction {
public void writeToStream(DataOutputStream out, int offset) throws IOException { public void writeToStream(DataOutputStream out, int offset) throws IOException {
@ -15,6 +30,5 @@ public class CHECKCAST extends Instruction {
public int length() { public int length() {
return 3; return 3;
} }
} }

@ -1,3 +1,18 @@
/*
* Copyright 2000-2014 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jetbrains.java.decompiler.code.instructions; package org.jetbrains.java.decompiler.code.instructions;
import org.jetbrains.java.decompiler.code.Instruction; import org.jetbrains.java.decompiler.code.Instruction;

@ -1,3 +1,18 @@
/*
* Copyright 2000-2014 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jetbrains.java.decompiler.code.instructions; package org.jetbrains.java.decompiler.code.instructions;
import org.jetbrains.java.decompiler.code.Instruction; import org.jetbrains.java.decompiler.code.Instruction;

@ -1,3 +1,18 @@
/*
* Copyright 2000-2014 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jetbrains.java.decompiler.code.instructions; package org.jetbrains.java.decompiler.code.instructions;
import org.jetbrains.java.decompiler.code.Instruction; import org.jetbrains.java.decompiler.code.Instruction;

@ -1,3 +1,18 @@
/*
* Copyright 2000-2014 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jetbrains.java.decompiler.code.instructions; package org.jetbrains.java.decompiler.code.instructions;
import org.jetbrains.java.decompiler.code.Instruction; import org.jetbrains.java.decompiler.code.Instruction;

@ -1,3 +1,18 @@
/*
* Copyright 2000-2014 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jetbrains.java.decompiler.code.instructions; package org.jetbrains.java.decompiler.code.instructions;
import org.jetbrains.java.decompiler.code.Instruction; import org.jetbrains.java.decompiler.code.Instruction;

@ -1,3 +1,18 @@
/*
* Copyright 2000-2014 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jetbrains.java.decompiler.code.instructions; package org.jetbrains.java.decompiler.code.instructions;
import org.jetbrains.java.decompiler.code.Instruction; import org.jetbrains.java.decompiler.code.Instruction;

@ -1,3 +1,18 @@
/*
* Copyright 2000-2014 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jetbrains.java.decompiler.code.instructions; package org.jetbrains.java.decompiler.code.instructions;
import org.jetbrains.java.decompiler.code.Instruction; import org.jetbrains.java.decompiler.code.Instruction;

@ -1,3 +1,18 @@
/*
* Copyright 2000-2014 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jetbrains.java.decompiler.code.instructions; package org.jetbrains.java.decompiler.code.instructions;
import org.jetbrains.java.decompiler.code.Instruction; import org.jetbrains.java.decompiler.code.Instruction;

@ -1,3 +1,18 @@
/*
* Copyright 2000-2014 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jetbrains.java.decompiler.code.instructions; package org.jetbrains.java.decompiler.code.instructions;
import org.jetbrains.java.decompiler.code.Instruction; import org.jetbrains.java.decompiler.code.Instruction;

@ -1,3 +1,18 @@
/*
* Copyright 2000-2014 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jetbrains.java.decompiler.code.instructions; package org.jetbrains.java.decompiler.code.instructions;
import org.jetbrains.java.decompiler.code.Instruction; import org.jetbrains.java.decompiler.code.Instruction;

@ -1,3 +1,18 @@
/*
* Copyright 2000-2014 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jetbrains.java.decompiler.code.instructions; package org.jetbrains.java.decompiler.code.instructions;
import org.jetbrains.java.decompiler.code.Instruction; import org.jetbrains.java.decompiler.code.Instruction;

@ -1,42 +1,60 @@
/*
* Copyright 2000-2014 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jetbrains.java.decompiler.code.instructions; package org.jetbrains.java.decompiler.code.instructions;
import org.jetbrains.java.decompiler.code.Instruction;
import java.io.DataOutputStream; import java.io.DataOutputStream;
import java.io.IOException; import java.io.IOException;
import org.jetbrains.java.decompiler.code.Instruction;
public class DLOAD extends Instruction { public class DLOAD extends Instruction {
private static int[] opcodes = new int[] {opc_dload_0,opc_dload_1,opc_dload_2,opc_dload_3}; 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 { public void writeToStream(DataOutputStream out, int offset) throws IOException {
int index = getOperand(0); int index = getOperand(0);
if(index>3) { if (index > 3) {
if(wide) { if (wide) {
out.writeByte(opc_wide); out.writeByte(opc_wide);
} }
out.writeByte(opc_dload); out.writeByte(opc_dload);
if(wide) { if (wide) {
out.writeShort(index); out.writeShort(index);
} else { }
else {
out.writeByte(index); out.writeByte(index);
} }
} else { }
else {
out.writeByte(opcodes[index]); out.writeByte(opcodes[index]);
} }
} }
public int length() { public int length() {
int index = getOperand(0); int index = getOperand(0);
if(index>3) { if (index > 3) {
if(wide) { if (wide) {
return 4; return 4;
} else { }
else {
return 2; return 2;
} }
} else { }
else {
return 1; return 1;
} }
} }
} }

@ -1,3 +1,18 @@
/*
* Copyright 2000-2014 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jetbrains.java.decompiler.code.instructions; package org.jetbrains.java.decompiler.code.instructions;
import org.jetbrains.java.decompiler.code.Instruction; import org.jetbrains.java.decompiler.code.Instruction;

@ -1,3 +1,18 @@
/*
* Copyright 2000-2014 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jetbrains.java.decompiler.code.instructions; package org.jetbrains.java.decompiler.code.instructions;
import org.jetbrains.java.decompiler.code.Instruction; import org.jetbrains.java.decompiler.code.Instruction;

@ -1,3 +1,18 @@
/*
* Copyright 2000-2014 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jetbrains.java.decompiler.code.instructions; package org.jetbrains.java.decompiler.code.instructions;
import org.jetbrains.java.decompiler.code.Instruction; import org.jetbrains.java.decompiler.code.Instruction;

@ -1,3 +1,18 @@
/*
* Copyright 2000-2014 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jetbrains.java.decompiler.code.instructions; package org.jetbrains.java.decompiler.code.instructions;
import org.jetbrains.java.decompiler.code.Instruction; import org.jetbrains.java.decompiler.code.Instruction;

@ -1,40 +1,59 @@
/*
* Copyright 2000-2014 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jetbrains.java.decompiler.code.instructions; package org.jetbrains.java.decompiler.code.instructions;
import org.jetbrains.java.decompiler.code.Instruction;
import java.io.DataOutputStream; import java.io.DataOutputStream;
import java.io.IOException; import java.io.IOException;
import org.jetbrains.java.decompiler.code.Instruction;
public class DSTORE extends Instruction { public class DSTORE extends Instruction {
private static int[] opcodes = new int[] {opc_dstore_0,opc_dstore_1,opc_dstore_2,opc_dstore_3}; 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 { public void writeToStream(DataOutputStream out, int offset) throws IOException {
int index = getOperand(0); int index = getOperand(0);
if(index>3) { if (index > 3) {
if(wide) { if (wide) {
out.writeByte(opc_wide); out.writeByte(opc_wide);
} }
out.writeByte(opc_dstore); out.writeByte(opc_dstore);
if(wide) { if (wide) {
out.writeShort(index); out.writeShort(index);
} else { }
else {
out.writeByte(index); out.writeByte(index);
} }
} else { }
else {
out.writeByte(opcodes[index]); out.writeByte(opcodes[index]);
} }
} }
public int length() { public int length() {
int index = getOperand(0); int index = getOperand(0);
if(index>3) { if (index > 3) {
if(wide) { if (wide) {
return 4; return 4;
} else { }
else {
return 2; return 2;
} }
} else { }
else {
return 1; return 1;
} }
} }

@ -1,3 +1,18 @@
/*
* Copyright 2000-2014 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jetbrains.java.decompiler.code.instructions; package org.jetbrains.java.decompiler.code.instructions;
import org.jetbrains.java.decompiler.code.Instruction; import org.jetbrains.java.decompiler.code.Instruction;

@ -1,3 +1,18 @@
/*
* Copyright 2000-2014 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jetbrains.java.decompiler.code.instructions; package org.jetbrains.java.decompiler.code.instructions;
import org.jetbrains.java.decompiler.code.Instruction; import org.jetbrains.java.decompiler.code.Instruction;

@ -1,3 +1,18 @@
/*
* Copyright 2000-2014 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jetbrains.java.decompiler.code.instructions; package org.jetbrains.java.decompiler.code.instructions;
import org.jetbrains.java.decompiler.code.Instruction; import org.jetbrains.java.decompiler.code.Instruction;

@ -1,3 +1,18 @@
/*
* Copyright 2000-2014 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jetbrains.java.decompiler.code.instructions; package org.jetbrains.java.decompiler.code.instructions;
import org.jetbrains.java.decompiler.code.Instruction; import org.jetbrains.java.decompiler.code.Instruction;

@ -1,3 +1,18 @@
/*
* Copyright 2000-2014 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jetbrains.java.decompiler.code.instructions; package org.jetbrains.java.decompiler.code.instructions;
import org.jetbrains.java.decompiler.code.Instruction; import org.jetbrains.java.decompiler.code.Instruction;

@ -1,3 +1,18 @@
/*
* Copyright 2000-2014 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jetbrains.java.decompiler.code.instructions; package org.jetbrains.java.decompiler.code.instructions;
import org.jetbrains.java.decompiler.code.Instruction; import org.jetbrains.java.decompiler.code.Instruction;

@ -1,3 +1,18 @@
/*
* Copyright 2000-2014 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jetbrains.java.decompiler.code.instructions; package org.jetbrains.java.decompiler.code.instructions;
import org.jetbrains.java.decompiler.code.Instruction; import org.jetbrains.java.decompiler.code.Instruction;

@ -1,3 +1,18 @@
/*
* Copyright 2000-2014 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jetbrains.java.decompiler.code.instructions; package org.jetbrains.java.decompiler.code.instructions;
import org.jetbrains.java.decompiler.code.Instruction; import org.jetbrains.java.decompiler.code.Instruction;

@ -1,3 +1,18 @@
/*
* Copyright 2000-2014 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jetbrains.java.decompiler.code.instructions; package org.jetbrains.java.decompiler.code.instructions;
import org.jetbrains.java.decompiler.code.Instruction; import org.jetbrains.java.decompiler.code.Instruction;

@ -1,3 +1,18 @@
/*
* Copyright 2000-2014 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jetbrains.java.decompiler.code.instructions; package org.jetbrains.java.decompiler.code.instructions;
import org.jetbrains.java.decompiler.code.Instruction; import org.jetbrains.java.decompiler.code.Instruction;

@ -1,3 +1,18 @@
/*
* Copyright 2000-2014 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jetbrains.java.decompiler.code.instructions; package org.jetbrains.java.decompiler.code.instructions;
import org.jetbrains.java.decompiler.code.Instruction; import org.jetbrains.java.decompiler.code.Instruction;

@ -1,3 +1,18 @@
/*
* Copyright 2000-2014 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jetbrains.java.decompiler.code.instructions; package org.jetbrains.java.decompiler.code.instructions;
import org.jetbrains.java.decompiler.code.Instruction; import org.jetbrains.java.decompiler.code.Instruction;

@ -1,3 +1,18 @@
/*
* Copyright 2000-2014 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jetbrains.java.decompiler.code.instructions; package org.jetbrains.java.decompiler.code.instructions;
import org.jetbrains.java.decompiler.code.Instruction; import org.jetbrains.java.decompiler.code.Instruction;

@ -1,3 +1,18 @@
/*
* Copyright 2000-2014 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jetbrains.java.decompiler.code.instructions; package org.jetbrains.java.decompiler.code.instructions;
import org.jetbrains.java.decompiler.code.Instruction; import org.jetbrains.java.decompiler.code.Instruction;

@ -1,3 +1,18 @@
/*
* Copyright 2000-2014 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jetbrains.java.decompiler.code.instructions; package org.jetbrains.java.decompiler.code.instructions;
import org.jetbrains.java.decompiler.code.Instruction; import org.jetbrains.java.decompiler.code.Instruction;

@ -1,3 +1,18 @@
/*
* Copyright 2000-2014 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jetbrains.java.decompiler.code.instructions; package org.jetbrains.java.decompiler.code.instructions;
import org.jetbrains.java.decompiler.code.Instruction; import org.jetbrains.java.decompiler.code.Instruction;

@ -1,3 +1,18 @@
/*
* Copyright 2000-2014 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jetbrains.java.decompiler.code.instructions; package org.jetbrains.java.decompiler.code.instructions;
import org.jetbrains.java.decompiler.code.Instruction; import org.jetbrains.java.decompiler.code.Instruction;

@ -1,3 +1,18 @@
/*
* Copyright 2000-2014 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jetbrains.java.decompiler.code.instructions; package org.jetbrains.java.decompiler.code.instructions;
import org.jetbrains.java.decompiler.code.Instruction; import org.jetbrains.java.decompiler.code.Instruction;

@ -1,3 +1,18 @@
/*
* Copyright 2000-2014 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jetbrains.java.decompiler.code.instructions; package org.jetbrains.java.decompiler.code.instructions;
import org.jetbrains.java.decompiler.code.Instruction; import org.jetbrains.java.decompiler.code.Instruction;

@ -1,42 +1,60 @@
/*
* Copyright 2000-2014 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jetbrains.java.decompiler.code.instructions; package org.jetbrains.java.decompiler.code.instructions;
import org.jetbrains.java.decompiler.code.Instruction;
import java.io.DataOutputStream; import java.io.DataOutputStream;
import java.io.IOException; import java.io.IOException;
import org.jetbrains.java.decompiler.code.Instruction;
public class FLOAD extends Instruction { public class FLOAD extends Instruction {
private static int[] opcodes = new int[] {opc_fload_0,opc_fload_1,opc_fload_2,opc_fload_3}; 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 { public void writeToStream(DataOutputStream out, int offset) throws IOException {
int index = getOperand(0); int index = getOperand(0);
if(index>3) { if (index > 3) {
if(wide) { if (wide) {
out.writeByte(opc_wide); out.writeByte(opc_wide);
} }
out.writeByte(opc_fload); out.writeByte(opc_fload);
if(wide) { if (wide) {
out.writeShort(index); out.writeShort(index);
} else { }
else {
out.writeByte(index); out.writeByte(index);
} }
} else { }
else {
out.writeByte(opcodes[index]); out.writeByte(opcodes[index]);
} }
} }
public int length() { public int length() {
int index = getOperand(0); int index = getOperand(0);
if(index>3) { if (index > 3) {
if(wide) { if (wide) {
return 4; return 4;
} else { }
else {
return 2; return 2;
} }
} else { }
else {
return 1; return 1;
} }
} }
} }

@ -1,3 +1,18 @@
/*
* Copyright 2000-2014 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jetbrains.java.decompiler.code.instructions; package org.jetbrains.java.decompiler.code.instructions;
import org.jetbrains.java.decompiler.code.Instruction; import org.jetbrains.java.decompiler.code.Instruction;

@ -1,3 +1,18 @@
/*
* Copyright 2000-2014 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jetbrains.java.decompiler.code.instructions; package org.jetbrains.java.decompiler.code.instructions;
import org.jetbrains.java.decompiler.code.Instruction; import org.jetbrains.java.decompiler.code.Instruction;

@ -1,3 +1,18 @@
/*
* Copyright 2000-2014 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jetbrains.java.decompiler.code.instructions; package org.jetbrains.java.decompiler.code.instructions;
import org.jetbrains.java.decompiler.code.Instruction; import org.jetbrains.java.decompiler.code.Instruction;

@ -1,3 +1,18 @@
/*
* Copyright 2000-2014 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jetbrains.java.decompiler.code.instructions; package org.jetbrains.java.decompiler.code.instructions;
import org.jetbrains.java.decompiler.code.Instruction; import org.jetbrains.java.decompiler.code.Instruction;

@ -1,40 +1,59 @@
/*
* Copyright 2000-2014 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jetbrains.java.decompiler.code.instructions; package org.jetbrains.java.decompiler.code.instructions;
import org.jetbrains.java.decompiler.code.Instruction;
import java.io.DataOutputStream; import java.io.DataOutputStream;
import java.io.IOException; import java.io.IOException;
import org.jetbrains.java.decompiler.code.Instruction;
public class FSTORE extends Instruction { public class FSTORE extends Instruction {
private static int[] opcodes = new int[] {opc_fstore_0,opc_fstore_1,opc_fstore_2,opc_fstore_3}; 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 { public void writeToStream(DataOutputStream out, int offset) throws IOException {
int index = getOperand(0); int index = getOperand(0);
if(index>3) { if (index > 3) {
if(wide) { if (wide) {
out.writeByte(opc_wide); out.writeByte(opc_wide);
} }
out.writeByte(opc_fstore); out.writeByte(opc_fstore);
if(wide) { if (wide) {
out.writeShort(index); out.writeShort(index);
} else { }
else {
out.writeByte(index); out.writeByte(index);
} }
} else { }
else {
out.writeByte(opcodes[index]); out.writeByte(opcodes[index]);
} }
} }
public int length() { public int length() {
int index = getOperand(0); int index = getOperand(0);
if(index>3) { if (index > 3) {
if(wide) { if (wide) {
return 4; return 4;
} else { }
else {
return 2; return 2;
} }
} else { }
else {
return 1; return 1;
} }
} }

@ -1,3 +1,18 @@
/*
* Copyright 2000-2014 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jetbrains.java.decompiler.code.instructions; package org.jetbrains.java.decompiler.code.instructions;
import org.jetbrains.java.decompiler.code.Instruction; import org.jetbrains.java.decompiler.code.Instruction;

@ -1,10 +1,25 @@
/*
* Copyright 2000-2014 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jetbrains.java.decompiler.code.instructions; package org.jetbrains.java.decompiler.code.instructions;
import org.jetbrains.java.decompiler.code.Instruction;
import java.io.DataOutputStream; import java.io.DataOutputStream;
import java.io.IOException; import java.io.IOException;
import org.jetbrains.java.decompiler.code.Instruction;
public class GETFIELD extends Instruction { public class GETFIELD extends Instruction {
public void writeToStream(DataOutputStream out, int offset) throws IOException { public void writeToStream(DataOutputStream out, int offset) throws IOException {

@ -1,10 +1,25 @@
/*
* Copyright 2000-2014 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jetbrains.java.decompiler.code.instructions; package org.jetbrains.java.decompiler.code.instructions;
import org.jetbrains.java.decompiler.code.Instruction;
import java.io.DataOutputStream; import java.io.DataOutputStream;
import java.io.IOException; import java.io.IOException;
import org.jetbrains.java.decompiler.code.Instruction;
public class GETSTATIC extends Instruction { public class GETSTATIC extends Instruction {
public void writeToStream(DataOutputStream out, int offset) throws IOException { public void writeToStream(DataOutputStream out, int offset) throws IOException {
@ -15,5 +30,4 @@ public class GETSTATIC extends Instruction {
public int length() { public int length() {
return 3; return 3;
} }
} }

@ -1,18 +1,34 @@
/*
* Copyright 2000-2014 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jetbrains.java.decompiler.code.instructions; package org.jetbrains.java.decompiler.code.instructions;
import org.jetbrains.java.decompiler.code.JumpInstruction;
import java.io.DataOutputStream; import java.io.DataOutputStream;
import java.io.IOException; import java.io.IOException;
import org.jetbrains.java.decompiler.code.JumpInstruction;
public class GOTO extends JumpInstruction { public class GOTO extends JumpInstruction {
public void writeToStream(DataOutputStream out, int offset) throws IOException { public void writeToStream(DataOutputStream out, int offset) throws IOException {
int operand = getOperand(0); int operand = getOperand(0);
if(operand < -32768 || operand > 32767) { if (operand < -32768 || operand > 32767) {
out.writeByte(opc_goto_w); out.writeByte(opc_goto_w);
out.writeInt(operand); out.writeInt(operand);
} else { }
else {
out.writeByte(opc_goto); out.writeByte(opc_goto);
out.writeShort(operand); out.writeShort(operand);
} }
@ -20,11 +36,11 @@ public class GOTO extends JumpInstruction {
public int length() { public int length() {
int operand = getOperand(0); int operand = getOperand(0);
if(operand < -32768 || operand > 32767) { if (operand < -32768 || operand > 32767) {
return 5; return 5;
} else { }
else {
return 3; return 3;
} }
} }
} }

@ -1,10 +1,25 @@
/*
* Copyright 2000-2014 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jetbrains.java.decompiler.code.instructions; package org.jetbrains.java.decompiler.code.instructions;
import org.jetbrains.java.decompiler.code.JumpInstruction;
import java.io.DataOutputStream; import java.io.DataOutputStream;
import java.io.IOException; import java.io.IOException;
import org.jetbrains.java.decompiler.code.JumpInstruction;
public class GOTO_W extends JumpInstruction { public class GOTO_W extends JumpInstruction {
public void writeToStream(DataOutputStream out, int offset) throws IOException { public void writeToStream(DataOutputStream out, int offset) throws IOException {
@ -15,5 +30,4 @@ public class GOTO_W extends JumpInstruction {
public int length() { public int length() {
return 5; return 5;
} }
} }

@ -1,3 +1,18 @@
/*
* Copyright 2000-2014 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jetbrains.java.decompiler.code.instructions; package org.jetbrains.java.decompiler.code.instructions;
import org.jetbrains.java.decompiler.code.Instruction; import org.jetbrains.java.decompiler.code.Instruction;

@ -1,3 +1,18 @@
/*
* Copyright 2000-2014 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jetbrains.java.decompiler.code.instructions; package org.jetbrains.java.decompiler.code.instructions;
import org.jetbrains.java.decompiler.code.Instruction; import org.jetbrains.java.decompiler.code.Instruction;

@ -1,3 +1,18 @@
/*
* Copyright 2000-2014 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jetbrains.java.decompiler.code.instructions; package org.jetbrains.java.decompiler.code.instructions;
import org.jetbrains.java.decompiler.code.Instruction; import org.jetbrains.java.decompiler.code.Instruction;

@ -1,3 +1,18 @@
/*
* Copyright 2000-2014 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jetbrains.java.decompiler.code.instructions; package org.jetbrains.java.decompiler.code.instructions;
import org.jetbrains.java.decompiler.code.Instruction; import org.jetbrains.java.decompiler.code.Instruction;

@ -1,3 +1,18 @@
/*
* Copyright 2000-2014 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jetbrains.java.decompiler.code.instructions; package org.jetbrains.java.decompiler.code.instructions;
import org.jetbrains.java.decompiler.code.Instruction; import org.jetbrains.java.decompiler.code.Instruction;

@ -1,3 +1,18 @@
/*
* Copyright 2000-2014 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jetbrains.java.decompiler.code.instructions; package org.jetbrains.java.decompiler.code.instructions;
import org.jetbrains.java.decompiler.code.Instruction; import org.jetbrains.java.decompiler.code.Instruction;

@ -1,3 +1,18 @@
/*
* Copyright 2000-2014 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jetbrains.java.decompiler.code.instructions; package org.jetbrains.java.decompiler.code.instructions;
import org.jetbrains.java.decompiler.code.Instruction; import org.jetbrains.java.decompiler.code.Instruction;

@ -1,3 +1,18 @@
/*
* Copyright 2000-2014 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jetbrains.java.decompiler.code.instructions; package org.jetbrains.java.decompiler.code.instructions;
import org.jetbrains.java.decompiler.code.Instruction; import org.jetbrains.java.decompiler.code.Instruction;

@ -1,3 +1,18 @@
/*
* Copyright 2000-2014 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jetbrains.java.decompiler.code.instructions; package org.jetbrains.java.decompiler.code.instructions;
import org.jetbrains.java.decompiler.code.Instruction; import org.jetbrains.java.decompiler.code.Instruction;

@ -1,3 +1,18 @@
/*
* Copyright 2000-2014 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jetbrains.java.decompiler.code.instructions; package org.jetbrains.java.decompiler.code.instructions;
import org.jetbrains.java.decompiler.code.Instruction; import org.jetbrains.java.decompiler.code.Instruction;

@ -1,3 +1,18 @@
/*
* Copyright 2000-2014 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jetbrains.java.decompiler.code.instructions; package org.jetbrains.java.decompiler.code.instructions;
import org.jetbrains.java.decompiler.code.Instruction; import org.jetbrains.java.decompiler.code.Instruction;

@ -1,10 +1,25 @@
/*
* Copyright 2000-2014 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jetbrains.java.decompiler.code.instructions; package org.jetbrains.java.decompiler.code.instructions;
import org.jetbrains.java.decompiler.code.JumpInstruction;
import java.io.DataOutputStream; import java.io.DataOutputStream;
import java.io.IOException; import java.io.IOException;
import org.jetbrains.java.decompiler.code.JumpInstruction;
public class IFEQ extends JumpInstruction { public class IFEQ extends JumpInstruction {
public void writeToStream(DataOutputStream out, int offset) throws IOException { public void writeToStream(DataOutputStream out, int offset) throws IOException {
@ -15,5 +30,4 @@ public class IFEQ extends JumpInstruction {
public int length() { public int length() {
return 3; return 3;
} }
} }

@ -1,10 +1,25 @@
/*
* Copyright 2000-2014 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jetbrains.java.decompiler.code.instructions; package org.jetbrains.java.decompiler.code.instructions;
import org.jetbrains.java.decompiler.code.JumpInstruction;
import java.io.DataOutputStream; import java.io.DataOutputStream;
import java.io.IOException; import java.io.IOException;
import org.jetbrains.java.decompiler.code.JumpInstruction;
public class IFGE extends JumpInstruction { public class IFGE extends JumpInstruction {
public void writeToStream(DataOutputStream out, int offset) throws IOException { public void writeToStream(DataOutputStream out, int offset) throws IOException {
@ -15,5 +30,4 @@ public class IFGE extends JumpInstruction {
public int length() { public int length() {
return 3; return 3;
} }
} }

@ -1,10 +1,25 @@
/*
* Copyright 2000-2014 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jetbrains.java.decompiler.code.instructions; package org.jetbrains.java.decompiler.code.instructions;
import org.jetbrains.java.decompiler.code.JumpInstruction;
import java.io.DataOutputStream; import java.io.DataOutputStream;
import java.io.IOException; import java.io.IOException;
import org.jetbrains.java.decompiler.code.JumpInstruction;
public class IFGT extends JumpInstruction { public class IFGT extends JumpInstruction {
public void writeToStream(DataOutputStream out, int offset) throws IOException { public void writeToStream(DataOutputStream out, int offset) throws IOException {
@ -15,5 +30,4 @@ public class IFGT extends JumpInstruction {
public int length() { public int length() {
return 3; return 3;
} }
} }

@ -1,10 +1,25 @@
/*
* Copyright 2000-2014 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jetbrains.java.decompiler.code.instructions; package org.jetbrains.java.decompiler.code.instructions;
import org.jetbrains.java.decompiler.code.JumpInstruction;
import java.io.DataOutputStream; import java.io.DataOutputStream;
import java.io.IOException; import java.io.IOException;
import org.jetbrains.java.decompiler.code.JumpInstruction;
public class IFLE extends JumpInstruction { public class IFLE extends JumpInstruction {
public void writeToStream(DataOutputStream out, int offset) throws IOException { public void writeToStream(DataOutputStream out, int offset) throws IOException {
@ -15,5 +30,4 @@ public class IFLE extends JumpInstruction {
public int length() { public int length() {
return 3; return 3;
} }
} }

@ -1,10 +1,25 @@
/*
* Copyright 2000-2014 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jetbrains.java.decompiler.code.instructions; package org.jetbrains.java.decompiler.code.instructions;
import org.jetbrains.java.decompiler.code.JumpInstruction;
import java.io.DataOutputStream; import java.io.DataOutputStream;
import java.io.IOException; import java.io.IOException;
import org.jetbrains.java.decompiler.code.JumpInstruction;
public class IFLT extends JumpInstruction { public class IFLT extends JumpInstruction {
public void writeToStream(DataOutputStream out, int offset) throws IOException { public void writeToStream(DataOutputStream out, int offset) throws IOException {
@ -15,5 +30,4 @@ public class IFLT extends JumpInstruction {
public int length() { public int length() {
return 3; return 3;
} }
} }

@ -1,10 +1,25 @@
/*
* Copyright 2000-2014 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jetbrains.java.decompiler.code.instructions; package org.jetbrains.java.decompiler.code.instructions;
import org.jetbrains.java.decompiler.code.JumpInstruction;
import java.io.DataOutputStream; import java.io.DataOutputStream;
import java.io.IOException; import java.io.IOException;
import org.jetbrains.java.decompiler.code.JumpInstruction;
public class IFNE extends JumpInstruction { public class IFNE extends JumpInstruction {
public void writeToStream(DataOutputStream out, int offset) throws IOException { public void writeToStream(DataOutputStream out, int offset) throws IOException {
@ -15,5 +30,4 @@ public class IFNE extends JumpInstruction {
public int length() { public int length() {
return 3; return 3;
} }
} }

@ -1,10 +1,25 @@
/*
* Copyright 2000-2014 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jetbrains.java.decompiler.code.instructions; package org.jetbrains.java.decompiler.code.instructions;
import org.jetbrains.java.decompiler.code.JumpInstruction;
import java.io.DataOutputStream; import java.io.DataOutputStream;
import java.io.IOException; import java.io.IOException;
import org.jetbrains.java.decompiler.code.JumpInstruction;
public class IFNONNULL extends JumpInstruction { public class IFNONNULL extends JumpInstruction {
public void writeToStream(DataOutputStream out, int offset) throws IOException { public void writeToStream(DataOutputStream out, int offset) throws IOException {
@ -15,5 +30,4 @@ public class IFNONNULL extends JumpInstruction {
public int length() { public int length() {
return 3; return 3;
} }
} }

@ -1,10 +1,25 @@
/*
* Copyright 2000-2014 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jetbrains.java.decompiler.code.instructions; package org.jetbrains.java.decompiler.code.instructions;
import org.jetbrains.java.decompiler.code.JumpInstruction;
import java.io.DataOutputStream; import java.io.DataOutputStream;
import java.io.IOException; import java.io.IOException;
import org.jetbrains.java.decompiler.code.JumpInstruction;
public class IFNULL extends JumpInstruction { public class IFNULL extends JumpInstruction {
public void writeToStream(DataOutputStream out, int offset) throws IOException { public void writeToStream(DataOutputStream out, int offset) throws IOException {
@ -15,5 +30,4 @@ public class IFNULL extends JumpInstruction {
public int length() { public int length() {
return 3; return 3;
} }
} }

@ -1,10 +1,25 @@
/*
* Copyright 2000-2014 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jetbrains.java.decompiler.code.instructions; package org.jetbrains.java.decompiler.code.instructions;
import org.jetbrains.java.decompiler.code.JumpInstruction;
import java.io.DataOutputStream; import java.io.DataOutputStream;
import java.io.IOException; import java.io.IOException;
import org.jetbrains.java.decompiler.code.JumpInstruction;
public class IF_ACMPEQ extends JumpInstruction { public class IF_ACMPEQ extends JumpInstruction {
public void writeToStream(DataOutputStream out, int offset) throws IOException { public void writeToStream(DataOutputStream out, int offset) throws IOException {
@ -15,6 +30,5 @@ public class IF_ACMPEQ extends JumpInstruction {
public int length() { public int length() {
return 3; return 3;
} }
} }

@ -1,10 +1,25 @@
/*
* Copyright 2000-2014 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jetbrains.java.decompiler.code.instructions; package org.jetbrains.java.decompiler.code.instructions;
import org.jetbrains.java.decompiler.code.JumpInstruction;
import java.io.DataOutputStream; import java.io.DataOutputStream;
import java.io.IOException; import java.io.IOException;
import org.jetbrains.java.decompiler.code.JumpInstruction;
public class IF_ACMPNE extends JumpInstruction { public class IF_ACMPNE extends JumpInstruction {
public void writeToStream(DataOutputStream out, int offset) throws IOException { public void writeToStream(DataOutputStream out, int offset) throws IOException {
@ -15,5 +30,4 @@ public class IF_ACMPNE extends JumpInstruction {
public int length() { public int length() {
return 3; return 3;
} }
} }

@ -1,10 +1,25 @@
/*
* Copyright 2000-2014 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jetbrains.java.decompiler.code.instructions; package org.jetbrains.java.decompiler.code.instructions;
import org.jetbrains.java.decompiler.code.JumpInstruction;
import java.io.DataOutputStream; import java.io.DataOutputStream;
import java.io.IOException; import java.io.IOException;
import org.jetbrains.java.decompiler.code.JumpInstruction;
public class IF_ICMPEQ extends JumpInstruction { public class IF_ICMPEQ extends JumpInstruction {
public void writeToStream(DataOutputStream out, int offset) throws IOException { public void writeToStream(DataOutputStream out, int offset) throws IOException {
@ -15,5 +30,4 @@ public class IF_ICMPEQ extends JumpInstruction {
public int length() { public int length() {
return 3; return 3;
} }
} }

@ -1,10 +1,25 @@
/*
* Copyright 2000-2014 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jetbrains.java.decompiler.code.instructions; package org.jetbrains.java.decompiler.code.instructions;
import org.jetbrains.java.decompiler.code.JumpInstruction;
import java.io.DataOutputStream; import java.io.DataOutputStream;
import java.io.IOException; import java.io.IOException;
import org.jetbrains.java.decompiler.code.JumpInstruction;
public class IF_ICMPGE extends JumpInstruction { public class IF_ICMPGE extends JumpInstruction {
public void writeToStream(DataOutputStream out, int offset) throws IOException { public void writeToStream(DataOutputStream out, int offset) throws IOException {
@ -15,5 +30,4 @@ public class IF_ICMPGE extends JumpInstruction {
public int length() { public int length() {
return 3; return 3;
} }
} }

@ -1,10 +1,25 @@
/*
* Copyright 2000-2014 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jetbrains.java.decompiler.code.instructions; package org.jetbrains.java.decompiler.code.instructions;
import org.jetbrains.java.decompiler.code.JumpInstruction;
import java.io.DataOutputStream; import java.io.DataOutputStream;
import java.io.IOException; import java.io.IOException;
import org.jetbrains.java.decompiler.code.JumpInstruction;
public class IF_ICMPGT extends JumpInstruction { public class IF_ICMPGT extends JumpInstruction {
public void writeToStream(DataOutputStream out, int offset) throws IOException { public void writeToStream(DataOutputStream out, int offset) throws IOException {
@ -15,5 +30,4 @@ public class IF_ICMPGT extends JumpInstruction {
public int length() { public int length() {
return 3; return 3;
} }
} }

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save