src/hotspot/share/oops/oopsHierarchy.hpp
author coleenp
Wed, 24 Jul 2019 10:22:11 -0400
changeset 57511 00ae3b739184
parent 54786 ebf733a324d4
child 57777 90ead0febf56
child 58678 9cf78a70fa4f
permissions -rw-r--r--
8228485: JVM crashes when bootstrap method for condy triggers loading of class whose static initializer throws exception Summary: Add case for JVM_CONSTANT_Dynamic in error_message function. Reviewed-by: dholmes, shade
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
     1
/*
53149
259c36ef27df 8215731: Move forward class definitions out of globalDefinitions.hpp
coleenp
parents: 52070
diff changeset
     2
 * Copyright (c) 1997, 2019, Oracle and/or its affiliates. All rights reserved.
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
489c9b5090e2 Initial load
duke
parents:
diff changeset
     4
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
489c9b5090e2 Initial load
duke
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
489c9b5090e2 Initial load
duke
parents:
diff changeset
     7
 * published by the Free Software Foundation.
489c9b5090e2 Initial load
duke
parents:
diff changeset
     8
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
489c9b5090e2 Initial load
duke
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
489c9b5090e2 Initial load
duke
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
489c9b5090e2 Initial load
duke
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
489c9b5090e2 Initial load
duke
parents:
diff changeset
    13
 * accompanied this code).
489c9b5090e2 Initial load
duke
parents:
diff changeset
    14
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
489c9b5090e2 Initial load
duke
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
489c9b5090e2 Initial load
duke
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    18
 *
5547
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 3262
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 3262
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 3262
diff changeset
    21
 * questions.
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    22
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
    23
 */
489c9b5090e2 Initial load
duke
parents:
diff changeset
    24
53244
9807daeb47c4 8216167: Update include guards to reflect correct directories
coleenp
parents: 53149
diff changeset
    25
#ifndef SHARE_OOPS_OOPSHIERARCHY_HPP
9807daeb47c4 8216167: Update include guards to reflect correct directories
coleenp
parents: 53149
diff changeset
    26
#define SHARE_OOPS_OOPSHIERARCHY_HPP
7397
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    27
46958
a13bd8c6b7a2 8186166: Generalize Atomic::cmpxchg with templates
eosterlund
parents: 25478
diff changeset
    28
#include "metaprogramming/integralConstant.hpp"
a13bd8c6b7a2 8186166: Generalize Atomic::cmpxchg with templates
eosterlund
parents: 25478
diff changeset
    29
#include "metaprogramming/primitiveConversions.hpp"
7397
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    30
#include "utilities/globalDefinitions.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    31
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    32
// OBJECT hierarchy
489c9b5090e2 Initial load
duke
parents:
diff changeset
    33
// This hierarchy is a representation hierarchy, i.e. if A is a superclass
489c9b5090e2 Initial load
duke
parents:
diff changeset
    34
// of B, A's representation is a prefix of B's representation.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    35
360
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
    36
typedef juint narrowOop; // Offset instead of address for an oop within a java object
19319
0ad35be0733a 8003424: Enable Class Data Sharing for CompressedOops
hseigel
parents: 13952
diff changeset
    37
0ad35be0733a 8003424: Enable Class Data Sharing for CompressedOops
hseigel
parents: 13952
diff changeset
    38
// If compressed klass pointers then use narrowKlass.
0ad35be0733a 8003424: Enable Class Data Sharing for CompressedOops
hseigel
parents: 13952
diff changeset
    39
typedef juint  narrowKlass;
0ad35be0733a 8003424: Enable Class Data Sharing for CompressedOops
hseigel
parents: 13952
diff changeset
    40
3262
30d1c247fc25 6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents: 2105
diff changeset
    41
typedef void* OopOrNarrowOopStar;
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 8725
diff changeset
    42
typedef class   markOopDesc*                markOop;
360
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
    43
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    44
#ifndef CHECK_UNHANDLED_OOPS
489c9b5090e2 Initial load
duke
parents:
diff changeset
    45
360
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
    46
typedef class oopDesc*                            oop;
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    47
typedef class   instanceOopDesc*            instanceOop;
360
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
    48
typedef class   arrayOopDesc*                    arrayOop;
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
    49
typedef class     objArrayOopDesc*            objArrayOop;
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
    50
