org.jikesrvm.compilers.opt.regalloc
Class LinearScan.CompoundInterval

java.lang.Object
  extended by java.util.AbstractCollection<E>
      extended by java.util.AbstractSet<E>
          extended by java.util.TreeSet<LinearScan.BasicInterval>
              extended by org.jikesrvm.compilers.opt.regalloc.LinearScan.IntervalSet
                  extended by org.jikesrvm.compilers.opt.regalloc.LinearScan.IncreasingStartIntervalSet
                      extended by org.jikesrvm.compilers.opt.regalloc.LinearScan.CompoundInterval
All Implemented Interfaces:
Serializable, Cloneable, Iterable<LinearScan.BasicInterval>, Collection<LinearScan.BasicInterval>, NavigableSet<LinearScan.BasicInterval>, Set<LinearScan.BasicInterval>, SortedSet<LinearScan.BasicInterval>
Direct Known Subclasses:
LinearScan.SpillLocationInterval
Enclosing class:
LinearScan

static class LinearScan.CompoundInterval
extends LinearScan.IncreasingStartIntervalSet

Implements a live interval with holes; ie; a list of basic live intervals.


Field Summary
private  boolean _infrequent
          Is this compound interval fully contained in infrequent code?
private  Register reg
          The register this compound interval represents
(package private) static long serialVersionUID
          Support for Set serialization
private  LinearScan.SpillLocationInterval spillInterval
          A spill location assigned for this interval.
 
Fields inherited from class org.jikesrvm.compilers.opt.regalloc.LinearScan.IncreasingStartIntervalSet
c
 
Constructor Summary
LinearScan.CompoundInterval(int dfnBegin, int dfnEnd, Register register)
          Create a new compound interval of a single Basic interval
LinearScan.CompoundInterval(LinearScan.BasicInterval i, Register register)
          Create a new compound interval of a single Basic interval
LinearScan.CompoundInterval(Register r)
          Dangerous constructor: use with care.
 
Method Summary
(package private)  void addNonIntersectingInterval(LinearScan.CompoundInterval i, LinearScan.BasicInterval stop)
          Merge this interval with another, non-intersecting interval.
(package private)  LinearScan.BasicInterval addRange(LiveIntervalElement live, BasicBlock bb)
          Add a new live range to this compound interval.
(package private)  void assign(Register r)
          Assign this compound interval to a physical register.
(package private)  LinearScan.CompoundInterval copy(Register r)
          Copy the ranges into a new interval associated with a register r.
(package private)  LinearScan.CompoundInterval copy(Register r, LinearScan.BasicInterval stop)
          Copy the ranges into a new interval associated with a register r.
(package private)  Register getAssignment()
          Get the physical register this interval is assigned to. null if none assigned.
(package private)  LinearScan.BasicInterval getBasicInterval(Instruction s)
          Return the first basic interval that contains a given instruction.
(package private)  LinearScan.BasicInterval getBasicInterval(int n)
          Return the first basic interval that contains the given instruction.
(package private)  int getLowerBound()
          Return the lowest DFN in this compound interval.
(package private)  Register getRegister()
          Return the register this interval represents
(package private)  LinearScan.SpillLocationInterval getSpillInterval()
           
(package private)  int getUpperBound()
          Return the highest DFN in this compound interval.
(package private)  SortedSet<LinearScan.BasicInterval> headSetInclusive(int upperBound)
          Compute the headSet() [from java.util.SortedSet] but include all elements less than upperBound inclusive
(package private)  SortedSet<LinearScan.BasicInterval> headSetInclusive(LinearScan.BasicInterval upperBound)
          Compute the headSet() [from java.util.SortedSet] but include all elements less than upperBound inclusive
(package private)  boolean intersects(LinearScan.CompoundInterval i)
          Does this interval intersect with i?
(package private)  boolean isAssigned()
          Has this interval been assigned to a physical register?
(package private)  boolean isInfrequent()
           
(package private)  boolean isSpilled()
          Has this interval been spilled?
(package private)  void removeAll(LinearScan.CompoundInterval c)
          SJF: Apparently our java.util implementation of removeAll() doesn't work.
(package private)  LinearScan.CompoundInterval removeIntervalsAndCache(LinearScan.CompoundInterval i)
          Remove some basic intervals from this compound interval, and return the intervals actually removed.
(package private)  void setFrequent()
           
private  boolean shouldConcatenate(LiveIntervalElement live, BasicBlock bb)
          Should we simply merge the live interval live into a previous BasicInterval?
(package private)  void spill(LinearScan.SpillLocationManager spillManager)
          Assign this compound interval to a free spill location.
(package private)  SortedSet<LinearScan.BasicInterval> tailSetInclusive(int lowerBound)
          Compute the tailSet() [from java.util.SortedSet] but include all elements greater than lowerBound inclusive
 String toString()
          Make a String representation
 
Methods inherited from class java.util.TreeSet
add, addAll, ceiling, clear, clone, comparator, contains, descendingIterator, descendingSet, first, floor, headSet, headSet, higher, isEmpty, iterator, last, lower, pollFirst, pollLast, remove, size, subSet, subSet, tailSet, tailSet
 
