hotspot/src/share/vm/oops/instanceMirrorKlass.cpp
author ehelin
Mon, 12 Aug 2013 17:37:02 +0200
changeset 19979 ebe1dbb6e1aa
parent 15482 470d0b0c09f1
child 21916 4977554a0c5e
permissions -rw-r--r--
8015107: NPG: Use consistent naming for metaspace concepts Reviewed-by: coleenp, mgerdin, hseigel
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
8725
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
     1
/*
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 10742
diff changeset
     2
 * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
8725
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
     4
 *
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
     7
 * published by the Free Software Foundation.
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
     8
 *
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
    13
 * accompanied this code).
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
    14
 *
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
    18
 *
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
    21
 * questions.
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
    22
 *
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
    23
 */
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
    24
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
    25
#include "precompiled.hpp"
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
    26
#include "classfile/javaClasses.hpp"
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
    27
#include "classfile/systemDictionary.hpp"
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
    28
#include "gc_implementation/shared/markSweep.inline.hpp"
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
    29
#include "gc_interface/collectedHeap.inline.hpp"
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
    30
#include "memory/genOopClosures.inline.hpp"
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
    31
#include "memory/oopFactory.hpp"
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
    32
#include "oops/instanceKlass.hpp"
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
    33
#include "oops/instanceMirrorKlass.hpp"
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
    34
#include "oops/instanceOop.hpp"
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
    35
#include "oops/oop.inline.hpp"
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
    36
#include "oops/symbol.hpp"
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
    37
#include "runtime/handles.inline.hpp"
15482
470d0b0c09f1 8005915: Unify SERIALGC and INCLUDE_ALTERNATE_GCS
jprovino
parents: 13738
diff changeset
    38
#include "utilities/macros.hpp"
470d0b0c09f1 8005915: Unify SERIALGC and INCLUDE_ALTERNATE_GCS
jprovino
parents: 13738
diff changeset
    39
#if INCLUDE_ALL_GCS
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 10742
diff changeset
    40
#include "gc_implementation/concurrentMarkSweep/cmsOopClosures.inline.hpp"
8725
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
    41
#include "gc_implementation/g1/g1CollectedHeap.inline.hpp"
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
    42
#include "gc_implementation/g1/g1OopClosures.inline.hpp"
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
    43
#include "gc_implementation/g1/g1RemSet.inline.hpp"
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
    44
#include "gc_implementation/g1/heapRegionSeq.inline.hpp"
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
    45
#include "gc_implementation/parNew/parOopClosures.inline.hpp"
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
    46
#include "gc_implementation/parallelScavenge/psPromotionManager.inline.hpp"
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
    47
#include "gc_implementation/parallelScavenge/psScavenge.inline.hpp"
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
    48
#include "oops/oop.pcgc.inline.hpp"
15482
470d0b0c09f1 8005915: Unify SERIALGC and INCLUDE_ALTERNATE_GCS
jprovino
parents: 13738
diff changeset
    49
#endif // INCLUDE_ALL_GCS
8725
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
    50
13738
d67be49a5beb 7195833: NPG: Rename instanceClassLoaderKlass, instanceRefKlass and instanceMirrorKlass
coleenp
parents: 13728
diff changeset
    51
int InstanceMirrorKlass::_offset_of_static_fields = 0;
8725
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
    52
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
    53
#ifdef ASSERT
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
    54
template <class T> void assert_is_in(T *p) {
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
    55
  T heap_oop = oopDesc::load_heap_oop(p);
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
    56
  if (!oopDesc::is_null(heap_oop)) {
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
    57
    oop o = oopDesc::decode_heap_oop_not_null(heap_oop);
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
    58
    assert(Universe::heap()->is_in(o), "should be in heap");
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
    59
  }
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
    60
}
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
    61
template <class T> void assert_is_in_closed_subset(T *p) {
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
    62
  T heap_oop = oopDesc::load_heap_oop(p);
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
    63
  if (!oopDesc::is_null(heap_oop)) {
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
    64
    oop o = oopDesc::decode_heap_oop_not_null(heap_oop);
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
    65
    assert(Universe::heap()->is_in_closed_subset(o), "should be in closed");
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
    66
  }
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
    67
}
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
    68
