hotspot/src/share/vm/oops/instanceMirrorKlass.cpp
author coleenp
Sat, 01 Sep 2012 13:25:18 -0400
changeset 13728 882756847a04
parent 10742 a64c942e4e6b
child 13738 d67be49a5beb
permissions -rw-r--r--
6964458: Reimplement class meta-data storage to use native memory Summary: Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland Contributed-by: jmasa <jon.masamitsu@oracle.com>, stefank <stefan.karlsson@oracle.com>, mgerdin <mikael.gerdin@oracle.com>, never <tom.rodriguez@oracle.com>
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"
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
    38
#ifndef SERIALGC
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 10742
diff changeset
    39
#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
    40
#include "gc_implementation/g1/g1CollectedHeap.inline.hpp"
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
    41
#include "gc_implementation/g1/g1OopClosures.inline.hpp"
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
    42
#include "gc_implementation/g1/g1RemSet.inline.hpp"
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
    43
#include "gc_implementation/g1/heapRegionSeq.inline.hpp"
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
    44
#include "gc_implementation/parNew/parOopClosures.inline.hpp"
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
    45
#include "gc_implementation/parallelScavenge/psPromotionManager.inline.hpp"
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
    46
#include "gc_implementation/parallelScavenge/psScavenge.inline.hpp"
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
    47
#include "oops/oop.pcgc.inline.hpp"
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
    48
#endif
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
    49
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
    50
int instanceMirrorKlass::_offset_of_static_fields = 0;
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
    51
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
    52
#ifdef ASSERT
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
    53
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
    54
  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
    55
  if (!oopDesc::is_null(heap_oop)) {
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
    56
    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
    57
    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
    58
  }
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
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
    61
  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
    62
  if (!oopDesc::is_null(heap_oop)) {
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
    63
    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
    64
    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
    65
  }
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
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
    68
  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
    69
  if (!oopDesc::is_null(heap_oop)) {
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
    70
    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
    71
    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
    72
  }
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
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
    75
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
    76
#else
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
    77
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
    78
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
    79
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
    80
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
    81
#endif // ASSERT
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
    82
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
    83
