author | alanb |
Thu, 17 Mar 2016 19:04:01 +0000 | |
changeset 36508 | 5f9eee6b383b |
parent 13728 | 882756847a04 |
child 46329 | 53ccc37bda19 |
permissions | -rw-r--r-- |
1 | 1 |
/* |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13195
diff
changeset
|
2 |
* Copyright (c) 2003, 2012, 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; |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13195
diff
changeset
|
33 |
class Symbol; |
1 | 34 |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13195
diff
changeset
|
35 |
class LoaderConstraintTable : public Hashtable<Klass*, mtClass> { |
1 | 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 |
||
8076
96d498ec7ae1
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
7397
diff
changeset
|
44 |
LoaderConstraintEntry** find_loader_constraint(Symbol* name, |
1 | 45 |
Handle loader); |
46 |
||
47 |
public: |
|
48 |
||
49 |
LoaderConstraintTable(int nof_buckets); |
|
50 |
||
8076
96d498ec7ae1
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
7397
diff
changeset
|
51 |
LoaderConstraintEntry* new_entry(unsigned int hash, Symbol* name, |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13195
diff
changeset
|
52 |
Klass* klass, int num_loaders, |
1 | 53 |
int max_loaders); |
8076
96d498ec7ae1
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
7397
diff
changeset
|
54 |
void free_entry(LoaderConstraintEntry *entry); |
1 | 55 |
|
56 |
LoaderConstraintEntry* bucket(int i) { |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13195
diff
changeset
|
57 |
return (LoaderConstraintEntry*)Hashtable<Klass*, mtClass>::bucket(i); |
1 | 58 |
} |
59 |
||
60 |
LoaderConstraintEntry** bucket_addr(int i) { |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13195
diff
changeset
|
61 |
return (LoaderConstraintEntry**)Hashtable<Klass*, mtClass>::bucket_addr(i); |
1 | 62 |
} |
63 |
||
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13195
diff
changeset
|
64 |
// Enhanced Class Redefinition support |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13195
diff
changeset
|
65 |
void classes_do(KlassClosure* f); |
1 | 66 |
|
67 |
// Check class loader constraints |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13195
diff
changeset
|
68 |
bool add_entry(Symbol* name, Klass* klass1, Handle loader1, |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13195
diff
changeset
|
69 |
Klass* klass2, Handle loader2); |
1 | 70 |
|
2332
5c7b6f4ce0a1
6814659: separable cleanups and subroutines for 6655638
jrose
parents:
1
diff
changeset
|
71 |
// Note: The main entry point for this module is via SystemDictionary. |
8076
96d498ec7ae1
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
7397
diff
changeset
|
72 |
// SystemDictionary::check_signature_loaders(Symbol* signature, |
2332
5c7b6f4ce0a1
6814659: separable cleanups and subroutines for 6655638
jrose
parents:
1
diff
changeset
|
73 |
// Handle loader1, Handle loader2, |
5c7b6f4ce0a1
6814659: separable cleanups and subroutines for 6655638
jrose
parents:
1
diff
changeset
|
74 |
// bool is_method, TRAPS) |
1 | 75 |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13195
diff
changeset
|
76 |
Klass* find_constrained_klass(Symbol* name, Handle loader); |
1 | 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, |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13195
diff
changeset
|
82 |
Klass* klass); |
1 | 83 |
void merge_loader_constraints(LoaderConstraintEntry** pp1, |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13195
diff
changeset
|
84 |
LoaderConstraintEntry** pp2, Klass* klass); |
1 | 85 |
|
86 |
bool check_or_update(instanceKlassHandle k, Handle loader, |
|
8076
96d498ec7ae1
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
7397
diff
changeset
|
87 |
Symbol* name); |
1 | 88 |
|
89 |
||
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13195
diff
changeset
|
90 |
void purge_loader_constraints(); |
1 | 91 |
|
4899
ab225bac579c
6920977: G1: guarantee(k == probe->klass(),"klass should be in dictionary") fails
tonyp
parents:
2332
diff
changeset
|
92 |
void verify(Dictionary* dictionary, PlaceholderTable* placeholders); |
1 | 93 |
#ifndef PRODUCT |
94 |
void print(); |
|
95 |
#endif |
|
96 |
}; |
|
97 |
||
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13195
diff
changeset
|
98 |
class LoaderConstraintEntry : public HashtableEntry<Klass*, mtClass> { |
1 | 99 |
friend class VMStructs; |
100 |
private: |
|
8076
96d498ec7ae1
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
7397
diff
changeset
|
101 |
Symbol* _name; // class name |
1 | 102 |
int _num_loaders; |
103 |
int _max_loaders; |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13195
diff
changeset
|
104 |
// Loader constraints enforce correct linking behavior. |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13195
diff
changeset
|
105 |
// Thus, it really operates on ClassLoaderData which represents linking domain, |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13195
diff
changeset
|
106 |
// not class loaders. |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13195
diff
changeset
|
107 |
ClassLoaderData** _loaders; // initiating loaders |
1 | 108 |
|
109 |
public: |
|
110 |
||
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13195
diff
changeset
|
111 |
Klass* klass() { return literal(); } |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13195
diff
changeset
|
112 |
Klass** klass_addr() { return literal_addr(); } |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13195
diff
changeset
|
113 |
void set_klass(Klass* k) { set_literal(k); } |
1 | 114 |
|
115 |
LoaderConstraintEntry* next() { |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13195
diff
changeset
|
116 |
return (LoaderConstraintEntry*)HashtableEntry<Klass*, mtClass>::next(); |
1 | 117 |
} |
118 |
||
119 |
LoaderConstraintEntry** next_addr() { |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13195
diff
changeset
|
120 |
return (LoaderConstraintEntry**)HashtableEntry<Klass*, mtClass>::next_addr(); |
1 | 121 |
} |
122 |
void set_next(LoaderConstraintEntry* next) { |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13195
diff
changeset
|
123 |
HashtableEntry<Klass*, mtClass>::set_next(next); |
1 | 124 |
} |
125 |
||
8076
96d498ec7ae1
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
7397
diff
changeset
|
126 |
Symbol* name() { return _name; } |
96d498ec7ae1
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
7397
diff
changeset
|
127 |
void set_name(Symbol* name) { |
96d498ec7ae1
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
7397
diff
changeset
|
128 |
_name = name; |
96d498ec7ae1
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
7397
diff
changeset
|
129 |
if (name != NULL) name->increment_refcount(); |
96d498ec7ae1
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
7397
diff
changeset
|
130 |
} |
1 | 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 |
||
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13195
diff
changeset
|
138 |
ClassLoaderData** loaders() { return _loaders; } |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13195
diff
changeset
|
139 |
void set_loaders(ClassLoaderData** loaders) { _loaders = loaders; } |
1 | 140 |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13195
diff
changeset
|
141 |
ClassLoaderData* loader_data(int i) { return _loaders[i]; } |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13195
diff
changeset
|
142 |
void set_loader_data(int i, ClassLoaderData* p) { _loaders[i] = p; } |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13195
diff
changeset
|
143 |
// convenience |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13195
diff
changeset
|
144 |
void set_loader(int i, oop p); |
1 | 145 |
}; |
7397 | 146 |
|
147 |
#endif // SHARE_VM_CLASSFILE_LOADERCONSTRAINTS_HPP |