template <class T> void assert_is_in_reserved(T *p) {
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
    69
  T heap_oop = oopDesc::load_heap_oop(p);
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
    70
  if (!oopDesc::is_null(heap_oop)) {
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
    71
    oop o = oopDesc::decode_heap_oop_not_null(heap_oop);
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
    72
    assert(Universe::heap()->is_in_reserved(o), "should be in reserved");
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
    73
  }
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
    74
}
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
    75
template <class T> void assert_nothing(T *p) {}
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
    76
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
    77
#else
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
    78
template <class T> void assert_is_in(T *p) {}
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
    79
template <class T> void assert_is_in_closed_subset(T *p) {}
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
    80
template <class T> void assert_is_in_reserved(T *p) {}
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
    81
template <class T> void assert_nothing(T *p) {}
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
    82
#endif // ASSERT
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
    83
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
    84
#define InstanceMirrorKlass_SPECIALIZED_OOP_ITERATE( \
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
    85
  T, start_p, count, do_oop,                         \
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
    86
  assert_fn)                                         \
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
    87
{                                                    \
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
    88
  T* p         = (T*)(start_p);                      \
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
    89
  T* const end = p + (count);                        \
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
    90
  while (p < end) {                                  \
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
    91
    (assert_fn)(p);                                  \
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
    92
    do_oop;                                          \
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
    93
    ++p;                                             \
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
    94
  }                                                  \
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
    95
}
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
    96
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
    97
#define InstanceMirrorKlass_SPECIALIZED_BOUNDED_OOP_ITERATE( \
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
    98
  T, start_p, count, low, high,                              \
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
    99
  do_oop, assert_fn)                                         \
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
   100
{                                                            \
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
   101
  T* const l = (T*)(low);                                    \
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
   102
  T* const h = (T*)(high);                                   \
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
   103
  assert(mask_bits((intptr_t)l, sizeof(T)-1) == 0 &&         \
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
   104
         mask_bits((intptr_t)h, sizeof(T)-1) == 0,           \
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
   105
         "bounded region must be properly aligned");         \
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
   106
  T* p       = (T*)(start_p);                                \
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
   107
  T* end     = p + (count);                                  \
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
   108
  if (p < l) p = l;                                          \
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
   109
  if (end > h) end = h;                                      \
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
   110
  while (p < end) {                                          \
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
   111
    (assert_fn)(p);                                          \
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
   112
    do_oop;                                                  \
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
   113
    ++p;                                                     \
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
   114
  }                                                          \
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
   115
}
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
   116
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
   117
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
   118
#define InstanceMirrorKlass_OOP_ITERATE(start_p, count,    \
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
   119
                                  do_oop, assert_fn)       \
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
   120
{                                                          \
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
   121
  if (UseCompressedOops) {                                 \
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
   122
    InstanceMirrorKlass_SPECIALIZED_OOP_ITERATE(narrowOop, \
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
   123
      start_p, count,                                      \
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
   124
      do_oop, assert_fn)                                   \
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
   125
  } else {                                                 \
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
   126
    InstanceMirrorKlass_SPECIALIZED_OOP_ITERATE(oop,       \
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
   127
      start_p, count,                                      \
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
   128
      do_oop, assert_fn)                                   \
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
   129
  }                                                        \
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
   130
}
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
   131
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
   132
// The following macros call specialized macros, passing either oop or
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
   133
// narrowOop as the specialization type.  These test the UseCompressedOops
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
   134
// flag.
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
   135
#define InstanceMirrorKlass_BOUNDED_OOP_ITERATE(start_p, count, low, high, \
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
   136
                                          do_oop, assert_fn)               \
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
   137
{                                                                          \
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
   138
  if (UseCompressedOops) {                                                 \
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
   139
    InstanceMirrorKlass_SPECIALIZED_BOUNDED_OOP_ITERATE(narrowOop,         \
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
   140
      start_p, count,                                                      \
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
   141
      low, high,                                                           \
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
   142
      do_oop, assert_fn)                                                   \
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
   143
  } else {                                                                 \
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
   144
    InstanceMirrorKlass_SPECIALIZED_BOUNDED_OOP_ITERATE(oop,               \
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
   145
      start_p, count,                                                      \
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
   146
      low, high,                                                           \
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
   147
      do_oop, assert_fn)                                                   \
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
   148
  }                                                                        \
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
   149
}
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
   150
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
   151
