< prev index next >

src/hotspot/cpu/arm/macroAssembler_arm.hpp

Print this page
rev 53683 : 8218625: Remove dead code in relocInfo
Reviewed-by: TBD


   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *
  23  */
  24 
  25 #ifndef CPU_ARM_MACROASSEMBLER_ARM_HPP
  26 #define CPU_ARM_MACROASSEMBLER_ARM_HPP
  27 
  28 #include "code/relocInfo.hpp"
  29 #include "code/relocInfo_ext.hpp"
  30 
  31 class BiasedLockingCounters;
  32 
  33 // Introduced AddressLiteral and its subclasses to ease portability from
  34 // x86 and avoid relocation issues
  35 class AddressLiteral {
  36   RelocationHolder _rspec;
  37   // Typically we use AddressLiterals we want to use their rval
  38   // However in some situations we want the lval (effect address) of the item.
  39   // We provide a special factory for making those lvals.
  40   bool _is_lval;
  41 
  42   address          _target;
  43 
  44  private:
  45   static relocInfo::relocType reloc_for_target(address target) {
  46     // Used for ExternalAddress or when the type is not specified
  47     // Sometimes ExternalAddress is used for values which aren't
  48     // exactly addresses, like the card table base.
  49     // external_word_type can't be used for values in the first page


 496 
 497   void mov_float(FloatRegister fd, jfloat c, AsmCondition cond = al);
 498   void mov_double(FloatRegister fd, jdouble c, AsmCondition cond = al);
 499 
 500 
 501   // Note: this variant of mov_address assumes the address moves with
 502   // the code. Do *not* implement it with non-relocated instructions,
 503   // unless PC-relative.
 504   void mov_relative_address(Register rd, address addr, AsmCondition cond = al) {
 505     int offset = addr - pc() - 8;
 506     assert((offset & 3) == 0, "bad alignment");
 507     if (offset >= 0) {
 508       assert(AsmOperand::is_rotated_imm(offset), "addr too far");
 509       add(rd, PC, offset, cond);
 510     } else {
 511       assert(AsmOperand::is_rotated_imm(-offset), "addr too far");
 512       sub(rd, PC, -offset, cond);
 513     }
 514   }
 515 
 516   // Runtime address that may vary from one execution to another. The
 517   // symbolic_reference describes what the address is, allowing
 518   // the address to be resolved in a different execution context.
 519   // Warning: do not implement as a PC relative address.
 520   void mov_address(Register rd, address addr, symbolic_Relocation::symbolic_reference t) {
 521     mov_address(rd, addr, RelocationHolder::none);
 522   }
 523 
 524   // rspec can be RelocationHolder::none (for ignored symbolic_Relocation).
 525   // In that case, the address is absolute and the generated code need
 526   // not be relocable.
 527   void mov_address(Register rd, address addr, RelocationHolder const& rspec) {
 528     assert(rspec.type() != relocInfo::runtime_call_type, "do not use mov_address for runtime calls");
 529     assert(rspec.type() != relocInfo::static_call_type, "do not use mov_address for relocable calls");
 530     if (rspec.type() == relocInfo::none) {
 531       // absolute address, relocation not needed
 532       mov_slow(rd, (intptr_t)addr);
 533       return;
 534     }
 535     if (VM_Version::supports_movw()) {
 536       relocate(rspec);
 537       int c = (int)addr;
 538       movw(rd, c & 0xffff);
 539       if ((unsigned int)c >> 16) {
 540         movt(rd, (unsigned int)c >> 16);
 541       }
 542       return;
 543     }
 544     Label skip_literal;




   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *
  23  */
  24 
  25 #ifndef CPU_ARM_MACROASSEMBLER_ARM_HPP
  26 #define CPU_ARM_MACROASSEMBLER_ARM_HPP
  27 
  28 #include "code/relocInfo.hpp"

  29 
  30 class BiasedLockingCounters;
  31 
  32 // Introduced AddressLiteral and its subclasses to ease portability from
  33 // x86 and avoid relocation issues
  34 class AddressLiteral {
  35   RelocationHolder _rspec;
  36   // Typically we use AddressLiterals we want to use their rval
  37   // However in some situations we want the lval (effect address) of the item.
  38   // We provide a special factory for making those lvals.
  39   bool _is_lval;
  40 
  41   address          _target;
  42 
  43  private:
  44   static relocInfo::relocType reloc_for_target(address target) {
  45     // Used for ExternalAddress or when the type is not specified
  46     // Sometimes ExternalAddress is used for values which aren't
  47     // exactly addresses, like the card table base.
  48     // external_word_type can't be used for values in the first page


 495 
 496   void mov_float(FloatRegister fd, jfloat c, AsmCondition cond = al);
 497   void mov_double(FloatRegister fd, jdouble c, AsmCondition cond = al);
 498 
 499 
 500   // Note: this variant of mov_address assumes the address moves with
 501   // the code. Do *not* implement it with non-relocated instructions,
 502   // unless PC-relative.
 503   void mov_relative_address(Register rd, address addr, AsmCondition cond = al) {
 504     int offset = addr - pc() - 8;
 505     assert((offset & 3) == 0, "bad alignment");
 506     if (offset >= 0) {
 507       assert(AsmOperand::is_rotated_imm(offset), "addr too far");
 508       add(rd, PC, offset, cond);
 509     } else {
 510       assert(AsmOperand::is_rotated_imm(-offset), "addr too far");
 511       sub(rd, PC, -offset, cond);
 512     }
 513   }
 514 
 515   // Runtime address that may vary from one execution to another.


 516   // Warning: do not implement as a PC relative address.
 517   void mov_address(Register rd, address addr) {
 518     mov_address(rd, addr, RelocationHolder::none);
 519   }
 520 
 521   // rspec can be RelocationHolder::none (for ignored symbolic Relocation).
 522   // In that case, the address is absolute and the generated code need
 523   // not be relocable.
 524   void mov_address(Register rd, address addr, RelocationHolder const& rspec) {
 525     assert(rspec.type() != relocInfo::runtime_call_type, "do not use mov_address for runtime calls");
 526     assert(rspec.type() != relocInfo::static_call_type, "do not use mov_address for relocable calls");
 527     if (rspec.type() == relocInfo::none) {
 528       // absolute address, relocation not needed
 529       mov_slow(rd, (intptr_t)addr);
 530       return;
 531     }
 532     if (VM_Version::supports_movw()) {
 533       relocate(rspec);
 534       int c = (int)addr;
 535       movw(rd, c & 0xffff);
 536       if ((unsigned int)c >> 16) {
 537         movt(rd, (unsigned int)c >> 16);
 538       }
 539       return;
 540     }
 541     Label skip_literal;


< prev index next >