jreversepro.revengine
Class JCollatingTable

java.lang.Object
  extended by jreversepro.revengine.JCollatingTable
All Implemented Interfaces:
KeyWords, BranchConstants

public class JCollatingTable
extends java.lang.Object
implements BranchConstants, KeyWords

JCollating table is responsible for collating the table objects.

Author:
Karthik Kumar

Field Summary
 
Fields inherited from interface jreversepro.revengine.BranchConstants
TYPE_BRANCH, TYPE_CASE, TYPE_CATCH, TYPE_CATCH_ANY, TYPE_DO_WHILE, TYPE_ELSE, TYPE_ELSE_IF, TYPE_GOTO, TYPE_IF, TYPE_INVALID, TYPE_JSR, TYPE_RET, TYPE_SWITCH, TYPE_SYNC, TYPE_TRY, TYPE_TRY_ANY, TYPE_WHILE
 
Fields inherited from interface jreversepro.common.KeyWords
ANY, BOOLEAN, BREAK, BYTE, CASE, CHAR, CLASS, CLASS_STRING, CLINIT, CLOSE_BRACKET, COND_AND, COND_NOT, COND_OR, CONTINUE, DEFAULT, DEFAULT_PACKAGE, DOUBLE, EQUALTO, FALSE, FLOAT, FOREIGN_CLASS, FOREIGN_OBJ, GOTO, INIT, INSTANCEOF, INT, INTERFACE, JVM_BOOLEAN, JVM_CHAR, JVM_VOID, LANG_OBJECT, LENGTH, LONG, NEW, NULL, OPEN_BRACKET, OPR_EQ, OPR_GE, OPR_GT, OPR_LE, OPR_LT, OPR_NE, OPR_NOT, REFERENCE, RET_ADDR, RETURN, SHORT, SPACE, STATIC, SUPER, SWITCH, THIS, THISCLASS, THROW, TRUE, VOID
 
Constructor Summary
JCollatingTable(JMethod method)
           
 
Method Summary
 void addConditionalBranch(JInstruction thisIns, int startPc, int type, java.lang.String opr1, java.lang.String opr2)
           
 void collate()
          This collates the information of the BranchTable to the Java-compiler Readable branches.
protected  void finalize()
          Finalizer.
 java.util.List<JBranchEntry> getEffectiveBranches()
          This method prunes the entries, removes all those branches whose type are TYPE_INVALID.
 void identifyWhileLoops(java.util.Map<java.lang.Integer,java.lang.Integer> mapGotos)
          Identifies the while loop in the list of branches mentioned.
 void sort()
          Sorts the branches - List.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

JCollatingTable

public JCollatingTable(JMethod method)
Parameters:
method - Method in which this collating table entry is present,
Method Detail

finalize

protected void finalize()
Finalizer.

Overrides:
finalize in class java.lang.Object

getEffectiveBranches

public java.util.List<JBranchEntry> getEffectiveBranches()
This method prunes the entries, removes all those branches whose type are TYPE_INVALID.

Returns:
List of branch of entries all of which are significant. The members of the entries are all - JBranchEntry.

addConditionalBranch

public void addConditionalBranch(JInstruction thisIns,
                                 int startPc,
                                 int type,
                                 java.lang.String opr1,
                                 java.lang.String opr2)
Parameters:
thisIns - Instruction - usually a if_xyz opcode.
startPc - StartPc of the conditional branch.
type - Type of the branch
opr1 - Operand 1.
opr2 - Operand 2.

sort

public void sort()
Sorts the branches - List.


collate

public void collate()
This collates the information of the BranchTable to the Java-compiler Readable branches.

StartPc TargetPc NextPc in that order
x y z
z y p Case1

x y z
z p q Case2


identifyWhileLoops

public void identifyWhileLoops(java.util.Map<java.lang.Integer,java.lang.Integer> mapGotos)
Identifies the while loop in the list of branches mentioned.

Parameters:
mapGotos - Map containing the goto entries in the method.

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object
Returns:
Returns a Stringified format of the class.


Submit Feedback to akkumar@users.sourceforge.net