13738
d67be49a5beb 7195833: NPG: Rename instanceClassLoaderKlass, instanceRefKlass and instanceMirrorKlass
coleenp
parents: 13728
diff changeset
   152
void InstanceMirrorKlass::oop_follow_contents(oop obj) {
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 10742
diff changeset
   153
  InstanceKlass::oop_follow_contents(obj);
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 10742
diff changeset
   154
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 10742
diff changeset
   155
  // Follow the klass field in the mirror.
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 10742
diff changeset
   156
  Klass* klass = java_lang_Class::as_Klass(obj);
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 10742
diff changeset
   157
  if (klass != NULL) {
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 10742
diff changeset
   158
    MarkSweep::follow_klass(klass);
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 10742
diff changeset
   159
  } else {
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 10742
diff changeset
   160
    // If klass is NULL then this a mirror for a primitive type.
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 10742
diff changeset
   161
    // We don't have to follow them, since they are handled as strong
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 10742
diff changeset
   162
    // roots in Universe::oops_do.
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 10742
diff changeset
   163
    assert(java_lang_Class::is_primitive(obj), "Sanity check");
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 10742
diff changeset
   164
  }
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 10742
diff changeset
   165
8725
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
   166
  InstanceMirrorKlass_OOP_ITERATE(                                                    \
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
   167
    start_of_static_fields(obj), java_lang_Class::static_oop_field_count(obj),        \
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
   168
    MarkSweep::mark_and_push(p),                                                      \
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
   169
    assert_is_in_closed_subset)
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
   170
}
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
   171
15482
470d0b0c09f1 8005915: Unify SERIALGC and INCLUDE_ALTERNATE_GCS
jprovino
parents: 13738
diff changeset
   172
#if INCLUDE_ALL_GCS
13738
d67be49a5beb 7195833: NPG: Rename instanceClassLoaderKlass, instanceRefKlass and instanceMirrorKlass
coleenp
parents: 13728
diff changeset
   173
void InstanceMirrorKlass::oop_follow_contents(ParCompactionManager* cm,
8725
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
   174
                                              oop obj) {
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 10742
diff changeset
   175
  InstanceKlass::oop_follow_contents(cm, obj);
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 10742
diff changeset
   176
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 10742
diff changeset
   177
  // Follow the klass field in the mirror.
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 10742
diff changeset
   178
  Klass* klass = java_lang_Class::as_Klass(obj);
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 10742
diff changeset
   179
  if (klass != NULL) {
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 10742
diff changeset
   180
    PSParallelCompact::follow_klass(cm, klass);
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 10742
diff changeset
   181
  } else {
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 10742
diff changeset
   182
    // If klass is NULL then this a mirror for a primitive type.
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 10742
diff changeset
   183
    // We don't have to follow them, since they are handled as strong
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 10742
diff changeset
   184
    // roots in Universe::oops_do.
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 10742
diff changeset
   185
    assert(java_lang_Class::is_primitive(obj), "Sanity check");
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 10742
diff changeset
   186
  }
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 10742
diff changeset
   187
8725
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
   188
  InstanceMirrorKlass_OOP_ITERATE(                                                    \
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
   189
    start_of_static_fields(obj), java_lang_Class::static_oop_field_count(obj),        \
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
   190
    PSParallelCompact::mark_and_push(cm, p),                                          \
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
   191
    assert_is_in)
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
   192
}
15482
470d0b0c09f1 8005915: Unify SERIALGC and INCLUDE_ALTERNATE_GCS
jprovino
parents: 13738
diff changeset
   193
#endif // INCLUDE_ALL_GCS
8725
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
   194
13738
d67be49a5beb 7195833: NPG: Rename instanceClassLoaderKlass, instanceRefKlass and instanceMirrorKlass
coleenp
parents: 13728
diff changeset
   195
