src/share/vm/asm/register.hpp

Print this page


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


 192   AbstractRegister a,
 193   AbstractRegister b,
 194   AbstractRegister c,
 195   AbstractRegister d,
 196   AbstractRegister e,
 197   AbstractRegister f,
 198   AbstractRegister g,
 199   AbstractRegister h
 200 ) {
 201   assert(
 202     a != b && a != c && a != d && a != e && a != f && a != g && a != h
 203            && b != c && b != d && b != e && b != f && b != g && b != h
 204                      && c != d && c != e && c != f && c != g && c != h
 205                                && d != e && d != f && d != g && d != h
 206                                          && e != f && e != g && e != h
 207                                                    && f != g && f != h
 208                                                              && g != h,
 209     "registers must be different"
 210   );
 211 }


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


 197   AbstractRegister a,
 198   AbstractRegister b,
 199   AbstractRegister c,
 200   AbstractRegister d,
 201   AbstractRegister e,
 202   AbstractRegister f,
 203   AbstractRegister g,
 204   AbstractRegister h
 205 ) {
 206   assert(
 207     a != b && a != c && a != d && a != e && a != f && a != g && a != h
 208            && b != c && b != d && b != e && b != f && b != g && b != h
 209                      && c != d && c != e && c != f && c != g && c != h
 210                                && d != e && d != f && d != g && d != h
 211                                          && e != f && e != g && e != h
 212                                                    && f != g && f != h
 213                                                              && g != h,
 214     "registers must be different"
 215   );
 216 }
 217 
 218 #endif // SHARE_VM_ASM_REGISTER_HPP