|
|
|
/* Block Copyright (C) 2000-2002 Jochen Hoenicke.
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU Lesser General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 2, or (at your option)
|
|
|
|
* any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public License
|
|
|
|
* along with this program; see the file COPYING.LESSER. If not, write to
|
|
|
|
* the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
|
|
|
|
*
|
|
|
|
* $Id$
|
|
|
|
*/
|
|
|
|
|
|
|
|
package net.sf.jode.bytecode;
|
|
|
|
|
|
|
|
import java.io.PrintWriter;
|
|
|
|
|
|
|
|
/**
|
* ConstantInstruction.java,IncInstruction.java,ReferenceInstruction.java,SlotInstruction.java,TypeDimensionInstruction.java,TypeInstruction.java: Class and Constructors no longer public.
* Instruction.java (forOpcode): added method to create instructions.
* SlotInstruction.java,IncInstruction.java: Use a LocalVariableInfo
entry instead of slot+addr
* BasicBlockReader.java, BasicBlockWriter.java: Adapted Instruction interface.
* BinaryInfo.java: package private class now.
* BinaryInfo.java,FieldInfo.java,MethodInfo.java: Made some methods
package private.
* BasicBlocks.java (getAllInstructions): removed.
(read,readAttribute): no longer protected.
* ClassInfo.java (isGuessed): added.
All classes: bug fixes, etc.
git-svn-id: https://svn.code.sf.net/p/jode/code/trunk@1266 379699f6-c40d-0410-875b-85095c16579e
24 years ago
|
|
|
* <p>Represents a single basic block. It contains a list of
|
|
|
|
* instructions and the successor blocks.</p>
|
|
|
|
*
|
* ConstantInstruction.java,IncInstruction.java,ReferenceInstruction.java,SlotInstruction.java,TypeDimensionInstruction.java,TypeInstruction.java: Class and Constructors no longer public.
* Instruction.java (forOpcode): added method to create instructions.
* SlotInstruction.java,IncInstruction.java: Use a LocalVariableInfo
entry instead of slot+addr
* BasicBlockReader.java, BasicBlockWriter.java: Adapted Instruction interface.
* BinaryInfo.java: package private class now.
* BinaryInfo.java,FieldInfo.java,MethodInfo.java: Made some methods
package private.
* BasicBlocks.java (getAllInstructions): removed.
(read,readAttribute): no longer protected.
* ClassInfo.java (isGuessed): added.
All classes: bug fixes, etc.
git-svn-id: https://svn.code.sf.net/p/jode/code/trunk@1266 379699f6-c40d-0410-875b-85095c16579e
24 years ago
|
|
|
* <p>All jump instructions must be at the end of the block. These
|
|
|
|
* jump instructions are <code>opc_lookupswitch</code>,
|
|
|
|
* <code>opc_if</code>xxx, <code>opc_jsr</code>, <code>opc_ret</code>,
|
|
|
|
* <code>opc_</code>x<code>return</code> and <code>opc_return</code>.
|
|
|
|
* An <code>opc_goto</code> is implicit if the basic block doesn't end
|
|
|
|
* with a jump instructions, or if it ends with an conditional jump or
|
|
|
|
* jsr.</p>
|
|
|
|
*
|
|
|
|
* <p>The jump instructions don't remember their destinations, instead
|
|
|
|
* the Block does it. This are the successor block. There are
|
|
|
|
* several cases:</p>
|
|
|
|
*
|
|
|
|
* <ul>
|
|
|
|
* <li>Block ends with <code>opc_lookupswitch</code> with
|
|
|
|
* <code>n</code> values. Then there must be <code>n+1</code>
|
|
|
|
* successors where the first <code>n</code> successors correspond to
|
|
|
|
* the values and the last successor is the default successor.</li>
|
|
|
|
* <li>Block ends with <code>opc_if</code>xxx, then there must be two
|
|
|
|
* successors: The first one is the successor if the condition evaluates
|
|
|
|
* to true, the second one is for the false branch. </li>
|
|
|
|
* <li>Block ends with <code>opc_jsr</code>, then there must be two
|
|
|
|
* successors: The first one is the subroutine, the second is the next
|
|
|
|
* block after the subroutine. </li>
|
|
|
|
* <li>Block ends with <code>opc_</code>x</code>return</code> or
|
|
|
|
* <code>opc_ret</code>, then there must no successor at all. </li>
|
|
|
|
* <li>In any other case there must be exactly one successor.</li>
|
|
|
|
* </ul>
|
|
|
|
*
|
|
|
|
* <p>If any successor is <code>null</code> it represents end of
|
|
|
|
* method, i.e. a return instruction. You can also use
|
|
|
|
* <code>null</code> successors for conditional jumps and switch
|
|
|
|
* instruction. You normally shouldn't use <code>opc_return</code>
|
|
|
|
* instructions. They are only necessary, if you want to return with
|
|
|
|
* a non-empty stack. </p>
|
|
|
|
*
|
|
|
|
* @author Jochen Hoenicke
|
|
|
|
* @see net.sf.jode.bytecode.BasicBlocks
|
|
|
|
* @see net.sf.jode.bytecode.Instruction
|
* ConstantInstruction.java,IncInstruction.java,ReferenceInstruction.java,SlotInstruction.java,TypeDimensionInstruction.java,TypeInstruction.java: Class and Constructors no longer public.
* Instruction.java (forOpcode): added method to create instructions.
* SlotInstruction.java,IncInstruction.java: Use a LocalVariableInfo
entry instead of slot+addr
* BasicBlockReader.java, BasicBlockWriter.java: Adapted Instruction interface.
* BinaryInfo.java: package private class now.
* BinaryInfo.java,FieldInfo.java,MethodInfo.java: Made some methods
package private.
* BasicBlocks.java (getAllInstructions): removed.
(read,readAttribute): no longer protected.
* ClassInfo.java (isGuessed): added.
All classes: bug fixes, etc.
git-svn-id: https://svn.code.sf.net/p/jode/code/trunk@1266 379699f6-c40d-0410-875b-85095c16579e
24 years ago
|
|
|
*/
|
|
|
|
public final class Block {
|
|
|
|
/**
|
|
|
|
* The opcodes of the instructions in this block.
|
|
|
|
*/
|
|
|
|
private Instruction[] instrs;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The blockNr of successor blocks
|
|
|
|
*/
|
|
|
|
private Block[] succs;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The catching blocks. Set by BasicBlocks.
|
|
|
|
*/
|
|
|
|
Handler[] catchers;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The blockNr of this block. Set by BasicBlocks.
|
|
|
|
*/
|
|
|
|
int blockNr;
|
|
|
|
|
* ConstantInstruction.java,IncInstruction.java,ReferenceInstruction.java,SlotInstruction.java,TypeDimensionInstruction.java,TypeInstruction.java: Class and Constructors no longer public.
* Instruction.java (forOpcode): added method to create instructions.
* SlotInstruction.java,IncInstruction.java: Use a LocalVariableInfo
entry instead of slot+addr
* BasicBlockReader.java, BasicBlockWriter.java: Adapted Instruction interface.
* BinaryInfo.java: package private class now.
* BinaryInfo.java,FieldInfo.java,MethodInfo.java: Made some methods
package private.
* BasicBlocks.java (getAllInstructions): removed.
(read,readAttribute): no longer protected.
* ClassInfo.java (isGuessed): added.
All classes: bug fixes, etc.
git-svn-id: https://svn.code.sf.net/p/jode/code/trunk@1266 379699f6-c40d-0410-875b-85095c16579e
24 years ago
|
|
|
/**
|
Documentation updates (INSTALL, javadoc).
Added JUnit Test cases.
* build.xml: Big update.
* net/sf/jode/bytecode/BasicBlock.java:
(updateMaxStackLocals): new method to calculate maxStack and
maxLocals.
(setBlocks): fixed calculation of handlers, call updateMaxLocals.
* net/sf/jode/bytecode/BasicBlockReader.java:
(maxLocals, maxStack): new fields.
(readCode): read maxStack/Locals into private fields.
(convert): check that maxStack/Locals match what we calculate.
* net/sf/jode/bytecode/BinaryInfo.java:
(getKnownAttributeCount): renamed to...
(getAttributeCount): ... this, and also count internal attributes.
Made it protected.
(readAttribute): made protected.
(drop): made protected.
(prepareAttributes): made protected.
(writeKnownAttributes): removed.
(writeAttributes): made protected, use getAttributeCount.
Changed policy: it doesn't call writeKnownAttribute, but instead
it expects sub classes to override this method.
(getAttributeSize): made protected, subclasses should override it.
Changed all subclasses to new policy.
* net/sf/jode/bytecode/Block.java:
(lineNr): Removed, it wasn't used.
(pop,push): Removed, replaced by ...
(maxpop,maxpush,delta): ... these, with slightly changed semantics.
(stackHeight): New variable.
(Block): Default Constructor doesn't initialize fields now.
(getCatchers): Renamed to ...
(getHandlers): ... this, changed all callers.
(initCode): Calculate maxpop, maxpush, delta correctly.
(getStackPopPush): Changed accordingly to new fields.
(setCode): Removed debugging output for illegal contents.
* net/sf/jode/bytecode/Classes.java: Reworked handling of inner
classes.
(innerClasses): Field mustn't be null anymore when loaded.
(setName): Update class in classpath.
* net/sf/jode/bytecode/ClassPath.java:
(renameClassInfo): new function, should only used by ClassInfo.
* net/sf/jode/bytecode/ConstantPool.java: made public.
(getUTF8,getRef,getClassType,getClassName): Don't allow the 0 index.
(iterateClassNames): New method.
* net/sf/jode/decompiler/Main.java:
(decompileClass): Catch ClassFormatExceptions and decompile
remaining classes.
* net/sf/jode/obfuscator/ClassIdentifier.java:
Updated handling of inner/extra classes to new ClassInfo behaviour.
(initSuperClasses): Load DECLARATION of super classes.
* net/sf/jode/obfuscator/PackageIdentifier.java:
Replace deprecated methods of ClassInfo with corresponding classpath
calls.
(loadMatchingClasses): Initialize packages loaded on demand if we
are initialize.
* net/sf/jode/obfuscator/modules/ConstantAnalyzer.java:
Now extends SimpleAnalyzer.
(canonizeIfaceRef): Removed; it is now inherited.
(canonizeRef): likewise.
Big updates to handle jsr correctly.
(handleOpcode): Moved method to BlockInfo.
* net/sf/jode/obfuscator/modules/SimpleAnalyzer.java:
(canonizeIfaceRef): New method, copied from ConstantAnalyzer.
(canonizeRef): call canonizeIfaceRef for interfaces.
* net/sf/jode/util/UnifyHash.java
(iterateHashCode): iterator now supports remove().
(remove): New method.
git-svn-id: https://svn.code.sf.net/p/jode/code/trunk@1337 379699f6-c40d-0410-875b-85095c16579e
23 years ago
|
|
|
* The number of items this block takes from the stack with
|
|
|
|
* respect to the stack items at the beginning of the block.
|
* ConstantInstruction.java,IncInstruction.java,ReferenceInstruction.java,SlotInstruction.java,TypeDimensionInstruction.java,TypeInstruction.java: Class and Constructors no longer public.
* Instruction.java (forOpcode): added method to create instructions.
* SlotInstruction.java,IncInstruction.java: Use a LocalVariableInfo
entry instead of slot+addr
* BasicBlockReader.java, BasicBlockWriter.java: Adapted Instruction interface.
* BinaryInfo.java: package private class now.
* BinaryInfo.java,FieldInfo.java,MethodInfo.java: Made some methods
package private.
* BasicBlocks.java (getAllInstructions): removed.
(read,readAttribute): no longer protected.
* ClassInfo.java (isGuessed): added.
All classes: bug fixes, etc.
git-svn-id: https://svn.code.sf.net/p/jode/code/trunk@1266 379699f6-c40d-0410-875b-85095c16579e
24 years ago
|
|
|
*/
|
Documentation updates (INSTALL, javadoc).
Added JUnit Test cases.
* build.xml: Big update.
* net/sf/jode/bytecode/BasicBlock.java:
(updateMaxStackLocals): new method to calculate maxStack and
maxLocals.
(setBlocks): fixed calculation of handlers, call updateMaxLocals.
* net/sf/jode/bytecode/BasicBlockReader.java:
(maxLocals, maxStack): new fields.
(readCode): read maxStack/Locals into private fields.
(convert): check that maxStack/Locals match what we calculate.
* net/sf/jode/bytecode/BinaryInfo.java:
(getKnownAttributeCount): renamed to...
(getAttributeCount): ... this, and also count internal attributes.
Made it protected.
(readAttribute): made protected.
(drop): made protected.
(prepareAttributes): made protected.
(writeKnownAttributes): removed.
(writeAttributes): made protected, use getAttributeCount.
Changed policy: it doesn't call writeKnownAttribute, but instead
it expects sub classes to override this method.
(getAttributeSize): made protected, subclasses should override it.
Changed all subclasses to new policy.
* net/sf/jode/bytecode/Block.java:
(lineNr): Removed, it wasn't used.
(pop,push): Removed, replaced by ...
(maxpop,maxpush,delta): ... these, with slightly changed semantics.
(stackHeight): New variable.
(Block): Default Constructor doesn't initialize fields now.
(getCatchers): Renamed to ...
(getHandlers): ... this, changed all callers.
(initCode): Calculate maxpop, maxpush, delta correctly.
(getStackPopPush): Changed accordingly to new fields.
(setCode): Removed debugging output for illegal contents.
* net/sf/jode/bytecode/Classes.java: Reworked handling of inner
classes.
(innerClasses): Field mustn't be null anymore when loaded.
(setName): Update class in classpath.
* net/sf/jode/bytecode/ClassPath.java:
(renameClassInfo): new function, should only used by ClassInfo.
* net/sf/jode/bytecode/ConstantPool.java: made public.
(getUTF8,getRef,getClassType,getClassName): Don't allow the 0 index.
(iterateClassNames): New method.
* net/sf/jode/decompiler/Main.java:
(decompileClass): Catch ClassFormatExceptions and decompile
remaining classes.
* net/sf/jode/obfuscator/ClassIdentifier.java:
Updated handling of inner/extra classes to new ClassInfo behaviour.
(initSuperClasses): Load DECLARATION of super classes.
* net/sf/jode/obfuscator/PackageIdentifier.java:
Replace deprecated methods of ClassInfo with corresponding classpath
calls.
(loadMatchingClasses): Initialize packages loaded on demand if we
are initialize.
* net/sf/jode/obfuscator/modules/ConstantAnalyzer.java:
Now extends SimpleAnalyzer.
(canonizeIfaceRef): Removed; it is now inherited.
(canonizeRef): likewise.
Big updates to handle jsr correctly.
(handleOpcode): Moved method to BlockInfo.
* net/sf/jode/obfuscator/modules/SimpleAnalyzer.java:
(canonizeIfaceRef): New method, copied from ConstantAnalyzer.
(canonizeRef): call canonizeIfaceRef for interfaces.
* net/sf/jode/util/UnifyHash.java
(iterateHashCode): iterator now supports remove().
(remove): New method.
git-svn-id: https://svn.code.sf.net/p/jode/code/trunk@1337 379699f6-c40d-0410-875b-85095c16579e
23 years ago
|
|
|
int maxpop;
|
* ConstantInstruction.java,IncInstruction.java,ReferenceInstruction.java,SlotInstruction.java,TypeDimensionInstruction.java,TypeInstruction.java: Class and Constructors no longer public.
* Instruction.java (forOpcode): added method to create instructions.
* SlotInstruction.java,IncInstruction.java: Use a LocalVariableInfo
entry instead of slot+addr
* BasicBlockReader.java, BasicBlockWriter.java: Adapted Instruction interface.
* BinaryInfo.java: package private class now.
* BinaryInfo.java,FieldInfo.java,MethodInfo.java: Made some methods
package private.
* BasicBlocks.java (getAllInstructions): removed.
(read,readAttribute): no longer protected.
* ClassInfo.java (isGuessed): added.
All classes: bug fixes, etc.
git-svn-id: https://svn.code.sf.net/p/jode/code/trunk@1266 379699f6-c40d-0410-875b-85095c16579e
24 years ago
|
|
|
/**
|
Documentation updates (INSTALL, javadoc).
Added JUnit Test cases.
* build.xml: Big update.
* net/sf/jode/bytecode/BasicBlock.java:
(updateMaxStackLocals): new method to calculate maxStack and
maxLocals.
(setBlocks): fixed calculation of handlers, call updateMaxLocals.
* net/sf/jode/bytecode/BasicBlockReader.java:
(maxLocals, maxStack): new fields.
(readCode): read maxStack/Locals into private fields.
(convert): check that maxStack/Locals match what we calculate.
* net/sf/jode/bytecode/BinaryInfo.java:
(getKnownAttributeCount): renamed to...
(getAttributeCount): ... this, and also count internal attributes.
Made it protected.
(readAttribute): made protected.
(drop): made protected.
(prepareAttributes): made protected.
(writeKnownAttributes): removed.
(writeAttributes): made protected, use getAttributeCount.
Changed policy: it doesn't call writeKnownAttribute, but instead
it expects sub classes to override this method.
(getAttributeSize): made protected, subclasses should override it.
Changed all subclasses to new policy.
* net/sf/jode/bytecode/Block.java:
(lineNr): Removed, it wasn't used.
(pop,push): Removed, replaced by ...
(maxpop,maxpush,delta): ... these, with slightly changed semantics.
(stackHeight): New variable.
(Block): Default Constructor doesn't initialize fields now.
(getCatchers): Renamed to ...
(getHandlers): ... this, changed all callers.
(initCode): Calculate maxpop, maxpush, delta correctly.
(getStackPopPush): Changed accordingly to new fields.
(setCode): Removed debugging output for illegal contents.
* net/sf/jode/bytecode/Classes.java: Reworked handling of inner
classes.
(innerClasses): Field mustn't be null anymore when loaded.
(setName): Update class in classpath.
* net/sf/jode/bytecode/ClassPath.java:
(renameClassInfo): new function, should only used by ClassInfo.
* net/sf/jode/bytecode/ConstantPool.java: made public.
(getUTF8,getRef,getClassType,getClassName): Don't allow the 0 index.
(iterateClassNames): New method.
* net/sf/jode/decompiler/Main.java:
(decompileClass): Catch ClassFormatExceptions and decompile
remaining classes.
* net/sf/jode/obfuscator/ClassIdentifier.java:
Updated handling of inner/extra classes to new ClassInfo behaviour.
(initSuperClasses): Load DECLARATION of super classes.
* net/sf/jode/obfuscator/PackageIdentifier.java:
Replace deprecated methods of ClassInfo with corresponding classpath
calls.
(loadMatchingClasses): Initialize packages loaded on demand if we
are initialize.
* net/sf/jode/obfuscator/modules/ConstantAnalyzer.java:
Now extends SimpleAnalyzer.
(canonizeIfaceRef): Removed; it is now inherited.
(canonizeRef): likewise.
Big updates to handle jsr correctly.
(handleOpcode): Moved method to BlockInfo.
* net/sf/jode/obfuscator/modules/SimpleAnalyzer.java:
(canonizeIfaceRef): New method, copied from ConstantAnalyzer.
(canonizeRef): call canonizeIfaceRef for interfaces.
* net/sf/jode/util/UnifyHash.java
(iterateHashCode): iterator now supports remove().
(remove): New method.
git-svn-id: https://svn.code.sf.net/p/jode/code/trunk@1337 379699f6-c40d-0410-875b-85095c16579e
23 years ago
|
|
|
* The maximum number of items the stack may grow.
|
* ConstantInstruction.java,IncInstruction.java,ReferenceInstruction.java,SlotInstruction.java,TypeDimensionInstruction.java,TypeInstruction.java: Class and Constructors no longer public.
* Instruction.java (forOpcode): added method to create instructions.
* SlotInstruction.java,IncInstruction.java: Use a LocalVariableInfo
entry instead of slot+addr
* BasicBlockReader.java, BasicBlockWriter.java: Adapted Instruction interface.
* BinaryInfo.java: package private class now.
* BinaryInfo.java,FieldInfo.java,MethodInfo.java: Made some methods
package private.
* BasicBlocks.java (getAllInstructions): removed.
(read,readAttribute): no longer protected.
* ClassInfo.java (isGuessed): added.
All classes: bug fixes, etc.
git-svn-id: https://svn.code.sf.net/p/jode/code/trunk@1266 379699f6-c40d-0410-875b-85095c16579e
24 years ago
|
|
|
*/
|
Documentation updates (INSTALL, javadoc).
Added JUnit Test cases.
* build.xml: Big update.
* net/sf/jode/bytecode/BasicBlock.java:
(updateMaxStackLocals): new method to calculate maxStack and
maxLocals.
(setBlocks): fixed calculation of handlers, call updateMaxLocals.
* net/sf/jode/bytecode/BasicBlockReader.java:
(maxLocals, maxStack): new fields.
(readCode): read maxStack/Locals into private fields.
(convert): check that maxStack/Locals match what we calculate.
* net/sf/jode/bytecode/BinaryInfo.java:
(getKnownAttributeCount): renamed to...
(getAttributeCount): ... this, and also count internal attributes.
Made it protected.
(readAttribute): made protected.
(drop): made protected.
(prepareAttributes): made protected.
(writeKnownAttributes): removed.
(writeAttributes): made protected, use getAttributeCount.
Changed policy: it doesn't call writeKnownAttribute, but instead
it expects sub classes to override this method.
(getAttributeSize): made protected, subclasses should override it.
Changed all subclasses to new policy.
* net/sf/jode/bytecode/Block.java:
(lineNr): Removed, it wasn't used.
(pop,push): Removed, replaced by ...
(maxpop,maxpush,delta): ... these, with slightly changed semantics.
(stackHeight): New variable.
(Block): Default Constructor doesn't initialize fields now.
(getCatchers): Renamed to ...
(getHandlers): ... this, changed all callers.
(initCode): Calculate maxpop, maxpush, delta correctly.
(getStackPopPush): Changed accordingly to new fields.
(setCode): Removed debugging output for illegal contents.
* net/sf/jode/bytecode/Classes.java: Reworked handling of inner
classes.
(innerClasses): Field mustn't be null anymore when loaded.
(setName): Update class in classpath.
* net/sf/jode/bytecode/ClassPath.java:
(renameClassInfo): new function, should only used by ClassInfo.
* net/sf/jode/bytecode/ConstantPool.java: made public.
(getUTF8,getRef,getClassType,getClassName): Don't allow the 0 index.
(iterateClassNames): New method.
* net/sf/jode/decompiler/Main.java:
(decompileClass): Catch ClassFormatExceptions and decompile
remaining classes.
* net/sf/jode/obfuscator/ClassIdentifier.java:
Updated handling of inner/extra classes to new ClassInfo behaviour.
(initSuperClasses): Load DECLARATION of super classes.
* net/sf/jode/obfuscator/PackageIdentifier.java:
Replace deprecated methods of ClassInfo with corresponding classpath
calls.
(loadMatchingClasses): Initialize packages loaded on demand if we
are initialize.
* net/sf/jode/obfuscator/modules/ConstantAnalyzer.java:
Now extends SimpleAnalyzer.
(canonizeIfaceRef): Removed; it is now inherited.
(canonizeRef): likewise.
Big updates to handle jsr correctly.
(handleOpcode): Moved method to BlockInfo.
* net/sf/jode/obfuscator/modules/SimpleAnalyzer.java:
(canonizeIfaceRef): New method, copied from ConstantAnalyzer.
(canonizeRef): call canonizeIfaceRef for interfaces.
* net/sf/jode/util/UnifyHash.java
(iterateHashCode): iterator now supports remove().
(remove): New method.
git-svn-id: https://svn.code.sf.net/p/jode/code/trunk@1337 379699f6-c40d-0410-875b-85095c16579e
23 years ago
|
|
|
int maxpush;
|
* ConstantInstruction.java,IncInstruction.java,ReferenceInstruction.java,SlotInstruction.java,TypeDimensionInstruction.java,TypeInstruction.java: Class and Constructors no longer public.
* Instruction.java (forOpcode): added method to create instructions.
* SlotInstruction.java,IncInstruction.java: Use a LocalVariableInfo
entry instead of slot+addr
* BasicBlockReader.java, BasicBlockWriter.java: Adapted Instruction interface.
* BinaryInfo.java: package private class now.
* BinaryInfo.java,FieldInfo.java,MethodInfo.java: Made some methods
package private.
* BasicBlocks.java (getAllInstructions): removed.
(read,readAttribute): no longer protected.
* ClassInfo.java (isGuessed): added.
All classes: bug fixes, etc.
git-svn-id: https://svn.code.sf.net/p/jode/code/trunk@1266 379699f6-c40d-0410-875b-85095c16579e
24 years ago
|
|
|
/**
|
Documentation updates (INSTALL, javadoc).
Added JUnit Test cases.
* build.xml: Big update.
* net/sf/jode/bytecode/BasicBlock.java:
(updateMaxStackLocals): new method to calculate maxStack and
maxLocals.
(setBlocks): fixed calculation of handlers, call updateMaxLocals.
* net/sf/jode/bytecode/BasicBlockReader.java:
(maxLocals, maxStack): new fields.
(readCode): read maxStack/Locals into private fields.
(convert): check that maxStack/Locals match what we calculate.
* net/sf/jode/bytecode/BinaryInfo.java:
(getKnownAttributeCount): renamed to...
(getAttributeCount): ... this, and also count internal attributes.
Made it protected.
(readAttribute): made protected.
(drop): made protected.
(prepareAttributes): made protected.
(writeKnownAttributes): removed.
(writeAttributes): made protected, use getAttributeCount.
Changed policy: it doesn't call writeKnownAttribute, but instead
it expects sub classes to override this method.
(getAttributeSize): made protected, subclasses should override it.
Changed all subclasses to new policy.
* net/sf/jode/bytecode/Block.java:
(lineNr): Removed, it wasn't used.
(pop,push): Removed, replaced by ...
(maxpop,maxpush,delta): ... these, with slightly changed semantics.
(stackHeight): New variable.
(Block): Default Constructor doesn't initialize fields now.
(getCatchers): Renamed to ...
(getHandlers): ... this, changed all callers.
(initCode): Calculate maxpop, maxpush, delta correctly.
(getStackPopPush): Changed accordingly to new fields.
(setCode): Removed debugging output for illegal contents.
* net/sf/jode/bytecode/Classes.java: Reworked handling of inner
classes.
(innerClasses): Field mustn't be null anymore when loaded.
(setName): Update class in classpath.
* net/sf/jode/bytecode/ClassPath.java:
(renameClassInfo): new function, should only used by ClassInfo.
* net/sf/jode/bytecode/ConstantPool.java: made public.
(getUTF8,getRef,getClassType,getClassName): Don't allow the 0 index.
(iterateClassNames): New method.
* net/sf/jode/decompiler/Main.java:
(decompileClass): Catch ClassFormatExceptions and decompile
remaining classes.
* net/sf/jode/obfuscator/ClassIdentifier.java:
Updated handling of inner/extra classes to new ClassInfo behaviour.
(initSuperClasses): Load DECLARATION of super classes.
* net/sf/jode/obfuscator/PackageIdentifier.java:
Replace deprecated methods of ClassInfo with corresponding classpath
calls.
(loadMatchingClasses): Initialize packages loaded on demand if we
are initialize.
* net/sf/jode/obfuscator/modules/ConstantAnalyzer.java:
Now extends SimpleAnalyzer.
(canonizeIfaceRef): Removed; it is now inherited.
(canonizeRef): likewise.
Big updates to handle jsr correctly.
(handleOpcode): Moved method to BlockInfo.
* net/sf/jode/obfuscator/modules/SimpleAnalyzer.java:
(canonizeIfaceRef): New method, copied from ConstantAnalyzer.
(canonizeRef): call canonizeIfaceRef for interfaces.
* net/sf/jode/util/UnifyHash.java
(iterateHashCode): iterator now supports remove().
(remove): New method.
git-svn-id: https://svn.code.sf.net/p/jode/code/trunk@1337 379699f6-c40d-0410-875b-85095c16579e
23 years ago
|
|
|
* The difference stack items after the block minus stack items
|
|
|
|
* before block.
|
* ConstantInstruction.java,IncInstruction.java,ReferenceInstruction.java,SlotInstruction.java,TypeDimensionInstruction.java,TypeInstruction.java: Class and Constructors no longer public.
* Instruction.java (forOpcode): added method to create instructions.
* SlotInstruction.java,IncInstruction.java: Use a LocalVariableInfo
entry instead of slot+addr
* BasicBlockReader.java, BasicBlockWriter.java: Adapted Instruction interface.
* BinaryInfo.java: package private class now.
* BinaryInfo.java,FieldInfo.java,MethodInfo.java: Made some methods
package private.
* BasicBlocks.java (getAllInstructions): removed.
(read,readAttribute): no longer protected.
* ClassInfo.java (isGuessed): added.
All classes: bug fixes, etc.
git-svn-id: https://svn.code.sf.net/p/jode/code/trunk@1266 379699f6-c40d-0410-875b-85095c16579e
24 years ago
|
|
|
*/
|
Documentation updates (INSTALL, javadoc).
Added JUnit Test cases.
* build.xml: Big update.
* net/sf/jode/bytecode/BasicBlock.java:
(updateMaxStackLocals): new method to calculate maxStack and
maxLocals.
(setBlocks): fixed calculation of handlers, call updateMaxLocals.
* net/sf/jode/bytecode/BasicBlockReader.java:
(maxLocals, maxStack): new fields.
(readCode): read maxStack/Locals into private fields.
(convert): check that maxStack/Locals match what we calculate.
* net/sf/jode/bytecode/BinaryInfo.java:
(getKnownAttributeCount): renamed to...
(getAttributeCount): ... this, and also count internal attributes.
Made it protected.
(readAttribute): made protected.
(drop): made protected.
(prepareAttributes): made protected.
(writeKnownAttributes): removed.
(writeAttributes): made protected, use getAttributeCount.
Changed policy: it doesn't call writeKnownAttribute, but instead
it expects sub classes to override this method.
(getAttributeSize): made protected, subclasses should override it.
Changed all subclasses to new policy.
* net/sf/jode/bytecode/Block.java:
(lineNr): Removed, it wasn't used.
(pop,push): Removed, replaced by ...
(maxpop,maxpush,delta): ... these, with slightly changed semantics.
(stackHeight): New variable.
(Block): Default Constructor doesn't initialize fields now.
(getCatchers): Renamed to ...
(getHandlers): ... this, changed all callers.
(initCode): Calculate maxpop, maxpush, delta correctly.
(getStackPopPush): Changed accordingly to new fields.
(setCode): Removed debugging output for illegal contents.
* net/sf/jode/bytecode/Classes.java: Reworked handling of inner
classes.
(innerClasses): Field mustn't be null anymore when loaded.
(setName): Update class in classpath.
* net/sf/jode/bytecode/ClassPath.java:
(renameClassInfo): new function, should only used by ClassInfo.
* net/sf/jode/bytecode/ConstantPool.java: made public.
(getUTF8,getRef,getClassType,getClassName): Don't allow the 0 index.
(iterateClassNames): New method.
* net/sf/jode/decompiler/Main.java:
(decompileClass): Catch ClassFormatExceptions and decompile
remaining classes.
* net/sf/jode/obfuscator/ClassIdentifier.java:
Updated handling of inner/extra classes to new ClassInfo behaviour.
(initSuperClasses): Load DECLARATION of super classes.
* net/sf/jode/obfuscator/PackageIdentifier.java:
Replace deprecated methods of ClassInfo with corresponding classpath
calls.
(loadMatchingClasses): Initialize packages loaded on demand if we
are initialize.
* net/sf/jode/obfuscator/modules/ConstantAnalyzer.java:
Now extends SimpleAnalyzer.
(canonizeIfaceRef): Removed; it is now inherited.
(canonizeRef): likewise.
Big updates to handle jsr correctly.
(handleOpcode): Moved method to BlockInfo.
* net/sf/jode/obfuscator/modules/SimpleAnalyzer.java:
(canonizeIfaceRef): New method, copied from ConstantAnalyzer.
(canonizeRef): call canonizeIfaceRef for interfaces.
* net/sf/jode/util/UnifyHash.java
(iterateHashCode): iterator now supports remove().
(remove): New method.
git-svn-id: https://svn.code.sf.net/p/jode/code/trunk@1337 379699f6-c40d-0410-875b-85095c16579e
23 years ago
|
|
|
int delta;
|
|
|
|
/**
|
|
|
|
* The stack height at the beginning of this block.
|
|
|
|
* Only valid after the block was inserted in a BasicBlocks and
|
|
|
|
* the updateMaxStackLocals() of BasicBlocks was called.
|
|
|
|
*/
|
|
|
|
int stackHeight;
|
* ConstantInstruction.java,IncInstruction.java,ReferenceInstruction.java,SlotInstruction.java,TypeDimensionInstruction.java,TypeInstruction.java: Class and Constructors no longer public.
* Instruction.java (forOpcode): added method to create instructions.
* SlotInstruction.java,IncInstruction.java: Use a LocalVariableInfo
entry instead of slot+addr
* BasicBlockReader.java, BasicBlockWriter.java: Adapted Instruction interface.
* BinaryInfo.java: package private class now.
* BinaryInfo.java,FieldInfo.java,MethodInfo.java: Made some methods
package private.
* BasicBlocks.java (getAllInstructions): removed.
(read,readAttribute): no longer protected.
* ClassInfo.java (isGuessed): added.
All classes: bug fixes, etc.
git-svn-id: https://svn.code.sf.net/p/jode/code/trunk@1266 379699f6-c40d-0410-875b-85095c16579e
24 years ago
|
|
|
|
|
|
|
/**
|
Documentation updates (INSTALL, javadoc).
Added JUnit Test cases.
* build.xml: Big update.
* net/sf/jode/bytecode/BasicBlock.java:
(updateMaxStackLocals): new method to calculate maxStack and
maxLocals.
(setBlocks): fixed calculation of handlers, call updateMaxLocals.
* net/sf/jode/bytecode/BasicBlockReader.java:
(maxLocals, maxStack): new fields.
(readCode): read maxStack/Locals into private fields.
(convert): check that maxStack/Locals match what we calculate.
* net/sf/jode/bytecode/BinaryInfo.java:
(getKnownAttributeCount): renamed to...
(getAttributeCount): ... this, and also count internal attributes.
Made it protected.
(readAttribute): made protected.
(drop): made protected.
(prepareAttributes): made protected.
(writeKnownAttributes): removed.
(writeAttributes): made protected, use getAttributeCount.
Changed policy: it doesn't call writeKnownAttribute, but instead
it expects sub classes to override this method.
(getAttributeSize): made protected, subclasses should override it.
Changed all subclasses to new policy.
* net/sf/jode/bytecode/Block.java:
(lineNr): Removed, it wasn't used.
(pop,push): Removed, replaced by ...
(maxpop,maxpush,delta): ... these, with slightly changed semantics.
(stackHeight): New variable.
(Block): Default Constructor doesn't initialize fields now.
(getCatchers): Renamed to ...
(getHandlers): ... this, changed all callers.
(initCode): Calculate maxpop, maxpush, delta correctly.
(getStackPopPush): Changed accordingly to new fields.
(setCode): Removed debugging output for illegal contents.
* net/sf/jode/bytecode/Classes.java: Reworked handling of inner
classes.
(innerClasses): Field mustn't be null anymore when loaded.
(setName): Update class in classpath.
* net/sf/jode/bytecode/ClassPath.java:
(renameClassInfo): new function, should only used by ClassInfo.
* net/sf/jode/bytecode/ConstantPool.java: made public.
(getUTF8,getRef,getClassType,getClassName): Don't allow the 0 index.
(iterateClassNames): New method.
* net/sf/jode/decompiler/Main.java:
(decompileClass): Catch ClassFormatExceptions and decompile
remaining classes.
* net/sf/jode/obfuscator/ClassIdentifier.java:
Updated handling of inner/extra classes to new ClassInfo behaviour.
(initSuperClasses): Load DECLARATION of super classes.
* net/sf/jode/obfuscator/PackageIdentifier.java:
Replace deprecated methods of ClassInfo with corresponding classpath
calls.
(loadMatchingClasses): Initialize packages loaded on demand if we
are initialize.
* net/sf/jode/obfuscator/modules/ConstantAnalyzer.java:
Now extends SimpleAnalyzer.
(canonizeIfaceRef): Removed; it is now inherited.
(canonizeRef): likewise.
Big updates to handle jsr correctly.
(handleOpcode): Moved method to BlockInfo.
* net/sf/jode/obfuscator/modules/SimpleAnalyzer.java:
(canonizeIfaceRef): New method, copied from ConstantAnalyzer.
(canonizeRef): call canonizeIfaceRef for interfaces.
* net/sf/jode/util/UnifyHash.java
(iterateHashCode): iterator now supports remove().
(remove): New method.
git-svn-id: https://svn.code.sf.net/p/jode/code/trunk@1337 379699f6-c40d-0410-875b-85095c16579e
23 years ago
|
|
|
* Creates a new block uninitialized block. You mustn't really
|
|
|
|
* use it (except as successor for other blocks) until you have
|
|
|
|
* set the code.
|
|
|
|
*/
|
|
|
|
public Block() {
|
|
|
|
}
|
Documentation updates (INSTALL, javadoc).
Added JUnit Test cases.
* build.xml: Big update.
* net/sf/jode/bytecode/BasicBlock.java:
(updateMaxStackLocals): new method to calculate maxStack and
maxLocals.
(setBlocks): fixed calculation of handlers, call updateMaxLocals.
* net/sf/jode/bytecode/BasicBlockReader.java:
(maxLocals, maxStack): new fields.
(readCode): read maxStack/Locals into private fields.
(convert): check that maxStack/Locals match what we calculate.
* net/sf/jode/bytecode/BinaryInfo.java:
(getKnownAttributeCount): renamed to...
(getAttributeCount): ... this, and also count internal attributes.
Made it protected.
(readAttribute): made protected.
(drop): made protected.
(prepareAttributes): made protected.
(writeKnownAttributes): removed.
(writeAttributes): made protected, use getAttributeCount.
Changed policy: it doesn't call writeKnownAttribute, but instead
it expects sub classes to override this method.
(getAttributeSize): made protected, subclasses should override it.
Changed all subclasses to new policy.
* net/sf/jode/bytecode/Block.java:
(lineNr): Removed, it wasn't used.
(pop,push): Removed, replaced by ...
(maxpop,maxpush,delta): ... these, with slightly changed semantics.
(stackHeight): New variable.
(Block): Default Constructor doesn't initialize fields now.
(getCatchers): Renamed to ...
(getHandlers): ... this, changed all callers.
(initCode): Calculate maxpop, maxpush, delta correctly.
(getStackPopPush): Changed accordingly to new fields.
(setCode): Removed debugging output for illegal contents.
* net/sf/jode/bytecode/Classes.java: Reworked handling of inner
classes.
(innerClasses): Field mustn't be null anymore when loaded.
(setName): Update class in classpath.
* net/sf/jode/bytecode/ClassPath.java:
(renameClassInfo): new function, should only used by ClassInfo.
* net/sf/jode/bytecode/ConstantPool.java: made public.
(getUTF8,getRef,getClassType,getClassName): Don't allow the 0 index.
(iterateClassNames): New method.
* net/sf/jode/decompiler/Main.java:
(decompileClass): Catch ClassFormatExceptions and decompile
remaining classes.
* net/sf/jode/obfuscator/ClassIdentifier.java:
Updated handling of inner/extra classes to new ClassInfo behaviour.
(initSuperClasses): Load DECLARATION of super classes.
* net/sf/jode/obfuscator/PackageIdentifier.java:
Replace deprecated methods of ClassInfo with corresponding classpath
calls.
(loadMatchingClasses): Initialize packages loaded on demand if we
are initialize.
* net/sf/jode/obfuscator/modules/ConstantAnalyzer.java:
Now extends SimpleAnalyzer.
(canonizeIfaceRef): Removed; it is now inherited.
(canonizeRef): likewise.
Big updates to handle jsr correctly.
(handleOpcode): Moved method to BlockInfo.
* net/sf/jode/obfuscator/modules/SimpleAnalyzer.java:
(canonizeIfaceRef): New method, copied from ConstantAnalyzer.
(canonizeRef): call canonizeIfaceRef for interfaces.
* net/sf/jode/util/UnifyHash.java
(iterateHashCode): iterator now supports remove().
(remove): New method.
git-svn-id: https://svn.code.sf.net/p/jode/code/trunk@1337 379699f6-c40d-0410-875b-85095c16579e
23 years ago
|
|
|
|
|
|
|
/**
|
|
|
|
* Gets the list of instructions. The returned list should not be
|
|
|
|
* modified, except that the instructions (but not their opcodes)
|
|
|
|
* may be modified.
|
|
|
|
*/
|
* ConstantInstruction.java,IncInstruction.java,ReferenceInstruction.java,SlotInstruction.java,TypeDimensionInstruction.java,TypeInstruction.java: Class and Constructors no longer public.
* Instruction.java (forOpcode): added method to create instructions.
* SlotInstruction.java,IncInstruction.java: Use a LocalVariableInfo
entry instead of slot+addr
* BasicBlockReader.java, BasicBlockWriter.java: Adapted Instruction interface.
* BinaryInfo.java: package private class now.
* BinaryInfo.java,FieldInfo.java,MethodInfo.java: Made some methods
package private.
* BasicBlocks.java (getAllInstructions): removed.
(read,readAttribute): no longer protected.
* ClassInfo.java (isGuessed): added.
All classes: bug fixes, etc.
git-svn-id: https://svn.code.sf.net/p/jode/code/trunk@1266 379699f6-c40d-0410-875b-85095c16579e
24 years ago
|
|
|
public Instruction[] getInstructions() {
|
|
|
|
return instrs;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Gets the successor array. The last successor is the next basic
|
|
|
|
* block that is jumped to via goto or the default part of a
|
|
|
|
* switch. For conditional jumps and jsrs the second successor gives
|
|
|
|
* the destination.
|
|
|
|
*/
|
|
|
|
public Block[] getSuccs() {
|
|
|
|
return succs;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
Documentation updates (INSTALL, javadoc).
Added JUnit Test cases.
* build.xml: Big update.
* net/sf/jode/bytecode/BasicBlock.java:
(updateMaxStackLocals): new method to calculate maxStack and
maxLocals.
(setBlocks): fixed calculation of handlers, call updateMaxLocals.
* net/sf/jode/bytecode/BasicBlockReader.java:
(maxLocals, maxStack): new fields.
(readCode): read maxStack/Locals into private fields.
(convert): check that maxStack/Locals match what we calculate.
* net/sf/jode/bytecode/BinaryInfo.java:
(getKnownAttributeCount): renamed to...
(getAttributeCount): ... this, and also count internal attributes.
Made it protected.
(readAttribute): made protected.
(drop): made protected.
(prepareAttributes): made protected.
(writeKnownAttributes): removed.
(writeAttributes): made protected, use getAttributeCount.
Changed policy: it doesn't call writeKnownAttribute, but instead
it expects sub classes to override this method.
(getAttributeSize): made protected, subclasses should override it.
Changed all subclasses to new policy.
* net/sf/jode/bytecode/Block.java:
(lineNr): Removed, it wasn't used.
(pop,push): Removed, replaced by ...
(maxpop,maxpush,delta): ... these, with slightly changed semantics.
(stackHeight): New variable.
(Block): Default Constructor doesn't initialize fields now.
(getCatchers): Renamed to ...
(getHandlers): ... this, changed all callers.
(initCode): Calculate maxpop, maxpush, delta correctly.
(getStackPopPush): Changed accordingly to new fields.
(setCode): Removed debugging output for illegal contents.
* net/sf/jode/bytecode/Classes.java: Reworked handling of inner
classes.
(innerClasses): Field mustn't be null anymore when loaded.
(setName): Update class in classpath.
* net/sf/jode/bytecode/ClassPath.java:
(renameClassInfo): new function, should only used by ClassInfo.
* net/sf/jode/bytecode/ConstantPool.java: made public.
(getUTF8,getRef,getClassType,getClassName): Don't allow the 0 index.
(iterateClassNames): New method.
* net/sf/jode/decompiler/Main.java:
(decompileClass): Catch ClassFormatExceptions and decompile
remaining classes.
* net/sf/jode/obfuscator/ClassIdentifier.java:
Updated handling of inner/extra classes to new ClassInfo behaviour.
(initSuperClasses): Load DECLARATION of super classes.
* net/sf/jode/obfuscator/PackageIdentifier.java:
Replace deprecated methods of ClassInfo with corresponding classpath
calls.
(loadMatchingClasses): Initialize packages loaded on demand if we
are initialize.
* net/sf/jode/obfuscator/modules/ConstantAnalyzer.java:
Now extends SimpleAnalyzer.
(canonizeIfaceRef): Removed; it is now inherited.
(canonizeRef): likewise.
Big updates to handle jsr correctly.
(handleOpcode): Moved method to BlockInfo.
* net/sf/jode/obfuscator/modules/SimpleAnalyzer.java:
(canonizeIfaceRef): New method, copied from ConstantAnalyzer.
(canonizeRef): call canonizeIfaceRef for interfaces.
* net/sf/jode/util/UnifyHash.java
(iterateHashCode): iterator now supports remove().
(remove): New method.
git-svn-id: https://svn.code.sf.net/p/jode/code/trunk@1337 379699f6-c40d-0410-875b-85095c16579e
23 years ago
|
|
|
* Gets the exception handlers whose try region contains this
|
|
|
|
* block. You can't set them since they are calculated
|
|
|
|
* automatically.
|
|
|
|
* @return the exception handlers.
|
Documentation updates (INSTALL, javadoc).
Added JUnit Test cases.
* build.xml: Big update.
* net/sf/jode/bytecode/BasicBlock.java:
(updateMaxStackLocals): new method to calculate maxStack and
maxLocals.
(setBlocks): fixed calculation of handlers, call updateMaxLocals.
* net/sf/jode/bytecode/BasicBlockReader.java:
(maxLocals, maxStack): new fields.
(readCode): read maxStack/Locals into private fields.
(convert): check that maxStack/Locals match what we calculate.
* net/sf/jode/bytecode/BinaryInfo.java:
(getKnownAttributeCount): renamed to...
(getAttributeCount): ... this, and also count internal attributes.
Made it protected.
(readAttribute): made protected.
(drop): made protected.
(prepareAttributes): made protected.
(writeKnownAttributes): removed.
(writeAttributes): made protected, use getAttributeCount.
Changed policy: it doesn't call writeKnownAttribute, but instead
it expects sub classes to override this method.
(getAttributeSize): made protected, subclasses should override it.
Changed all subclasses to new policy.
* net/sf/jode/bytecode/Block.java:
(lineNr): Removed, it wasn't used.
(pop,push): Removed, replaced by ...
(maxpop,maxpush,delta): ... these, with slightly changed semantics.
(stackHeight): New variable.
(Block): Default Constructor doesn't initialize fields now.
(getCatchers): Renamed to ...
(getHandlers): ... this, changed all callers.
(initCode): Calculate maxpop, maxpush, delta correctly.
(getStackPopPush): Changed accordingly to new fields.
(setCode): Removed debugging output for illegal contents.
* net/sf/jode/bytecode/Classes.java: Reworked handling of inner
classes.
(innerClasses): Field mustn't be null anymore when loaded.
(setName): Update class in classpath.
* net/sf/jode/bytecode/ClassPath.java:
(renameClassInfo): new function, should only used by ClassInfo.
* net/sf/jode/bytecode/ConstantPool.java: made public.
(getUTF8,getRef,getClassType,getClassName): Don't allow the 0 index.
(iterateClassNames): New method.
* net/sf/jode/decompiler/Main.java:
(decompileClass): Catch ClassFormatExceptions and decompile
remaining classes.
* net/sf/jode/obfuscator/ClassIdentifier.java:
Updated handling of inner/extra classes to new ClassInfo behaviour.
(initSuperClasses): Load DECLARATION of super classes.
* net/sf/jode/obfuscator/PackageIdentifier.java:
Replace deprecated methods of ClassInfo with corresponding classpath
calls.
(loadMatchingClasses): Initialize packages loaded on demand if we
are initialize.
* net/sf/jode/obfuscator/modules/ConstantAnalyzer.java:
Now extends SimpleAnalyzer.
(canonizeIfaceRef): Removed; it is now inherited.
(canonizeRef): likewise.
Big updates to handle jsr correctly.
(handleOpcode): Moved method to BlockInfo.
* net/sf/jode/obfuscator/modules/SimpleAnalyzer.java:
(canonizeIfaceRef): New method, copied from ConstantAnalyzer.
(canonizeRef): call canonizeIfaceRef for interfaces.
* net/sf/jode/util/UnifyHash.java
(iterateHashCode): iterator now supports remove().
(remove): New method.
git-svn-id: https://svn.code.sf.net/p/jode/code/trunk@1337 379699f6-c40d-0410-875b-85095c16579e
23 years ago
|
|
|
* @see BasicBlocks#setBlocks
|
|
|
|
*/
|
Documentation updates (INSTALL, javadoc).
Added JUnit Test cases.
* build.xml: Big update.
* net/sf/jode/bytecode/BasicBlock.java:
(updateMaxStackLocals): new method to calculate maxStack and
maxLocals.
(setBlocks): fixed calculation of handlers, call updateMaxLocals.
* net/sf/jode/bytecode/BasicBlockReader.java:
(maxLocals, maxStack): new fields.
(readCode): read maxStack/Locals into private fields.
(convert): check that maxStack/Locals match what we calculate.
* net/sf/jode/bytecode/BinaryInfo.java:
(getKnownAttributeCount): renamed to...
(getAttributeCount): ... this, and also count internal attributes.
Made it protected.
(readAttribute): made protected.
(drop): made protected.
(prepareAttributes): made protected.
(writeKnownAttributes): removed.
(writeAttributes): made protected, use getAttributeCount.
Changed policy: it doesn't call writeKnownAttribute, but instead
it expects sub classes to override this method.
(getAttributeSize): made protected, subclasses should override it.
Changed all subclasses to new policy.
* net/sf/jode/bytecode/Block.java:
(lineNr): Removed, it wasn't used.
(pop,push): Removed, replaced by ...
(maxpop,maxpush,delta): ... these, with slightly changed semantics.
(stackHeight): New variable.
(Block): Default Constructor doesn't initialize fields now.
(getCatchers): Renamed to ...
(getHandlers): ... this, changed all callers.
(initCode): Calculate maxpop, maxpush, delta correctly.
(getStackPopPush): Changed accordingly to new fields.
(setCode): Removed debugging output for illegal contents.
* net/sf/jode/bytecode/Classes.java: Reworked handling of inner
classes.
(innerClasses): Field mustn't be null anymore when loaded.
(setName): Update class in classpath.
* net/sf/jode/bytecode/ClassPath.java:
(renameClassInfo): new function, should only used by ClassInfo.
* net/sf/jode/bytecode/ConstantPool.java: made public.
(getUTF8,getRef,getClassType,getClassName): Don't allow the 0 index.
(iterateClassNames): New method.
* net/sf/jode/decompiler/Main.java:
(decompileClass): Catch ClassFormatExceptions and decompile
remaining classes.
* net/sf/jode/obfuscator/ClassIdentifier.java:
Updated handling of inner/extra classes to new ClassInfo behaviour.
(initSuperClasses): Load DECLARATION of super classes.
* net/sf/jode/obfuscator/PackageIdentifier.java:
Replace deprecated methods of ClassInfo with corresponding classpath
calls.
(loadMatchingClasses): Initialize packages loaded on demand if we
are initialize.
* net/sf/jode/obfuscator/modules/ConstantAnalyzer.java:
Now extends SimpleAnalyzer.
(canonizeIfaceRef): Removed; it is now inherited.
(canonizeRef): likewise.
Big updates to handle jsr correctly.
(handleOpcode): Moved method to BlockInfo.
* net/sf/jode/obfuscator/modules/SimpleAnalyzer.java:
(canonizeIfaceRef): New method, copied from ConstantAnalyzer.
(canonizeRef): call canonizeIfaceRef for interfaces.
* net/sf/jode/util/UnifyHash.java
(iterateHashCode): iterator now supports remove().
(remove): New method.
git-svn-id: https://svn.code.sf.net/p/jode/code/trunk@1337 379699f6-c40d-0410-875b-85095c16579e
23 years ago
|
|
|
public Handler[] getHandlers() {
|
|
|
|
return catchers;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Gets the block number. The block numbers are consecutive number
|
|
|
|
* from 0 to the number of blocks in a method. The equation
|
|
|
|
* <pre> BasicBlocks.getBlock()[i].getBlockNr() == i </pre>
|
|
|
|
* always holds (as long as you don't do something dirty, like adding
|
|
|
|
* the same block to different BasicBlocks, or to the same but more
|
|
|
|
* than once).
|
|
|
|
* @return the block number.
|
|
|
|
*/
|
|
|
|
public int getBlockNr() {
|
|
|
|
return blockNr;
|
|
|
|
}
|
|
|
|
|
* ConstantInstruction.java,IncInstruction.java,ReferenceInstruction.java,SlotInstruction.java,TypeDimensionInstruction.java,TypeInstruction.java: Class and Constructors no longer public.
* Instruction.java (forOpcode): added method to create instructions.
* SlotInstruction.java,IncInstruction.java: Use a LocalVariableInfo
entry instead of slot+addr
* BasicBlockReader.java, BasicBlockWriter.java: Adapted Instruction interface.
* BinaryInfo.java: package private class now.
* BinaryInfo.java,FieldInfo.java,MethodInfo.java: Made some methods
package private.
* BasicBlocks.java (getAllInstructions): removed.
(read,readAttribute): no longer protected.
* ClassInfo.java (isGuessed): added.
All classes: bug fixes, etc.
git-svn-id: https://svn.code.sf.net/p/jode/code/trunk@1266 379699f6-c40d-0410-875b-85095c16579e
24 years ago
|
|
|
private void initCode() {
|
|
|
|
int size = instrs.length;
|
Documentation updates (INSTALL, javadoc).
Added JUnit Test cases.
* build.xml: Big update.
* net/sf/jode/bytecode/BasicBlock.java:
(updateMaxStackLocals): new method to calculate maxStack and
maxLocals.
(setBlocks): fixed calculation of handlers, call updateMaxLocals.
* net/sf/jode/bytecode/BasicBlockReader.java:
(maxLocals, maxStack): new fields.
(readCode): read maxStack/Locals into private fields.
(convert): check that maxStack/Locals match what we calculate.
* net/sf/jode/bytecode/BinaryInfo.java:
(getKnownAttributeCount): renamed to...
(getAttributeCount): ... this, and also count internal attributes.
Made it protected.
(readAttribute): made protected.
(drop): made protected.
(prepareAttributes): made protected.
(writeKnownAttributes): removed.
(writeAttributes): made protected, use getAttributeCount.
Changed policy: it doesn't call writeKnownAttribute, but instead
it expects sub classes to override this method.
(getAttributeSize): made protected, subclasses should override it.
Changed all subclasses to new policy.
* net/sf/jode/bytecode/Block.java:
(lineNr): Removed, it wasn't used.
(pop,push): Removed, replaced by ...
(maxpop,maxpush,delta): ... these, with slightly changed semantics.
(stackHeight): New variable.
(Block): Default Constructor doesn't initialize fields now.
(getCatchers): Renamed to ...
(getHandlers): ... this, changed all callers.
(initCode): Calculate maxpop, maxpush, delta correctly.
(getStackPopPush): Changed accordingly to new fields.
(setCode): Removed debugging output for illegal contents.
* net/sf/jode/bytecode/Classes.java: Reworked handling of inner
classes.
(innerClasses): Field mustn't be null anymore when loaded.
(setName): Update class in classpath.
* net/sf/jode/bytecode/ClassPath.java:
(renameClassInfo): new function, should only used by ClassInfo.
* net/sf/jode/bytecode/ConstantPool.java: made public.
(getUTF8,getRef,getClassType,getClassName): Don't allow the 0 index.
(iterateClassNames): New method.
* net/sf/jode/decompiler/Main.java:
(decompileClass): Catch ClassFormatExceptions and decompile
remaining classes.
* net/sf/jode/obfuscator/ClassIdentifier.java:
Updated handling of inner/extra classes to new ClassInfo behaviour.
(initSuperClasses): Load DECLARATION of super classes.
* net/sf/jode/obfuscator/PackageIdentifier.java:
Replace deprecated methods of ClassInfo with corresponding classpath
calls.
(loadMatchingClasses): Initialize packages loaded on demand if we
are initialize.
* net/sf/jode/obfuscator/modules/ConstantAnalyzer.java:
Now extends SimpleAnalyzer.
(canonizeIfaceRef): Removed; it is now inherited.
(canonizeRef): likewise.
Big updates to handle jsr correctly.
(handleOpcode): Moved method to BlockInfo.
* net/sf/jode/obfuscator/modules/SimpleAnalyzer.java:
(canonizeIfaceRef): New method, copied from ConstantAnalyzer.
(canonizeRef): call canonizeIfaceRef for interfaces.
* net/sf/jode/util/UnifyHash.java
(iterateHashCode): iterator now supports remove().
(remove): New method.
git-svn-id: https://svn.code.sf.net/p/jode/code/trunk@1337 379699f6-c40d-0410-875b-85095c16579e
23 years ago
|
|
|
maxpop = maxpush = 0;
|
* ConstantInstruction.java,IncInstruction.java,ReferenceInstruction.java,SlotInstruction.java,TypeDimensionInstruction.java,TypeInstruction.java: Class and Constructors no longer public.
* Instruction.java (forOpcode): added method to create instructions.
* SlotInstruction.java,IncInstruction.java: Use a LocalVariableInfo
entry instead of slot+addr
* BasicBlockReader.java, BasicBlockWriter.java: Adapted Instruction interface.
* BinaryInfo.java: package private class now.
* BinaryInfo.java,FieldInfo.java,MethodInfo.java: Made some methods
package private.
* BasicBlocks.java (getAllInstructions): removed.
(read,readAttribute): no longer protected.
* ClassInfo.java (isGuessed): added.
All classes: bug fixes, etc.
git-svn-id: https://svn.code.sf.net/p/jode/code/trunk@1266 379699f6-c40d-0410-875b-85095c16579e
24 years ago
|
|
|
int depth = 0;
|
|
|
|
int poppush[] = new int[2];
|
|
|
|
boolean needGoto = true;
|
|
|
|
for (int i = 0; i < size; i++) {
|
* ConstantInstruction.java,IncInstruction.java,ReferenceInstruction.java,SlotInstruction.java,TypeDimensionInstruction.java,TypeInstruction.java: Class and Constructors no longer public.
* Instruction.java (forOpcode): added method to create instructions.
* SlotInstruction.java,IncInstruction.java: Use a LocalVariableInfo
entry instead of slot+addr
* BasicBlockReader.java, BasicBlockWriter.java: Adapted Instruction interface.
* BinaryInfo.java: package private class now.
* BinaryInfo.java,FieldInfo.java,MethodInfo.java: Made some methods
package private.
* BasicBlocks.java (getAllInstructions): removed.
(read,readAttribute): no longer protected.
* ClassInfo.java (isGuessed): added.
All classes: bug fixes, etc.
git-svn-id: https://svn.code.sf.net/p/jode/code/trunk@1266 379699f6-c40d-0410-875b-85095c16579e
24 years ago
|
|
|
instrs[i].getStackPopPush(poppush);
|
Documentation updates (INSTALL, javadoc).
Added JUnit Test cases.
* build.xml: Big update.
* net/sf/jode/bytecode/BasicBlock.java:
(updateMaxStackLocals): new method to calculate maxStack and
maxLocals.
(setBlocks): fixed calculation of handlers, call updateMaxLocals.
* net/sf/jode/bytecode/BasicBlockReader.java:
(maxLocals, maxStack): new fields.
(readCode): read maxStack/Locals into private fields.
(convert): check that maxStack/Locals match what we calculate.
* net/sf/jode/bytecode/BinaryInfo.java:
(getKnownAttributeCount): renamed to...
(getAttributeCount): ... this, and also count internal attributes.
Made it protected.
(readAttribute): made protected.
(drop): made protected.
(prepareAttributes): made protected.
(writeKnownAttributes): removed.
(writeAttributes): made protected, use getAttributeCount.
Changed policy: it doesn't call writeKnownAttribute, but instead
it expects sub classes to override this method.
(getAttributeSize): made protected, subclasses should override it.
Changed all subclasses to new policy.
* net/sf/jode/bytecode/Block.java:
(lineNr): Removed, it wasn't used.
(pop,push): Removed, replaced by ...
(maxpop,maxpush,delta): ... these, with slightly changed semantics.
(stackHeight): New variable.
(Block): Default Constructor doesn't initialize fields now.
(getCatchers): Renamed to ...
(getHandlers): ... this, changed all callers.
(initCode): Calculate maxpop, maxpush, delta correctly.
(getStackPopPush): Changed accordingly to new fields.
(setCode): Removed debugging output for illegal contents.
* net/sf/jode/bytecode/Classes.java: Reworked handling of inner
classes.
(innerClasses): Field mustn't be null anymore when loaded.
(setName): Update class in classpath.
* net/sf/jode/bytecode/ClassPath.java:
(renameClassInfo): new function, should only used by ClassInfo.
* net/sf/jode/bytecode/ConstantPool.java: made public.
(getUTF8,getRef,getClassType,getClassName): Don't allow the 0 index.
(iterateClassNames): New method.
* net/sf/jode/decompiler/Main.java:
(decompileClass): Catch ClassFormatExceptions and decompile
remaining classes.
* net/sf/jode/obfuscator/ClassIdentifier.java:
Updated handling of inner/extra classes to new ClassInfo behaviour.
(initSuperClasses): Load DECLARATION of super classes.
* net/sf/jode/obfuscator/PackageIdentifier.java:
Replace deprecated methods of ClassInfo with corresponding classpath
calls.
(loadMatchingClasses): Initialize packages loaded on demand if we
are initialize.
* net/sf/jode/obfuscator/modules/ConstantAnalyzer.java:
Now extends SimpleAnalyzer.
(canonizeIfaceRef): Removed; it is now inherited.
(canonizeRef): likewise.
Big updates to handle jsr correctly.
(handleOpcode): Moved method to BlockInfo.
* net/sf/jode/obfuscator/modules/SimpleAnalyzer.java:
(canonizeIfaceRef): New method, copied from ConstantAnalyzer.
(canonizeRef): call canonizeIfaceRef for interfaces.
* net/sf/jode/util/UnifyHash.java
(iterateHashCode): iterator now supports remove().
(remove): New method.
git-svn-id: https://svn.code.sf.net/p/jode/code/trunk@1337 379699f6-c40d-0410-875b-85095c16579e
23 years ago
|
|
|
depth -= poppush[0];
|
|
|
|
if (maxpop < -depth)
|
|
|
|
maxpop = -depth;
|
|
|
|
depth += poppush[1];
|
|
|
|
if (maxpush < depth)
|
|
|
|
maxpush = depth;
|
* ConstantInstruction.java,IncInstruction.java,ReferenceInstruction.java,SlotInstruction.java,TypeDimensionInstruction.java,TypeInstruction.java: Class and Constructors no longer public.
* Instruction.java (forOpcode): added method to create instructions.
* SlotInstruction.java,IncInstruction.java: Use a LocalVariableInfo
entry instead of slot+addr
* BasicBlockReader.java, BasicBlockWriter.java: Adapted Instruction interface.
* BinaryInfo.java: package private class now.
* BinaryInfo.java,FieldInfo.java,MethodInfo.java: Made some methods
package private.
* BasicBlocks.java (getAllInstructions): removed.
(read,readAttribute): no longer protected.
* ClassInfo.java (isGuessed): added.
All classes: bug fixes, etc.
git-svn-id: https://svn.code.sf.net/p/jode/code/trunk@1266 379699f6-c40d-0410-875b-85095c16579e
24 years ago
|
|
|
|
|
|
|
int opcode = instrs[i].getOpcode();
|
|
|
|
switch (opcode) {
|
|
|
|
case Opcodes.opc_goto:
|
|
|
|
throw new IllegalArgumentException("goto in block");
|
|
|
|
|
|
|
|
case Opcodes.opc_lookupswitch:
|
* ConstantInstruction.java,IncInstruction.java,ReferenceInstruction.java,SlotInstruction.java,TypeDimensionInstruction.java,TypeInstruction.java: Class and Constructors no longer public.
* Instruction.java (forOpcode): added method to create instructions.
* SlotInstruction.java,IncInstruction.java: Use a LocalVariableInfo
entry instead of slot+addr
* BasicBlockReader.java, BasicBlockWriter.java: Adapted Instruction interface.
* BinaryInfo.java: package private class now.
* BinaryInfo.java,FieldInfo.java,MethodInfo.java: Made some methods
package private.
* BasicBlocks.java (getAllInstructions): removed.
(read,readAttribute): no longer protected.
* ClassInfo.java (isGuessed): added.
All classes: bug fixes, etc.
git-svn-id: https://svn.code.sf.net/p/jode/code/trunk@1266 379699f6-c40d-0410-875b-85095c16579e
24 years ago
|
|
|
if (succs.length != instrs[i].getValues().length + 1)
|
|
|
|
throw new IllegalArgumentException
|
Documentation updates (INSTALL, javadoc).
Added JUnit Test cases.
* build.xml: Big update.
* net/sf/jode/bytecode/BasicBlock.java:
(updateMaxStackLocals): new method to calculate maxStack and
maxLocals.
(setBlocks): fixed calculation of handlers, call updateMaxLocals.
* net/sf/jode/bytecode/BasicBlockReader.java:
(maxLocals, maxStack): new fields.
(readCode): read maxStack/Locals into private fields.
(convert): check that maxStack/Locals match what we calculate.
* net/sf/jode/bytecode/BinaryInfo.java:
(getKnownAttributeCount): renamed to...
(getAttributeCount): ... this, and also count internal attributes.
Made it protected.
(readAttribute): made protected.
(drop): made protected.
(prepareAttributes): made protected.
(writeKnownAttributes): removed.
(writeAttributes): made protected, use getAttributeCount.
Changed policy: it doesn't call writeKnownAttribute, but instead
it expects sub classes to override this method.
(getAttributeSize): made protected, subclasses should override it.
Changed all subclasses to new policy.
* net/sf/jode/bytecode/Block.java:
(lineNr): Removed, it wasn't used.
(pop,push): Removed, replaced by ...
(maxpop,maxpush,delta): ... these, with slightly changed semantics.
(stackHeight): New variable.
(Block): Default Constructor doesn't initialize fields now.
(getCatchers): Renamed to ...
(getHandlers): ... this, changed all callers.
(initCode): Calculate maxpop, maxpush, delta correctly.
(getStackPopPush): Changed accordingly to new fields.
(setCode): Removed debugging output for illegal contents.
* net/sf/jode/bytecode/Classes.java: Reworked handling of inner
classes.
(innerClasses): Field mustn't be null anymore when loaded.
(setName): Update class in classpath.
* net/sf/jode/bytecode/ClassPath.java:
(renameClassInfo): new function, should only used by ClassInfo.
* net/sf/jode/bytecode/ConstantPool.java: made public.
(getUTF8,getRef,getClassType,getClassName): Don't allow the 0 index.
(iterateClassNames): New method.
* net/sf/jode/decompiler/Main.java:
(decompileClass): Catch ClassFormatExceptions and decompile
remaining classes.
* net/sf/jode/obfuscator/ClassIdentifier.java:
Updated handling of inner/extra classes to new ClassInfo behaviour.
(initSuperClasses): Load DECLARATION of super classes.
* net/sf/jode/obfuscator/PackageIdentifier.java:
Replace deprecated methods of ClassInfo with corresponding classpath
calls.
(loadMatchingClasses): Initialize packages loaded on demand if we
are initialize.
* net/sf/jode/obfuscator/modules/ConstantAnalyzer.java:
Now extends SimpleAnalyzer.
(canonizeIfaceRef): Removed; it is now inherited.
(canonizeRef): likewise.
Big updates to handle jsr correctly.
(handleOpcode): Moved method to BlockInfo.
* net/sf/jode/obfuscator/modules/SimpleAnalyzer.java:
(canonizeIfaceRef): New method, copied from ConstantAnalyzer.
(canonizeRef): call canonizeIfaceRef for interfaces.
* net/sf/jode/util/UnifyHash.java
(iterateHashCode): iterator now supports remove().
(remove): New method.
git-svn-id: https://svn.code.sf.net/p/jode/code/trunk@1337 379699f6-c40d-0410-875b-85095c16579e
23 years ago
|
|
|
("number of successors for switch doesn't match");
|
|
|
|
if (i != size - 1)
|
|
|
|
throw new IllegalArgumentException
|
|
|
|
("switch in the middle!");
|
* ConstantInstruction.java,IncInstruction.java,ReferenceInstruction.java,SlotInstruction.java,TypeDimensionInstruction.java,TypeInstruction.java: Class and Constructors no longer public.
* Instruction.java (forOpcode): added method to create instructions.
* SlotInstruction.java,IncInstruction.java: Use a LocalVariableInfo
entry instead of slot+addr
* BasicBlockReader.java, BasicBlockWriter.java: Adapted Instruction interface.
* BinaryInfo.java: package private class now.
* BinaryInfo.java,FieldInfo.java,MethodInfo.java: Made some methods
package private.
* BasicBlocks.java (getAllInstructions): removed.
(read,readAttribute): no longer protected.
* ClassInfo.java (isGuessed): added.
All classes: bug fixes, etc.
git-svn-id: https://svn.code.sf.net/p/jode/code/trunk@1266 379699f6-c40d-0410-875b-85095c16579e
24 years ago
|
|
|
needGoto = false;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case Opcodes.opc_ret: case Opcodes.opc_athrow:
|
|
|
|
case Opcodes.opc_ireturn: case Opcodes.opc_lreturn:
|
|
|
|
case Opcodes.opc_freturn: case Opcodes.opc_dreturn:
|
|
|
|
case Opcodes.opc_areturn: case Opcodes.opc_return:
|
* ConstantInstruction.java,IncInstruction.java,ReferenceInstruction.java,SlotInstruction.java,TypeDimensionInstruction.java,TypeInstruction.java: Class and Constructors no longer public.
* Instruction.java (forOpcode): added method to create instructions.
* SlotInstruction.java,IncInstruction.java: Use a LocalVariableInfo
entry instead of slot+addr
* BasicBlockReader.java, BasicBlockWriter.java: Adapted Instruction interface.
* BinaryInfo.java: package private class now.
* BinaryInfo.java,FieldInfo.java,MethodInfo.java: Made some methods
package private.
* BasicBlocks.java (getAllInstructions): removed.
(read,readAttribute): no longer protected.
* ClassInfo.java (isGuessed): added.
All classes: bug fixes, etc.
git-svn-id: https://svn.code.sf.net/p/jode/code/trunk@1266 379699f6-c40d-0410-875b-85095c16579e
24 years ago
|
|
|
if (succs.length != 0)
|
|
|
|
throw new IllegalArgumentException
|
|
|
|
("throw or return with successor.");
|
|
|
|
if (i != size - 1)
|
|
|
|
throw new IllegalArgumentException
|
|
|
|
("return in the middle!");
|
* ConstantInstruction.java,IncInstruction.java,ReferenceInstruction.java,SlotInstruction.java,TypeDimensionInstruction.java,TypeInstruction.java: Class and Constructors no longer public.
* Instruction.java (forOpcode): added method to create instructions.
* SlotInstruction.java,IncInstruction.java: Use a LocalVariableInfo
entry instead of slot+addr
* BasicBlockReader.java, BasicBlockWriter.java: Adapted Instruction interface.
* BinaryInfo.java: package private class now.
* BinaryInfo.java,FieldInfo.java,MethodInfo.java: Made some methods
package private.
* BasicBlocks.java (getAllInstructions): removed.
(read,readAttribute): no longer protected.
* ClassInfo.java (isGuessed): added.
All classes: bug fixes, etc.
git-svn-id: https://svn.code.sf.net/p/jode/code/trunk@1266 379699f6-c40d-0410-875b-85095c16579e
24 years ago
|
|
|
needGoto = false;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case Opcodes.opc_ifeq: case Opcodes.opc_ifne:
|
|
|
|
case Opcodes.opc_iflt: case Opcodes.opc_ifge:
|
|
|
|
case Opcodes.opc_ifgt: case Opcodes.opc_ifle:
|
|
|
|
case Opcodes.opc_if_icmpeq: case Opcodes.opc_if_icmpne:
|
|
|
|
case Opcodes.opc_if_icmplt: case Opcodes.opc_if_icmpge:
|
|
|
|
case Opcodes.opc_if_icmpgt: case Opcodes.opc_if_icmple:
|
|
|
|
case Opcodes.opc_if_acmpeq: case Opcodes.opc_if_acmpne:
|
|
|
|
case Opcodes.opc_ifnull: case Opcodes.opc_ifnonnull:
|
|
|
|
case Opcodes.opc_jsr:
|
* ConstantInstruction.java,IncInstruction.java,ReferenceInstruction.java,SlotInstruction.java,TypeDimensionInstruction.java,TypeInstruction.java: Class and Constructors no longer public.
* Instruction.java (forOpcode): added method to create instructions.
* SlotInstruction.java,IncInstruction.java: Use a LocalVariableInfo
entry instead of slot+addr
* BasicBlockReader.java, BasicBlockWriter.java: Adapted Instruction interface.
* BinaryInfo.java: package private class now.
* BinaryInfo.java,FieldInfo.java,MethodInfo.java: Made some methods
package private.
* BasicBlocks.java (getAllInstructions): removed.
(read,readAttribute): no longer protected.
* ClassInfo.java (isGuessed): added.
All classes: bug fixes, etc.
git-svn-id: https://svn.code.sf.net/p/jode/code/trunk@1266 379699f6-c40d-0410-875b-85095c16579e
24 years ago
|
|
|
if (succs.length != 2)
|
|
|
|
throw new IllegalArgumentException
|
|
|
|
("successors inappropriate for if/jsr");
|
* ConstantInstruction.java,IncInstruction.java,ReferenceInstruction.java,SlotInstruction.java,TypeDimensionInstruction.java,TypeInstruction.java: Class and Constructors no longer public.
* Instruction.java (forOpcode): added method to create instructions.
* SlotInstruction.java,IncInstruction.java: Use a LocalVariableInfo
entry instead of slot+addr
* BasicBlockReader.java, BasicBlockWriter.java: Adapted Instruction interface.
* BinaryInfo.java: package private class now.
* BinaryInfo.java,FieldInfo.java,MethodInfo.java: Made some methods
package private.
* BasicBlocks.java (getAllInstructions): removed.
(read,readAttribute): no longer protected.
* ClassInfo.java (isGuessed): added.
All classes: bug fixes, etc.
git-svn-id: https://svn.code.sf.net/p/jode/code/trunk@1266 379699f6-c40d-0410-875b-85095c16579e
24 years ago
|
|
|
if (succs[0] == null && opcode == Opcodes.opc_jsr)
|
|
|
|
throw new IllegalArgumentException
|
|
|
|
("null successors inappropriate for jsr");
|
|
|
|
if (i != size - 1)
|
|
|
|
throw new IllegalArgumentException
|
|
|
|
("if/jsr in the middle!");
|
* ConstantInstruction.java,IncInstruction.java,ReferenceInstruction.java,SlotInstruction.java,TypeDimensionInstruction.java,TypeInstruction.java: Class and Constructors no longer public.
* Instruction.java (forOpcode): added method to create instructions.
* SlotInstruction.java,IncInstruction.java: Use a LocalVariableInfo
entry instead of slot+addr
* BasicBlockReader.java, BasicBlockWriter.java: Adapted Instruction interface.
* BinaryInfo.java: package private class now.
* BinaryInfo.java,FieldInfo.java,MethodInfo.java: Made some methods
package private.
* BasicBlocks.java (getAllInstructions): removed.
(read,readAttribute): no longer protected.
* ClassInfo.java (isGuessed): added.
All classes: bug fixes, etc.
git-svn-id: https://svn.code.sf.net/p/jode/code/trunk@1266 379699f6-c40d-0410-875b-85095c16579e
24 years ago
|
|
|
needGoto = false;
|
|
|
|
}
|
|
|
|
}
|
Documentation updates (INSTALL, javadoc).
Added JUnit Test cases.
* build.xml: Big update.
* net/sf/jode/bytecode/BasicBlock.java:
(updateMaxStackLocals): new method to calculate maxStack and
maxLocals.
(setBlocks): fixed calculation of handlers, call updateMaxLocals.
* net/sf/jode/bytecode/BasicBlockReader.java:
(maxLocals, maxStack): new fields.
(readCode): read maxStack/Locals into private fields.
(convert): check that maxStack/Locals match what we calculate.
* net/sf/jode/bytecode/BinaryInfo.java:
(getKnownAttributeCount): renamed to...
(getAttributeCount): ... this, and also count internal attributes.
Made it protected.
(readAttribute): made protected.
(drop): made protected.
(prepareAttributes): made protected.
(writeKnownAttributes): removed.
(writeAttributes): made protected, use getAttributeCount.
Changed policy: it doesn't call writeKnownAttribute, but instead
it expects sub classes to override this method.
(getAttributeSize): made protected, subclasses should override it.
Changed all subclasses to new policy.
* net/sf/jode/bytecode/Block.java:
(lineNr): Removed, it wasn't used.
(pop,push): Removed, replaced by ...
(maxpop,maxpush,delta): ... these, with slightly changed semantics.
(stackHeight): New variable.
(Block): Default Constructor doesn't initialize fields now.
(getCatchers): Renamed to ...
(getHandlers): ... this, changed all callers.
(initCode): Calculate maxpop, maxpush, delta correctly.
(getStackPopPush): Changed accordingly to new fields.
(setCode): Removed debugging output for illegal contents.
* net/sf/jode/bytecode/Classes.java: Reworked handling of inner
classes.
(innerClasses): Field mustn't be null anymore when loaded.
(setName): Update class in classpath.
* net/sf/jode/bytecode/ClassPath.java:
(renameClassInfo): new function, should only used by ClassInfo.
* net/sf/jode/bytecode/ConstantPool.java: made public.
(getUTF8,getRef,getClassType,getClassName): Don't allow the 0 index.
(iterateClassNames): New method.
* net/sf/jode/decompiler/Main.java:
(decompileClass): Catch ClassFormatExceptions and decompile
remaining classes.
* net/sf/jode/obfuscator/ClassIdentifier.java:
Updated handling of inner/extra classes to new ClassInfo behaviour.
(initSuperClasses): Load DECLARATION of super classes.
* net/sf/jode/obfuscator/PackageIdentifier.java:
Replace deprecated methods of ClassInfo with corresponding classpath
calls.
(loadMatchingClasses): Initialize packages loaded on demand if we
are initialize.
* net/sf/jode/obfuscator/modules/ConstantAnalyzer.java:
Now extends SimpleAnalyzer.
(canonizeIfaceRef): Removed; it is now inherited.
(canonizeRef): likewise.
Big updates to handle jsr correctly.
(handleOpcode): Moved method to BlockInfo.
* net/sf/jode/obfuscator/modules/SimpleAnalyzer.java:
(canonizeIfaceRef): New method, copied from ConstantAnalyzer.
(canonizeRef): call canonizeIfaceRef for interfaces.
* net/sf/jode/util/UnifyHash.java
(iterateHashCode): iterator now supports remove().
(remove): New method.
git-svn-id: https://svn.code.sf.net/p/jode/code/trunk@1337 379699f6-c40d-0410-875b-85095c16579e
23 years ago
|
|
|
delta = depth;
|
* ConstantInstruction.java,IncInstruction.java,ReferenceInstruction.java,SlotInstruction.java,TypeDimensionInstruction.java,TypeInstruction.java: Class and Constructors no longer public.
* Instruction.java (forOpcode): added method to create instructions.
* SlotInstruction.java,IncInstruction.java: Use a LocalVariableInfo
entry instead of slot+addr
* BasicBlockReader.java, BasicBlockWriter.java: Adapted Instruction interface.
* BinaryInfo.java: package private class now.
* BinaryInfo.java,FieldInfo.java,MethodInfo.java: Made some methods
package private.
* BasicBlocks.java (getAllInstructions): removed.
(read,readAttribute): no longer protected.
* ClassInfo.java (isGuessed): added.
All classes: bug fixes, etc.
git-svn-id: https://svn.code.sf.net/p/jode/code/trunk@1266 379699f6-c40d-0410-875b-85095c16579e
24 years ago
|
|
|
if (needGoto && succs.length != 1)
|
|
|
|
throw new IllegalArgumentException("no single successor block");
|
|
|
|
}
|
* ConstantInstruction.java,IncInstruction.java,ReferenceInstruction.java,SlotInstruction.java,TypeDimensionInstruction.java,TypeInstruction.java: Class and Constructors no longer public.
* Instruction.java (forOpcode): added method to create instructions.
* SlotInstruction.java,IncInstruction.java: Use a LocalVariableInfo
entry instead of slot+addr
* BasicBlockReader.java, BasicBlockWriter.java: Adapted Instruction interface.
* BinaryInfo.java: package private class now.
* BinaryInfo.java,FieldInfo.java,MethodInfo.java: Made some methods
package private.
* BasicBlocks.java (getAllInstructions): removed.
(read,readAttribute): no longer protected.
* ClassInfo.java (isGuessed): added.
All classes: bug fixes, etc.
git-svn-id: https://svn.code.sf.net/p/jode/code/trunk@1266 379699f6-c40d-0410-875b-85095c16579e
24 years ago
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns the stack height at the beginning of the block. This
|
|
|
|
* is automatically calculated, when the block is inserted in a
|
|
|
|
* basic block.
|
|
|
|
*/
|
|
|
|
public int getStackHeight () {
|
|
|
|
return stackHeight;
|
|
|
|
}
|
|
|
|
|
* ConstantInstruction.java,IncInstruction.java,ReferenceInstruction.java,SlotInstruction.java,TypeDimensionInstruction.java,TypeInstruction.java: Class and Constructors no longer public.
* Instruction.java (forOpcode): added method to create instructions.
* SlotInstruction.java,IncInstruction.java: Use a LocalVariableInfo
entry instead of slot+addr
* BasicBlockReader.java, BasicBlockWriter.java: Adapted Instruction interface.
* BinaryInfo.java: package private class now.
* BinaryInfo.java,FieldInfo.java,MethodInfo.java: Made some methods
package private.
* BasicBlocks.java (getAllInstructions): removed.
(read,readAttribute): no longer protected.
* ClassInfo.java (isGuessed): added.
All classes: bug fixes, etc.
git-svn-id: https://svn.code.sf.net/p/jode/code/trunk@1266 379699f6-c40d-0410-875b-85095c16579e
24 years ago
|
|
|
public void getStackPopPush (int[] poppush) {
|
Documentation updates (INSTALL, javadoc).
Added JUnit Test cases.
* build.xml: Big update.
* net/sf/jode/bytecode/BasicBlock.java:
(updateMaxStackLocals): new method to calculate maxStack and
maxLocals.
(setBlocks): fixed calculation of handlers, call updateMaxLocals.
* net/sf/jode/bytecode/BasicBlockReader.java:
(maxLocals, maxStack): new fields.
(readCode): read maxStack/Locals into private fields.
(convert): check that maxStack/Locals match what we calculate.
* net/sf/jode/bytecode/BinaryInfo.java:
(getKnownAttributeCount): renamed to...
(getAttributeCount): ... this, and also count internal attributes.
Made it protected.
(readAttribute): made protected.
(drop): made protected.
(prepareAttributes): made protected.
(writeKnownAttributes): removed.
(writeAttributes): made protected, use getAttributeCount.
Changed policy: it doesn't call writeKnownAttribute, but instead
it expects sub classes to override this method.
(getAttributeSize): made protected, subclasses should override it.
Changed all subclasses to new policy.
* net/sf/jode/bytecode/Block.java:
(lineNr): Removed, it wasn't used.
(pop,push): Removed, replaced by ...
(maxpop,maxpush,delta): ... these, with slightly changed semantics.
(stackHeight): New variable.
(Block): Default Constructor doesn't initialize fields now.
(getCatchers): Renamed to ...
(getHandlers): ... this, changed all callers.
(initCode): Calculate maxpop, maxpush, delta correctly.
(getStackPopPush): Changed accordingly to new fields.
(setCode): Removed debugging output for illegal contents.
* net/sf/jode/bytecode/Classes.java: Reworked handling of inner
classes.
(innerClasses): Field mustn't be null anymore when loaded.
(setName): Update class in classpath.
* net/sf/jode/bytecode/ClassPath.java:
(renameClassInfo): new function, should only used by ClassInfo.
* net/sf/jode/bytecode/ConstantPool.java: made public.
(getUTF8,getRef,getClassType,getClassName): Don't allow the 0 index.
(iterateClassNames): New method.
* net/sf/jode/decompiler/Main.java:
(decompileClass): Catch ClassFormatExceptions and decompile
remaining classes.
* net/sf/jode/obfuscator/ClassIdentifier.java:
Updated handling of inner/extra classes to new ClassInfo behaviour.
(initSuperClasses): Load DECLARATION of super classes.
* net/sf/jode/obfuscator/PackageIdentifier.java:
Replace deprecated methods of ClassInfo with corresponding classpath
calls.
(loadMatchingClasses): Initialize packages loaded on demand if we
are initialize.
* net/sf/jode/obfuscator/modules/ConstantAnalyzer.java:
Now extends SimpleAnalyzer.
(canonizeIfaceRef): Removed; it is now inherited.
(canonizeRef): likewise.
Big updates to handle jsr correctly.
(handleOpcode): Moved method to BlockInfo.
* net/sf/jode/obfuscator/modules/SimpleAnalyzer.java:
(canonizeIfaceRef): New method, copied from ConstantAnalyzer.
(canonizeRef): call canonizeIfaceRef for interfaces.
* net/sf/jode/util/UnifyHash.java
(iterateHashCode): iterator now supports remove().
(remove): New method.
git-svn-id: https://svn.code.sf.net/p/jode/code/trunk@1337 379699f6-c40d-0410-875b-85095c16579e
23 years ago
|
|
|
poppush[0] = maxpop;
|
|
|
|
poppush[1] = delta + maxpop;
|
* ConstantInstruction.java,IncInstruction.java,ReferenceInstruction.java,SlotInstruction.java,TypeDimensionInstruction.java,TypeInstruction.java: Class and Constructors no longer public.
* Instruction.java (forOpcode): added method to create instructions.
* SlotInstruction.java,IncInstruction.java: Use a LocalVariableInfo
entry instead of slot+addr
* BasicBlockReader.java, BasicBlockWriter.java: Adapted Instruction interface.
* BinaryInfo.java: package private class now.
* BinaryInfo.java,FieldInfo.java,MethodInfo.java: Made some methods
package private.
* BasicBlocks.java (getAllInstructions): removed.
(read,readAttribute): no longer protected.
* ClassInfo.java (isGuessed): added.
All classes: bug fixes, etc.
git-svn-id: https://svn.code.sf.net/p/jode/code/trunk@1266 379699f6-c40d-0410-875b-85095c16579e
24 years ago
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Set the code, i.e. instructions and successor blocks.
|
|
|
|
* The instructions must be valid and match the successors.
|
|
|
|
*/
|
* ConstantInstruction.java,IncInstruction.java,ReferenceInstruction.java,SlotInstruction.java,TypeDimensionInstruction.java,TypeInstruction.java: Class and Constructors no longer public.
* Instruction.java (forOpcode): added method to create instructions.
* SlotInstruction.java,IncInstruction.java: Use a LocalVariableInfo
entry instead of slot+addr
* BasicBlockReader.java, BasicBlockWriter.java: Adapted Instruction interface.
* BinaryInfo.java: package private class now.
* BinaryInfo.java,FieldInfo.java,MethodInfo.java: Made some methods
package private.
* BasicBlocks.java (getAllInstructions): removed.
(read,readAttribute): no longer protected.
* ClassInfo.java (isGuessed): added.
All classes: bug fixes, etc.
git-svn-id: https://svn.code.sf.net/p/jode/code/trunk@1266 379699f6-c40d-0410-875b-85095c16579e
24 years ago
|
|
|
public void setCode(Instruction[] instrs, Block[] succs) {
|
|
|
|
this.instrs = instrs;
|
|
|
|
this.succs = succs;
|
Documentation updates (INSTALL, javadoc).
Added JUnit Test cases.
* build.xml: Big update.
* net/sf/jode/bytecode/BasicBlock.java:
(updateMaxStackLocals): new method to calculate maxStack and
maxLocals.
(setBlocks): fixed calculation of handlers, call updateMaxLocals.
* net/sf/jode/bytecode/BasicBlockReader.java:
(maxLocals, maxStack): new fields.
(readCode): read maxStack/Locals into private fields.
(convert): check that maxStack/Locals match what we calculate.
* net/sf/jode/bytecode/BinaryInfo.java:
(getKnownAttributeCount): renamed to...
(getAttributeCount): ... this, and also count internal attributes.
Made it protected.
(readAttribute): made protected.
(drop): made protected.
(prepareAttributes): made protected.
(writeKnownAttributes): removed.
(writeAttributes): made protected, use getAttributeCount.
Changed policy: it doesn't call writeKnownAttribute, but instead
it expects sub classes to override this method.
(getAttributeSize): made protected, subclasses should override it.
Changed all subclasses to new policy.
* net/sf/jode/bytecode/Block.java:
(lineNr): Removed, it wasn't used.
(pop,push): Removed, replaced by ...
(maxpop,maxpush,delta): ... these, with slightly changed semantics.
(stackHeight): New variable.
(Block): Default Constructor doesn't initialize fields now.
(getCatchers): Renamed to ...
(getHandlers): ... this, changed all callers.
(initCode): Calculate maxpop, maxpush, delta correctly.
(getStackPopPush): Changed accordingly to new fields.
(setCode): Removed debugging output for illegal contents.
* net/sf/jode/bytecode/Classes.java: Reworked handling of inner
classes.
(innerClasses): Field mustn't be null anymore when loaded.
(setName): Update class in classpath.
* net/sf/jode/bytecode/ClassPath.java:
(renameClassInfo): new function, should only used by ClassInfo.
* net/sf/jode/bytecode/ConstantPool.java: made public.
(getUTF8,getRef,getClassType,getClassName): Don't allow the 0 index.
(iterateClassNames): New method.
* net/sf/jode/decompiler/Main.java:
(decompileClass): Catch ClassFormatExceptions and decompile
remaining classes.
* net/sf/jode/obfuscator/ClassIdentifier.java:
Updated handling of inner/extra classes to new ClassInfo behaviour.
(initSuperClasses): Load DECLARATION of super classes.
* net/sf/jode/obfuscator/PackageIdentifier.java:
Replace deprecated methods of ClassInfo with corresponding classpath
calls.
(loadMatchingClasses): Initialize packages loaded on demand if we
are initialize.
* net/sf/jode/obfuscator/modules/ConstantAnalyzer.java:
Now extends SimpleAnalyzer.
(canonizeIfaceRef): Removed; it is now inherited.
(canonizeRef): likewise.
Big updates to handle jsr correctly.
(handleOpcode): Moved method to BlockInfo.
* net/sf/jode/obfuscator/modules/SimpleAnalyzer.java:
(canonizeIfaceRef): New method, copied from ConstantAnalyzer.
(canonizeRef): call canonizeIfaceRef for interfaces.
* net/sf/jode/util/UnifyHash.java
(iterateHashCode): iterator now supports remove().
(remove): New method.
git-svn-id: https://svn.code.sf.net/p/jode/code/trunk@1337 379699f6-c40d-0410-875b-85095c16579e
23 years ago
|
|
|
initCode();
|
|
|
|
}
|
|
|
|
|
|
|
|
public void dumpCode(PrintWriter output) {
|
|
|
|
output.println(" "+this+":");
|
|
|
|
for (int i = 0; i < instrs.length; i++) {
|
|
|
|
Instruction instr = instrs[i];
|
|
|
|
if (i == instrs.length - 1 && succs != null) {
|
|
|
|
int opcode = instr.getOpcode();
|
|
|
|
if (opcode == Opcodes.opc_lookupswitch) {
|
|
|
|
// Special case for switch:
|
|
|
|
output.println("\tswitch");
|
|
|
|
int[] values = instr.getValues();
|
|
|
|
for (int j = 0; j < values.length; j++)
|
|
|
|
output.println("\t case"+values[j]
|
|
|
|
+": goto "+succs[j]);
|
|
|
|
output.println("\t default: goto"+
|
|
|
|
succs[values.length]);
|
|
|
|
return;
|
|
|
|
} else if (succs.length > 1) {
|
|
|
|
output.println("\t"+instr.getDescription()
|
|
|
|
+" "+succs[0]);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
output.println("\t"+instr.getDescription());
|
|
|
|
|
|
|
|
}
|
|
|
|
if (succs != null && succs.length > 0) {
|
|
|
|
if (succs[succs.length-1] == null)
|
|
|
|
output.println("\treturn");
|
|
|
|
else
|
|
|
|
output.println("\tgoto "+succs[succs.length-1]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public String toString() {
|
|
|
|
return "Block_"+blockNr;
|
|
|
|
}
|
|
|
|
}
|