hotspot/src/share/vm/classfile/dictionary.cpp
author stefank
Tue, 23 Nov 2010 13:22:55 -0800
changeset 7397 5b173b4ca846
parent 5547 f4b087cbb361
child 8076 96d498ec7ae1
permissions -rw-r--r--
6989984: Use standard include model for Hospot Summary: Replaced MakeDeps and the includeDB files with more standardized solutions. Reviewed-by: coleenp, kvn, kamg
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: 5426
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 5426
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: 5426
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/dictionary.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 "prims/jvmtiRedefineClassesTrace.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    30
#include "services/classLoadingService.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    31
#include "utilities/hashtable.inline.hpp"
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    32
489c9b5090e2 Initial load
duke
parents:
diff changeset
    33
489c9b5090e2 Initial load
duke
parents:
diff changeset
    34
DictionaryEntry*  Dictionary::_current_class_entry = NULL;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    35
int               Dictionary::_current_class_index =    0;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    36
489c9b5090e2 Initial load
duke
parents:
diff changeset
    37
489c9b5090e2 Initial load
duke
parents:
diff changeset
    38
Dictionary::Dictionary(int table_size)
489c9b5090e2 Initial load
duke
parents:
diff changeset
    39
  : TwoOopHashtable(table_size, sizeof(DictionaryEntry)) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    40
  _current_class_index = 0;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    41
  _current_class_entry = NULL;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    42
};
489c9b5090e2 Initial load
duke
parents:
diff changeset
    43
489c9b5090e2 Initial load
duke
parents:
diff changeset
    44
489c9b5090e2 Initial load
duke
parents:
diff changeset
    45
489c9b5090e2 Initial load
duke
parents:
diff changeset
    46
Dictionary::Dictionary(int table_size, HashtableBucket* t,
489c9b5090e2 Initial load
duke
parents:
diff changeset
    47
                       int number_of_entries)
489c9b5090e2 Initial load
duke
parents:
diff changeset
    48
  : TwoOopHashtable(table_size, sizeof(DictionaryEntry), t, number_of_entries) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    49
  _current_class_index = 0;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    50
  _current_class_entry = NULL;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    51
};
489c9b5090e2 Initial load
duke
parents:
diff changeset
    52
489c9b5090e2 Initial load
duke
parents:
diff changeset
    53
489c9b5090e2 Initial load
duke
parents:
diff changeset
    54
DictionaryEntry* Dictionary::new_entry(unsigned int hash, klassOop klass,
489c9b5090e2 Initial load
duke
parents:
diff changeset
    55
                                       oop loader) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    56
  DictionaryEntry* entry;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    57
  entry = (DictionaryEntry*)Hashtable::new_entry(hash, klass);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    58
  entry->set_loader(loader);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    59
  entry->set_pd_set(NULL);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    60
  return entry;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    61
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
    62
489c9b5090e2 Initial load
duke
parents:
diff changeset
    63
489c9b5090e2 Initial load
duke
parents:
diff changeset
    64
DictionaryEntry* Dictionary::new_entry() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    65
  DictionaryEntry* entry = (DictionaryEntry*)Hashtable::new_entry(0L, NULL);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    66
  entry->set_loader(NULL);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    67
  entry->set_pd_set(NULL);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    68
  return entry;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    69
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
    70
489c9b5090e2 Initial load
duke
parents:
diff changeset
    71
489c9b5090e2 Initial load
duke
parents:
diff changeset
    72
void Dictionary::free_entry(DictionaryEntry* entry) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    73
  // avoid recursion when deleting linked list
489c9b5090e2 Initial load
duke
parents:
diff changeset
    74
  while (entry->pd_set() != NULL) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    75
    ProtectionDomainEntry* to_delete = entry->pd_set();
489c9b5090e2 Initial load
duke
parents:
diff changeset
    76
    entry->set_pd_set(to_delete->next());
489c9b5090e2 Initial load
duke
parents:
diff changeset
    77
    delete to_delete;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    78
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    79
  Hashtable::free_entry(entry);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    80
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
    81
489c9b5090e2 Initial load
duke
parents:
diff changeset
    82
489c9b5090e2 Initial load
duke
parents:
diff changeset
    83
bool DictionaryEntry::contains_protection_domain(oop protection_domain) const {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    84
#ifdef ASSERT
489c9b5090e2 Initial load
duke
parents:
diff changeset
    85
  if (protection_domain == instanceKlass::cast(klass())->protection_domain()) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    86
    // Ensure this doesn't show up in the pd_set (invariant)
489c9b5090e2 Initial load
duke
parents:
diff changeset
    87
    bool in_pd_set = false;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    88
    for (ProtectionDomainEntry* current = _pd_set;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    89
                                current != NULL;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    90
                                current = current->next()) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    91
      if (current->protection_domain() == protection_domain) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    92
        in_pd_set = true;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    93
        break;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    94
      }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    95
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    96
    if (in_pd_set) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    97
      assert(false, "A klass's protection domain should not show up "
489c9b5090e2 Initial load
duke
parents:
diff changeset
    98
                    "in its sys. dict. PD set");
489c9b5090e2 Initial load
duke
parents:
diff changeset
    99
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   100
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   101
#endif /* ASSERT */
489c9b5090e2 Initial load
duke
parents:
diff changeset
   102
489c9b5090e2 Initial load
duke
parents:
diff changeset
   103
  if (protection_domain == instanceKlass::cast(klass())->protection_domain()) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   104
    // Succeeds trivially
