< prev index next >

src/share/vm/oops/oopsHierarchy.hpp

Print this page
rev 13429 : imported patch cmpxchg_template
rev 13451 : imported patch copyrights
   1 /*
   2  * Copyright (c) 1997, 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_OOPS_OOPSHIERARCHY_HPP
  26 #define SHARE_VM_OOPS_OOPSHIERARCHY_HPP
  27 


  28 #include "runtime/globals.hpp"
  29 #include "utilities/globalDefinitions.hpp"
  30 
  31 // OBJECT hierarchy
  32 // This hierarchy is a representation hierarchy, i.e. if A is a superclass
  33 // of B, A's representation is a prefix of B's representation.
  34 
  35 typedef juint narrowOop; // Offset instead of address for an oop within a java object
  36 
  37 // If compressed klass pointers then use narrowKlass.
  38 typedef juint  narrowKlass;
  39 
  40 typedef void* OopOrNarrowOopStar;
  41 typedef class   markOopDesc*                markOop;
  42 
  43 #ifndef CHECK_UNHANDLED_OOPS
  44 
  45 typedef class oopDesc*                            oop;
  46 typedef class   instanceOopDesc*            instanceOop;
  47 typedef class   arrayOopDesc*                    arrayOop;


 123   operator HeapWord* () const         { return (HeapWord*)obj(); }
 124   operator oopDesc* () const volatile { return obj(); }
 125   operator intptr_t* () const         { return (intptr_t*)obj(); }
 126   operator PromotedObject* () const   { return (PromotedObject*)obj(); }
 127   operator markOop () const volatile  { return markOop(obj()); }
 128   operator address   () const         { return (address)obj(); }
 129 
 130   // from javaCalls.cpp
 131   operator jobject () const           { return (jobject)obj(); }
 132   // from javaClasses.cpp
 133   operator JavaThread* () const       { return (JavaThread*)obj(); }
 134 
 135 #ifndef _LP64
 136   // from jvm.cpp
 137   operator jlong* () const            { return (jlong*)obj(); }
 138 #endif
 139 
 140   // from parNewGeneration and other things that want to get to the end of
 141   // an oop for stuff (like ObjArrayKlass.cpp)
 142   operator oop* () const              { return (oop *)obj(); }









 143 };
 144 
 145 #define DEF_OOP(type)                                                      \
 146    class type##OopDesc;                                                    \
 147    class type##Oop : public oop {                                          \
 148      public:                                                               \
 149        type##Oop() : oop() {}                                              \
 150        type##Oop(const oop& o) : oop(o) {}                                 \
 151        type##Oop(const volatile oop& o) : oop(o) {}                        \
 152        type##Oop(const void* p) : oop(p) {}                                \
 153        operator type##OopDesc* () const { return (type##OopDesc*)obj(); }  \
 154        type##OopDesc* operator->() const {                                 \
 155             return (type##OopDesc*)obj();                                  \
 156        }                                                                   \
 157        type##Oop& operator=(const type##Oop& o) {                          \
 158             oop::operator=(o);                                             \
 159             return *this;                                                  \
 160        }                                                                   \
 161        volatile type##Oop& operator=(const type##Oop& o) volatile {        \
 162             (void)const_cast<oop&>(oop::operator=(o));                     \


   1 /*
   2  * Copyright (c) 1997, 2017, 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_OOPS_OOPSHIERARCHY_HPP
  26 #define SHARE_VM_OOPS_OOPSHIERARCHY_HPP
  27 
  28 #include "metaprogramming/integerTypes.hpp"
  29 #include "metaprogramming/integralConstant.hpp"
  30 #include "runtime/globals.hpp"
  31 #include "utilities/globalDefinitions.hpp"
  32 
  33 // OBJECT hierarchy
  34 // This hierarchy is a representation hierarchy, i.e. if A is a superclass
  35 // of B, A's representation is a prefix of B's representation.
  36 
  37 typedef juint narrowOop; // Offset instead of address for an oop within a java object
  38 
  39 // If compressed klass pointers then use narrowKlass.
  40 typedef juint  narrowKlass;
  41 
  42 typedef void* OopOrNarrowOopStar;
  43 typedef class   markOopDesc*                markOop;
  44 
  45 #ifndef CHECK_UNHANDLED_OOPS
  46 
  47 typedef class oopDesc*                            oop;
  48 typedef class   instanceOopDesc*            instanceOop;
  49 typedef class   arrayOopDesc*                    arrayOop;


 125   operator HeapWord* () const         { return (HeapWord*)obj(); }
 126   operator oopDesc* () const volatile { return obj(); }
 127   operator intptr_t* () const         { return (intptr_t*)obj(); }
 128   operator PromotedObject* () const   { return (PromotedObject*)obj(); }
 129   operator markOop () const volatile  { return markOop(obj()); }
 130   operator address   () const         { return (address)obj(); }
 131 
 132   // from javaCalls.cpp
 133   operator jobject () const           { return (jobject)obj(); }
 134   // from javaClasses.cpp
 135   operator JavaThread* () const       { return (JavaThread*)obj(); }
 136 
 137 #ifndef _LP64
 138   // from jvm.cpp
 139   operator jlong* () const            { return (jlong*)obj(); }
 140 #endif
 141 
 142   // from parNewGeneration and other things that want to get to the end of
 143   // an oop for stuff (like ObjArrayKlass.cpp)
 144   operator oop* () const              { return (oop *)obj(); }
 145 };
 146 
 147 template<>
 148 struct IntegerTypes::Translate<oop> : public TrueType {
 149   typedef oop Value;
 150   typedef oopDesc* Decayed;
 151 
 152   static Decayed decay(Value x) { return x.obj(); }
 153   static Value recover(Decayed x) { return oop(x); }
 154 };
 155 
 156 #define DEF_OOP(type)                                                      \
 157    class type##OopDesc;                                                    \
 158    class type##Oop : public oop {                                          \
 159      public:                                                               \
 160        type##Oop() : oop() {}                                              \
 161        type##Oop(const oop& o) : oop(o) {}                                 \
 162        type##Oop(const volatile oop& o) : oop(o) {}                        \
 163        type##Oop(const void* p) : oop(p) {}                                \
 164        operator type##OopDesc* () const { return (type##OopDesc*)obj(); }  \
 165        type##OopDesc* operator->() const {                                 \
 166             return (type##OopDesc*)obj();                                  \
 167        }                                                                   \
 168        type##Oop& operator=(const type##Oop& o) {                          \
 169             oop::operator=(o);                                             \
 170             return *this;                                                  \
 171        }                                                                   \
 172        volatile type##Oop& operator=(const type##Oop& o) volatile {        \
 173             (void)const_cast<oop&>(oop::operator=(o));                     \


< prev index next >