src/cpu/sparc/vm/assembler_sparc.hpp

changeset 2950
cba7b5c2d53f
parent 2781
e1162778c1c8
child 3001
faa472957b38
     1.1 --- a/src/cpu/sparc/vm/assembler_sparc.hpp	Thu Jun 02 13:36:11 2011 -0700
     1.2 +++ b/src/cpu/sparc/vm/assembler_sparc.hpp	Fri Jun 03 22:31:43 2011 -0700
     1.3 @@ -309,12 +309,14 @@
     1.4  #endif
     1.5  
     1.6    // accessors
     1.7 -  Register base()      const { return _base; }
     1.8 -  Register index()     const { return _index_or_disp.as_register(); }
     1.9 -  int      disp()      const { return _index_or_disp.as_constant(); }
    1.10 -
    1.11 -  bool     has_index() const { return _index_or_disp.is_register(); }
    1.12 -  bool     has_disp()  const { return _index_or_disp.is_constant(); }
    1.13 +  Register base()             const { return _base; }
    1.14 +  Register index()            const { return _index_or_disp.as_register(); }
    1.15 +  int      disp()             const { return _index_or_disp.as_constant(); }
    1.16 +
    1.17 +  bool     has_index()        const { return _index_or_disp.is_register(); }
    1.18 +  bool     has_disp()         const { return _index_or_disp.is_constant(); }
    1.19 +
    1.20 +  bool     uses(Register reg) const { return base() == reg || (has_index() && index() == reg); }
    1.21  
    1.22    const relocInfo::relocType rtype() { return _rspec.type(); }
    1.23    const RelocationHolder&    rspec() { return _rspec; }
    1.24 @@ -330,6 +332,10 @@
    1.25      Address a(base(), disp() + plusdisp);
    1.26      return a;
    1.27    }
    1.28 +  bool is_same_address(Address a) const {
    1.29 +    // disregard _rspec
    1.30 +    return base() == a.base() && (has_index() ? index() == a.index() : disp() == a.disp());
    1.31 +  }
    1.32  
    1.33    Address after_save() const {
    1.34      Address a = (*this);
    1.35 @@ -436,6 +442,10 @@
    1.36      : _address((address) addr),
    1.37        _rspec(rspec_from_rtype(rtype, (address) addr)) {}
    1.38  
    1.39 +  AddressLiteral(oop* addr, relocInfo::relocType rtype = relocInfo::none)
    1.40 +    : _address((address) addr),
    1.41 +      _rspec(rspec_from_rtype(rtype, (address) addr)) {}
    1.42 +
    1.43    AddressLiteral(float* addr, relocInfo::relocType rtype = relocInfo::none)
    1.44      : _address((address) addr),
    1.45        _rspec(rspec_from_rtype(rtype, (address) addr)) {}
    1.46 @@ -455,6 +465,21 @@
    1.47    }
    1.48  };
    1.49  
    1.50 +// Convenience classes
    1.51 +class ExternalAddress: public AddressLiteral {
    1.52 + private:
    1.53 +  static relocInfo::relocType reloc_for_target(address target) {
    1.54 +    // Sometimes ExternalAddress is used for values which aren't
    1.55 +    // exactly addresses, like the card table base.
    1.56 +    // external_word_type can't be used for values in the first page
    1.57 +    // so just skip the reloc in that case.
    1.58 +    return external_word_Relocation::can_be_relocated(target) ? relocInfo::external_word_type : relocInfo::none;
    1.59 +  }
    1.60 +
    1.61 + public:
    1.62 +  ExternalAddress(address target) : AddressLiteral(target, reloc_for_target(          target)) {}
    1.63 +  ExternalAddress(oop*    target) : AddressLiteral(target, reloc_for_target((address) target)) {}
    1.64 +};
    1.65  
    1.66  inline Address RegisterImpl::address_in_saved_window() const {
    1.67     return (Address(SP, (sp_offset_in_saved_window() * wordSize) + STACK_BIAS));
    1.68 @@ -855,9 +880,8 @@
    1.69    // and be sign-extended. Check the range.
    1.70  
    1.71    static void assert_signed_range(intptr_t x, int nbits) {
    1.72 -    assert( nbits == 32
    1.73 -        ||  -(1 << nbits-1) <= x  &&  x < ( 1 << nbits-1),
    1.74 -      "value out of range");
    1.75 +    assert(nbits == 32 || (-(1 << nbits-1) <= x  &&  x < ( 1 << nbits-1)),
    1.76 +           err_msg("value out of range: x=" INTPTR_FORMAT ", nbits=%d", x, nbits));
    1.77    }
    1.78  
    1.79    static void assert_signed_word_disp_range(intptr_t x, int nbits) {
    1.80 @@ -2287,7 +2311,7 @@
    1.81    int total_frame_size_in_bytes(int extraWords);
    1.82  
    1.83    // used when extraWords known statically
    1.84 -  void save_frame(int extraWords);
    1.85 +  void save_frame(int extraWords = 0);
    1.86    void save_frame_c1(int size_in_bytes);
    1.87    // make a frame, and simultaneously pass up one or two register value
    1.88    // into the new register window
    1.89 @@ -2456,9 +2480,11 @@
    1.90    // offset relative to Gargs of argument at tos[arg_slot].
    1.91    // (arg_slot == 0 means the last argument, not the first).
    1.92    RegisterOrConstant argument_offset(RegisterOrConstant arg_slot,
    1.93 +                                     Register temp_reg,
    1.94                                       int extra_slot_offset = 0);
    1.95    // Address of Gargs and argument_offset.
    1.96    Address            argument_address(RegisterOrConstant arg_slot,
    1.97 +                                      Register temp_reg,
    1.98                                        int extra_slot_offset = 0);
    1.99  
   1.100    // Stack overflow checking

mercurial