489c9b5090e2 Initial load
duke
parents:
diff changeset
   105
    return true;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   106
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   107
489c9b5090e2 Initial load
duke
parents:
diff changeset
   108
  for (ProtectionDomainEntry* current = _pd_set;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   109
                              current != NULL;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   110
                              current = current->next()) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   111
    if (current->protection_domain() == protection_domain) return true;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   112
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   113
  return false;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   114
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   115
489c9b5090e2 Initial load
duke
parents:
diff changeset
   116
489c9b5090e2 Initial load
duke
parents:
diff changeset
   117
void DictionaryEntry::add_protection_domain(oop protection_domain) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   118
  assert_locked_or_safepoint(SystemDictionary_lock);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   119
  if (!contains_protection_domain(protection_domain)) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   120
    ProtectionDomainEntry* new_head =
489c9b5090e2 Initial load
duke
parents:
diff changeset
   121
                new ProtectionDomainEntry(protection_domain, _pd_set);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   122
    // Warning: Preserve store ordering.  The SystemDictionary is read
489c9b5090e2 Initial load
duke
parents:
diff changeset
   123
    //          without locks.  The new ProtectionDomainEntry must be
489c9b5090e2 Initial load
duke
parents:
diff changeset
   124
    //          complete before other threads can be allowed to see it
489c9b5090e2 Initial load
duke
parents:
diff changeset
   125
    //          via a store to _pd_set.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   126
    OrderAccess::release_store_ptr(&_pd_set, new_head);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   127
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   128
  if (TraceProtectionDomainVerification && WizardMode) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   129
    print();
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
489c9b5090e2 Initial load
duke
parents:
diff changeset
   134
bool Dictionary::do_unloading(BoolObjectClosure* is_alive) {
5402
c51fd0c1d005 6888953: some calls to function-like macros are missing semicolons
jcoomes
parents: 2534
diff changeset
   135
  assert(SafepointSynchronize::is_at_safepoint(), "must be at safepoint");
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   136
  bool class_was_unloaded = false;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   137
  int  index = 0; // Defined here for portability! Do not move
489c9b5090e2 Initial load
duke
parents:
diff changeset
   138
489c9b5090e2 Initial load
duke
parents:
diff changeset
   139
  // Remove unloadable entries and classes from system dictionary
489c9b5090e2 Initial load
duke
parents:
diff changeset
   140
  // The placeholder array has been handled in always_strong_oops_do.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   141
  DictionaryEntry* probe = NULL;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   142
  for (index = 0; index < table_size(); index++) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   143
    for (DictionaryEntry** p = bucket_addr(index); *p != NULL; ) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   144
      probe = *p;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   145
      klassOop e = probe->klass();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   146
      oop class_loader = probe->loader();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   147
489c9b5090e2 Initial load
duke
parents:
diff changeset
   148
      instanceKlass* ik = instanceKlass::cast(e);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   149
      if (ik->previous_versions() != NULL) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   150
        // This klass has previous versions so see what we can cleanup
489c9b5090e2 Initial load
duke
parents:
diff changeset
   151
        // while it is safe to do so.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   152
489c9b5090e2 Initial load
duke
parents:
diff changeset
   153
        int gc_count = 0;    // leave debugging breadcrumbs
489c9b5090e2 Initial load
duke
parents:
diff changeset
   154
        int live_count = 0;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   155
489c9b5090e2 Initial load
duke
parents:
diff changeset
   156
        // RC_TRACE macro has an embedded ResourceMark
489c9b5090e2 Initial load
duke
parents:
diff changeset
   157
        RC_TRACE(0x00000200, ("unload: %s: previous version length=%d",
489c9b5090e2 Initial load
duke
parents:
diff changeset
   158
          ik->external_name(), ik->previous_versions()->length()));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   159
489c9b5090e2 Initial load
duke
parents:
diff changeset
   160
        for (int i = ik->previous_versions()->length() - 1; i >= 0; i--) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   161
          // check the previous versions array for GC'ed weak refs
489c9b5090e2 Initial load
duke
parents:
diff changeset
   162
          PreviousVersionNode * pv_node = ik->previous_versions()->at(i);
220
e6ef4818c49d 6497639: 4/3 Profiling Swing application caused JVM crash
dcubed
parents: 1
diff changeset
   163
          jobject cp_ref = pv_node->prev_constant_pool();
e6ef4818c49d 6497639: 4/3 Profiling Swing application caused JVM crash
dcubed
parents: 1
diff changeset
   164
          assert(cp_ref != NULL, "cp ref was unexpectedly cleared");
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   165
          if (cp_ref == NULL) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   166
            delete pv_node;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   167
            ik->previous_versions()->remove_at(i);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   168
            // Since we are traversing the array backwards, we don't have to
489c9b5090e2 Initial load
duke
parents:
diff changeset
   169
            // do anything special with the index.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   170
            continue;  // robustness
489c9b5090e2 Initial load
duke
parents:
diff changeset
   171
          }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   172
489c9b5090e2 Initial load
duke
parents:
diff changeset
   173
          constantPoolOop pvcp = (constantPoolOop)JNIHandles::resolve(cp_ref);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   174
          if (pvcp == NULL) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   175
            // this entry has been GC'ed so remove it
489c9b5090e2 Initial load
duke
parents:
diff changeset
   176
            delete pv_node;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   177
            ik->previous_versions()->remove_at(i);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   178
            // Since we are traversing the array backwards, we don't have to
