< prev index next >

hotspot/src/share/vm/c1/c1_LinearScan.hpp

Print this page
rev 10452 : imported patch primitive arrays


  27 
  28 #include "c1/c1_FpuStackSim.hpp"
  29 #include "c1/c1_FrameMap.hpp"
  30 #include "c1/c1_IR.hpp"
  31 #include "c1/c1_Instruction.hpp"
  32 #include "c1/c1_LIR.hpp"
  33 #include "c1/c1_LIRGenerator.hpp"
  34 
  35 class DebugInfoCache;
  36 class FpuStackAllocator;
  37 class IRScopeDebugInfo;
  38 class Interval;
  39 class IntervalWalker;
  40 class LIRGenerator;
  41 class LinearScan;
  42 class MoveResolver;
  43 class Range;
  44 
  45 typedef GrowableArray<Interval*> IntervalArray;
  46 typedef GrowableArray<Interval*> IntervalList;
  47 
  48 define_array(IntervalsArray, IntervalList*)
  49 define_stack(IntervalsList, IntervalsArray)
  50 
  51 define_array(OopMapArray, OopMap*)
  52 define_stack(OopMapList, OopMapArray)
  53 
  54 define_array(ScopeValueArray, ScopeValue*)
  55 
  56 define_array(LIR_OpListArray, LIR_OpList*);
  57 define_stack(LIR_OpListStack, LIR_OpListArray);
  58 
  59 
  60 enum IntervalUseKind {
  61   // priority of use kinds must be ascending
  62   noUse = 0,
  63   loopEndMarker = 1,
  64   shouldHaveRegister = 2,
  65   mustHaveRegister = 3,
  66 
  67   firstValidKind = 1,
  68   lastValidKind = 3
  69 };
  70 define_array(UseKindArray, IntervalUseKind)
  71 define_stack(UseKindStack, UseKindArray)
  72 
  73 
  74 enum IntervalKind {
  75   fixedKind = 0,  // interval pre-colored by LIR_Generator
  76   anyKind   = 1,  // no register/memory allocated by LIR_Generator
  77   nofKinds,
  78   firstKind = fixedKind
  79 };
  80 
  81 
  82 // during linear scan an interval is in one of four states in
  83 enum IntervalState {
  84   unhandledState = 0, // unhandled state (not processed yet)
  85   activeState   = 1,  // life and is in a physical register
  86   inactiveState = 2,  // in a life time hole and is in a physical register
  87   handledState  = 3,  // spilled or not life again
  88   invalidState = -1
  89 };
  90 
  91 
  92 enum IntervalSpillState {


 602   // returns true if this interval has a shadow copy on the stack that is always correct
 603   bool             always_in_memory() const      { return split_parent()->_spill_state == storeAtDefinition || split_parent()->_spill_state == startInMemory; }
 604 
 605   // caching of values that take time to compute and are used multiple times
 606   LIR_Opr          cached_opr() const            { return _cached_opr; }
 607   VMReg            cached_vm_reg() const         { return _cached_vm_reg; }
 608   void             set_cached_opr(LIR_Opr opr)   { _cached_opr = opr; }
 609   void             set_cached_vm_reg(VMReg reg)  { _cached_vm_reg = reg; }
 610 
 611   // access to use positions
 612   int    first_usage(IntervalUseKind min_use_kind) const;           // id of the first operation requiring this interval in a register
 613   int    next_usage(IntervalUseKind min_use_kind, int from) const;  // id of next usage seen from the given position
 614   int    next_usage_exact(IntervalUseKind exact_use_kind, int from) const;
 615   int    previous_usage(IntervalUseKind min_use_kind, int from) const;
 616 
 617   // manipulating intervals
 618   void   add_use_pos(int pos, IntervalUseKind use_kind);
 619   void   add_range(int from, int to);
 620   Interval* split(int split_pos);
 621   Interval* split_from_start(int split_pos);
 622   void remove_first_use_pos()                    { _use_pos_and_kinds.truncate(_use_pos_and_kinds.length() - 2); }
 623 
 624   // test intersection
 625   bool   covers(int op_id, LIR_OpVisitState::OprMode mode) const;
 626   bool   has_hole_between(int from, int to);
 627   bool   intersects(Interval* i) const           { return _first->intersects(i->_first); }
 628   int    intersects_at(Interval* i) const        { return _first->intersects_at(i->_first); }
 629 
 630   // range iteration
 631   void   rewind_range()                          { _current = _first; }
 632   void   next_range()                            { assert(this != _end, "not allowed on sentinel"); _current = _current->next(); }
 633   int    current_from() const                    { return _current->from(); }
 634   int    current_to() const                      { return _current->to(); }
 635   bool   current_at_end() const                  { return _current == Range::end(); }
 636   bool   current_intersects(Interval* it)        { return _current->intersects(it->_current); };
 637   int    current_intersects_at(Interval* it)     { return _current->intersects_at(it->_current); };
 638 
 639   // printing
 640   void print(outputStream* out = tty) const      PRODUCT_RETURN;
 641 };
 642 




  27 
  28 #include "c1/c1_FpuStackSim.hpp"
  29 #include "c1/c1_FrameMap.hpp"
  30 #include "c1/c1_IR.hpp"
  31 #include "c1/c1_Instruction.hpp"
  32 #include "c1/c1_LIR.hpp"
  33 #include "c1/c1_LIRGenerator.hpp"
  34 
  35 class DebugInfoCache;
  36 class FpuStackAllocator;
  37 class IRScopeDebugInfo;
  38 class Interval;
  39 class IntervalWalker;
  40 class LIRGenerator;
  41 class LinearScan;
  42 class MoveResolver;
  43 class Range;
  44 
  45 typedef GrowableArray<Interval*> IntervalArray;
  46 typedef GrowableArray<Interval*> IntervalList;
  47 typedef GrowableArray<IntervalList*> IntervalsList;
  48 typedef GrowableArray<ScopeValue*> ScopeValueArray;
  49 typedef GrowableArray<LIR_OpList*> LIR_OpListStack;









  50 
  51 enum IntervalUseKind {
  52   // priority of use kinds must be ascending
  53   noUse = 0,
  54   loopEndMarker = 1,
  55   shouldHaveRegister = 2,
  56   mustHaveRegister = 3,
  57 
  58   firstValidKind = 1,
  59   lastValidKind = 3
  60 };



  61 
  62 enum IntervalKind {
  63   fixedKind = 0,  // interval pre-colored by LIR_Generator
  64   anyKind   = 1,  // no register/memory allocated by LIR_Generator
  65   nofKinds,
  66   firstKind = fixedKind
  67 };
  68 
  69 
  70 // during linear scan an interval is in one of four states in
  71 enum IntervalState {
  72   unhandledState = 0, // unhandled state (not processed yet)
  73   activeState   = 1,  // life and is in a physical register
  74   inactiveState = 2,  // in a life time hole and is in a physical register
  75   handledState  = 3,  // spilled or not life again
  76   invalidState = -1
  77 };
  78 
  79 
  80 enum IntervalSpillState {


 590   // returns true if this interval has a shadow copy on the stack that is always correct
 591   bool             always_in_memory() const      { return split_parent()->_spill_state == storeAtDefinition || split_parent()->_spill_state == startInMemory; }
 592 
 593   // caching of values that take time to compute and are used multiple times
 594   LIR_Opr          cached_opr() const            { return _cached_opr; }
 595   VMReg            cached_vm_reg() const         { return _cached_vm_reg; }
 596   void             set_cached_opr(LIR_Opr opr)   { _cached_opr = opr; }
 597   void             set_cached_vm_reg(VMReg reg)  { _cached_vm_reg = reg; }
 598 
 599   // access to use positions
 600   int    first_usage(IntervalUseKind min_use_kind) const;           // id of the first operation requiring this interval in a register
 601   int    next_usage(IntervalUseKind min_use_kind, int from) const;  // id of next usage seen from the given position
 602   int    next_usage_exact(IntervalUseKind exact_use_kind, int from) const;
 603   int    previous_usage(IntervalUseKind min_use_kind, int from) const;
 604 
 605   // manipulating intervals
 606   void   add_use_pos(int pos, IntervalUseKind use_kind);
 607   void   add_range(int from, int to);
 608   Interval* split(int split_pos);
 609   Interval* split_from_start(int split_pos);
 610   void remove_first_use_pos()                    { _use_pos_and_kinds.trunc_to(_use_pos_and_kinds.length() - 2); }
 611 
 612   // test intersection
 613   bool   covers(int op_id, LIR_OpVisitState::OprMode mode) const;
 614   bool   has_hole_between(int from, int to);
 615   bool   intersects(Interval* i) const           { return _first->intersects(i->_first); }
 616   int    intersects_at(Interval* i) const        { return _first->intersects_at(i->_first); }
 617 
 618   // range iteration
 619   void   rewind_range()                          { _current = _first; }
 620   void   next_range()                            { assert(this != _end, "not allowed on sentinel"); _current = _current->next(); }
 621   int    current_from() const                    { return _current->from(); }
 622   int    current_to() const                      { return _current->to(); }
 623   bool   current_at_end() const                  { return _current == Range::end(); }
 624   bool   current_intersects(Interval* it)        { return _current->intersects(it->_current); };
 625   int    current_intersects_at(Interval* it)     { return _current->intersects_at(it->_current); };
 626 
 627   // printing
 628   void print(outputStream* out = tty) const      PRODUCT_RETURN;
 629 };
 630 


< prev index next >