typedef class     typeArrayOopDesc*            typeArrayOop;
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    51
489c9b5090e2 Initial load
duke
parents:
diff changeset
    52
#else
489c9b5090e2 Initial load
duke
parents:
diff changeset
    53
489c9b5090e2 Initial load
duke
parents:
diff changeset
    54
// When CHECK_UNHANDLED_OOPS is defined, an "oop" is a class with a
489c9b5090e2 Initial load
duke
parents:
diff changeset
    55
// carefully chosen set of constructors and conversion operators to go
489c9b5090e2 Initial load
duke
parents:
diff changeset
    56
// to and from the underlying oopDesc pointer type.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    57
//
489c9b5090e2 Initial load
duke
parents:
diff changeset
    58
// Because oop and its subclasses <type>Oop are class types, arbitrary
20282
7f9cbdf89af2 7195622: CheckUnhandledOops has limited usefulness now
hseigel
parents: 19319
diff changeset
    59
// conversions are not accepted by the compiler.  Applying a cast to
7f9cbdf89af2 7195622: CheckUnhandledOops has limited usefulness now
hseigel
parents: 19319
diff changeset
    60
// an oop will cause the best matched conversion operator to be
7f9cbdf89af2 7195622: CheckUnhandledOops has limited usefulness now
hseigel
parents: 19319
diff changeset
    61
// invoked returning the underlying oopDesc* type if appropriate.
7f9cbdf89af2 7195622: CheckUnhandledOops has limited usefulness now
hseigel
parents: 19319
diff changeset
    62
// No copy constructors, explicit user conversions or operators of
7f9cbdf89af2 7195622: CheckUnhandledOops has limited usefulness now
hseigel
parents: 19319
diff changeset
    63
// numerical type should be defined within the oop class. Most C++
7f9cbdf89af2 7195622: CheckUnhandledOops has limited usefulness now
hseigel
parents: 19319
diff changeset
    64
// compilers will issue a compile time error concerning the overloading
7f9cbdf89af2 7195622: CheckUnhandledOops has limited usefulness now
hseigel
parents: 19319
diff changeset
    65
// ambiguity between operators of numerical and pointer types. If
7f9cbdf89af2 7195622: CheckUnhandledOops has limited usefulness now
hseigel
parents: 19319
diff changeset
    66
// a conversion to or from an oop to a numerical type is needed,
7f9cbdf89af2 7195622: CheckUnhandledOops has limited usefulness now
hseigel
parents: 19319
diff changeset
    67
// use the inline template methods, cast_*_oop, defined below.
7f9cbdf89af2 7195622: CheckUnhandledOops has limited usefulness now
hseigel
parents: 19319
diff changeset
    68
//
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    69
// Converting NULL to oop to Handle implicit is no longer accepted by the
489c9b5090e2 Initial load
duke
parents:
diff changeset
    70
// compiler because there are too many steps in the conversion.  Use Handle()
489c9b5090e2 Initial load
duke
parents:
diff changeset
    71
// instead, which generates less code anyway.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    72
489c9b5090e2 Initial load
duke
parents:
diff changeset
    73
class Thread;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    74
class PromotedObject;
53149
259c36ef27df 8215731: Move forward class definitions out of globalDefinitions.hpp
coleenp
parents: 52070
diff changeset
    75
class oopDesc;
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    76
54786
ebf733a324d4 8223624: Cleanup includes of universe.hpp
stefank
parents: 53244
diff changeset
    77
