Mercurial > hg > truffle
annotate src/share/vm/classfile/resolutionErrors.cpp @ 1972:f95d63e2154a
6989984: Use standard include model for Hospot
Summary: Replaced MakeDeps and the includeDB files with more standardized solutions.
Reviewed-by: coleenp, kvn, kamg
author | stefank |
---|---|
date | Tue, 23 Nov 2010 13:22:55 -0800 |
parents | c18cbe5936b8 |
children | 3582bf76420e |
rev | line source |
---|---|
0 | 1 /* |
1972 | 2 * Copyright (c) 2005, 2010, 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:
1489
diff
changeset
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
1489
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:
1489
diff
changeset
|
21 * questions. |
0 | 22 * |
23 */ | |
24 | |
1972 | 25 #include "precompiled.hpp" |
26 #include "classfile/resolutionErrors.hpp" | |
27 #include "memory/resourceArea.hpp" | |
28 #include "oops/oop.inline.hpp" | |
29 #include "runtime/handles.inline.hpp" | |
30 #include "runtime/safepoint.hpp" | |
31 #include "utilities/hashtable.inline.hpp" | |
0 | 32 |
33 // add new entry to the table | |
34 void ResolutionErrorTable::add_entry(int index, unsigned int hash, | |
35 constantPoolHandle pool, int cp_index, symbolHandle error) | |
36 { | |
37 assert_locked_or_safepoint(SystemDictionary_lock); | |
38 assert(!pool.is_null() && !error.is_null(), "adding NULL obj"); | |
39 | |
40 ResolutionErrorEntry* entry = new_entry(hash, pool(), cp_index, error()); | |
41 add_entry(index, entry); | |
42 } | |
43 | |
44 // find entry in the table | |
45 ResolutionErrorEntry* ResolutionErrorTable::find_entry(int index, unsigned int hash, | |
46 constantPoolHandle pool, int cp_index) | |
47 { | |
48 assert_locked_or_safepoint(SystemDictionary_lock); | |
49 | |
50 for (ResolutionErrorEntry *error_probe = bucket(index); | |
51 error_probe != NULL; | |
52 error_probe = error_probe->next()) { | |
53 if (error_probe->hash() == hash && error_probe->pool() == pool()) { | |
54 return error_probe;; | |
55 } | |
56 } | |
57 return NULL; | |
58 } | |
59 | |
60 // create new error entry | |
61 ResolutionErrorEntry* ResolutionErrorTable::new_entry(int hash, constantPoolOop pool, | |
62 int cp_index, symbolOop error) | |
63 { | |
64 ResolutionErrorEntry* entry = (ResolutionErrorEntry*)Hashtable::new_entry(hash, pool); | |
65 entry->set_cp_index(cp_index); | |
66 entry->set_error(error); | |
67 | |
68 return entry; | |
69 } | |
70 | |
71 // create resolution error table | |
72 ResolutionErrorTable::ResolutionErrorTable(int table_size) | |
73 : Hashtable(table_size, sizeof(ResolutionErrorEntry)) { | |
74 } | |
75 | |
76 // GC support | |
77 void ResolutionErrorTable::oops_do(OopClosure* f) { | |
78 for (int i = 0; i < table_size(); i++) { | |
79 for (ResolutionErrorEntry* probe = bucket(i); | |
80 probe != NULL; | |
81 probe = probe->next()) { | |
82 assert(probe->pool() != (constantPoolOop)NULL, "resolution error table is corrupt"); | |
83 assert(probe->error() != (symbolOop)NULL, "resolution error table is corrupt"); | |
84 probe->oops_do(f); | |
85 } | |
86 } | |
87 } | |
88 | |
89 // GC support | |
90 void ResolutionErrorEntry::oops_do(OopClosure* blk) { | |
91 blk->do_oop((oop*)pool_addr()); | |
92 blk->do_oop((oop*)error_addr()); | |
93 } | |
94 | |
95 // We must keep the symbolOop used in the error alive. The constantPoolOop will | |
96 // decide when the entry can be purged. | |
97 void ResolutionErrorTable::always_strong_classes_do(OopClosure* blk) { | |
98 for (int i = 0; i < table_size(); i++) { | |
99 for (ResolutionErrorEntry* probe = bucket(i); | |
100 probe != NULL; | |
101 probe = probe->next()) { | |
102 assert(probe->error() != (symbolOop)NULL, "resolution error table is corrupt"); | |
103 blk->do_oop((oop*)probe->error_addr()); | |
104 } | |
105 } | |
106 } | |
107 | |
108 // Remove unloaded entries from the table | |
109 void ResolutionErrorTable::purge_resolution_errors(BoolObjectClosure* is_alive) { | |
1489
cff162798819
6888953: some calls to function-like macros are missing semicolons
jcoomes
parents:
0
diff
changeset
|
110 assert(SafepointSynchronize::is_at_safepoint(), "must be at safepoint"); |
0 | 111 for (int i = 0; i < table_size(); i++) { |
112 for (ResolutionErrorEntry** p = bucket_addr(i); *p != NULL; ) { | |
113 ResolutionErrorEntry* entry = *p; | |
114 assert(entry->pool() != (constantPoolOop)NULL, "resolution error table is corrupt"); | |
115 constantPoolOop pool = entry->pool(); | |
116 if (is_alive->do_object_b(pool)) { | |
117 p = entry->next_addr(); | |
118 } else { | |
119 *p = entry->next(); | |
120 free_entry(entry); | |
121 } | |
122 } | |
123 } | |
124 } |