hotspot/src/share/vm/oops/constantPoolKlass.cpp
author jrose
Thu, 23 Jun 2011 17:14:06 -0700
changeset 10008 d84de97ad847
parent 9635 f668c715d4aa
child 10565 dc90c239f4ec
permissions -rw-r--r--
7056328: JSR 292 invocation sometimes fails in adapters for types not on boot class path Reviewed-by: never
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
     1
/*
8297
f05d10c1c4b8 7014851: Remove unused parallel compaction code
stefank
parents: 8296
diff changeset
     2
 * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
489c9b5090e2 Initial load
duke
parents:
diff changeset
     4
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
489c9b5090e2 Initial load
duke
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
489c9b5090e2 Initial load
duke
parents:
diff changeset
     7
 * published by the Free Software Foundation.
489c9b5090e2 Initial load
duke
parents:
diff changeset
     8
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
489c9b5090e2 Initial load
duke
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
489c9b5090e2 Initial load
duke
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
489c9b5090e2 Initial load
duke
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
489c9b5090e2 Initial load
duke
parents:
diff changeset
    13
 * accompanied this code).
489c9b5090e2 Initial load
duke
parents:
diff changeset
    14
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
489c9b5090e2 Initial load
duke
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
489c9b5090e2 Initial load
duke
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    18
 *
5547
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 4584
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 4584
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 4584
diff changeset
    21
 * questions.
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    22
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
    23
 */
489c9b5090e2 Initial load
duke
parents:
diff changeset
    24
7397
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 7114
diff changeset
    25
#include "precompiled.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 7114
diff changeset
    26
#include "classfile/javaClasses.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 7114
diff changeset
    27
#include "gc_implementation/shared/markSweep.inline.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 7114
diff changeset
    28
#include "gc_interface/collectedHeap.inline.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 7114
diff changeset
    29
#include "memory/oopFactory.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 7114
diff changeset
    30
#include "memory/permGen.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 7114
diff changeset
    31
#include "memory/universe.inline.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 7114
diff changeset
    32
#include "oops/constantPoolKlass.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 7114
diff changeset
    33
#include "oops/constantPoolOop.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 7114
diff changeset
    34
#include "oops/oop.inline.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 7114
diff changeset
    35
#include "oops/oop.inline2.hpp"
8076
96d498ec7ae1 6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents: 7436
diff changeset
    36
#include "oops/symbol.hpp"
7397
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 7114
diff changeset
    37
#include "runtime/handles.inline.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 7114
diff changeset
    38
#ifdef TARGET_OS_FAMILY_linux
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 7114
diff changeset
    39
# include "thread_linux.inline.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 7114
diff changeset
    40
#endif
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 7114
diff changeset
    41
#ifdef TARGET_OS_FAMILY_solaris
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 7114
diff changeset
    42
# include "thread_solaris.inline.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 7114
diff changeset
    43
#endif
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 7114
diff changeset
    44
#ifdef TARGET_OS_FAMILY_windows
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 7114
diff changeset
    45
# include "thread_windows.inline.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 7114
diff changeset
    46
#endif
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 7114
diff changeset
    47
#ifndef SERIALGC
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 7114
diff changeset
    48
#include "gc_implementation/parNew/parOopClosures.inline.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 7114
diff changeset
    49
#include "gc_implementation/parallelScavenge/psPromotionManager.inline.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 7114
diff changeset
    50
#include "gc_implementation/parallelScavenge/psScavenge.inline.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 7114
diff changeset
    51
#include "memory/cardTableRS.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 7114
diff changeset
    52
#include "oops/oop.pcgc.inline.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 7114
diff changeset
    53
#endif
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    54
1894
5c343868d071 6692899: CMS: many vm.parallel_class_loading tests fail with assert "missing Printezis mark"
jmasa
parents: 1550
diff changeset
    55
