hotspot/src/share/vm/oops/instanceKlassKlass.cpp
author jrose
Tue, 21 Apr 2009 23:21:04 -0700
changeset 2570 ecc7862946d4
parent 2332 5c7b6f4ce0a1
child 3693 af387bf37e8d
child 3820 0a8fbbe180db
permissions -rw-r--r--
6655646: dynamic languages need dynamically linked call sites Summary: invokedynamic instruction (JSR 292 RI) Reviewed-by: twisti, never
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
     1
/*
2332
5c7b6f4ce0a1 6814659: separable cleanups and subroutines for 6655638
jrose
parents: 1550
diff changeset
     2
 * Copyright 1997-2009 Sun Microsystems, Inc.  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
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
    19
 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
489c9b5090e2 Initial load
duke
parents:
diff changeset
    20
 * CA 95054 USA or visit www.sun.com if you need additional information or
489c9b5090e2 Initial load
duke
parents:
diff changeset
    21
 * have any questions.
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/_instanceKlassKlass.cpp.incl"
489c9b5090e2 Initial load
duke
parents:
diff changeset
    27
489c9b5090e2 Initial load
duke
parents:
diff changeset
    28
klassOop instanceKlassKlass::create_klass(TRAPS) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    29
  instanceKlassKlass o;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    30
  KlassHandle h_this_klass(THREAD, Universe::klassKlassObj());
489c9b5090e2 Initial load
duke
parents:
diff changeset
    31
  KlassHandle k = base_create_klass(h_this_klass, header_size(), o.vtbl_value(), CHECK_NULL);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    32
  // Make sure size calculation is right
489c9b5090e2 Initial load
duke
parents:
diff changeset
    33
  assert(k()->size() == align_object_size(header_size()), "wrong size for object");
489c9b5090e2 Initial load
duke
parents:
diff changeset
    34
  java_lang_Class::create_mirror(k, CHECK_NULL); // Allocate mirror
489c9b5090e2 Initial load
duke
parents:
diff changeset
    35
  return k();
489c9b5090e2 Initial load
duke
parents:
diff changeset
    36
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
    37
489c9b5090e2 Initial load
duke
parents:
diff changeset
    38
int instanceKlassKlass::oop_size(oop obj) const {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    39
  assert(obj->is_klass(), "must be klass");
489c9b5090e2 Initial load
duke
parents:
diff changeset
    40
  return instanceKlass::cast(klassOop(obj))->object_size();
489c9b5090e2 Initial load
duke
parents:
diff changeset
    41
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
    42
489c9b5090e2 Initial load
duke
parents:
diff changeset
    43
bool instanceKlassKlass::oop_is_parsable(oop obj) const {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    44
  assert(obj->is_klass(), "must be klass");
489c9b5090e2 Initial load
duke
parents:
diff changeset
    45
  instanceKlass* ik = instanceKlass::cast(klassOop(obj));
489c9b5090e2 Initial load
duke
parents:
diff changeset
    46
  return (!ik->null_vtbl()) && ik->object_is_parsable();
489c9b5090e2 Initial load
duke
parents:
diff changeset
    47
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
    48
489c9b5090e2 Initial load
duke
parents:
diff changeset
    49
void instanceKlassKlass::iterate_c_heap_oops(instanceKlass* ik,
489c9b5090e2 Initial load
duke
parents:
diff changeset
    50
                                             OopClosure* closure) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    51
  if (ik->oop_map_cache() != NULL) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    52
    ik->oop_map_cache()->oop_iterate(closure);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    53
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    54
489c9b5090e2 Initial load
duke
parents:
diff changeset
    55
  if (ik->jni_ids() != NULL) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    56
    ik->jni_ids()->oops_do(closure);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    57
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    58
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
    59
489c9b5090e2 Initial load
duke
parents:
diff changeset
    60
void instanceKlassKlass::oop_follow_contents(oop obj) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    61
  assert(obj->is_klass(),"must be a klass");
489c9b5090e2 Initial load
duke
parents:
diff changeset
    62
  assert(klassOop(obj)->klass_part()->oop_is_instance_slow(), "must be instance klass");
489c9b5090e2 Initial load
duke
parents:
diff changeset
    63
489c9b5090e2 Initial load
duke
parents:
diff changeset
    64
  instanceKlass* ik = instanceKlass::cast(klassOop(obj));
489c9b5090e2 Initial load
duke
parents:
diff changeset
    65
  ik->follow_static_fields();
489c9b5090e2 Initial load
duke
parents:
diff changeset
    66
  {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    67
    HandleMark hm;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    68
    ik->vtable()->oop_follow_contents();
489c9b5090e2 Initial load
duke
parents:
diff changeset
    69
    ik->itable()->oop_follow_contents();
489c9b5090e2 Initial load
duke
parents:
diff changeset
    70
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    71
489c9b5090e2 Initial load
duke
parents:
diff changeset
    72
  MarkSweep::mark_and_push(ik->adr_array_klasses());
489c9b5090e2 Initial load
duke
parents:
diff changeset
    73
  MarkSweep::mark_and_push(ik->adr_methods());
489c9b5090e2 Initial load
duke
parents:
diff changeset
    74
  MarkSweep::mark_and_push(ik->adr_method_ordering());
489c9b5090e2 Initial load
duke
parents:
diff changeset
    75
  MarkSweep::mark_and_push(ik->adr_local_interfaces());
489c9b5090e2 Initial load
duke
parents:
diff changeset
    76
  MarkSweep::mark_and_push(ik->adr_transitive_interfaces());
489c9b5090e2 Initial load
duke
parents:
diff changeset
    77
  MarkSweep::mark_and_push(ik->adr_fields());
489c9b5090e2 Initial load
duke
parents:
diff changeset
    78
  MarkSweep::mark_and_push(ik->adr_constants());
489c9b5090e2 Initial load
duke
parents:
diff changeset
    79
  MarkSweep::mark_and_push(ik->adr_class_loader());
489c9b5090e2 Initial load
duke
parents:
diff changeset
    80
  MarkSweep::mark_and_push(ik->adr_source_file_name());
489c9b5090e2 Initial load
duke
parents:
diff changeset
    81
  MarkSweep::mark_and_push(ik->adr_source_debug_extension());
489c9b5090e2 Initial load
duke
parents:
diff changeset
    82
  MarkSweep::mark_and_push(ik->adr_inner_classes());
489c9b5090e2 Initial load
duke
parents:
diff changeset
    83
  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
    84
  MarkSweep::mark_and_push(ik->adr_host_klass());
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    85
  MarkSweep::mark_and_push(ik->adr_signers());
489c9b5090e2 Initial load
duke
parents:
diff changeset
    86
  MarkSweep::mark_and_push(ik->adr_generic_signature());
2570
ecc7862946d4 6655646: dynamic languages need dynamically linked call sites
jrose
parents: 2332
diff changeset
    87
  MarkSweep::mark_and_push(ik->adr_bootstrap_method());
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    88
  MarkSweep::mark_and_push(ik->adr_class_annotations());
489c9b5090e2 Initial load
duke
parents:
diff changeset
    89
  MarkSweep::mark_and_push(ik->adr_fields_annotations());
489c9b5090e2 Initial load
duke
parents:
diff changeset
    90
  MarkSweep::mark_and_push(ik->adr_methods_annotations());
489c9b5090e2 Initial load
duke
parents:
diff changeset
    91
  MarkSweep::mark_and_push(ik->adr_methods_parameter_annotations());
489c9b5090e2 Initial load
duke
parents:
diff changeset
    92
  MarkSweep::mark_and_push(ik->adr_methods_default_annotations());
489c9b5090e2 Initial load
duke
parents:
diff changeset
    93
489c9b5090e2 Initial load
duke
parents:
diff changeset
    94
  // We do not follow adr_implementors() here. It is followed later
489c9b5090e2 Initial load
duke
parents:
diff changeset
    95
  // in instanceKlass::follow_weak_klass_links()
489c9b5090e2 Initial load
duke
parents:
diff changeset
    96
489c9b5090e2 Initial load
duke
parents:
diff changeset
    97
  klassKlass::oop_follow_contents(obj);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    98
489c9b5090e2 Initial load
duke
parents:
diff changeset
    99
  iterate_c_heap_oops(ik, &MarkSweep::mark_and_push_closure);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   100
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   101
489c9b5090e2 Initial load
duke
parents:
diff changeset
   102
#ifndef SERIALGC
489c9b5090e2 Initial load
duke
parents:
diff changeset
   103
void instanceKlassKlass::oop_follow_contents(ParCompactionManager* cm,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   104
                                             oop obj) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   105
  assert(obj->is_klass(),"must be a klass");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   106
  assert(klassOop(obj)->klass_part()->oop_is_instance_slow(), "must be instance klass");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   107
489c9b5090e2 Initial load
duke
parents:
diff changeset
   108
  instanceKlass* ik = instanceKlass::cast(klassOop(obj));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   109
  ik->follow_static_fields(cm);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   110
  ik->vtable()->oop_follow_contents(cm);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   111
  ik->itable()->oop_follow_contents(cm);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   112
489c9b5090e2 Initial load
duke
parents:
diff changeset
   113
  PSParallelCompact::mark_and_push(cm, ik->adr_array_klasses());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   114
  PSParallelCompact::mark_and_push(cm, ik->adr_methods());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   115
  PSParallelCompact::mark_and_push(cm, ik->adr_method_ordering());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   116
  PSParallelCompact::mark_and_push(cm, ik->adr_local_interfaces());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   117
  PSParallelCompact::mark_and_push(cm, ik->adr_transitive_interfaces());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   118
  PSParallelCompact::mark_and_push(cm, ik->adr_fields());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   119
  PSParallelCompact::mark_and_push(cm, ik->adr_constants());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   120
  PSParallelCompact::mark_and_push(cm, ik->adr_class_loader());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   121
  PSParallelCompact::mark_and_push(cm, ik->adr_source_file_name());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   122
  PSParallelCompact::mark_and_push(cm, ik->adr_source_debug_extension());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   123
  PSParallelCompact::mark_and_push(cm, ik->adr_inner_classes());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   124
  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
   125
  PSParallelCompact::mark_and_push(cm, ik->adr_host_klass());
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   126
  PSParallelCompact::mark_and_push(cm, ik->adr_signers());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   127
  PSParallelCompact::mark_and_push(cm, ik->adr_generic_signature());
2570
ecc7862946d4 6655646: dynamic languages need dynamically linked call sites
jrose
parents: 2332
diff changeset
   128
  PSParallelCompact::mark_and_push(cm, ik->adr_bootstrap_method());
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   129
  PSParallelCompact::mark_and_push(cm, ik->adr_class_annotations());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   130
  PSParallelCompact::mark_and_push(cm, ik->adr_fields_annotations());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   131
  PSParallelCompact::mark_and_push(cm, ik->adr_methods_annotations());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   132
  PSParallelCompact::mark_and_push(cm, ik->adr_methods_parameter_annotations());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   133
  PSParallelCompact::mark_and_push(cm, ik->adr_methods_default_annotations());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   134
489c9b5090e2 Initial load
duke
parents:
diff changeset
   135
  // We do not follow adr_implementor() here. It is followed later
489c9b5090e2 Initial load
duke
parents:
diff changeset
   136
  // in instanceKlass::follow_weak_klass_links()
489c9b5090e2 Initial load
duke
parents:
diff changeset
   137
489c9b5090e2 Initial load
duke
parents:
diff changeset
   138
  klassKlass::oop_follow_contents(cm, obj);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   139
489c9b5090e2 Initial load
duke
parents:
diff changeset
   140
  PSParallelCompact::MarkAndPushClosure mark_and_push_closure(cm);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   141
  iterate_c_heap_oops(ik, &mark_and_push_closure);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   142
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   143
#endif // SERIALGC
489c9b5090e2 Initial load
duke
parents:
diff changeset
   144
489c9b5090e2 Initial load
duke
parents:
diff changeset
   145
int instanceKlassKlass::oop_oop_iterate(oop obj, OopClosure* blk) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   146
  assert(obj->is_klass(),"must be a klass");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   147
  assert(klassOop(obj)->klass_part()->oop_is_instance_slow(), "must be instance klass");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   148
  instanceKlass* ik = instanceKlass::cast(klassOop(obj));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   149
  // Get size before changing pointers.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   150
  // Don't call size() or oop_size() since that is a virtual call.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   151
  int size = ik->object_size();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   152
489c9b5090e2 Initial load
duke
parents:
diff changeset
   153
  ik->iterate_static_fields(blk);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   154
  ik->vtable()->oop_oop_iterate(blk);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   155
  ik->itable()->oop_oop_iterate(blk);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   156
489c9b5090e2 Initial load
duke
parents:
diff changeset
   157
  blk->do_oop(ik->adr_array_klasses());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   158
  blk->do_oop(ik->adr_methods());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   159
  blk->do_oop(ik->adr_method_ordering());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   160
  blk->do_oop(ik->adr_local_interfaces());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   161
  blk->do_oop(ik->adr_transitive_interfaces());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   162
  blk->do_oop(ik->adr_fields());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   163
  blk->do_oop(ik->adr_constants());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   164
  blk->do_oop(ik->adr_class_loader());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   165
  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
   166
  blk->do_oop(ik->adr_host_klass());
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   167
  blk->do_oop(ik->adr_signers());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   168
  blk->do_oop(ik->adr_source_file_name());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   169
  blk->do_oop(ik->adr_source_debug_extension());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   170
  blk->do_oop(ik->adr_inner_classes());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   171
  for (int i = 0; i < instanceKlass::implementors_limit; i++) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   172
    blk->do_oop(&ik->adr_implementors()[i]);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   173
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   174
  blk->do_oop(ik->adr_generic_signature());
2570
ecc7862946d4 6655646: dynamic languages need dynamically linked call sites
jrose
parents: 2332
diff changeset
   175
  blk->do_oop(ik->adr_bootstrap_method());
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   176
  blk->do_oop(ik->adr_class_annotations());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   177
  blk->do_oop(ik->adr_fields_annotations());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   178
  blk->do_oop(ik->adr_methods_annotations());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   179
  blk->do_oop(ik->adr_methods_parameter_annotations());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   180
  blk->do_oop(ik->adr_methods_default_annotations());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   181
489c9b5090e2 Initial load
duke
parents:
diff changeset
   182
  klassKlass::oop_oop_iterate(obj, blk);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   183
489c9b5090e2 Initial load
duke
parents:
diff changeset
   184
  if(ik->oop_map_cache() != NULL) ik->oop_map_cache()->oop_iterate(blk);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   185
  return size;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   186
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   187
489c9b5090e2 Initial load
duke
parents:
diff changeset
   188
int instanceKlassKlass::oop_oop_iterate_m(oop obj, OopClosure* blk,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   189
                                           MemRegion mr) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   190
  assert(obj->is_klass(),"must be a klass");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   191
  assert(klassOop(obj)->klass_part()->oop_is_instance_slow(), "must be instance klass");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   192
  instanceKlass* ik = instanceKlass::cast(klassOop(obj));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   193
  // Get size before changing pointers.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   194
  // Don't call size() or oop_size() since that is a virtual call.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   195
  int size = ik->object_size();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   196
489c9b5090e2 Initial load
duke
parents:
diff changeset
   197
  ik->iterate_static_fields(blk, mr);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   198
  ik->vtable()->oop_oop_iterate_m(blk, mr);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   199
  ik->itable()->oop_oop_iterate_m(blk, mr);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   200
489c9b5090e2 Initial load
duke
parents:
diff changeset
   201
  oop* adr;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   202
  adr = ik->adr_array_klasses();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   203
  if (mr.contains(adr)) blk->do_oop(adr);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   204
  adr = ik->adr_methods();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   205
  if (mr.contains(adr)) blk->do_oop(adr);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   206
  adr = ik->adr_method_ordering();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   207
  if (mr.contains(adr)) blk->do_oop(adr);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   208
  adr = ik->adr_local_interfaces();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   209
  if (mr.contains(adr)) blk->do_oop(adr);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   210
  adr = ik->adr_transitive_interfaces();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   211
  if (mr.contains(adr)) blk->do_oop(adr);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   212
  adr = ik->adr_fields();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   213
  if (mr.contains(adr)) blk->do_oop(adr);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   214
  adr = ik->adr_constants();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   215
  if (mr.contains(adr)) blk->do_oop(adr);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   216
  adr = ik->adr_class_loader();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   217
  if (mr.contains(adr)) blk->do_oop(adr);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   218
  adr = ik->adr_protection_domain();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   219
  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
   220
  adr = ik->adr_host_klass();
be2fc37a817f 6653858: dynamic languages need to be able to load anonymous classes
jrose
parents: 670
diff changeset
   221
  if (mr.contains(adr)) blk->do_oop(adr);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   222
  adr = ik->adr_signers();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   223
  if (mr.contains(adr)) blk->do_oop(adr);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   224
  adr = ik->adr_source_file_name();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   225
  if (mr.contains(adr)) blk->do_oop(adr);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   226
  adr = ik->adr_source_debug_extension();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   227
  if (mr.contains(adr)) blk->do_oop(adr);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   228
  adr = ik->adr_inner_classes();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   229
  if (mr.contains(adr)) blk->do_oop(adr);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   230
  adr = ik->adr_implementors();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   231
  for (int i = 0; i < instanceKlass::implementors_limit; i++) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   232
    if (mr.contains(&adr[i])) blk->do_oop(&adr[i]);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   233
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   234
  adr = ik->adr_generic_signature();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   235
  if (mr.contains(adr)) blk->do_oop(adr);
2570
ecc7862946d4 6655646: dynamic languages need dynamically linked call sites
jrose
parents: 2332
diff changeset
   236
  adr = ik->adr_bootstrap_method();
ecc7862946d4 6655646: dynamic languages need dynamically linked call sites
jrose
parents: 2332
diff changeset
   237
  if (mr.contains(adr)) blk->do_oop(adr);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   238
  adr = ik->adr_class_annotations();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   239
  if (mr.contains(adr)) blk->do_oop(adr);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   240
  adr = ik->adr_fields_annotations();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   241
  if (mr.contains(adr)) blk->do_oop(adr);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   242
  adr = ik->adr_methods_annotations();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   243
  if (mr.contains(adr)) blk->do_oop(adr);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   244
  adr = ik->adr_methods_parameter_annotations();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   245
  if (mr.contains(adr)) blk->do_oop(adr);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   246
  adr = ik->adr_methods_default_annotations();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   247
  if (mr.contains(adr)) blk->do_oop(adr);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   248
489c9b5090e2 Initial load
duke
parents:
diff changeset
   249
  klassKlass::oop_oop_iterate_m(obj, blk, mr);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   250
489c9b5090e2 Initial load
duke
parents:
diff changeset
   251
  if(ik->oop_map_cache() != NULL) ik->oop_map_cache()->oop_iterate(blk, mr);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   252
  return size;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   253
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   254
489c9b5090e2 Initial load
duke
parents:
diff changeset
   255
int instanceKlassKlass::oop_adjust_pointers(oop obj) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   256
  assert(obj->is_klass(),"must be a klass");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   257
  assert(klassOop(obj)->klass_part()->oop_is_instance_slow(), "must be instance klass");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   258
489c9b5090e2 Initial load
duke
parents:
diff changeset
   259
  instanceKlass* ik = instanceKlass::cast(klassOop(obj));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   260
  ik->adjust_static_fields();
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_source_file_name());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   276
  MarkSweep::adjust_pointer(ik->adr_source_debug_extension());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   277
  MarkSweep::adjust_pointer(ik->adr_inner_classes());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   278
  for (int i = 0; i < instanceKlass::implementors_limit; i++) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   279
    MarkSweep::adjust_pointer(&ik->adr_implementors()[i]);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   280
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   281
  MarkSweep::adjust_pointer(ik->adr_generic_signature());
2570
ecc7862946d4 6655646: dynamic languages need dynamically linked call sites
jrose
parents: 2332
diff changeset
   282
  MarkSweep::adjust_pointer(ik->adr_bootstrap_method());
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   283
  MarkSweep::adjust_pointer(ik->adr_class_annotations());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   284
  MarkSweep::adjust_pointer(ik->adr_fields_annotations());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   285
  MarkSweep::adjust_pointer(ik->adr_methods_annotations());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   286
  MarkSweep::adjust_pointer(ik->adr_methods_parameter_annotations());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   287
  MarkSweep::adjust_pointer(ik->adr_methods_default_annotations());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   288
489c9b5090e2 Initial load
duke
parents:
diff changeset
   289
  iterate_c_heap_oops(ik, &MarkSweep::adjust_root_pointer_closure);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   290
489c9b5090e2 Initial load
duke
parents:
diff changeset
   291
  return klassKlass::oop_adjust_pointers(obj);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   292
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   293
489c9b5090e2 Initial load
duke
parents:
diff changeset
   294
#ifndef SERIALGC
489c9b5090e2 Initial load
duke
parents:
diff changeset
   295
void instanceKlassKlass::oop_copy_contents(PSPromotionManager* pm, oop obj) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   296
  assert(!pm->depth_first(), "invariant");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   297
  instanceKlass* ik = instanceKlass::cast(klassOop(obj));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   298
  ik->copy_static_fields(pm);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   299
489c9b5090e2 Initial load
duke
parents:
diff changeset
   300
  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
   301
  if (PSScavenge::should_scavenge(loader_addr)) {
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   302
    pm->claim_or_forward_breadth(loader_addr);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   303
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   304
489c9b5090e2 Initial load
duke
parents:
diff changeset
   305
  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
   306
  if (PSScavenge::should_scavenge(pd_addr)) {
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   307
    pm->claim_or_forward_breadth(pd_addr);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   308
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   309
1550
be2fc37a817f 6653858: dynamic languages need to be able to load anonymous classes
jrose
parents: 670
diff changeset
   310
  oop* hk_addr = ik->adr_host_klass();
be2fc37a817f 6653858: dynamic languages need to be able to load anonymous classes
jrose
parents: 670
diff changeset
   311
  if (PSScavenge::should_scavenge(hk_addr)) {
be2fc37a817f 6653858: dynamic languages need to be able to load anonymous classes
jrose
parents: 670
diff changeset
   312
    pm->claim_or_forward_breadth(hk_addr);
be2fc37a817f 6653858: dynamic languages need to be able to load anonymous classes
jrose
parents: 670
diff changeset
   313
  }
be2fc37a817f 6653858: dynamic languages need to be able to load anonymous classes
jrose
parents: 670
diff changeset
   314
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   315
  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
   316
  if (PSScavenge::should_scavenge(sg_addr)) {
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   317
    pm->claim_or_forward_breadth(sg_addr);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   318
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   319
489c9b5090e2 Initial load
duke
parents:
diff changeset
   320
  klassKlass::oop_copy_contents(pm, obj);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   321
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   322
489c9b5090e2 Initial load
duke
parents:
diff changeset
   323
void instanceKlassKlass::oop_push_contents(PSPromotionManager* pm, oop obj) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   324
  assert(pm->depth_first(), "invariant");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   325
  instanceKlass* ik = instanceKlass::cast(klassOop(obj));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   326
  ik->push_static_fields(pm);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   327
489c9b5090e2 Initial load
duke
parents:
diff changeset
   328
  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
   329
  if (PSScavenge::should_scavenge(loader_addr)) {
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   330
    pm->claim_or_forward_depth(loader_addr);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   331
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   332
489c9b5090e2 Initial load
duke
parents:
diff changeset
   333
  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
   334
  if (PSScavenge::should_scavenge(pd_addr)) {
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   335
    pm->claim_or_forward_depth(pd_addr);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   336
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   337
1550
be2fc37a817f 6653858: dynamic languages need to be able to load anonymous classes
jrose
parents: 670
diff changeset
   338
  oop* hk_addr = ik->adr_host_klass();
be2fc37a817f 6653858: dynamic languages need to be able to load anonymous classes
jrose
parents: 670
diff changeset
   339
  if (PSScavenge::should_scavenge(hk_addr)) {
be2fc37a817f 6653858: dynamic languages need to be able to load anonymous classes
jrose
parents: 670
diff changeset
   340
    pm->claim_or_forward_depth(hk_addr);
be2fc37a817f 6653858: dynamic languages need to be able to load anonymous classes
jrose
parents: 670
diff changeset
   341
  }
be2fc37a817f 6653858: dynamic languages need to be able to load anonymous classes
jrose
parents: 670
diff changeset
   342
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   343
  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
   344
  if (PSScavenge::should_scavenge(sg_addr)) {
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   345
    pm->claim_or_forward_depth(sg_addr);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   346
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   347
489c9b5090e2 Initial load
duke
parents:
diff changeset
   348
  klassKlass::oop_copy_contents(pm, obj);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   349
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   350
489c9b5090e2 Initial load
duke
parents:
diff changeset
   351
int instanceKlassKlass::oop_update_pointers(ParCompactionManager* cm, oop obj) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   352
  assert(obj->is_klass(),"must be a klass");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   353
  assert(klassOop(obj)->klass_part()->oop_is_instance_slow(),
489c9b5090e2 Initial load
duke
parents:
diff changeset
   354
         "must be instance klass");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   355
489c9b5090e2 Initial load
duke
parents:
diff changeset
   356
  instanceKlass* ik = instanceKlass::cast(klassOop(obj));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   357
  ik->update_static_fields();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   358
  ik->vtable()->oop_update_pointers(cm);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   359
  ik->itable()->oop_update_pointers(cm);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   360
489c9b5090e2 Initial load
duke
parents:
diff changeset
   361
  oop* const beg_oop = ik->oop_block_beg();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   362
  oop* const end_oop = ik->oop_block_end();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   363
  for (oop* cur_oop = beg_oop; cur_oop < end_oop; ++cur_oop) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   364
    PSParallelCompact::adjust_pointer(cur_oop);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   365
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   366
489c9b5090e2 Initial load
duke
parents:
diff changeset
   367
  OopClosure* closure = PSParallelCompact::adjust_root_pointer_closure();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   368
  iterate_c_heap_oops(ik, closure);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   369
489c9b5090e2 Initial load
duke
parents:
diff changeset
   370
  klassKlass::oop_update_pointers(cm, obj);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   371
  return ik->object_size();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   372
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   373
489c9b5090e2 Initial load
duke
parents:
diff changeset
   374
int instanceKlassKlass::oop_update_pointers(ParCompactionManager* cm, oop obj,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   375
                                            HeapWord* beg_addr,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   376
                                            HeapWord* end_addr) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   377
  assert(obj->is_klass(),"must be a klass");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   378
  assert(klassOop(obj)->klass_part()->oop_is_instance_slow(),
489c9b5090e2 Initial load
duke
parents:
diff changeset
   379
         "must be instance klass");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   380
489c9b5090e2 Initial load
duke
parents:
diff changeset
   381
  instanceKlass* ik = instanceKlass::cast(klassOop(obj));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   382
  ik->update_static_fields(beg_addr, end_addr);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   383
  ik->vtable()->oop_update_pointers(cm, beg_addr, end_addr);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   384
  ik->itable()->oop_update_pointers(cm, beg_addr, end_addr);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   385
489c9b5090e2 Initial load
duke
parents:
diff changeset
   386
  oop* const beg_oop = MAX2((oop*)beg_addr, ik->oop_block_beg());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   387
  oop* const end_oop = MIN2((oop*)end_addr, ik->oop_block_end());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   388
  for (oop* cur_oop = beg_oop; cur_oop < end_oop; ++cur_oop) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   389
    PSParallelCompact::adjust_pointer(cur_oop);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   390
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   391
489c9b5090e2 Initial load
duke
parents:
diff changeset
   392
  // The oop_map_cache, jni_ids and jni_id_map are allocated from the C heap,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   393
  // and so don't lie within any 'Chunk' boundaries.  Update them when the
489c9b5090e2 Initial load
duke
parents:
diff changeset
   394
  // lowest addressed oop in the instanceKlass 'oop_block' is updated.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   395
  if (beg_oop == ik->oop_block_beg()) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   396
    OopClosure* closure = PSParallelCompact::adjust_root_pointer_closure();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   397
    iterate_c_heap_oops(ik, closure);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   398
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   399
489c9b5090e2 Initial load
duke
parents:
diff changeset
   400
  klassKlass::oop_update_pointers(cm, obj, beg_addr, end_addr);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   401
  return ik->object_size();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   402
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   403
#endif // SERIALGC
489c9b5090e2 Initial load
duke
parents:
diff changeset
   404
489c9b5090e2 Initial load
duke
parents:
diff changeset
   405
klassOop instanceKlassKlass::allocate_instance_klass(int vtable_len, int itable_len, int static_field_size,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   406
                                                     int nonstatic_oop_map_size, ReferenceType rt, TRAPS) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   407
489c9b5090e2 Initial load
duke
parents:
diff changeset
   408
  int size = instanceKlass::object_size(align_object_offset(vtable_len) + align_object_offset(itable_len) + static_field_size + nonstatic_oop_map_size);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   409
489c9b5090e2 Initial load
duke
parents:
diff changeset
   410
  // Allocation
489c9b5090e2 Initial load
duke
parents:
diff changeset
   411
  KlassHandle h_this_klass(THREAD, as_klassOop());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   412
  KlassHandle k;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   413
  if (rt == REF_NONE) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   414
    // regular klass
489c9b5090e2 Initial load
duke
parents:
diff changeset
   415
    instanceKlass o;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   416
    k = base_create_klass(h_this_klass, size, o.vtbl_value(), CHECK_NULL);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   417
  } else {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   418
    // reference klass
489c9b5090e2 Initial load
duke
parents:
diff changeset
   419
    instanceRefKlass o;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   420
    k = base_create_klass(h_this_klass, size, o.vtbl_value(), CHECK_NULL);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   421
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   422
  {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   423
    No_Safepoint_Verifier no_safepoint; // until k becomes parsable
489c9b5090e2 Initial load
duke
parents:
diff changeset
   424
    instanceKlass* ik = (instanceKlass*) k()->klass_part();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   425
    assert(!k()->is_parsable(), "not expecting parsability yet.");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   426
489c9b5090e2 Initial load
duke
parents:
diff changeset
   427
    // The sizes of these these three variables are used for determining the
489c9b5090e2 Initial load
duke
parents:
diff changeset
   428
    // size of the instanceKlassOop. It is critical that these are set to the right
489c9b5090e2 Initial load
duke
parents:
diff changeset
   429
    // sizes before the first GC, i.e., when we allocate the mirror.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   430
    ik->set_vtable_length(vtable_len);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   431
    ik->set_itable_length(itable_len);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   432
    ik->set_static_field_size(static_field_size);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   433
    ik->set_nonstatic_oop_map_size(nonstatic_oop_map_size);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   434
    assert(k()->size() == size, "wrong size for object");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   435
489c9b5090e2 Initial load
duke
parents:
diff changeset
   436
    ik->set_array_klasses(NULL);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   437
    ik->set_methods(NULL);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   438
    ik->set_method_ordering(NULL);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   439
    ik->set_local_interfaces(NULL);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   440
    ik->set_transitive_interfaces(NULL);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   441
    ik->init_implementor();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   442
    ik->set_fields(NULL);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   443
    ik->set_constants(NULL);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   444
    ik->set_class_loader(NULL);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   445
    ik->set_protection_domain(NULL);
1550
be2fc37a817f 6653858: dynamic languages need to be able to load anonymous classes
jrose
parents: 670
diff changeset
   446
    ik->set_host_klass(NULL);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   447
    ik->set_signers(NULL);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   448
    ik->set_source_file_name(NULL);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   449
    ik->set_source_debug_extension(NULL);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   450
    ik->set_inner_classes(NULL);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   451
    ik->set_static_oop_field_size(0);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   452
    ik->set_nonstatic_field_size(0);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   453
    ik->set_is_marked_dependent(false);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   454
    ik->set_init_state(instanceKlass::allocated);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   455
    ik->set_init_thread(NULL);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   456
    ik->set_reference_type(rt);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   457
    ik->set_oop_map_cache(NULL);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   458
    ik->set_jni_ids(NULL);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   459
    ik->set_osr_nmethods_head(NULL);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   460
    ik->set_breakpoints(NULL);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   461
    ik->init_previous_versions();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   462
    ik->set_generic_signature(NULL);
2570
ecc7862946d4 6655646: dynamic languages need dynamically linked call sites
jrose
parents: 2332
diff changeset
   463
    ik->set_bootstrap_method(NULL);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   464
    ik->release_set_methods_jmethod_ids(NULL);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   465
    ik->release_set_methods_cached_itable_indices(NULL);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   466
    ik->set_class_annotations(NULL);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   467
    ik->set_fields_annotations(NULL);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   468
    ik->set_methods_annotations(NULL);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   469
    ik->set_methods_parameter_annotations(NULL);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   470
    ik->set_methods_default_annotations(NULL);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   471
    ik->set_enclosing_method_indices(0, 0);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   472
    ik->set_jvmti_cached_class_field_map(NULL);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   473
    ik->set_initial_method_idnum(0);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   474
    assert(k()->is_parsable(), "should be parsable here.");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   475
489c9b5090e2 Initial load
duke
parents:
diff changeset
   476
    // initialize the non-header words to zero
489c9b5090e2 Initial load
duke
parents:
diff changeset
   477
    intptr_t* p = (intptr_t*)k();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   478
    for (int index = instanceKlass::header_size(); index < size; index++) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   479
      p[index] = NULL_WORD;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   480
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   481
489c9b5090e2 Initial load
duke
parents:
diff changeset
   482
    // To get verify to work - must be set to partial loaded before first GC point.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   483
    k()->set_partially_loaded();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   484
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   485
489c9b5090e2 Initial load
duke
parents:
diff changeset
   486
  // GC can happen here
489c9b5090e2 Initial load
duke
parents:
diff changeset
   487
  java_lang_Class::create_mirror(k, CHECK_NULL); // Allocate mirror
489c9b5090e2 Initial load
duke
parents:
diff changeset
   488
  return k();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   489
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   490
489c9b5090e2 Initial load
duke
parents:
diff changeset
   491
489c9b5090e2 Initial load
duke
parents:
diff changeset
   492
489c9b5090e2 Initial load
duke
parents:
diff changeset
   493
#ifndef PRODUCT
489c9b5090e2 Initial load
duke
parents:
diff changeset
   494
489c9b5090e2 Initial load
duke
parents:
diff changeset
   495
// Printing
489c9b5090e2 Initial load
duke
parents:
diff changeset
   496
2332
5c7b6f4ce0a1 6814659: separable cleanups and subroutines for 6655638
jrose
parents: 1550
diff changeset
   497
#define BULLET  " - "
5c7b6f4ce0a1 6814659: separable cleanups and subroutines for 6655638
jrose
parents: 1550
diff changeset
   498
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   499
static const char* state_names[] = {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   500
  "unparseable_by_gc", "allocated", "loaded", "linked", "being_initialized", "fully_initialized", "initialization_error"
489c9b5090e2 Initial load
duke
parents:
diff changeset
   501
};
489c9b5090e2 Initial load
duke
parents:
diff changeset
   502
489c9b5090e2 Initial load
duke
parents:
diff changeset
   503
489c9b5090e2 Initial load
duke
parents:
diff changeset
   504
void instanceKlassKlass::oop_print_on(oop obj, outputStream* st) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   505
  assert(obj->is_klass(), "must be klass");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   506
  instanceKlass* ik = instanceKlass::cast(klassOop(obj));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   507
  klassKlass::oop_print_on(obj, st);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   508
2332
5c7b6f4ce0a1 6814659: separable cleanups and subroutines for 6655638
jrose
parents: 1550
diff changeset
   509
  st->print(BULLET"instance size:     %d", ik->size_helper());                        st->cr();
5c7b6f4ce0a1 6814659: separable cleanups and subroutines for 6655638
jrose
parents: 1550
diff changeset
   510
  st->print(BULLET"klass size:        %d", ik->object_size());                        st->cr();
5c7b6f4ce0a1 6814659: separable cleanups and subroutines for 6655638
jrose
parents: 1550
diff changeset
   511
  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
   512
  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
   513
  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
   514
  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
   515
  st->print(BULLET"sub:               ");
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   516
  Klass* sub = ik->subklass();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   517
  int n;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   518
  for (n = 0; sub != NULL; n++, sub = sub->next_sibling()) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   519
    if (n < MaxSubklassPrintSize) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   520
      sub->as_klassOop()->print_value_on(st);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   521
      st->print("   ");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   522
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   523
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   524
  if (n >= MaxSubklassPrintSize) st->print("(%d more klasses...)", n - MaxSubklassPrintSize);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   525
  st->cr();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   526
489c9b5090e2 Initial load
duke
parents:
diff changeset
   527
  if (ik->is_interface()) {
2332
5c7b6f4ce0a1 6814659: separable cleanups and subroutines for 6655638
jrose
parents: 1550
diff changeset
   528
    st->print_cr(BULLET"nof implementors:  %d", ik->nof_implementors());
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   529
    int print_impl = 0;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   530
    for (int i = 0; i < instanceKlass::implementors_limit; i++) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   531
      if (ik->implementor(i) != NULL) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   532
        if (++print_impl == 1)
2332
5c7b6f4ce0a1 6814659: separable cleanups and subroutines for 6655638
jrose
parents: 1550
diff changeset
   533
          st->print_cr(BULLET"implementor:    ");
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   534
        st->print("   ");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   535
        ik->implementor(i)->print_value_on(st);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   536
      }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   537
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   538
    if (print_impl > 0)  st->cr();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   539
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   540
2332
5c7b6f4ce0a1 6814659: separable cleanups and subroutines for 6655638
jrose
parents: 1550
diff changeset
   541
  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
   542
  st->print(BULLET"methods:           "); ik->methods()->print_value_on(st);           st->cr();
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   543
  if (Verbose) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   544
    objArrayOop methods = ik->methods();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   545
    for(int i = 0; i < methods->length(); i++) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   546
      tty->print("%d : ", i); methods->obj_at(i)->print_value(); tty->cr();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   547
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   548
  }
2332
5c7b6f4ce0a1 6814659: separable cleanups and subroutines for 6655638
jrose
parents: 1550
diff changeset
   549
  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
   550
  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
   551
  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
   552
  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
   553
  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
   554
  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
   555
  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
   556
  st->print(BULLET"signers:           "); ik->signers()->print_value_on(st);           st->cr();
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   557
  if (ik->source_file_name() != NULL) {
2332
5c7b6f4ce0a1 6814659: separable cleanups and subroutines for 6655638
jrose
parents: 1550
diff changeset
   558
    st->print(BULLET"source file:       ");
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   559
    ik->source_file_name()->print_value_on(st);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   560
    st->cr();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   561
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   562
  if (ik->source_debug_extension() != NULL) {
2332
5c7b6f4ce0a1 6814659: separable cleanups and subroutines for 6655638
jrose
parents: 1550
diff changeset
   563
    st->print(BULLET"source debug extension:       ");
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   564
    ik->source_debug_extension()->print_value_on(st);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   565
    st->cr();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   566
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   567
489c9b5090e2 Initial load
duke
parents:
diff changeset
   568
  {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   569
    ResourceMark rm;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   570
    // PreviousVersionInfo objects returned via PreviousVersionWalker
489c9b5090e2 Initial load
duke
parents:
diff changeset
   571
    // contain a GrowableArray of handles. We have to clean up the
489c9b5090e2 Initial load
duke
parents:
diff changeset
   572
    // GrowableArray _after_ the PreviousVersionWalker destructor
489c9b5090e2 Initial load
duke
parents:
diff changeset
   573
    // has destroyed the handles.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   574
    {
2332
5c7b6f4ce0a1 6814659: separable cleanups and subroutines for 6655638
jrose
parents: 1550
diff changeset
   575
      bool have_pv = false;
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   576
      PreviousVersionWalker pvw(ik);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   577
      for (PreviousVersionInfo * pv_info = pvw.next_previous_version();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   578
           pv_info != NULL; pv_info = pvw.next_previous_version()) {
2332
5c7b6f4ce0a1 6814659: separable cleanups and subroutines for 6655638
jrose
parents: 1550
diff changeset
   579
        if (!have_pv)
5c7b6f4ce0a1 6814659: separable cleanups and subroutines for 6655638
jrose
parents: 1550
diff changeset
   580
          st->print(BULLET"previous version:  ");
5c7b6f4ce0a1 6814659: separable cleanups and subroutines for 6655638
jrose
parents: 1550
diff changeset
   581
        have_pv = true;
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   582
        pv_info->prev_constant_pool_handle()()->print_value_on(st);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   583
      }
2332
5c7b6f4ce0a1 6814659: separable cleanups and subroutines for 6655638
jrose
parents: 1550
diff changeset
   584
      if (have_pv)  st->cr();
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   585
    } // pvw is cleaned up
489c9b5090e2 Initial load
duke
parents:
diff changeset
   586
  } // rm is cleaned up
489c9b5090e2 Initial load
duke
parents:
diff changeset
   587
2570
ecc7862946d4 6655646: dynamic languages need dynamically linked call sites
jrose
parents: 2332
diff changeset
   588
  if (ik->bootstrap_method() != NULL) {
ecc7862946d4 6655646: dynamic languages need dynamically linked call sites
jrose
parents: 2332
diff changeset
   589
    st->print(BULLET"bootstrap method:  ");
ecc7862946d4 6655646: dynamic languages need dynamically linked call sites
jrose
parents: 2332
diff changeset
   590
    ik->bootstrap_method()->print_value_on(st);
ecc7862946d4 6655646: dynamic languages need dynamically linked call sites
jrose
parents: 2332
diff changeset
   591
    st->cr();
ecc7862946d4 6655646: dynamic languages need dynamically linked call sites
jrose
parents: 2332
diff changeset
   592
  }
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   593
  if (ik->generic_signature() != NULL) {
2332
5c7b6f4ce0a1 6814659: separable cleanups and subroutines for 6655638
jrose
parents: 1550
diff changeset
   594
    st->print(BULLET"generic signature: ");
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   595
    ik->generic_signature()->print_value_on(st);
2332
5c7b6f4ce0a1 6814659: separable cleanups and subroutines for 6655638
jrose
parents: 1550
diff changeset
   596
    st->cr();
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   597
  }
2332
5c7b6f4ce0a1 6814659: separable cleanups and subroutines for 6655638
jrose
parents: 1550
diff changeset
   598
  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
   599
  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
   600
  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
   601
  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
   602
  st->print_cr(BULLET"---- static fields (%d words):", ik->static_field_size());
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   603
  FieldPrinter print_static_field(st);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   604
  ik->do_local_static_fields(&print_static_field);
2332
5c7b6f4ce0a1 6814659: separable cleanups and subroutines for 6655638
jrose
parents: 1550
diff changeset
   605
  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
   606
  FieldPrinter print_nonstatic_field(st);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   607
  ik->do_nonstatic_fields(&print_nonstatic_field);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   608
2332
5c7b6f4ce0a1 6814659: separable cleanups and subroutines for 6655638
jrose
parents: 1550
diff changeset
   609
  st->print(BULLET"static oop maps:     ");
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   610
  if (ik->static_oop_field_size() > 0) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   611
    int first_offset = ik->offset_of_static_fields();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   612
    st->print("%d-%d", first_offset, first_offset + ik->static_oop_field_size() - 1);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   613
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   614
  st->cr();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   615
2332
5c7b6f4ce0a1 6814659: separable cleanups and subroutines for 6655638
jrose
parents: 1550
diff changeset
   616
  st->print(BULLET"non-static oop maps: ");
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   617
  OopMapBlock* map     = ik->start_of_nonstatic_oop_maps();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   618
  OopMapBlock* end_map = map + ik->nonstatic_oop_map_size();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   619
  while (map < end_map) {
591
04d2e26e6d69 6703888: Compressed Oops: use the 32-bits gap after klass in a object
kvn
parents: 360
diff changeset
   620
    st->print("%d-%d ", map->offset(), map->offset() + heapOopSize*(map->length() - 1));
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   621
    map++;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   622
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   623
  st->cr();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   624
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   625
489c9b5090e2 Initial load
duke
parents:
diff changeset
   626
489c9b5090e2 Initial load
duke
parents:
diff changeset
   627
void instanceKlassKlass::oop_print_value_on(oop obj, outputStream* st) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   628
  assert(obj->is_klass(), "must be klass");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   629
  instanceKlass* ik = instanceKlass::cast(klassOop(obj));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   630
  ik->name()->print_value_on(st);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   631
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   632
489c9b5090e2 Initial load
duke
parents:
diff changeset
   633
#endif // PRODUCT
489c9b5090e2 Initial load
duke
parents:
diff changeset
   634
489c9b5090e2 Initial load
duke
parents:
diff changeset
   635
const char* instanceKlassKlass::internal_name() const {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   636
  return "{instance class}";
489c9b5090e2 Initial load
duke
parents:
diff changeset
   637
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   638
489c9b5090e2 Initial load
duke
parents:
diff changeset
   639
// Verification
489c9b5090e2 Initial load
duke
parents:
diff changeset
   640
489c9b5090e2 Initial load
duke
parents:
diff changeset
   641
class VerifyFieldClosure: public OopClosure {
360
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   642
 protected:
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   643
  template <class T> void do_oop_work(T* p) {
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   644
    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
   645
    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
   646
    guarantee(obj->is_oop_or_null(), "should be in heap");
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   647
  }
360
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   648
 public:
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   649
  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
   650
  virtual void do_oop(narrowOop* p) { VerifyFieldClosure::do_oop_work(p); }
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   651
};
489c9b5090e2 Initial load
duke
parents:
diff changeset
   652
489c9b5090e2 Initial load
duke
parents:
diff changeset
   653
void instanceKlassKlass::oop_verify_on(oop obj, outputStream* st) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   654
  klassKlass::oop_verify_on(obj, st);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   655
  if (!obj->partially_loaded()) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   656
    Thread *thread = Thread::current();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   657
    instanceKlass* ik = instanceKlass::cast(klassOop(obj));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   658
489c9b5090e2 Initial load
duke
parents:
diff changeset
   659
#ifndef PRODUCT
489c9b5090e2 Initial load
duke
parents:
diff changeset
   660
    // Avoid redundant verifies
489c9b5090e2 Initial load
duke
parents:
diff changeset
   661
    if (ik->_verify_count == Universe::verify_count()) return;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   662
    ik->_verify_count = Universe::verify_count();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   663
#endif
489c9b5090e2 Initial load
duke
parents:
diff changeset
   664
    // 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
   665
    if (ik->is_loaded() && !ik->is_anonymous()) {
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   666
      symbolHandle h_name (thread, ik->name());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   667
      Handle h_loader (thread, ik->class_loader());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   668
      Handle h_obj(thread, obj);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   669
      SystemDictionary::verify_obj_klass_present(h_obj, h_name, h_loader);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   670
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   671
489c9b5090e2 Initial load
duke
parents:
diff changeset
   672
    // Verify static fields
489c9b5090e2 Initial load
duke
parents:
diff changeset
   673
    VerifyFieldClosure blk;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   674
    ik->iterate_static_fields(&blk);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   675
489c9b5090e2 Initial load
duke
parents:
diff changeset
   676
    // Verify vtables
489c9b5090e2 Initial load
duke
parents:
diff changeset
   677
    if (ik->is_linked()) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   678
      ResourceMark rm(thread);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   679
      // $$$ This used to be done only for m/s collections.  Doing it
489c9b5090e2 Initial load
duke
parents:
diff changeset
   680
      // always seemed a valid generalization.  (DLD -- 6/00)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   681
      ik->vtable()->verify(st);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   682
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   683
489c9b5090e2 Initial load
duke
parents:
diff changeset
   684
    // Verify oop map cache
489c9b5090e2 Initial load
duke
parents:
diff changeset
   685
    if (ik->oop_map_cache() != NULL) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   686
      ik->oop_map_cache()->verify();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   687
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   688
489c9b5090e2 Initial load
duke
parents:
diff changeset
   689
    // Verify first subklass
489c9b5090e2 Initial load
duke
parents:
diff changeset
   690
    if (ik->subklass_oop() != NULL) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   691
      guarantee(ik->subklass_oop()->is_perm(),  "should be in permspace");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   692
      guarantee(ik->subklass_oop()->is_klass(), "should be klass");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   693
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   694
489c9b5090e2 Initial load
duke
parents:
diff changeset
   695
    // Verify siblings
489c9b5090e2 Initial load
duke
parents:
diff changeset
   696
    klassOop super = ik->super();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   697
    Klass* sib = ik->next_sibling();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   698
    int sib_count = 0;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   699
    while (sib != NULL) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   700
      if (sib == ik) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   701
        fatal1("subclass cycle of length %d", sib_count);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   702
      }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   703
      if (sib_count >= 100000) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   704
        fatal1("suspiciously long subclass list %d", sib_count);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   705
      }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   706
      guarantee(sib->as_klassOop()->is_klass(), "should be klass");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   707
      guarantee(sib->as_klassOop()->is_perm(),  "should be in permspace");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   708
      guarantee(sib->super() == super, "siblings should have same superklass");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   709
      sib = sib->next_sibling();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   710
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   711
489c9b5090e2 Initial load
duke
parents:
diff changeset
   712
    // Verify implementor fields
489c9b5090e2 Initial load
duke
parents:
diff changeset
   713
    bool saw_null_impl = false;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   714
    for (int i = 0; i < instanceKlass::implementors_limit; i++) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   715
      klassOop im = ik->implementor(i);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   716
      if (im == NULL) { saw_null_impl = true; continue; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   717
      guarantee(!saw_null_impl, "non-nulls must preceded all nulls");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   718
      guarantee(ik->is_interface(), "only interfaces should have implementor set");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   719
      guarantee(i < ik->nof_implementors(), "should only have one implementor");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   720
      guarantee(im->is_perm(),  "should be in permspace");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   721
      guarantee(im->is_klass(), "should be klass");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   722
      guarantee(!Klass::cast(klassOop(im))->is_interface(), "implementors cannot be interfaces");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   723
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   724
489c9b5090e2 Initial load
duke
parents:
diff changeset
   725
    // Verify local interfaces
489c9b5090e2 Initial load
duke
parents:
diff changeset
   726
    objArrayOop local_interfaces = ik->local_interfaces();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   727
    guarantee(local_interfaces->is_perm(),          "should be in permspace");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   728
    guarantee(local_interfaces->is_objArray(),      "should be obj array");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   729
    int j;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   730
    for (j = 0; j < local_interfaces->length(); j++) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   731
      oop e = local_interfaces->obj_at(j);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   732
      guarantee(e->is_klass() && Klass::cast(klassOop(e))->is_interface(), "invalid local interface");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   733
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   734
489c9b5090e2 Initial load
duke
parents:
diff changeset
   735
    // Verify transitive interfaces
489c9b5090e2 Initial load
duke
parents:
diff changeset
   736
    objArrayOop transitive_interfaces = ik->transitive_interfaces();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   737
    guarantee(transitive_interfaces->is_perm(),          "should be in permspace");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   738
    guarantee(transitive_interfaces->is_objArray(),      "should be obj array");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   739
    for (j = 0; j < transitive_interfaces->length(); j++) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   740
      oop e = transitive_interfaces->obj_at(j);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   741
      guarantee(e->is_klass() && Klass::cast(klassOop(e))->is_interface(), "invalid transitive interface");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   742
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   743
489c9b5090e2 Initial load
duke
parents:
diff changeset
   744
    // Verify methods
489c9b5090e2 Initial load
duke
parents:
diff changeset
   745
    objArrayOop methods = ik->methods();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   746
    guarantee(methods->is_perm(),              "should be in permspace");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   747
    guarantee(methods->is_objArray(),          "should be obj array");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   748
    for (j = 0; j < methods->length(); j++) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   749
      guarantee(methods->obj_at(j)->is_method(), "non-method in methods array");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   750
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   751
    for (j = 0; j < methods->length() - 1; j++) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   752
      methodOop m1 = methodOop(methods->obj_at(j));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   753
      methodOop m2 = methodOop(methods->obj_at(j + 1));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   754
      guarantee(m1->name()->fast_compare(m2->name()) <= 0, "methods not sorted correctly");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   755
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   756
489c9b5090e2 Initial load
duke
parents:
diff changeset
   757
    // Verify method ordering
489c9b5090e2 Initial load
duke
parents:
diff changeset
   758
    typeArrayOop method_ordering = ik->method_ordering();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   759
    guarantee(method_ordering->is_perm(),              "should be in permspace");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   760
    guarantee(method_ordering->is_typeArray(),         "should be type array");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   761
    int length = method_ordering->length();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   762
    if (JvmtiExport::can_maintain_original_method_order()) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   763
      guarantee(length == methods->length(),           "invalid method ordering length");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   764
      jlong sum = 0;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   765
      for (j = 0; j < length; j++) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   766
        int original_index = method_ordering->int_at(j);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   767
        guarantee(original_index >= 0 && original_index < length, "invalid method ordering index");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   768
        sum += original_index;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   769
      }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   770
      // Verify sum of indices 0,1,...,length-1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   771
      guarantee(sum == ((jlong)length*(length-1))/2,   "invalid method ordering sum");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   772
    } else {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   773
      guarantee(length == 0,                           "invalid method ordering length");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   774
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   775
489c9b5090e2 Initial load
duke
parents:
diff changeset
   776
    // Verify JNI static field identifiers
489c9b5090e2 Initial load
duke
parents:
diff changeset
   777
    if (ik->jni_ids() != NULL) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   778
      ik->jni_ids()->verify(ik->as_klassOop());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   779
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   780
489c9b5090e2 Initial load
duke
parents:
diff changeset
   781
    // Verify other fields
489c9b5090e2 Initial load
duke
parents:
diff changeset
   782
    if (ik->array_klasses() != NULL) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   783
      guarantee(ik->array_klasses()->is_perm(),      "should be in permspace");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   784
      guarantee(ik->array_klasses()->is_klass(),     "should be klass");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   785
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   786
    guarantee(ik->fields()->is_perm(),               "should be in permspace");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   787
    guarantee(ik->fields()->is_typeArray(),          "should be type array");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   788
    guarantee(ik->constants()->is_perm(),            "should be in permspace");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   789
    guarantee(ik->constants()->is_constantPool(),    "should be constant pool");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   790
    guarantee(ik->inner_classes()->is_perm(),        "should be in permspace");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   791
    guarantee(ik->inner_classes()->is_typeArray(),   "should be type array");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   792
    if (ik->source_file_name() != NULL) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   793
      guarantee(ik->source_file_name()->is_perm(),   "should be in permspace");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   794
      guarantee(ik->source_file_name()->is_symbol(), "should be symbol");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   795
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   796
    if (ik->source_debug_extension() != NULL) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   797
      guarantee(ik->source_debug_extension()->is_perm(),   "should be in permspace");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   798
      guarantee(ik->source_debug_extension()->is_symbol(), "should be symbol");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   799
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   800
    if (ik->protection_domain() != NULL) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   801
      guarantee(ik->protection_domain()->is_oop(),  "should be oop");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   802
    }
1550
be2fc37a817f 6653858: dynamic languages need to be able to load anonymous classes
jrose
parents: 670
diff changeset
   803
    if (ik->host_klass() != NULL) {
be2fc37a817f 6653858: dynamic languages need to be able to load anonymous classes
jrose
parents: 670
diff changeset
   804
      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
   805
    }
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   806
    if (ik->signers() != NULL) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   807
      guarantee(ik->signers()->is_objArray(),       "should be obj array");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   808
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   809
    if (ik->generic_signature() != NULL) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   810
      guarantee(ik->generic_signature()->is_perm(),   "should be in permspace");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   811
      guarantee(ik->generic_signature()->is_symbol(), "should be symbol");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   812
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   813
    if (ik->class_annotations() != NULL) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   814
      guarantee(ik->class_annotations()->is_typeArray(), "should be type array");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   815
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   816
    if (ik->fields_annotations() != NULL) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   817
      guarantee(ik->fields_annotations()->is_objArray(), "should be obj array");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   818
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   819
    if (ik->methods_annotations() != NULL) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   820
      guarantee(ik->methods_annotations()->is_objArray(), "should be obj array");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   821
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   822
    if (ik->methods_parameter_annotations() != NULL) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   823
      guarantee(ik->methods_parameter_annotations()->is_objArray(), "should be obj array");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   824
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   825
    if (ik->methods_default_annotations() != NULL) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   826
      guarantee(ik->methods_default_annotations()->is_objArray(), "should be obj array");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   827
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   828
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   829
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   830
489c9b5090e2 Initial load
duke
parents:
diff changeset
   831
489c9b5090e2 Initial load
duke
parents:
diff changeset
   832
bool instanceKlassKlass::oop_partially_loaded(oop obj) const {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   833
  assert(obj->is_klass(), "object must be klass");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   834
  instanceKlass* ik = instanceKlass::cast(klassOop(obj));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   835
  assert(ik->oop_is_instance(), "object must be instanceKlass");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   836
  return ik->transitive_interfaces() == (objArrayOop) obj;   // Check whether transitive_interfaces points to self
489c9b5090e2 Initial load
duke
parents:
diff changeset
   837
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   838
489c9b5090e2 Initial load
duke
parents:
diff changeset
   839
489c9b5090e2 Initial load
duke
parents:
diff changeset
   840
// The transitive_interfaces is the last field set when loading an object.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   841
void instanceKlassKlass::oop_set_partially_loaded(oop obj) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   842
  assert(obj->is_klass(), "object must be klass");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   843
  instanceKlass* ik = instanceKlass::cast(klassOop(obj));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   844
  // Set the layout helper to a place-holder value, until fuller initialization.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   845
  // (This allows asserts in oop_is_instance to succeed.)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   846
  ik->set_layout_helper(Klass::instance_layout_helper(0, true));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   847
  assert(ik->oop_is_instance(), "object must be instanceKlass");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   848
  assert(ik->transitive_interfaces() == NULL, "just checking");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   849
  ik->set_transitive_interfaces((objArrayOop) obj);   // Temporarily set transitive_interfaces to point to self
489c9b5090e2 Initial load
duke
parents:
diff changeset
   850
}