org.jikesrvm.compilers.opt.hir2lir
Class ExpandRuntimeServices

java.lang.Object
  extended by org.jikesrvm.compilers.opt.driver.CompilerPhase
      extended by org.jikesrvm.compilers.opt.hir2lir.ExpandRuntimeServices

public final class ExpandRuntimeServices
extends CompilerPhase

As part of the expansion of HIR into LIR, this compile phase replaces all HIR operators that are implemented as calls to VM service routines with CALLs to those routines. For some (common and performance critical) operators, we may optionally inline expand the call (depending on the the values of the relevant compiler options and/or Controls). This pass is also responsible for inserting write barriers if we are using an allocator that requires them. Write barriers are always inline expanded.


Field Summary
private  Simple _os
          Cache of simple optimizations if used to tidy up
private  BranchOptimizations branchOpts
          Cache of branch optimizations if used to tidy up
private static Constructor<CompilerPhase> constructor
          Constructor for this compiler phase
private  boolean didSomething
          Did we expand something?
 
Fields inherited from class org.jikesrvm.compilers.opt.driver.CompilerPhase
container
 
Constructor Summary
ExpandRuntimeServices()
           
 
Method Summary
 Constructor<CompilerPhase> getClassConstructor()
          Get a constructor object for this compiler phase
 String getName()
           
private  void inline(Instruction inst, IR ir)
          Inline a call instruction
private  void inline(Instruction inst, IR ir, boolean noCalleeExceptions)
          Inline a call instruction
 void perform(IR ir)
          Given an HIR, expand operators that are implemented as calls to runtime service methods.
private  void primitiveArrayStoreHelper(RVMMethod target, Instruction inst, Instruction next, IR ir)
          Helper method to generate call to primitive arrayStore write barrier
private  void primitiveObjectFieldStoreHelper(RVMMethod target, Instruction inst, Instruction next, IR ir, FieldReference fieldRef)
          Helper method to generate call to primitive putfield write barrier
 void reportAdditionalStats()
          Called when printing a measure compilation report to enable a phase to report additional phase-specific statistics.
 boolean shouldPerform(OptOptions options)
          This method determines if the phase should be run, based on the Options object it is passed.
 
Methods inherited from class org.jikesrvm.compilers.opt.driver.CompilerPhase
dumpIR, dumpIR, getCompilerPhaseConstructor, getCompilerPhaseConstructor, newExecution, performPhase, printingEnabled, setContainer, verify
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_os

private Simple _os
Cache of simple optimizations if used to tidy up


branchOpts

private BranchOptimizations branchOpts
Cache of branch optimizations if used to tidy up


didSomething

private boolean didSomething
Did we expand something?


constructor

private static final Constructor<CompilerPhase> constructor
Constructor for this compiler phase

Constructor Detail

ExpandRuntimeServices

public ExpandRuntimeServices()
Method Detail

getClassConstructor

public Constructor<CompilerPhase> getClassConstructor()
Get a constructor object for this compiler phase

Overrides:
getClassConstructor in class CompilerPhase
Returns:
compiler phase constructor

shouldPerform

public boolean shouldPerform(OptOptions options)
Description copied from class: CompilerPhase
This method determines if the phase should be run, based on the Options object it is passed. By default, phases are always performed. Subclasses should override this method if they only want to be performed conditionally.

Overrides:
shouldPerform in class CompilerPhase
Parameters:
options - the compiler options for the compilation
Returns:
true if the phase should be performed

getName

public String getName()
Specified by:
getName in class CompilerPhase
Returns:
a String which is the name of the phase.

reportAdditionalStats

public void reportAdditionalStats()
Description copied from class: CompilerPhase
Called when printing a measure compilation report to enable a phase to report additional phase-specific statistics.

Overrides:
reportAdditionalStats in class CompilerPhase

perform

public void perform(IR ir)
Given an HIR, expand operators that are implemented as calls to runtime service methods. This method should be called as one of the first steps in lowering HIR into LIR.

Specified by:
perform in class CompilerPhase
Parameters:
ir - The HIR to expand

inline

private void inline(Instruction inst,
                    IR ir)
Inline a call instruction


inline

private void inline(Instruction inst,
                    IR ir,
                    boolean noCalleeExceptions)
Inline a call instruction


primitiveArrayStoreHelper

private void primitiveArrayStoreHelper(RVMMethod target,
                                       Instruction inst,
                                       Instruction next,
                                       IR ir)
Helper method to generate call to primitive arrayStore write barrier

Parameters:
target - entry point for write barrier method
inst - the current instruction
next - the next instruction
ir - the IR

primitiveObjectFieldStoreHelper

private void primitiveObjectFieldStoreHelper(RVMMethod target,
                                             Instruction inst,
                                             Instruction next,
                                             IR ir,
                                             FieldReference fieldRef)
Helper method to generate call to primitive putfield write barrier

Parameters:
target - entry point for write barrier method
inst - the current instruction
next - the next instruction
ir - the IR