int InstanceMirrorKlass::oop_adjust_pointers(oop obj) {
8725
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
   196
  int size = oop_size(obj);
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 10742
diff changeset
   197
  InstanceKlass::oop_adjust_pointers(obj);
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 10742
diff changeset
   198
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 10742
diff changeset
   199
  // Follow the klass field in the mirror.
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 10742
diff changeset
   200
  Klass* klass = java_lang_Class::as_Klass(obj);
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 10742
diff changeset
   201
  if (klass != NULL) {
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 10742
diff changeset
   202
    MarkSweep::adjust_klass(klass);
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 10742
diff changeset
   203
  } else {
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 10742
diff changeset
   204
    // If klass is NULL then this a mirror for a primitive type.
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 10742
diff changeset
   205
    // We don't have to follow them, since they are handled as strong
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 10742
diff changeset
   206
    // roots in Universe::oops_do.
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 10742
diff changeset
   207
    assert(java_lang_Class::is_primitive(obj), "Sanity check");
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 10742
diff changeset
   208
  }
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 10742
diff changeset
   209
8725
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
   210
  InstanceMirrorKlass_OOP_ITERATE(                                                    \
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
   211
    start_of_static_fields(obj), java_lang_Class::static_oop_field_count(obj),        \
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
   212
    MarkSweep::adjust_pointer(p),                                                     \
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
   213
    assert_nothing)
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
   214
  return size;
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
   215
}
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
   216
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
   217
#define InstanceMirrorKlass_SPECIALIZED_OOP_ITERATE_DEFN(T, nv_suffix)                \
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
   218
  InstanceMirrorKlass_OOP_ITERATE(                                                    \
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
   219
    start_of_static_fields(obj), java_lang_Class::static_oop_field_count(obj),        \
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
   220
      (closure)->do_oop##nv_suffix(p),                                                \
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
   221
    assert_is_in_closed_subset)                                                       \
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
   222
  return oop_size(obj);                                                               \
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
   223
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
   224
#define InstanceMirrorKlass_BOUNDED_SPECIALIZED_OOP_ITERATE(T, nv_suffix, mr)         \
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
   225
  InstanceMirrorKlass_BOUNDED_OOP_ITERATE(                                            \
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
   226
    start_of_static_fields(obj), java_lang_Class::static_oop_field_count(obj),        \
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
   227
    mr.start(), mr.end(),                                                             \
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
   228
      (closure)->do_oop##nv_suffix(p),                                                \
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
   229
    assert_is_in_closed_subset)                                                       \
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
   230
  return oop_size(obj);                                                               \
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
   231
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
   232
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 10742
diff changeset
   233
#define if_do_metadata_checked(closure, nv_suffix)                    \
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 10742
diff changeset
   234
  /* Make sure the non-virtual and the virtual versions match. */     \
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 10742
diff changeset
   235
  assert(closure->do_metadata##nv_suffix() == closure->do_metadata(), \
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 10742
diff changeset
   236
      "Inconsistency in do_metadata");                                \
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 10742
diff changeset
   237
  if (closure->do_metadata##nv_suffix())
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 10742
diff changeset
   238
13738
d67be49a5beb 7195833: NPG: Rename instanceClassLoaderKlass, instanceRefKlass and instanceMirrorKlass
coleenp
parents: 13728
diff changeset
   239
// Macro to define InstanceMirrorKlass::oop_oop_iterate for virtual/nonvirtual for
8725
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
   240
// all closures.  Macros calling macros above for each oop size.
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
   241
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
   242
#define InstanceMirrorKlass_OOP_OOP_ITERATE_DEFN(OopClosureType, nv_suffix)           \
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
   243
                                                                                      \
13738
d67be49a5beb 7195833: NPG: Rename instanceClassLoaderKlass, instanceRefKlass and instanceMirrorKlass
coleenp
parents: 13728
diff changeset
   244
int InstanceMirrorKlass::                                                             \
8725
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
   245
oop_oop_iterate##nv_suffix(oop obj, OopClosureType* closure) {                        \
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
   246
  /* Get size before changing pointers */                                             \
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
   247
  SpecializationStats::record_iterate_call##nv_suffix(SpecializationStats::irk);      \
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
   248
                                                                                      \
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 10742
diff changeset
   249
  InstanceKlass::oop_oop_iterate##nv_suffix(obj, closure);                            \
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 10742
diff changeset
   250
                                                                                      \
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 10742
diff changeset
   251
  if_do_metadata_checked(closure, nv_suffix) {                                        \
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 10742
diff changeset
   252
    Klass* klass = java_lang_Class::as_Klass(obj);                                    \
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 10742
diff changeset
   253
    /* We'll get NULL for primitive mirrors. */                                       \
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 10742
diff changeset
   254
    if (klass != NULL) {                                                              \
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 10742
diff changeset
   255
      closure->do_klass##nv_suffix(klass);                                            \
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 10742
diff changeset
   256
    }                                                                                 \
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 10742
diff changeset
   257
  }                                                                                   \
8725
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
   258
                                                                                      \
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
   259
  if (UseCompressedOops) {                                                            \
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
   260
    InstanceMirrorKlass_SPECIALIZED_OOP_ITERATE_DEFN(narrowOop, nv_suffix);           \
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
   261
  } else {                                                                            \
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
   262
    InstanceMirrorKlass_SPECIALIZED_OOP_ITERATE_DEFN(oop, nv_suffix);                 \
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
   263
  }                                                                                   \
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
   264
}
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
   265