Methods inherited from class java.util.AbstractSet
equals, hashCode, removeAll
 
Methods inherited from class java.util.AbstractCollection
containsAll, retainAll, toArray, toArray
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.Set
containsAll, equals, hashCode, removeAll, retainAll, toArray, toArray
 

Field Detail

serialVersionUID

static final long serialVersionUID
Support for Set serialization

See Also:
Constant Field Values

_infrequent

private boolean _infrequent
Is this compound interval fully contained in infrequent code?


reg

private final Register reg
The register this compound interval represents


spillInterval

private LinearScan.SpillLocationInterval spillInterval
A spill location assigned for this interval.

Constructor Detail

LinearScan.CompoundInterval

LinearScan.CompoundInterval(int dfnBegin,
                            int dfnEnd,
                            Register register)
Create a new compound interval of a single Basic interval


LinearScan.CompoundInterval

LinearScan.CompoundInterval(LinearScan.BasicInterval i,
                            Register register)
Create a new compound interval of a single Basic interval


LinearScan.CompoundInterval

LinearScan.CompoundInterval(Register r)
Dangerous constructor: use with care.

Method Detail

setFrequent

final void setFrequent()

isInfrequent

final boolean isInfrequent()

getSpillInterval

LinearScan.SpillLocationInterval getSpillInterval()

getRegister

Register getRegister()
Return the register this interval represents


copy

LinearScan.CompoundInterval copy(Register r)
Copy the ranges into a new interval associated with a register r.


copy

LinearScan.CompoundInterval copy(Register r,
                                 LinearScan.BasicInterval stop)
Copy the ranges into a new interval associated with a register r. Copy only the basic intervals up to and including stop.


addRange

LinearScan.BasicInterval addRange(LiveIntervalElement live,
                                  BasicBlock bb)
Add a new live range to this compound interval.

Parameters:
live - the new live range
bb - the basic block for live
Returns:
the new basic interval if one was created; null otherwise

shouldConcatenate

private boolean shouldConcatenate(LiveIntervalElement live,
                                  BasicBlock bb)
Should we simply merge the live interval live into a previous BasicInterval?

Parameters:
live - the live interval being queried
bb - the basic block in which live resides.

spill

void spill(LinearScan.SpillLocationManager spillManager)
Assign this compound interval to a free spill location.

Parameters:
spillManager - governing spill location manager

isSpilled

boolean isSpilled()
Has this interval been spilled?


assign

void assign(Register r)
Assign this compound interval to a physical register.


isAssigned

boolean isAssigned()
Has this interval been assigned to a physical register?


getAssignment

Register getAssignment()
Get the physical register this interval is assigned to. null if none assigned.


addNonIntersectingInterval

void addNonIntersectingInterval(LinearScan.CompoundInterval i,
                                LinearScan.BasicInterval stop)
Merge this interval with another, non-intersecting interval. Precondition: BasicInterval stop is an interval in i. This version will only merge basic intervals up to and including stop into this.


headSetInclusive

SortedSet<LinearScan.BasicInterval> headSetInclusive(LinearScan.BasicInterval upperBound)
Compute the headSet() [from java.util.SortedSet] but include all elements less than upperBound inclusive


headSetInclusive

SortedSet<LinearScan.BasicInterval> headSetInclusive(int upperBound)
Compute the headSet() [from java.util.SortedSet] but include all elements less than upperBound inclusive


tailSetInclusive

SortedSet<LinearScan.BasicInterval> tailSetInclusive(int lowerBound)
Compute the tailSet() [from java.util.SortedSet] but include all elements greater than lowerBound inclusive


removeIntervalsAndCache

LinearScan.CompoundInterval removeIntervalsAndCache(LinearScan.CompoundInterval i)
Remove some basic intervals from this compound interval, and return the intervals actually removed. PRECONDITION: all basic intervals in i must appear in this compound interval, unless they end after the end of this interval


removeAll

void removeAll(LinearScan.CompoundInterval c)
SJF: Apparently our java.util implementation of removeAll() doesn't work. Perhaps I've somehow screwed up the comparator with the "consistent with equals" property? It breaks javalex on BaseOptMarkSweep on IA32 Hopefully this problem will go away if/when we switch to classpath. Else, perhaps I'll ditch use of java.util Collections and write my own collection classes. In the meantime, here's an ugly hack to get around the problem.


getLowerBound

int getLowerBound()
Return the lowest DFN in this compound interval.


getUpperBound

int getUpperBound()
Return the highest DFN in this compound interval.


intersects

boolean intersects(LinearScan.CompoundInterval i)
Does this interval intersect with i?


getBasicInterval

LinearScan.BasicInterval getBasicInterval(Instruction s)
Return the first basic interval that contains a given instruction. If there is no such interval, return null;

Parameters:
s - The instruction in question

getBasicInterval

LinearScan.BasicInterval getBasicInterval(int n)
Return the first basic interval that contains the given instruction. If there is no such interval, return null;

Parameters:
n - The DFN of the instruction in question

toString

public String toString()
Make a String representation

Overrides:
toString in class LinearScan.IntervalSet