hotspot/src/share/vm/oops/klassKlass.cpp
author bobv
Tue, 03 Aug 2010 08:13:38 -0400
changeset 6176 4d9030fe341f
parent 5547 f4b087cbb361
child 6255 0cbe4eb819f0
permissions -rw-r--r--
6953477: Increase portability and flexibility of building Hotspot Summary: A collection of portability improvements including shared code support for PPC, ARM platforms, software floating point, cross compilation support and improvements in error crash detail. Reviewed-by: phh, never, coleenp, dholmes
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
     1
/*
5547
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 4584
diff changeset
     2
 * Copyright (c) 1997, 2006, Oracle and/or its affiliates. All rights reserved.
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
489c9b5090e2 Initial load
duke
parents:
diff changeset
     4
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
489c9b5090e2 Initial load
duke
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
489c9b5090e2 Initial load
duke
parents:
diff changeset
     7
 * published by the Free Software Foundation.
489c9b5090e2 Initial load
duke
parents:
diff changeset
     8
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
489c9b5090e2 Initial load
duke
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
489c9b5090e2 Initial load
duke
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
489c9b5090e2 Initial load
duke
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
489c9b5090e2 Initial load
duke
parents:
diff changeset
    13
 * accompanied this code).
489c9b5090e2 Initial load
duke
parents:
diff changeset
    14
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
489c9b5090e2 Initial load
duke
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
489c9b5090e2 Initial load
duke
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    18
 *
5547
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 4584
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 4584
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 4584
diff changeset
    21
 * questions.
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    22
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
    23
 */
489c9b5090e2 Initial load
duke
parents:
diff changeset
    24
489c9b5090e2 Initial load
duke
parents:
diff changeset
    25
# include "incls/_precompiled.incl"
489c9b5090e2 Initial load
duke
parents:
diff changeset
    26
# include "incls/_klassKlass.cpp.incl"
489c9b5090e2 Initial load
duke
parents:
diff changeset
    27
489c9b5090e2 Initial load
duke
parents:
diff changeset
    28