constantPoolOop constantPoolKlass::allocate(int length, bool is_conc_safe, TRAPS) {
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    56
  int size = constantPoolOopDesc::object_size(length);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    57
  KlassHandle klass (THREAD, as_klassOop());
8299
70d329dddda3 7018302: newly added assert related to size of constantPoolOop causes secondary assertions or crashes
ysr
parents: 8297
diff changeset
    58
  assert(klass()->is_oop(), "Can't be null, else handlizing of c below won't work");
70d329dddda3 7018302: newly added assert related to size of constantPoolOop causes secondary assertions or crashes
ysr
parents: 8297
diff changeset
    59
  constantPoolHandle pool;
70d329dddda3 7018302: newly added assert related to size of constantPoolOop causes secondary assertions or crashes
ysr
parents: 8297
diff changeset
    60
  {
70d329dddda3 7018302: newly added assert related to size of constantPoolOop causes secondary assertions or crashes
ysr
parents: 8297
diff changeset
    61
    constantPoolOop c =
70d329dddda3 7018302: newly added assert related to size of constantPoolOop causes secondary assertions or crashes
ysr
parents: 8297
diff changeset
    62
      (constantPoolOop)CollectedHeap::permanent_obj_allocate(klass, size, CHECK_NULL);
70d329dddda3 7018302: newly added assert related to size of constantPoolOop causes secondary assertions or crashes
ysr
parents: 8297
diff changeset
    63
    assert(c->klass_or_null() != NULL, "Handlizing below won't work");
70d329dddda3 7018302: newly added assert related to size of constantPoolOop causes secondary assertions or crashes
ysr
parents: 8297
diff changeset
    64
    pool = constantPoolHandle(THREAD, c);
70d329dddda3 7018302: newly added assert related to size of constantPoolOop causes secondary assertions or crashes
ysr
parents: 8297
diff changeset
    65
  }
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    66
8299
70d329dddda3 7018302: newly added assert related to size of constantPoolOop causes secondary assertions or crashes
ysr
parents: 8297
diff changeset
    67
  pool->set_length(length);
70d329dddda3 7018302: newly added assert related to size of constantPoolOop causes secondary assertions or crashes
ysr
parents: 8297
diff changeset
    68
  pool->set_tags(NULL);
70d329dddda3 7018302: newly added assert related to size of constantPoolOop causes secondary assertions or crashes
ysr
parents: 8297
diff changeset
    69
  pool->set_cache(NULL);
70d329dddda3 7018302: newly added assert related to size of constantPoolOop causes secondary assertions or crashes
ysr
parents: 8297
diff changeset
    70
  pool->set_operands(NULL);
70d329dddda3 7018302: newly added assert related to size of constantPoolOop causes secondary assertions or crashes
ysr
parents: 8297
diff changeset
    71
  pool->set_pool_holder(NULL);
70d329dddda3 7018302: newly added assert related to size of constantPoolOop causes secondary assertions or crashes
ysr
parents: 8297
diff changeset
    72
  pool->set_flags(0);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    73
  // only set to non-zero if constant pool is merged by RedefineClasses
8299
70d329dddda3 7018302: newly added assert related to size of constantPoolOop causes secondary assertions or crashes
ysr
parents: 8297
diff changeset
    74
  pool->set_orig_length(0);
1894
5c343868d071 6692899: CMS: many vm.parallel_class_loading tests fail with assert "missing Printezis mark"
jmasa
parents: 1550
diff changeset
    75
  // if constant pool may change during RedefineClasses, it is created
5c343868d071 6692899: CMS: many vm.parallel_class_loading tests fail with assert "missing Printezis mark"
jmasa
parents: 1550
diff changeset
    76
  // unsafe for GC concurrent processing.
8299
70d329dddda3 7018302: newly added assert related to size of constantPoolOop causes secondary assertions or crashes
ysr
parents: 8297
diff changeset
    77
  pool->set_is_conc_safe(is_conc_safe);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    78
  // all fields are initialized; needed for GC
489c9b5090e2 Initial load
duke
parents:
diff changeset
    79
8296
b1c2163e4e59 6912621: iCMS: Error: assert(_markBitMap.isMarked(addr + 1),"Missing Printezis bit?")
ysr
parents: 8076
diff changeset
    80
  // Note: because we may be in this "conc_unsafe" state when allocating
b1c2163e4e59 6912621: iCMS: Error: assert(_markBitMap.isMarked(addr + 1),"Missing Printezis bit?")
ysr
parents: 8076
diff changeset
    81
  // t_oop below, which may in turn cause a GC, it is imperative that our
b1c2163e4e59 6912621: iCMS: Error: assert(_markBitMap.isMarked(addr + 1),"Missing Printezis bit?")
ysr
parents: 8076
diff changeset
    82
  // size be correct, consistent and henceforth stable, at this stage.
8299
70d329dddda3 7018302: newly added assert related to size of constantPoolOop causes secondary assertions or crashes
ysr
parents: 8297
diff changeset
    83
  assert(pool->is_oop() && pool->is_parsable(), "Else size() below is unreliable");
70d329dddda3 7018302: newly added assert related to size of constantPoolOop causes secondary assertions or crashes
ysr
parents: 8297
diff changeset
    84
  assert(size == pool->size(), "size() is wrong");
8296
b1c2163e4e59 6912621: iCMS: Error: assert(_markBitMap.isMarked(addr + 1),"Missing Printezis bit?")
ysr
parents: 8076
diff changeset
    85
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    86
  // initialize tag array
489c9b5090e2 Initial load
duke
parents:
diff changeset
    87
  typeArrayOop t_oop = oopFactory::new_permanent_byteArray(length, CHECK_NULL);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    88
  typeArrayHandle tags (THREAD, t_oop);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    89
  for (int index = 0; index < length; index++) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    90
    tags()->byte_at_put(index, JVM_CONSTANT_Invalid);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    91
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    92
  pool->set_tags(tags());
489c9b5090e2 Initial load
duke
parents:
diff changeset
    93
8296
b1c2163e4e59 6912621: iCMS: Error: assert(_markBitMap.isMarked(addr + 1),"Missing Printezis bit?")
ysr
parents: 8076
diff changeset
    94
  // Check that our size was stable at its old value.
8299
70d329dddda3 7018302: newly added assert related to size of constantPoolOop causes secondary assertions or crashes
ysr
parents: 8297
diff changeset
    95
  assert(size == pool->size(), "size() changed");
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    96
  return pool();
489c9b5090e2 Initial load
duke
parents:
diff changeset
    97
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
    98
489c9b5090e2 Initial load
duke
parents:
diff changeset
    99
klassOop constantPoolKlass::create_klass(TRAPS) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   100
  constantPoolKlass o;
360
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   101
  KlassHandle h_this_klass(THREAD, Universe::klassKlassObj());
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   102
  KlassHandle k = base_create_klass(h_this_klass, header_size(), o.vtbl_value(), CHECK_NULL);
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   103
  // Make sure size calculation is right
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   104
  assert(k()->size() == align_object_size(header_size()), "wrong size for object");
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   105
  java_lang_Class::create_mirror(k, CHECK_NULL); // Allocate mirror
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   106
  return k();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   107
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   108
489c9b5090e2 Initial load
duke
parents:
diff changeset
   109
int constantPoolKlass::oop_size(oop obj) const {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   110
  assert(obj->is_constantPool(), "must be constantPool");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   111
  return constantPoolOop(obj)->object_size();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   112
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   113
489c9b5090e2 Initial load
duke
parents:
diff changeset
   114
489c9b5090e2 Initial load
duke
parents:
diff changeset
   115
void constantPoolKlass::oop_follow_contents(oop obj) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   116
  assert (obj->is_constantPool(), "obj must be constant pool");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   117
  constantPoolOop cp = (constantPoolOop) obj;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   118
  // Performance tweak: We skip iterating over the klass pointer since we
489c9b5090e2 Initial load
duke
parents:
diff changeset
   119
  // know that Universe::constantPoolKlassObj never moves.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   120
489c9b5090e2 Initial load
duke
parents:
diff changeset
   121
  // If the tags array is null we are in the middle of allocating this constant pool
489c9b5090e2 Initial load
duke
parents:
diff changeset
   122
  if (cp->tags() != NULL) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   123
    // gc of constant pool contents
489c9b5090e2 Initial load
duke
parents:
diff changeset
   124
    oop* base = (oop*)cp->base();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   125
    for (int i = 0; i < cp->length(); i++) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   126
      if (cp->is_pointer_entry(i)) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   127
        if (*base != NULL) MarkSweep::mark_and_push(base);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   128
      }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   129
      base++;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   130
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   131
    // gc of constant pool instance variables
489c9b5090e2 Initial load
duke
parents:
diff changeset
   132
    MarkSweep::mark_and_push(cp->tags_addr());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   133
    MarkSweep::mark_and_push(cp->cache_addr());
7114
65d21c4c6337 6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents: 6255
diff changeset
   134
    MarkSweep::mark_and_push(cp->operands_addr());
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   135
    MarkSweep::mark_and_push(cp->pool_holder_addr());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   136
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   137
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   138
489c9b5090e2 Initial load
duke
parents:
diff changeset
   139
#ifndef SERIALGC
489c9b5090e2 Initial load
duke
parents:
diff changeset
   140
void constantPoolKlass::oop_follow_contents(ParCompactionManager* cm,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   141
                                            oop obj) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   142
  assert (obj->is_constantPool(), "obj must be constant pool");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   143
  constantPoolOop cp = (constantPoolOop) obj;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   144
  // Performance tweak: We skip iterating over the klass pointer since we
489c9b5090e2 Initial load
duke
parents:
diff changeset
   145
  // know that Universe::constantPoolKlassObj never moves.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   146
489c9b5090e2 Initial load
duke
parents:
diff changeset
   147
  // If the tags array is null we are in the middle of allocating this constant
489c9b5090e2 Initial load
duke
parents:
diff changeset
   148
  // pool.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   149
  if (cp->tags() != NULL) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   150
    // gc of constant pool contents
489c9b5090e2 Initial load
duke
parents:
diff changeset
   151
    oop* base = (oop*)cp->base();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   152
    for (int i = 0; i < cp->length(); i++) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   153
      if (cp->is_pointer_entry(i)) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   154
        if (*base != NULL) PSParallelCompact::mark_and_push(cm, base);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   155
      }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   156
      base++;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   157
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   158
    // gc of constant pool instance variables
