org.jikesrvm.compilers.opt.ir
Class ExceptionHandlerBasicBlock

java.lang.Object
  extended by org.jikesrvm.compilers.opt.util.SpaceEffGraphNode
      extended by org.jikesrvm.compilers.opt.util.SortedGraphNode
          extended by org.jikesrvm.compilers.opt.ir.BasicBlock
              extended by org.jikesrvm.compilers.opt.ir.ExceptionHandlerBasicBlock
All Implemented Interfaces:
GraphElement, GraphNode

public final class ExceptionHandlerBasicBlock
extends BasicBlock

A basic block that marks the start of an exception handler. Exception Handler Basic Block; acronym EHBB.


Nested Class Summary
 
Nested classes/interfaces inherited from class org.jikesrvm.compilers.opt.ir.BasicBlock
BasicBlock.BBEnum, BasicBlock.ComputedBBEnum, BasicBlock.ExceptionOutEdgeEnum, BasicBlock.InEdgeEnum, BasicBlock.NormalOutEdgeEnum, BasicBlock.OutEdgeEnum
 
Nested classes/interfaces inherited from class org.jikesrvm.compilers.opt.util.SpaceEffGraphNode
SpaceEffGraphNode.GraphEdgeEnumeration<T extends GraphEdge>, SpaceEffGraphNode.OutEdgeEnumeration
 
Field Summary
private  TypeOperand[] exceptionTypes
          The RVMType(s) of the exception(s) caught by this block.
private  LiveSet liveSet
          The liveness information at the beginning of this block.
 
Fields inherited from class org.jikesrvm.compilers.opt.ir.BasicBlock
CAN_THROW_EXCEPTIONS, end, EXCEPTION_HANDLER, EXCEPTION_HANDLER_WITH_NORMAL_IN, exceptionHandlers, flags, freq, IMPLICIT_EXIT_EDGE, INFREQUENT, LANDING_PAD, REACHABLE_FROM_EXCEPTION_HANDLER, SCRATCH, start, UNSAFE_TO_SCHEDULE
 
Fields inherited from class org.jikesrvm.compilers.opt.util.SortedGraphNode
backwardSortNumber, forwardSortNumber, sortedNext, sortedPrev
 
Fields inherited from class org.jikesrvm.compilers.opt.util.SpaceEffGraphNode
_inEdgeEnd, _inEdgeStart, _outEdgeEnd, _outEdgeStart, info, next, nextSorted, prev, scratch, scratchObject
 
Constructor Summary
ExceptionHandlerBasicBlock(int loc, InlineSequence position, TypeOperand type, ControlFlowGraph cfg)
          Creates a new exception handler basic block at the specified location, which catches the specified type of exception.
 
Method Summary
 void addCaughtException(TypeOperand et)
          Add a new exception type to an extant exception handler block.
 Enumeration<TypeOperand> getExceptionTypes()
          Return an Enumeration of the caught exception types.
 LiveSet getLiveSet()
          Returns the set of registers live before the first instruction of this basic block
 int getNumberOfExceptionTableEntries()
          Get how many table entries this EHBB needs.
 byte mayCatchException(TypeReference cand)
          Return YES/NO/MAYBE values that answer the question is it possible for this handler block to catch an exception of the type et.
 byte mustCatchException(TypeReference cand)
          Return YES/NO/MAYBE values that answer the question is it guarenteed that this handler block will catch an exception of type cand
 void setLiveSet(LiveSet liveSet)
          Set the set of registers live before the first instruction of this basic block
 String toString()
          Return a string representation of the basic block (augment BasicBlock.toString() with the exceptions caught by this handler block).
 
Methods inherited from class org.jikesrvm.compilers.opt.ir.BasicBlock
appendInstruction, appendInstructionRespectingTerminalBranch, appendInstructionRespectingTerminalBranchOrPEI, augmentExecutionFrequency, canThrowExceptions, clearCanThrowExceptions, clearExceptionHandlerBasicBlock, clearInfrequent, clearLandingPad, clearMayThrowUncaughtException, clearReachableFromExceptionHandler, clearScratchFlag, clearUnsafeToSchedule, copyWithoutLinks, createSubBlock, createSubBlock, deleteNormalOut, discardInstructions, enumerateBranchInstructions, enumerateLiveIntervals, firstBranchInstruction, firstInstruction, firstRealInstruction, forwardInstrEnumerator, forwardRealInstrEnumerator, getApplicableExceptionalOut, getExceptionalOut, getExceptionHandlers, getExecutionFrequency, getFallThroughBlock, getFirstLiveIntervalElement, getIn, getInfrequent, getInNodes, getLandingPad, getNormalOut, getNotTakenNextBlock, getNumberOfExceptionalOut, getNumberOfNormalOut, getNumberOfRealInstructions, getOut, getOutNodes, getReachableExceptionHandlers, getScratchFlag, hasApplicableExceptionalOut, hasAthrowInst, hasExceptionHandlers, hasGoto, hasNonReturningCall, hasNonReturningOsr, hasReachableExceptionHandlers, hasReturn, hasSwitch, hasTrap, initializeLiveRange, initInOutSets, isEmpty, isExceptionalOut, isExceptionHandlerBasicBlock, isExceptionHandlerEquivalent, isExceptionHandlerWithNormalIn, isExit, isIn, isNormalOut, isOut, isReachableFromExceptionHandler, isUnsafeToSchedule, killFallThrough, lastInstruction, lastRealInstruction, makeExit, makeGOTO, makeJumpTarget, mayThrowUncaughtException, mergeFallThrough, moveBehind, nextBasicBlockInCodeOrder, prependInstruction, prependInstructionRespectingPrologue, prependLiveIntervalElement, prevBasicBlockInCodeOrder, printExtended, pruneExceptionalOut, recomputeNormalOut, redirectOuts, replicateNormalOut, replicateThisOut, replicateThisOut, reverseInstrEnumerator, reverseRealInstrEnumerator, scaleExecutionFrequency, segregateInstruction, setCanThrowExceptions, setExceptionHandlerBasicBlock, setExceptionHandlerWithNormalIn, setExecutionFrequency, setInfrequent, setInfrequent, setLandingPad, setMayThrowUncaughtException, setReachableFromExceptionHandler, setScratchFlag, setUnsafeToSchedule, splitNodeAt, splitNodeWithLinksAt, unfactor
 
