245 static inline unsigned int hash_to_index(unsigned int hash) { |
245 static inline unsigned int hash_to_index(unsigned int hash) { |
246 return (hash % table_size); |
246 return (hash % table_size); |
247 } |
247 } |
248 |
248 |
249 static inline const NativeCallStack* hash_entry_allocation_stack() { |
249 static inline const NativeCallStack* hash_entry_allocation_stack() { |
250 return (NativeCallStack*)_hash_entry_allocation_stack; |
250 assert(_hash_entry_allocation_stack != NULL, "Must be set"); |
|
251 return _hash_entry_allocation_stack; |
|
252 } |
|
253 |
|
254 static inline const MallocSiteHashtableEntry* hash_entry_allocation_site() { |
|
255 assert(_hash_entry_allocation_site != NULL, "Must be set"); |
|
256 return _hash_entry_allocation_site; |
251 } |
257 } |
252 |
258 |
253 private: |
259 private: |
254 // Counter for counting concurrent access |
260 // Counter for counting concurrent access |
255 static volatile int _access_count; |
261 static volatile int _access_count; |
256 |
262 |
257 // The callsite hashtable. It has to be a static table, |
263 // The callsite hashtable. It has to be a static table, |
258 // since malloc call can come from C runtime linker. |
264 // since malloc call can come from C runtime linker. |
259 static MallocSiteHashtableEntry* _table[table_size]; |
265 static MallocSiteHashtableEntry* _table[table_size]; |
260 |
266 static const NativeCallStack* _hash_entry_allocation_stack; |
261 |
267 static const MallocSiteHashtableEntry* _hash_entry_allocation_site; |
262 // Reserve enough memory for placing the objects |
268 |
263 |
269 |
264 // The memory for hashtable entry allocation stack object |
|
265 static size_t _hash_entry_allocation_stack[CALC_OBJ_SIZE_IN_TYPE(NativeCallStack, size_t)]; |
|
266 // The memory for hashtable entry allocation callsite object |
|
267 static size_t _hash_entry_allocation_site[CALC_OBJ_SIZE_IN_TYPE(MallocSiteHashtableEntry, size_t)]; |
|
268 NOT_PRODUCT(static int _peak_count;) |
270 NOT_PRODUCT(static int _peak_count;) |
269 }; |
271 }; |
270 |
272 |
271 #endif // INCLUDE_NMT |
273 #endif // INCLUDE_NMT |
272 #endif // SHARE_VM_SERVICES_MALLOC_SITE_TABLE_HPP |
274 #endif // SHARE_VM_SERVICES_MALLOC_SITE_TABLE_HPP |