Mercurial > hg > truffle
annotate src/share/vm/memory/restore.cpp @ 1988:684faacebf20
7003782: Update JVMTI version to 1.2 for jdk7
Summary: Update minor version to 1.2 for jdk7
Reviewed-by: phh, dcubed
author | kamg |
---|---|
date | Mon, 06 Dec 2010 20:21:15 -0500 |
parents | f95d63e2154a |
children | 3582bf76420e |
rev | line source |
---|---|
0 | 1 /* |
1972 | 2 * Copyright (c) 2003, 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:
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 | |
110 // Skip over (reserve space for) dummy C++ vtables Klass objects. | |
111 // They are used as is. | |
112 | |
113 void** vtbl_list = (void**)buffer; | |
114 buffer += vtbl_list_size * sizeof(void*); | |
115 intptr_t vtable_size = *(intptr_t*)buffer; | |
116 buffer += sizeof(intptr_t); | |
117 buffer += vtable_size; | |
118 | |
119 // Create the symbol table using the bucket array at this spot in the | |
120 // misc data space. Since the symbol table is often modified, this | |
121 // region (of mapped pages) will be copy-on-write. | |
122 | |
123 int symbolTableLen = *(intptr_t*)buffer; | |
124 buffer += sizeof(intptr_t); | |
125 int number_of_entries = *(intptr_t*)buffer; | |
126 buffer += sizeof(intptr_t); | |
127 SymbolTable::create_table((HashtableBucket*)buffer, symbolTableLen, | |
128 number_of_entries); | |
129 buffer += symbolTableLen; | |
130 | |
131 // Create the string table using the bucket array at this spot in the | |
132 // misc data space. Since the string table is often modified, this | |
133 // region (of mapped pages) will be copy-on-write. | |
134 | |
135 int stringTableLen = *(intptr_t*)buffer; | |
136 buffer += sizeof(intptr_t); | |
137 number_of_entries = *(intptr_t*)buffer; | |
138 buffer += sizeof(intptr_t); | |
139 StringTable::create_table((HashtableBucket*)buffer, stringTableLen, | |
140 number_of_entries); | |
141 buffer += stringTableLen; | |
142 | |
143 // Create the shared dictionary using the bucket array at this spot in | |
144 // the misc data space. Since the shared dictionary table is never | |
145 // modified, this region (of mapped pages) will be (effectively, if | |
146 // not explicitly) read-only. | |
147 | |
148 int sharedDictionaryLen = *(intptr_t*)buffer; | |
149 buffer += sizeof(intptr_t); | |
150 number_of_entries = *(intptr_t*)buffer; | |
151 buffer += sizeof(intptr_t); | |
152 SystemDictionary::set_shared_dictionary((HashtableBucket*)buffer, | |
153 sharedDictionaryLen, | |
154 number_of_entries); | |
155 buffer += sharedDictionaryLen; | |
156 | |
157 // Create the package info table using the bucket array at this spot in | |
158 // the misc data space. Since the package info table is never | |
159 // modified, this region (of mapped pages) will be (effectively, if | |
160 // not explicitly) read-only. | |
161 | |
162 int pkgInfoLen = *(intptr_t*)buffer; | |
163 buffer += sizeof(intptr_t); | |
164 number_of_entries = *(intptr_t*)buffer; | |
165 buffer += sizeof(intptr_t); | |
166 ClassLoader::create_package_info_table((HashtableBucket*)buffer, pkgInfoLen, | |
167 number_of_entries); | |
168 buffer += pkgInfoLen; | |
169 ClassLoader::verify(); | |
170 | |
171 // The following data in the shared misc data region are the linked | |
172 // list elements (HashtableEntry objects) for the symbol table, string | |
173 // table, and shared dictionary. The heap objects refered to by the | |
174 // symbol table, string table, and shared dictionary are permanent and | |
175 // unmovable. Since new entries added to the string and symbol tables | |
176 // are always added at the beginning of the linked lists, THESE LINKED | |
177 // LIST ELEMENTS ARE READ-ONLY. | |
178 | |
179 int len = *(intptr_t*)buffer; // skip over symbol table entries | |
180 buffer += sizeof(intptr_t); | |
181 buffer += len; | |
182 | |
183 len = *(intptr_t*)buffer; // skip over string table entries | |
184 buffer += sizeof(intptr_t); | |
185 buffer += len; | |
186 | |
187 len = *(intptr_t*)buffer; // skip over shared dictionary entries | |
188 buffer += sizeof(intptr_t); | |
189 buffer += len; | |
190 | |
191 len = *(intptr_t*)buffer; // skip over package info table entries | |
192 buffer += sizeof(intptr_t); | |
193 buffer += len; | |
194 | |
195 len = *(intptr_t*)buffer; // skip over package info table char[] arrays. | |
196 buffer += sizeof(intptr_t); | |
197 buffer += len; | |
198 | |
199 oop* oop_array = (oop*)buffer; | |
200 ReadClosure rc(&oop_array); | |
201 serialize_oops(&rc); | |
202 } |