489c9b5090e2 Initial load
duke
parents:
diff changeset
   179
            // do anything special with the index.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   180
            gc_count++;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   181
            continue;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   182
          } else {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   183
            RC_TRACE(0x00000200, ("unload: previous version @%d is alive", i));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   184
            if (is_alive->do_object_b(pvcp)) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   185
              live_count++;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   186
            } else {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   187
              guarantee(false, "sanity check");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   188
            }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   189
          }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   190
489c9b5090e2 Initial load
duke
parents:
diff changeset
   191
          GrowableArray<jweak>* method_refs = pv_node->prev_EMCP_methods();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   192
          if (method_refs != NULL) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   193
            RC_TRACE(0x00000200, ("unload: previous methods length=%d",
489c9b5090e2 Initial load
duke
parents:
diff changeset
   194
              method_refs->length()));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   195
            for (int j = method_refs->length() - 1; j >= 0; j--) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   196
              jweak method_ref = method_refs->at(j);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   197
              assert(method_ref != NULL, "weak method ref was unexpectedly cleared");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   198
              if (method_ref == NULL) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   199
                method_refs->remove_at(j);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   200
                // Since we are traversing the array backwards, we don't have to
489c9b5090e2 Initial load
duke
parents:
diff changeset
   201
                // do anything special with the index.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   202
                continue;  // robustness
489c9b5090e2 Initial load
duke
parents:
diff changeset
   203
              }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   204
489c9b5090e2 Initial load
duke
parents:
diff changeset
   205
              methodOop method = (methodOop)JNIHandles::resolve(method_ref);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   206
              if (method == NULL) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   207
                // this method entry has been GC'ed so remove it
489c9b5090e2 Initial load
duke
parents:
diff changeset
   208
                JNIHandles::destroy_weak_global(method_ref);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   209
                method_refs->remove_at(j);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   210
              } else {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   211
                // RC_TRACE macro has an embedded ResourceMark
489c9b5090e2 Initial load
duke
parents:
diff changeset
   212
                RC_TRACE(0x00000200,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   213
                  ("unload: %s(%s): prev method @%d in version @%d is alive",
489c9b5090e2 Initial load
duke
parents:
diff changeset
   214
                  method->name()->as_C_string(),
489c9b5090e2 Initial load
duke
parents:
diff changeset
   215
                  method->signature()->as_C_string(), j, i));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   216
              }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   217
            }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   218
          }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   219
        }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   220
        assert(ik->previous_versions()->length() == live_count, "sanity check");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   221
        RC_TRACE(0x00000200,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   222
          ("unload: previous version stats: live=%d, GC'ed=%d", live_count,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   223
          gc_count));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   224
      }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   225
489c9b5090e2 Initial load
duke
parents:
diff changeset
   226
      // Non-unloadable classes were handled in always_strong_oops_do
489c9b5090e2 Initial load
duke
parents:
diff changeset
   227
      if (!is_strongly_reachable(class_loader, e)) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   228
        // Entry was not visited in phase1 (negated test from phase1)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   229
        assert(class_loader != NULL, "unloading entry with null class loader");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   230
        oop k_def_class_loader = ik->class_loader();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   231
489c9b5090e2 Initial load
duke
parents:
diff changeset
   232
        // Do we need to delete this system dictionary entry?
489c9b5090e2 Initial load
duke
parents:
diff changeset
   233
        bool purge_entry = false;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   234
489c9b5090e2 Initial load
duke
parents:
diff changeset
   235
        // Do we need to delete this system dictionary entry?
489c9b5090e2 Initial load
duke
parents:
diff changeset
   236
        if (!is_alive->do_object_b(class_loader)) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   237
          // If the loader is not live this entry should always be
489c9b5090e2 Initial load
duke
parents:
diff changeset
   238
          // removed (will never be looked up again). Note that this is
489c9b5090e2 Initial load
duke
parents:
diff changeset
   239
          // not the same as unloading the referred class.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   240
          if (k_def_class_loader == class_loader) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   241
            // This is the defining entry, so the referred class is about
489c9b5090e2 Initial load
duke
parents:
diff changeset
   242
            // to be unloaded.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   243
            // Notify the debugger and clean up the class.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   244
            guarantee(!is_alive->do_object_b(e),
489c9b5090e2 Initial load
duke
parents:
diff changeset
   245
                      "klass should not be live if defining loader is not");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   246
            class_was_unloaded = true;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   247
            // notify the debugger
489c9b5090e2 Initial load
duke
parents:
diff changeset
   248
            if (JvmtiExport::should_post_class_unload()) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   249
              JvmtiExport::post_class_unload(ik->as_klassOop());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   250
            }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   251
489c9b5090e2 Initial load
duke
parents:
diff changeset
   252
            // notify ClassLoadingService of class unload
489c9b5090e2 Initial load
duke
parents:
diff changeset
   253
            ClassLoadingService::notify_class_unloaded(ik);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   254
489c9b5090e2 Initial load
duke
parents:
diff changeset
   255
            // Clean up C heap
489c9b5090e2 Initial load
duke
parents:
diff changeset
   256
            ik->release_C_heap_structures();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   257
          }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   258
          // Also remove this system dictionary entry.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   259
          purge_entry = true;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   260
