annotate src/share/vm/classfile/loaderConstraints.hpp @ 196:d1605aabd0a1 jdk7-b30

6719955: Update copyright year Summary: Update copyright year for files that have been modified in 2008 Reviewed-by: ohair, tbell
author xdono
date Wed, 02 Jul 2008 12:55:16 -0700
parents a61af66fc99e
children c89f86385056
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
a61af66fc99e Initial load
duke
parents:
diff changeset
1 /*
a61af66fc99e Initial load
duke
parents:
diff changeset
2 * Copyright 2003-2006 Sun Microsystems, Inc. All Rights Reserved.
a61af66fc99e Initial load
duke
parents:
diff changeset
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
a61af66fc99e Initial load
duke
parents:
diff changeset
4 *
a61af66fc99e Initial load
duke
parents:
diff changeset
5 * This code is free software; you can redistribute it and/or modify it
a61af66fc99e Initial load
duke
parents:
diff changeset
6 * under the terms of the GNU General Public License version 2 only, as
a61af66fc99e Initial load
duke
parents:
diff changeset
7 * published by the Free Software Foundation.
a61af66fc99e Initial load
duke
parents:
diff changeset
8 *
a61af66fc99e Initial load
duke
parents:
diff changeset
9 * This code is distributed in the hope that it will be useful, but WITHOUT
a61af66fc99e Initial load
duke
parents:
diff changeset
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
a61af66fc99e Initial load
duke
parents:
diff changeset
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
a61af66fc99e Initial load
duke
parents:
diff changeset
12 * version 2 for more details (a copy is included in the LICENSE file that
a61af66fc99e Initial load
duke
parents:
diff changeset
13 * accompanied this code).
a61af66fc99e Initial load
duke
parents:
diff changeset
14 *
a61af66fc99e Initial load
duke
parents:
diff changeset
15 * You should have received a copy of the GNU General Public License version
a61af66fc99e Initial load
duke
parents:
diff changeset
16 * 2 along with this work; if not, write to the Free Software Foundation,
a61af66fc99e Initial load
duke
parents:
diff changeset
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
a61af66fc99e Initial load
duke
parents:
diff changeset
18 *
a61af66fc99e Initial load
duke
parents:
diff changeset
19 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
a61af66fc99e Initial load
duke
parents:
diff changeset
20 * CA 95054 USA or visit www.sun.com if you need additional information or
a61af66fc99e Initial load
duke
parents:
diff changeset
21 * have any questions.
a61af66fc99e Initial load
duke
parents:
diff changeset
22 *
a61af66fc99e Initial load
duke
parents:
diff changeset
23 */
a61af66fc99e Initial load
duke
parents:
diff changeset
24
a61af66fc99e Initial load
duke
parents:
diff changeset
25 class LoaderConstraintEntry;
a61af66fc99e Initial load
duke
parents:
diff changeset
26
a61af66fc99e Initial load
duke
parents:
diff changeset
27 class LoaderConstraintTable : public Hashtable {
a61af66fc99e Initial load
duke
parents:
diff changeset
28 friend class VMStructs;
a61af66fc99e Initial load
duke
parents:
diff changeset
29 private:
a61af66fc99e Initial load
duke
parents:
diff changeset
30
a61af66fc99e Initial load
duke
parents:
diff changeset
31 enum Constants {
a61af66fc99e Initial load
duke
parents:
diff changeset
32 _loader_constraint_size = 107, // number of entries in constraint table
a61af66fc99e Initial load
duke
parents:
diff changeset
33 _nof_buckets = 1009 // number of buckets in hash table
a61af66fc99e Initial load
duke
parents:
diff changeset
34 };
a61af66fc99e Initial load
duke
parents:
diff changeset
35
a61af66fc99e Initial load
duke
parents:
diff changeset
36 LoaderConstraintEntry** find_loader_constraint(symbolHandle name,
a61af66fc99e Initial load
duke
parents:
diff changeset
37 Handle loader);
a61af66fc99e Initial load
duke
parents:
diff changeset
38
a61af66fc99e Initial load
duke
parents:
diff changeset
39 public:
a61af66fc99e Initial load
duke
parents:
diff changeset
40
a61af66fc99e Initial load
duke
parents:
diff changeset
41 LoaderConstraintTable(int nof_buckets);
a61af66fc99e Initial load
duke
parents:
diff changeset
42
a61af66fc99e Initial load
duke
parents:
diff changeset
43 LoaderConstraintEntry* new_entry(unsigned int hash, symbolOop name,
a61af66fc99e Initial load
duke
parents:
diff changeset
44 klassOop klass, int num_loaders,
a61af66fc99e Initial load
duke
parents:
diff changeset
45 int max_loaders);
a61af66fc99e Initial load
duke
parents:
diff changeset
46
a61af66fc99e Initial load
duke
parents:
diff changeset
47 LoaderConstraintEntry* bucket(int i) {
a61af66fc99e Initial load
duke
parents:
diff changeset
48 return (LoaderConstraintEntry*)Hashtable::bucket(i);
a61af66fc99e Initial load
duke
parents:
diff changeset
49 }
a61af66fc99e Initial load
duke
parents:
diff changeset
50
a61af66fc99e Initial load
duke
parents:
diff changeset
51 LoaderConstraintEntry** bucket_addr(int i) {
a61af66fc99e Initial load
duke
parents:
diff changeset
52 return (LoaderConstraintEntry**)Hashtable::bucket_addr(i);
a61af66fc99e Initial load
duke
parents:
diff changeset
53 }
a61af66fc99e Initial load
duke
parents:
diff changeset
54
a61af66fc99e Initial load
duke
parents:
diff changeset
55 // GC support
a61af66fc99e Initial load
duke
parents:
diff changeset
56 void oops_do(OopClosure* f);
a61af66fc99e Initial load
duke
parents:
diff changeset
57 void always_strong_classes_do(OopClosure* blk);
a61af66fc99e Initial load
duke
parents:
diff changeset
58
a61af66fc99e Initial load
duke
parents:
diff changeset
59 // Check class loader constraints
a61af66fc99e Initial load
duke
parents:
diff changeset
60 bool add_entry(symbolHandle name, klassOop klass1, Handle loader1,
a61af66fc99e Initial load
duke
parents:
diff changeset
61 klassOop klass2, Handle loader2);
a61af66fc99e Initial load
duke
parents:
diff changeset
62
a61af66fc99e Initial load
duke
parents:
diff changeset
63 void check_signature_loaders(symbolHandle signature, Handle loader1,
a61af66fc99e Initial load
duke
parents:
diff changeset
64 Handle loader2, bool is_method, TRAPS);
a61af66fc99e Initial load
duke
parents:
diff changeset
65
a61af66fc99e Initial load
duke
parents:
diff changeset
66 klassOop find_constrained_klass(symbolHandle name, Handle loader);
a61af66fc99e Initial load
duke
parents:
diff changeset
67 klassOop find_constrained_elem_klass(symbolHandle name, symbolHandle elem_name,
a61af66fc99e Initial load
duke
parents:
diff changeset
68 Handle loader, TRAPS);
a61af66fc99e Initial load
duke
parents:
diff changeset
69
a61af66fc99e Initial load
duke
parents:
diff changeset
70
a61af66fc99e Initial load
duke
parents:
diff changeset
71 // Class loader constraints
a61af66fc99e Initial load
duke
parents:
diff changeset
72
a61af66fc99e Initial load
duke
parents:
diff changeset
73 void ensure_loader_constraint_capacity(LoaderConstraintEntry *p, int nfree);
a61af66fc99e Initial load
duke
parents:
diff changeset
74 void extend_loader_constraint(LoaderConstraintEntry* p, Handle loader,
a61af66fc99e Initial load
duke
parents:
diff changeset
75 klassOop klass);
a61af66fc99e Initial load
duke
parents:
diff changeset
76 void merge_loader_constraints(LoaderConstraintEntry** pp1,
a61af66fc99e Initial load
duke
parents:
diff changeset
77 LoaderConstraintEntry** pp2, klassOop klass);
a61af66fc99e Initial load
duke
parents:
diff changeset
78
a61af66fc99e Initial load
duke
parents:
diff changeset
79 bool check_or_update(instanceKlassHandle k, Handle loader,
a61af66fc99e Initial load
duke
parents:
diff changeset
80 symbolHandle name);
a61af66fc99e Initial load
duke
parents:
diff changeset
81
a61af66fc99e Initial load
duke
parents:
diff changeset
82
a61af66fc99e Initial load
duke
parents:
diff changeset
83 void purge_loader_constraints(BoolObjectClosure* is_alive);
a61af66fc99e Initial load
duke
parents:
diff changeset
84
a61af66fc99e Initial load
duke
parents:
diff changeset
85 void verify(Dictionary* dictionary);
a61af66fc99e Initial load
duke
parents:
diff changeset
86 #ifndef PRODUCT
a61af66fc99e Initial load
duke
parents:
diff changeset
87 void print();
a61af66fc99e Initial load
duke
parents:
diff changeset
88 #endif
a61af66fc99e Initial load
duke
parents:
diff changeset
89 };
a61af66fc99e Initial load
duke
parents:
diff changeset
90
a61af66fc99e Initial load
duke
parents:
diff changeset
91 class LoaderConstraintEntry : public HashtableEntry {
a61af66fc99e Initial load
duke
parents:
diff changeset
92 friend class VMStructs;
a61af66fc99e Initial load
duke
parents:
diff changeset
93 private:
a61af66fc99e Initial load
duke
parents:
diff changeset
94 symbolOop _name; // class name
a61af66fc99e Initial load
duke
parents:
diff changeset
95 int _num_loaders;
a61af66fc99e Initial load
duke
parents:
diff changeset
96 int _max_loaders;
a61af66fc99e Initial load
duke
parents:
diff changeset
97 oop* _loaders; // initiating loaders
a61af66fc99e Initial load
duke
parents:
diff changeset
98
a61af66fc99e Initial load
duke
parents:
diff changeset
99 public:
a61af66fc99e Initial load
duke
parents:
diff changeset
100
a61af66fc99e Initial load
duke
parents:
diff changeset
101 klassOop klass() { return (klassOop)literal(); }
a61af66fc99e Initial load
duke
parents:
diff changeset
102 klassOop* klass_addr() { return (klassOop*)literal_addr(); }
a61af66fc99e Initial load
duke
parents:
diff changeset
103 void set_klass(klassOop k) { set_literal(k); }
a61af66fc99e Initial load
duke
parents:
diff changeset
104
a61af66fc99e Initial load
duke
parents:
diff changeset
105 LoaderConstraintEntry* next() {
a61af66fc99e Initial load
duke
parents:
diff changeset
106 return (LoaderConstraintEntry*)HashtableEntry::next();
a61af66fc99e Initial load
duke
parents:
diff changeset
107 }
a61af66fc99e Initial load
duke
parents:
diff changeset
108
a61af66fc99e Initial load
duke
parents:
diff changeset
109 LoaderConstraintEntry** next_addr() {
a61af66fc99e Initial load
duke
parents:
diff changeset
110 return (LoaderConstraintEntry**)HashtableEntry::next_addr();
a61af66fc99e Initial load
duke
parents:
diff changeset
111 }
a61af66fc99e Initial load
duke
parents:
diff changeset
112 void set_next(LoaderConstraintEntry* next) {
a61af66fc99e Initial load
duke
parents:
diff changeset
113 HashtableEntry::set_next(next);
a61af66fc99e Initial load
duke
parents:
diff changeset
114 }
a61af66fc99e Initial load
duke
parents:
diff changeset
115
a61af66fc99e Initial load
duke
parents:
diff changeset
116 symbolOop name() { return _name; }
a61af66fc99e Initial load
duke
parents:
diff changeset
117 symbolOop* name_addr() { return &_name; }
a61af66fc99e Initial load
duke
parents:
diff changeset
118 void set_name(symbolOop name) { _name = name; }
a61af66fc99e Initial load
duke
parents:
diff changeset
119
a61af66fc99e Initial load
duke
parents:
diff changeset
120 int num_loaders() { return _num_loaders; }
a61af66fc99e Initial load
duke
parents:
diff changeset
121 void set_num_loaders(int i) { _num_loaders = i; }
a61af66fc99e Initial load
duke
parents:
diff changeset
122
a61af66fc99e Initial load
duke
parents:
diff changeset
123 int max_loaders() { return _max_loaders; }
a61af66fc99e Initial load
duke
parents:
diff changeset
124 void set_max_loaders(int i) { _max_loaders = i; }
a61af66fc99e Initial load
duke
parents:
diff changeset
125
a61af66fc99e Initial load
duke
parents:
diff changeset
126 oop* loaders() { return _loaders; }
a61af66fc99e Initial load
duke
parents:
diff changeset
127 void set_loaders(oop* loaders) { _loaders = loaders; }
a61af66fc99e Initial load
duke
parents:
diff changeset
128
a61af66fc99e Initial load
duke
parents:
diff changeset
129 oop loader(int i) { return _loaders[i]; }
a61af66fc99e Initial load
duke
parents:
diff changeset
130 oop* loader_addr(int i) { return &_loaders[i]; }
a61af66fc99e Initial load
duke
parents:
diff changeset
131 void set_loader(int i, oop p) { _loaders[i] = p; }
a61af66fc99e Initial load
duke
parents:
diff changeset
132
a61af66fc99e Initial load
duke
parents:
diff changeset
133 };