Mercurial > hg > truffle
annotate src/share/vm/classfile/loaderConstraints.hpp @ 14714:b602356a9cfc
additional canonicalizers for accesses and value nodes (improves number of implicit null checks)
author | Lukas Stadler <lukas.stadler@oracle.com> |
---|---|
date | Thu, 20 Mar 2014 17:15:36 +0100 |
parents | da91efe96a93 |
children |
rev | line source |
---|---|
0 | 1 /* |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6197
diff
changeset
|
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:
1339
diff
changeset
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
1339
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:
1339
diff
changeset
|
21 * questions. |
0 | 22 * |
23 */ | |
24 | |
1972 | 25 #ifndef SHARE_VM_CLASSFILE_LOADERCONSTRAINTS_HPP |
26 #define SHARE_VM_CLASSFILE_LOADERCONSTRAINTS_HPP | |
27 | |
28 #include "classfile/dictionary.hpp" | |
29 #include "classfile/placeholders.hpp" | |
30 #include "utilities/hashtable.hpp" | |
31 | |
0 | 32 class LoaderConstraintEntry; |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6197
diff
changeset
|
33 class Symbol; |
0 | 34 |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6197
diff
changeset
|
35 class LoaderConstraintTable : public Hashtable<Klass*, mtClass> { |
0 | 36 friend class VMStructs; |
37 private: | |
38 | |
39 enum Constants { | |
40 _loader_constraint_size = 107, // number of entries in constraint table | |
41 _nof_buckets = 1009 // number of buckets in hash table | |
42 }; | |
43 | |
2177
3582bf76420e
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
1972
diff
changeset
|
44 LoaderConstraintEntry** find_loader_constraint(Symbol* name, |
0 | 45 Handle loader); |
46 | |
47 public: | |
48 | |
49 LoaderConstraintTable(int nof_buckets); | |
50 | |
2177
3582bf76420e
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
1972
diff
changeset
|
51 LoaderConstraintEntry* new_entry(unsigned int hash, Symbol* name, |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6197
diff
changeset
|
52 Klass* klass, int num_loaders, |
0 | 53 int max_loaders); |
2177
3582bf76420e
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
1972
diff
changeset
|
54 void free_entry(LoaderConstraintEntry *entry); |
0 | 55 |
56 LoaderConstraintEntry* bucket(int i) { | |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6197
diff
changeset
|
57 return (LoaderConstraintEntry*)Hashtable<Klass*, mtClass>::bucket(i); |
0 | 58 } |
59 | |
60 LoaderConstraintEntry** bucket_addr(int i) { | |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6197
diff
changeset
|
61 return (LoaderConstraintEntry**)Hashtable<Klass*, mtClass>::bucket_addr(i); |
0 | 62 } |
63 | |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6197
diff
changeset
|
64 // Enhanced Class Redefinition support |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6197
diff
changeset
|
65 void classes_do(KlassClosure* f); |
0 | 66 |
67 // Check class loader constraints | |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6197
diff
changeset
|
68 bool add_entry(Symbol* name, Klass* klass1, Handle loader1, |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6197
diff
changeset
|
69 Klass* klass2, Handle loader2); |
0 | 70 |
665
c89f86385056
6814659: separable cleanups and subroutines for 6655638
jrose
parents:
0
diff
changeset
|
71 // Note: The main entry point for this module is via SystemDictionary. |
2177
3582bf76420e
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
1972
diff
changeset
|
72 // SystemDictionary::check_signature_loaders(Symbol* signature, |
665
c89f86385056
6814659: separable cleanups and subroutines for 6655638
jrose
parents:
0
diff
changeset
|
73 // Handle loader1, Handle loader2, |
c89f86385056
6814659: separable cleanups and subroutines for 6655638
jrose
parents:
0
diff
changeset
|
74 // bool is_method, TRAPS) |
0 | 75 |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6197
diff
changeset
|
76 Klass* find_constrained_klass(Symbol* name, Handle loader); |
0 | 77 |
78 // Class loader constraints | |
79 | |
80 void ensure_loader_constraint_capacity(LoaderConstraintEntry *p, int nfree); | |
81 void extend_loader_constraint(LoaderConstraintEntry* p, Handle loader, | |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6197
diff
changeset
|
82 Klass* klass); |
0 | 83 void merge_loader_constraints(LoaderConstraintEntry** pp1, |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6197
diff
changeset
|
84 LoaderConstraintEntry** pp2, Klass* klass); |
0 | 85 |
86 bool check_or_update(instanceKlassHandle k, Handle loader, | |
2177
3582bf76420e
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
1972
diff
changeset
|
87 Symbol* name); |
0 | 88 |
89 | |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6197
diff
changeset
|
90 void purge_loader_constraints(); |
0 | 91 |
1258
38836cf1d8d2
6920977: G1: guarantee(k == probe->klass(),"klass should be in dictionary") fails
tonyp
parents:
665
diff
changeset
|
92 void verify(Dictionary* dictionary, PlaceholderTable* placeholders); |
0 | 93 #ifndef PRODUCT |
94 void print(); | |
95 #endif | |
96 }; | |
97 | |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6197
diff
changeset
|
98 class LoaderConstraintEntry : public HashtableEntry<Klass*, mtClass> { |
0 | 99 friend class VMStructs; |
100 private: | |
2177
3582bf76420e
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
1972
diff
changeset
|
101 Symbol* _name; // class name |
0 | 102 int _num_loaders; |
103 int _max_loaders; | |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6197
diff
changeset
|
104 // Loader constraints enforce correct linking behavior. |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6197
diff
changeset
|
105 // Thus, it really operates on ClassLoaderData which represents linking domain, |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6197
diff
changeset
|
106 // not class loaders. |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6197
diff
changeset
|
107 ClassLoaderData** _loaders; // initiating loaders |
0 | 108 |
109 public: | |
110 | |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6197
diff
changeset
|
111 Klass* klass() { return literal(); } |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6197
diff
changeset
|
112 Klass** klass_addr() { return literal_addr(); } |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6197
diff
changeset
|
113 void set_klass(Klass* k) { set_literal(k); } |
0 | 114 |
115 LoaderConstraintEntry* next() { | |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6197
diff
changeset
|
116 return (LoaderConstraintEntry*)HashtableEntry<Klass*, mtClass>::next(); |
0 | 117 } |
118 | |
119 LoaderConstraintEntry** next_addr() { | |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6197
diff
changeset
|
120 return (LoaderConstraintEntry**)HashtableEntry<Klass*, mtClass>::next_addr(); |
0 | 121 } |
122 void set_next(LoaderConstraintEntry* next) { | |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6197
diff
changeset
|
123 HashtableEntry<Klass*, mtClass>::set_next(next); |
0 | 124 } |
125 | |
2177
3582bf76420e
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
1972
diff
changeset
|
126 Symbol* name() { return _name; } |
3582bf76420e
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
1972
diff
changeset
|
127 void set_name(Symbol* name) { |
3582bf76420e
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
1972
diff
changeset
|
128 _name = name; |
3582bf76420e
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
1972
diff
changeset
|
129 if (name != NULL) name->increment_refcount(); |
3582bf76420e
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
1972
diff
changeset
|
130 } |
0 | 131 |
132 int num_loaders() { return _num_loaders; } | |
133 void set_num_loaders(int i) { _num_loaders = i; } | |
134 | |
135 int max_loaders() { return _max_loaders; } | |
136 void set_max_loaders(int i) { _max_loaders = i; } | |
137 | |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6197
diff
changeset
|
138 ClassLoaderData** loaders() { return _loaders; } |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6197
diff
changeset
|
139 void set_loaders(ClassLoaderData** loaders) { _loaders = loaders; } |
0 | 140 |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6197
diff
changeset
|
141 ClassLoaderData* loader_data(int i) { return _loaders[i]; } |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6197
diff
changeset
|
142 void set_loader_data(int i, ClassLoaderData* p) { _loaders[i] = p; } |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6197
diff
changeset
|
143 // convenience |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6197
diff
changeset
|
144 void set_loader(int i, oop p); |
0 | 145 }; |
1972 | 146 |
147 #endif // SHARE_VM_CLASSFILE_LOADERCONSTRAINTS_HPP |