Mercurial > hg > truffle
annotate src/share/vm/utilities/hashtable.inline.hpp @ 20543:e7d0505c8a30
8059758: Footprint regressions with JDK-8038423
Summary: Changes in JDK-8038423 always initialize (zero out) virtual memory used for auxiliary data structures. This causes a footprint regression for G1 in startup benchmarks. This is because they do not touch that memory at all, so the operating system does not actually commit these pages. The fix is to, if the initialization value of the data structures matches the default value of just committed memory (=0), do not do anything.
Reviewed-by: jwilhelm, brutisso
author | tschatzl |
---|---|
date | Fri, 10 Oct 2014 15:51:58 +0200 |
parents | ce8f6bb717c9 |
children |
rev | line source |
---|---|
0 | 1 /* |
6162 | 2 * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved. |
0 | 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * | |
5 * This code is free software; you can redistribute it and/or modify it | |
6 * under the terms of the GNU General Public License version 2 only, as | |
7 * published by the Free Software Foundation. | |
8 * | |
9 * This code is distributed in the hope that it will be useful, but WITHOUT | |
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |
12 * version 2 for more details (a copy is included in the LICENSE file that | |
13 * accompanied this code). | |
14 * | |
15 * You should have received a copy of the GNU General Public License version | |
16 * 2 along with this work; if not, write to the Free Software Foundation, | |
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. | |
18 * | |
1552
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
0
diff
changeset
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
0
diff
changeset
|
20 * or visit www.oracle.com if you need additional information or have any |
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
0
diff
changeset
|
21 * questions. |
0 | 22 * |
23 */ | |
24 | |
1972 | 25 #ifndef SHARE_VM_UTILITIES_HASHTABLE_INLINE_HPP |
26 #define SHARE_VM_UTILITIES_HASHTABLE_INLINE_HPP | |
27 | |
28 #include "memory/allocation.inline.hpp" | |
20197
ce8f6bb717c9
8042195: Introduce umbrella header orderAccess.inline.hpp.
goetz
parents:
6197
diff
changeset
|
29 #include "runtime/orderAccess.inline.hpp" |
1972 | 30 #include "utilities/hashtable.hpp" |
6197 | 31 #include "utilities/dtrace.hpp" |
1972 | 32 |
0 | 33 // Inline function definitions for hashtable.hpp. |
34 | |
35 // -------------------------------------------------------------------------- | |
36 | |
37 // Initialize a table. | |
38 | |
6197 | 39 template <MEMFLAGS F> inline BasicHashtable<F>::BasicHashtable(int table_size, int entry_size) { |
0 | 40 // Called on startup, no locking needed |
41 initialize(table_size, entry_size, 0); | |
6197 | 42 _buckets = NEW_C_HEAP_ARRAY2(HashtableBucket<F>, table_size, F, CURRENT_PC); |
0 | 43 for (int index = 0; index < _table_size; index++) { |
44 _buckets[index].clear(); | |
45 } | |
46 } | |
47 | |
48 | |
6197 | 49 template <MEMFLAGS F> inline BasicHashtable<F>::BasicHashtable(int table_size, int entry_size, |
50 HashtableBucket<F>* buckets, | |
0 | 51 int number_of_entries) { |
52 // Called on startup, no locking needed | |
53 initialize(table_size, entry_size, number_of_entries); | |
54 _buckets = buckets; | |
55 } | |
56 | |
57 | |
6197 | 58 template <MEMFLAGS F> inline void BasicHashtable<F>::initialize(int table_size, int entry_size, |
0 | 59 int number_of_entries) { |
60 // Called on startup, no locking needed | |
61 _table_size = table_size; | |
62 _entry_size = entry_size; | |
63 _free_list = NULL; | |
64 _first_free_entry = NULL; | |
65 _end_block = NULL; | |
66 _number_of_entries = number_of_entries; | |
67 #ifdef ASSERT | |
68 _lookup_count = 0; | |
69 _lookup_length = 0; | |
70 #endif | |
71 } | |
72 | |
73 | |
74 // The following method is MT-safe and may be used with caution. | |
6197 | 75 template <MEMFLAGS F> inline BasicHashtableEntry<F>* BasicHashtable<F>::bucket(int i) { |
0 | 76 return _buckets[i].get_entry(); |
77 } | |
78 | |
79 | |
6197 | 80 template <MEMFLAGS F> inline void HashtableBucket<F>::set_entry(BasicHashtableEntry<F>* l) { |
0 | 81 // Warning: Preserve store ordering. The SystemDictionary is read |
82 // without locks. The new SystemDictionaryEntry must be | |
83 // complete before other threads can be allowed to see it | |
84 // via a store to _buckets[index]. | |
85 OrderAccess::release_store_ptr(&_entry, l); | |
86 } | |
87 | |
88 | |
6197 | 89 template <MEMFLAGS F> inline BasicHashtableEntry<F>* HashtableBucket<F>::get_entry() const { |
0 | 90 // Warning: Preserve load ordering. The SystemDictionary is read |
91 // without locks. The new SystemDictionaryEntry must be | |
92 // complete before other threads can be allowed to see it | |
93 // via a store to _buckets[index]. | |
6197 | 94 return (BasicHashtableEntry<F>*) OrderAccess::load_ptr_acquire(&_entry); |
0 | 95 } |
96 | |
97 | |
6197 | 98 template <MEMFLAGS F> inline void BasicHashtable<F>::set_entry(int index, BasicHashtableEntry<F>* entry) { |
0 | 99 _buckets[index].set_entry(entry); |
100 } | |
101 | |
102 | |
6197 | 103 template <MEMFLAGS F> inline void BasicHashtable<F>::add_entry(int index, BasicHashtableEntry<F>* entry) { |
0 | 104 entry->set_next(bucket(index)); |
105 _buckets[index].set_entry(entry); | |
106 ++_number_of_entries; | |
107 } | |
108 | |
6197 | 109 template <MEMFLAGS F> inline void BasicHashtable<F>::free_entry(BasicHashtableEntry<F>* entry) { |
0 | 110 entry->set_next(_free_list); |
111 _free_list = entry; | |
112 --_number_of_entries; | |
113 } | |
1972 | 114 |
115 #endif // SHARE_VM_UTILITIES_HASHTABLE_INLINE_HPP |