489c9b5090e2 Initial load
duke
parents:
diff changeset
   159
    PSParallelCompact::mark_and_push(cm, cp->tags_addr());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   160
    PSParallelCompact::mark_and_push(cm, cp->cache_addr());
7114
65d21c4c6337 6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents: 6255
diff changeset
   161
    PSParallelCompact::mark_and_push(cm, cp->operands_addr());
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   162
    PSParallelCompact::mark_and_push(cm, cp->pool_holder_addr());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   163
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   164
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   165
#endif // SERIALGC
489c9b5090e2 Initial load
duke
parents:
diff changeset
   166
489c9b5090e2 Initial load
duke
parents:
diff changeset
   167
489c9b5090e2 Initial load
duke
parents:
diff changeset
   168
int constantPoolKlass::oop_adjust_pointers(oop obj) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   169
  assert (obj->is_constantPool(), "obj must be constant pool");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   170
  constantPoolOop cp = (constantPoolOop) obj;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   171
  // Get size before changing pointers.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   172
  // Don't call size() or oop_size() since that is a virtual call.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   173
  int size = cp->object_size();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   174
  // Performance tweak: We skip iterating over the klass pointer since we
489c9b5090e2 Initial load
duke
parents:
diff changeset
   175
  // know that Universe::constantPoolKlassObj never moves.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   176
489c9b5090e2 Initial load
duke
parents:
diff changeset
   177
  // If the tags array is null we are in the middle of allocating this constant
489c9b5090e2 Initial load
duke
parents:
diff changeset
   178
  // pool.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   179
  if (cp->tags() != NULL) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   180
    oop* base = (oop*)cp->base();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   181
    for (int i = 0; i< cp->length();  i++) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   182
      if (cp->is_pointer_entry(i)) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   183
        MarkSweep::adjust_pointer(base);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   184
      }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   185
      base++;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   186
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   187
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   188
  MarkSweep::adjust_pointer(cp->tags_addr());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   189
  MarkSweep::adjust_pointer(cp->cache_addr());
7114
65d21c4c6337 6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents: 6255
diff changeset
   190
  MarkSweep::adjust_pointer(cp->operands_addr());
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   191
  MarkSweep::adjust_pointer(cp->pool_holder_addr());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   192
  return size;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   193
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   194
489c9b5090e2 Initial load
duke
parents:
diff changeset
   195
489c9b5090e2 Initial load
duke
parents:
diff changeset
   196
int constantPoolKlass::oop_oop_iterate(oop obj, OopClosure* blk) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   197
  assert (obj->is_constantPool(), "obj must be constant pool");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   198
  // Performance tweak: We skip iterating over the klass pointer since we
489c9b5090e2 Initial load
duke
parents:
diff changeset
   199
  // know that Universe::constantPoolKlassObj never moves.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   200
  constantPoolOop cp = (constantPoolOop) obj;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   201
  // Get size before changing pointers.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   202
  // Don't call size() or oop_size() since that is a virtual call.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   203
  int size = cp->object_size();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   204
489c9b5090e2 Initial load
duke
parents:
diff changeset
   205
  // If the tags array is null we are in the middle of allocating this constant
489c9b5090e2 Initial load
duke
parents:
diff changeset
   206
  // pool.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   207
  if (cp->tags() != NULL) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   208
    oop* base = (oop*)cp->base();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   209
    for (int i = 0; i < cp->length(); i++) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   210
      if (cp->is_pointer_entry(i)) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   211
        blk->do_oop(base);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   212
      }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   213
      base++;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   214
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   215
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   216
  blk->do_oop(cp->tags_addr());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   217
  blk->do_oop(cp->cache_addr());
7114
65d21c4c6337 6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents: 6255
diff changeset
   218
  blk->do_oop(cp->operands_addr());
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   219
  blk->do_oop(cp->pool_holder_addr());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   220
  return size;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   221
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   222
489c9b5090e2 Initial load
duke
parents:
diff changeset
   223
489c9b5090e2 Initial load
duke
parents:
diff changeset
   224
int constantPoolKlass::oop_oop_iterate_m(oop obj, OopClosure* blk, MemRegion mr) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   225
  assert (obj->is_constantPool(), "obj must be constant pool");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   226
  // Performance tweak: We skip iterating over the klass pointer since we
489c9b5090e2 Initial load
duke
parents:
diff changeset
   227
  // know that Universe::constantPoolKlassObj never moves.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   228
  constantPoolOop cp = (constantPoolOop) obj;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   229
  // Get size before changing pointers.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   230
  // Don't call size() or oop_size() since that is a virtual call.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   231
  int size = cp->object_size();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   232
489c9b5090e2 Initial load
duke
parents:
diff changeset
   233
  // If the tags array is null we are in the middle of allocating this constant
489c9b5090e2 Initial load
duke
parents:
diff changeset
   234
  // pool.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   235
  if (cp->tags() != NULL) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   236
    oop* base = (oop*)cp->base();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   237
    for (int i = 0; i < cp->length(); i++) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   238
      if (mr.contains(base)) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   239
        if (cp->is_pointer_entry(i)) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   240
          blk->do_oop(base);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   241
        }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   242
      }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   243
      base++;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   244
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   245
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   246
  oop* addr;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   247
  addr = cp->tags_addr();
8922
dc678ff8de0c 7030435: Some oop_oop_iterate_m() methods iterate outside of specified memory bounds
ysr
parents: 8728
diff changeset
   248
  if (mr.contains(addr)) blk->do_oop(addr);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   249
  addr = cp->cache_addr();
