1 /* |
1 /* |
2 * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * |
4 * |
5 * This code is free software; you can redistribute it and/or modify it |
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 |
6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. |
7 * published by the Free Software Foundation. |
54 static oop intern(Handle string_or_null, jchar* chars, int length, TRAPS); |
54 static oop intern(Handle string_or_null, jchar* chars, int length, TRAPS); |
55 oop basic_add(int index, Handle string_or_null, jchar* name, int len, |
55 oop basic_add(int index, Handle string_or_null, jchar* name, int len, |
56 unsigned int hashValue, TRAPS); |
56 unsigned int hashValue, TRAPS); |
57 |
57 |
58 oop lookup_in_main_table(int index, jchar* chars, int length, unsigned int hashValue); |
58 oop lookup_in_main_table(int index, jchar* chars, int length, unsigned int hashValue); |
59 static oop lookup_shared(jchar* name, int len); |
59 static oop lookup_shared(jchar* name, int len, unsigned int hash); |
60 |
60 |
61 // Apply the give oop closure to the entries to the buckets |
61 // Apply the give oop closure to the entries to the buckets |
62 // in the range [start_idx, end_idx). |
62 // in the range [start_idx, end_idx). |
63 static void buckets_oops_do(OopClosure* f, int start_idx, int end_idx); |
63 static void buckets_oops_do(OopClosure* f, int start_idx, int end_idx); |
64 // Unlink or apply the give oop closure to the entries to the buckets |
64 // Unlink or apply the give oop closure to the entries to the buckets |
65 // in the range [start_idx, end_idx). |
65 // in the range [start_idx, end_idx). |
66 static void buckets_unlink_or_oops_do(BoolObjectClosure* is_alive, OopClosure* f, int start_idx, int end_idx, int* processed, int* removed); |
66 static void buckets_unlink_or_oops_do(BoolObjectClosure* is_alive, OopClosure* f, int start_idx, int end_idx, int* processed, int* removed); |
|
67 |
|
68 // Hashing algorithm, used as the hash value used by the |
|
69 // StringTable for bucket selection and comparison (stored in the |
|
70 // HashtableEntry structures). This is used in the String.intern() method. |
|
71 static unsigned int hash_string(const jchar* s, int len); |
|
72 static unsigned int hash_string(oop string); |
|
73 static unsigned int alt_hash_string(const jchar* s, int len); |
67 |
74 |
68 StringTable() : RehashableHashtable<oop, mtSymbol>((int)StringTableSize, |
75 StringTable() : RehashableHashtable<oop, mtSymbol>((int)StringTableSize, |
69 sizeof (HashtableEntry<oop, mtSymbol>)) {} |
76 sizeof (HashtableEntry<oop, mtSymbol>)) {} |
70 |
77 |
71 StringTable(HashtableBucket<mtSymbol>* t, int number_of_entries) |
78 StringTable(HashtableBucket<mtSymbol>* t, int number_of_entries) |
106 static void possibly_parallel_unlink_or_oops_do(BoolObjectClosure* cl, OopClosure* f, int* processed, int* removed); |
113 static void possibly_parallel_unlink_or_oops_do(BoolObjectClosure* cl, OopClosure* f, int* processed, int* removed); |
107 static void possibly_parallel_unlink(BoolObjectClosure* cl, int* processed, int* removed) { |
114 static void possibly_parallel_unlink(BoolObjectClosure* cl, int* processed, int* removed) { |
108 possibly_parallel_unlink_or_oops_do(cl, NULL, processed, removed); |
115 possibly_parallel_unlink_or_oops_do(cl, NULL, processed, removed); |
109 } |
116 } |
110 static void possibly_parallel_oops_do(OopClosure* f); |
117 static void possibly_parallel_oops_do(OopClosure* f); |
111 |
|
112 // Hashing algorithm, used as the hash value used by the |
|
113 // StringTable for bucket selection and comparison (stored in the |
|
114 // HashtableEntry structures). This is used in the String.intern() method. |
|
115 static unsigned int hash_string(const jchar* s, int len); |
|
116 static unsigned int hash_string(oop string); |
|
117 |
118 |
118 // Internal test. |
119 // Internal test. |
119 static void test_alt_hash() PRODUCT_RETURN; |
120 static void test_alt_hash() PRODUCT_RETURN; |
120 |
121 |
121 // Probing |
122 // Probing |