author | ikrylov |
Wed, 01 Dec 2010 18:26:32 -0500 | |
changeset 7405 | e6fc8d3926f8 |
parent 7397 | 5b173b4ca846 |
child 8076 | 96d498ec7ae1 |
permissions | -rw-r--r-- |
1 | 1 |
/* |
7397 | 2 |
* Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved. |
1 | 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 |
* |
|
5547
f4b087cbb361
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
5124
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
f4b087cbb361
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
5124
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
f4b087cbb361
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
5124
diff
changeset
|
21 |
* questions. |
1 | 22 |
* |
23 |
*/ |
|
24 |
||
7397 | 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 |
||
1 | 32 |
class LoaderConstraintEntry; |
33 |
||
34 |
class LoaderConstraintTable : public Hashtable { |
|
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 |
||
43 |
LoaderConstraintEntry** find_loader_constraint(symbolHandle name, |
|
44 |
Handle loader); |
|
45 |
||
46 |
public: |
|
47 |
||
48 |
LoaderConstraintTable(int nof_buckets); |
|
49 |
||
50 |
LoaderConstraintEntry* new_entry(unsigned int hash, symbolOop name, |
|
51 |
klassOop klass, int num_loaders, |
|
52 |
int max_loaders); |
|
53 |
||
54 |
LoaderConstraintEntry* bucket(int i) { |
|
55 |
return (LoaderConstraintEntry*)Hashtable::bucket(i); |
|
56 |
} |
|
57 |
||
58 |
LoaderConstraintEntry** bucket_addr(int i) { |
|
59 |
return (LoaderConstraintEntry**)Hashtable::bucket_addr(i); |
|
60 |
} |
|
61 |
||
62 |
// GC support |
|
63 |
void oops_do(OopClosure* f); |
|
64 |
void always_strong_classes_do(OopClosure* blk); |
|
65 |
||
66 |
// Check class loader constraints |
|
67 |
bool add_entry(symbolHandle name, klassOop klass1, Handle loader1, |
|
68 |
klassOop klass2, Handle loader2); |
|
69 |
||
2332
5c7b6f4ce0a1
6814659: separable cleanups and subroutines for 6655638
jrose
parents:
1
diff
changeset
|
70 |
// Note: The main entry point for this module is via SystemDictionary. |
5c7b6f4ce0a1
6814659: separable cleanups and subroutines for 6655638
jrose
parents:
1
diff
changeset
|
71 |
// SystemDictionary::check_signature_loaders(symbolHandle signature, |
5c7b6f4ce0a1
6814659: separable cleanups and subroutines for 6655638
jrose
parents:
1
diff
changeset
|
72 |
// Handle loader1, Handle loader2, |
5c7b6f4ce0a1
6814659: separable cleanups and subroutines for 6655638
jrose
parents:
1
diff
changeset
|
73 |
// bool is_method, TRAPS) |
1 | 74 |
|
75 |
klassOop find_constrained_klass(symbolHandle name, Handle loader); |
|
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, |
|
86 |
symbolHandle name); |
|
87 |
||
88 |
||
89 |
void purge_loader_constraints(BoolObjectClosure* is_alive); |
|
90 |
||
4899
ab225bac579c
6920977: G1: guarantee(k == probe->klass(),"klass should be in dictionary") fails
tonyp
parents:
2332
diff
changeset
|
91 |
void verify(Dictionary* dictionary, PlaceholderTable* placeholders); |
1 | 92 |
#ifndef PRODUCT |
93 |
void print(); |
|
94 |
#endif |
|
95 |
}; |
|
96 |
||
97 |
class LoaderConstraintEntry : public HashtableEntry { |
|
98 |
friend class VMStructs; |
|
99 |
private: |
|
100 |
symbolOop _name; // class name |
|
101 |
int _num_loaders; |
|
102 |
int _max_loaders; |
|
103 |
oop* _loaders; // initiating loaders |
|
104 |
||
105 |
public: |
|
106 |
||
107 |
klassOop klass() { return (klassOop)literal(); } |
|
108 |
klassOop* klass_addr() { return (klassOop*)literal_addr(); } |
|
109 |
void set_klass(klassOop k) { set_literal(k); } |
|
110 |
||
111 |
LoaderConstraintEntry* next() { |
|
112 |
return (LoaderConstraintEntry*)HashtableEntry::next(); |
|
113 |
} |
|
114 |
||
115 |
LoaderConstraintEntry** next_addr() { |
|
116 |
return (LoaderConstraintEntry**)HashtableEntry::next_addr(); |
|
117 |
} |
|
118 |
void set_next(LoaderConstraintEntry* next) { |
|
119 |
HashtableEntry::set_next(next); |
|
120 |
} |
|
121 |
||
122 |
symbolOop name() { return _name; } |
|
123 |
symbolOop* name_addr() { return &_name; } |
|
124 |
void set_name(symbolOop name) { _name = name; } |
|
125 |
||
126 |
int num_loaders() { return _num_loaders; } |
|
127 |
void set_num_loaders(int i) { _num_loaders = i; } |
|
128 |
||
129 |
int max_loaders() { return _max_loaders; } |
|
130 |
void set_max_loaders(int i) { _max_loaders = i; } |
|
131 |
||
132 |
oop* loaders() { return _loaders; } |
|
133 |
void set_loaders(oop* loaders) { _loaders = loaders; } |
|
134 |
||
135 |
oop loader(int i) { return _loaders[i]; } |
|
136 |
oop* loader_addr(int i) { return &_loaders[i]; } |
|
137 |
void set_loader(int i, oop p) { _loaders[i] = p; } |
|
138 |
||
139 |
}; |
|
7397 | 140 |
|
141 |
#endif // SHARE_VM_CLASSFILE_LOADERCONSTRAINTS_HPP |