net.sf.jode.flow
Class InstructionContainer

java.lang.Object
  extended by net.sf.jode.flow.StructuredBlock
      extended by net.sf.jode.flow.InstructionContainer
Direct Known Subclasses:
ConditionalBlock, InstructionBlock, ReturnBlock, SwitchBlock

public abstract class InstructionContainer
extends StructuredBlock

This is a method for block containing a single instruction.


Constructor Summary
InstructionContainer(Expression instr)
           
InstructionContainer(Instruction bytecodeInstr, Expression instr)
           
 
Method Summary
 boolean doTransformations()
          Do simple transformation on the structuredBlock.
 void fillInGenSet(Set in, Set gen)
          Fill all in variables into the given VariableSet.
 Set getDeclarables()
           
 Expression getInstruction()
          Get the contained instruction.
 void makeDeclaration(Set done)
          Make the declarations, i.e.
 void removeOnetimeLocals()
          This method should remove local variables that are only written and read one time directly after another.
 void setInstruction(Expression instr)
          Set the contained instruction.
 void simplify()
           
 
Methods inherited from class net.sf.jode.flow.StructuredBlock
appendBlock, checkConsistent, contains, copyJump, dumpInstruction, dumpSource, flowMayBeChanged, getBCELInstructions, getBytecodeInstructions, getNextBlock, getNextBlock, getNextFlowBlock, getNextFlowBlock, getSubBlocks, isEmpty, isSingleExit, jumpMayBeChanged, mapStackToLocal, moveJump, needsBraces, prependBlock, propagateUsage, removeBlock, removeJump, removePush, replace, replaceSubBlock, setFlowBlock, setJump, setSuccessors, swapJump, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

InstructionContainer

public InstructionContainer(Expression instr)

InstructionContainer

public InstructionContainer(Instruction bytecodeInstr,
                            Expression instr)
Method Detail

makeDeclaration

public void makeDeclaration(Set done)
Make the declarations, i.e. initialize the declare variable to correct values. This will declare every variable that is marked as used, but not done.
This will now also combine locals, that use the same slot, have compatible types and are declared in the same block.

Overrides:
makeDeclaration in class StructuredBlock
Parameters:
done - The set of the already declare variables.

removeOnetimeLocals

public void removeOnetimeLocals()
This method should remove local variables that are only written and read one time directly after another.
This is especially important for stack locals, that are created when there are unusual swap or dup instructions, but also makes inlined functions more pretty (but not that close to the bytecode).

Overrides:
removeOnetimeLocals in class StructuredBlock

fillInGenSet

public void fillInGenSet(Set in,
                         Set gen)
Fill all in variables into the given VariableSet.

Overrides:
fillInGenSet in class StructuredBlock
Parameters:
in - The VariableSet, the in variables should be stored to.

getDeclarables

public Set getDeclarables()
Overrides:
getDeclarables in class StructuredBlock

doTransformations

public boolean doTransformations()
Description copied from class: StructuredBlock
Do simple transformation on the structuredBlock.

Overrides:
doTransformations in class StructuredBlock
Returns:
true, if some transformation was done.

getInstruction

public final Expression getInstruction()
Get the contained instruction.

Returns:
the contained instruction.

simplify

public void simplify()
Overrides:
simplify in class StructuredBlock

setInstruction

public final void setInstruction(Expression instr)
Set the contained instruction.

Parameters:
instr - the new instruction.