15482
470d0b0c09f1 8005915: Unify SERIALGC and INCLUDE_ALTERNATE_GCS
jprovino
parents: 13738
diff changeset
   266
#if INCLUDE_ALL_GCS
8725
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
   267
#define InstanceMirrorKlass_OOP_OOP_ITERATE_BACKWARDS_DEFN(OopClosureType, nv_suffix) \
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
   268
                                                                                      \
13738
d67be49a5beb 7195833: NPG: Rename instanceClassLoaderKlass, instanceRefKlass and instanceMirrorKlass
coleenp
parents: 13728
diff changeset
   269
int InstanceMirrorKlass::                                                             \
8725
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
   270
oop_oop_iterate_backwards##nv_suffix(oop obj, OopClosureType* closure) {              \
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
   271
  /* Get size before changing pointers */                                             \
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
   272
  SpecializationStats::record_iterate_call##nv_suffix(SpecializationStats::irk);      \
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
   273
                                                                                      \
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 10742
diff changeset
   274
  InstanceKlass::oop_oop_iterate_backwards##nv_suffix(obj, closure);                  \
8725
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
   275
                                                                                      \
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
   276
  if (UseCompressedOops) {                                                            \
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
   277
    InstanceMirrorKlass_SPECIALIZED_OOP_ITERATE_DEFN(narrowOop, nv_suffix);           \
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
   278
  } else {                                                                            \
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
   279
    InstanceMirrorKlass_SPECIALIZED_OOP_ITERATE_DEFN(oop, nv_suffix);                 \
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
   280
  }                                                                                   \
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
   281
}
15482
470d0b0c09f1 8005915: Unify SERIALGC and INCLUDE_ALTERNATE_GCS
jprovino
parents: 13738
diff changeset
   282
#endif // INCLUDE_ALL_GCS
8725
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
   283
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
   284
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
   285
#define InstanceMirrorKlass_OOP_OOP_ITERATE_DEFN_m(OopClosureType, nv_suffix)         \
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
   286
                                                                                      \
13738
d67be49a5beb 7195833: NPG: Rename instanceClassLoaderKlass, instanceRefKlass and instanceMirrorKlass
coleenp
parents: 13728
diff changeset
   287
int InstanceMirrorKlass::                                                             \
8725
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
   288
