|
|
|
/* Jump Copyright (C) 1998-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.flow;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* This class represents an unconditional jump.
|
|
|
|
*/
|
|
|
|
public class Jump {
|
|
|
|
/**
|
|
|
|
* The structured block that precedes this jump.
|
|
|
|
*/
|
|
|
|
StructuredBlock prev;
|
|
|
|
/**
|
|
|
|
* The destination block of this jump, null if not known, or illegal.
|
|
|
|
*/
|
|
|
|
FlowBlock destination;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The jumps in a flow block, that have the same destination, are
|
|
|
|
* in a link list. This field points to the next jump in this link.
|
|
|
|
*/
|
|
|
|
Jump next;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The stack map. This tells how many objects are on stack at
|
|
|
|
* begin of the flow block, and to what locals they are maped.
|
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 FlowBlock#mapStackToLocal
|
|
|
|
*/
|
|
|
|
VariableStack stackMap;
|
|
|
|
|
|
|
|
public Jump (FlowBlock dest) {
|
|
|
|
this.destination = dest;
|
|
|
|
}
|
|
|
|
|
|
|
|
public Jump (Jump jump) {
|
|
|
|
destination = jump.destination;
|
|
|
|
next = jump.next;
|
|
|
|
jump.next = this;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Print the source code for this structured block. This handles
|
|
|
|
* everything that is unique for all structured blocks and calls
|
|
|
|
* dumpInstruction afterwards.
|
|
|
|
* @param writer The tabbed print writer, where we print to.
|
|
|
|
*/
|
|
|
|
public void dumpSource(net.sf.jode.decompiler.TabbedPrintWriter writer)
|
|
|
|
throws java.io.IOException
|
|
|
|
{
|
|
|
|
if (destination == null)
|
|
|
|
writer.println ("GOTO null-ptr!!!!!");
|
|
|
|
else
|
|
|
|
writer.println("GOTO "+destination.getLabel());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|