8922
dc678ff8de0c 7030435: Some oop_oop_iterate_m() methods iterate outside of specified memory bounds
ysr
parents: 8728
diff changeset
   250
  if (mr.contains(addr)) blk->do_oop(addr);
7114
65d21c4c6337 6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents: 6255
diff changeset
   251
  addr = cp->operands_addr();
8922
dc678ff8de0c 7030435: Some oop_oop_iterate_m() methods iterate outside of specified memory bounds
ysr
parents: 8728
diff changeset
   252
  if (mr.contains(addr)) blk->do_oop(addr);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   253
  addr = cp->pool_holder_addr();
8922
dc678ff8de0c 7030435: Some oop_oop_iterate_m() methods iterate outside of specified memory bounds
ysr
parents: 8728
diff changeset
   254
  if (mr.contains(addr)) blk->do_oop(addr);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   255
  return size;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   256
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   257
1894
5c343868d071 6692899: CMS: many vm.parallel_class_loading tests fail with assert "missing Printezis mark"
jmasa
parents: 1550
diff changeset
   258
bool constantPoolKlass::oop_is_conc_safe(oop obj) const {
5c343868d071 6692899: CMS: many vm.parallel_class_loading tests fail with assert "missing Printezis mark"
jmasa
parents: 1550
diff changeset
   259
  assert(obj->is_constantPool(), "must be constantPool");
5c343868d071 6692899: CMS: many vm.parallel_class_loading tests fail with assert "missing Printezis mark"
jmasa
parents: 1550
diff changeset
   260
  return constantPoolOop(obj)->is_conc_safe();
5c343868d071 6692899: CMS: many vm.parallel_class_loading tests fail with assert "missing Printezis mark"
jmasa
parents: 1550
diff changeset
   261
}
5c343868d071 6692899: CMS: many vm.parallel_class_loading tests fail with assert "missing Printezis mark"
jmasa
parents: 1550
diff changeset
   262
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   263
#ifndef SERIALGC
489c9b5090e2 Initial load
duke
parents:
diff changeset
   264
int constantPoolKlass::oop_update_pointers(ParCompactionManager* cm, oop obj) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   265
  assert (obj->is_constantPool(), "obj must be constant pool");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   266
  constantPoolOop cp = (constantPoolOop) obj;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   267
489c9b5090e2 Initial load
duke
parents:
diff changeset
   268
  // If the tags array is null we are in the middle of allocating this constant
489c9b5090e2 Initial load
duke
parents:
diff changeset
   269
  // pool.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   270
  if (cp->tags() != NULL) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   271
    oop* base = (oop*)cp->base();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   272
    for (int i = 0; i < cp->length(); ++i, ++base) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   273
      if (cp->is_pointer_entry(i)) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   274
        PSParallelCompact::adjust_pointer(base);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   275
      }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   276
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   277
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   278
  PSParallelCompact::adjust_pointer(cp->tags_addr());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   279
  PSParallelCompact::adjust_pointer(cp->cache_addr());
7114
65d21c4c6337 6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents: 6255
diff changeset
   280
  PSParallelCompact::adjust_pointer(cp->operands_addr());
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   281
  PSParallelCompact::adjust_pointer(cp->pool_holder_addr());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   282
  return cp->object_size();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   283
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   284
489c9b5090e2 Initial load
duke
parents:
diff changeset
   285
void constantPoolKlass::oop_push_contents(PSPromotionManager* pm, oop obj) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   286
  assert(obj->is_constantPool(), "should be constant pool");
1550
be2fc37a817f 6653858: dynamic languages need to be able to load anonymous classes
jrose
parents: 670
diff changeset
   287
  constantPoolOop cp = (constantPoolOop) obj;
9635
f668c715d4aa 7043040: JSR292: JRuby bench/shootout/binarytrees.ruby-2.ruby SEGV: constantPoolKlass::oop_follow_contents
never
parents: 9124
diff changeset
   288
  if (cp->tags() != NULL) {
8728
3f1bcd33068e 6962931: move interned strings out of the perm gen
jcoomes
parents: 8299
diff changeset
   289
    for (int i = 1; i < cp->length(); ++i) {
9635
f668c715d4aa 7043040: JSR292: JRuby bench/shootout/binarytrees.ruby-2.ruby SEGV: constantPoolKlass::oop_follow_contents
never
parents: 9124
diff changeset
   290
      if (cp->is_pointer_entry(i)) {
8728
3f1bcd33068e 6962931: move interned strings out of the perm gen
jcoomes
parents: 8299
diff changeset
   291
        oop* base = cp->obj_at_addr_raw(i);
1550
be2fc37a817f 6653858: dynamic languages need to be able to load anonymous classes
jrose
parents: 670
diff changeset
   292
        if (PSScavenge::should_scavenge(base)) {
be2fc37a817f 6653858: dynamic languages need to be able to load anonymous classes
jrose
parents: 670
diff changeset
   293
          pm->claim_or_forward_depth(base);
be2fc37a817f 6653858: dynamic languages need to be able to load anonymous classes
jrose
parents: 670
diff changeset
   294
        }
be2fc37a817f 6653858: dynamic languages need to be able to load anonymous classes
jrose
parents: 670
diff changeset
   295
      }
be2fc37a817f 6653858: dynamic languages need to be able to load anonymous classes
jrose
parents: 670
diff changeset
   296
    }
be2fc37a817f 6653858: dynamic languages need to be able to load anonymous classes
jrose
parents: 670
diff changeset
   297
  }
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   298
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   299
#endif // SERIALGC
489c9b5090e2 Initial load
duke
parents:
diff changeset
   300
489c9b5090e2 Initial load
duke
parents:
diff changeset
   301
// Printing
489c9b5090e2 Initial load
duke
parents:
diff changeset
   302
489c9b5090e2 Initial load
duke
parents:
diff changeset
   303
void constantPoolKlass::oop_print_on(oop obj, outputStream* st) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   304
  EXCEPTION_MARK;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   305
  oop anObj;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   306
  assert(obj->is_constantPool(), "must be constantPool");
360
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   307
  Klass::oop_print_on(obj, st);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   308
  constantPoolOop cp = constantPoolOop(obj);
