1 /*
2 * Copyright (c) 1997, 2015, 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 *
194 _method_ordering = MetadataFactory::new_array<int>(class_loader_data(), m->length(), CHECK);
195 for (int i = 0; i < m->length(); i++) {
196 _method_ordering->at_put(i, m->at(i));
197 }
198 } else {
199 _method_ordering = Universe::the_empty_int_array();
200 }
201 }
202
203 // create a new array of vtable_indices for default methods
204 Array<int>* InstanceKlass::create_new_default_vtable_indices(int len, TRAPS) {
205 Array<int>* vtable_indices = MetadataFactory::new_array<int>(class_loader_data(), len, CHECK_NULL);
206 assert(default_vtable_indices() == NULL, "only create once");
207 set_default_vtable_indices(vtable_indices);
208 return vtable_indices;
209 }
210
211 InstanceKlass::InstanceKlass(const ClassFileParser& parser, unsigned kind) :
212 _static_field_size(parser.static_field_size()),
213 _nonstatic_oop_map_size(nonstatic_oop_map_size(parser.total_oop_map_count())),
214 _vtable_len(parser.vtable_size()),
215 _itable_len(parser.itable_size()),
216 _reference_type(parser.reference_type()) {
217 set_kind(kind);
218 set_access_flags(parser.access_flags());
219 set_is_anonymous(parser.is_anonymous());
220 set_layout_helper(Klass::instance_layout_helper(parser.layout_size(),
221 false));
222
223 assert(NULL == _methods, "underlying memory not zeroed?");
224 assert(is_instance_klass(), "is layout incorrect?");
225 assert(size_helper() == parser.layout_size(), "incorrect size_helper?");
226 }
227
228 void InstanceKlass::deallocate_methods(ClassLoaderData* loader_data,
229 Array<Method*>* methods) {
230 if (methods != NULL && methods != Universe::the_empty_method_array() &&
231 !methods->is_shared()) {
232 for (int i = 0; i < methods->length(); i++) {
233 Method* method = methods->at(i);
234 if (method == NULL) continue; // maybe null if error processing
235 // Only want to delete methods that are not executing for RedefineClasses.
236 // The previous version will point to them so they're not totally dangling
|
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 *
194 _method_ordering = MetadataFactory::new_array<int>(class_loader_data(), m->length(), CHECK);
195 for (int i = 0; i < m->length(); i++) {
196 _method_ordering->at_put(i, m->at(i));
197 }
198 } else {
199 _method_ordering = Universe::the_empty_int_array();
200 }
201 }
202
203 // create a new array of vtable_indices for default methods
204 Array<int>* InstanceKlass::create_new_default_vtable_indices(int len, TRAPS) {
205 Array<int>* vtable_indices = MetadataFactory::new_array<int>(class_loader_data(), len, CHECK_NULL);
206 assert(default_vtable_indices() == NULL, "only create once");
207 set_default_vtable_indices(vtable_indices);
208 return vtable_indices;
209 }
210
211 InstanceKlass::InstanceKlass(const ClassFileParser& parser, unsigned kind) :
212 _static_field_size(parser.static_field_size()),
213 _nonstatic_oop_map_size(nonstatic_oop_map_size(parser.total_oop_map_count())),
214 _itable_len(parser.itable_size()),
215 _reference_type(parser.reference_type()) {
216 set_vtable_length(parser.vtable_size());
217 set_kind(kind);
218 set_access_flags(parser.access_flags());
219 set_is_anonymous(parser.is_anonymous());
220 set_layout_helper(Klass::instance_layout_helper(parser.layout_size(),
221 false));
222
223 assert(NULL == _methods, "underlying memory not zeroed?");
224 assert(is_instance_klass(), "is layout incorrect?");
225 assert(size_helper() == parser.layout_size(), "incorrect size_helper?");
226 }
227
228 void InstanceKlass::deallocate_methods(ClassLoaderData* loader_data,
229 Array<Method*>* methods) {
230 if (methods != NULL && methods != Universe::the_empty_method_array() &&
231 !methods->is_shared()) {
232 for (int i = 0; i < methods->length(); i++) {
233 Method* method = methods->at(i);
234 if (method == NULL) continue; // maybe null if error processing
235 // Only want to delete methods that are not executing for RedefineClasses.
236 // The previous version will point to them so they're not totally dangling
|