Mercurial > hg > truffle
annotate src/share/vm/classfile/loaderConstraints.hpp @ 2645:b2c1e959be46
Clean up around BlockBegin / StdEntry.
author | Thomas Wuerthinger <thomas@wuerthinger.net> |
---|---|
date | Wed, 11 May 2011 14:34:29 +0200 |
parents | 1d1603768966 |
children | d2a62e0f25eb |
rev | line source |
---|---|
0 | 1 /* |
2426
1d1603768966
7010070: Update all 2010 Oracle-changed OpenJDK files to have the proper copyright dates - second pass
trims
parents:
2177
diff
changeset
|
2 * Copyright (c) 2003, 2011, 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; |
33 | |
2177
3582bf76420e
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
1972
diff
changeset
|
34 class LoaderConstraintTable : public Hashtable<klassOop> { |
0 | 35 friend class VMStructs; |
36 private: | |
37 | |
38 enum Constants { | |
39 _loader_constraint_size = 107, // number of entries in constraint table | |
40 _nof_buckets = 1009 // number of buckets in hash table | |
41 }; | |
42 | |
2177
3582bf76420e
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
1972
diff
changeset
|
43 LoaderConstraintEntry** find_loader_constraint(Symbol* name, |
0 | 44 Handle loader); |
45 | |
46 public: | |
47 | |
48 LoaderConstraintTable(int nof_buckets); | |
49 | |
2177
3582bf76420e
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
1972
diff
changeset
|
50 LoaderConstraintEntry* new_entry(unsigned int hash, Symbol* name, |
0 | 51 klassOop klass, int num_loaders, |
52 int max_loaders); | |
2177
3582bf76420e
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
1972
diff
changeset
|
53 void free_entry(LoaderConstraintEntry *entry); |
0 | 54 |
55 LoaderConstraintEntry* bucket(int i) { | |
2177
3582bf76420e
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
1972
diff
changeset
|
56 return (LoaderConstraintEntry*)Hashtable<klassOop>::bucket(i); |
0 | 57 } |
58 | |
59 LoaderConstraintEntry** bucket_addr(int i) { | |
2177
3582bf76420e
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
1972
diff
changeset
|
60 return (LoaderConstraintEntry**)Hashtable<klassOop>::bucket_addr(i); |
0 | 61 } |
62 | |
63 // GC support | |
64 void oops_do(OopClosure* f); | |
65 | |
66 // Check class loader constraints | |
2177
3582bf76420e
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
1972
diff
changeset
|
67 bool add_entry(Symbol* name, klassOop klass1, Handle loader1, |
0 | 68 klassOop klass2, Handle loader2); |
69 | |
665
c89f86385056
6814659: separable cleanups and subroutines for 6655638
jrose
parents:
0
diff
changeset
|
70 // 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
|
71 // SystemDictionary::check_signature_loaders(Symbol* signature, |
665
c89f86385056
6814659: separable cleanups and subroutines for 6655638
jrose
parents:
0
diff
changeset
|
72 // Handle loader1, Handle loader2, |
c89f86385056
6814659: separable cleanups and subroutines for 6655638
jrose
parents:
0
diff
changeset
|
73 // bool is_method, TRAPS) |
0 | 74 |
2177
3582bf76420e
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
1972
diff
changeset
|
75 klassOop find_constrained_klass(Symbol* name, Handle loader); |
0 | 76 |
77 // Class loader constraints | |
78 | |
79 void ensure_loader_constraint_capacity(LoaderConstraintEntry *p, int nfree); | |
80 void extend_loader_constraint(LoaderConstraintEntry* p, Handle loader, | |
81 klassOop klass); | |
82 void merge_loader_constraints(LoaderConstraintEntry** pp1, | |
83 LoaderConstraintEntry** pp2, klassOop klass); | |
84 | |
85 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
|
86 Symbol* name); |
0 | 87 |
88 | |
89 void purge_loader_constraints(BoolObjectClosure* is_alive); | |
90 | |
1258
38836cf1d8d2
6920977: G1: guarantee(k == probe->klass(),"klass should be in dictionary") fails
tonyp
parents:
665
diff
changeset
|
91 void verify(Dictionary* dictionary, PlaceholderTable* placeholders); |
0 | 92 #ifndef PRODUCT |
93 void print(); | |
94 #endif | |
95 }; | |
96 | |
2177
3582bf76420e
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
1972
diff
changeset
|
97 class LoaderConstraintEntry : public HashtableEntry<klassOop> { |
0 | 98 friend class VMStructs; |
99 private: | |
2177
3582bf76420e
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
1972
diff
changeset
|
100 Symbol* _name; // class name |
0 | 101 int _num_loaders; |
102 int _max_loaders; | |
103 oop* _loaders; // initiating loaders | |
104 | |
105 public: | |
106 | |
2177
3582bf76420e
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
1972
diff
changeset
|
107 klassOop klass() { return literal(); } |
3582bf76420e
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
1972
diff
changeset
|
108 klassOop* klass_addr() { return literal_addr(); } |
0 | 109 void set_klass(klassOop k) { set_literal(k); } |
110 | |
111 LoaderConstraintEntry* next() { | |
2177
3582bf76420e
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
1972
diff
changeset
|
112 return (LoaderConstraintEntry*)HashtableEntry<klassOop>::next(); |
0 | 113 } |
114 | |
115 LoaderConstraintEntry** next_addr() { | |
2177
3582bf76420e
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
1972
diff
changeset
|
116 return (LoaderConstraintEntry**)HashtableEntry<klassOop>::next_addr(); |
0 | 117 } |
118 void set_next(LoaderConstraintEntry* next) { | |
2177
3582bf76420e
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
1972
diff
changeset
|
119 HashtableEntry<klassOop>::set_next(next); |
0 | 120 } |
121 | |
2177
3582bf76420e
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
1972
diff
changeset
|
122 Symbol* name() { return _name; } |
3582bf76420e
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
1972
diff
changeset
|
123 void set_name(Symbol* name) { |
3582bf76420e
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
1972
diff
changeset
|
124 _name = name; |
3582bf76420e
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
1972
diff
changeset
|
125 if (name != NULL) name->increment_refcount(); |
3582bf76420e
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
1972
diff
changeset
|
126 } |
0 | 127 |
128 int num_loaders() { return _num_loaders; } | |
129 void set_num_loaders(int i) { _num_loaders = i; } | |
130 | |
131 int max_loaders() { return _max_loaders; } | |
132 void set_max_loaders(int i) { _max_loaders = i; } | |
133 | |
134 oop* loaders() { return _loaders; } | |
135 void set_loaders(oop* loaders) { _loaders = loaders; } | |
136 | |
137 oop loader(int i) { return _loaders[i]; } | |
138 oop* loader_addr(int i) { return &_loaders[i]; } | |
139 void set_loader(int i, oop p) { _loaders[i] = p; } | |
140 | |
141 }; | |
1972 | 142 |
143 #endif // SHARE_VM_CLASSFILE_LOADERCONSTRAINTS_HPP |