src/share/vm/classfile/resolutionErrors.cpp

Mon, 27 May 2013 12:56:34 +0200

author
stefank
date
Mon, 27 May 2013 12:56:34 +0200
changeset 5195
95c00927be11
parent 4037
da91efe96a93
child 6876
710a3c8b516e
child 9966
baf9f57c9b46
permissions
-rw-r--r--

8015428: Remove unused CDS support from StringTable
Summary: The string in StringTable is not used by CDS anymore. Remove the unnecessary code in preparation for 8015422: Large performance hit when the StringTable is walked twice in Parallel Scavenge
Reviewed-by: pliden, tschatzl, coleenp

duke@435 1 /*
coleenp@4037 2 * Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved.
duke@435 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
duke@435 4 *
duke@435 5 * This code is free software; you can redistribute it and/or modify it
duke@435 6 * under the terms of the GNU General Public License version 2 only, as
duke@435 7 * published by the Free Software Foundation.
duke@435 8 *
duke@435 9 * This code is distributed in the hope that it will be useful, but WITHOUT
duke@435 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
duke@435 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
duke@435 12 * version 2 for more details (a copy is included in the LICENSE file that
duke@435 13 * accompanied this code).
duke@435 14 *
duke@435 15 * You should have received a copy of the GNU General Public License version
duke@435 16 * 2 along with this work; if not, write to the Free Software Foundation,
duke@435 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
duke@435 18 *
trims@1907 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
trims@1907 20 * or visit www.oracle.com if you need additional information or have any
trims@1907 21 * questions.
duke@435 22 *
duke@435 23 */
duke@435 24
stefank@2314 25 #include "precompiled.hpp"
stefank@2314 26 #include "classfile/resolutionErrors.hpp"
stefank@2314 27 #include "memory/resourceArea.hpp"
stefank@2314 28 #include "oops/oop.inline.hpp"
stefank@2314 29 #include "runtime/handles.inline.hpp"
stefank@2314 30 #include "runtime/safepoint.hpp"
stefank@2314 31 #include "utilities/hashtable.inline.hpp"
duke@435 32
duke@435 33 // add new entry to the table
duke@435 34 void ResolutionErrorTable::add_entry(int index, unsigned int hash,
coleenp@2497 35 constantPoolHandle pool, int cp_index, Symbol* error)
duke@435 36 {
duke@435 37 assert_locked_or_safepoint(SystemDictionary_lock);
coleenp@2497 38 assert(!pool.is_null() && error != NULL, "adding NULL obj");
duke@435 39
coleenp@2497 40 ResolutionErrorEntry* entry = new_entry(hash, pool(), cp_index, error);
duke@435 41 add_entry(index, entry);
duke@435 42 }
duke@435 43
duke@435 44 // find entry in the table
duke@435 45 ResolutionErrorEntry* ResolutionErrorTable::find_entry(int index, unsigned int hash,
duke@435 46 constantPoolHandle pool, int cp_index)
duke@435 47 {
duke@435 48 assert_locked_or_safepoint(SystemDictionary_lock);
duke@435 49
duke@435 50 for (ResolutionErrorEntry *error_probe = bucket(index);
duke@435 51 error_probe != NULL;
duke@435 52 error_probe = error_probe->next()) {
duke@435 53 if (error_probe->hash() == hash && error_probe->pool() == pool()) {
duke@435 54 return error_probe;;
duke@435 55 }
duke@435 56 }
duke@435 57 return NULL;
duke@435 58 }
duke@435 59
coleenp@2497 60 void ResolutionErrorEntry::set_error(Symbol* e) {
coleenp@2497 61 assert(e == NULL || _error == NULL, "cannot reset error");
coleenp@2497 62 _error = e;
coleenp@2497 63 if (_error != NULL) _error->increment_refcount();
coleenp@2497 64 }
coleenp@2497 65
duke@435 66 // create new error entry
coleenp@4037 67 ResolutionErrorEntry* ResolutionErrorTable::new_entry(int hash, ConstantPool* pool,
coleenp@2497 68 int cp_index, Symbol* error)
duke@435 69 {
coleenp@4037 70 ResolutionErrorEntry* entry = (ResolutionErrorEntry*)Hashtable<ConstantPool*, mtClass>::new_entry(hash, pool);
duke@435 71 entry->set_cp_index(cp_index);
coleenp@2497 72 NOT_PRODUCT(entry->set_error(NULL);)
duke@435 73 entry->set_error(error);
duke@435 74
duke@435 75 return entry;
duke@435 76 }
duke@435 77
coleenp@2497 78 void ResolutionErrorTable::free_entry(ResolutionErrorEntry *entry) {
coleenp@2497 79 // decrement error refcount
coleenp@2497 80 assert(entry->error() != NULL, "error should be set");
coleenp@2497 81 entry->error()->decrement_refcount();
coleenp@4037 82 Hashtable<ConstantPool*, mtClass>::free_entry(entry);
coleenp@2497 83 }
coleenp@2497 84
coleenp@2497 85
duke@435 86 // create resolution error table
duke@435 87 ResolutionErrorTable::ResolutionErrorTable(int table_size)
coleenp@4037 88 : Hashtable<ConstantPool*, mtClass>(table_size, sizeof(ResolutionErrorEntry)) {
duke@435 89 }
duke@435 90
coleenp@4037 91 // RedefineClasses support - remove matching entry of a
coleenp@4037 92 // constant pool that is going away
coleenp@4037 93 void ResolutionErrorTable::delete_entry(ConstantPool* c) {
coleenp@4037 94 assert(SafepointSynchronize::is_at_safepoint(), "must be at safepoint");
duke@435 95 for (int i = 0; i < table_size(); i++) {
coleenp@4037 96 for (ResolutionErrorEntry** p = bucket_addr(i); *p != NULL; ) {
coleenp@4037 97 ResolutionErrorEntry* entry = *p;
coleenp@4037 98 assert(entry->pool() != NULL, "resolution error table is corrupt");
coleenp@4037 99 if (entry->pool() == c) {
coleenp@4037 100 *p = entry->next();
coleenp@4037 101 free_entry(entry);
coleenp@4037 102 } else {
coleenp@4037 103 p = entry->next_addr();
coleenp@4037 104 }
duke@435 105 }
duke@435 106 }
duke@435 107 }
duke@435 108
duke@435 109
duke@435 110 // Remove unloaded entries from the table
coleenp@4037 111 void ResolutionErrorTable::purge_resolution_errors() {
jcoomes@1844 112 assert(SafepointSynchronize::is_at_safepoint(), "must be at safepoint");
duke@435 113 for (int i = 0; i < table_size(); i++) {
duke@435 114 for (ResolutionErrorEntry** p = bucket_addr(i); *p != NULL; ) {
duke@435 115 ResolutionErrorEntry* entry = *p;
coleenp@4037 116 assert(entry->pool() != (ConstantPool*)NULL, "resolution error table is corrupt");
coleenp@4037 117 ConstantPool* pool = entry->pool();
coleenp@4037 118 assert(pool->pool_holder() != NULL, "Constant pool without a class?");
coleenp@4037 119 ClassLoaderData* loader_data =
coleenp@4037 120 pool->pool_holder()->class_loader_data();
coleenp@4037 121 if (!loader_data->is_unloading()) {
duke@435 122 p = entry->next_addr();
duke@435 123 } else {
duke@435 124 *p = entry->next();
duke@435 125 free_entry(entry);
duke@435 126 }
duke@435 127 }
duke@435 128 }
duke@435 129 }

mercurial