< prev index next >

src/share/vm/code/vmreg.hpp

Print this page
rev 11647 : 8161258: Simplify including platform files.
Summary: Include patform files with macros cpu_header() etc. Do various cleanups of macro usages. Remove _64/_32 from adlc generated files and platform .hpp files. Merge stubRoutines_x86*.hpp. Remove empty mutex_<os>* files.
Reviewed-by: dholmes, coleenp, kbarrett
   1 /*
   2  * Copyright (c) 1998, 2014, 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 SHARE_VM_CODE_VMREG_HPP
  26 #define SHARE_VM_CODE_VMREG_HPP
  27 
  28 #include "asm/register.hpp"
  29 #include "memory/allocation.hpp"
  30 #include "utilities/globalDefinitions.hpp"

  31 #include "utilities/ostream.hpp"
  32 #ifdef COMPILER2
  33 #include "opto/adlcVMDeps.hpp"
  34 #endif
  35 
  36 //------------------------------VMReg------------------------------------------
  37 // The VM uses 'unwarped' stack slots; the compiler uses 'warped' stack slots.
  38 // Register numbers below VMRegImpl::stack0 are the same for both.  Register
  39 // numbers above stack0 are either warped (in the compiler) or unwarped
  40 // (in the VM).  Unwarped numbers represent stack indices, offsets from
  41 // the current stack pointer.  Warped numbers are required during compilation
  42 // when we do not yet know how big the frame will be.
  43 
  44 class VMRegImpl;
  45 typedef VMRegImpl* VMReg;
  46 
  47 class VMRegImpl {
  48 // friend class OopMap;
  49 friend class VMStructs;
  50 friend class OptoReg;


 122   VMReg bias(int offset) {
 123     assert(is_stack(), "must be");
 124     // VMReg res = VMRegImpl::as_VMReg(value() + offset);
 125     VMReg res = stack2reg(reg2stack() + offset);
 126     assert(res->is_stack(), "must be");
 127     return res;
 128   }
 129 
 130   // Convert register numbers to stack slots and vice versa
 131   static VMReg stack2reg( int idx ) {
 132     return (VMReg) (intptr_t) (stack0->value() + idx);
 133   }
 134 
 135   uintptr_t reg2stack() {
 136     assert( is_stack(), "Not a stack-based register" );
 137     return value() - stack0->value();
 138   }
 139 
 140   static void set_regName();
 141 
 142 #ifdef TARGET_ARCH_x86
 143 # include "vmreg_x86.hpp"
 144 #endif
 145 #ifdef TARGET_ARCH_sparc
 146 # include "vmreg_sparc.hpp"
 147 #endif
 148 #ifdef TARGET_ARCH_zero
 149 # include "vmreg_zero.hpp"
 150 #endif
 151 #ifdef TARGET_ARCH_arm
 152 # include "vmreg_arm.hpp"
 153 #endif
 154 #ifdef TARGET_ARCH_ppc
 155 # include "vmreg_ppc.hpp"
 156 #endif
 157 #ifdef TARGET_ARCH_aarch64
 158 # include "vmreg_aarch64.hpp"
 159 #endif
 160 
 161 
 162 };
 163 
 164 //---------------------------VMRegPair-------------------------------------------
 165 // Pairs of 32-bit registers for arguments.
 166 // SharedRuntime::java_calling_convention will overwrite the structs with
 167 // the calling convention's registers.  VMRegImpl::Bad is returned for any
 168 // unused 32-bit register.  This happens for the unused high half of Int
 169 // arguments, or for 32-bit pointers or for longs in the 32-bit sparc build
 170 // (which are passed to natives in low 32-bits of e.g. O0/O1 and the high
 171 // 32-bits of O0/O1 are set to VMRegImpl::Bad).  Longs in one register & doubles
 172 // always return a high and a low register, as do 64-bit pointers.
 173 //
 174 class VMRegPair {
 175 private:
 176   VMReg _second;
 177   VMReg _first;
 178 public:
 179   void set_bad (                   ) { _second=VMRegImpl::Bad(); _first=VMRegImpl::Bad(); }
 180   void set1    (         VMReg v  ) { _second=VMRegImpl::Bad(); _first=v; }


   1 /*
   2  * Copyright (c) 1998, 2016, 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 SHARE_VM_CODE_VMREG_HPP
  26 #define SHARE_VM_CODE_VMREG_HPP
  27 
  28 #include "asm/register.hpp"
  29 #include "memory/allocation.hpp"
  30 #include "utilities/globalDefinitions.hpp"
  31 #include "utilities/macros.hpp"
  32 #include "utilities/ostream.hpp"
  33 #ifdef COMPILER2
  34 #include "opto/adlcVMDeps.hpp"
  35 #endif
  36 
  37 //------------------------------VMReg------------------------------------------
  38 // The VM uses 'unwarped' stack slots; the compiler uses 'warped' stack slots.
  39 // Register numbers below VMRegImpl::stack0 are the same for both.  Register
  40 // numbers above stack0 are either warped (in the compiler) or unwarped
  41 // (in the VM).  Unwarped numbers represent stack indices, offsets from
  42 // the current stack pointer.  Warped numbers are required during compilation
  43 // when we do not yet know how big the frame will be.
  44 
  45 class VMRegImpl;
  46 typedef VMRegImpl* VMReg;
  47 
  48 class VMRegImpl {
  49 // friend class OopMap;
  50 friend class VMStructs;
  51 friend class OptoReg;


 123   VMReg bias(int offset) {
 124     assert(is_stack(), "must be");
 125     // VMReg res = VMRegImpl::as_VMReg(value() + offset);
 126     VMReg res = stack2reg(reg2stack() + offset);
 127     assert(res->is_stack(), "must be");
 128     return res;
 129   }
 130 
 131   // Convert register numbers to stack slots and vice versa
 132   static VMReg stack2reg( int idx ) {
 133     return (VMReg) (intptr_t) (stack0->value() + idx);
 134   }
 135 
 136   uintptr_t reg2stack() {
 137     assert( is_stack(), "Not a stack-based register" );
 138     return value() - stack0->value();
 139   }
 140 
 141   static void set_regName();
 142 
 143 #include CPU_HEADER(vmreg)


















 144 
 145 };
 146 
 147 //---------------------------VMRegPair-------------------------------------------
 148 // Pairs of 32-bit registers for arguments.
 149 // SharedRuntime::java_calling_convention will overwrite the structs with
 150 // the calling convention's registers.  VMRegImpl::Bad is returned for any
 151 // unused 32-bit register.  This happens for the unused high half of Int
 152 // arguments, or for 32-bit pointers or for longs in the 32-bit sparc build
 153 // (which are passed to natives in low 32-bits of e.g. O0/O1 and the high
 154 // 32-bits of O0/O1 are set to VMRegImpl::Bad).  Longs in one register & doubles
 155 // always return a high and a low register, as do 64-bit pointers.
 156 //
 157 class VMRegPair {
 158 private:
 159   VMReg _second;
 160   VMReg _first;
 161 public:
 162   void set_bad (                   ) { _second=VMRegImpl::Bad(); _first=VMRegImpl::Bad(); }
 163   void set1    (         VMReg v  ) { _second=VMRegImpl::Bad(); _first=v; }


< prev index next >