489c9b5090e2 Initial load
duke
parents:
diff changeset
   261
        } else {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   262
          // The loader in this entry is alive. If the klass is dead,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   263
          // the loader must be an initiating loader (rather than the
489c9b5090e2 Initial load
duke
parents:
diff changeset
   264
          // defining loader). Remove this entry.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   265
          if (!is_alive->do_object_b(e)) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   266
            guarantee(!is_alive->do_object_b(k_def_class_loader),
489c9b5090e2 Initial load
duke
parents:
diff changeset
   267
                      "defining loader should not be live if klass is not");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   268
            // If we get here, the class_loader must not be the defining
489c9b5090e2 Initial load
duke
parents:
diff changeset
   269
            // loader, it must be an initiating one.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   270
            assert(k_def_class_loader != class_loader,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   271
                   "cannot have live defining loader and unreachable klass");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   272
489c9b5090e2 Initial load
duke
parents:
diff changeset
   273
            // Loader is live, but class and its defining loader are dead.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   274
            // Remove the entry. The class is going away.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   275
            purge_entry = true;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   276
          }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   277
        }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   278
489c9b5090e2 Initial load
duke
parents:
diff changeset
   279
        if (purge_entry) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   280
          *p = probe->next();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   281
          if (probe == _current_class_entry) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   282
            _current_class_entry = NULL;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   283
          }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   284
          free_entry(probe);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   285
          continue;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   286
        }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   287
      }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   288
      p = probe->next_addr();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   289
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   290
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   291
  return class_was_unloaded;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   292
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   293
489c9b5090e2 Initial load
duke
parents:
diff changeset
   294
489c9b5090e2 Initial load
duke
parents:
diff changeset
   295
void Dictionary::always_strong_classes_do(OopClosure* blk) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   296
  // Follow all system classes and temporary placeholders in dictionary
489c9b5090e2 Initial load
duke
parents:
diff changeset
   297
  for (int index = 0; index < table_size(); index++) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   298
    for (DictionaryEntry *probe = bucket(index);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   299
                          probe != NULL;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   300
                          probe = probe->next()) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   301
      oop e = probe->klass();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   302
      oop class_loader = probe->loader();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   303
      if (is_strongly_reachable(class_loader, e)) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   304
        blk->do_oop((oop*)probe->klass_addr());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   305
        if (class_loader != NULL) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   306
          blk->do_oop(probe->loader_addr());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   307
        }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   308
        probe->protection_domain_set_oops_do(blk);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   309
      }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   310
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   311
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   312
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   313
489c9b5090e2 Initial load
duke
parents:
diff changeset
   314
489c9b5090e2 Initial load
duke
parents:
diff changeset
   315
//   Just the classes from defining class loaders
489c9b5090e2 Initial load
duke
parents:
diff changeset
   316
void Dictionary::classes_do(void f(klassOop)) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   317
  for (int index = 0; index < table_size(); index++) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   318
    for (DictionaryEntry* probe = bucket(index);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   319
                          probe != NULL;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   320
                          probe = probe->next()) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   321
      klassOop k = probe->klass();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   322
      if (probe->loader() == instanceKlass::cast(k)->class_loader()) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   323
        f(k);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   324
      }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   325
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   326
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   327
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   328
489c9b5090e2 Initial load
duke
parents:
diff changeset
   329
// Added for initialize_itable_for_klass to handle exceptions
489c9b5090e2 Initial load
duke
parents:
diff changeset
   330
//   Just the classes from defining class loaders
489c9b5090e2 Initial load
duke
parents:
diff changeset
   331
void Dictionary::classes_do(void f(klassOop, TRAPS), TRAPS) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   332
  for (int index = 0; index < table_size(); index++) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   333
    for (DictionaryEntry* probe = bucket(index);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   334
                          probe != NULL;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   335
                          probe = probe->next()) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   336
      klassOop k = probe->klass();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   337
      if (probe->loader() == instanceKlass::cast(k)->class_loader()) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   338
        f(k, CHECK);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   339
      }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   340
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   341
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   342
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   343
489c9b5090e2 Initial load
duke
parents:
diff changeset
   344
489c9b5090e2 Initial load
duke
parents:
diff changeset
   345
//   All classes, and their class loaders
489c9b5090e2 Initial load
duke
parents:
diff changeset
   346
//   (added for helpers that use HandleMarks and ResourceMarks)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   347
// Don't iterate over placeholders
489c9b5090e2 Initial load
duke
parents:
diff changeset
   348
void Dictionary::classes_do(void f(klassOop, oop, TRAPS), TRAPS) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   349
  for (int index = 0; index < table_size(); index++) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   350
    for (DictionaryEntry* probe = bucket(index);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   351
                          probe != NULL;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   352
                          probe = probe->next()) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   353
      klassOop k = probe->klass();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   354
      f(k, probe->loader(), CHECK);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   355
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   356
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   357
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   358
489c9b5090e2 Initial load
duke
parents:
diff changeset
   359
489c9b5090e2 Initial load
duke
parents:
diff changeset
   360
//   All classes, and their class loaders
489c9b5090e2 Initial load
duke
parents:
diff changeset
   361
// Don't iterate over placeholders
489c9b5090e2 Initial load
duke
parents:
diff changeset
   362
void Dictionary::classes_do(void f(klassOop, oop)) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   363
  for (int index = 0; index < table_size(); index++) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   364
    for (DictionaryEntry* probe = bucket(index);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   365
                          probe != NULL;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   366
                          probe = probe->next()) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   367
      klassOop k = probe->klass();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   368
      f(k, probe->loader());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   369
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   370
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   371
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   372
489c9b5090e2 Initial load
duke
parents:
diff changeset
   373
489c9b5090e2 Initial load
duke
parents:
diff changeset
   374
void Dictionary::oops_do(OopClosure* f) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   375
  for (int index = 0; index < table_size(); index++) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   376
    for (DictionaryEntry* probe = bucket(index);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   377
                          probe != NULL;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   378
                          probe = probe->next()) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   379
      f->do_oop((oop*)probe->klass_addr());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   380
      if (probe->loader() != NULL) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   381
        f->do_oop(probe->loader_addr());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   382
      }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   383
      probe->protection_domain_set_oops_do(f);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   384
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   385
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   386
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   387
489c9b5090e2 Initial load
duke
parents:
diff changeset
   388