int klassKlass::oop_size(oop obj) const {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    29
  assert (obj->is_klass(), "must be a klassOop");
489c9b5090e2 Initial load
duke
parents:
diff changeset
    30
  return klassOop(obj)->klass_part()->klass_oop_size();
489c9b5090e2 Initial load
duke
parents:
diff changeset
    31
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
    32
489c9b5090e2 Initial load
duke
parents:
diff changeset
    33
klassOop klassKlass::create_klass(TRAPS) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    34
  KlassHandle h_this_klass;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    35
  klassKlass o;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    36
  // for bootstrapping, handles may not be available yet.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    37
  klassOop k = base_create_klass_oop(h_this_klass, header_size(), o.vtbl_value(), CHECK_NULL);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    38
  k->set_klass(k); // point to thyself
489c9b5090e2 Initial load
duke
parents:
diff changeset
    39
  // Do not try to allocate mirror, java.lang.Class not loaded at this point.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    40
  // See Universe::fixup_mirrors()
489c9b5090e2 Initial load
duke
parents:
diff changeset
    41
  return k;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    42
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
    43
489c9b5090e2 Initial load
duke
parents:
diff changeset
    44
void klassKlass::oop_follow_contents(oop obj) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    45
  Klass* k = Klass::cast(klassOop(obj));
489c9b5090e2 Initial load
duke
parents:
diff changeset
    46
  // If we are alive it is valid to keep our superclass and subtype caches alive
489c9b5090e2 Initial load
duke
parents:
diff changeset
    47
  MarkSweep::mark_and_push(k->adr_super());
489c9b5090e2 Initial load
duke
parents:
diff changeset
    48
  for (juint i = 0; i < Klass::primary_super_limit(); i++)
489c9b5090e2 Initial load
duke
parents:
diff changeset
    49
    MarkSweep::mark_and_push(k->adr_primary_supers()+i);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    50
  MarkSweep::mark_and_push(k->adr_secondary_super_cache());
489c9b5090e2 Initial load
duke
parents:
diff changeset
    51
  MarkSweep::mark_and_push(k->adr_secondary_supers());
489c9b5090e2 Initial load
duke
parents:
diff changeset
    52
  MarkSweep::mark_and_push(k->adr_java_mirror());
489c9b5090e2 Initial load
duke
parents:
diff changeset
    53
  MarkSweep::mark_and_push(k->adr_name());
489c9b5090e2 Initial load
duke
parents:
diff changeset
    54
  // We follow the subklass and sibling links at the end of the
489c9b5090e2 Initial load
duke
parents:
diff changeset
    55
  // marking phase, since otherwise following them will prevent
489c9b5090e2 Initial load
duke
parents:
diff changeset
    56
  // class unloading (all classes are transitively linked from
489c9b5090e2 Initial load
duke
parents:
diff changeset
    57
  // java.lang.Object).
489c9b5090e2 Initial load
duke
parents:
diff changeset
    58
  MarkSweep::revisit_weak_klass_link(k);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    59
  obj->follow_header();
489c9b5090e2 Initial load
duke
parents:
diff changeset
    60
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
    61
489c9b5090e2 Initial load
duke
parents:
diff changeset
    62
#ifndef SERIALGC
489c9b5090e2 Initial load
duke
parents:
diff changeset
    63
void klassKlass::oop_follow_contents(ParCompactionManager* cm,
489c9b5090e2 Initial load
duke
parents:
diff changeset
    64
                                     oop obj) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    65
  Klass* k = Klass::cast(klassOop(obj));
489c9b5090e2 Initial load
duke
parents:
diff changeset
    66
  // If we are alive it is valid to keep our superclass and subtype caches alive
489c9b5090e2 Initial load
duke
parents:
diff changeset
    67
  PSParallelCompact::mark_and_push(cm, k->adr_super());
489c9b5090e2 Initial load
duke
parents:
diff changeset
    68
  for (juint i = 0; i < Klass::primary_super_limit(); i++)
489c9b5090e2 Initial load
duke
parents:
diff changeset
    69
    PSParallelCompact::mark_and_push(cm, k->adr_primary_supers()+i);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    70
  PSParallelCompact::mark_and_push(cm, k->adr_secondary_super_cache());
489c9b5090e2 Initial load
duke
parents:
diff changeset
    71
  PSParallelCompact::mark_and_push(cm, k->adr_secondary_supers());
489c9b5090e2 Initial load
duke
parents:
diff changeset
    72
  PSParallelCompact::mark_and_push(cm, k->adr_java_mirror());
489c9b5090e2 Initial load
duke
parents:
diff changeset
    73
  PSParallelCompact::mark_and_push(cm, k->adr_name());
489c9b5090e2 Initial load
duke
parents:
diff changeset
    74
  // We follow the subklass and sibling links at the end of the
489c9b5090e2 Initial load
duke
parents:
diff changeset
    75
  // marking phase, since otherwise following them will prevent
489c9b5090e2 Initial load
duke
parents:
diff changeset
    76
  // class unloading (all classes are transitively linked from
489c9b5090e2 Initial load
duke
parents:
diff changeset
    77
  // java.lang.Object).
489c9b5090e2 Initial load
duke
parents:
diff changeset
    78
  PSParallelCompact::revisit_weak_klass_link(cm, k);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    79
  obj->follow_header(cm);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    80
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
    81
#endif // SERIALGC
489c9b5090e2 Initial load
duke
parents:
diff changeset
    82
489c9b5090e2 Initial load
duke
parents:
diff changeset
    83
int klassKlass::oop_oop_iterate(oop obj, OopClosure* blk) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    84
  // Get size before changing pointers
489c9b5090e2 Initial load
duke
parents:
diff changeset
    85
  int size = oop_size(obj);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    86
  Klass* k = Klass::cast(klassOop(obj));
489c9b5090e2 Initial load
duke
parents:
diff changeset
    87
  blk->do_oop(k->adr_super());
489c9b5090e2 Initial load
duke
parents:
diff changeset
    88
  for (juint i = 0; i < Klass::primary_super_limit(); i++)
489c9b5090e2 Initial load
duke
parents:
diff changeset
    89
    blk->do_oop(k->adr_primary_supers()+i);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    90
  blk->do_oop(k->adr_secondary_super_cache());
489c9b5090e2 Initial load
duke
parents:
diff changeset
    91
  blk->do_oop(k->adr_secondary_supers());
489c9b5090e2 Initial load
duke
parents:
diff changeset
    92
  blk->do_oop(k->adr_java_mirror());
489c9b5090e2 Initial load
duke
parents:
diff changeset
    93
  blk->do_oop(k->adr_name());
489c9b5090e2 Initial load
duke
parents:
diff changeset
    94
  // The following are in the perm gen and are treated
489c9b5090e2 Initial load
duke
parents:
diff changeset
    95
  // specially in a later phase of a perm gen collection; ...
489c9b5090e2 Initial load
duke
parents:
diff changeset
    96
  assert(oop(k)->is_perm(), "should be in perm");
489c9b5090e2 Initial load
duke
parents:
diff changeset
    97
  assert(oop(k->subklass())->is_perm_or_null(), "should be in perm");
489c9b5090e2 Initial load
duke
parents:
diff changeset
    98
  assert(oop(k->next_sibling())->is_perm_or_null(), "should be in perm");
489c9b5090e2 Initial load
duke
parents:
diff changeset
    99
  // ... don't scan them normally, but remember this klassKlass
489c9b5090e2 Initial load
duke
parents:
diff changeset
   100
  // for later (see, for instance, oop_follow_contents above
489c9b5090e2 Initial load
duke
parents:
diff changeset
   101
  // for what MarkSweep does with it.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   102
  if (blk->should_remember_klasses()) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   103
    blk->remember_klass(k);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   104
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   105
  obj->oop_iterate_header(blk);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   106
  return size;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   107
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   108
489c9b5090e2 Initial load
duke
parents:
diff changeset
   109
489c9b5090e2 Initial load
duke
parents:
diff changeset
   110
int klassKlass::oop_oop_iterate_m(oop obj, OopClosure* blk, MemRegion mr) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   111
  // Get size before changing pointers
489c9b5090e2 Initial load
duke
parents:
diff changeset
   112
  int size = oop_size(obj);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   113
  Klass* k = Klass::cast(klassOop(obj));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   114
  oop* adr;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   115
  adr = k->adr_super();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   116
  if (mr.contains(adr)) blk->do_oop(adr);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   117
  for (juint i = 0; i < Klass::primary_super_limit(); i++) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   118
    adr = k->adr_primary_supers()+i;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   119
    if (mr.contains(adr)) blk->do_oop(adr);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   120
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   121
  adr = k->adr_secondary_super_cache();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   122
  if (mr.contains(adr)) blk->do_oop(adr);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   123
  adr = k->adr_secondary_supers();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   124
  if (mr.contains(adr)) blk->do_oop(adr);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   125
  adr = k->adr_java_mirror();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   126
  if (mr.contains(adr)) blk->do_oop(adr);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   127
  adr = k->adr_name();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   128
  if (mr.contains(adr)) blk->do_oop(adr);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   129
  // The following are "weak links" in the perm gen and are
489c9b5090e2 Initial load
duke
parents:
diff changeset
   130
  // treated specially in a later phase of a perm gen collection.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   131
  assert(oop(k)->is_perm(), "should be in perm");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   132
  assert(oop(k->adr_subklass())->is_perm(), "should be in perm");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   133
  assert(oop(k->adr_next_sibling())->is_perm(), "should be in perm");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   134
  if (blk->should_remember_klasses()
489c9b5090e2 Initial load
duke
parents:
diff changeset
   135
      && (mr.contains(k->adr_subklass())
489c9b5090e2 Initial load
duke
parents:
diff changeset
   136
          || mr.contains(k->adr_next_sibling()))) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   137
    blk->remember_klass(k);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   138
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   139
  obj->oop_iterate_header(blk, mr);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   140
  return size;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   141
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   142
489c9b5090e2 Initial load
duke
parents:
diff changeset
   143
489c9b5090e2 Initial load
duke
parents:
diff changeset
   144
int klassKlass::oop_adjust_pointers(oop obj) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   145
  // Get size before changing pointers
489c9b5090e2 Initial load
duke
parents:
diff changeset
   146
  int size = oop_size(obj);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   147
  obj->adjust_header();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   148
489c9b5090e2 Initial load
duke
parents:
diff changeset
   149
  Klass* k = Klass::cast(klassOop(obj));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   150
489c9b5090e2 Initial load
duke
parents:
diff changeset
   151
  MarkSweep::adjust_pointer(k->adr_super());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   152
  for (juint i = 0; i < Klass::primary_super_limit(); i++)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   153
    MarkSweep::adjust_pointer(k->adr_primary_supers()+i);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   154
  MarkSweep::adjust_pointer(k->adr_secondary_super_cache());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   155
  MarkSweep::adjust_pointer(k->adr_secondary_supers());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   156
  MarkSweep::adjust_pointer(k->adr_java_mirror());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   157
  MarkSweep::adjust_pointer(k->adr_name());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   158
  MarkSweep::adjust_pointer(k->adr_subklass());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   159
  MarkSweep::adjust_pointer(k->adr_next_sibling());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   160
  return size;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   161
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   162
489c9b5090e2 Initial load
duke
parents:
diff changeset
   163
#ifndef SERIALGC
489c9b5090e2 Initial load
duke
parents:
diff changeset
   164
void klassKlass::oop_copy_contents(PSPromotionManager* pm, oop obj) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   165
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   166
489c9b5090e2 Initial load
duke
parents:
diff changeset
   167
void klassKlass::oop_push_contents(PSPromotionManager* pm, oop obj) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   168
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   169
489c9b5090e2 Initial load
duke
parents:
diff changeset
   170
int klassKlass::oop_update_pointers(ParCompactionManager* cm, oop obj) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   171
  Klass* k = Klass::cast(klassOop(obj));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   172
489c9b5090e2 Initial load
duke
parents:
diff changeset
   173
  oop* const beg_oop = k->oop_block_beg();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   174
  oop* const end_oop = k->oop_block_end();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   175
  for (oop* cur_oop = beg_oop; cur_oop < end_oop; ++cur_oop) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   176
    PSParallelCompact::adjust_pointer(cur_oop);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   177
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   178
489c9b5090e2 Initial load
duke
parents:
diff changeset
   179
  return oop_size(obj);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   180
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   181
489c9b5090e2 Initial load
duke
parents:
diff changeset
   182
int klassKlass::oop_update_pointers(ParCompactionManager* cm, oop obj,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   183
                                    HeapWord* beg_addr, HeapWord* end_addr) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   184
  Klass* k = Klass::cast(klassOop(obj));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   185
489c9b5090e2 Initial load
duke
parents:
diff changeset
   186
  oop* const beg_oop = MAX2((oop*)beg_addr, k->oop_block_beg());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   187
  oop* const end_oop = MIN2((oop*)end_addr, k->oop_block_end());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   188
  for (oop* cur_oop = beg_oop; cur_oop < end_oop; ++cur_oop) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   189
    PSParallelCompact::adjust_pointer(cur_oop);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   190
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   191
489c9b5090e2 Initial load
duke
parents:
diff changeset
   192
  return oop_size(obj);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   193
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   194
#endif // SERIALGC
489c9b5090e2 Initial load
duke
parents:
diff changeset
   195
489c9b5090e2 Initial load
duke
parents:
diff changeset
   196
489c9b5090e2 Initial load
duke
parents:
diff changeset
   197
// Printing
489c9b5090e2 Initial load
duke
parents:
diff changeset
   198
489c9b5090e2 Initial load
duke
parents:
diff changeset
   199
void klassKlass::oop_print_on(oop obj, outputStream* st) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   200
  Klass::oop_print_on(obj, st);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   201
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   202
489c9b5090e2 Initial load
duke
parents:
diff changeset
   203
void klassKlass::oop_print_value_on(oop obj, outputStream* st) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   204
  Klass::oop_print_value_on(obj, st);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   205
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   206
489c9b5090e2 Initial load
duke
parents:
diff changeset
   207
const char* klassKlass::internal_name() const {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   208
  return "{other class}";
489c9b5090e2 Initial load
duke
parents:
diff changeset
   209
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   210
489c9b5090e2 Initial load
duke
parents:
diff changeset
   211
489c9b5090e2 Initial load
duke
parents:
diff changeset
   212
// Verification
489c9b5090e2 Initial load
duke
parents:
diff changeset
   213
489c9b5090e2 Initial load
duke
parents:
diff changeset
   214
void klassKlass::oop_verify_on(oop obj, outputStream* st) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   215
  Klass::oop_verify_on(obj, st);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   216
  guarantee(obj->is_perm(),                      "should be in permspace");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   217
  guarantee(obj->is_klass(),                     "should be klass");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   218
489c9b5090e2 Initial load
duke
parents:
diff changeset
   219
  Klass* k = Klass::cast(klassOop(obj));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   220
  if (k->super() != NULL) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   221
    guarantee(k->super()->is_perm(),             "should be in permspace");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   222
    guarantee(k->super()->is_klass(),            "should be klass");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   223
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   224
  klassOop ko = k->secondary_super_cache();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   225
  if( ko != NULL ) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   226
    guarantee(ko->is_perm(),                     "should be in permspace");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   227
    guarantee(ko->is_klass(),                    "should be klass");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   228
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   229
  for( uint i = 0; i < primary_super_limit(); i++ ) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   230
    oop ko = k->adr_primary_supers()[i]; // Cannot use normal accessor because it asserts
489c9b5090e2 Initial load
duke
parents:
diff changeset
   231
    if( ko != NULL ) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   232
      guarantee(ko->is_perm(),                   "should be in permspace");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   233
      guarantee(ko->is_klass(),                  "should be klass");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   234
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   235
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   236
489c9b5090e2 Initial load
duke
parents:
diff changeset
   237
  if (k->java_mirror() != NULL || (k->oop_is_instance() && instanceKlass::cast(klassOop(obj))->is_loaded())) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   238
    guarantee(k->java_mirror() != NULL,          "should be allocated");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   239
    guarantee(k->java_mirror()->is_perm(),       "should be in permspace");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   240
    guarantee(k->java_mirror()->is_instance(),   "should be instance");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   241
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   242
  if (k->name() != NULL) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   243
    guarantee(Universe::heap()->is_in_permanent(k->name()),
489c9b5090e2 Initial load
duke
parents:
diff changeset
   244
              "should be in permspace");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   245
    guarantee(k->name()->is_symbol(), "should be symbol");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   246
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   247
}