< prev index next >

src/share/vm/asm/register.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) 2000, 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_ASM_REGISTER_HPP
  26 #define SHARE_VM_ASM_REGISTER_HPP
  27 
  28 #include "utilities/debug.hpp"
  29 #include "utilities/globalDefinitions.hpp"

  30 
  31 // Use AbstractRegister as shortcut
  32 class AbstractRegisterImpl;
  33 typedef AbstractRegisterImpl* AbstractRegister;
  34 
  35 
  36 // The super class for platform specific registers. Instead of using value objects,
  37 // registers are implemented as pointers. Subclassing is used so all registers can
  38 // use the debugging suport below. No virtual functions are used for efficiency.
  39 // They are canonicalized; i.e., registers are equal if their pointers are equal,
  40 // and vice versa. A concrete implementation may just map the register onto 'this'.
  41 
  42 class AbstractRegisterImpl {
  43  protected:
  44   int value() const                              { return (int)(intx)this; }
  45 };
  46 
  47 
  48 //
  49 // Macros for use in defining Register instances.  We'd like to be


  77 // enum { Gmethod_RegisterEnumValue = G5_RegisterEnumValue } ;
  78 //
  79 // REGISTER_DEFINITION(Register, G0);
  80 //
  81 // const Register G0 = ( ( Register ) G0_RegisterEnumValue ) ;
  82 //
  83 
  84 #define AS_REGISTER(type,name)         ((type)name##_##type##EnumValue)
  85 
  86 #define CONSTANT_REGISTER_DECLARATION(type, name, value) \
  87 extern const type name;                                  \
  88 enum { name##_##type##EnumValue = (value) }
  89 
  90 #define REGISTER_DECLARATION(type, name, value) \
  91 extern const type name;                         \
  92 enum { name##_##type##EnumValue = value##_##type##EnumValue }
  93 
  94 #define REGISTER_DEFINITION(type, name) \
  95 const type name = ((type)name##_##type##EnumValue)
  96 
  97 #ifdef TARGET_ARCH_x86
  98 # include "register_x86.hpp"
  99 #endif
 100 #ifdef TARGET_ARCH_sparc
 101 # include "register_sparc.hpp"
 102 #endif
 103 #ifdef TARGET_ARCH_zero
 104 # include "register_zero.hpp"
 105 #endif
 106 #ifdef TARGET_ARCH_arm
 107 # include "register_arm.hpp"
 108 #endif
 109 #ifdef TARGET_ARCH_ppc
 110 # include "register_ppc.hpp"
 111 #endif
 112 #ifdef TARGET_ARCH_aarch64
 113 # include "register_aarch64.hpp"
 114 #endif
 115 
 116 
 117 // Debugging support
 118 
 119 inline void assert_different_registers(
 120   AbstractRegister a,
 121   AbstractRegister b
 122 ) {
 123   assert(
 124     a != b,
 125     "registers must be different: a=" INTPTR_FORMAT ", b=" INTPTR_FORMAT "", p2i(a), p2i(b)
 126   );
 127 }
 128 
 129 
 130 inline void assert_different_registers(
 131   AbstractRegister a,
 132   AbstractRegister b,
 133   AbstractRegister c
 134 ) {
 135   assert(


   1 /*
   2  * Copyright (c) 2000, 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_ASM_REGISTER_HPP
  26 #define SHARE_VM_ASM_REGISTER_HPP
  27 
  28 #include "utilities/debug.hpp"
  29 #include "utilities/globalDefinitions.hpp"
  30 #include "utilities/macros.hpp"
  31 
  32 // Use AbstractRegister as shortcut
  33 class AbstractRegisterImpl;
  34 typedef AbstractRegisterImpl* AbstractRegister;
  35 
  36 
  37 // The super class for platform specific registers. Instead of using value objects,
  38 // registers are implemented as pointers. Subclassing is used so all registers can
  39 // use the debugging suport below. No virtual functions are used for efficiency.
  40 // They are canonicalized; i.e., registers are equal if their pointers are equal,
  41 // and vice versa. A concrete implementation may just map the register onto 'this'.
  42 
  43 class AbstractRegisterImpl {
  44  protected:
  45   int value() const                              { return (int)(intx)this; }
  46 };
  47 
  48 
  49 //
  50 // Macros for use in defining Register instances.  We'd like to be


  78 // enum { Gmethod_RegisterEnumValue = G5_RegisterEnumValue } ;
  79 //
  80 // REGISTER_DEFINITION(Register, G0);
  81 //
  82 // const Register G0 = ( ( Register ) G0_RegisterEnumValue ) ;
  83 //
  84 
  85 #define AS_REGISTER(type,name)         ((type)name##_##type##EnumValue)
  86 
  87 #define CONSTANT_REGISTER_DECLARATION(type, name, value) \
  88 extern const type name;                                  \
  89 enum { name##_##type##EnumValue = (value) }
  90 
  91 #define REGISTER_DECLARATION(type, name, value) \
  92 extern const type name;                         \
  93 enum { name##_##type##EnumValue = value##_##type##EnumValue }
  94 
  95 #define REGISTER_DEFINITION(type, name) \
  96 const type name = ((type)name##_##type##EnumValue)
  97 
  98 #include CPU_HEADER(register)


















  99 
 100 // Debugging support
 101 
 102 inline void assert_different_registers(
 103   AbstractRegister a,
 104   AbstractRegister b
 105 ) {
 106   assert(
 107     a != b,
 108     "registers must be different: a=" INTPTR_FORMAT ", b=" INTPTR_FORMAT "", p2i(a), p2i(b)
 109   );
 110 }
 111 
 112 
 113 inline void assert_different_registers(
 114   AbstractRegister a,
 115   AbstractRegister b,
 116   AbstractRegister c
 117 ) {
 118   assert(


< prev index next >