1 /*
2 * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
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 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
23 */
24
25 #ifndef SHARE_VM_GC_IMPLEMENTATION_G1_G1STRINGDEDUPTABLE_HPP
26 #define SHARE_VM_GC_IMPLEMENTATION_G1_G1STRINGDEDUPTABLE_HPP
27
28 #include "gc_implementation/g1/g1StringDedupStat.hpp"
29 #include "runtime/mutexLocker.hpp"
30
31 class G1StringDedupEntryCache;
32 class G1StringDedupUnlinkOrOopsDoClosure;
33
34 //
35 // Table entry in the deduplication hashtable. Points weakly to the
36 // character array. Can be chained in a linked list in case of hash
37 // collisions or when placed in a freelist in the entry cache.
38 //
39 class G1StringDedupEntry : public CHeapObj<mtGC> {
40 private:
41 G1StringDedupEntry* _next;
42 unsigned int _hash;
43 typeArrayOop _obj;
44
45 public:
46 G1StringDedupEntry() :
47 _next(NULL),
48 _hash(0),
211 static void finish_resize(G1StringDedupTable* resized_table);
212
213 // If a table rehash is needed, returns a newly allocated empty
214 // hashtable and updates the hash seed.
215 static G1StringDedupTable* prepare_rehash();
216
217 // Transfers rehashed entries from the currently active table into
218 // the new table. Installs the new table as the currently active table
219 // and deletes the previously active table.
220 static void finish_rehash(G1StringDedupTable* rehashed_table);
221
222 // If the table entry cache has grown too large, trim it down according to policy
223 static void trim_entry_cache();
224
225 static void unlink_or_oops_do(G1StringDedupUnlinkOrOopsDoClosure* cl, uint worker_id);
226
227 static void print_statistics(outputStream* st);
228 static void verify();
229 };
230
231 #endif // SHARE_VM_GC_IMPLEMENTATION_G1_G1STRINGDEDUPTABLE_HPP
|
1 /*
2 * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
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 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
23 */
24
25 #ifndef SHARE_VM_GC_G1_G1STRINGDEDUPTABLE_HPP
26 #define SHARE_VM_GC_G1_G1STRINGDEDUPTABLE_HPP
27
28 #include "gc/g1/g1StringDedupStat.hpp"
29 #include "runtime/mutexLocker.hpp"
30
31 class G1StringDedupEntryCache;
32 class G1StringDedupUnlinkOrOopsDoClosure;
33
34 //
35 // Table entry in the deduplication hashtable. Points weakly to the
36 // character array. Can be chained in a linked list in case of hash
37 // collisions or when placed in a freelist in the entry cache.
38 //
39 class G1StringDedupEntry : public CHeapObj<mtGC> {
40 private:
41 G1StringDedupEntry* _next;
42 unsigned int _hash;
43 typeArrayOop _obj;
44
45 public:
46 G1StringDedupEntry() :
47 _next(NULL),
48 _hash(0),
211 static void finish_resize(G1StringDedupTable* resized_table);
212
213 // If a table rehash is needed, returns a newly allocated empty
214 // hashtable and updates the hash seed.
215 static G1StringDedupTable* prepare_rehash();
216
217 // Transfers rehashed entries from the currently active table into
218 // the new table. Installs the new table as the currently active table
219 // and deletes the previously active table.
220 static void finish_rehash(G1StringDedupTable* rehashed_table);
221
222 // If the table entry cache has grown too large, trim it down according to policy
223 static void trim_entry_cache();
224
225 static void unlink_or_oops_do(G1StringDedupUnlinkOrOopsDoClosure* cl, uint worker_id);
226
227 static void print_statistics(outputStream* st);
228 static void verify();
229 };
230
231 #endif // SHARE_VM_GC_G1_G1STRINGDEDUPTABLE_HPP
|