oop_oop_iterate##nv_suffix##_m(oop obj,                                               \
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
   289
                               OopClosureType* closure,                               \
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
   290
                               MemRegion mr) {                                        \
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
   291
  SpecializationStats::record_iterate_call##nv_suffix(SpecializationStats::irk);      \
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
   292
                                                                                      \
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 10742
diff changeset
   293
  InstanceKlass::oop_oop_iterate##nv_suffix##_m(obj, closure, mr);                    \
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 10742
diff changeset
   294
                                                                                      \
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 10742
diff changeset
   295
  if_do_metadata_checked(closure, nv_suffix) {                                        \
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 10742
diff changeset
   296
    if (mr.contains(obj)) {                                                           \
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 10742
diff changeset
   297
      Klass* klass = java_lang_Class::as_Klass(obj);                                  \
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 10742
diff changeset
   298
      /* We'll get NULL for primitive mirrors. */                                     \
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 10742
diff changeset
   299
      if (klass != NULL) {                                                            \
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 10742
diff changeset
   300
        closure->do_klass##nv_suffix(klass);                                          \
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 10742
diff changeset
   301
      }                                                                               \
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 10742
diff changeset
   302
    }                                                                                 \
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 10742
diff changeset
   303
  }                                                                                   \
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 10742
diff changeset
   304
                                                                                      \
8725
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
   305
  if (UseCompressedOops) {                                                            \
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
   306
    InstanceMirrorKlass_BOUNDED_SPECIALIZED_OOP_ITERATE(narrowOop, nv_suffix, mr);    \
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
   307
  } else {                                                                            \
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
   308
    InstanceMirrorKlass_BOUNDED_SPECIALIZED_OOP_ITERATE(oop, nv_suffix, mr);          \
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
   309
  }                                                                                   \
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
   310
}
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
   311
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
   312
ALL_OOP_OOP_ITERATE_CLOSURES_1(InstanceMirrorKlass_OOP_OOP_ITERATE_DEFN)
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
   313
ALL_OOP_OOP_ITERATE_CLOSURES_2(InstanceMirrorKlass_OOP_OOP_ITERATE_DEFN)
15482
470d0b0c09f1 8005915: Unify SERIALGC and INCLUDE_ALTERNATE_GCS
jprovino
parents: 13738
diff changeset
   314
#if INCLUDE_ALL_GCS
8725
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
   315
ALL_OOP_OOP_ITERATE_CLOSURES_1(InstanceMirrorKlass_OOP_OOP_ITERATE_BACKWARDS_DEFN)
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
   316
ALL_OOP_OOP_ITERATE_CLOSURES_2(InstanceMirrorKlass_OOP_OOP_ITERATE_BACKWARDS_DEFN)
15482
470d0b0c09f1 8005915: Unify SERIALGC and INCLUDE_ALTERNATE_GCS
jprovino
parents: 13738
diff changeset
   317
#endif // INCLUDE_ALL_GCS
8725
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
   318
ALL_OOP_OOP_ITERATE_CLOSURES_1(InstanceMirrorKlass_OOP_OOP_ITERATE_DEFN_m)
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
   319
ALL_OOP_OOP_ITERATE_CLOSURES_2(InstanceMirrorKlass_OOP_OOP_ITERATE_DEFN_m)
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
   320
15482
470d0b0c09f1 8005915: Unify SERIALGC and INCLUDE_ALTERNATE_GCS
jprovino
parents: 13738
diff changeset
   321
#if INCLUDE_ALL_GCS
13738
d67be49a5beb 7195833: NPG: Rename instanceClassLoaderKlass, instanceRefKlass and instanceMirrorKlass
coleenp
parents: 13728
diff changeset
   322
void InstanceMirrorKlass::oop_push_contents(PSPromotionManager* pm, oop obj) {
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 10742
diff changeset
   323
  // Note that we don't have to follow the mirror -> klass pointer, since all
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 10742
diff changeset
   324
  // klasses that are dirty will be scavenged when we iterate over the
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 10742
diff changeset
   325
  // ClassLoaderData objects.
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 10742
diff changeset
   326
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 10742
diff changeset
   327
  InstanceKlass::oop_push_contents(pm, obj);
8725
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
   328
  InstanceMirrorKlass_OOP_ITERATE(                                            \
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
   329
    start_of_static_fields(obj), java_lang_Class::static_oop_field_count(obj),\
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
   330
    if (PSScavenge::should_scavenge(p)) {                                     \
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
   331
      pm->claim_or_forward_depth(p);                                          \
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
   332
    },                                                                        \
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
   333
    assert_nothing )
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
   334
}
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
   335
13738
d67be49a5beb 7195833: NPG: Rename instanceClassLoaderKlass, instanceRefKlass and instanceMirrorKlass
coleenp
parents: 13728
diff changeset
   336
