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_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
32 class LoaderConstraintEntry;
33 class Symbol;
34
35 class LoaderConstraintTable : public Hashtable<InstanceKlass*, mtClass> {
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
44 LoaderConstraintEntry** find_loader_constraint(Symbol* name,
45 Handle loader);
46
47 public:
48
49 LoaderConstraintTable(int nof_buckets);
50
51 LoaderConstraintEntry* new_entry(unsigned int hash, Symbol* name,
67
68 // Note: The main entry point for this module is via SystemDictionary.
69 // SystemDictionary::check_signature_loaders(Symbol* signature,
70 // Handle loader1, Handle loader2,
71 // bool is_method, TRAPS)
72
73 InstanceKlass* find_constrained_klass(Symbol* name, Handle loader);
74
75 // Class loader constraints
76
77 void ensure_loader_constraint_capacity(LoaderConstraintEntry *p, int nfree);
78 void extend_loader_constraint(LoaderConstraintEntry* p, Handle loader,
79 InstanceKlass* klass);
80 void merge_loader_constraints(LoaderConstraintEntry** pp1,
81 LoaderConstraintEntry** pp2, InstanceKlass* klass);
82
83 bool check_or_update(InstanceKlass* k, Handle loader, Symbol* name);
84
85 void purge_loader_constraints();
86
87 void verify(Dictionary* dictionary, PlaceholderTable* placeholders);
88 #ifndef PRODUCT
89 void print();
90 #endif
91 };
92
93 class LoaderConstraintEntry : public HashtableEntry<InstanceKlass*, mtClass> {
94 friend class VMStructs;
95 private:
96 Symbol* _name; // class name
97 int _num_loaders;
98 int _max_loaders;
99 // Loader constraints enforce correct linking behavior.
100 // Thus, it really operates on ClassLoaderData which represents linking domain,
101 // not class loaders.
102 ClassLoaderData** _loaders; // initiating loaders
103
104 public:
105
106 InstanceKlass* klass() { return literal(); }
107 InstanceKlass** klass_addr() { return literal_addr(); }
|
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_CLASSFILE_LOADERCONSTRAINTS_HPP
26 #define SHARE_VM_CLASSFILE_LOADERCONSTRAINTS_HPP
27
28 #include "classfile/placeholders.hpp"
29 #include "utilities/hashtable.hpp"
30
31 class ClassLoaderData;
32 class LoaderConstraintEntry;
33 class Symbol;
34
35 class LoaderConstraintTable : public Hashtable<InstanceKlass*, mtClass> {
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
44 LoaderConstraintEntry** find_loader_constraint(Symbol* name,
45 Handle loader);
46
47 public:
48
49 LoaderConstraintTable(int nof_buckets);
50
51 LoaderConstraintEntry* new_entry(unsigned int hash, Symbol* name,
67
68 // Note: The main entry point for this module is via SystemDictionary.
69 // SystemDictionary::check_signature_loaders(Symbol* signature,
70 // Handle loader1, Handle loader2,
71 // bool is_method, TRAPS)
72
73 InstanceKlass* find_constrained_klass(Symbol* name, Handle loader);
74
75 // Class loader constraints
76
77 void ensure_loader_constraint_capacity(LoaderConstraintEntry *p, int nfree);
78 void extend_loader_constraint(LoaderConstraintEntry* p, Handle loader,
79 InstanceKlass* klass);
80 void merge_loader_constraints(LoaderConstraintEntry** pp1,
81 LoaderConstraintEntry** pp2, InstanceKlass* klass);
82
83 bool check_or_update(InstanceKlass* k, Handle loader, Symbol* name);
84
85 void purge_loader_constraints();
86
87 void verify(PlaceholderTable* placeholders);
88 #ifndef PRODUCT
89 void print();
90 #endif
91 };
92
93 class LoaderConstraintEntry : public HashtableEntry<InstanceKlass*, mtClass> {
94 friend class VMStructs;
95 private:
96 Symbol* _name; // class name
97 int _num_loaders;
98 int _max_loaders;
99 // Loader constraints enforce correct linking behavior.
100 // Thus, it really operates on ClassLoaderData which represents linking domain,
101 // not class loaders.
102 ClassLoaderData** _loaders; // initiating loaders
103
104 public:
105
106 InstanceKlass* klass() { return literal(); }
107 InstanceKlass** klass_addr() { return literal_addr(); }
|