1550
be2fc37a817f 6653858: dynamic languages need to be able to load anonymous classes
jrose
parents: 670
diff changeset
   309
  if (cp->flags() != 0) {
5696
93e15b419ad4 6957004: MethodComparator uses the wrong CP index accessor
jrose
parents: 4584
diff changeset
   310
    st->print(" - flags: 0x%x", cp->flags());
1550
be2fc37a817f 6653858: dynamic languages need to be able to load anonymous classes
jrose
parents: 670
diff changeset
   311
    if (cp->has_pseudo_string()) st->print(" has_pseudo_string");
2570
ecc7862946d4 6655646: dynamic languages need dynamically linked call sites
jrose
parents: 2105
diff changeset
   312
    if (cp->has_invokedynamic()) st->print(" has_invokedynamic");
10008
d84de97ad847 7056328: JSR 292 invocation sometimes fails in adapters for types not on boot class path
jrose
parents: 9635
diff changeset
   313
    if (cp->has_preresolution()) st->print(" has_preresolution");
1550
be2fc37a817f 6653858: dynamic languages need to be able to load anonymous classes
jrose
parents: 670
diff changeset
   314
    st->cr();
be2fc37a817f 6653858: dynamic languages need to be able to load anonymous classes
jrose
parents: 670
diff changeset
   315
  }
10008
d84de97ad847 7056328: JSR 292 invocation sometimes fails in adapters for types not on boot class path
jrose
parents: 9635
diff changeset
   316
  if (cp->pool_holder() != NULL) {
d84de97ad847 7056328: JSR 292 invocation sometimes fails in adapters for types not on boot class path
jrose
parents: 9635
diff changeset
   317
    bool extra = (instanceKlass::cast(cp->pool_holder())->constants() != cp);
d84de97ad847 7056328: JSR 292 invocation sometimes fails in adapters for types not on boot class path
jrose
parents: 9635
diff changeset
   318
    st->print_cr(" - holder: " INTPTR_FORMAT "%s", cp->pool_holder(), (extra? " (extra)" : ""));
d84de97ad847 7056328: JSR 292 invocation sometimes fails in adapters for types not on boot class path
jrose
parents: 9635
diff changeset
   319
  }