int InstanceMirrorKlass::oop_update_pointers(ParCompactionManager* cm, oop obj) {
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 10742
diff changeset
   337
  int size = oop_size(obj);
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 10742
diff changeset
   338
  InstanceKlass::oop_update_pointers(cm, obj);
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 10742
diff changeset
   339
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 10742
diff changeset
   340
  // Follow the klass field in the mirror.
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 10742
diff changeset
   341
  Klass* klass = java_lang_Class::as_Klass(obj);
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 10742
diff changeset
   342
  if (klass != NULL) {
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 10742
diff changeset
   343
    PSParallelCompact::adjust_klass(cm, klass);
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 10742
diff changeset
   344
  } else {
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 10742
diff changeset
   345
    // If klass is NULL then this a mirror for a primitive type.
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 10742
diff changeset
   346
    // We don't have to follow them, since they are handled as strong
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 10742
diff changeset
   347
    // roots in Universe::oops_do.
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 10742
diff changeset
   348
    assert(java_lang_Class::is_primitive(obj), "Sanity check");
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 10742
diff changeset
   349
  }
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 10742
diff changeset
   350
8725
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
   351
  InstanceMirrorKlass_OOP_ITERATE(                                            \
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
   352
    start_of_static_fields(obj), java_lang_Class::static_oop_field_count(obj),\
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
   353
    PSParallelCompact::adjust_pointer(p),                                     \
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
   354
    assert_nothing)
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 10742
diff changeset
   355
  return size;
8725
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
   356
}
15482
470d0b0c09f1 8005915: Unify SERIALGC and INCLUDE_ALTERNATE_GCS
jprovino
parents: 13738
diff changeset
   357
#endif // INCLUDE_ALL_GCS
8725
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
   358
13738
d67be49a5beb 7195833: NPG: Rename instanceClassLoaderKlass, instanceRefKlass and instanceMirrorKlass
coleenp
parents: 13728
diff changeset
   359
int InstanceMirrorKlass::instance_size(KlassHandle k) {
8725
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
   360
  if (k() != NULL && k->oop_is_instance()) {
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 10742
diff changeset
   361
    return align_object_size(size_helper() + InstanceKlass::cast(k())->static_field_size());
8725
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
   362
  }
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
   363
  return size_helper();
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
   364
}
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
   365
13738
d67be49a5beb 7195833: NPG: Rename instanceClassLoaderKlass, instanceRefKlass and instanceMirrorKlass
coleenp
parents: 13728
diff changeset
   366
instanceOop InstanceMirrorKlass::allocate_instance(KlassHandle k, TRAPS) {
8725
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
   367
  // Query before forming handle.
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
   368
  int size = instance_size(k);
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 10742
diff changeset
   369
  KlassHandle h_k(THREAD, this);
10742
a64c942e4e6b 7098528: crash with java -XX:+ExtendedDTraceProbes
never
parents: 8725
diff changeset
   370
  instanceOop i = (instanceOop) CollectedHeap::Class_obj_allocate(h_k, size, k, CHECK_NULL);
8725
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
   371
  return i;
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
   372
}
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
   373
13738
d67be49a5beb 7195833: NPG: Rename instanceClassLoaderKlass, instanceRefKlass and instanceMirrorKlass
coleenp
parents: 13728
diff changeset
   374
int InstanceMirrorKlass::oop_size(oop obj) const {
8725
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
   375
  return java_lang_Class::oop_size(obj);
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
   376
}
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
   377
13738
d67be49a5beb 7195833: NPG: Rename instanceClassLoaderKlass, instanceRefKlass and instanceMirrorKlass
coleenp
parents: 13728
diff changeset
   378
int InstanceMirrorKlass::compute_static_oop_field_count(oop obj) {
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 10742
diff changeset
   379
  Klass* k = java_lang_Class::as_Klass(obj);
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 10742
diff changeset
   380
  if (k != NULL && k->oop_is_instance()) {
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 10742
diff changeset
   381
    return InstanceKlass::cast(k)->static_oop_field_count();
8725
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
   382
  }
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
   383
  return 0;
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
   384
}