Mercurial > hg > truffle
annotate src/share/vm/ci/ciObjectFactory.hpp @ 1478:5571b97fc1ec
More JNI global handle clean ups.
author | Thomas Wuerthinger <wuerthinger@ssw.jku.at> |
---|---|
date | Fri, 26 Nov 2010 19:45:05 +0100 |
parents | a61af66fc99e |
children | 2d26b0046e0d |
rev | line source |
---|---|
0 | 1 /* |
2 * Copyright 1999-2007 Sun Microsystems, Inc. All Rights Reserved. | |
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 * | |
19 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, | |
20 * CA 95054 USA or visit www.sun.com if you need additional information or | |
21 * have any questions. | |
22 * | |
23 */ | |
24 | |
25 // ciObjectFactory | |
26 // | |
27 // This class handles requests for the creation of new instances | |
28 // of ciObject and its subclasses. It contains a caching mechanism | |
29 // which ensures that for each oop, at most one ciObject is created. | |
30 // This invariant allows efficient implementation of ciObject. | |
31 class ciObjectFactory : public ResourceObj { | |
32 private: | |
33 static volatile bool _initialized; | |
34 static GrowableArray<ciObject*>* _shared_ci_objects; | |
35 static ciSymbol* _shared_ci_symbols[]; | |
36 static int _shared_ident_limit; | |
37 | |
38 Arena* _arena; | |
39 GrowableArray<ciObject*>* _ci_objects; | |
40 GrowableArray<ciMethod*>* _unloaded_methods; | |
41 GrowableArray<ciKlass*>* _unloaded_klasses; | |
42 GrowableArray<ciReturnAddress*>* _return_addresses; | |
43 int _next_ident; | |
44 | |
45 public: | |
46 struct NonPermObject : public ResourceObj { | |
47 ciObject* _object; | |
48 NonPermObject* _next; | |
49 | |
50 inline NonPermObject(NonPermObject* &bucket, oop key, ciObject* object); | |
51 ciObject* object() { return _object; } | |
52 NonPermObject* &next() { return _next; } | |
53 }; | |
54 private: | |
55 enum { NON_PERM_BUCKETS = 61 }; | |
56 NonPermObject* _non_perm_bucket[NON_PERM_BUCKETS]; | |
57 int _non_perm_count; | |
58 | |
59 int find(oop key, GrowableArray<ciObject*>* objects); | |
60 bool is_found_at(int index, oop key, GrowableArray<ciObject*>* objects); | |
61 void insert(int index, ciObject* obj, GrowableArray<ciObject*>* objects); | |
62 ciObject* create_new_object(oop o); | |
63 static bool is_equal(NonPermObject* p, oop key) { | |
64 return p->object()->get_oop() == key; | |
65 } | |
66 | |
67 NonPermObject* &find_non_perm(oop key); | |
68 void insert_non_perm(NonPermObject* &where, oop key, ciObject* obj); | |
69 | |
70 void init_ident_of(ciObject* obj); | |
71 | |
72 Arena* arena() { return _arena; } | |
73 | |
74 void print_contents_impl(); | |
75 | |
76 public: | |
77 static bool is_initialized() { return _initialized; } | |
78 | |
79 static void initialize(); | |
80 void init_shared_objects(); | |
81 | |
82 ciObjectFactory(Arena* arena, int expected_size); | |
83 | |
1478
5571b97fc1ec
More JNI global handle clean ups.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
0
diff
changeset
|
84 void cleanup(); |
0 | 85 |
86 // Get the ciObject corresponding to some oop. | |
87 ciObject* get(oop key); | |
88 | |
89 // Get the ciSymbol corresponding to one of the vmSymbols. | |
90 static ciSymbol* vm_symbol_at(int index); | |
91 | |
92 // Get the ciMethod representing an unloaded/unfound method. | |
93 ciMethod* get_unloaded_method(ciInstanceKlass* holder, | |
94 ciSymbol* name, | |
95 ciSymbol* signature); | |
96 | |
97 // Get a ciKlass representing an unloaded klass. | |
98 ciKlass* get_unloaded_klass(ciKlass* accessing_klass, | |
99 ciSymbol* name, | |
100 bool create_if_not_found); | |
101 | |
102 | |
103 // Get the ciMethodData representing the methodData for a method | |
104 // with none. | |
105 ciMethodData* get_empty_methodData(); | |
106 | |
107 ciReturnAddress* get_return_address(int bci); | |
108 | |
109 void print_contents(); | |
110 void print(); | |
111 }; |