Mercurial > hg > truffle
annotate src/share/vm/memory/restore.cpp @ 4058:59e515ee9354
7059047: EA: can't find initializing store with several CheckCastPP
Summary: Split adjust_escape_state() method into two methods to find initializing stores.
Reviewed-by: never
author | kvn |
---|---|
date | Mon, 07 Nov 2011 14:33:57 -0800 |
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:
196
diff
changeset
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
196
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:
196
diff
changeset
|
21 * questions. |
0 | 22 * |
23 */ | |
24 | |
1972 | 25 #include "precompiled.hpp" |
26 #include "classfile/symbolTable.hpp" | |
27 #include "classfile/systemDictionary.hpp" | |
28 #include "memory/filemap.hpp" | |
29 #include "oops/oop.inline.hpp" | |
30 #include "utilities/hashtable.inline.hpp" | |
0 | 31 |
32 | |
33 // Closure for serializing initialization data in from a data area | |
34 // (oop_array) read from the shared file. | |
35 | |
36 class ReadClosure : public SerializeOopClosure { | |
37 private: | |
38 oop** _oop_array; | |
39 | |
40 inline oop nextOop() { | |
41 return *(*_oop_array)++; | |
42 } | |
43 | |
44 public: | |
45 ReadClosure(oop** oop_array) { _oop_array = oop_array; } | |
46 | |
47 void do_oop(oop* p) { | |
48 assert(SharedSkipVerify || *p == NULL || *p == Universe::klassKlassObj(), | |
49 "initializing previously initialized oop."); | |
50 oop obj = nextOop(); | |
51 assert(SharedSkipVerify || (intptr_t)obj >= 0 || (intptr_t)obj < -100, | |
52 "hit tag while initializing oops."); | |
53 assert(SharedSkipVerify || obj->is_oop_or_null(), "invalid oop"); | |
54 *p = obj; | |
55 } | |
56 | |
113
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
57 void do_oop(narrowOop* p) { ShouldNotReachHere(); } |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
58 |
0 | 59 void do_ptr(void** p) { |
60 assert(*p == NULL, "initializing previous initialized pointer."); | |
61 void* obj = nextOop(); | |
62 assert((intptr_t)obj >= 0 || (intptr_t)obj < -100, | |
63 "hit tag while initializing ptrs."); | |
64 *p = obj; | |
65 } | |
66 | |
67 void do_ptr(HeapWord** p) { do_ptr((void **) p); } | |
68 | |
69 void do_int(int* p) { | |
70 *p = (int)(intptr_t)nextOop(); | |
71 } | |
72 | |
73 void do_size_t(size_t* p) { | |
74 // Assumes that size_t and pointers are the same size. | |
75 *p = (size_t)nextOop(); | |
76 } | |
77 | |
78 void do_tag(int tag) { | |
79 int old_tag; | |
80 do_int(&old_tag); | |
81 FileMapInfo::assert_mark(tag == old_tag); | |
82 } | |
83 | |
84 void do_region(u_char* start, size_t size) { | |
85 assert((intptr_t)start % sizeof(oop) == 0, "bad alignment"); | |
86 assert(size % sizeof(oop) == 0, "bad size"); | |
87 do_tag((int)size); | |
88 while (size > 0) { | |
89 *(oop*)start = nextOop(); | |
90 start += sizeof(oop); | |
91 size -= sizeof(oop); | |
92 } | |
93 } | |
94 | |
95 bool reading() const { return true; } | |
96 }; | |
97 | |
98 | |
99 // Read the oop and miscellaneous data from the shared file, and | |
100 // serialize it out to its various destinations. | |
101 | |
102 void CompactingPermGenGen::initialize_oops() { | |
103 FileMapInfo *mapinfo = FileMapInfo::current_info(); | |
104 | |
105 char* buffer = mapinfo->region_base(md); | |
106 | |
107 // Skip over (reserve space for) a list of addresses of C++ vtables | |
108 // for Klass objects. They get filled in later. | |
109 | |
2177
3582bf76420e
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
1972
diff
changeset
|
110 void** vtbl_list = (void**)buffer; |
3582bf76420e
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
1972
diff
changeset
|
111 buffer += vtbl_list_size * sizeof(void*); |
3582bf76420e
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
1972
diff
changeset
|
112 Universe::init_self_patching_vtbl_list(vtbl_list, vtbl_list_size); |
3582bf76420e
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
1972
diff
changeset
|
113 |
0 | 114 // Skip over (reserve space for) dummy C++ vtables Klass objects. |
115 // They are used as is. | |
116 | |
117 intptr_t vtable_size = *(intptr_t*)buffer; | |
118 buffer += sizeof(intptr_t); | |
119 buffer += vtable_size; | |
120 | |
2177
3582bf76420e
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
1972
diff
changeset
|
121 // Skip the recorded symbols. |
3582bf76420e
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
1972
diff
changeset
|
122 |
3582bf76420e
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
1972
diff
changeset
|
123 intptr_t total_symbol_size = *(intptr_t*)buffer; |
3582bf76420e
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
1972
diff
changeset
|
124 buffer += sizeof(intptr_t) * 2; |
3582bf76420e
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
1972
diff
changeset
|
125 buffer += total_symbol_size; |
3582bf76420e
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
1972
diff
changeset
|
126 |
0 | 127 // Create the symbol table using the bucket array at this spot in the |
128 // misc data space. Since the symbol table is often modified, this | |
129 // region (of mapped pages) will be copy-on-write. | |
130 | |
131 int symbolTableLen = *(intptr_t*)buffer; | |
132 buffer += sizeof(intptr_t); | |
133 int number_of_entries = *(intptr_t*)buffer; | |
134 buffer += sizeof(intptr_t); | |
135 SymbolTable::create_table((HashtableBucket*)buffer, symbolTableLen, | |
136 number_of_entries); | |
137 buffer += symbolTableLen; | |
138 | |
139 // Create the string table using the bucket array at this spot in the | |
140 // misc data space. Since the string table is often modified, this | |
141 // region (of mapped pages) will be copy-on-write. | |
142 | |
143 int stringTableLen = *(intptr_t*)buffer; | |
144 buffer += sizeof(intptr_t); | |
145 number_of_entries = *(intptr_t*)buffer; | |
146 buffer += sizeof(intptr_t); | |
147 StringTable::create_table((HashtableBucket*)buffer, stringTableLen, | |
148 number_of_entries); | |
149 buffer += stringTableLen; | |
150 | |
151 // Create the shared dictionary using the bucket array at this spot in | |
152 // the misc data space. Since the shared dictionary table is never | |
153 // modified, this region (of mapped pages) will be (effectively, if | |
154 // not explicitly) read-only. | |
155 | |
156 int sharedDictionaryLen = *(intptr_t*)buffer; | |
157 buffer += sizeof(intptr_t); | |
158 number_of_entries = *(intptr_t*)buffer; | |
159 buffer += sizeof(intptr_t); | |
160 SystemDictionary::set_shared_dictionary((HashtableBucket*)buffer, | |
161 sharedDictionaryLen, | |
162 number_of_entries); | |
163 buffer += sharedDictionaryLen; | |
164 | |
165 // Create the package info table using the bucket array at this spot in | |
166 // the misc data space. Since the package info table is never | |
167 // modified, this region (of mapped pages) will be (effectively, if | |
168 // not explicitly) read-only. | |
169 | |
170 int pkgInfoLen = *(intptr_t*)buffer; | |
171 buffer += sizeof(intptr_t); | |
172 number_of_entries = *(intptr_t*)buffer; | |
173 buffer += sizeof(intptr_t); | |
174 ClassLoader::create_package_info_table((HashtableBucket*)buffer, pkgInfoLen, | |
175 number_of_entries); | |
176 buffer += pkgInfoLen; | |
177 ClassLoader::verify(); | |
178 | |
179 // The following data in the shared misc data region are the linked | |
180 // list elements (HashtableEntry objects) for the symbol table, string | |
181 // table, and shared dictionary. The heap objects refered to by the | |
182 // symbol table, string table, and shared dictionary are permanent and | |
183 // unmovable. Since new entries added to the string and symbol tables | |
184 // are always added at the beginning of the linked lists, THESE LINKED | |
185 // LIST ELEMENTS ARE READ-ONLY. | |
186 | |
187 int len = *(intptr_t*)buffer; // skip over symbol table entries | |
188 buffer += sizeof(intptr_t); | |
189 buffer += len; | |
190 | |
191 len = *(intptr_t*)buffer; // skip over string table entries | |
192 buffer += sizeof(intptr_t); | |
193 buffer += len; | |
194 | |
195 len = *(intptr_t*)buffer; // skip over shared dictionary entries | |
196 buffer += sizeof(intptr_t); | |
197 buffer += len; | |
198 | |
199 len = *(intptr_t*)buffer; // skip over package info table entries | |
200 buffer += sizeof(intptr_t); | |
201 buffer += len; | |
202 | |
203 len = *(intptr_t*)buffer; // skip over package info table char[] arrays. | |
204 buffer += sizeof(intptr_t); | |
205 buffer += len; | |
206 | |
207 oop* oop_array = (oop*)buffer; | |
208 ReadClosure rc(&oop_array); | |
209 serialize_oops(&rc); | |
210 } |