JML

org.multijava.util.optimize
Class Optimizer

java.lang.Object
  extended byorg.multijava.util.optimize.Optimizer
All Implemented Interfaces:
AccessorContainer

public class Optimizer
extends Object
implements AccessorContainer

This class is the entry point for the peephole byte code optimizer


Field Summary
private  InstructionHandle codeStart
           
private  HandlerInfo[] handlers
           
private  LocalVariableInfo[] localVariables
           
 
Constructor Summary
Optimizer(CodeInfo codeInfo)
          Constructs a new optimizer object.
 
Method Summary
private  void buildBasicBlocks(InstructionHandle start)
           
private  Instruction[] buildInstructionArray()
          Build the array of the instructions resulting from the optimization process.
private  LineNumberInfo[] buildLineNumberInfo()
          Build the array of line number information for the optimized instruction sequence.
private  boolean cleanCode()
           
private  void dumpCode()
           
private  void dumpCode(Instruction[] insns)
           
 CodeInfo getCodeInfo()
          Returns a new, optimized code info structure.
 InstructionHandle getCodeStart()
           
private  InstructionHandle installInstructionHandles(CodeInfo info)
          Install handles around instructions.
static CodeInfo optimize(CodeInfo code, int level)
          Optimizes the byte code for a single method.
private  boolean optimizeCodeSequence()
           
 void setCodeStart(InstructionHandle handle)
           
 void transformAccessors(AccessorTransformer transformer)
          Transforms targets (deferences to actual instructions).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

codeStart

private InstructionHandle codeStart

handlers

private HandlerInfo[] handlers

localVariables

private LocalVariableInfo[] localVariables
Constructor Detail

Optimizer

public Optimizer(CodeInfo codeInfo)
Constructs a new optimizer object.

Method Detail

optimize

public static CodeInfo optimize(CodeInfo code,
                                int level)
Optimizes the byte code for a single method.


getCodeInfo

public CodeInfo getCodeInfo()
Returns a new, optimized code info structure.


buildBasicBlocks

private void buildBasicBlocks(InstructionHandle start)

optimizeCodeSequence

private boolean optimizeCodeSequence()

cleanCode

private boolean cleanCode()

installInstructionHandles

private InstructionHandle installInstructionHandles(CodeInfo info)
Install handles around instructions.


dumpCode

private void dumpCode(Instruction[] insns)

dumpCode

private void dumpCode()

buildInstructionArray

private Instruction[] buildInstructionArray()
Build the array of the instructions resulting from the optimization process.

Returns:
the array of instructions

buildLineNumberInfo

private LineNumberInfo[] buildLineNumberInfo()
Build the array of line number information for the optimized instruction sequence.


transformAccessors

public void transformAccessors(AccessorTransformer transformer)
                        throws BadAccessorException
Transforms targets (deferences to actual instructions).

Specified by:
transformAccessors in interface AccessorContainer
Parameters:
transformer - the transformer used to transform accessors
Throws:
BadAccessorException

setCodeStart

public void setCodeStart(InstructionHandle handle)

getCodeStart

public InstructionHandle getCodeStart()

JML

JML is Copyright (C) 1998-2002 by Iowa State University and is distributed under the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This release depends on code from the MultiJava project and is based in part on the Kopi project Copyright (C) 1990-99 DMS Decision Management Systems Ges.m.b.H.