hotspot/src/share/vm/classfile/placeholders.cpp
author ikrylov
Wed, 01 Dec 2010 18:26:32 -0500
changeset 7405 e6fc8d3926f8
parent 7397 5b173b4ca846
child 8076 96d498ec7ae1
permissions -rw-r--r--
6348631: remove the use of the HPI library from Hotspot Summary: move functions from hpi library to hotspot, communicate with licensees and open source community, check jdk for dependency, file CCC request Reviewed-by: coleenp, acorn, dsamersoff
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
     1
/*
7397
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
     2
 * Copyright (c) 2003, 2010, 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: 1
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 1
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: 1
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: 5547
diff changeset
    25
#include "precompiled.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    26
#include "classfile/placeholders.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    27
#include "classfile/systemDictionary.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    28
#include "oops/oop.inline.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    29
#include "runtime/fieldType.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    30
#include "utilities/hashtable.inline.hpp"
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    31
489c9b5090e2 Initial load
duke
parents:
diff changeset
    32
// Placeholder methods
489c9b5090e2 Initial load
duke
parents:
diff changeset
    33
489c9b5090e2 Initial load
duke
parents:
diff changeset
    34
PlaceholderEntry* PlaceholderTable::new_entry(int hash, symbolOop name,
489c9b5090e2 Initial load
duke
parents:
diff changeset
    35
                                              oop loader, bool havesupername,
489c9b5090e2 Initial load
duke
parents:
diff changeset
    36
                                              symbolOop supername) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    37
  PlaceholderEntry* entry = (PlaceholderEntry*)Hashtable::new_entry(hash, name);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    38
  entry->set_loader(loader);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    39
  entry->set_havesupername(havesupername);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    40
  entry->set_supername(supername);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    41
  entry->set_superThreadQ(NULL);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    42
  entry->set_loadInstanceThreadQ(NULL);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    43
  entry->set_defineThreadQ(NULL);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    44
  entry->set_definer(NULL);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    45
  entry->set_instanceKlass(NULL);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    46
  return entry;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    47
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
    48
489c9b5090e2 Initial load
duke
parents:
diff changeset
    49
489c9b5090e2 Initial load
duke
parents:
diff changeset
    50
// Placeholder objects represent classes currently being loaded.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    51
// All threads examining the placeholder table must hold the
489c9b5090e2 Initial load
duke
parents:
diff changeset
    52
// SystemDictionary_lock, so we don't need special precautions
489c9b5090e2 Initial load
duke
parents:
diff changeset
    53
// on store ordering here.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    54
void PlaceholderTable::add_entry(int index, unsigned int hash,
489c9b5090e2 Initial load
duke
parents:
diff changeset
    55
                                 symbolHandle class_name, Handle class_loader,
489c9b5090e2 Initial load
duke
parents:
diff changeset
    56
                                 bool havesupername, symbolHandle supername){
489c9b5090e2 Initial load
duke
parents:
diff changeset
    57
  assert_locked_or_safepoint(SystemDictionary_lock);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    58
  assert(!class_name.is_null(), "adding NULL obj");
489c9b5090e2 Initial load
duke
parents:
diff changeset
    59
489c9b5090e2 Initial load
duke
parents:
diff changeset
    60
  // Both readers and writers are locked so it's safe to just
489c9b5090e2 Initial load
duke
parents:
diff changeset
    61
  // create the placeholder and insert it in the list without a membar.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    62
  PlaceholderEntry* entry = new_entry(hash, class_name(), class_loader(), havesupername, supername());
489c9b5090e2 Initial load
duke
parents:
diff changeset
    63
  add_entry(index, entry);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    64
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
    65
489c9b5090e2 Initial load
duke
parents:
diff changeset
    66
489c9b5090e2 Initial load
duke
parents:
diff changeset
    67
// Remove a placeholder object.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    68
void PlaceholderTable::remove_entry(int index, unsigned int hash,
489c9b5090e2 Initial load
duke
parents:
diff changeset
    69
                                    symbolHandle class_name,
489c9b5090e2 Initial load
duke
parents:
diff changeset
    70
                                    Handle class_loader) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    71
  assert_locked_or_safepoint(SystemDictionary_lock);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    72
  PlaceholderEntry** p = bucket_addr(index);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    73
  while (*p) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    74
    PlaceholderEntry *probe = *p;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    75
    if (probe->hash() == hash && probe->equals(class_name(), class_loader())) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    76
      // Delete entry
489c9b5090e2 Initial load
duke
parents:
diff changeset
    77
      *p = probe->next();
489c9b5090e2 Initial load
duke
parents:
diff changeset
    78
      free_entry(probe);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    79
      return;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    80
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    81
    p = probe->next_addr();
489c9b5090e2 Initial load
duke
parents:
diff changeset
    82
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    83
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
    84
489c9b5090e2 Initial load
duke
parents:
diff changeset
    85
PlaceholderEntry* PlaceholderTable::get_entry(int index, unsigned int hash,
489c9b5090e2 Initial load
duke
parents:
diff changeset
    86
                                       symbolHandle class_name,
489c9b5090e2 Initial load
duke
parents:
diff changeset
    87
                                       Handle class_loader) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    88
  assert_locked_or_safepoint(SystemDictionary_lock);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    89
489c9b5090e2 Initial load
duke
parents:
diff changeset
    90
  symbolOop class_name_ = class_name();
489c9b5090e2 Initial load
duke
parents:
diff changeset
    91
  oop class_loader_ = class_loader();
489c9b5090e2 Initial load
duke
parents:
diff changeset
    92
489c9b5090e2 Initial load
duke
parents:
diff changeset
    93
  for (PlaceholderEntry *place_probe = bucket(index);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    94
                         place_probe != NULL;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    95
                         place_probe = place_probe->next()) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    96
    if (place_probe->hash() == hash &&
489c9b5090e2 Initial load
duke
parents:
diff changeset
    97
        place_probe->equals(class_name_, class_loader_)) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    98
      return place_probe;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    99
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   100
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   101
  return NULL;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   102
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   103
489c9b5090e2 Initial load
duke
parents:
diff changeset
   104
symbolOop PlaceholderTable::find_entry(int index, unsigned int hash,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   105
                                       symbolHandle class_name,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   106
                                       Handle class_loader) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   107
  PlaceholderEntry* probe = get_entry(index, hash, class_name, class_loader);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   108
  return (probe? probe->klass(): symbolOop(NULL));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   109
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   110
489c9b5090e2 Initial load
duke
parents:
diff changeset
   111
  // find_and_add returns probe pointer - old or new
489c9b5090e2 Initial load
duke
parents:
diff changeset
   112
  // If no entry exists, add a placeholder entry
489c9b5090e2 Initial load
duke
parents:
diff changeset
   113
  // If entry exists, reuse entry
489c9b5090e2 Initial load
duke
parents:
diff changeset
   114
  // For both, push SeenThread for classloadAction
489c9b5090e2 Initial load
duke
parents:
diff changeset
   115
  // if havesupername: this is used for circularity for instanceklass loading
489c9b5090e2 Initial load
duke
parents:
diff changeset
   116
PlaceholderEntry* PlaceholderTable::find_and_add(int index, unsigned int hash, symbolHandle name, Handle loader, classloadAction action, symbolHandle supername, Thread* thread) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   117
  PlaceholderEntry* probe = get_entry(index, hash, name, loader);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   118
  if (probe == NULL) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   119
    // Nothing found, add place holder
489c9b5090e2 Initial load
duke
parents:
diff changeset
   120
    add_entry(index, hash, name, loader, (action == LOAD_SUPER), supername);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   121
    probe = get_entry(index, hash, name, loader);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   122
  } else {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   123
    if (action == LOAD_SUPER) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   124
      probe->set_havesupername(true);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   125
      probe->set_supername(supername());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   126
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   127
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   128
  if (probe) probe->add_seen_thread(thread, action);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   129
  return probe;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   130
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   131
489c9b5090e2 Initial load
duke
parents:
diff changeset
   132
489c9b5090e2 Initial load
duke
parents:
diff changeset
   133
// placeholder used to track class loading internal states
489c9b5090e2 Initial load
duke
parents:
diff changeset
   134
// placeholder existence now for loading superclass/superinterface
489c9b5090e2 Initial load
duke
parents:
diff changeset
   135
// superthreadQ tracks class circularity, while loading superclass/superinterface
489c9b5090e2 Initial load
duke
parents:
diff changeset
   136
// loadInstanceThreadQ tracks load_instance_class calls
489c9b5090e2 Initial load
duke
parents:
diff changeset
   137
// definer() tracks the single thread that owns define token
489c9b5090e2 Initial load
duke
parents:
diff changeset
   138
// defineThreadQ tracks waiters on defining thread's results
489c9b5090e2 Initial load
duke
parents:
diff changeset
   139
// 1st claimant creates placeholder
489c9b5090e2 Initial load
duke
parents:
diff changeset
   140
// find_and_add adds SeenThread entry for appropriate queue
489c9b5090e2 Initial load
duke
parents:
diff changeset
   141
// All claimants remove SeenThread after completing action
489c9b5090e2 Initial load
duke
parents:
diff changeset
   142
// On removal: if definer and all queues empty, remove entry
489c9b5090e2 Initial load
duke
parents:
diff changeset
   143
// Note: you can be in both placeholders and systemDictionary
489c9b5090e2 Initial load
duke
parents:
diff changeset
   144
// see parse_stream for redefine classes
489c9b5090e2 Initial load
duke
parents:
diff changeset
   145
// Therefore - must always check SD first
489c9b5090e2 Initial load
duke
parents:
diff changeset
   146
// Ignores the case where entry is not found
489c9b5090e2 Initial load
duke
parents:
diff changeset
   147
void PlaceholderTable::find_and_remove(int index, unsigned int hash,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   148
                       symbolHandle name, Handle loader, Thread* thread) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   149
    assert_locked_or_safepoint(SystemDictionary_lock);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   150
    PlaceholderEntry *probe = get_entry(index, hash, name, loader);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   151
    if (probe != NULL) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   152
       // No other threads using this entry
489c9b5090e2 Initial load
duke
parents:
diff changeset
   153
       if ((probe->superThreadQ() == NULL) && (probe->loadInstanceThreadQ() == NULL)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   154
          && (probe->defineThreadQ() == NULL) && (probe->definer() == NULL)) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   155
         remove_entry(index, hash, name, loader);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   156
       }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   157
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   158
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   159
489c9b5090e2 Initial load
duke
parents:
diff changeset
   160
PlaceholderTable::PlaceholderTable(int table_size)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   161
    : TwoOopHashtable(table_size, sizeof(PlaceholderEntry)) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   162
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   163
489c9b5090e2 Initial load
duke
parents:
diff changeset
   164
489c9b5090e2 Initial load
duke
parents:
diff changeset
   165
void PlaceholderTable::oops_do(OopClosure* f) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   166
  for (int index = 0; index < table_size(); index++) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   167
    for (PlaceholderEntry* probe = bucket(index);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   168
                           probe != NULL;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   169
                           probe = probe->next()) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   170
      probe->oops_do(f);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   171
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   172
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   173
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   174
489c9b5090e2 Initial load
duke
parents:
diff changeset
   175
489c9b5090e2 Initial load
duke
parents:
diff changeset
   176
void PlaceholderEntry::oops_do(OopClosure* blk) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   177
  assert(klass() != NULL, "should have a non-null klass");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   178
  blk->do_oop((oop*)klass_addr());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   179
  if (_loader != NULL) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   180
    blk->do_oop(loader_addr());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   181
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   182
  if (_supername != NULL) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   183
    blk->do_oop((oop*)supername_addr());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   184
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   185
  if (_instanceKlass != NULL) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   186
    blk->do_oop((oop*)instanceKlass_addr());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   187
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   188
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   189
489c9b5090e2 Initial load
duke
parents:
diff changeset
   190
// do all entries in the placeholder table
489c9b5090e2 Initial load
duke
parents:
diff changeset
   191
void PlaceholderTable::entries_do(void f(symbolOop, oop)) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   192
  for (int index = 0; index < table_size(); index++) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   193
    for (PlaceholderEntry* probe = bucket(index);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   194
                           probe != NULL;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   195
                           probe = probe->next()) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   196
      f(probe->klass(), probe->loader());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   197
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   198
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   199
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   200
489c9b5090e2 Initial load
duke
parents:
diff changeset
   201
489c9b5090e2 Initial load
duke
parents:
diff changeset
   202
#ifndef PRODUCT
489c9b5090e2 Initial load
duke
parents:
diff changeset
   203
// Note, doesn't append a cr
489c9b5090e2 Initial load
duke
parents:
diff changeset
   204
void PlaceholderEntry::print() const {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   205
  klass()->print_value();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   206
  if (loader() != NULL) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   207
    tty->print(", loader ");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   208
    loader()->print_value();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   209
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   210
  if (supername() != NULL) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   211
    tty->print(", supername ");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   212
    supername()->print_value();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   213
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   214
  if (definer() != NULL) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   215
    tty->print(", definer ");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   216
    definer()->print_value();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   217
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   218
  if (instanceKlass() != NULL) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   219
    tty->print(", instanceKlass ");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   220
    instanceKlass()->print_value();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   221
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   222
  tty->print("\n");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   223
  tty->print("loadInstanceThreadQ threads:");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   224
  loadInstanceThreadQ()->printActionQ();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   225
  tty->print("\n");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   226
  tty->print("superThreadQ threads:");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   227
  superThreadQ()->printActionQ();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   228
  tty->print("\n");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   229
  tty->print("defineThreadQ threads:");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   230
  defineThreadQ()->printActionQ();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   231
  tty->print("\n");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   232
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   233
#endif
489c9b5090e2 Initial load
duke
parents:
diff changeset
   234
489c9b5090e2 Initial load
duke
parents:
diff changeset
   235
void PlaceholderEntry::verify() const {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   236
  guarantee(loader() == NULL || loader()->is_instance(),
489c9b5090e2 Initial load
duke
parents:
diff changeset
   237
            "checking type of _loader");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   238
  guarantee(instanceKlass() == NULL
489c9b5090e2 Initial load
duke
parents:
diff changeset
   239
            || Klass::cast(instanceKlass())->oop_is_instance(),
489c9b5090e2 Initial load
duke
parents:
diff changeset
   240
            "checking type of instanceKlass result");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   241
  klass()->verify();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   242
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   243
489c9b5090e2 Initial load
duke
parents:
diff changeset
   244
void PlaceholderTable::verify() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   245
  int element_count = 0;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   246
  for (int pindex = 0; pindex < table_size(); pindex++) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   247
    for (PlaceholderEntry* probe = bucket(pindex);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   248
                           probe != NULL;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   249
                           probe = probe->next()) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   250
      probe->verify();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   251
      element_count++;  // both klasses and place holders count
489c9b5090e2 Initial load
duke
parents:
diff changeset
   252
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   253
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   254
  guarantee(number_of_entries() == element_count,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   255
            "Verify of system dictionary failed");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   256
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   257
489c9b5090e2 Initial load
duke
parents:
diff changeset
   258
489c9b5090e2 Initial load
duke
parents:
diff changeset
   259
#ifndef PRODUCT
489c9b5090e2 Initial load
duke
parents:
diff changeset
   260
void PlaceholderTable::print() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   261
  for (int pindex = 0; pindex < table_size(); pindex++) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   262
    for (PlaceholderEntry* probe = bucket(pindex);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   263
                           probe != NULL;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   264
                           probe = probe->next()) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   265
      if (Verbose) tty->print("%4d: ", pindex);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   266
      tty->print(" place holder ");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   267
489c9b5090e2 Initial load
duke
parents:
diff changeset
   268
      probe->print();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   269
      tty->cr();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   270
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   271
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   272
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   273
#endif