< prev index next >

src/cpu/sparc/vm/macroAssembler_sparc.hpp

Print this page




 316 
 317   // Convert the raw encoding form into the form expected by the
 318   // constructor for Address.
 319   static Address make_raw(int base, int index, int scale, int disp, relocInfo::relocType disp_reloc);
 320 
 321   friend class Assembler;
 322 };
 323 
 324 
 325 class AddressLiteral VALUE_OBJ_CLASS_SPEC {
 326  private:
 327   address          _address;
 328   RelocationHolder _rspec;
 329 
 330   RelocationHolder rspec_from_rtype(relocInfo::relocType rtype, address addr) {
 331     switch (rtype) {
 332     case relocInfo::external_word_type:
 333       return external_word_Relocation::spec(addr);
 334     case relocInfo::internal_word_type:
 335       return internal_word_Relocation::spec(addr);
 336 #ifdef _LP64
 337     case relocInfo::opt_virtual_call_type:
 338       return opt_virtual_call_Relocation::spec();
 339     case relocInfo::static_call_type:
 340       return static_call_Relocation::spec();
 341     case relocInfo::runtime_call_type:
 342       return runtime_call_Relocation::spec();
 343 #endif
 344     case relocInfo::none:
 345       return RelocationHolder();
 346     default:
 347       ShouldNotReachHere();
 348       return RelocationHolder();
 349     }
 350   }
 351 
 352  protected:
 353   // creation
 354   AddressLiteral() : _address(NULL), _rspec(NULL) {}
 355 
 356  public:
 357   AddressLiteral(address addr, RelocationHolder const& rspec)
 358     : _address(addr),
 359       _rspec(rspec) {}
 360 
 361   // Some constructors to avoid casting at the call site.
 362   AddressLiteral(jobject obj, RelocationHolder const& rspec)
 363     : _address((address) obj),


 379   AddressLiteral(bool* addr, relocInfo::relocType rtype = relocInfo::none)
 380     : _address((address) addr),
 381       _rspec(rspec_from_rtype(rtype, (address) addr)) {}
 382 
 383   AddressLiteral(const bool* addr, relocInfo::relocType rtype = relocInfo::none)
 384     : _address((address) addr),
 385       _rspec(rspec_from_rtype(rtype, (address) addr)) {}
 386 
 387   AddressLiteral(signed char* addr, relocInfo::relocType rtype = relocInfo::none)
 388     : _address((address) addr),
 389       _rspec(rspec_from_rtype(rtype, (address) addr)) {}
 390 
 391   AddressLiteral(int* addr, relocInfo::relocType rtype = relocInfo::none)
 392     : _address((address) addr),
 393       _rspec(rspec_from_rtype(rtype, (address) addr)) {}
 394 
 395   AddressLiteral(intptr_t addr, relocInfo::relocType rtype = relocInfo::none)
 396     : _address((address) addr),
 397       _rspec(rspec_from_rtype(rtype, (address) addr)) {}
 398 
 399 #ifdef _LP64
 400   // 32-bit complains about a multiple declaration for int*.
 401   AddressLiteral(intptr_t* addr, relocInfo::relocType rtype = relocInfo::none)
 402     : _address((address) addr),
 403       _rspec(rspec_from_rtype(rtype, (address) addr)) {}
 404 #endif
 405 
 406   AddressLiteral(Metadata* addr, relocInfo::relocType rtype = relocInfo::none)
 407     : _address((address) addr),
 408       _rspec(rspec_from_rtype(rtype, (address) addr)) {}
 409 
 410   AddressLiteral(Metadata** addr, relocInfo::relocType rtype = relocInfo::none)
 411     : _address((address) addr),
 412       _rspec(rspec_from_rtype(rtype, (address) addr)) {}
 413 
 414   AddressLiteral(float* addr, relocInfo::relocType rtype = relocInfo::none)
 415     : _address((address) addr),
 416       _rspec(rspec_from_rtype(rtype, (address) addr)) {}
 417 
 418   AddressLiteral(double* addr, relocInfo::relocType rtype = relocInfo::none)
 419     : _address((address) addr),
 420       _rspec(rspec_from_rtype(rtype, (address) addr)) {}
 421 
 422   intptr_t value() const { return (intptr_t) _address; }
 423   int      low10() const;
 424 


 447 };
 448 
 449 inline Address RegisterImpl::address_in_saved_window() const {
 450    return (Address(SP, (sp_offset_in_saved_window() * wordSize) + STACK_BIAS));
 451 }
 452 
 453 
 454 
 455 // Argument is an abstraction used to represent an outgoing
 456 // actual argument or an incoming formal parameter, whether
 457 // it resides in memory or in a register, in a manner consistent
 458 // with the SPARC Application Binary Interface, or ABI.  This is
 459 // often referred to as the native or C calling convention.
 460 
 461 class Argument VALUE_OBJ_CLASS_SPEC {
 462  private:
 463   int _number;
 464   bool _is_in;
 465 
 466  public:
 467 #ifdef _LP64
 468   enum {
 469     n_register_parameters = 6,          // only 6 registers may contain integer parameters
 470     n_float_register_parameters = 16    // Can have up to 16 floating registers
 471   };
 472 #else
 473   enum {
 474     n_register_parameters = 6           // only 6 registers may contain integer parameters
 475   };
 476 #endif
 477 
 478   // creation
 479   Argument(int number, bool is_in) : _number(number), _is_in(is_in) {}
 480 
 481   int  number() const  { return _number;  }
 482   bool is_in()  const  { return _is_in;   }
 483   bool is_out() const  { return !is_in(); }
 484 
 485   Argument successor() const  { return Argument(number() + 1, is_in()); }
 486   Argument as_in()     const  { return Argument(number(), true ); }
 487   Argument as_out()    const  { return Argument(number(), false); }
 488 
 489   // locating register-based arguments:
 490   bool is_register() const { return _number < n_register_parameters; }
 491 
 492 #ifdef _LP64
 493   // locating Floating Point register-based arguments:
 494   bool is_float_register() const { return _number < n_float_register_parameters; }
 495 
 496   FloatRegister as_float_register() const {
 497     assert(is_float_register(), "must be a register argument");
 498     return as_FloatRegister(( number() *2 ) + 1);
 499   }
 500   FloatRegister as_double_register() const {
 501     assert(is_float_register(), "must be a register argument");
 502     return as_FloatRegister(( number() *2 ));
 503   }
 504 #endif
 505 
 506   Register as_register() const {
 507     assert(is_register(), "must be a register argument");
 508     return is_in() ? as_iRegister(number()) : as_oRegister(number());
 509   }
 510 
 511   // locating memory-based arguments
 512   Address as_address() const {
 513     assert(!is_register(), "must be a memory argument");
 514     return address_in_frame();
 515   }
 516 
 517   // When applied to a register-based argument, give the corresponding address
 518   // into the 6-word area "into which callee may store register arguments"
 519   // (This is a different place than the corresponding register-save area location.)
 520   Address address_in_frame() const;
 521 
 522   // debugging
 523   const char* name() const;
 524 


1200 
1201   static void debug(char* msg, RegistersForDebugging* outWindow);
1202 
1203   // implementations of bytecodes used by both interpreter and compiler
1204 
1205   void lcmp( Register Ra_hi, Register Ra_low,
1206              Register Rb_hi, Register Rb_low,
1207              Register Rresult);
1208 
1209   void lneg( Register Rhi, Register Rlow );
1210 
1211   void lshl(  Register Rin_high,  Register Rin_low,  Register Rcount,
1212               Register Rout_high, Register Rout_low, Register Rtemp );
1213 
1214   void lshr(  Register Rin_high,  Register Rin_low,  Register Rcount,
1215               Register Rout_high, Register Rout_low, Register Rtemp );
1216 
1217   void lushr( Register Rin_high,  Register Rin_low,  Register Rcount,
1218               Register Rout_high, Register Rout_low, Register Rtemp );
1219 
1220 #ifdef _LP64
1221   void lcmp( Register Ra, Register Rb, Register Rresult);
1222 #endif
1223 
1224   // Load and store values by size and signed-ness
1225   void load_sized_value( Address src, Register dst, size_t size_in_bytes, bool is_signed);
1226   void store_sized_value(Register src, Address dst, size_t size_in_bytes);
1227 
1228   void float_cmp( bool is_float, int unordered_result,
1229                   FloatRegister Fa, FloatRegister Fb,
1230                   Register Rresult);
1231 
1232   void save_all_globals_into_locals();
1233   void restore_globals_from_locals();
1234 
1235   // These set the icc condition code to equal if the lock succeeded
1236   // and notEqual if it failed and requires a slow case
1237   void compiler_lock_object(Register Roop, Register Rmark, Register Rbox,
1238                             Register Rscratch,
1239                             BiasedLockingCounters* counters = NULL,
1240                             bool try_bias = UseBiasedLocking);
1241   void compiler_unlock_object(Register Roop, Register Rmark, Register Rbox,
1242                               Register Rscratch,




 316 
 317   // Convert the raw encoding form into the form expected by the
 318   // constructor for Address.
 319   static Address make_raw(int base, int index, int scale, int disp, relocInfo::relocType disp_reloc);
 320 
 321   friend class Assembler;
 322 };
 323 
 324 
 325 class AddressLiteral VALUE_OBJ_CLASS_SPEC {
 326  private:
 327   address          _address;
 328   RelocationHolder _rspec;
 329 
 330   RelocationHolder rspec_from_rtype(relocInfo::relocType rtype, address addr) {
 331     switch (rtype) {
 332     case relocInfo::external_word_type:
 333       return external_word_Relocation::spec(addr);
 334     case relocInfo::internal_word_type:
 335       return internal_word_Relocation::spec(addr);

 336     case relocInfo::opt_virtual_call_type:
 337       return opt_virtual_call_Relocation::spec();
 338     case relocInfo::static_call_type:
 339       return static_call_Relocation::spec();
 340     case relocInfo::runtime_call_type:
 341       return runtime_call_Relocation::spec();

 342     case relocInfo::none:
 343       return RelocationHolder();
 344     default:
 345       ShouldNotReachHere();
 346       return RelocationHolder();
 347     }
 348   }
 349 
 350  protected:
 351   // creation
 352   AddressLiteral() : _address(NULL), _rspec(NULL) {}
 353 
 354  public:
 355   AddressLiteral(address addr, RelocationHolder const& rspec)
 356     : _address(addr),
 357       _rspec(rspec) {}
 358 
 359   // Some constructors to avoid casting at the call site.
 360   AddressLiteral(jobject obj, RelocationHolder const& rspec)
 361     : _address((address) obj),


 377   AddressLiteral(bool* addr, relocInfo::relocType rtype = relocInfo::none)
 378     : _address((address) addr),
 379       _rspec(rspec_from_rtype(rtype, (address) addr)) {}
 380 
 381   AddressLiteral(const bool* addr, relocInfo::relocType rtype = relocInfo::none)
 382     : _address((address) addr),
 383       _rspec(rspec_from_rtype(rtype, (address) addr)) {}
 384 
 385   AddressLiteral(signed char* addr, relocInfo::relocType rtype = relocInfo::none)
 386     : _address((address) addr),
 387       _rspec(rspec_from_rtype(rtype, (address) addr)) {}
 388 
 389   AddressLiteral(int* addr, relocInfo::relocType rtype = relocInfo::none)
 390     : _address((address) addr),
 391       _rspec(rspec_from_rtype(rtype, (address) addr)) {}
 392 
 393   AddressLiteral(intptr_t addr, relocInfo::relocType rtype = relocInfo::none)
 394     : _address((address) addr),
 395       _rspec(rspec_from_rtype(rtype, (address) addr)) {}
 396 

 397   // 32-bit complains about a multiple declaration for int*.
 398   AddressLiteral(intptr_t* addr, relocInfo::relocType rtype = relocInfo::none)
 399     : _address((address) addr),
 400       _rspec(rspec_from_rtype(rtype, (address) addr)) {}

 401 
 402   AddressLiteral(Metadata* addr, relocInfo::relocType rtype = relocInfo::none)
 403     : _address((address) addr),
 404       _rspec(rspec_from_rtype(rtype, (address) addr)) {}
 405 
 406   AddressLiteral(Metadata** addr, relocInfo::relocType rtype = relocInfo::none)
 407     : _address((address) addr),
 408       _rspec(rspec_from_rtype(rtype, (address) addr)) {}
 409 
 410   AddressLiteral(float* addr, relocInfo::relocType rtype = relocInfo::none)
 411     : _address((address) addr),
 412       _rspec(rspec_from_rtype(rtype, (address) addr)) {}
 413 
 414   AddressLiteral(double* addr, relocInfo::relocType rtype = relocInfo::none)
 415     : _address((address) addr),
 416       _rspec(rspec_from_rtype(rtype, (address) addr)) {}
 417 
 418   intptr_t value() const { return (intptr_t) _address; }
 419   int      low10() const;
 420 


 443 };
 444 
 445 inline Address RegisterImpl::address_in_saved_window() const {
 446    return (Address(SP, (sp_offset_in_saved_window() * wordSize) + STACK_BIAS));
 447 }
 448 
 449 
 450 
 451 // Argument is an abstraction used to represent an outgoing
 452 // actual argument or an incoming formal parameter, whether
 453 // it resides in memory or in a register, in a manner consistent
 454 // with the SPARC Application Binary Interface, or ABI.  This is
 455 // often referred to as the native or C calling convention.
 456 
 457 class Argument VALUE_OBJ_CLASS_SPEC {
 458  private:
 459   int _number;
 460   bool _is_in;
 461 
 462  public:

 463   enum {
 464     n_register_parameters = 6,          // only 6 registers may contain integer parameters
 465     n_float_register_parameters = 16    // Can have up to 16 floating registers
 466   };





 467 
 468   // creation
 469   Argument(int number, bool is_in) : _number(number), _is_in(is_in) {}
 470 
 471   int  number() const  { return _number;  }
 472   bool is_in()  const  { return _is_in;   }
 473   bool is_out() const  { return !is_in(); }
 474 
 475   Argument successor() const  { return Argument(number() + 1, is_in()); }
 476   Argument as_in()     const  { return Argument(number(), true ); }
 477   Argument as_out()    const  { return Argument(number(), false); }
 478 
 479   // locating register-based arguments:
 480   bool is_register() const { return _number < n_register_parameters; }
 481 

 482   // locating Floating Point register-based arguments:
 483   bool is_float_register() const { return _number < n_float_register_parameters; }
 484 
 485   FloatRegister as_float_register() const {
 486     assert(is_float_register(), "must be a register argument");
 487     return as_FloatRegister(( number() *2 ) + 1);
 488   }
 489   FloatRegister as_double_register() const {
 490     assert(is_float_register(), "must be a register argument");
 491     return as_FloatRegister(( number() *2 ));
 492   }

 493 
 494   Register as_register() const {
 495     assert(is_register(), "must be a register argument");
 496     return is_in() ? as_iRegister(number()) : as_oRegister(number());
 497   }
 498 
 499   // locating memory-based arguments
 500   Address as_address() const {
 501     assert(!is_register(), "must be a memory argument");
 502     return address_in_frame();
 503   }
 504 
 505   // When applied to a register-based argument, give the corresponding address
 506   // into the 6-word area "into which callee may store register arguments"
 507   // (This is a different place than the corresponding register-save area location.)
 508   Address address_in_frame() const;
 509 
 510   // debugging
 511   const char* name() const;
 512 


1188 
1189   static void debug(char* msg, RegistersForDebugging* outWindow);
1190 
1191   // implementations of bytecodes used by both interpreter and compiler
1192 
1193   void lcmp( Register Ra_hi, Register Ra_low,
1194              Register Rb_hi, Register Rb_low,
1195              Register Rresult);
1196 
1197   void lneg( Register Rhi, Register Rlow );
1198 
1199   void lshl(  Register Rin_high,  Register Rin_low,  Register Rcount,
1200               Register Rout_high, Register Rout_low, Register Rtemp );
1201 
1202   void lshr(  Register Rin_high,  Register Rin_low,  Register Rcount,
1203               Register Rout_high, Register Rout_low, Register Rtemp );
1204 
1205   void lushr( Register Rin_high,  Register Rin_low,  Register Rcount,
1206               Register Rout_high, Register Rout_low, Register Rtemp );
1207 

1208   void lcmp( Register Ra, Register Rb, Register Rresult);

1209 
1210   // Load and store values by size and signed-ness
1211   void load_sized_value( Address src, Register dst, size_t size_in_bytes, bool is_signed);
1212   void store_sized_value(Register src, Address dst, size_t size_in_bytes);
1213 
1214   void float_cmp( bool is_float, int unordered_result,
1215                   FloatRegister Fa, FloatRegister Fb,
1216                   Register Rresult);
1217 
1218   void save_all_globals_into_locals();
1219   void restore_globals_from_locals();
1220 
1221   // These set the icc condition code to equal if the lock succeeded
1222   // and notEqual if it failed and requires a slow case
1223   void compiler_lock_object(Register Roop, Register Rmark, Register Rbox,
1224                             Register Rscratch,
1225                             BiasedLockingCounters* counters = NULL,
1226                             bool try_bias = UseBiasedLocking);
1227   void compiler_unlock_object(Register Roop, Register Rmark, Register Rbox,
1228                               Register Rscratch,


< prev index next >