Mercurial > hg > truffle
annotate src/share/vm/jvmci/jvmciHashtable.hpp @ 21924:c0744b24b230
Truffle: minor refactoring
author | Andreas Woess <andreas.woess@oracle.com> |
---|---|
date | Thu, 11 Jun 2015 17:16:53 +0200 |
parents | 59c3f921e454 |
children |
rev | line source |
---|---|
21519
cecb4e39521c
Use files in lib/graal/options to define Graal options (-G:...) instead of generating code for them
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
diff
changeset
|
1 /* |
cecb4e39521c
Use files in lib/graal/options to define Graal options (-G:...) instead of generating code for them
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
diff
changeset
|
2 * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. |
cecb4e39521c
Use files in lib/graal/options to define Graal options (-G:...) instead of generating code for them
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
diff
changeset
|
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
cecb4e39521c
Use files in lib/graal/options to define Graal options (-G:...) instead of generating code for them
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
diff
changeset
|
4 * |
cecb4e39521c
Use files in lib/graal/options to define Graal options (-G:...) instead of generating code for them
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
diff
changeset
|
5 * This code is free software; you can redistribute it and/or modify it |
cecb4e39521c
Use files in lib/graal/options to define Graal options (-G:...) instead of generating code for them
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
diff
changeset
|
6 * under the terms of the GNU General Public License version 2 only, as |
cecb4e39521c
Use files in lib/graal/options to define Graal options (-G:...) instead of generating code for them
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
diff
changeset
|
7 * published by the Free Software Foundation. |
cecb4e39521c
Use files in lib/graal/options to define Graal options (-G:...) instead of generating code for them
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
diff
changeset
|
8 * |
cecb4e39521c
Use files in lib/graal/options to define Graal options (-G:...) instead of generating code for them
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
diff
changeset
|
9 * This code is distributed in the hope that it will be useful, but WITHOUT |
cecb4e39521c
Use files in lib/graal/options to define Graal options (-G:...) instead of generating code for them
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
diff
changeset
|
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
cecb4e39521c
Use files in lib/graal/options to define Graal options (-G:...) instead of generating code for them
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
diff
changeset
|
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
cecb4e39521c
Use files in lib/graal/options to define Graal options (-G:...) instead of generating code for them
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
diff
changeset
|
12 * version 2 for more details (a copy is included in the LICENSE file that |
cecb4e39521c
Use files in lib/graal/options to define Graal options (-G:...) instead of generating code for them
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
diff
changeset
|
13 * accompanied this code). |
cecb4e39521c
Use files in lib/graal/options to define Graal options (-G:...) instead of generating code for them
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
diff
changeset
|
14 * |
cecb4e39521c
Use files in lib/graal/options to define Graal options (-G:...) instead of generating code for them
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
diff
changeset
|
15 * You should have received a copy of the GNU General Public License version |
cecb4e39521c
Use files in lib/graal/options to define Graal options (-G:...) instead of generating code for them
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
diff
changeset
|
16 * 2 along with this work; if not, write to the Free Software Foundation, |
cecb4e39521c
Use files in lib/graal/options to define Graal options (-G:...) instead of generating code for them
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
diff
changeset
|
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
cecb4e39521c
Use files in lib/graal/options to define Graal options (-G:...) instead of generating code for them
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
diff
changeset
|
18 * |
cecb4e39521c
Use files in lib/graal/options to define Graal options (-G:...) instead of generating code for them
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
diff
changeset
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
cecb4e39521c
Use files in lib/graal/options to define Graal options (-G:...) instead of generating code for them
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
diff
changeset
|
20 * or visit www.oracle.com if you need additional information or have any |
cecb4e39521c
Use files in lib/graal/options to define Graal options (-G:...) instead of generating code for them
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
diff
changeset
|
21 * questions. |
cecb4e39521c
Use files in lib/graal/options to define Graal options (-G:...) instead of generating code for them
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
diff
changeset
|
22 */ |
cecb4e39521c
Use files in lib/graal/options to define Graal options (-G:...) instead of generating code for them
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
diff
changeset
|
23 |
21562 | 24 #ifndef SHARE_VM_JVMCI_JVMCI_HASHTABLE_HPP |
25 #define SHARE_VM_JVMCI_JVMCI_HASHTABLE_HPP | |
21519
cecb4e39521c
Use files in lib/graal/options to define Graal options (-G:...) instead of generating code for them
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
diff
changeset
|
26 |
cecb4e39521c
Use files in lib/graal/options to define Graal options (-G:...) instead of generating code for them
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
diff
changeset
|
27 #include "memory/allocation.hpp" |
cecb4e39521c
Use files in lib/graal/options to define Graal options (-G:...) instead of generating code for them
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
diff
changeset
|
28 #include "memory/allocation.inline.hpp" |
cecb4e39521c
Use files in lib/graal/options to define Graal options (-G:...) instead of generating code for them
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
diff
changeset
|
29 |
cecb4e39521c
Use files in lib/graal/options to define Graal options (-G:...) instead of generating code for them
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
diff
changeset
|
30 // based on hashtable.hpp |
cecb4e39521c
Use files in lib/graal/options to define Graal options (-G:...) instead of generating code for them
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
diff
changeset
|
31 |
21562 | 32 template <class T> class JVMCIHashtableEntry : public CHeapObj<mtCompiler> { |
21519
cecb4e39521c
Use files in lib/graal/options to define Graal options (-G:...) instead of generating code for them
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
diff
changeset
|
33 friend class VMStructs; |
cecb4e39521c
Use files in lib/graal/options to define Graal options (-G:...) instead of generating code for them
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
diff
changeset
|
34 private: |
cecb4e39521c
Use files in lib/graal/options to define Graal options (-G:...) instead of generating code for them
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
diff
changeset
|
35 T _literal; // ref to item in table. |
21562 | 36 JVMCIHashtableEntry* _next; // Link to next element in the linked list for this bucket |
21519
cecb4e39521c
Use files in lib/graal/options to define Graal options (-G:...) instead of generating code for them
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
diff
changeset
|
37 |
cecb4e39521c
Use files in lib/graal/options to define Graal options (-G:...) instead of generating code for them
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
diff
changeset
|
38 public: |
21562 | 39 JVMCIHashtableEntry(T literal) : _literal(literal), _next(NULL) {} |
21519
cecb4e39521c
Use files in lib/graal/options to define Graal options (-G:...) instead of generating code for them
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
diff
changeset
|
40 |
cecb4e39521c
Use files in lib/graal/options to define Graal options (-G:...) instead of generating code for them
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
diff
changeset
|
41 T literal() { |
cecb4e39521c
Use files in lib/graal/options to define Graal options (-G:...) instead of generating code for them
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
diff
changeset
|
42 return _literal; |
cecb4e39521c
Use files in lib/graal/options to define Graal options (-G:...) instead of generating code for them
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
diff
changeset
|
43 } |
cecb4e39521c
Use files in lib/graal/options to define Graal options (-G:...) instead of generating code for them
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
diff
changeset
|
44 |
cecb4e39521c
Use files in lib/graal/options to define Graal options (-G:...) instead of generating code for them
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
diff
changeset
|
45 void set_literal(T value) { |
cecb4e39521c
Use files in lib/graal/options to define Graal options (-G:...) instead of generating code for them
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
diff
changeset
|
46 _literal = value; |
cecb4e39521c
Use files in lib/graal/options to define Graal options (-G:...) instead of generating code for them
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
diff
changeset
|
47 } |
cecb4e39521c
Use files in lib/graal/options to define Graal options (-G:...) instead of generating code for them
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
diff
changeset
|
48 |
cecb4e39521c
Use files in lib/graal/options to define Graal options (-G:...) instead of generating code for them
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
diff
changeset
|
49 T* literal_addr() { |
cecb4e39521c
Use files in lib/graal/options to define Graal options (-G:...) instead of generating code for them
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
diff
changeset
|
50 return &_literal; |
cecb4e39521c
Use files in lib/graal/options to define Graal options (-G:...) instead of generating code for them
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
diff
changeset
|
51 } |
cecb4e39521c
Use files in lib/graal/options to define Graal options (-G:...) instead of generating code for them
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
diff
changeset
|
52 |
21562 | 53 JVMCIHashtableEntry* next() const { |
21519
cecb4e39521c
Use files in lib/graal/options to define Graal options (-G:...) instead of generating code for them
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
diff
changeset
|
54 return _next; |
cecb4e39521c
Use files in lib/graal/options to define Graal options (-G:...) instead of generating code for them
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
diff
changeset
|
55 } |
cecb4e39521c
Use files in lib/graal/options to define Graal options (-G:...) instead of generating code for them
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
diff
changeset
|
56 |
21562 | 57 void set_next(JVMCIHashtableEntry* next) { |
21519
cecb4e39521c
Use files in lib/graal/options to define Graal options (-G:...) instead of generating code for them
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
diff
changeset
|
58 _next = next; |
cecb4e39521c
Use files in lib/graal/options to define Graal options (-G:...) instead of generating code for them
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
diff
changeset
|
59 } |
cecb4e39521c
Use files in lib/graal/options to define Graal options (-G:...) instead of generating code for them
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
diff
changeset
|
60 }; |
cecb4e39521c
Use files in lib/graal/options to define Graal options (-G:...) instead of generating code for them
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
diff
changeset
|
61 |
cecb4e39521c
Use files in lib/graal/options to define Graal options (-G:...) instead of generating code for them
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
diff
changeset
|
62 template <class V> |
cecb4e39521c
Use files in lib/graal/options to define Graal options (-G:...) instead of generating code for them
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
diff
changeset
|
63 class ValueClosure : public StackObj { |
cecb4e39521c
Use files in lib/graal/options to define Graal options (-G:...) instead of generating code for them
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
diff
changeset
|
64 bool _abort; |
cecb4e39521c
Use files in lib/graal/options to define Graal options (-G:...) instead of generating code for them
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
diff
changeset
|
65 protected: |
cecb4e39521c
Use files in lib/graal/options to define Graal options (-G:...) instead of generating code for them
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
diff
changeset
|
66 void abort() { _abort = true; } |
cecb4e39521c
Use files in lib/graal/options to define Graal options (-G:...) instead of generating code for them
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
diff
changeset
|
67 public: |
cecb4e39521c
Use files in lib/graal/options to define Graal options (-G:...) instead of generating code for them
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
diff
changeset
|
68 ValueClosure() : _abort(false) {} |
cecb4e39521c
Use files in lib/graal/options to define Graal options (-G:...) instead of generating code for them
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
diff
changeset
|
69 virtual void do_value(V* value) = 0; |
cecb4e39521c
Use files in lib/graal/options to define Graal options (-G:...) instead of generating code for them
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
diff
changeset
|
70 bool is_aborted() { return _abort; } |
cecb4e39521c
Use files in lib/graal/options to define Graal options (-G:...) instead of generating code for them
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
diff
changeset
|
71 }; |
cecb4e39521c
Use files in lib/graal/options to define Graal options (-G:...) instead of generating code for them
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
diff
changeset
|
72 |
21562 | 73 template <class K, class V> class JVMCIHashtable : public CHeapObj<mtCompiler> { |
21519
cecb4e39521c
Use files in lib/graal/options to define Graal options (-G:...) instead of generating code for them
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
diff
changeset
|
74 friend class VMStructs; |
cecb4e39521c
Use files in lib/graal/options to define Graal options (-G:...) instead of generating code for them
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
diff
changeset
|
75 private: |
cecb4e39521c
Use files in lib/graal/options to define Graal options (-G:...) instead of generating code for them
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
diff
changeset
|
76 // Instance variables |
cecb4e39521c
Use files in lib/graal/options to define Graal options (-G:...) instead of generating code for them
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
diff
changeset
|
77 unsigned int _table_size; |
21562 | 78 JVMCIHashtableEntry<V>** _buckets; |
21519
cecb4e39521c
Use files in lib/graal/options to define Graal options (-G:...) instead of generating code for them
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
diff
changeset
|
79 unsigned int _number_of_entries; |
cecb4e39521c
Use files in lib/graal/options to define Graal options (-G:...) instead of generating code for them
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
diff
changeset
|
80 |
cecb4e39521c
Use files in lib/graal/options to define Graal options (-G:...) instead of generating code for them
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
diff
changeset
|
81 public: |
21587
59c3f921e454
fixes for windows build (size_t conversion, missing precompiled.hpp, missing strtof, strtoll in Windows SDK)
Christian Wirth <christian.wirth@oracle.com>
parents:
21562
diff
changeset
|
82 JVMCIHashtable(size_t size) : _table_size((int)size), _number_of_entries(0) { |
21562 | 83 _buckets = NEW_C_HEAP_ARRAY(JVMCIHashtableEntry<V>*, table_size(), mtCompiler); |
21519
cecb4e39521c
Use files in lib/graal/options to define Graal options (-G:...) instead of generating code for them
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
diff
changeset
|
84 for (size_t i = 0; i < table_size(); ++i) { |
cecb4e39521c
Use files in lib/graal/options to define Graal options (-G:...) instead of generating code for them
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
diff
changeset
|
85 _buckets[i] = NULL; |
cecb4e39521c
Use files in lib/graal/options to define Graal options (-G:...) instead of generating code for them
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
diff
changeset
|
86 } |
cecb4e39521c
Use files in lib/graal/options to define Graal options (-G:...) instead of generating code for them
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
diff
changeset
|
87 } |
21562 | 88 virtual ~JVMCIHashtable(); |
21519
cecb4e39521c
Use files in lib/graal/options to define Graal options (-G:...) instead of generating code for them
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
diff
changeset
|
89 |
cecb4e39521c
Use files in lib/graal/options to define Graal options (-G:...) instead of generating code for them
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
diff
changeset
|
90 private: |
cecb4e39521c
Use files in lib/graal/options to define Graal options (-G:...) instead of generating code for them
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
diff
changeset
|
91 // Bucket handling |
cecb4e39521c
Use files in lib/graal/options to define Graal options (-G:...) instead of generating code for them
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
diff
changeset
|
92 unsigned int hash_to_index(unsigned int full_hash) { |
cecb4e39521c
Use files in lib/graal/options to define Graal options (-G:...) instead of generating code for them
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
diff
changeset
|
93 unsigned int h = full_hash % _table_size; |
cecb4e39521c
Use files in lib/graal/options to define Graal options (-G:...) instead of generating code for them
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
diff
changeset
|
94 assert(h >= 0 && h < _table_size, "Illegal hash value"); |
cecb4e39521c
Use files in lib/graal/options to define Graal options (-G:...) instead of generating code for them
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
diff
changeset
|
95 return h; |
cecb4e39521c
Use files in lib/graal/options to define Graal options (-G:...) instead of generating code for them
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
diff
changeset
|
96 } |
cecb4e39521c
Use files in lib/graal/options to define Graal options (-G:...) instead of generating code for them
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
diff
changeset
|
97 |
cecb4e39521c
Use files in lib/graal/options to define Graal options (-G:...) instead of generating code for them
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
diff
changeset
|
98 unsigned int index_for(K key) { |
cecb4e39521c
Use files in lib/graal/options to define Graal options (-G:...) instead of generating code for them
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
diff
changeset
|
99 return hash_to_index(compute_hash(key)); |
cecb4e39521c
Use files in lib/graal/options to define Graal options (-G:...) instead of generating code for them
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
diff
changeset
|
100 } |
cecb4e39521c
Use files in lib/graal/options to define Graal options (-G:...) instead of generating code for them
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
diff
changeset
|
101 |
cecb4e39521c
Use files in lib/graal/options to define Graal options (-G:...) instead of generating code for them
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
diff
changeset
|
102 size_t entry_size() { |
cecb4e39521c
Use files in lib/graal/options to define Graal options (-G:...) instead of generating code for them
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
diff
changeset
|
103 return sizeof(V); |
cecb4e39521c
Use files in lib/graal/options to define Graal options (-G:...) instead of generating code for them
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
diff
changeset
|
104 } |
cecb4e39521c
Use files in lib/graal/options to define Graal options (-G:...) instead of generating code for them
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
diff
changeset
|
105 |
cecb4e39521c
Use files in lib/graal/options to define Graal options (-G:...) instead of generating code for them
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
diff
changeset
|
106 size_t table_size() { return _table_size; } |
cecb4e39521c
Use files in lib/graal/options to define Graal options (-G:...) instead of generating code for them
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
diff
changeset
|
107 |
21562 | 108 JVMCIHashtableEntry<V>* bucket(unsigned int index) { |
21519
cecb4e39521c
Use files in lib/graal/options to define Graal options (-G:...) instead of generating code for them
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
diff
changeset
|
109 return _buckets[index]; |
cecb4e39521c
Use files in lib/graal/options to define Graal options (-G:...) instead of generating code for them
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
diff
changeset
|
110 } |
cecb4e39521c
Use files in lib/graal/options to define Graal options (-G:...) instead of generating code for them
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
diff
changeset
|
111 |
cecb4e39521c
Use files in lib/graal/options to define Graal options (-G:...) instead of generating code for them
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
diff
changeset
|
112 bool add(V v, bool replace); |
cecb4e39521c
Use files in lib/graal/options to define Graal options (-G:...) instead of generating code for them
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
diff
changeset
|
113 |
cecb4e39521c
Use files in lib/graal/options to define Graal options (-G:...) instead of generating code for them
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
diff
changeset
|
114 protected: |
cecb4e39521c
Use files in lib/graal/options to define Graal options (-G:...) instead of generating code for them
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
diff
changeset
|
115 virtual unsigned int compute_hash(K key) = 0; |
cecb4e39521c
Use files in lib/graal/options to define Graal options (-G:...) instead of generating code for them
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
diff
changeset
|
116 virtual bool key_equals(K k1, K k2) = 0; |
cecb4e39521c
Use files in lib/graal/options to define Graal options (-G:...) instead of generating code for them
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
diff
changeset
|
117 virtual K get_key(V value) = 0; |
cecb4e39521c
Use files in lib/graal/options to define Graal options (-G:...) instead of generating code for them
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
diff
changeset
|
118 virtual K get_key(V* value) = 0; |
cecb4e39521c
Use files in lib/graal/options to define Graal options (-G:...) instead of generating code for them
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
diff
changeset
|
119 |
cecb4e39521c
Use files in lib/graal/options to define Graal options (-G:...) instead of generating code for them
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
diff
changeset
|
120 public: |
cecb4e39521c
Use files in lib/graal/options to define Graal options (-G:...) instead of generating code for them
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
diff
changeset
|
121 /** |
cecb4e39521c
Use files in lib/graal/options to define Graal options (-G:...) instead of generating code for them
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
diff
changeset
|
122 * Tries to insert the value in the hash table. Returns false if an entry with the same key already exists. |
cecb4e39521c
Use files in lib/graal/options to define Graal options (-G:...) instead of generating code for them
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
diff
changeset
|
123 * In this case it does *not* replace the existing entry. |
cecb4e39521c
Use files in lib/graal/options to define Graal options (-G:...) instead of generating code for them
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
diff
changeset
|
124 */ |
cecb4e39521c
Use files in lib/graal/options to define Graal options (-G:...) instead of generating code for them
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
diff
changeset
|
125 bool add(V v) { return add(v, false); } |
cecb4e39521c
Use files in lib/graal/options to define Graal options (-G:...) instead of generating code for them
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
diff
changeset
|
126 /** |
cecb4e39521c
Use files in lib/graal/options to define Graal options (-G:...) instead of generating code for them
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
diff
changeset
|
127 * Inserts the value in the hash table. Returns false if an entry with the same key already exists. |
cecb4e39521c
Use files in lib/graal/options to define Graal options (-G:...) instead of generating code for them
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
diff
changeset
|
128 * In this case it replaces the existing entry. |
cecb4e39521c
Use files in lib/graal/options to define Graal options (-G:...) instead of generating code for them
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
diff
changeset
|
129 */ |
cecb4e39521c
Use files in lib/graal/options to define Graal options (-G:...) instead of generating code for them
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
diff
changeset
|
130 bool put(V v) { return add(v, true); } |
cecb4e39521c
Use files in lib/graal/options to define Graal options (-G:...) instead of generating code for them
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
diff
changeset
|
131 V* get(K k); |
cecb4e39521c
Use files in lib/graal/options to define Graal options (-G:...) instead of generating code for them
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
diff
changeset
|
132 void for_each(ValueClosure<V>* closure); |
cecb4e39521c
Use files in lib/graal/options to define Graal options (-G:...) instead of generating code for them
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
diff
changeset
|
133 int number_of_entries() { return _number_of_entries; } |
cecb4e39521c
Use files in lib/graal/options to define Graal options (-G:...) instead of generating code for them
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
diff
changeset
|
134 |
cecb4e39521c
Use files in lib/graal/options to define Graal options (-G:...) instead of generating code for them
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
diff
changeset
|
135 }; |
cecb4e39521c
Use files in lib/graal/options to define Graal options (-G:...) instead of generating code for them
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
diff
changeset
|
136 |
21562 | 137 #endif // SHARE_VM_JVMCI_JVMCI_HASHTABLE_HPP |