org.jikesrvm.compilers.opt.inlining
Class InlineDecision

java.lang.Object
  extended by org.jikesrvm.compilers.opt.inlining.InlineDecision

public final class InlineDecision
extends Object

Instances of this class represent decisions to inline.


Nested Class Summary
private static class InlineDecision.Code
           
 
Field Summary
private  InlineDecision.Code code
          Holds characterization of this decision.
private  byte[] guards
          The set of guards to use (only valid when code == GUARDED_YES)
private  String rationale
          Rationale for this decision
private  RVMMethod[] targets
          The set of methods to inline.
private  boolean testFailedOSR
          Should the test-failed block be replaced with an OSR point?
 
Constructor Summary
private InlineDecision(RVMMethod[] targets, byte[] guards, InlineDecision.Code code, String reason)
           
 
Method Summary
 byte[] getGuards()
          Return the guards to use according to this decision.
 int getNumberOfTargets()
          Return the number methods to inline.
 RVMMethod[] getTargets()
          Return the methods to inline according to this decision.
static InlineDecision guardedYES(RVMMethod[] targets, byte[] guards, String reason)
          Return a decision YES to do a guarded inline.
static InlineDecision guardedYES(RVMMethod target, byte guard, String reason)
          Return a decision YES to do a guarded inline.
 boolean isNO()
          Is this inline decision a NO?
 boolean isYES()
          Is this inline decision a YES?
 boolean needsGuard()
          Does this inline site need a guard?
static InlineDecision NO(RVMMethod target, String reason)
          Return a decision NOT to inline.
static InlineDecision NO(String reason)
          Return a decision NOT to inline.
 boolean OSRTestFailed()
           
 void setOSRTestFailed()
           
 String toString()
           
static InlineDecision YES(RVMMethod target, String reason)
          Return a decision to inline without a guard.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

rationale

private final String rationale
Rationale for this decision


code

private final InlineDecision.Code code
Holds characterization of this decision.


targets

private final RVMMethod[] targets
The set of methods to inline.


guards

private final byte[] guards
The set of guards to use (only valid when code == GUARDED_YES)


testFailedOSR

private boolean testFailedOSR
Should the test-failed block be replaced with an OSR point?

Constructor Detail

InlineDecision

private InlineDecision(RVMMethod[] targets,
                       byte[] guards,
                       InlineDecision.Code code,
                       String reason)
Parameters:
targets - The methods to inline
code - the decision code
reason - a string rationale
Method Detail

NO

public static InlineDecision NO(RVMMethod target,
                                String reason)
Return a decision NOT to inline.

Parameters:
target - the method that is not being inlined.
reason - a rationale for not inlining
Returns:
a decision NOT to inline

NO

public static InlineDecision NO(String reason)
Return a decision NOT to inline.

Parameters:
reason - a rationale for not inlining
Returns:
a decision NOT to inline

YES

public static InlineDecision YES(RVMMethod target,
                                 String reason)
Return a decision to inline without a guard.

Parameters:
target - the method to inline
reason - a rationale for inlining
Returns:
a decision YES to inline

guardedYES

public static InlineDecision guardedYES(RVMMethod target,
                                        byte guard,
                                        String reason)
Return a decision YES to do a guarded inline.

Parameters:
target - the method to inline
guard - the type of guard to use
reason - a rationale for inlining
Returns:
a decision YES to inline, but it is not always safe.

guardedYES

public static InlineDecision guardedYES(RVMMethod[] targets,
                                        byte[] guards,
                                        String reason)
Return a decision YES to do a guarded inline.

Parameters:
targets - The methods to inline
guards - the types of guard to use
reason - A rationale for inlining
Returns:
a decision YES to inline, but it is not always safe.

isYES

public boolean isYES()
Is this inline decision a YES?


isNO

public boolean isNO()
Is this inline decision a NO?


needsGuard

public boolean needsGuard()
Does this inline site need a guard?


getTargets

public RVMMethod[] getTargets()
Return the methods to inline according to this decision.


getGuards

public byte[] getGuards()
Return the guards to use according to this decision.


getNumberOfTargets

public int getNumberOfTargets()
Return the number methods to inline.


setOSRTestFailed

public void setOSRTestFailed()

OSRTestFailed

public boolean OSRTestFailed()

toString

public String toString()
Overrides:
toString in class Object