#define InstanceMirrorKlass_SPECIALIZED_OOP_ITERATE( \
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
    84
  T, start_p, count, do_oop,                         \
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
    85
  assert_fn)                                         \
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
    86
{                                                    \
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
    87
  T* p         = (T*)(start_p);                      \
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
    88
  T* const end = p + (count);                        \
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
    89
  while (p < end) {                                  \
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
    90
    (assert_fn)(p);                                  \
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
    91
    do_oop;                                          \
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
    92
    ++p;                                             \
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
    93
  }                                                  \
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
#define InstanceMirrorKlass_SPECIALIZED_BOUNDED_OOP_ITERATE( \
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
    97
  T, start_p, count, low, high,                              \
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
    98
  do_oop, assert_fn)                                         \
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
    99
{                                                            \
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
   100
  T* const l = (T*)(low);                                    \
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
   101
  T* const h = (T*)(high);                                   \
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
   102
  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
   103
         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
   104
         "bounded region must be properly aligned");         \
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
   105
  T* p       = (T*)(start_p);                                \
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
   106
  T* end     = p + (count);                                  \
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
   107
  if (p < l) p = l;                                          \
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
   108
  if (end > h) end = h;                                      \
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
   109
  while (p < end) {                                          \
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
   110
    (assert_fn)(p);                                          \
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
   111
    do_oop;                                                  \
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
   112
    ++p;                                                     \
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
   113
  }                                                          \
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
#define InstanceMirrorKlass_OOP_ITERATE(start_p, count,    \
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
   118
                                  do_oop, assert_fn)       \
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
   119
{                                                          \
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
   120
  if (UseCompressedOops) {                                 \
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
   121
    InstanceMirrorKlass_SPECIALIZED_OOP_ITERATE(narrowOop, \
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
   122
      start_p, count,                                      \
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
   123
      do_oop, assert_fn)                                   \
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
   124
  } else {                                                 \
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
   125
    InstanceMirrorKlass_SPECIALIZED_OOP_ITERATE(oop,       \
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
   126
      start_p, count,                                      \
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
   127
      do_oop, assert_fn)                                   \
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
   128
  }                                                        \
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
// 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
   132
// 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
   133
// flag.
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
   134
#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
   135
                                          do_oop, assert_fn)               \
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
   136
{                                                                          \
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
   137
  if (UseCompressedOops) {                                                 \
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
   138
    InstanceMirrorKlass_SPECIALIZED_BOUNDED_OOP_ITERATE(narrowOop,         \
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
   139
      start_p, count,                                                      \
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
   140
      low, high,                                                           \
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
   141
      do_oop, assert_fn)                                                   \
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
   142
  } else {                                                                 \
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
   143
    InstanceMirrorKlass_SPECIALIZED_BOUNDED_OOP_ITERATE(oop,               \
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
   144
      start_p, count,                                                      \
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
   145
      low, high,                                                           \
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
   146
      do_oop, assert_fn)                                                   \
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
   147
  }                                                                        \
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
void instanceMirrorKlass::oop_follow_contents(oop obj) {
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 10742
diff changeset
   152
  InstanceKlass::oop_follow_contents(obj);
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 10742
diff changeset
   153
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 10742
diff changeset
   154
  // Follow the klass field in the mirror.
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 10742
diff changeset
   155
  Klass* klass = java_lang_Class::as_Klass(obj);
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 10742
diff changeset
   156
  if (klass != NULL) {
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 10742
diff changeset
   157
    MarkSweep::follow_klass(klass);
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 10742
diff changeset
   158
  } else {
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 10742
diff changeset
   159
    // 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
   160
    // 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
   161
    // roots in Universe::oops_do.
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 10742
diff changeset
   162
    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
   163
  }
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 10742
diff changeset
   164
8725
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
   165
  InstanceMirrorKlass_OOP_ITERATE(                                                    \
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
   166
    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
   167
    MarkSweep::mark_and_push(p),                                                      \
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
   168
    assert_is_in_closed_subset)
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
   169
}
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
#ifndef SERIALGC
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
   172
void instanceMirrorKlass::oop_follow_contents(ParCompactionManager* cm,
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
   173
                                              oop obj) {
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 10742
diff changeset
   174
  InstanceKlass::oop_follow_contents(cm, obj);
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 10742
diff changeset
   175
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 10742
diff changeset
   176
  // Follow the klass field in the mirror.
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 10742
diff changeset
   177
  Klass* klass = java_lang_Class::as_Klass(obj);
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 10742
diff changeset
   178
  if (klass != NULL) {
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 10742
diff changeset
   179
    PSParallelCompact::follow_klass(cm, klass);
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 10742
diff changeset
   180
  } else {
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 10742
diff changeset
   181
    // 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
   182
    // 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
   183
    // roots in Universe::oops_do.
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 10742
diff changeset
   184
    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
   185
  }
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 10742
diff changeset
   186
8725
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
   187
  InstanceMirrorKlass_OOP_ITERATE(                                                    \
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
   188
    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
   189
    PSParallelCompact::mark_and_push(cm, p),                                          \
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
   190
    assert_is_in)
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
   191
}
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
   192
#endif // SERIALGC
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
   193
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
   194
int instanceMirrorKlass::oop_adjust_pointers(oop obj) {
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
   195
  int size = oop_size(obj);
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 10742
diff changeset
   196
  InstanceKlass::oop_adjust_pointers(obj);
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 10742
diff changeset
   197
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 10742
diff changeset
   198
  // Follow the klass field in the mirror.
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 10742
diff changeset
   199
  Klass* klass = java_lang_Class::as_Klass(obj);
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 10742
diff changeset
   200
  if (klass != NULL) {
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 10742
diff changeset
   201
    MarkSweep::adjust_klass(klass);
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 10742
diff changeset
   202
  } else {
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 10742
diff changeset
   203
    // 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
   204
    // 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
   205
    // roots in Universe::oops_do.
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 10742
diff changeset
   206
    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
   207
  }
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 10742
diff changeset
   208
8725
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
   209
  InstanceMirrorKlass_OOP_ITERATE(                                                    \
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
   210
    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
   211
    MarkSweep::adjust_pointer(p),                                                     \
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
   212
    assert_nothing)
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
   213
  return size;
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
   214
}
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
#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
   217
  InstanceMirrorKlass_OOP_ITERATE(                                                    \
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
   218
    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
   219
      (closure)->do_oop##nv_suffix(p),                                                \
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
   220
    assert_is_in_closed_subset)                                                       \
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
   221
  return oop_size(obj);                                                               \
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
   222
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
   223
#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
   224
  InstanceMirrorKlass_BOUNDED_OOP_ITERATE(                                            \
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
   225
    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
   226
    mr.start(), mr.end(),                                                             \
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
   227
      (closure)->do_oop##nv_suffix(p),                                                \
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
   228
    assert_is_in_closed_subset)                                                       \
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
   229
  return oop_size(obj);                                                               \
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
   230
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
   231
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 10742
diff changeset
   232
#define if_do_metadata_checked(closure, nv_suffix)                    \
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 10742
diff changeset
   233
  /* 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
   234
  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
   235
      "Inconsistency in do_metadata");                                \
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 10742
diff changeset
   236
  if (closure->do_metadata##nv_suffix())
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 10742
diff changeset
   237
8725
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
   238
// Macro to define instanceMirrorKlass::oop_oop_iterate for virtual/nonvirtual for
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
   239
// 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
   240
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
   241
#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
   242
                                                                                      \
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
   243
int instanceMirrorKlass::                                                             \
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
   244
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
   245
  /* Get size before changing pointers */                                             \
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
   246
  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
   247
                                                                                      \
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 10742
diff changeset
   248
  InstanceKlass::oop_oop_iterate##nv_suffix(obj, closure);                            \
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 10742
diff changeset
   249
                                                                                      \
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 10742
diff changeset
   250
  if_do_metadata_checked(closure, nv_suffix) {                                        \
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 10742
diff changeset
   251
    Klass* klass = java_lang_Class::as_Klass(obj);                                    \
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 10742
diff changeset
   252
    /* We'll get NULL for primitive mirrors. */                                       \
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 10742
diff changeset
   253
    if (klass != NULL) {                                                              \
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 10742
diff changeset
   254
      closure->do_klass##nv_suffix(klass);                                            \
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 10742
diff changeset
   255
    }                                                                                 \
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 10742
diff changeset
   256
  }                                                                                   \
8725
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
   257
                                                                                      \
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
   258
  if (UseCompressedOops) {                                                            \
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
   259
    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
   260
  } else {                                                                            \
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
   261
    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
   262
  }                                                                                   \
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
#ifndef SERIALGC
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
   266
#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
   267
                                                                                      \
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
   268
int instanceMirrorKlass::                                                             \
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
   269
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
   270
  /* Get size before changing pointers */                                             \
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
   271
  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
   272
                                                                                      \
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 10742
diff changeset
   273
  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
   274
                                                                                      \
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
   275
  if (UseCompressedOops) {                                                            \
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
   276
    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
   277
  } else {                                                                            \
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
   278
    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
   279
  }                                                                                   \
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
#endif // !SERIALGC
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
   282
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
#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
   285
                                                                                      \
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
   286
int instanceMirrorKlass::                                                             \
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
   287
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
   288
                               OopClosureType* closure,                               \
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
   289
                               MemRegion mr) {                                        \
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
   290
  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
   291
                                                                                      \
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 10742
diff changeset
   292
  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
   293
                                                                                      \
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 10742
diff changeset
   294
  if_do_metadata_checked(closure, nv_suffix) {                                        \
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 10742
diff changeset
   295
    if (mr.contains(obj)) {                                                           \
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 10742
diff changeset
   296
      Klass* klass = java_lang_Class::as_Klass(obj);                                  \
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 10742
diff changeset
   297
      /* We'll get NULL for primitive mirrors. */                                     \
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 10742
diff changeset
   298
      if (klass != NULL) {                                                            \
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 10742
diff changeset
   299
        closure->do_klass##nv_suffix(klass);                                          \
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 10742
diff changeset
   300
      }                                                                               \
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
                                                                                      \
8725
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
   304
  if (UseCompressedOops) {                                                            \
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
   305
    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
   306
  } else {                                                                            \
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
   307
    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
   308
  }                                                                                   \
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
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
   312
ALL_OOP_OOP_ITERATE_CLOSURES_2(InstanceMirrorKlass_OOP_OOP_ITERATE_DEFN)
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
   313
#ifndef SERIALGC
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
   314
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
   315
ALL_OOP_OOP_ITERATE_CLOSURES_2(InstanceMirrorKlass_OOP_OOP_ITERATE_BACKWARDS_DEFN)
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
   316
#endif // SERIALGC
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
   317
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
   318
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
   319
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
   320
#ifndef SERIALGC
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
   321
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
   322
  // 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
   323
  // 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
   324
  // ClassLoaderData objects.
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 10742
diff changeset
   325
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 10742
diff changeset
   326
  InstanceKlass::oop_push_contents(pm, obj);
8725
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
   327
  InstanceMirrorKlass_OOP_ITERATE(                                            \
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
   328
    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
   329
    if (PSScavenge::should_scavenge(p)) {                                     \
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
   330
      pm->claim_or_forward_depth(p);                                          \
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
   331
    },                                                                        \
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
   332
    assert_nothing )
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
   333
}
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
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
   336
  int size = oop_size(obj);
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 10742
diff changeset
   337
  InstanceKlass::oop_update_pointers(cm, obj);
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 10742
diff changeset
   338
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 10742
diff changeset
   339
  // Follow the klass field in the mirror.
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 10742
diff changeset
   340
  Klass* klass = java_lang_Class::as_Klass(obj);
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 10742
diff changeset
   341
  if (klass != NULL) {
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 10742
diff changeset
   342
    PSParallelCompact::adjust_klass(cm, klass);
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 10742
diff changeset
   343
  } else {
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 10742
diff changeset
   344
    // 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
   345
    // 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
   346
    // roots in Universe::oops_do.
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 10742
diff changeset
   347
    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
   348
  }
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 10742
diff changeset
   349
8725
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
   350
  InstanceMirrorKlass_OOP_ITERATE(                                            \
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
   351
    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
   352
    PSParallelCompact::adjust_pointer(p),                                     \
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
   353
    assert_nothing)
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 10742
diff changeset
   354
  return size;
8725
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
   355
}
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
   356
#endif // SERIALGC
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
   357
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
   358
int instanceMirrorKlass::instance_size(KlassHandle k) {
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
   359
  if (k() != NULL && k->oop_is_instance()) {
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 10742
diff changeset
   360
    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
   361
  }
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
   362
  return size_helper();
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
   363
}
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
instanceOop instanceMirrorKlass::allocate_instance(KlassHandle k, TRAPS) {
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
   366
  // Query before forming handle.
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
   367
  int size = instance_size(k);
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 10742
diff changeset
   368
  KlassHandle h_k(THREAD, this);
10742
a64c942e4e6b 7098528: crash with java -XX:+ExtendedDTraceProbes
never
parents: 8725
diff changeset
   369
  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
   370
  return i;
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
   371
}
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
int instanceMirrorKlass::oop_size(oop obj) const {
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
   374
  return java_lang_Class::oop_size(obj);
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
   375
}
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
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
   378
  Klass* k = java_lang_Class::as_Klass(obj);
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 10742
diff changeset
   379
  if (k != NULL && k->oop_is_instance()) {
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 10742
diff changeset
   380
    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
   381
  }
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
   382
  return 0;
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents:
diff changeset
   383
}