Mercurial > hg > graal-compiler
diff src/share/vm/utilities/hashtable.inline.hpp @ 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 | e9140bf80b4a |
children | ce8f6bb717c9 |
line wrap: on
line diff
--- a/src/share/vm/utilities/hashtable.inline.hpp Wed Jun 27 15:23:36 2012 +0200 +++ b/src/share/vm/utilities/hashtable.inline.hpp Thu Jun 28 17:03:16 2012 -0400 @@ -27,6 +27,7 @@ #include "memory/allocation.inline.hpp" #include "utilities/hashtable.hpp" +#include "utilities/dtrace.hpp" // Inline function definitions for hashtable.hpp. @@ -34,18 +35,18 @@ // Initialize a table. -inline BasicHashtable::BasicHashtable(int table_size, int entry_size) { +template <MEMFLAGS F> inline BasicHashtable<F>::BasicHashtable(int table_size, int entry_size) { // Called on startup, no locking needed initialize(table_size, entry_size, 0); - _buckets = NEW_C_HEAP_ARRAY(HashtableBucket, table_size); + _buckets = NEW_C_HEAP_ARRAY2(HashtableBucket<F>, table_size, F, CURRENT_PC); for (int index = 0; index < _table_size; index++) { _buckets[index].clear(); } } -inline BasicHashtable::BasicHashtable(int table_size, int entry_size, - HashtableBucket* buckets, +template <MEMFLAGS F> inline BasicHashtable<F>::BasicHashtable(int table_size, int entry_size, + HashtableBucket<F>* buckets, int number_of_entries) { // Called on startup, no locking needed initialize(table_size, entry_size, number_of_entries); @@ -53,7 +54,7 @@ } -inline void BasicHashtable::initialize(int table_size, int entry_size, +template <MEMFLAGS F> inline void BasicHashtable<F>::initialize(int table_size, int entry_size, int number_of_entries) { // Called on startup, no locking needed _table_size = table_size; @@ -70,12 +71,12 @@ // The following method is MT-safe and may be used with caution. -inline BasicHashtableEntry* BasicHashtable::bucket(int i) { +template <MEMFLAGS F> inline BasicHashtableEntry<F>* BasicHashtable<F>::bucket(int i) { return _buckets[i].get_entry(); } -inline void HashtableBucket::set_entry(BasicHashtableEntry* l) { +template <MEMFLAGS F> inline void HashtableBucket<F>::set_entry(BasicHashtableEntry<F>* l) { // Warning: Preserve store ordering. The SystemDictionary is read // without locks. The new SystemDictionaryEntry must be // complete before other threads can be allowed to see it @@ -84,27 +85,27 @@ } -inline BasicHashtableEntry* HashtableBucket::get_entry() const { +template <MEMFLAGS F> inline BasicHashtableEntry<F>* HashtableBucket<F>::get_entry() const { // Warning: Preserve load ordering. The SystemDictionary is read // without locks. The new SystemDictionaryEntry must be // complete before other threads can be allowed to see it // via a store to _buckets[index]. - return (BasicHashtableEntry*) OrderAccess::load_ptr_acquire(&_entry); + return (BasicHashtableEntry<F>*) OrderAccess::load_ptr_acquire(&_entry); } -inline void BasicHashtable::set_entry(int index, BasicHashtableEntry* entry) { +template <MEMFLAGS F> inline void BasicHashtable<F>::set_entry(int index, BasicHashtableEntry<F>* entry) { _buckets[index].set_entry(entry); } -inline void BasicHashtable::add_entry(int index, BasicHashtableEntry* entry) { +template <MEMFLAGS F> inline void BasicHashtable<F>::add_entry(int index, BasicHashtableEntry<F>* entry) { entry->set_next(bucket(index)); _buckets[index].set_entry(entry); ++_number_of_entries; } -inline void BasicHashtable::free_entry(BasicHashtableEntry* entry) { +template <MEMFLAGS F> inline void BasicHashtable<F>::free_entry(BasicHashtableEntry<F>* entry) { entry->set_next(_free_list); _free_list = entry; --_number_of_entries;