< prev index next >

src/hotspot/share/runtime/registerMap.hpp

Print this page
rev 50307 : [mq]: cont


  58 //      values of the callee-saved registers does not matter, e.g., if you
  59 //      only need the static properties such as frame type, pc, and such.
  60 //      Updating of the RegisterMap can be turned off by instantiating the
  61 //      register map as: RegisterMap map(thread, false);
  62 
  63 class RegisterMap : public StackObj {
  64  public:
  65     typedef julong LocationValidType;
  66   enum {
  67     reg_count = ConcreteRegisterImpl::number_of_registers,
  68     location_valid_type_size = sizeof(LocationValidType)*8,
  69     location_valid_size = (reg_count+location_valid_type_size-1)/location_valid_type_size
  70   };
  71  private:
  72   intptr_t*    _location[reg_count];    // Location of registers (intptr_t* looks better than address in the debugger)
  73   LocationValidType _location_valid[location_valid_size];
  74   bool        _include_argument_oops;   // Should include argument_oop marked locations for compiler
  75   JavaThread* _thread;                  // Reference to current thread
  76   bool        _update_map;              // Tells if the register map need to be
  77                                         // updated when traversing the stack

  78 
  79 #ifdef ASSERT
  80   void check_location_valid();
  81 #else
  82   void check_location_valid() {}
  83 #endif
  84 
  85  public:
  86   debug_only(intptr_t* _update_for_id;) // Assert that RegisterMap is not updated twice for same frame
  87   RegisterMap(JavaThread *thread, bool update_map = true);
  88   RegisterMap(const RegisterMap* map);
  89 
  90   address location(VMReg reg) const {
  91     int index = reg->value() / location_valid_type_size;
  92     assert(0 <= reg->value() && reg->value() < reg_count, "range check");
  93     assert(0 <= index && index < location_valid_size, "range check");
  94     if (_location_valid[index] & ((LocationValidType)1 << (reg->value() % location_valid_type_size))) {
  95       return (address) _location[reg->value()];
  96     } else {
  97       return pd_location(reg);
  98     }
  99   }
 100 
 101   void set_location(VMReg reg, address loc) {
 102     int index = reg->value() / location_valid_type_size;
 103     assert(0 <= reg->value() && reg->value() < reg_count, "range check");
 104     assert(0 <= index && index < location_valid_size, "range check");
 105     assert(_update_map, "updating map that does not need updating");
 106     _location[reg->value()] = (intptr_t*) loc;
 107     _location_valid[index] |= ((LocationValidType)1 << (reg->value() % location_valid_type_size));
 108     check_location_valid();
 109   }
 110 
 111   // Called by an entry frame.
 112   void clear();
 113 
 114   bool include_argument_oops() const      { return _include_argument_oops; }
 115   void set_include_argument_oops(bool f)  { _include_argument_oops = f; }
 116 
 117   JavaThread *thread() const { return _thread; }
 118   bool update_map()    const { return _update_map; }

 119 
 120   void print_on(outputStream* st) const;
 121   void print() const;
 122 
 123   // the following contains the definition of pd_xxx methods
 124 #include CPU_HEADER(registerMap)
 125 
 126 };
 127 
 128 #endif // SHARE_VM_RUNTIME_REGISTERMAP_HPP


  58 //      values of the callee-saved registers does not matter, e.g., if you
  59 //      only need the static properties such as frame type, pc, and such.
  60 //      Updating of the RegisterMap can be turned off by instantiating the
  61 //      register map as: RegisterMap map(thread, false);
  62 
  63 class RegisterMap : public StackObj {
  64  public:
  65     typedef julong LocationValidType;
  66   enum {
  67     reg_count = ConcreteRegisterImpl::number_of_registers,
  68     location_valid_type_size = sizeof(LocationValidType)*8,
  69     location_valid_size = (reg_count+location_valid_type_size-1)/location_valid_type_size
  70   };
  71  private:
  72   intptr_t*    _location[reg_count];    // Location of registers (intptr_t* looks better than address in the debugger)
  73   LocationValidType _location_valid[location_valid_size];
  74   bool        _include_argument_oops;   // Should include argument_oop marked locations for compiler
  75   JavaThread* _thread;                  // Reference to current thread
  76   bool        _update_map;              // Tells if the register map need to be
  77                                         // updated when traversing the stack
  78   bool _validate_oops;                 // whether to perform valid oop checks in asserts
  79 
  80 #ifdef ASSERT
  81   void check_location_valid();
  82 #else
  83   void check_location_valid() {}
  84 #endif
  85 
  86  public:
  87   DEBUG_ONLY(intptr_t* _update_for_id;) // Assert that RegisterMap is not updated twice for same frame
  88   RegisterMap(JavaThread *thread, bool update_map = true, bool validate_oops = true);
  89   RegisterMap(const RegisterMap* map);
  90 
  91   address location(VMReg reg) const {
  92     int index = reg->value() / location_valid_type_size;
  93     assert(0 <= reg->value() && reg->value() < reg_count, "range check");
  94     assert(0 <= index && index < location_valid_size, "range check");
  95     if (_location_valid[index] & ((LocationValidType)1 << (reg->value() % location_valid_type_size))) {
  96       return (address) _location[reg->value()];
  97     } else {
  98       return pd_location(reg);
  99     }
 100   }
 101 
 102   void set_location(VMReg reg, address loc) {
 103     int index = reg->value() / location_valid_type_size;
 104     assert(0 <= reg->value() && reg->value() < reg_count, "range check");
 105     assert(0 <= index && index < location_valid_size, "range check");
 106     assert(_update_map, "updating map that does not need updating");
 107     _location[reg->value()] = (intptr_t*) loc;
 108     _location_valid[index] |= ((LocationValidType)1 << (reg->value() % location_valid_type_size));
 109     check_location_valid();
 110   }
 111 
 112   // Called by an entry frame.
 113   void clear();
 114 
 115   bool include_argument_oops() const      { return _include_argument_oops; }
 116   void set_include_argument_oops(bool f)  { _include_argument_oops = f; }
 117 
 118   JavaThread *thread() const { return _thread; }
 119   bool update_map()    const { return _update_map; }
 120   bool validate_oops() const { return _validate_oops; }
 121 
 122   void print_on(outputStream* st) const;
 123   void print() const;
 124 
 125   // the following contains the definition of pd_xxx methods
 126 #include CPU_HEADER(registerMap)
 127 
 128 };
 129 
 130 #endif // SHARE_VM_RUNTIME_REGISTERMAP_HPP
< prev index next >