489c9b5090e2 Initial load
duke
parents:
diff changeset
   389
void Dictionary::methods_do(void f(methodOop)) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   390
  for (int index = 0; index < table_size(); index++) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   391
    for (DictionaryEntry* probe = bucket(index);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   392
                          probe != NULL;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   393
                          probe = probe->next()) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   394
      klassOop k = probe->klass();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   395
      if (probe->loader() == instanceKlass::cast(k)->class_loader()) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   396
        // only take klass is we have the entry with the defining class loader
489c9b5090e2 Initial load
duke
parents:
diff changeset
   397
        instanceKlass::cast(k)->methods_do(f);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   398
      }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   399
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   400
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   401
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   402
489c9b5090e2 Initial load
duke
parents:
diff changeset
   403
489c9b5090e2 Initial load
duke
parents:
diff changeset
   404
klassOop Dictionary::try_get_next_class() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   405
  while (true) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   406
    if (_current_class_entry != NULL) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   407
      klassOop k = _current_class_entry->klass();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   408
      _current_class_entry = _current_class_entry->next();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   409
      return k;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   410
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   411
    _current_class_index = (_current_class_index + 1) % table_size();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   412
    _current_class_entry = bucket(_current_class_index);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   413
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   414
  // never reached
489c9b5090e2 Initial load
duke
parents:
diff changeset
   415
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   416
489c9b5090e2 Initial load
duke
parents:
diff changeset
   417
489c9b5090e2 Initial load
duke
parents:
diff changeset
   418
// Add a loaded class to the system dictionary.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   419
// Readers of the SystemDictionary aren't always locked, so _buckets
489c9b5090e2 Initial load
duke
parents:
diff changeset
   420
// is volatile. The store of the next field in the constructor is
489c9b5090e2 Initial load
duke
parents:
diff changeset
   421
// also cast to volatile;  we do this to ensure store order is maintained
489c9b5090e2 Initial load
duke
parents:
diff changeset
   422
// by the compilers.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   423
489c9b5090e2 Initial load
duke
parents:
diff changeset
   424
void Dictionary::add_klass(symbolHandle class_name, Handle class_loader,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   425
                           KlassHandle obj) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   426
  assert_locked_or_safepoint(SystemDictionary_lock);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   427
  assert(obj() != NULL, "adding NULL obj");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   428
  assert(Klass::cast(obj())->name() == class_name(), "sanity check on name");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   429
489c9b5090e2 Initial load
duke
parents:
diff changeset
   430
  unsigned int hash = compute_hash(class_name, class_loader);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   431
  int index = hash_to_index(hash);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   432
  DictionaryEntry* entry = new_entry(hash, obj(), class_loader());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   433
  add_entry(index, entry);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   434
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   435
489c9b5090e2 Initial load
duke
parents:
diff changeset
   436
489c9b5090e2 Initial load
duke
parents:
diff changeset
   437
// This routine does not lock the system dictionary.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   438
//
489c9b5090e2 Initial load
duke
parents:
diff changeset
   439
// Since readers don't hold a lock, we must make sure that system
489c9b5090e2 Initial load
duke
parents:
diff changeset
   440
// dictionary entries are only removed at a safepoint (when only one
489c9b5090e2 Initial load
duke
parents:
diff changeset
   441
// thread is running), and are added to in a safe way (all links must
489c9b5090e2 Initial load
duke
parents:
diff changeset
   442
// be updated in an MT-safe manner).
489c9b5090e2 Initial load
duke
parents:
diff changeset
   443
//
489c9b5090e2 Initial load
duke
parents:
diff changeset
   444
// Callers should be aware that an entry could be added just after
489c9b5090e2 Initial load
duke
parents:
diff changeset
   445
// _buckets[index] is read here, so the caller will not see the new entry.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   446
DictionaryEntry* Dictionary::get_entry(int index, unsigned int hash,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   447
                                       symbolHandle class_name,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   448
                                       Handle class_loader) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   449
  symbolOop name_ = class_name();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   450
  oop loader_ = class_loader();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   451
  debug_only(_lookup_count++);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   452
  for (DictionaryEntry* entry = bucket(index);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   453
                        entry != NULL;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   454
                        entry = entry->next()) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   455
    if (entry->hash() == hash && entry->equals(name_, loader_)) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   456
      return entry;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   457
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   458
    debug_only(_lookup_length++);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   459
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   460
  return NULL;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   461
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   462
489c9b5090e2 Initial load
duke
parents:
diff changeset
   463
489c9b5090e2 Initial load
duke
parents:
diff changeset
   464
