comparison src/share/vm/classfile/dictionary.cpp @ 6197:d2a62e0f25eb

6995781: Native Memory Tracking (Phase 1) 7151532: DCmd for hotspot native memory tracking Summary: Implementation of native memory tracking phase 1, which tracks VM native memory usage, and related DCmd Reviewed-by: acorn, coleenp, fparain
author zgu
date Thu, 28 Jun 2012 17:03:16 -0400
parents b2cd0ee8f778
children da91efe96a93
comparison
equal deleted inserted replaced
6174:74533f63b116 6197:d2a62e0f25eb
34 DictionaryEntry* Dictionary::_current_class_entry = NULL; 34 DictionaryEntry* Dictionary::_current_class_entry = NULL;
35 int Dictionary::_current_class_index = 0; 35 int Dictionary::_current_class_index = 0;
36 36
37 37
38 Dictionary::Dictionary(int table_size) 38 Dictionary::Dictionary(int table_size)
39 : TwoOopHashtable<klassOop>(table_size, sizeof(DictionaryEntry)) { 39 : TwoOopHashtable<klassOop, mtClass>(table_size, sizeof(DictionaryEntry)) {
40 _current_class_index = 0; 40 _current_class_index = 0;
41 _current_class_entry = NULL; 41 _current_class_entry = NULL;
42 }; 42 };
43 43
44 44
45 45
46 Dictionary::Dictionary(int table_size, HashtableBucket* t, 46 Dictionary::Dictionary(int table_size, HashtableBucket<mtClass>* t,
47 int number_of_entries) 47 int number_of_entries)
48 : TwoOopHashtable<klassOop>(table_size, sizeof(DictionaryEntry), t, number_of_entries) { 48 : TwoOopHashtable<klassOop, mtClass>(table_size, sizeof(DictionaryEntry), t, number_of_entries) {
49 _current_class_index = 0; 49 _current_class_index = 0;
50 _current_class_entry = NULL; 50 _current_class_entry = NULL;
51 }; 51 };
52 52
53 53
54 DictionaryEntry* Dictionary::new_entry(unsigned int hash, klassOop klass, 54 DictionaryEntry* Dictionary::new_entry(unsigned int hash, klassOop klass,
55 oop loader) { 55 oop loader) {
56 DictionaryEntry* entry; 56 DictionaryEntry* entry;
57 entry = (DictionaryEntry*)Hashtable<klassOop>::new_entry(hash, klass); 57 entry = (DictionaryEntry*)Hashtable<klassOop, mtClass>::new_entry(hash, klass);
58 entry->set_loader(loader); 58 entry->set_loader(loader);
59 entry->set_pd_set(NULL); 59 entry->set_pd_set(NULL);
60 return entry; 60 return entry;
61 } 61 }
62 62
63 63
64 DictionaryEntry* Dictionary::new_entry() { 64 DictionaryEntry* Dictionary::new_entry() {
65 DictionaryEntry* entry = (DictionaryEntry*)Hashtable<klassOop>::new_entry(0L, NULL); 65 DictionaryEntry* entry = (DictionaryEntry*)Hashtable<klassOop, mtClass>::new_entry(0L, NULL);
66 entry->set_loader(NULL); 66 entry->set_loader(NULL);
67 entry->set_pd_set(NULL); 67 entry->set_pd_set(NULL);
68 return entry; 68 return entry;
69 } 69 }
70 70
74 while (entry->pd_set() != NULL) { 74 while (entry->pd_set() != NULL) {
75 ProtectionDomainEntry* to_delete = entry->pd_set(); 75 ProtectionDomainEntry* to_delete = entry->pd_set();
76 entry->set_pd_set(to_delete->next()); 76 entry->set_pd_set(to_delete->next());
77 delete to_delete; 77 delete to_delete;
78 } 78 }
79 Hashtable<klassOop>::free_entry(entry); 79 Hashtable<klassOop, mtClass>::free_entry(entry);
80 } 80 }
81 81
82 82
83 bool DictionaryEntry::contains_protection_domain(oop protection_domain) const { 83 bool DictionaryEntry::contains_protection_domain(oop protection_domain) const {
84 #ifdef ASSERT 84 #ifdef ASSERT
552 set_entry(index, p); 552 set_entry(index, p);
553 } 553 }
554 } 554 }
555 555
556 SymbolPropertyTable::SymbolPropertyTable(int table_size) 556 SymbolPropertyTable::SymbolPropertyTable(int table_size)
557 : Hashtable<Symbol*>(table_size, sizeof(SymbolPropertyEntry)) 557 : Hashtable<Symbol*, mtSymbol>(table_size, sizeof(SymbolPropertyEntry))
558 { 558 {
559 } 559 }
560 SymbolPropertyTable::SymbolPropertyTable(int table_size, HashtableBucket* t, 560 SymbolPropertyTable::SymbolPropertyTable(int table_size, HashtableBucket<mtSymbol>* t,
561 int number_of_entries) 561 int number_of_entries)
562 : Hashtable<Symbol*>(table_size, sizeof(SymbolPropertyEntry), t, number_of_entries) 562 : Hashtable<Symbol*, mtSymbol>(table_size, sizeof(SymbolPropertyEntry), t, number_of_entries)
563 { 563 {
564 } 564 }
565 565
566 566
567 SymbolPropertyEntry* SymbolPropertyTable::find_entry(int index, unsigned int hash, 567 SymbolPropertyEntry* SymbolPropertyTable::find_entry(int index, unsigned int hash,
582 assert_locked_or_safepoint(SystemDictionary_lock); 582 assert_locked_or_safepoint(SystemDictionary_lock);
583 assert(index == index_for(sym, sym_mode), "incorrect index?"); 583 assert(index == index_for(sym, sym_mode), "incorrect index?");
584 assert(find_entry(index, hash, sym, sym_mode) == NULL, "no double entry"); 584 assert(find_entry(index, hash, sym, sym_mode) == NULL, "no double entry");
585 585
586 SymbolPropertyEntry* p = new_entry(hash, sym, sym_mode); 586 SymbolPropertyEntry* p = new_entry(hash, sym, sym_mode);
587 Hashtable<Symbol*>::add_entry(index, p); 587 Hashtable<Symbol*, mtSymbol>::add_entry(index, p);
588 return p; 588 return p;
589 } 589 }
590 590
591 591
592 void SymbolPropertyTable::oops_do(OopClosure* f) { 592 void SymbolPropertyTable::oops_do(OopClosure* f) {