1 /*
2 * Copyright (c) 1997, 2016, Oracle and/or its affiliates. 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
135 Array<u2>* om = MetadataFactory::new_array<u2>(loader_data, constant_pool_map_length, CHECK);
136
137 for (int i = 0; i < constant_pool_map_length; i++) {
138 int x = reference_map.at(i);
139 assert(x == (int)(jushort) x, "klass index is too big");
140 om->at_put(i, (jushort)x);
141 }
142 set_reference_map(om);
143 }
144
145 // Create Java array for holding resolved strings, methodHandles,
146 // methodTypes, invokedynamic and invokehandle appendix objects, etc.
147 objArrayOop stom = oopFactory::new_objArray(SystemDictionary::Object_klass(), map_length, CHECK);
148 Handle refs_handle (THREAD, (oop)stom); // must handleize.
149 set_resolved_references(loader_data->add_handle(refs_handle));
150 }
151 }
152
153 // CDS support. Create a new resolved_references array.
154 void ConstantPool::restore_unshareable_info(TRAPS) {
155
156 // Only create the new resolved references array if it hasn't been attempted before
157 if (resolved_references() != NULL) return;
158
159 // restore the C++ vtable from the shared archive
160 restore_vtable();
161
162 if (SystemDictionary::Object_klass_loaded()) {
163 // Recreate the object array and add to ClassLoaderData.
164 int map_length = resolved_reference_length();
165 if (map_length > 0) {
166 objArrayOop stom = oopFactory::new_objArray(SystemDictionary::Object_klass(), map_length, CHECK);
167 Handle refs_handle (THREAD, (oop)stom); // must handleize.
168
169 ClassLoaderData* loader_data = pool_holder()->class_loader_data();
170 set_resolved_references(loader_data->add_handle(refs_handle));
171 }
172 }
173 }
174
|
1 /*
2 * Copyright (c) 1997, 2017, Oracle and/or its affiliates. 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
135 Array<u2>* om = MetadataFactory::new_array<u2>(loader_data, constant_pool_map_length, CHECK);
136
137 for (int i = 0; i < constant_pool_map_length; i++) {
138 int x = reference_map.at(i);
139 assert(x == (int)(jushort) x, "klass index is too big");
140 om->at_put(i, (jushort)x);
141 }
142 set_reference_map(om);
143 }
144
145 // Create Java array for holding resolved strings, methodHandles,
146 // methodTypes, invokedynamic and invokehandle appendix objects, etc.
147 objArrayOop stom = oopFactory::new_objArray(SystemDictionary::Object_klass(), map_length, CHECK);
148 Handle refs_handle (THREAD, (oop)stom); // must handleize.
149 set_resolved_references(loader_data->add_handle(refs_handle));
150 }
151 }
152
153 // CDS support. Create a new resolved_references array.
154 void ConstantPool::restore_unshareable_info(TRAPS) {
155 assert(is_constantPool(), "ensure C++ vtable is restored");
156
157 // Only create the new resolved references array if it hasn't been attempted before
158 if (resolved_references() != NULL) return;
159
160 // restore the C++ vtable from the shared archive
161 restore_vtable();
162
163 if (SystemDictionary::Object_klass_loaded()) {
164 // Recreate the object array and add to ClassLoaderData.
165 int map_length = resolved_reference_length();
166 if (map_length > 0) {
167 objArrayOop stom = oopFactory::new_objArray(SystemDictionary::Object_klass(), map_length, CHECK);
168 Handle refs_handle (THREAD, (oop)stom); // must handleize.
169
170 ClassLoaderData* loader_data = pool_holder()->class_loader_data();
171 set_resolved_references(loader_data->add_handle(refs_handle));
172 }
173 }
174 }
175
|