extern bool CheckUnhandledOops;
ebf733a324d4 8223624: Cleanup includes of universe.hpp
stefank
parents: 53244
diff changeset
    78
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    79
class oop {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    80
  oopDesc* _o;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    81
489c9b5090e2 Initial load
duke
parents:
diff changeset
    82
  void register_oop();
489c9b5090e2 Initial load
duke
parents:
diff changeset
    83
  void unregister_oop();
489c9b5090e2 Initial load
duke
parents:
diff changeset
    84
489c9b5090e2 Initial load
duke
parents:
diff changeset
    85
  // friend class markOop;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    86
public:
489c9b5090e2 Initial load
duke
parents:
diff changeset
    87
  void set_obj(const void* p)         {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    88
    raw_set_obj(p);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    89
    if (CheckUnhandledOops) register_oop();
489c9b5090e2 Initial load
duke
parents:
diff changeset
    90
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    91
  void raw_set_obj(const void* p)     { _o = (oopDesc*)p; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    92
489c9b5090e2 Initial load
duke
parents:
diff changeset
    93
  oop()                               { set_obj(NULL); }
20282
7f9cbdf89af2 7195622: CheckUnhandledOops has limited usefulness now
hseigel
parents: 19319
diff changeset
    94
  oop(const oop& o)                   { set_obj(o.obj()); }
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    95
  oop(const volatile oop& o)          { set_obj(o.obj()); }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    96
  oop(const void* p)                  { set_obj(p); }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    97
  ~oop()                              {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    98
    if (CheckUnhandledOops) unregister_oop();
489c9b5090e2 Initial load
duke
parents:
diff changeset
    99
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   100
489c9b5090e2 Initial load
duke
parents:
diff changeset
   101
  oopDesc* obj()  const volatile      { return _o; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   102
489c9b5090e2 Initial load
duke
parents:
diff changeset
   103
  // General access
489c9b5090e2 Initial load
duke
parents:
diff changeset
   104
  oopDesc*  operator->() const        { return obj(); }
52070
e4d72440d60e 8211279: Verify missing object equals barriers
rkennke
parents: 49592
diff changeset
   105
  bool operator==(const oop o) const;
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   106
  bool operator==(void *p) const      { return obj() == p; }
52070
e4d72440d60e 8211279: Verify missing object equals barriers
rkennke
parents: 49592
diff changeset
   107
  bool operator!=(const volatile oop o) const;
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   108
  bool operator!=(void *p) const      { return obj() != p; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   109
20282
7f9cbdf89af2 7195622: CheckUnhandledOops has limited usefulness now
hseigel
parents: 19319
diff changeset
   110
  // Assignment
7f9cbdf89af2 7195622: CheckUnhandledOops has limited usefulness now
hseigel
parents: 19319
diff changeset
   111
  oop& operator=(const oop& o)                            { _o = o.obj(); return *this; }
7f9cbdf89af2 7195622: CheckUnhandledOops has limited usefulness now
hseigel
parents: 19319
diff changeset
   112
  volatile oop& operator=(const oop& o) volatile          { _o = o.obj(); return *this; }
7f9cbdf89af2 7195622: CheckUnhandledOops has limited usefulness now
hseigel
parents: 19319
diff changeset
   113
  volatile oop& operator=(const volatile oop& o) volatile { _o = o.obj(); return *this; }
7f9cbdf89af2 7195622: CheckUnhandledOops has limited usefulness now
hseigel
parents: 19319
diff changeset
   114
7f9cbdf89af2 7195622: CheckUnhandledOops has limited usefulness now
hseigel
parents: 19319
diff changeset
   115
  // Explict user conversions
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   116
  operator void* () const             { return (void *)obj(); }
20282
7f9cbdf89af2 7195622: CheckUnhandledOops has limited usefulness now
hseigel
parents: 19319
diff changeset
   117
#ifndef SOLARIS
7f9cbdf89af2 7195622: CheckUnhandledOops has limited usefulness now
hseigel
parents: 19319
diff changeset
   118
  operator void* () const volatile    { return (void *)obj(); }
7f9cbdf89af2 7195622: CheckUnhandledOops has limited usefulness now
hseigel
parents: 19319
diff changeset
   119
#endif
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   120
  operator HeapWord* () const         { return (HeapWord*)obj(); }
24831
e4df2f64bb2e 8041623: Solaris Studio 12.4 C++ 5.13, CHECK_UNHANDLED_OOPS use of class oop's copy constructor definitions causing error level diagnostic.
lfoltan
parents: 20282
diff changeset
   121
  operator oopDesc* () const volatile { return obj(); }
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   122
  operator intptr_t* () const         { return (intptr_t*)obj(); }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   123
  operator PromotedObject* () const   { return (PromotedObject*)obj(); }
25478
7e6c884aa31f 8048128: Fix for Solaris Studio C++ 5.13, CHECK_UNHANDLED_OOPS breaks PPC build.
lfoltan
parents: 24831
diff changeset
   124
  operator markOop () const volatile  { return markOop(obj()); }
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   125
  operator address   () const         { return (address)obj(); }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   126
489c9b5090e2 Initial load
duke
parents:
diff changeset
   127
  // from javaCalls.cpp
489c9b5090e2 Initial load
duke
parents:
diff changeset
   128
  operator jobject () const           { return (jobject)obj(); }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   129
489c9b5090e2 Initial load
duke
parents:
diff changeset
   130
  // from parNewGeneration and other things that want to get to the end of
13952
e3cf184080bc 8000213: NPG: Should have renamed arrayKlass and typeArrayKlass
coleenp
parents: 13738
diff changeset
   131
  // an oop for stuff (like ObjArrayKlass.cpp)
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   132
  operator oop* () const              { return (oop *)obj(); }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   133
};
489c9b5090e2 Initial load
duke
parents:
diff changeset
   134
46958
a13bd8c6b7a2 8186166: Generalize Atomic::cmpxchg with templates
eosterlund
parents: 25478
diff changeset
   135
template<>
a13bd8c6b7a2 8186166: Generalize Atomic::cmpxchg with templates
eosterlund
parents: 25478
diff changeset
   136
struct PrimitiveConversions::Translate<oop> : public TrueType {
a13bd8c6b7a2 8186166: Generalize Atomic::cmpxchg with templates
eosterlund
parents: 25478
diff changeset
   137
  typedef oop Value;
a13bd8c6b7a2 8186166: Generalize Atomic::cmpxchg with templates
eosterlund
parents: 25478
diff changeset
   138
  typedef oopDesc* Decayed;
a13bd8c6b7a2 8186166: Generalize Atomic::cmpxchg with templates
eosterlund
parents: 25478
diff changeset
   139
a13bd8c6b7a2 8186166: Generalize Atomic::cmpxchg with templates
eosterlund
parents: 25478
diff changeset
   140
  static Decayed decay(Value x) { return x.obj(); }
a13bd8c6b7a2 8186166: Generalize Atomic::cmpxchg with templates
eosterlund
parents: 25478
diff changeset
   141
  static Value recover(Decayed x) { return oop(x); }
a13bd8c6b7a2 8186166: Generalize Atomic::cmpxchg with templates
eosterlund
parents: 25478
diff changeset
   142
};
a13bd8c6b7a2 8186166: Generalize Atomic::cmpxchg with templates
eosterlund
parents: 25478
diff changeset
   143
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   144
#define DEF_OOP(type)                                                      \
489c9b5090e2 Initial load
duke
parents:
diff changeset
   145
   class type##OopDesc;                                                    \
489c9b5090e2 Initial load
duke
parents:
diff changeset
   146
   class type##Oop : public oop {                                          \
489c9b5090e2 Initial load
duke
parents:
diff changeset
   147
     public:                                                               \
489c9b5090e2 Initial load
duke
parents:
diff changeset
   148
       type##Oop() : oop() {}                                              \
20282
7f9cbdf89af2 7195622: CheckUnhandledOops has limited usefulness now
hseigel
parents: 19319
diff changeset
   149
       type##Oop(const oop& o) : oop(o) {}                                 \
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   150
       type##Oop(const volatile oop& o) : oop(o) {}                        \
489c9b5090e2 Initial load
duke
parents:
diff changeset
   151
       type##Oop(const void* p) : oop(p) {}                                \
489c9b5090e2 Initial load
duke
parents:
diff changeset
   152
       operator type##OopDesc* () const { return (type##OopDesc*)obj(); }  \
489c9b5090e2 Initial load
duke
parents:
diff changeset
   153
       type##OopDesc* operator->() const {                                 \
489c9b5090e2 Initial load
duke
parents:
diff changeset
   154
            return (type##OopDesc*)obj();                                  \
489c9b5090e2 Initial load
duke
parents:
diff changeset
   155
       }                                                                   \
20282
7f9cbdf89af2 7195622: CheckUnhandledOops has limited usefulness now
hseigel
parents: 19319
diff changeset
   156
       type##Oop& operator=(const type##Oop& o) {                          \
7f9cbdf89af2 7195622: CheckUnhandledOops has limited usefulness now
hseigel
parents: 19319
diff changeset
   157
            oop::operator=(o);                                             \
7f9cbdf89af2 7195622: CheckUnhandledOops has limited usefulness now
hseigel
parents: 19319
diff changeset
   158
            return *this;                                                  \
7f9cbdf89af2 7195622: CheckUnhandledOops has limited usefulness now
hseigel
parents: 19319
diff changeset
   159
       }                                                                   \
7f9cbdf89af2 7195622: CheckUnhandledOops has limited usefulness now
hseigel
parents: 19319
diff changeset
   160
       volatile type##Oop& operator=(const type##Oop& o) volatile {        \
7f9cbdf89af2 7195622: CheckUnhandledOops has limited usefulness now
hseigel
parents: 19319
diff changeset
   161
            (void)const_cast<oop&>(oop::operator=(o));                     \
7f9cbdf89af2 7195622: CheckUnhandledOops has limited usefulness now
hseigel
parents: 19319
diff changeset
   162
            return *this;                                                  \
24831
e4df2f64bb2e 8041623: Solaris Studio 12.4 C++ 5.13, CHECK_UNHANDLED_OOPS use of class oop's copy constructor definitions causing error level diagnostic.
lfoltan
parents: 20282
diff changeset
   163
       }                                                                   \
20282
7f9cbdf89af2 7195622: CheckUnhandledOops has limited usefulness now
hseigel
parents: 19319
diff changeset
   164
       volatile type##Oop& operator=(const volatile type##Oop& o) volatile {\
7f9cbdf89af2 7195622: CheckUnhandledOops has limited usefulness now
hseigel
parents: 19319
diff changeset
   165
            (void)const_cast<oop&>(oop::operator=(o));                     \
7f9cbdf89af2 7195622: CheckUnhandledOops has limited usefulness now
hseigel
parents: 19319
diff changeset
   166
            return *this;                                                  \
7f9cbdf89af2 7195622: CheckUnhandledOops has limited usefulness now
hseigel
parents: 19319
diff changeset
   167
       }                                                                   \
47609
a1f68e415b48 8188813: Generalize OrderAccess to use templates
eosterlund
parents: 47216
diff changeset
   168
   };                                                                      \
a1f68e415b48 8188813: Generalize OrderAccess to use templates
eosterlund
parents: 47216
diff changeset
   169
                                                                           \
a1f68e415b48 8188813: Generalize OrderAccess to use templates
eosterlund
parents: 47216
diff changeset
   170
   template<>                                                              \
a1f68e415b48 8188813: Generalize OrderAccess to use templates
eosterlund
parents: 47216
diff changeset
   171
   struct PrimitiveConversions::Translate<type##Oop> : public TrueType {   \
a1f68e415b48 8188813: Generalize OrderAccess to use templates
eosterlund
parents: 47216
diff changeset
   172
     typedef type##Oop Value;                                              \
a1f68e415b48 8188813: Generalize OrderAccess to use templates
eosterlund
parents: 47216
diff changeset
   173
     typedef type##OopDesc* Decayed;                                       \
a1f68e415b48 8188813: Generalize OrderAccess to use templates
eosterlund
parents: 47216
diff changeset
   174
                                                                           \
a1f68e415b48 8188813: Generalize OrderAccess to use templates
eosterlund
parents: 47216
diff changeset
   175
     static Decayed decay(Value x) { return (type##OopDesc*)x.obj(); }     \
a1f68e415b48 8188813: Generalize OrderAccess to use templates
eosterlund
parents: 47216
diff changeset
   176
     static Value recover(Decayed x) { return type##Oop(x); }              \
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 8725
diff changeset
   177
   };
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   178
489c9b5090e2 Initial load
duke
parents:
diff changeset
   179
DEF_OOP(instance);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   180
DEF_OOP(array);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   181
DEF_OOP(objArray);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   182
DEF_OOP(typeArray);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   183
489c9b5090e2 Initial load
duke
parents:
diff changeset
   184
#endif // CHECK_UNHANDLED_OOPS
489c9b5090e2 Initial load
duke
parents:
diff changeset
   185
20282
7f9cbdf89af2 7195622: CheckUnhandledOops has limited usefulness now
hseigel
parents: 19319
diff changeset
   186
// For CHECK_UNHANDLED_OOPS, it is ambiguous C++ behavior to have the oop
7f9cbdf89af2 7195622: CheckUnhandledOops has limited usefulness now
hseigel
parents: 19319
diff changeset
   187
// structure contain explicit user defined conversions of both numerical
7f9cbdf89af2 7195622: CheckUnhandledOops has limited usefulness now
hseigel
parents: 19319
diff changeset
   188
// and pointer type. Define inline methods to provide the numerical conversions.
7f9cbdf89af2 7195622: CheckUnhandledOops has limited usefulness now
hseigel
parents: 19319
diff changeset
   189
template <class T> inline oop cast_to_oop(T value) {
7f9cbdf89af2 7195622: CheckUnhandledOops has limited usefulness now
hseigel
parents: 19319
diff changeset
   190
  return (oop)(CHECK_UNHANDLED_OOPS_ONLY((void *))(value));
7f9cbdf89af2 7195622: CheckUnhandledOops has limited usefulness now
hseigel
parents: 19319
diff changeset
   191
}
7f9cbdf89af2 7195622: CheckUnhandledOops has limited usefulness now
hseigel
parents: 19319
diff changeset
   192
template <class T> inline T cast_from_oop(oop o) {
7f9cbdf89af2 7195622: CheckUnhandledOops has limited usefulness now
hseigel
parents: 19319
diff changeset
   193
  return (T)(CHECK_UNHANDLED_OOPS_ONLY((void*))o);
7f9cbdf89af2 7195622: CheckUnhandledOops has limited usefulness now
hseigel
parents: 19319
diff changeset
   194
}
7f9cbdf89af2 7195622: CheckUnhandledOops has limited usefulness now
hseigel
parents: 19319
diff changeset
   195
49592
77fb0be7d19f 8199946: Move load/store and encode/decode out of oopDesc
stefank
parents: 49057
diff changeset
   196
inline bool check_obj_alignment(oop obj) {
77fb0be7d19f 8199946: Move load/store and encode/decode out of oopDesc
stefank
parents: 49057
diff changeset
   197
  return (cast_from_oop<intptr_t>(obj) & MinObjAlignmentInBytesMask) == 0;
77fb0be7d19f 8199946: Move load/store and encode/decode out of oopDesc
stefank
parents: 49057
diff changeset
   198
}
77fb0be7d19f 8199946: Move load/store and encode/decode out of oopDesc
stefank
parents: 49057
diff changeset
   199
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 8725
diff changeset
   200
// The metadata hierarchy is separate from the oop hierarchy
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 8725
diff changeset
   201
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 8725
diff changeset
   202
//      class MetaspaceObj
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 8725
diff changeset
   203
class   ConstMethod;
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 8725
diff changeset
   204
class   ConstantPoolCache;
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 8725
diff changeset
   205
class   MethodData;
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 8725
diff changeset
   206
//      class Metadata
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 8725
diff changeset
   207
class   Method;
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 8725
diff changeset
   208
class   ConstantPool;
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 8725
diff changeset
   209
//      class CHeapObj
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 8725
diff changeset
   210
class   CompiledICHolder;
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 8725
diff changeset
   211
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 8725
diff changeset
   212
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   213
// The klass hierarchy is separate from the oop hierarchy.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   214
489c9b5090e2 Initial load
duke
parents:
diff changeset
   215
class Klass;
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 8725
diff changeset
   216
class   InstanceKlass;
13738
d67be49a5beb 7195833: NPG: Rename instanceClassLoaderKlass, instanceRefKlass and instanceMirrorKlass
coleenp
parents: 13728
diff changeset
   217
class     InstanceMirrorKlass;
d67be49a5beb 7195833: NPG: Rename instanceClassLoaderKlass, instanceRefKlass and instanceMirrorKlass
coleenp
parents: 13728
diff changeset
   218
class     InstanceClassLoaderKlass;
d67be49a5beb 7195833: NPG: Rename instanceClassLoaderKlass, instanceRefKlass and instanceMirrorKlass
coleenp
parents: 13728
diff changeset
   219
class     InstanceRefKlass;
13952
e3cf184080bc 8000213: NPG: Should have renamed arrayKlass and typeArrayKlass
coleenp
parents: 13738
diff changeset
   220
class   ArrayKlass;
e3cf184080bc 8000213: NPG: Should have renamed arrayKlass and typeArrayKlass
coleenp
parents: 13738
diff changeset
   221
class     ObjArrayKlass;
e3cf184080bc 8000213: NPG: Should have renamed arrayKlass and typeArrayKlass
coleenp
parents: 13738
diff changeset
   222
class     TypeArrayKlass;
7397
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
   223
53244
9807daeb47c4 8216167: Update include guards to reflect correct directories
coleenp
parents: 53149
diff changeset
   224
#endif // SHARE_OOPS_OOPSHIERARCHY_HPP