klassOop Dictionary::find(int index, unsigned int hash, symbolHandle name,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   465
                          Handle loader, Handle protection_domain, TRAPS) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   466
  DictionaryEntry* entry = get_entry(index, hash, name, loader);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   467
  if (entry != NULL && entry->is_valid_protection_domain(protection_domain)) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   468
    return entry->klass();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   469
  } else {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   470
    return NULL;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   471
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   472
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   473
489c9b5090e2 Initial load
duke
parents:
diff changeset
   474
489c9b5090e2 Initial load
duke
parents:
diff changeset
   475
klassOop Dictionary::find_class(int index, unsigned int hash,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   476
                                symbolHandle name, Handle loader) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   477
  assert_locked_or_safepoint(SystemDictionary_lock);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   478
  assert (index == index_for(name, loader), "incorrect index?");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   479
489c9b5090e2 Initial load
duke
parents:
diff changeset
   480
  DictionaryEntry* entry = get_entry(index, hash, name, loader);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   481
  return (entry != NULL) ? entry->klass() : (klassOop)NULL;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   482
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   483
489c9b5090e2 Initial load
duke
parents:
diff changeset
   484
489c9b5090e2 Initial load
duke
parents:
diff changeset
   485
// Variant of find_class for shared classes.  No locking required, as
489c9b5090e2 Initial load
duke
parents:
diff changeset
   486
// that table is static.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   487
489c9b5090e2 Initial load
duke
parents:
diff changeset
   488
klassOop Dictionary::find_shared_class(int index, unsigned int hash,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   489
                                       symbolHandle name) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   490
  assert (index == index_for(name, Handle()), "incorrect index?");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   491
489c9b5090e2 Initial load
duke
parents:
diff changeset
   492
  DictionaryEntry* entry = get_entry(index, hash, name, Handle());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   493
  return (entry != NULL) ? entry->klass() : (klassOop)NULL;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   494
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   495
489c9b5090e2 Initial load
duke
parents:
diff changeset
   496
489c9b5090e2 Initial load
duke
parents:
diff changeset
   497
void Dictionary::add_protection_domain(int index, unsigned int hash,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   498
                                       instanceKlassHandle klass,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   499
                                       Handle loader, Handle protection_domain,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   500
                                       TRAPS) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   501
  symbolHandle klass_name(THREAD, klass->name());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   502
  DictionaryEntry* entry = get_entry(index, hash, klass_name, loader);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   503
489c9b5090e2 Initial load
duke
parents:
diff changeset
   504
  assert(entry != NULL,"entry must be present, we just created it");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   505
  assert(protection_domain() != NULL,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   506
         "real protection domain should be present");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   507
489c9b5090e2 Initial load
duke
parents:
diff changeset
   508
  entry->add_protection_domain(protection_domain());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   509
489c9b5090e2 Initial load
duke
parents:
diff changeset
   510
  assert(entry->contains_protection_domain(protection_domain()),
489c9b5090e2 Initial load
duke
parents:
diff changeset
   511
         "now protection domain should be present");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   512
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   513
489c9b5090e2 Initial load
duke
parents:
diff changeset
   514
489c9b5090e2 Initial load
duke
parents:
diff changeset
   515
bool Dictionary::is_valid_protection_domain(int index, unsigned int hash,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   516
                                            symbolHandle name,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   517
                                            Handle loader,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   518
                                            Handle protection_domain) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   519
  DictionaryEntry* entry = get_entry(index, hash, name, loader);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   520
  return entry->is_valid_protection_domain(protection_domain);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   521
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   522
489c9b5090e2 Initial load
duke
parents:
diff changeset
   523
489c9b5090e2 Initial load
duke
parents:
diff changeset
   524
void Dictionary::reorder_dictionary() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   525
489c9b5090e2 Initial load
duke
parents:
diff changeset
   526
  // Copy all the dictionary entries into a single master list.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   527
489c9b5090e2 Initial load
duke
parents:
diff changeset
   528
  DictionaryEntry* master_list = NULL;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   529
  for (int i = 0; i < table_size(); ++i) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   530
    DictionaryEntry* p = bucket(i);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   531
    while (p != NULL) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   532
      DictionaryEntry* tmp;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   533
      tmp = p->next();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   534
      p->set_next(master_list);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   535
      master_list = p;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   536
      p = tmp;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   537
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   538
    set_entry(i, NULL);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   539
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   540
489c9b5090e2 Initial load
duke
parents:
diff changeset
   541
  // Add the dictionary entries back to the list in the correct buckets.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   542
  Thread *thread = Thread::current();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   543
489c9b5090e2 Initial load
duke
parents:
diff changeset
   544
  while (master_list != NULL) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   545
    DictionaryEntry* p = master_list;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   546
    master_list = master_list->next();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   547
    p->set_next(NULL);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   548
    symbolHandle class_name (thread, instanceKlass::cast((klassOop)(p->klass()))->name());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   549
    unsigned int hash = compute_hash(class_name, Handle(thread, p->loader()));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   550
    int index = hash_to_index(hash);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   551
    p->set_hash(hash);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   552
    p->set_next(bucket(index));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   553
    set_entry(index, p);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   554
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   555
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   556
2534
08dac9ce0cd7 6655638: dynamic languages need method handles
jrose
parents: 670
diff changeset
   557
SymbolPropertyTable::SymbolPropertyTable(int table_size)
08dac9ce0cd7 6655638: dynamic languages need method handles
jrose
parents: 670
diff changeset
   558
  : Hashtable(table_size, sizeof(SymbolPropertyEntry))
08dac9ce0cd7 6655638: dynamic languages need method handles
jrose
parents: 670
diff changeset
   559
{
08dac9ce0cd7 6655638: dynamic languages need method handles
jrose
parents: 670
diff changeset
   560
}
08dac9ce0cd7 6655638: dynamic languages need method handles
jrose
parents: 670
diff changeset
   561
SymbolPropertyTable::SymbolPropertyTable(int table_size, HashtableBucket* t,
08dac9ce0cd7 6655638: dynamic languages need method handles
jrose
parents: 670
diff changeset
   562
                                         int number_of_entries)
08dac9ce0cd7 6655638: dynamic languages need method handles
jrose
parents: 670
diff changeset
   563
  : Hashtable(table_size, sizeof(SymbolPropertyEntry), t, number_of_entries)
08dac9ce0cd7 6655638: dynamic languages need method handles
jrose
parents: 670
diff changeset
   564
{
08dac9ce0cd7 6655638: dynamic languages need method handles
jrose
parents: 670
diff changeset
   565
}
08dac9ce0cd7 6655638: dynamic languages need method handles
jrose
parents: 670
diff changeset
   566
08dac9ce0cd7 6655638: dynamic languages need method handles
jrose
parents: 670
diff changeset
   567
08dac9ce0cd7 6655638: dynamic languages need method handles
jrose
parents: 670
diff changeset
   568
SymbolPropertyEntry* SymbolPropertyTable::find_entry(int index, unsigned int hash,
5420
586d3988e72b 6939134: JSR 292 adjustments to method handle invocation
jrose
parents: 2534
diff changeset
   569
                                                     symbolHandle sym,
586d3988e72b 6939134: JSR 292 adjustments to method handle invocation
jrose
parents: 2534
diff changeset
   570
                                                     intptr_t sym_mode) {
586d3988e72b 6939134: JSR 292 adjustments to method handle invocation
jrose
parents: 2534
diff changeset
   571
  assert(index == index_for(sym, sym_mode), "incorrect index?");
2534
08dac9ce0cd7 6655638: dynamic languages need method handles
jrose
parents: 670
diff changeset
   572
  for (SymbolPropertyEntry* p = bucket(index); p != NULL; p = p->next()) {
5420
586d3988e72b 6939134: JSR 292 adjustments to method handle invocation
jrose
parents: 2534
diff changeset
   573
    if (p->hash() == hash && p->symbol() == sym() && p->symbol_mode() == sym_mode) {
2534
08dac9ce0cd7 6655638: dynamic languages need method handles
jrose
parents: 670
diff changeset
   574
      return p;
08dac9ce0cd7 6655638: dynamic languages need method handles
jrose
parents: 670
diff changeset
   575
    }
08dac9ce0cd7 6655638: dynamic languages need method handles
jrose
parents: 670
diff changeset
   576
  }
08dac9ce0cd7 6655638: dynamic languages need method handles
jrose
parents: 670
diff changeset
   577
  return NULL;
08dac9ce0cd7 6655638: dynamic languages need method handles
jrose
parents: 670
diff changeset
   578
}
08dac9ce0cd7 6655638: dynamic languages need method handles
jrose
parents: 670
diff changeset
   579
08dac9ce0cd7 6655638: dynamic languages need method handles
jrose
parents: 670
diff changeset
   580
08dac9ce0cd7 6655638: dynamic languages need method handles
jrose
parents: 670
diff changeset
   581
SymbolPropertyEntry* SymbolPropertyTable::add_entry(int index, unsigned int hash,
5420
586d3988e72b 6939134: JSR 292 adjustments to method handle invocation
jrose
parents: 2534
diff changeset
   582
                                                    symbolHandle sym, intptr_t sym_mode) {
2534
08dac9ce0cd7 6655638: dynamic languages need method handles
jrose
parents: 670
diff changeset
   583
  assert_locked_or_safepoint(SystemDictionary_lock);
5420
586d3988e72b 6939134: JSR 292 adjustments to method handle invocation
jrose
parents: 2534
diff changeset
   584
  assert(index == index_for(sym, sym_mode), "incorrect index?");
586d3988e72b 6939134: JSR 292 adjustments to method handle invocation
jrose
parents: 2534
diff changeset
   585
  assert(find_entry(index, hash, sym, sym_mode) == NULL, "no double entry");
2534
08dac9ce0cd7 6655638: dynamic languages need method handles
jrose
parents: 670
diff changeset
   586
5420
586d3988e72b 6939134: JSR 292 adjustments to method handle invocation
jrose
parents: 2534
diff changeset
   587
  SymbolPropertyEntry* p = new_entry(hash, sym(), sym_mode);
2534
08dac9ce0cd7 6655638: dynamic languages need method handles
jrose
parents: 670
diff changeset
   588
  Hashtable::add_entry(index, p);
08dac9ce0cd7 6655638: dynamic languages need method handles
jrose
parents: 670
diff changeset
   589
  return p;
08dac9ce0cd7 6655638: dynamic languages need method handles
jrose
parents: 670
diff changeset
   590
}
08dac9ce0cd7 6655638: dynamic languages need method handles
jrose
parents: 670
diff changeset
   591
08dac9ce0cd7 6655638: dynamic languages need method handles
jrose
parents: 670
diff changeset
   592
08dac9ce0cd7 6655638: dynamic languages need method handles
jrose
parents: 670
diff changeset
   593
void SymbolPropertyTable::oops_do(OopClosure* f) {
08dac9ce0cd7 6655638: dynamic languages need method handles
jrose
parents: 670
diff changeset
   594
  for (int index = 0; index < table_size(); index++) {
08dac9ce0cd7 6655638: dynamic languages need method handles
jrose
parents: 670
diff changeset
   595
    for (SymbolPropertyEntry* p = bucket(index); p != NULL; p = p->next()) {
08dac9ce0cd7 6655638: dynamic languages need method handles
jrose
parents: 670
diff changeset
   596
      f->do_oop((oop*) p->symbol_addr());
08dac9ce0cd7 6655638: dynamic languages need method handles
jrose
parents: 670
diff changeset
   597
      if (p->property_oop() != NULL) {
08dac9ce0cd7 6655638: dynamic languages need method handles
jrose
parents: 670
diff changeset
   598
        f->do_oop(p->property_oop_addr());
08dac9ce0cd7 6655638: dynamic languages need method handles
jrose
parents: 670
diff changeset
   599
      }
08dac9ce0cd7 6655638: dynamic languages need method handles
jrose
parents: 670
diff changeset
   600
    }
08dac9ce0cd7 6655638: dynamic languages need method handles
jrose
parents: 670
diff changeset
   601
  }
08dac9ce0cd7 6655638: dynamic languages need method handles
jrose
parents: 670
diff changeset
   602
}
08dac9ce0cd7 6655638: dynamic languages need method handles
jrose
parents: 670
diff changeset
   603
08dac9ce0cd7 6655638: dynamic languages need method handles
jrose
parents: 670
diff changeset
   604
void SymbolPropertyTable::methods_do(void f(methodOop)) {
08dac9ce0cd7 6655638: dynamic languages need method handles
jrose
parents: 670
diff changeset
   605
  for (int index = 0; index < table_size(); index++) {
08dac9ce0cd7 6655638: dynamic languages need method handles
jrose
parents: 670
diff changeset
   606
    for (SymbolPropertyEntry* p = bucket(index); p != NULL; p = p->next()) {
08dac9ce0cd7 6655638: dynamic languages need method handles
jrose
parents: 670
diff changeset
   607
      oop prop = p->property_oop();
08dac9ce0cd7 6655638: dynamic languages need method handles
jrose
parents: 670
diff changeset
   608
      if (prop != NULL && prop->is_method()) {
08dac9ce0cd7 6655638: dynamic languages need method handles
jrose
parents: 670
diff changeset
   609
        f((methodOop)prop);
08dac9ce0cd7 6655638: dynamic languages need method handles
jrose
parents: 670
diff changeset
   610
      }
08dac9ce0cd7 6655638: dynamic languages need method handles
jrose
parents: 670
diff changeset
   611
    }
08dac9ce0cd7 6655638: dynamic languages need method handles
jrose
parents: 670
diff changeset
   612
  }
08dac9ce0cd7 6655638: dynamic languages need method handles
jrose
parents: 670
diff changeset
   613
}
08dac9ce0cd7 6655638: dynamic languages need method handles
jrose
parents: 670
diff changeset
   614
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   615
489c9b5090e2 Initial load
duke
parents:
diff changeset
   616
// ----------------------------------------------------------------------------
489c9b5090e2 Initial load
duke
parents:
diff changeset
   617
#ifndef PRODUCT
489c9b5090e2 Initial load
duke
parents:
diff changeset
   618
489c9b5090e2 Initial load
duke
parents:
diff changeset
   619
void Dictionary::print() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   620
  ResourceMark rm;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   621
  HandleMark   hm;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   622
489c9b5090e2 Initial load
duke
parents:
diff changeset
   623
  tty->print_cr("Java system dictionary (classes=%d)", number_of_entries());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   624
  tty->print_cr("^ indicates that initiating loader is different from "
489c9b5090e2 Initial load
duke
parents:
diff changeset
   625
                "defining loader");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   626
489c9b5090e2 Initial load
duke
parents:
diff changeset
   627
  for (int index = 0; index < table_size(); index++) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   628
    for (DictionaryEntry* probe = bucket(index);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   629
                          probe != NULL;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   630
                          probe = probe->next()) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   631
      if (Verbose) tty->print("%4d: ", index);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   632
      klassOop e = probe->klass();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   633
      oop class_loader =  probe->loader();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   634
      bool is_defining_class =
489c9b5090e2 Initial load
duke
parents:
diff changeset
   635
         (class_loader == instanceKlass::cast(e)->class_loader());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   636
      tty->print("%s%s", is_defining_class ? " " : "^",
489c9b5090e2 Initial load
duke
parents:
diff changeset
   637
                   Klass::cast(e)->external_name());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   638
      if (class_loader != NULL) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   639
        tty->print(", loader ");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   640
        class_loader->print_value();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   641
      }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   642
      tty->cr();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   643
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   644
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   645
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   646
489c9b5090e2 Initial load
duke
parents:
diff changeset
   647