Methods inherited from class org.jikesrvm.compilers.opt.util.SortedGraphNode
getBackwardSortedNext, getBackwardSortNumber, getForwardSortedNext, getForwardSortNumber, getNewSortMarker, getSortedNext, getSortMarker, getSortNumber, isSortMarkedWith, setBackwardSortNumber, setForwardSortNumber, setSortedNext, setSortMarker, setSortNumber, setSortNumber
 
Methods inherited from class org.jikesrvm.compilers.opt.util.SpaceEffGraphNode
_sortDFS, _sortRevTop, _sortTop, append, appendInEdge, appendOutEdge, clearDfsVisited, clearFlags, clearInFlags, clearLoopHeader, clearOnStack, clearOutFlags, clearTopVisited, deleteIn, deleteOut, deleteOut, deleteOut, dfsVisited, findOutEdgeTo, firstInEdge, firstInNode, firstOutEdge, firstOutNode, flagsOn, getIndex, getNext, getNumber, getNumberOfIn, getNumberOfOut, getPrev, getScratch, hasIn, hasOneIn, hasOneIn, hasOneOut, hasOneOut, hasOut, hasZeroIn, hasZeroOut, inEdges, inNodes, insertOut, insertOut, isLoopHeader, markDFN, markSCC, onStack, outEdges, outNodes, pointsIn, pointsOut, printInEdges, printInNodes, printOutEdges, printOutNodes, remove, removeIn, removeIn, removeOut, removeOut, replaceInEdge, replaceOut, setDfsVisited, setDfsVisitedOnStack, setIndex, setLoopHeader, setNumber, setOnStack, setScratch, setTopVisited, sortDFS, sortRevTop, sortTop, topVisited
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

exceptionTypes

private TypeOperand[] exceptionTypes
The RVMType(s) of the exception(s) caught by this block.


liveSet

private LiveSet liveSet
The liveness information at the beginning of this block.

NOTE: If we decide to store this for all blocks, we should move this field to BasicBlock (the parent class)

Constructor Detail

ExceptionHandlerBasicBlock

public ExceptionHandlerBasicBlock(int loc,
                                  InlineSequence position,
                                  TypeOperand type,
                                  ControlFlowGraph cfg)
Creates a new exception handler basic block at the specified location, which catches the specified type of exception.

Parameters:
loc - Bytecode index to create basic block at
position - The inline context for this basic block
type - The exception type
cfg - The ControlFlowGraph that will contain the basic block
Method Detail

addCaughtException

public void addCaughtException(TypeOperand et)
Add a new exception type to an extant exception handler block. Do filtering of duplicates internally for efficiency. NOTE: this routine is only intended to be called by BC2IR.

Parameters:
et - the exception type to be added

mayCatchException

public byte mayCatchException(TypeReference cand)
Return YES/NO/MAYBE values that answer the question is it possible for this handler block to catch an exception of the type et.

Parameters:
cand - the TypeReference of the exception in question.
Returns:
YES, NO, MAYBE

mustCatchException

public byte mustCatchException(TypeReference cand)
Return YES/NO/MAYBE values that answer the question is it guarenteed that this handler block will catch an exception of type cand

Parameters:
cand - the TypeReference of the exception in question.
Returns:
YES, NO, MAYBE

getExceptionTypes

public Enumeration<TypeOperand> getExceptionTypes()
Return an Enumeration of the caught exception types. Mainly intended for creation of exception tables during final assembly. Most other clients shouldn't care about this level of detail.


getNumberOfExceptionTableEntries

public int getNumberOfExceptionTableEntries()
Get how many table entries this EHBB needs. Really only of interest during final assembly.

Returns:
the number of table entries for this basic block
See Also:
OptExceptionTable

getLiveSet

public LiveSet getLiveSet()
Returns the set of registers live before the first instruction of this basic block

Returns:
the set of registers live before the first instruction of this basic block

setLiveSet

public void setLiveSet(LiveSet liveSet)
Set the set of registers live before the first instruction of this basic block

Parameters:
liveSet - The set of registers live before the first instruction of this basic block

toString

public String toString()
Return a string representation of the basic block (augment BasicBlock.toString() with the exceptions caught by this handler block).

Overrides:
toString in class BasicBlock
Returns:
a string representation of the block