org.jikesrvm.compilers.opt.escape
Class ObjectReplacer

java.lang.Object
  extended by org.jikesrvm.compilers.opt.escape.ObjectReplacer
All Implemented Interfaces:
AggregateReplacer

final class ObjectReplacer
extends Object
implements AggregateReplacer

Class that performs scalar replacement of aggregates for non-array objects


Field Summary
private  IR ir
          the IR
private  RVMClass klass
          type of the object
private  Register reg
          the register holding the object reference
 
Constructor Summary
private ObjectReplacer(Register r, RVMClass _klass, IR i)
           
 
Method Summary
private static boolean containsUnsupportedUse(IR ir, Register reg, RVMClass klass, Set<Register> visited)
          Some cases we don't handle yet.
private static ArrayList<RVMField> getFieldsAsArrayList(RVMClass klass)
          Returns a ArrayList, holding the fields of the object
static ObjectReplacer getReplacer(Instruction inst, IR ir)
          Return an object representing this transformation for a given allocation site
private  void scalarReplace(RegisterOperand use, RegisterOperand[] scalars, ArrayList<RVMField> fields, Set<Register> visited)
          Replace a given use of a object with its scalar equivalent
 void transform()
          Perform the transformation
private  void transform2(Register reg, Instruction defI, RegisterOperand[] scalars, ArrayList<RVMField> fields, Set<Register> visited)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

klass

private final RVMClass klass
type of the object


ir

private final IR ir
the IR


reg

private final Register reg
the register holding the object reference

Constructor Detail

ObjectReplacer

private ObjectReplacer(Register r,
                       RVMClass _klass,
                       IR i)
Parameters:
r - the register holding the object reference
_klass - the type of the object to replace
i - the IR
Method Detail

getReplacer

public static ObjectReplacer getReplacer(Instruction inst,
                                         IR ir)
Return an object representing this transformation for a given allocation site

Parameters:
inst - the allocation site
ir -
Returns:
the object, or null if illegal

transform

public void transform()
Description copied from interface: AggregateReplacer
Perform the transformation

Specified by:
transform in interface AggregateReplacer

transform2

private void transform2(Register reg,
                        Instruction defI,
                        RegisterOperand[] scalars,
                        ArrayList<RVMField> fields,
                        Set<Register> visited)

getFieldsAsArrayList

private static ArrayList<RVMField> getFieldsAsArrayList(RVMClass klass)
Returns a ArrayList, holding the fields of the object

Parameters:
klass - the type of the object

scalarReplace

private void scalarReplace(RegisterOperand use,
                           RegisterOperand[] scalars,
                           ArrayList<RVMField> fields,
                           Set<Register> visited)
Replace a given use of a object with its scalar equivalent

Parameters:
use - the use to replace
scalars - an array of scalar register operands to replace the object's fields with

containsUnsupportedUse

private static boolean containsUnsupportedUse(IR ir,
                                              Register reg,
                                              RVMClass klass,
                                              Set<Register> visited)
Some cases we don't handle yet. TODO: handle them.