1.1 --- a/src/share/vm/classfile/dictionary.cpp Wed Apr 08 00:12:59 2009 -0700 1.2 +++ b/src/share/vm/classfile/dictionary.cpp Wed Apr 08 10:56:49 2009 -0700 1.3 @@ -1,5 +1,5 @@ 1.4 /* 1.5 - * Copyright 2003-2008 Sun Microsystems, Inc. All Rights Reserved. 1.6 + * Copyright 2003-2009 Sun Microsystems, Inc. All Rights Reserved. 1.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 1.8 * 1.9 * This code is free software; you can redistribute it and/or modify it 1.10 @@ -549,6 +549,63 @@ 1.11 } 1.12 } 1.13 1.14 +SymbolPropertyTable::SymbolPropertyTable(int table_size) 1.15 + : Hashtable(table_size, sizeof(SymbolPropertyEntry)) 1.16 +{ 1.17 +} 1.18 +SymbolPropertyTable::SymbolPropertyTable(int table_size, HashtableBucket* t, 1.19 + int number_of_entries) 1.20 + : Hashtable(table_size, sizeof(SymbolPropertyEntry), t, number_of_entries) 1.21 +{ 1.22 +} 1.23 + 1.24 + 1.25 +SymbolPropertyEntry* SymbolPropertyTable::find_entry(int index, unsigned int hash, 1.26 + symbolHandle sym) { 1.27 + assert(index == index_for(sym), "incorrect index?"); 1.28 + for (SymbolPropertyEntry* p = bucket(index); p != NULL; p = p->next()) { 1.29 + if (p->hash() == hash && p->symbol() == sym()) { 1.30 + return p; 1.31 + } 1.32 + } 1.33 + return NULL; 1.34 +} 1.35 + 1.36 + 1.37 +SymbolPropertyEntry* SymbolPropertyTable::add_entry(int index, unsigned int hash, 1.38 + symbolHandle sym) { 1.39 + assert_locked_or_safepoint(SystemDictionary_lock); 1.40 + assert(index == index_for(sym), "incorrect index?"); 1.41 + assert(find_entry(index, hash, sym) == NULL, "no double entry"); 1.42 + 1.43 + SymbolPropertyEntry* p = new_entry(hash, sym()); 1.44 + Hashtable::add_entry(index, p); 1.45 + return p; 1.46 +} 1.47 + 1.48 + 1.49 +void SymbolPropertyTable::oops_do(OopClosure* f) { 1.50 + for (int index = 0; index < table_size(); index++) { 1.51 + for (SymbolPropertyEntry* p = bucket(index); p != NULL; p = p->next()) { 1.52 + f->do_oop((oop*) p->symbol_addr()); 1.53 + if (p->property_oop() != NULL) { 1.54 + f->do_oop(p->property_oop_addr()); 1.55 + } 1.56 + } 1.57 + } 1.58 +} 1.59 + 1.60 +void SymbolPropertyTable::methods_do(void f(methodOop)) { 1.61 + for (int index = 0; index < table_size(); index++) { 1.62 + for (SymbolPropertyEntry* p = bucket(index); p != NULL; p = p->next()) { 1.63 + oop prop = p->property_oop(); 1.64 + if (prop != NULL && prop->is_method()) { 1.65 + f((methodOop)prop); 1.66 + } 1.67 + } 1.68 + } 1.69 +} 1.70 + 1.71 1.72 // ---------------------------------------------------------------------------- 1.73 #ifndef PRODUCT