5696
93e15b419ad4 6957004: MethodComparator uses the wrong CP index accessor
jrose
parents: 4584
diff changeset
   320
  st->print_cr(" - cache: " INTPTR_FORMAT, cp->cache());
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   321
  for (int index = 1; index < cp->length(); index++) {      // Index 0 is unused
489c9b5090e2 Initial load
duke
parents:
diff changeset
   322
    st->print(" - %3d : ", index);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   323
    cp->tag_at(index).print_on(st);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   324
    st->print(" : ");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   325
    switch (cp->tag_at(index).value()) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   326
      case JVM_CONSTANT_Class :
489c9b5090e2 Initial load
duke
parents:
diff changeset
   327
        { anObj = cp->klass_at(index, CATCH);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   328
          anObj->print_value_on(st);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   329
          st->print(" {0x%lx}", (address)anObj);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   330
        }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   331
        break;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   332
      case JVM_CONSTANT_Fieldref :
489c9b5090e2 Initial load
duke
parents:
diff changeset
   333
      case JVM_CONSTANT_Methodref :
489c9b5090e2 Initial load
duke
parents:
diff changeset
   334
      case JVM_CONSTANT_InterfaceMethodref :
5696
93e15b419ad4 6957004: MethodComparator uses the wrong CP index accessor
jrose
parents: 4584
diff changeset
   335
        st->print("klass_index=%d", cp->uncached_klass_ref_index_at(index));
93e15b419ad4 6957004: MethodComparator uses the wrong CP index accessor
jrose
parents: 4584
diff changeset
   336
        st->print(" name_and_type_index=%d", cp->uncached_name_and_type_ref_index_at(index));
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   337
        break;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   338
      case JVM_CONSTANT_UnresolvedString :
489c9b5090e2 Initial load
duke
parents:
diff changeset
   339
      case JVM_CONSTANT_String :
1550
be2fc37a817f 6653858: dynamic languages need to be able to load anonymous classes
jrose
parents: 670
diff changeset
   340
        if (cp->is_pseudo_string_at(index)) {
be2fc37a817f 6653858: dynamic languages need to be able to load anonymous classes
jrose
parents: 670
diff changeset
   341
          anObj = cp->pseudo_string_at(index);
be2fc37a817f 6653858: dynamic languages need to be able to load anonymous classes
jrose
parents: 670
diff changeset
   342
        } else {
be2fc37a817f 6653858: dynamic languages need to be able to load anonymous classes
jrose
parents: 670
diff changeset
   343
          anObj = cp->string_at(index, CATCH);
be2fc37a817f 6653858: dynamic languages need to be able to load anonymous classes
jrose
parents: 670
diff changeset
   344
        }
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   345
        anObj->print_value_on(st);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   346
        st->print(" {0x%lx}", (address)anObj);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   347
        break;
9635
f668c715d4aa 7043040: JSR292: JRuby bench/shootout/binarytrees.ruby-2.ruby SEGV: constantPoolKlass::oop_follow_contents
never
parents: 9124
diff changeset
   348
      case JVM_CONSTANT_Object :
f668c715d4aa 7043040: JSR292: JRuby bench/shootout/binarytrees.ruby-2.ruby SEGV: constantPoolKlass::oop_follow_contents
never
parents: 9124
diff changeset
   349
        anObj = cp->object_at(index);
f668c715d4aa 7043040: JSR292: JRuby bench/shootout/binarytrees.ruby-2.ruby SEGV: constantPoolKlass::oop_follow_contents
never
parents: 9124
diff changeset
   350
        anObj->print_value_on(st);
f668c715d4aa 7043040: JSR292: JRuby bench/shootout/binarytrees.ruby-2.ruby SEGV: constantPoolKlass::oop_follow_contents
never
parents: 9124
diff changeset
   351
        st->print(" {0x%lx}", (address)anObj);
f668c715d4aa 7043040: JSR292: JRuby bench/shootout/binarytrees.ruby-2.ruby SEGV: constantPoolKlass::oop_follow_contents
never
parents: 9124
diff changeset
   352
        break;
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   353
      case JVM_CONSTANT_Integer :
489c9b5090e2 Initial load
duke
parents:
diff changeset
   354
        st->print("%d", cp->int_at(index));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   355
        break;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   356
      case JVM_CONSTANT_Float :
489c9b5090e2 Initial load
duke
parents:
diff changeset
   357
        st->print("%f", cp->float_at(index));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   358
        break;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   359
      case JVM_CONSTANT_Long :
489c9b5090e2 Initial load
duke
parents:
diff changeset
   360
        st->print_jlong(cp->long_at(index));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   361
        index++;   // Skip entry following eigth-byte constant
489c9b5090e2 Initial load
duke
parents:
diff changeset
   362
        break;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   363
      case JVM_CONSTANT_Double :
489c9b5090e2 Initial load
duke
parents:
diff changeset
   364
        st->print("%lf", cp->double_at(index));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   365
        index++;   // Skip entry following eigth-byte constant
489c9b5090e2 Initial load
duke
parents:
diff changeset
   366
        break;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   367
      case JVM_CONSTANT_NameAndType :
489c9b5090e2 Initial load
duke
parents:
diff changeset
   368
        st->print("name_index=%d", cp->name_ref_index_at(index));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   369
        st->print(" signature_index=%d", cp->signature_ref_index_at(index));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   370
        break;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   371
      case JVM_CONSTANT_Utf8 :
489c9b5090e2 Initial load
duke
parents:
diff changeset
   372
        cp->symbol_at(index)->print_value_on(st);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   373
        break;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   374
      case JVM_CONSTANT_UnresolvedClass :               // fall-through
489c9b5090e2 Initial load
duke
parents:
diff changeset
   375
      case JVM_CONSTANT_UnresolvedClassInError: {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   376
        // unresolved_klass_at requires lock or safe world.
8076
96d498ec7ae1 6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents: 7436
diff changeset
   377
        CPSlot entry = cp->slot_at(index);
96d498ec7ae1 6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents: 7436
diff changeset
   378
        if (entry.is_oop()) {
96d498ec7ae1 6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents: 7436
diff changeset
   379
          entry.get_oop()->print_value_on(st);
96d498ec7ae1 6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents: 7436
diff changeset
   380
        } else {
96d498ec7ae1 6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents: 7436
diff changeset
   381
          entry.get_symbol()->print_value_on(st);
96d498ec7ae1 6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents: 7436
diff changeset
   382
        }
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   383
        }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   384
        break;
5882
6b2aecc4f7d8 6939203: JSR 292 needs method handle constants
jrose
parents: 5702
diff changeset
   385
      case JVM_CONSTANT_MethodHandle :
6b2aecc4f7d8 6939203: JSR 292 needs method handle constants
jrose
parents: 5702
diff changeset
   386
        st->print("ref_kind=%d", cp->method_handle_ref_kind_at(index));
6b2aecc4f7d8 6939203: JSR 292 needs method handle constants
jrose
parents: 5702
diff changeset
   387
        st->print(" ref_index=%d", cp->method_handle_index_at(index));
6b2aecc4f7d8 6939203: JSR 292 needs method handle constants
jrose
parents: 5702
diff changeset
   388
        break;
6b2aecc4f7d8 6939203: JSR 292 needs method handle constants
jrose
parents: 5702
diff changeset
   389
      case JVM_CONSTANT_MethodType :
6b2aecc4f7d8 6939203: JSR 292 needs method handle constants
jrose
parents: 5702
diff changeset
   390
        st->print("signature_index=%d", cp->method_type_index_at(index));
6b2aecc4f7d8 6939203: JSR 292 needs method handle constants
jrose
parents: 5702
diff changeset
   391
        break;
6062
bab93afe9df7 6964498: JSR 292 invokedynamic sites need local bootstrap methods
jrose
parents: 5882
diff changeset
   392
      case JVM_CONSTANT_InvokeDynamic :
7114
65d21c4c6337 6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents: 6255
diff changeset
   393
        {
65d21c4c6337 6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents: 6255
diff changeset
   394
          st->print("bootstrap_method_index=%d", cp->invoke_dynamic_bootstrap_method_ref_index_at(index));
65d21c4c6337 6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents: 6255
diff changeset
   395
          st->print(" name_and_type_index=%d", cp->invoke_dynamic_name_and_type_ref_index_at(index));
65d21c4c6337 6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents: 6255
diff changeset
   396
          int argc = cp->invoke_dynamic_argument_count_at(index);
65d21c4c6337 6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents: 6255
diff changeset
   397
          if (argc > 0) {
65d21c4c6337 6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents: 6255
diff changeset
   398
            for (int arg_i = 0; arg_i < argc; arg_i++) {
65d21c4c6337 6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents: 6255
diff changeset
   399
              int arg = cp->invoke_dynamic_argument_index_at(index, arg_i);
65d21c4c6337 6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents: 6255
diff changeset
   400
              st->print((arg_i == 0 ? " arguments={%d" : ", %d"), arg);
65d21c4c6337 6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents: 6255
diff changeset
   401
            }
65d21c4c6337 6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents: 6255
diff changeset
   402
            st->print("}");
65d21c4c6337 6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents: 6255
diff changeset
   403
          }
65d21c4c6337 6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents: 6255
diff changeset
   404
        }
6062
bab93afe9df7 6964498: JSR 292 invokedynamic sites need local bootstrap methods
jrose
parents: 5882
diff changeset
   405
        break;
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   406
      default:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   407
        ShouldNotReachHere();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   408
        break;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   409
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   410
    st->cr();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   411
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   412
  st->cr();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   413
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   414
4584
e2a449e8cc6f 6912062: disassembler plugin needs to produce symbolic information in product mode
jrose
parents: 2570
diff changeset
   415
void constantPoolKlass::oop_print_value_on(oop obj, outputStream* st) {
e2a449e8cc6f 6912062: disassembler plugin needs to produce symbolic information in product mode
jrose
parents: 2570
diff changeset
   416
  assert(obj->is_constantPool(), "must be constantPool");
e2a449e8cc6f 6912062: disassembler plugin needs to produce symbolic information in product mode
jrose
parents: 2570
diff changeset
   417
  constantPoolOop cp = constantPoolOop(obj);
e2a449e8cc6f 6912062: disassembler plugin needs to produce symbolic information in product mode
jrose
parents: 2570
diff changeset
   418
  st->print("constant pool [%d]", cp->length());
e2a449e8cc6f 6912062: disassembler plugin needs to produce symbolic information in product mode
jrose
parents: 2570
diff changeset
   419
  if (cp->has_pseudo_string()) st->print("/pseudo_string");
e2a449e8cc6f 6912062: disassembler plugin needs to produce symbolic information in product mode
jrose
parents: 2570
diff changeset
   420
  if (cp->has_invokedynamic()) st->print("/invokedynamic");
10008
d84de97ad847 7056328: JSR 292 invocation sometimes fails in adapters for types not on boot class path
jrose
parents: 9635
diff changeset
   421
  if (cp->has_preresolution()) st->print("/preresolution");
7114
65d21c4c6337 6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents: 6255
diff changeset
   422
  if (cp->operands() != NULL)  st->print("/operands[%d]", cp->operands()->length());
4584
e2a449e8cc6f 6912062: disassembler plugin needs to produce symbolic information in product mode
jrose
parents: 2570
diff changeset
   423
  cp->print_address_on(st);
e2a449e8cc6f 6912062: disassembler plugin needs to produce symbolic information in product mode
jrose
parents: 2570
diff changeset
   424
  st->print(" for ");
e2a449e8cc6f 6912062: disassembler plugin needs to produce symbolic information in product mode
jrose
parents: 2570
diff changeset
   425
  cp->pool_holder()->print_value_on(st);
10008
d84de97ad847 7056328: JSR 292 invocation sometimes fails in adapters for types not on boot class path
jrose
parents: 9635
diff changeset
   426
  if (cp->pool_holder() != NULL) {
d84de97ad847 7056328: JSR 292 invocation sometimes fails in adapters for types not on boot class path
jrose
parents: 9635
diff changeset
   427
    bool extra = (instanceKlass::cast(cp->pool_holder())->constants() != cp);
d84de97ad847 7056328: JSR 292 invocation sometimes fails in adapters for types not on boot class path
jrose
parents: 9635
diff changeset
   428
    if (extra)  st->print(" (extra)");
d84de97ad847 7056328: JSR 292 invocation sometimes fails in adapters for types not on boot class path
jrose
parents: 9635
diff changeset
   429
  }
5696
93e15b419ad4 6957004: MethodComparator uses the wrong CP index accessor
jrose
parents: 4584
diff changeset
   430
  if (cp->cache() != NULL) {
93e15b419ad4 6957004: MethodComparator uses the wrong CP index accessor
jrose
parents: 4584
diff changeset
   431
    st->print(" cache=" PTR_FORMAT, cp->cache());
93e15b419ad4 6957004: MethodComparator uses the wrong CP index accessor
jrose
parents: 4584
diff changeset
   432
  }
4584
e2a449e8cc6f 6912062: disassembler plugin needs to produce symbolic information in product mode
jrose
parents: 2570
diff changeset
   433
}
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   434
489c9b5090e2 Initial load
duke
parents:
diff changeset
   435
const char* constantPoolKlass::internal_name() const {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   436
  return "{constant pool}";
489c9b5090e2 Initial load
duke
parents:
diff changeset
   437
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   438
489c9b5090e2 Initial load
duke
parents:
diff changeset
   439
// Verification
489c9b5090e2 Initial load
duke
parents:
diff changeset
   440
489c9b5090e2 Initial load
duke
parents:
diff changeset
   441
void constantPoolKlass::oop_verify_on(oop obj, outputStream* st) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   442
  Klass::oop_verify_on(obj, st);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   443
  guarantee(obj->is_constantPool(), "object must be constant pool");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   444
  constantPoolOop cp = constantPoolOop(obj);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   445
  guarantee(cp->is_perm(), "should be in permspace");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   446
  if (!cp->partially_loaded()) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   447
    for (int i = 0; i< cp->length();  i++) {
9635
f668c715d4aa 7043040: JSR292: JRuby bench/shootout/binarytrees.ruby-2.ruby SEGV: constantPoolKlass::oop_follow_contents
never
parents: 9124
diff changeset
   448
      constantTag tag = cp->tag_at(i);
8076
96d498ec7ae1 6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents: 7436
diff changeset
   449
      CPSlot entry = cp->slot_at(i);
9635
f668c715d4aa 7043040: JSR292: JRuby bench/shootout/binarytrees.ruby-2.ruby SEGV: constantPoolKlass::oop_follow_contents
never
parents: 9124
diff changeset
   450
      if (tag.is_klass()) {
8076
96d498ec7ae1 6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents: 7436
diff changeset
   451
        if (entry.is_oop()) {
96d498ec7ae1 6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents: 7436
diff changeset
   452
          guarantee(entry.get_oop()->is_perm(),     "should be in permspace");
96d498ec7ae1 6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents: 7436
diff changeset
   453
          guarantee(entry.get_oop()->is_klass(),    "should be klass");
96d498ec7ae1 6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents: 7436
diff changeset
   454
        }
9635
f668c715d4aa 7043040: JSR292: JRuby bench/shootout/binarytrees.ruby-2.ruby SEGV: constantPoolKlass::oop_follow_contents
never
parents: 9124
diff changeset
   455
      } else if (tag.is_unresolved_klass()) {
8076
96d498ec7ae1 6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents: 7436
diff changeset
   456
        if (entry.is_oop()) {
96d498ec7ae1 6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents: 7436
diff changeset
   457
          guarantee(entry.get_oop()->is_perm(),     "should be in permspace");
96d498ec7ae1 6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents: 7436
diff changeset
   458
          guarantee(entry.get_oop()->is_klass(),    "should be klass");
96d498ec7ae1 6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents: 7436
diff changeset
   459
        }
9635
f668c715d4aa 7043040: JSR292: JRuby bench/shootout/binarytrees.ruby-2.ruby SEGV: constantPoolKlass::oop_follow_contents
never
parents: 9124
diff changeset
   460
      } else if (tag.is_symbol()) {
8076
96d498ec7ae1 6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents: 7436
diff changeset
   461
        guarantee(entry.get_symbol()->refcount() != 0, "should have nonzero reference count");
9635
f668c715d4aa 7043040: JSR292: JRuby bench/shootout/binarytrees.ruby-2.ruby SEGV: constantPoolKlass::oop_follow_contents
never
parents: 9124
diff changeset
   462
      } else if (tag.is_unresolved_string()) {
8076
96d498ec7ae1 6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents: 7436
diff changeset
   463
        if (entry.is_oop()) {
96d498ec7ae1 6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents: 7436
diff changeset
   464
          guarantee(entry.get_oop()->is_perm(),     "should be in permspace");
96d498ec7ae1 6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents: 7436
diff changeset
   465
          guarantee(entry.get_oop()->is_instance(), "should be instance");
96d498ec7ae1 6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents: 7436
diff changeset
   466
        }
96d498ec7ae1 6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents: 7436
diff changeset
   467
        else {
96d498ec7ae1 6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents: 7436
diff changeset
   468
          guarantee(entry.get_symbol()->refcount() != 0, "should have nonzero reference count");
96d498ec7ae1 6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents: 7436
diff changeset
   469
        }
9635
f668c715d4aa 7043040: JSR292: JRuby bench/shootout/binarytrees.ruby-2.ruby SEGV: constantPoolKlass::oop_follow_contents
never
parents: 9124
diff changeset
   470
      } else if (tag.is_string()) {
1550
be2fc37a817f 6653858: dynamic languages need to be able to load anonymous classes
jrose
parents: 670
diff changeset
   471
        if (!cp->has_pseudo_string()) {
8076
96d498ec7ae1 6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents: 7436
diff changeset
   472
          if (entry.is_oop()) {
8728
3f1bcd33068e 6962931: move interned strings out of the perm gen
jcoomes
parents: 8299
diff changeset
   473
            guarantee(!JavaObjectsInPerm || entry.get_oop()->is_perm(),
3f1bcd33068e 6962931: move interned strings out of the perm gen
jcoomes
parents: 8299
diff changeset
   474
                      "should be in permspace");
8076
96d498ec7ae1 6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents: 7436
diff changeset
   475
            guarantee(entry.get_oop()->is_instance(), "should be instance");
96d498ec7ae1 6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents: 7436
diff changeset
   476
          }
1550
be2fc37a817f 6653858: dynamic languages need to be able to load anonymous classes
jrose
parents: 670
diff changeset
   477
        } else {
be2fc37a817f 6653858: dynamic languages need to be able to load anonymous classes
jrose
parents: 670
diff changeset
   478
          // can be non-perm, can be non-instance (array)
be2fc37a817f 6653858: dynamic languages need to be able to load anonymous classes
jrose
parents: 670
diff changeset
   479
        }
9635
f668c715d4aa 7043040: JSR292: JRuby bench/shootout/binarytrees.ruby-2.ruby SEGV: constantPoolKlass::oop_follow_contents
never
parents: 9124
diff changeset
   480
      } else if (tag.is_object()) {
f668c715d4aa 7043040: JSR292: JRuby bench/shootout/binarytrees.ruby-2.ruby SEGV: constantPoolKlass::oop_follow_contents
never
parents: 9124
diff changeset
   481
        assert(entry.get_oop()->is_oop(), "should be some valid oop");
f668c715d4aa 7043040: JSR292: JRuby bench/shootout/binarytrees.ruby-2.ruby SEGV: constantPoolKlass::oop_follow_contents
never
parents: 9124
diff changeset
   482
      } else {
f668c715d4aa 7043040: JSR292: JRuby bench/shootout/binarytrees.ruby-2.ruby SEGV: constantPoolKlass::oop_follow_contents
never
parents: 9124
diff changeset
   483
        assert(!cp->is_pointer_entry(i), "unhandled oop type in constantPoolKlass::verify_on");
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   484
      }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   485
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   486
    guarantee(cp->tags()->is_perm(),         "should be in permspace");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   487
    guarantee(cp->tags()->is_typeArray(),    "should be type array");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   488
    if (cp->cache() != NULL) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   489
      // Note: cache() can be NULL before a class is completely setup or
489c9b5090e2 Initial load
duke
parents:
diff changeset
   490
      // in temporary constant pools used during constant pool merging
489c9b5090e2 Initial load
duke
parents:
diff changeset
   491
      guarantee(cp->cache()->is_perm(),              "should be in permspace");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   492
      guarantee(cp->cache()->is_constantPoolCache(), "should be constant pool cache");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   493
    }
7114
65d21c4c6337 6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents: 6255
diff changeset
   494
    if (cp->operands() != NULL) {
65d21c4c6337 6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents: 6255
diff changeset
   495
      guarantee(cp->operands()->is_perm(),  "should be in permspace");
65d21c4c6337 6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents: 6255
diff changeset
   496
      guarantee(cp->operands()->is_typeArray(), "should be type array");
65d21c4c6337 6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents: 6255
diff changeset
   497
    }
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   498
    if (cp->pool_holder() != NULL) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   499
      // Note: pool_holder() can be NULL in temporary constant pools
489c9b5090e2 Initial load
duke
parents:
diff changeset
   500
      // used during constant pool merging
489c9b5090e2 Initial load
duke
parents:
diff changeset
   501
      guarantee(cp->pool_holder()->is_perm(),  "should be in permspace");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   502
      guarantee(cp->pool_holder()->is_klass(), "should be klass");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   503
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   504
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   505
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   506
489c9b5090e2 Initial load
duke
parents:
diff changeset
   507
bool constantPoolKlass::oop_partially_loaded(oop obj) const {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   508
  assert(obj->is_constantPool(), "object must be constant pool");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   509
  constantPoolOop cp = constantPoolOop(obj);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   510
  return cp->tags() == NULL || cp->pool_holder() == (klassOop) cp;   // Check whether pool holder points to self
489c9b5090e2 Initial load
duke
parents:
diff changeset
   511
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   512
489c9b5090e2 Initial load
duke
parents:
diff changeset
   513
489c9b5090e2 Initial load
duke
parents:
diff changeset
   514
void constantPoolKlass::oop_set_partially_loaded(oop obj) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   515
  assert(obj->is_constantPool(), "object must be constant pool");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   516
  constantPoolOop cp = constantPoolOop(obj);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   517
  assert(cp->pool_holder() == NULL, "just checking");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   518
  cp->set_pool_holder((klassOop) cp);   // Temporarily set pool holder to point to self
489c9b5090e2 Initial load
duke
parents:
diff changeset
   519
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   520
489c9b5090e2 Initial load
duke
parents:
diff changeset
   521
#ifndef PRODUCT
489c9b5090e2 Initial load
duke
parents:
diff changeset
   522
// CompileTheWorld support. Preload all classes loaded references in the passed in constantpool
489c9b5090e2 Initial load
duke
parents:
diff changeset
   523
void constantPoolKlass::preload_and_initialize_all_classes(oop obj, TRAPS) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   524
  guarantee(obj->is_constantPool(), "object must be constant pool");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   525
  constantPoolHandle cp(THREAD, (constantPoolOop)obj);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   526
  guarantee(!cp->partially_loaded(), "must be fully loaded");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   527
489c9b5090e2 Initial load
duke
parents:
diff changeset
   528
  for (int i = 0; i< cp->length();  i++) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   529
    if (cp->tag_at(i).is_unresolved_klass()) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   530
      // This will force loading of the class
489c9b5090e2 Initial load
duke
parents:
diff changeset
   531
      klassOop klass = cp->klass_at(i, CHECK);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   532
      if (klass->is_instance()) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   533
        // Force initialization of class
489c9b5090e2 Initial load
duke
parents:
diff changeset
   534
        instanceKlass::cast(klass)->initialize(CHECK);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   535
      }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   536
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   537
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   538
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   539
489c9b5090e2 Initial load
duke
parents:
diff changeset
   540
#endif