< prev index next >

src/hotspot/cpu/arm/macroAssembler_arm.hpp

Print this page

   1 /*
   2  * Copyright (c) 2008, 2025, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   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 "utilities/powerOfTwo.hpp"
  30 




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

1064   // improved x86 portability (minimizing source code changes)
1065 
1066   void ldr_literal(Register rd, AddressLiteral addr) {
1067     relocate(addr.rspec());
1068     ldr(rd, Address(PC, addr.target() - pc() - 8));
1069   }
1070 
1071   void lea(Register Rd, AddressLiteral addr) {
1072     // Never dereferenced, as on x86 (lval status ignored)
1073     mov_address(Rd, addr.target(), addr.rspec());
1074   }
1075 
1076   void restore_default_fp_mode();
1077 
1078   void safepoint_poll(Register tmp1, Label& slow_path);
1079   void get_polling_page(Register dest);
1080   void read_polling_page(Register dest, relocInfo::relocType rtype);
1081 
1082   static int ic_check_size();
1083   int ic_check(int end_alignment);





1084 };
1085 
1086 
1087 // The purpose of this class is to build several code fragments of the same size
1088 // in order to allow fast table branch.
1089 
1090 class FixedSizeCodeBlock {
1091 public:
1092   FixedSizeCodeBlock(MacroAssembler* masm, int size_in_instrs, bool enabled);
1093   ~FixedSizeCodeBlock();
1094 
1095 private:
1096   MacroAssembler* _masm;
1097   address _start;
1098   int _size_in_instrs;
1099   bool _enabled;
1100 };
1101 
1102 
1103 #endif // CPU_ARM_MACROASSEMBLER_ARM_HPP

   1 /*
   2  * Copyright (c) 2008, 2026, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   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 "utilities/powerOfTwo.hpp"
  30 
  31 class ciInlineKlass;
  32 class SigEntry;
  33 class VMRegPair;
  34 
  35 // Introduced AddressLiteral and its subclasses to ease portability from
  36 // x86 and avoid relocation issues
  37 class AddressLiteral {
  38   RelocationHolder _rspec;
  39   // Typically we use AddressLiterals we want to use their rval
  40   // However in some situations we want the lval (effect address) of the item.
  41   // We provide a special factory for making those lvals.
  42   bool _is_lval;
  43 
  44   address          _target;
  45 
  46  private:
  47   static relocInfo::relocType reloc_for_target(address target) {
  48     // Used for ExternalAddress or when the type is not specified
  49     // Sometimes ExternalAddress is used for values which aren't
  50     // exactly addresses, like the card table base.
  51     // external_word_type can't be used for values in the first page
  52     // so just skip the reloc in that case.
  53     return external_word_Relocation::can_be_relocated(target) ? relocInfo::external_word_type : relocInfo::none;
  54   }

1068   // improved x86 portability (minimizing source code changes)
1069 
1070   void ldr_literal(Register rd, AddressLiteral addr) {
1071     relocate(addr.rspec());
1072     ldr(rd, Address(PC, addr.target() - pc() - 8));
1073   }
1074 
1075   void lea(Register Rd, AddressLiteral addr) {
1076     // Never dereferenced, as on x86 (lval status ignored)
1077     mov_address(Rd, addr.target(), addr.rspec());
1078   }
1079 
1080   void restore_default_fp_mode();
1081 
1082   void safepoint_poll(Register tmp1, Label& slow_path);
1083   void get_polling_page(Register dest);
1084   void read_polling_page(Register dest, relocInfo::relocType rtype);
1085 
1086   static int ic_check_size();
1087   int ic_check(int end_alignment);
1088 
1089   // Inline type specific methods
1090   #include "asm/macroAssembler_common.hpp"
1091 
1092   void remove_frame(int initial_framesize);
1093 };
1094 
1095 
1096 // The purpose of this class is to build several code fragments of the same size
1097 // in order to allow fast table branch.
1098 
1099 class FixedSizeCodeBlock {
1100 public:
1101   FixedSizeCodeBlock(MacroAssembler* masm, int size_in_instrs, bool enabled);
1102   ~FixedSizeCodeBlock();
1103 
1104 private:
1105   MacroAssembler* _masm;
1106   address _start;
1107   int _size_in_instrs;
1108   bool _enabled;
1109 };
1110 
1111 
1112 #endif // CPU_ARM_MACROASSEMBLER_ARM_HPP
< prev index next >