hotspot/src/share/vm/oops/instanceKlassKlass.cpp
author jiangli
Thu, 29 Mar 2012 22:18:56 -0400
changeset 12369 48fd3da4025c
parent 12231 6a9cfc59a18a
child 12587 8f819769ca1b
permissions -rw-r--r--
7154670: The instanceKlass _implementors[] and _nof_implementors are not needed for non-interface klass. Summary: Change implementor to embedded instanceKlass field. Reviewed-by: sspitsyn, minqi, coleenp
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
     1
/*
12369
48fd3da4025c 7154670: The instanceKlass _implementors[] and _nof_implementors are not needed for non-interface klass.
jiangli
parents: 12231
diff changeset
     2
 * Copyright (c) 1997, 2012, 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: 5403
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 5403
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: 5403
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
7397
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 6248
diff changeset
    25
#include "precompiled.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 6248
diff changeset
    26
#include "classfile/javaClasses.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 6248
diff changeset
    27
#include "classfile/systemDictionary.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 6248
diff changeset
    28
#include "gc_implementation/shared/markSweep.inline.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 6248
diff changeset
    29
#include "gc_interface/collectedHeap.inline.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 6248
diff changeset
    30
#include "interpreter/oopMapCache.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 6248
diff changeset
    31
#include "memory/gcLocker.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 6248
diff changeset
    32
#include "oops/constantPoolOop.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 6248
diff changeset
    33
#include "oops/instanceKlass.hpp"
8725
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents: 8297
diff changeset
    34
#include "oops/instanceMirrorKlass.hpp"
7397
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 6248
diff changeset
    35
#include "oops/instanceKlassKlass.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 6248
diff changeset
    36
#include "oops/instanceRefKlass.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 6248
diff changeset
    37
#include "oops/objArrayKlassKlass.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 6248
diff changeset
    38
#include "oops/objArrayOop.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 6248
diff changeset
    39
#include "oops/oop.inline.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 6248
diff changeset
    40
#include "oops/oop.inline2.hpp"
8076
96d498ec7ae1 6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents: 7397
diff changeset
    41
#include "oops/symbol.hpp"
7397
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 6248
diff changeset
    42
#include "oops/typeArrayOop.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 6248
diff changeset
    43
#include "prims/jvmtiExport.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 6248
diff changeset
    44
#include "runtime/fieldDescriptor.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 6248
diff changeset
    45
#ifndef SERIALGC
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 6248
diff changeset
    46
#include "gc_implementation/parNew/parOopClosures.inline.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 6248
diff changeset
    47
#include "gc_implementation/parallelScavenge/psPromotionManager.inline.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 6248
diff changeset
    48
#include "gc_implementation/parallelScavenge/psScavenge.inline.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 6248
diff changeset
    49
#include "memory/cardTableRS.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 6248
diff changeset
    50
#include "oops/oop.pcgc.inline.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 6248
diff changeset
    51
#endif
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    52
489c9b5090e2 Initial load
duke
parents:
diff changeset
    53
klassOop instanceKlassKlass::create_klass(TRAPS) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    54
  instanceKlassKlass o;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    55
  KlassHandle h_this_klass(THREAD, Universe::klassKlassObj());
489c9b5090e2 Initial load
duke
parents:
diff changeset
    56
  KlassHandle k = base_create_klass(h_this_klass, header_size(), o.vtbl_value(), CHECK_NULL);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    57
  // Make sure size calculation is right
489c9b5090e2 Initial load
duke
parents:
diff changeset
    58
  assert(k()->size() == align_object_size(header_size()), "wrong size for object");
489c9b5090e2 Initial load
duke
parents:
diff changeset
    59
  java_lang_Class::create_mirror(k, CHECK_NULL); // Allocate mirror
489c9b5090e2 Initial load
duke
parents:
diff changeset
    60
  return k();
489c9b5090e2 Initial load
duke
parents:
diff changeset
    61
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
    62
489c9b5090e2 Initial load
duke
parents:
diff changeset
    63
int instanceKlassKlass::oop_size(oop obj) const {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    64
  assert(obj->is_klass(), "must be klass");
489c9b5090e2 Initial load
duke
parents:
diff changeset
    65
  return instanceKlass::cast(klassOop(obj))->object_size();
489c9b5090e2 Initial load
duke
parents:
diff changeset
    66
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
    67
489c9b5090e2 Initial load
duke
parents:
diff changeset
    68
bool instanceKlassKlass::oop_is_parsable(oop obj) const {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    69
  assert(obj->is_klass(), "must be klass");
489c9b5090e2 Initial load
duke
parents:
diff changeset
    70
  instanceKlass* ik = instanceKlass::cast(klassOop(obj));
489c9b5090e2 Initial load
duke
parents:
diff changeset
    71
  return (!ik->null_vtbl()) && ik->object_is_parsable();
489c9b5090e2 Initial load
duke
parents:
diff changeset
    72
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
    73
489c9b5090e2 Initial load
duke
parents:
diff changeset
    74
void instanceKlassKlass::iterate_c_heap_oops(instanceKlass* ik,
489c9b5090e2 Initial load
duke
parents:
diff changeset
    75
                                             OopClosure* closure) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    76
  if (ik->oop_map_cache() != NULL) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    77
    ik->oop_map_cache()->oop_iterate(closure);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    78
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    79
489c9b5090e2 Initial load
duke
parents:
diff changeset
    80
  if (ik->jni_ids() != NULL) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    81
    ik->jni_ids()->oops_do(closure);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    82
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    83
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
    84
489c9b5090e2 Initial load
duke
parents:
diff changeset
    85
void instanceKlassKlass::oop_follow_contents(oop obj) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    86
  assert(obj->is_klass(),"must be a klass");
489c9b5090e2 Initial load
duke
parents:
diff changeset
    87
  assert(klassOop(obj)->klass_part()->oop_is_instance_slow(), "must be instance klass");
489c9b5090e2 Initial load
duke
parents:
diff changeset
    88
489c9b5090e2 Initial load
duke
parents:
diff changeset
    89
  instanceKlass* ik = instanceKlass::cast(klassOop(obj));
489c9b5090e2 Initial load
duke
parents:
diff changeset
    90
  {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    91
    HandleMark hm;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    92
    ik->vtable()->oop_follow_contents();
489c9b5090e2 Initial load
duke
parents:
diff changeset
    93
    ik->itable()->oop_follow_contents();
489c9b5090e2 Initial load
duke
parents:
diff changeset
    94
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    95
489c9b5090e2 Initial load
duke
parents:
diff changeset
    96
  MarkSweep::mark_and_push(ik->adr_array_klasses());
489c9b5090e2 Initial load
duke
parents:
diff changeset
    97
  MarkSweep::mark_and_push(ik->adr_methods());
489c9b5090e2 Initial load
duke
parents:
diff changeset
    98
  MarkSweep::mark_and_push(ik->adr_method_ordering());
489c9b5090e2 Initial load
duke
parents:
diff changeset
    99
  MarkSweep::mark_and_push(ik->adr_local_interfaces());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   100
  MarkSweep::mark_and_push(ik->adr_transitive_interfaces());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   101
  MarkSweep::mark_and_push(ik->adr_fields());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   102
  MarkSweep::mark_and_push(ik->adr_constants());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   103
  MarkSweep::mark_and_push(ik->adr_class_loader());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   104
  MarkSweep::mark_and_push(ik->adr_inner_classes());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   105
  MarkSweep::mark_and_push(ik->adr_protection_domain());
1550
be2fc37a817f 6653858: dynamic languages need to be able to load anonymous classes
jrose
parents: 670
diff changeset
   106
  MarkSweep::mark_and_push(ik->adr_host_klass());
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   107
  MarkSweep::mark_and_push(ik->adr_signers());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   108
  MarkSweep::mark_and_push(ik->adr_class_annotations());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   109
  MarkSweep::mark_and_push(ik->adr_fields_annotations());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   110
  MarkSweep::mark_and_push(ik->adr_methods_annotations());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   111
  MarkSweep::mark_and_push(ik->adr_methods_parameter_annotations());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   112
  MarkSweep::mark_and_push(ik->adr_methods_default_annotations());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   113
12369
48fd3da4025c 7154670: The instanceKlass _implementors[] and _nof_implementors are not needed for non-interface klass.
jiangli
parents: 12231
diff changeset
   114
  // We do not follow adr_implementor() here. It is followed later
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   115
  // in instanceKlass::follow_weak_klass_links()
489c9b5090e2 Initial load
duke
parents:
diff changeset
   116
489c9b5090e2 Initial load
duke
parents:
diff changeset
   117
  klassKlass::oop_follow_contents(obj);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   118
489c9b5090e2 Initial load
duke
parents:
diff changeset
   119
  iterate_c_heap_oops(ik, &MarkSweep::mark_and_push_closure);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   120
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   121
489c9b5090e2 Initial load
duke
parents:
diff changeset
   122
#ifndef SERIALGC
489c9b5090e2 Initial load
duke
parents:
diff changeset
   123
void instanceKlassKlass::oop_follow_contents(ParCompactionManager* cm,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   124
                                             oop obj) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   125
  assert(obj->is_klass(),"must be a klass");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   126
  assert(klassOop(obj)->klass_part()->oop_is_instance_slow(), "must be instance klass");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   127
489c9b5090e2 Initial load
duke
parents:
diff changeset
   128
  instanceKlass* ik = instanceKlass::cast(klassOop(obj));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   129
  ik->vtable()->oop_follow_contents(cm);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   130
  ik->itable()->oop_follow_contents(cm);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   131
489c9b5090e2 Initial load
duke
parents:
diff changeset
   132
  PSParallelCompact::mark_and_push(cm, ik->adr_array_klasses());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   133
  PSParallelCompact::mark_and_push(cm, ik->adr_methods());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   134
  PSParallelCompact::mark_and_push(cm, ik->adr_method_ordering());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   135
  PSParallelCompact::mark_and_push(cm, ik->adr_local_interfaces());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   136
  PSParallelCompact::mark_and_push(cm, ik->adr_transitive_interfaces());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   137
  PSParallelCompact::mark_and_push(cm, ik->adr_fields());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   138
  PSParallelCompact::mark_and_push(cm, ik->adr_constants());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   139
  PSParallelCompact::mark_and_push(cm, ik->adr_class_loader());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   140
  PSParallelCompact::mark_and_push(cm, ik->adr_inner_classes());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   141
  PSParallelCompact::mark_and_push(cm, ik->adr_protection_domain());
1550
be2fc37a817f 6653858: dynamic languages need to be able to load anonymous classes
jrose
parents: 670
diff changeset
   142
  PSParallelCompact::mark_and_push(cm, ik->adr_host_klass());
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   143
  PSParallelCompact::mark_and_push(cm, ik->adr_signers());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   144
  PSParallelCompact::mark_and_push(cm, ik->adr_class_annotations());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   145
  PSParallelCompact::mark_and_push(cm, ik->adr_fields_annotations());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   146
  PSParallelCompact::mark_and_push(cm, ik->adr_methods_annotations());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   147
  PSParallelCompact::mark_and_push(cm, ik->adr_methods_parameter_annotations());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   148
  PSParallelCompact::mark_and_push(cm, ik->adr_methods_default_annotations());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   149
489c9b5090e2 Initial load
duke
parents:
diff changeset
   150
  // We do not follow adr_implementor() here. It is followed later
489c9b5090e2 Initial load
duke
parents:
diff changeset
   151
  // in instanceKlass::follow_weak_klass_links()
489c9b5090e2 Initial load
duke
parents:
diff changeset
   152
489c9b5090e2 Initial load
duke
parents:
diff changeset
   153
  klassKlass::oop_follow_contents(cm, obj);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   154
489c9b5090e2 Initial load
duke
parents:
diff changeset
   155
  PSParallelCompact::MarkAndPushClosure mark_and_push_closure(cm);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   156
  iterate_c_heap_oops(ik, &mark_and_push_closure);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   157
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   158
#endif // SERIALGC
489c9b5090e2 Initial load
duke
parents:
diff changeset
   159
489c9b5090e2 Initial load
duke
parents:
diff changeset
   160
int instanceKlassKlass::oop_oop_iterate(oop obj, OopClosure* blk) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   161
  assert(obj->is_klass(),"must be a klass");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   162
  assert(klassOop(obj)->klass_part()->oop_is_instance_slow(), "must be instance klass");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   163
  instanceKlass* ik = instanceKlass::cast(klassOop(obj));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   164
  // Get size before changing pointers.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   165
  // Don't call size() or oop_size() since that is a virtual call.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   166
  int size = ik->object_size();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   167
489c9b5090e2 Initial load
duke
parents:
diff changeset
   168
  ik->vtable()->oop_oop_iterate(blk);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   169
  ik->itable()->oop_oop_iterate(blk);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   170
489c9b5090e2 Initial load
duke
parents:
diff changeset
   171
  blk->do_oop(ik->adr_array_klasses());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   172
  blk->do_oop(ik->adr_methods());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   173
  blk->do_oop(ik->adr_method_ordering());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   174
  blk->do_oop(ik->adr_local_interfaces());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   175
  blk->do_oop(ik->adr_transitive_interfaces());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   176
  blk->do_oop(ik->adr_fields());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   177
  blk->do_oop(ik->adr_constants());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   178
  blk->do_oop(ik->adr_class_loader());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   179
  blk->do_oop(ik->adr_protection_domain());
1550
be2fc37a817f 6653858: dynamic languages need to be able to load anonymous classes
jrose
parents: 670
diff changeset
   180
  blk->do_oop(ik->adr_host_klass());
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   181
  blk->do_oop(ik->adr_signers());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   182
  blk->do_oop(ik->adr_inner_classes());
12369
48fd3da4025c 7154670: The instanceKlass _implementors[] and _nof_implementors are not needed for non-interface klass.
jiangli
parents: 12231
diff changeset
   183
  if (ik->is_interface()) {
48fd3da4025c 7154670: The instanceKlass _implementors[] and _nof_implementors are not needed for non-interface klass.
jiangli
parents: 12231
diff changeset
   184
    blk->do_oop(ik->adr_implementor());
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   185
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   186
  blk->do_oop(ik->adr_class_annotations());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   187
  blk->do_oop(ik->adr_fields_annotations());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   188
  blk->do_oop(ik->adr_methods_annotations());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   189
  blk->do_oop(ik->adr_methods_parameter_annotations());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   190
  blk->do_oop(ik->adr_methods_default_annotations());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   191
489c9b5090e2 Initial load
duke
parents:
diff changeset
   192
  klassKlass::oop_oop_iterate(obj, blk);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   193
489c9b5090e2 Initial load
duke
parents:
diff changeset
   194
  if(ik->oop_map_cache() != NULL) ik->oop_map_cache()->oop_iterate(blk);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   195
  return size;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   196
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   197
489c9b5090e2 Initial load
duke
parents:
diff changeset
   198
int instanceKlassKlass::oop_oop_iterate_m(oop obj, OopClosure* blk,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   199
                                           MemRegion mr) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   200
  assert(obj->is_klass(),"must be a klass");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   201
  assert(klassOop(obj)->klass_part()->oop_is_instance_slow(), "must be instance klass");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   202
  instanceKlass* ik = instanceKlass::cast(klassOop(obj));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   203
  // Get size before changing pointers.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   204
  // Don't call size() or oop_size() since that is a virtual call.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   205
  int size = ik->object_size();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   206
489c9b5090e2 Initial load
duke
parents:
diff changeset
   207
  ik->vtable()->oop_oop_iterate_m(blk, mr);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   208
  ik->itable()->oop_oop_iterate_m(blk, mr);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   209
489c9b5090e2 Initial load
duke
parents:
diff changeset
   210
  oop* adr;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   211
  adr = ik->adr_array_klasses();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   212
  if (mr.contains(adr)) blk->do_oop(adr);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   213
  adr = ik->adr_methods();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   214
  if (mr.contains(adr)) blk->do_oop(adr);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   215
  adr = ik->adr_method_ordering();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   216
  if (mr.contains(adr)) blk->do_oop(adr);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   217
  adr = ik->adr_local_interfaces();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   218
  if (mr.contains(adr)) blk->do_oop(adr);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   219
  adr = ik->adr_transitive_interfaces();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   220
  if (mr.contains(adr)) blk->do_oop(adr);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   221
  adr = ik->adr_fields();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   222
  if (mr.contains(adr)) blk->do_oop(adr);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   223
  adr = ik->adr_constants();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   224
  if (mr.contains(adr)) blk->do_oop(adr);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   225
  adr = ik->adr_class_loader();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   226
  if (mr.contains(adr)) blk->do_oop(adr);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   227
  adr = ik->adr_protection_domain();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   228
  if (mr.contains(adr)) blk->do_oop(adr);
1550
be2fc37a817f 6653858: dynamic languages need to be able to load anonymous classes
jrose
parents: 670
diff changeset
   229
  adr = ik->adr_host_klass();
be2fc37a817f 6653858: dynamic languages need to be able to load anonymous classes
jrose
parents: 670
diff changeset
   230
  if (mr.contains(adr)) blk->do_oop(adr);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   231
  adr = ik->adr_signers();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   232
  if (mr.contains(adr)) blk->do_oop(adr);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   233
  adr = ik->adr_inner_classes();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   234
  if (mr.contains(adr)) blk->do_oop(adr);
12369
48fd3da4025c 7154670: The instanceKlass _implementors[] and _nof_implementors are not needed for non-interface klass.
jiangli
parents: 12231
diff changeset
   235
  if (ik->is_interface()) {
48fd3da4025c 7154670: The instanceKlass _implementors[] and _nof_implementors are not needed for non-interface klass.
jiangli
parents: 12231
diff changeset
   236
    adr = ik->adr_implementor();
48fd3da4025c 7154670: The instanceKlass _implementors[] and _nof_implementors are not needed for non-interface klass.
jiangli
parents: 12231
diff changeset
   237
    if (mr.contains(adr)) blk->do_oop(adr);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   238
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   239
  adr = ik->adr_class_annotations();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   240
  if (mr.contains(adr)) blk->do_oop(adr);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   241
  adr = ik->adr_fields_annotations();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   242
  if (mr.contains(adr)) blk->do_oop(adr);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   243
  adr = ik->adr_methods_annotations();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   244
  if (mr.contains(adr)) blk->do_oop(adr);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   245
  adr = ik->adr_methods_parameter_annotations();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   246
  if (mr.contains(adr)) blk->do_oop(adr);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   247
  adr = ik->adr_methods_default_annotations();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   248
  if (mr.contains(adr)) blk->do_oop(adr);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   249
489c9b5090e2 Initial load
duke
parents:
diff changeset
   250
  klassKlass::oop_oop_iterate_m(obj, blk, mr);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   251
489c9b5090e2 Initial load
duke
parents:
diff changeset
   252
  if(ik->oop_map_cache() != NULL) ik->oop_map_cache()->oop_iterate(blk, mr);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   253
  return size;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   254
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   255
489c9b5090e2 Initial load
duke
parents:
diff changeset
   256
int instanceKlassKlass::oop_adjust_pointers(oop obj) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   257
  assert(obj->is_klass(),"must be a klass");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   258
  assert(klassOop(obj)->klass_part()->oop_is_instance_slow(), "must be instance klass");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   259
489c9b5090e2 Initial load
duke
parents:
diff changeset
   260
  instanceKlass* ik = instanceKlass::cast(klassOop(obj));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   261
  ik->vtable()->oop_adjust_pointers();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   262
  ik->itable()->oop_adjust_pointers();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   263
489c9b5090e2 Initial load
duke
parents:
diff changeset
   264
  MarkSweep::adjust_pointer(ik->adr_array_klasses());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   265
  MarkSweep::adjust_pointer(ik->adr_methods());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   266
  MarkSweep::adjust_pointer(ik->adr_method_ordering());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   267
  MarkSweep::adjust_pointer(ik->adr_local_interfaces());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   268
  MarkSweep::adjust_pointer(ik->adr_transitive_interfaces());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   269
  MarkSweep::adjust_pointer(ik->adr_fields());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   270
  MarkSweep::adjust_pointer(ik->adr_constants());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   271
  MarkSweep::adjust_pointer(ik->adr_class_loader());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   272
  MarkSweep::adjust_pointer(ik->adr_protection_domain());
1550
be2fc37a817f 6653858: dynamic languages need to be able to load anonymous classes
jrose
parents: 670
diff changeset
   273
  MarkSweep::adjust_pointer(ik->adr_host_klass());
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   274
  MarkSweep::adjust_pointer(ik->adr_signers());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   275
  MarkSweep::adjust_pointer(ik->adr_inner_classes());
12369
48fd3da4025c 7154670: The instanceKlass _implementors[] and _nof_implementors are not needed for non-interface klass.
jiangli
parents: 12231
diff changeset
   276
  if (ik->is_interface()) {
48fd3da4025c 7154670: The instanceKlass _implementors[] and _nof_implementors are not needed for non-interface klass.
jiangli
parents: 12231
diff changeset
   277
    MarkSweep::adjust_pointer(ik->adr_implementor());
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   278
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   279
  MarkSweep::adjust_pointer(ik->adr_class_annotations());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   280
  MarkSweep::adjust_pointer(ik->adr_fields_annotations());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   281
  MarkSweep::adjust_pointer(ik->adr_methods_annotations());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   282
  MarkSweep::adjust_pointer(ik->adr_methods_parameter_annotations());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   283
  MarkSweep::adjust_pointer(ik->adr_methods_default_annotations());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   284
489c9b5090e2 Initial load
duke
parents:
diff changeset
   285
  iterate_c_heap_oops(ik, &MarkSweep::adjust_root_pointer_closure);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   286
489c9b5090e2 Initial load
duke
parents:
diff changeset
   287
  return klassKlass::oop_adjust_pointers(obj);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   288
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   289
489c9b5090e2 Initial load
duke
parents:
diff changeset
   290
#ifndef SERIALGC
489c9b5090e2 Initial load
duke
parents:
diff changeset
   291
void instanceKlassKlass::oop_push_contents(PSPromotionManager* pm, oop obj) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   292
  instanceKlass* ik = instanceKlass::cast(klassOop(obj));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   293
489c9b5090e2 Initial load
duke
parents:
diff changeset
   294
  oop* loader_addr = ik->adr_class_loader();
360
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   295
  if (PSScavenge::should_scavenge(loader_addr)) {
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   296
    pm->claim_or_forward_depth(loader_addr);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   297
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   298
489c9b5090e2 Initial load
duke
parents:
diff changeset
   299
  oop* pd_addr = ik->adr_protection_domain();
360
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   300
  if (PSScavenge::should_scavenge(pd_addr)) {
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   301
    pm->claim_or_forward_depth(pd_addr);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   302
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   303
1550
be2fc37a817f 6653858: dynamic languages need to be able to load anonymous classes
jrose
parents: 670
diff changeset
   304
  oop* hk_addr = ik->adr_host_klass();
be2fc37a817f 6653858: dynamic languages need to be able to load anonymous classes
jrose
parents: 670
diff changeset
   305
  if (PSScavenge::should_scavenge(hk_addr)) {
be2fc37a817f 6653858: dynamic languages need to be able to load anonymous classes
jrose
parents: 670
diff changeset
   306
    pm->claim_or_forward_depth(hk_addr);
be2fc37a817f 6653858: dynamic languages need to be able to load anonymous classes
jrose
parents: 670
diff changeset
   307
  }
be2fc37a817f 6653858: dynamic languages need to be able to load anonymous classes
jrose
parents: 670
diff changeset
   308
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   309
  oop* sg_addr = ik->adr_signers();
360
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   310
  if (PSScavenge::should_scavenge(sg_addr)) {
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   311
    pm->claim_or_forward_depth(sg_addr);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   312
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   313
6248
2e661807cef0 6962589: remove breadth first scanning code from parallel gc
tonyp
parents: 5547
diff changeset
   314
  klassKlass::oop_push_contents(pm, obj);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   315
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   316
489c9b5090e2 Initial load
duke
parents:
diff changeset
   317
int instanceKlassKlass::oop_update_pointers(ParCompactionManager* cm, oop obj) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   318
  assert(obj->is_klass(),"must be a klass");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   319
  assert(klassOop(obj)->klass_part()->oop_is_instance_slow(),
489c9b5090e2 Initial load
duke
parents:
diff changeset
   320
         "must be instance klass");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   321
489c9b5090e2 Initial load
duke
parents:
diff changeset
   322
  instanceKlass* ik = instanceKlass::cast(klassOop(obj));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   323
  ik->vtable()->oop_update_pointers(cm);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   324
  ik->itable()->oop_update_pointers(cm);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   325
489c9b5090e2 Initial load
duke
parents:
diff changeset
   326
  oop* const beg_oop = ik->oop_block_beg();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   327
  oop* const end_oop = ik->oop_block_end();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   328
  for (oop* cur_oop = beg_oop; cur_oop < end_oop; ++cur_oop) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   329
    PSParallelCompact::adjust_pointer(cur_oop);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   330
  }
12369
48fd3da4025c 7154670: The instanceKlass _implementors[] and _nof_implementors are not needed for non-interface klass.
jiangli
parents: 12231
diff changeset
   331
  if (ik->is_interface()) {
48fd3da4025c 7154670: The instanceKlass _implementors[] and _nof_implementors are not needed for non-interface klass.
jiangli
parents: 12231
diff changeset
   332
    PSParallelCompact::adjust_pointer(ik->adr_implementor());
48fd3da4025c 7154670: The instanceKlass _implementors[] and _nof_implementors are not needed for non-interface klass.
jiangli
parents: 12231
diff changeset
   333
  }
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   334
489c9b5090e2 Initial load
duke
parents:
diff changeset
   335
  OopClosure* closure = PSParallelCompact::adjust_root_pointer_closure();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   336
  iterate_c_heap_oops(ik, closure);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   337
489c9b5090e2 Initial load
duke
parents:
diff changeset
   338
  klassKlass::oop_update_pointers(cm, obj);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   339
  return ik->object_size();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   340
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   341
489c9b5090e2 Initial load
duke
parents:
diff changeset
   342
#endif // SERIALGC
489c9b5090e2 Initial load
duke
parents:
diff changeset
   343
3693
af387bf37e8d 6861660: OopMapBlock count/size confusion
jcoomes
parents: 2570
diff changeset
   344
klassOop
8725
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents: 8297
diff changeset
   345
instanceKlassKlass::allocate_instance_klass(Symbol* name, int vtable_len, int itable_len,
3693
af387bf37e8d 6861660: OopMapBlock count/size confusion
jcoomes
parents: 2570
diff changeset
   346
                                            int static_field_size,
3694
942b7bc7f28c 6845368: large objects cause a crash or unexpected exception
jcoomes
parents: 3693
diff changeset
   347
                                            unsigned nonstatic_oop_map_count,
12369
48fd3da4025c 7154670: The instanceKlass _implementors[] and _nof_implementors are not needed for non-interface klass.
jiangli
parents: 12231
diff changeset
   348
                                            AccessFlags access_flags,
3693
af387bf37e8d 6861660: OopMapBlock count/size confusion
jcoomes
parents: 2570
diff changeset
   349
                                            ReferenceType rt, TRAPS) {
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   350
3693
af387bf37e8d 6861660: OopMapBlock count/size confusion
jcoomes
parents: 2570
diff changeset
   351
  const int nonstatic_oop_map_size =
af387bf37e8d 6861660: OopMapBlock count/size confusion
jcoomes
parents: 2570
diff changeset
   352
    instanceKlass::nonstatic_oop_map_size(nonstatic_oop_map_count);
12369
48fd3da4025c 7154670: The instanceKlass _implementors[] and _nof_implementors are not needed for non-interface klass.
jiangli
parents: 12231
diff changeset
   353
  int size = align_object_offset(vtable_len) + align_object_offset(itable_len);
48fd3da4025c 7154670: The instanceKlass _implementors[] and _nof_implementors are not needed for non-interface klass.
jiangli
parents: 12231
diff changeset
   354
  if (access_flags.is_interface()) {
48fd3da4025c 7154670: The instanceKlass _implementors[] and _nof_implementors are not needed for non-interface klass.
jiangli
parents: 12231
diff changeset
   355
    size += align_object_offset(nonstatic_oop_map_size) + (int)sizeof(klassOop)/HeapWordSize;
48fd3da4025c 7154670: The instanceKlass _implementors[] and _nof_implementors are not needed for non-interface klass.
jiangli
parents: 12231
diff changeset
   356
  } else {
48fd3da4025c 7154670: The instanceKlass _implementors[] and _nof_implementors are not needed for non-interface klass.
jiangli
parents: 12231
diff changeset
   357
    size += nonstatic_oop_map_size;
48fd3da4025c 7154670: The instanceKlass _implementors[] and _nof_implementors are not needed for non-interface klass.
jiangli
parents: 12231
diff changeset
   358
  }
48fd3da4025c 7154670: The instanceKlass _implementors[] and _nof_implementors are not needed for non-interface klass.
jiangli
parents: 12231
diff changeset
   359
  size = instanceKlass::object_size(size);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   360
489c9b5090e2 Initial load
duke
parents:
diff changeset
   361
  // Allocation
489c9b5090e2 Initial load
duke
parents:
diff changeset
   362
  KlassHandle h_this_klass(THREAD, as_klassOop());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   363
  KlassHandle k;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   364
  if (rt == REF_NONE) {
8725
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents: 8297
diff changeset
   365
    if (name != vmSymbols::java_lang_Class()) {
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents: 8297
diff changeset
   366
      // regular klass
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents: 8297
diff changeset
   367
      instanceKlass o;
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents: 8297
diff changeset
   368
      k = base_create_klass(h_this_klass, size, o.vtbl_value(), CHECK_NULL);
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents: 8297
diff changeset
   369
    } else {
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents: 8297
diff changeset
   370
      // Class
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents: 8297
diff changeset
   371
      instanceMirrorKlass o;
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents: 8297
diff changeset
   372
      k = base_create_klass(h_this_klass, size, o.vtbl_value(), CHECK_NULL);
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents: 8297
diff changeset
   373
    }
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   374
  } else {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   375
    // reference klass
489c9b5090e2 Initial load
duke
parents:
diff changeset
   376
    instanceRefKlass o;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   377
    k = base_create_klass(h_this_klass, size, o.vtbl_value(), CHECK_NULL);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   378
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   379
  {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   380
    No_Safepoint_Verifier no_safepoint; // until k becomes parsable
489c9b5090e2 Initial load
duke
parents:
diff changeset
   381
    instanceKlass* ik = (instanceKlass*) k()->klass_part();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   382
    assert(!k()->is_parsable(), "not expecting parsability yet.");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   383
489c9b5090e2 Initial load
duke
parents:
diff changeset
   384
    // The sizes of these these three variables are used for determining the
489c9b5090e2 Initial load
duke
parents:
diff changeset
   385
    // size of the instanceKlassOop. It is critical that these are set to the right
489c9b5090e2 Initial load
duke
parents:
diff changeset
   386
    // sizes before the first GC, i.e., when we allocate the mirror.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   387
    ik->set_vtable_length(vtable_len);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   388
    ik->set_itable_length(itable_len);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   389
    ik->set_static_field_size(static_field_size);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   390
    ik->set_nonstatic_oop_map_size(nonstatic_oop_map_size);
12369
48fd3da4025c 7154670: The instanceKlass _implementors[] and _nof_implementors are not needed for non-interface klass.
jiangli
parents: 12231
diff changeset
   391
    ik->set_access_flags(access_flags);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   392
    assert(k()->size() == size, "wrong size for object");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   393
489c9b5090e2 Initial load
duke
parents:
diff changeset
   394
    ik->set_array_klasses(NULL);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   395
    ik->set_methods(NULL);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   396
    ik->set_method_ordering(NULL);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   397
    ik->set_local_interfaces(NULL);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   398
    ik->set_transitive_interfaces(NULL);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   399
    ik->init_implementor();
10546
e79347eebbc5 7086585: make Java field injection more flexible
never
parents: 9172
diff changeset
   400
    ik->set_fields(NULL, 0);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   401
    ik->set_constants(NULL);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   402
    ik->set_class_loader(NULL);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   403
    ik->set_protection_domain(NULL);
1550
be2fc37a817f 6653858: dynamic languages need to be able to load anonymous classes
jrose
parents: 670
diff changeset
   404
    ik->set_host_klass(NULL);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   405
    ik->set_signers(NULL);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   406
    ik->set_source_file_name(NULL);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   407
    ik->set_source_debug_extension(NULL);
8076
96d498ec7ae1 6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents: 7397
diff changeset
   408
    ik->set_source_debug_extension(NULL);
96d498ec7ae1 6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents: 7397
diff changeset
   409
    ik->set_array_name(NULL);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   410
    ik->set_inner_classes(NULL);
8725
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents: 8297
diff changeset
   411
    ik->set_static_oop_field_count(0);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   412
    ik->set_nonstatic_field_size(0);
11440
dea12ec80745 7129240: backout fix for 7102776 until 7128770 is resolved
dcubed
parents: 11405
diff changeset
   413
    ik->set_is_marked_dependent(false);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   414
    ik->set_init_state(instanceKlass::allocated);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   415
    ik->set_init_thread(NULL);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   416
    ik->set_reference_type(rt);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   417
    ik->set_oop_map_cache(NULL);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   418
    ik->set_jni_ids(NULL);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   419
    ik->set_osr_nmethods_head(NULL);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   420
    ik->set_breakpoints(NULL);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   421
    ik->init_previous_versions();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   422
    ik->set_generic_signature(NULL);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   423
    ik->release_set_methods_jmethod_ids(NULL);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   424
    ik->release_set_methods_cached_itable_indices(NULL);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   425
    ik->set_class_annotations(NULL);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   426
    ik->set_fields_annotations(NULL);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   427
    ik->set_methods_annotations(NULL);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   428
    ik->set_methods_parameter_annotations(NULL);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   429
    ik->set_methods_default_annotations(NULL);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   430
    ik->set_jvmti_cached_class_field_map(NULL);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   431
    ik->set_initial_method_idnum(0);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   432
    assert(k()->is_parsable(), "should be parsable here.");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   433
489c9b5090e2 Initial load
duke
parents:
diff changeset
   434
    // initialize the non-header words to zero
489c9b5090e2 Initial load
duke
parents:
diff changeset
   435
    intptr_t* p = (intptr_t*)k();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   436
    for (int index = instanceKlass::header_size(); index < size; index++) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   437
      p[index] = NULL_WORD;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   438
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   439
489c9b5090e2 Initial load
duke
parents:
diff changeset
   440
    // To get verify to work - must be set to partial loaded before first GC point.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   441
    k()->set_partially_loaded();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   442
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   443
  return k();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   444
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   445
489c9b5090e2 Initial load
duke
parents:
diff changeset
   446
489c9b5090e2 Initial load
duke
parents:
diff changeset
   447
489c9b5090e2 Initial load
duke
parents:
diff changeset
   448
#ifndef PRODUCT
489c9b5090e2 Initial load
duke
parents:
diff changeset
   449
489c9b5090e2 Initial load
duke
parents:
diff changeset
   450
// Printing
489c9b5090e2 Initial load
duke
parents:
diff changeset
   451
2332
5c7b6f4ce0a1 6814659: separable cleanups and subroutines for 6655638
jrose
parents: 1550
diff changeset
   452
#define BULLET  " - "
5c7b6f4ce0a1 6814659: separable cleanups and subroutines for 6655638
jrose
parents: 1550
diff changeset
   453
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   454
static const char* state_names[] = {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   455
  "unparseable_by_gc", "allocated", "loaded", "linked", "being_initialized", "fully_initialized", "initialization_error"
489c9b5090e2 Initial load
duke
parents:
diff changeset
   456
};
489c9b5090e2 Initial load
duke
parents:
diff changeset
   457
489c9b5090e2 Initial load
duke
parents:
diff changeset
   458
489c9b5090e2 Initial load
duke
parents:
diff changeset
   459
void instanceKlassKlass::oop_print_on(oop obj, outputStream* st) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   460
  assert(obj->is_klass(), "must be klass");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   461
  instanceKlass* ik = instanceKlass::cast(klassOop(obj));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   462
  klassKlass::oop_print_on(obj, st);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   463
2332
5c7b6f4ce0a1 6814659: separable cleanups and subroutines for 6655638
jrose
parents: 1550
diff changeset
   464
  st->print(BULLET"instance size:     %d", ik->size_helper());                        st->cr();
5c7b6f4ce0a1 6814659: separable cleanups and subroutines for 6655638
jrose
parents: 1550
diff changeset
   465
  st->print(BULLET"klass size:        %d", ik->object_size());                        st->cr();
5c7b6f4ce0a1 6814659: separable cleanups and subroutines for 6655638
jrose
parents: 1550
diff changeset
   466
  st->print(BULLET"access:            "); ik->access_flags().print_on(st);            st->cr();
5c7b6f4ce0a1 6814659: separable cleanups and subroutines for 6655638
jrose
parents: 1550
diff changeset
   467
  st->print(BULLET"state:             "); st->print_cr(state_names[ik->_init_state]);
5c7b6f4ce0a1 6814659: separable cleanups and subroutines for 6655638
jrose
parents: 1550
diff changeset
   468
  st->print(BULLET"name:              "); ik->name()->print_value_on(st);             st->cr();
5c7b6f4ce0a1 6814659: separable cleanups and subroutines for 6655638
jrose
parents: 1550
diff changeset
   469
  st->print(BULLET"super:             "); ik->super()->print_value_on(st);            st->cr();
5c7b6f4ce0a1 6814659: separable cleanups and subroutines for 6655638
jrose
parents: 1550
diff changeset
   470
  st->print(BULLET"sub:               ");
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   471
  Klass* sub = ik->subklass();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   472
  int n;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   473
  for (n = 0; sub != NULL; n++, sub = sub->next_sibling()) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   474
    if (n < MaxSubklassPrintSize) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   475
      sub->as_klassOop()->print_value_on(st);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   476
      st->print("   ");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   477
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   478
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   479
  if (n >= MaxSubklassPrintSize) st->print("(%d more klasses...)", n - MaxSubklassPrintSize);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   480
  st->cr();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   481
489c9b5090e2 Initial load
duke
parents:
diff changeset
   482
  if (ik->is_interface()) {
2332
5c7b6f4ce0a1 6814659: separable cleanups and subroutines for 6655638
jrose
parents: 1550
diff changeset
   483
    st->print_cr(BULLET"nof implementors:  %d", ik->nof_implementors());
12369
48fd3da4025c 7154670: The instanceKlass _implementors[] and _nof_implementors are not needed for non-interface klass.
jiangli
parents: 12231
diff changeset
   484
    if (ik->nof_implementors() == 1) {
48fd3da4025c 7154670: The instanceKlass _implementors[] and _nof_implementors are not needed for non-interface klass.
jiangli
parents: 12231
diff changeset
   485
      st->print_cr(BULLET"implementor:    ");
48fd3da4025c 7154670: The instanceKlass _implementors[] and _nof_implementors are not needed for non-interface klass.
jiangli
parents: 12231
diff changeset
   486
      st->print("   ");
48fd3da4025c 7154670: The instanceKlass _implementors[] and _nof_implementors are not needed for non-interface klass.
jiangli
parents: 12231
diff changeset
   487
      ik->implementor()->print_value_on(st);
48fd3da4025c 7154670: The instanceKlass _implementors[] and _nof_implementors are not needed for non-interface klass.
jiangli
parents: 12231
diff changeset
   488
      st->cr();
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   489
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   490
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   491
2332
5c7b6f4ce0a1 6814659: separable cleanups and subroutines for 6655638
jrose
parents: 1550
diff changeset
   492
  st->print(BULLET"arrays:            "); ik->array_klasses()->print_value_on(st);     st->cr();
5c7b6f4ce0a1 6814659: separable cleanups and subroutines for 6655638
jrose
parents: 1550
diff changeset
   493
  st->print(BULLET"methods:           "); ik->methods()->print_value_on(st);           st->cr();
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   494
  if (Verbose) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   495
    objArrayOop methods = ik->methods();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   496
    for(int i = 0; i < methods->length(); i++) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   497
      tty->print("%d : ", i); methods->obj_at(i)->print_value(); tty->cr();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   498
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   499
  }
2332
5c7b6f4ce0a1 6814659: separable cleanups and subroutines for 6655638
jrose
parents: 1550
diff changeset
   500
  st->print(BULLET"method ordering:   "); ik->method_ordering()->print_value_on(st);       st->cr();
5c7b6f4ce0a1 6814659: separable cleanups and subroutines for 6655638
jrose
parents: 1550
diff changeset
   501
  st->print(BULLET"local interfaces:  "); ik->local_interfaces()->print_value_on(st);      st->cr();
5c7b6f4ce0a1 6814659: separable cleanups and subroutines for 6655638
jrose
parents: 1550
diff changeset
   502
  st->print(BULLET"trans. interfaces: "); ik->transitive_interfaces()->print_value_on(st); st->cr();
5c7b6f4ce0a1 6814659: separable cleanups and subroutines for 6655638
jrose
parents: 1550
diff changeset
   503
  st->print(BULLET"constants:         "); ik->constants()->print_value_on(st);         st->cr();
5c7b6f4ce0a1 6814659: separable cleanups and subroutines for 6655638
jrose
parents: 1550
diff changeset
   504
  st->print(BULLET"class loader:      "); ik->class_loader()->print_value_on(st);      st->cr();
5c7b6f4ce0a1 6814659: separable cleanups and subroutines for 6655638
jrose
parents: 1550
diff changeset
   505
  st->print(BULLET"protection domain: "); ik->protection_domain()->print_value_on(st); st->cr();
5c7b6f4ce0a1 6814659: separable cleanups and subroutines for 6655638
jrose
parents: 1550
diff changeset
   506
  st->print(BULLET"host class:        "); ik->host_klass()->print_value_on(st);        st->cr();
5c7b6f4ce0a1 6814659: separable cleanups and subroutines for 6655638
jrose
parents: 1550
diff changeset
   507
  st->print(BULLET"signers:           "); ik->signers()->print_value_on(st);           st->cr();
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   508
  if (ik->source_file_name() != NULL) {
2332
5c7b6f4ce0a1 6814659: separable cleanups and subroutines for 6655638
jrose
parents: 1550
diff changeset
   509
    st->print(BULLET"source file:       ");
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   510
    ik->source_file_name()->print_value_on(st);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   511
    st->cr();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   512
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   513
  if (ik->source_debug_extension() != NULL) {
2332
5c7b6f4ce0a1 6814659: separable cleanups and subroutines for 6655638
jrose
parents: 1550
diff changeset
   514
    st->print(BULLET"source debug extension:       ");
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   515
    ik->source_debug_extension()->print_value_on(st);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   516
    st->cr();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   517
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   518
489c9b5090e2 Initial load
duke
parents:
diff changeset
   519
  {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   520
    ResourceMark rm;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   521
    // PreviousVersionInfo objects returned via PreviousVersionWalker
489c9b5090e2 Initial load
duke
parents:
diff changeset
   522
    // contain a GrowableArray of handles. We have to clean up the
489c9b5090e2 Initial load
duke
parents:
diff changeset
   523
    // GrowableArray _after_ the PreviousVersionWalker destructor
489c9b5090e2 Initial load
duke
parents:
diff changeset
   524
    // has destroyed the handles.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   525
    {
2332
5c7b6f4ce0a1 6814659: separable cleanups and subroutines for 6655638
jrose
parents: 1550
diff changeset
   526
      bool have_pv = false;
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   527
      PreviousVersionWalker pvw(ik);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   528
      for (PreviousVersionInfo * pv_info = pvw.next_previous_version();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   529
           pv_info != NULL; pv_info = pvw.next_previous_version()) {
2332
5c7b6f4ce0a1 6814659: separable cleanups and subroutines for 6655638
jrose
parents: 1550
diff changeset
   530
        if (!have_pv)
5c7b6f4ce0a1 6814659: separable cleanups and subroutines for 6655638
jrose
parents: 1550
diff changeset
   531
          st->print(BULLET"previous version:  ");
5c7b6f4ce0a1 6814659: separable cleanups and subroutines for 6655638
jrose
parents: 1550
diff changeset
   532
        have_pv = true;
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   533
        pv_info->prev_constant_pool_handle()()->print_value_on(st);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   534
      }
2332
5c7b6f4ce0a1 6814659: separable cleanups and subroutines for 6655638
jrose
parents: 1550
diff changeset
   535
      if (have_pv)  st->cr();
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   536
    } // pvw is cleaned up
489c9b5090e2 Initial load
duke
parents:
diff changeset
   537
  } // rm is cleaned up
489c9b5090e2 Initial load
duke
parents:
diff changeset
   538
489c9b5090e2 Initial load
duke
parents:
diff changeset
   539
  if (ik->generic_signature() != NULL) {
2332
5c7b6f4ce0a1 6814659: separable cleanups and subroutines for 6655638
jrose
parents: 1550
diff changeset
   540
    st->print(BULLET"generic signature: ");
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   541
    ik->generic_signature()->print_value_on(st);
2332
5c7b6f4ce0a1 6814659: separable cleanups and subroutines for 6655638
jrose
parents: 1550
diff changeset
   542
    st->cr();
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   543
  }
2332
5c7b6f4ce0a1 6814659: separable cleanups and subroutines for 6655638
jrose
parents: 1550
diff changeset
   544
  st->print(BULLET"inner classes:     "); ik->inner_classes()->print_value_on(st);     st->cr();
5c7b6f4ce0a1 6814659: separable cleanups and subroutines for 6655638
jrose
parents: 1550
diff changeset
   545
  st->print(BULLET"java mirror:       "); ik->java_mirror()->print_value_on(st);       st->cr();
5c7b6f4ce0a1 6814659: separable cleanups and subroutines for 6655638
jrose
parents: 1550
diff changeset
   546
  st->print(BULLET"vtable length      %d  (start addr: " INTPTR_FORMAT ")", ik->vtable_length(), ik->start_of_vtable());  st->cr();
5c7b6f4ce0a1 6814659: separable cleanups and subroutines for 6655638
jrose
parents: 1550
diff changeset
   547
  st->print(BULLET"itable length      %d (start addr: " INTPTR_FORMAT ")", ik->itable_length(), ik->start_of_itable()); st->cr();
5c7b6f4ce0a1 6814659: separable cleanups and subroutines for 6655638
jrose
parents: 1550
diff changeset
   548
  st->print_cr(BULLET"---- static fields (%d words):", ik->static_field_size());
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   549
  FieldPrinter print_static_field(st);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   550
  ik->do_local_static_fields(&print_static_field);
2332
5c7b6f4ce0a1 6814659: separable cleanups and subroutines for 6655638
jrose
parents: 1550
diff changeset
   551
  st->print_cr(BULLET"---- non-static fields (%d words):", ik->nonstatic_field_size());
5c7b6f4ce0a1 6814659: separable cleanups and subroutines for 6655638
jrose
parents: 1550
diff changeset
   552
  FieldPrinter print_nonstatic_field(st);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   553
  ik->do_nonstatic_fields(&print_nonstatic_field);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   554
2332
5c7b6f4ce0a1 6814659: separable cleanups and subroutines for 6655638
jrose
parents: 1550
diff changeset
   555
  st->print(BULLET"non-static oop maps: ");
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   556
  OopMapBlock* map     = ik->start_of_nonstatic_oop_maps();
3693
af387bf37e8d 6861660: OopMapBlock count/size confusion
jcoomes
parents: 2570
diff changeset
   557
  OopMapBlock* end_map = map + ik->nonstatic_oop_map_count();
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   558
  while (map < end_map) {
3693
af387bf37e8d 6861660: OopMapBlock count/size confusion
jcoomes
parents: 2570
diff changeset
   559
    st->print("%d-%d ", map->offset(), map->offset() + heapOopSize*(map->count() - 1));
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   560
    map++;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   561
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   562
  st->cr();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   563
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   564
4584
e2a449e8cc6f 6912062: disassembler plugin needs to produce symbolic information in product mode
jrose
parents: 4429
diff changeset
   565
#endif //PRODUCT
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   566
489c9b5090e2 Initial load
duke
parents:
diff changeset
   567
void instanceKlassKlass::oop_print_value_on(oop obj, outputStream* st) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   568
  assert(obj->is_klass(), "must be klass");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   569
  instanceKlass* ik = instanceKlass::cast(klassOop(obj));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   570
  ik->name()->print_value_on(st);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   571
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   572
489c9b5090e2 Initial load
duke
parents:
diff changeset
   573
const char* instanceKlassKlass::internal_name() const {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   574
  return "{instance class}";
489c9b5090e2 Initial load
duke
parents:
diff changeset
   575
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   576
489c9b5090e2 Initial load
duke
parents:
diff changeset
   577
// Verification
489c9b5090e2 Initial load
duke
parents:
diff changeset
   578
489c9b5090e2 Initial load
duke
parents:
diff changeset
   579
class VerifyFieldClosure: public OopClosure {
360
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   580
 protected:
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   581
  template <class T> void do_oop_work(T* p) {
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   582
    guarantee(Universe::heap()->is_in(p), "should be in heap");
360
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   583
    oop obj = oopDesc::load_decode_heap_oop(p);
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   584
    guarantee(obj->is_oop_or_null(), "should be in heap");
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   585
  }
360
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   586
 public:
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   587
  virtual void do_oop(oop* p)       { VerifyFieldClosure::do_oop_work(p); }
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   588
  virtual void do_oop(narrowOop* p) { VerifyFieldClosure::do_oop_work(p); }
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   589
};
489c9b5090e2 Initial load
duke
parents:
diff changeset
   590
489c9b5090e2 Initial load
duke
parents:
diff changeset
   591
void instanceKlassKlass::oop_verify_on(oop obj, outputStream* st) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   592
  klassKlass::oop_verify_on(obj, st);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   593
  if (!obj->partially_loaded()) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   594
    Thread *thread = Thread::current();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   595
    instanceKlass* ik = instanceKlass::cast(klassOop(obj));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   596
489c9b5090e2 Initial load
duke
parents:
diff changeset
   597
#ifndef PRODUCT
489c9b5090e2 Initial load
duke
parents:
diff changeset
   598
    // Avoid redundant verifies
489c9b5090e2 Initial load
duke
parents:
diff changeset
   599
    if (ik->_verify_count == Universe::verify_count()) return;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   600
    ik->_verify_count = Universe::verify_count();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   601
#endif
489c9b5090e2 Initial load
duke
parents:
diff changeset
   602
    // Verify that klass is present in SystemDictionary
1550
be2fc37a817f 6653858: dynamic languages need to be able to load anonymous classes
jrose
parents: 670
diff changeset
   603
    if (ik->is_loaded() && !ik->is_anonymous()) {
8076
96d498ec7ae1 6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents: 7397
diff changeset
   604
      Symbol* h_name = ik->name();
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   605
      Handle h_loader (thread, ik->class_loader());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   606
      Handle h_obj(thread, obj);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   607
      SystemDictionary::verify_obj_klass_present(h_obj, h_name, h_loader);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   608
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   609
489c9b5090e2 Initial load
duke
parents:
diff changeset
   610
    // Verify static fields
489c9b5090e2 Initial load
duke
parents:
diff changeset
   611
    VerifyFieldClosure blk;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   612
489c9b5090e2 Initial load
duke
parents:
diff changeset
   613
    // Verify vtables
489c9b5090e2 Initial load
duke
parents:
diff changeset
   614
    if (ik->is_linked()) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   615
      ResourceMark rm(thread);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   616
      // $$$ This used to be done only for m/s collections.  Doing it
489c9b5090e2 Initial load
duke
parents:
diff changeset
   617
      // always seemed a valid generalization.  (DLD -- 6/00)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   618
      ik->vtable()->verify(st);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   619
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   620
489c9b5090e2 Initial load
duke
parents:
diff changeset
   621
    // Verify oop map cache
489c9b5090e2 Initial load
duke
parents:
diff changeset
   622
    if (ik->oop_map_cache() != NULL) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   623
      ik->oop_map_cache()->verify();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   624
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   625
489c9b5090e2 Initial load
duke
parents:
diff changeset
   626
    // Verify first subklass
489c9b5090e2 Initial load
duke
parents:
diff changeset
   627
    if (ik->subklass_oop() != NULL) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   628
      guarantee(ik->subklass_oop()->is_perm(),  "should be in permspace");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   629
      guarantee(ik->subklass_oop()->is_klass(), "should be klass");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   630
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   631
489c9b5090e2 Initial load
duke
parents:
diff changeset
   632
    // Verify siblings
489c9b5090e2 Initial load
duke
parents:
diff changeset
   633
    klassOop super = ik->super();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   634
    Klass* sib = ik->next_sibling();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   635
    int sib_count = 0;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   636
    while (sib != NULL) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   637
      if (sib == ik) {
5403
6b0dd9c75dde 6888954: argument formatting for assert() and friends
jcoomes
parents: 4584
diff changeset
   638
        fatal(err_msg("subclass cycle of length %d", sib_count));
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   639
      }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   640
      if (sib_count >= 100000) {
5403
6b0dd9c75dde 6888954: argument formatting for assert() and friends
jcoomes
parents: 4584
diff changeset
   641
        fatal(err_msg("suspiciously long subclass list %d", sib_count));
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   642
      }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   643
      guarantee(sib->as_klassOop()->is_klass(), "should be klass");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   644
      guarantee(sib->as_klassOop()->is_perm(),  "should be in permspace");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   645
      guarantee(sib->super() == super, "siblings should have same superklass");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   646
      sib = sib->next_sibling();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   647
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   648
489c9b5090e2 Initial load
duke
parents:
diff changeset
   649
    // Verify implementor fields
12369
48fd3da4025c 7154670: The instanceKlass _implementors[] and _nof_implementors are not needed for non-interface klass.
jiangli
parents: 12231
diff changeset
   650
    klassOop im = ik->implementor();
48fd3da4025c 7154670: The instanceKlass _implementors[] and _nof_implementors are not needed for non-interface klass.
jiangli
parents: 12231
diff changeset
   651
    if (im != NULL) {
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   652
      guarantee(ik->is_interface(), "only interfaces should have implementor set");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   653
      guarantee(im->is_perm(),  "should be in permspace");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   654
      guarantee(im->is_klass(), "should be klass");
12369
48fd3da4025c 7154670: The instanceKlass _implementors[] and _nof_implementors are not needed for non-interface klass.
jiangli
parents: 12231
diff changeset
   655
      guarantee(!Klass::cast(klassOop(im))->is_interface() || im == ik->as_klassOop(), "implementors cannot be interfaces");
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   656
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   657
489c9b5090e2 Initial load
duke
parents:
diff changeset
   658
    // Verify local interfaces
489c9b5090e2 Initial load
duke
parents:
diff changeset
   659
    objArrayOop local_interfaces = ik->local_interfaces();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   660
    guarantee(local_interfaces->is_perm(),          "should be in permspace");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   661
    guarantee(local_interfaces->is_objArray(),      "should be obj array");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   662
    int j;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   663
    for (j = 0; j < local_interfaces->length(); j++) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   664
      oop e = local_interfaces->obj_at(j);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   665
      guarantee(e->is_klass() && Klass::cast(klassOop(e))->is_interface(), "invalid local interface");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   666
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   667
489c9b5090e2 Initial load
duke
parents:
diff changeset
   668
    // Verify transitive interfaces
489c9b5090e2 Initial load
duke
parents:
diff changeset
   669
    objArrayOop transitive_interfaces = ik->transitive_interfaces();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   670
    guarantee(transitive_interfaces->is_perm(),          "should be in permspace");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   671
    guarantee(transitive_interfaces->is_objArray(),      "should be obj array");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   672
    for (j = 0; j < transitive_interfaces->length(); j++) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   673
      oop e = transitive_interfaces->obj_at(j);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   674
      guarantee(e->is_klass() && Klass::cast(klassOop(e))->is_interface(), "invalid transitive interface");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   675
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   676
489c9b5090e2 Initial load
duke
parents:
diff changeset
   677
    // Verify methods
489c9b5090e2 Initial load
duke
parents:
diff changeset
   678
    objArrayOop methods = ik->methods();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   679
    guarantee(methods->is_perm(),              "should be in permspace");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   680
    guarantee(methods->is_objArray(),          "should be obj array");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   681
    for (j = 0; j < methods->length(); j++) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   682
      guarantee(methods->obj_at(j)->is_method(), "non-method in methods array");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   683
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   684
    for (j = 0; j < methods->length() - 1; j++) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   685
      methodOop m1 = methodOop(methods->obj_at(j));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   686
      methodOop m2 = methodOop(methods->obj_at(j + 1));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   687
      guarantee(m1->name()->fast_compare(m2->name()) <= 0, "methods not sorted correctly");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   688
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   689
489c9b5090e2 Initial load
duke
parents:
diff changeset
   690
    // Verify method ordering
489c9b5090e2 Initial load
duke
parents:
diff changeset
   691
    typeArrayOop method_ordering = ik->method_ordering();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   692
    guarantee(method_ordering->is_perm(),              "should be in permspace");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   693
    guarantee(method_ordering->is_typeArray(),         "should be type array");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   694
    int length = method_ordering->length();
9172
a4e13ccafc44 7032407: Crash in LinkResolver::runtime_resolve_virtual_method()
coleenp
parents: 9116
diff changeset
   695
    if (JvmtiExport::can_maintain_original_method_order() ||
a4e13ccafc44 7032407: Crash in LinkResolver::runtime_resolve_virtual_method()
coleenp
parents: 9116
diff changeset
   696
        (UseSharedSpaces && length != 0)) {
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   697
      guarantee(length == methods->length(),           "invalid method ordering length");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   698
      jlong sum = 0;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   699
      for (j = 0; j < length; j++) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   700
        int original_index = method_ordering->int_at(j);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   701
        guarantee(original_index >= 0 && original_index < length, "invalid method ordering index");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   702
        sum += original_index;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   703
      }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   704
      // Verify sum of indices 0,1,...,length-1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   705
      guarantee(sum == ((jlong)length*(length-1))/2,   "invalid method ordering sum");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   706
    } else {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   707
      guarantee(length == 0,                           "invalid method ordering length");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   708
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   709
489c9b5090e2 Initial load
duke
parents:
diff changeset
   710
    // Verify JNI static field identifiers
489c9b5090e2 Initial load
duke
parents:
diff changeset
   711
    if (ik->jni_ids() != NULL) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   712
      ik->jni_ids()->verify(ik->as_klassOop());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   713
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   714
489c9b5090e2 Initial load
duke
parents:
diff changeset
   715
    // Verify other fields
489c9b5090e2 Initial load
duke
parents:
diff changeset
   716
    if (ik->array_klasses() != NULL) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   717
      guarantee(ik->array_klasses()->is_perm(),      "should be in permspace");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   718
      guarantee(ik->array_klasses()->is_klass(),     "should be klass");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   719
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   720
    guarantee(ik->fields()->is_perm(),               "should be in permspace");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   721
    guarantee(ik->fields()->is_typeArray(),          "should be type array");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   722
    guarantee(ik->constants()->is_perm(),            "should be in permspace");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   723
    guarantee(ik->constants()->is_constantPool(),    "should be constant pool");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   724
    guarantee(ik->inner_classes()->is_perm(),        "should be in permspace");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   725
    guarantee(ik->inner_classes()->is_typeArray(),   "should be type array");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   726
    if (ik->protection_domain() != NULL) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   727
      guarantee(ik->protection_domain()->is_oop(),  "should be oop");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   728
    }
1550
be2fc37a817f 6653858: dynamic languages need to be able to load anonymous classes
jrose
parents: 670
diff changeset
   729
    if (ik->host_klass() != NULL) {
be2fc37a817f 6653858: dynamic languages need to be able to load anonymous classes
jrose
parents: 670
diff changeset
   730
      guarantee(ik->host_klass()->is_oop(),  "should be oop");
be2fc37a817f 6653858: dynamic languages need to be able to load anonymous classes
jrose
parents: 670
diff changeset
   731
    }
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   732
    if (ik->signers() != NULL) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   733
      guarantee(ik->signers()->is_objArray(),       "should be obj array");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   734
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   735
    if (ik->class_annotations() != NULL) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   736
      guarantee(ik->class_annotations()->is_typeArray(), "should be type array");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   737
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   738
    if (ik->fields_annotations() != NULL) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   739
      guarantee(ik->fields_annotations()->is_objArray(), "should be obj array");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   740
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   741
    if (ik->methods_annotations() != NULL) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   742
      guarantee(ik->methods_annotations()->is_objArray(), "should be obj array");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   743
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   744
    if (ik->methods_parameter_annotations() != NULL) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   745
      guarantee(ik->methods_parameter_annotations()->is_objArray(), "should be obj array");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   746
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   747
    if (ik->methods_default_annotations() != NULL) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   748
      guarantee(ik->methods_default_annotations()->is_objArray(), "should be obj array");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   749
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   750
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   751
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   752
489c9b5090e2 Initial load
duke
parents:
diff changeset
   753
489c9b5090e2 Initial load
duke
parents:
diff changeset
   754
bool instanceKlassKlass::oop_partially_loaded(oop obj) const {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   755
  assert(obj->is_klass(), "object must be klass");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   756
  instanceKlass* ik = instanceKlass::cast(klassOop(obj));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   757
  assert(ik->oop_is_instance(), "object must be instanceKlass");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   758
  return ik->transitive_interfaces() == (objArrayOop) obj;   // Check whether transitive_interfaces points to self
489c9b5090e2 Initial load
duke
parents:
diff changeset
   759
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   760
489c9b5090e2 Initial load
duke
parents:
diff changeset
   761
489c9b5090e2 Initial load
duke
parents:
diff changeset
   762
// The transitive_interfaces is the last field set when loading an object.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   763
void instanceKlassKlass::oop_set_partially_loaded(oop obj) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   764
  assert(obj->is_klass(), "object must be klass");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   765
  instanceKlass* ik = instanceKlass::cast(klassOop(obj));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   766
  // Set the layout helper to a place-holder value, until fuller initialization.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   767
  // (This allows asserts in oop_is_instance to succeed.)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   768
  ik->set_layout_helper(Klass::instance_layout_helper(0, true));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   769
  assert(ik->oop_is_instance(), "object must be instanceKlass");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   770
  assert(ik->transitive_interfaces() == NULL, "just checking");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   771
  ik->set_transitive_interfaces((objArrayOop) obj);   // Temporarily set transitive_interfaces to point to self
489c9b5090e2 Initial load
duke
parents:
diff changeset
   772
}