#endif
489c9b5090e2 Initial load
duke
parents:
diff changeset
   648
489c9b5090e2 Initial load
duke
parents:
diff changeset
   649
void Dictionary::verify() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   650
  guarantee(number_of_entries() >= 0, "Verify of system dictionary failed");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   651
  int element_count = 0;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   652
  for (int index = 0; index < table_size(); index++) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   653
    for (DictionaryEntry* probe = bucket(index);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   654
                          probe != NULL;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   655
                          probe = probe->next()) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   656
      klassOop e = probe->klass();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   657
      oop class_loader = probe->loader();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   658
      guarantee(Klass::cast(e)->oop_is_instance(),
489c9b5090e2 Initial load
duke
parents:
diff changeset
   659
                              "Verify of system dictionary failed");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   660
      // class loader must be present;  a null class loader is the
489c9b5090e2 Initial load
duke
parents:
diff changeset
   661
      // boostrap loader
489c9b5090e2 Initial load
duke
parents:
diff changeset
   662
      guarantee(class_loader == NULL || class_loader->is_instance(),
489c9b5090e2 Initial load
duke
parents:
diff changeset
   663
                "checking type of class_loader");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   664
      e->verify();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   665
      probe->verify_protection_domain_set();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   666
      element_count++;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   667
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   668
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   669
  guarantee(number_of_entries() == element_count,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   670
            "Verify of system dictionary failed");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   671
  debug_only(verify_lookup_length((double)number_of_entries() / table_size()));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   672
}