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 *
77 // Always ignore overpass methods in superclasses, although technically the
78 // super klass of an array, (j.l.Object) should not have
79 // any overpass methods present.
80 return super()->uncached_lookup_method(name, signature, Klass::skip_overpass);
81 }
82
83 ArrayKlass::ArrayKlass(Symbol* name) {
84 set_name(name);
85
86 set_super(Universe::is_bootstrapping() ? (Klass*)NULL : SystemDictionary::Object_klass());
87 set_layout_helper(Klass::_lh_neutral_value);
88 set_dimension(1);
89 set_higher_dimension(NULL);
90 set_lower_dimension(NULL);
91 set_component_mirror(NULL);
92 // Arrays don't add any new methods, so their vtable is the same size as
93 // the vtable of klass Object.
94 int vtable_size = Universe::base_vtable_size();
95 set_vtable_length(vtable_size);
96 set_is_cloneable(); // All arrays are considered to be cloneable (See JLS 20.1.5)
97 }
98
99
100 // Initialization of vtables and mirror object is done separatly from base_create_array_klass,
101 // since a GC can happen. At this point all instance variables of the ArrayKlass must be setup.
102 void ArrayKlass::complete_create_array_klass(ArrayKlass* k, KlassHandle super_klass, TRAPS) {
103 ResourceMark rm(THREAD);
104 k->initialize_supers(super_klass(), CHECK);
105 k->vtable()->initialize_vtable(false, CHECK);
106 java_lang_Class::create_mirror(k, Handle(THREAD, k->class_loader()), Handle(NULL), CHECK);
107 }
108
109 GrowableArray<Klass*>* ArrayKlass::compute_secondary_supers(int num_extra_slots) {
110 // interfaces = { cloneable_klass, serializable_klass };
111 assert(num_extra_slots == 0, "sanity of primitive array type");
112 // Must share this for correct bootstrapping!
113 set_secondary_supers(Universe::the_array_interfaces_array());
114 return NULL;
115 }
116
|
1 /*
2 * Copyright (c) 1997, 2019, 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 *
77 // Always ignore overpass methods in superclasses, although technically the
78 // super klass of an array, (j.l.Object) should not have
79 // any overpass methods present.
80 return super()->uncached_lookup_method(name, signature, Klass::skip_overpass);
81 }
82
83 ArrayKlass::ArrayKlass(Symbol* name) {
84 set_name(name);
85
86 set_super(Universe::is_bootstrapping() ? (Klass*)NULL : SystemDictionary::Object_klass());
87 set_layout_helper(Klass::_lh_neutral_value);
88 set_dimension(1);
89 set_higher_dimension(NULL);
90 set_lower_dimension(NULL);
91 set_component_mirror(NULL);
92 // Arrays don't add any new methods, so their vtable is the same size as
93 // the vtable of klass Object.
94 int vtable_size = Universe::base_vtable_size();
95 set_vtable_length(vtable_size);
96 set_is_cloneable(); // All arrays are considered to be cloneable (See JLS 20.1.5)
97 TRACE_INIT_ID(this);
98 }
99
100
101 // Initialization of vtables and mirror object is done separatly from base_create_array_klass,
102 // since a GC can happen. At this point all instance variables of the ArrayKlass must be setup.
103 void ArrayKlass::complete_create_array_klass(ArrayKlass* k, KlassHandle super_klass, TRAPS) {
104 ResourceMark rm(THREAD);
105 k->initialize_supers(super_klass(), CHECK);
106 k->vtable()->initialize_vtable(false, CHECK);
107 java_lang_Class::create_mirror(k, Handle(THREAD, k->class_loader()), Handle(NULL), CHECK);
108 }
109
110 GrowableArray<Klass*>* ArrayKlass::compute_secondary_supers(int num_extra_slots) {
111 // interfaces = { cloneable_klass, serializable_klass };
112 assert(num_extra_slots == 0, "sanity of primitive array type");
113 // Must share this for correct bootstrapping!
114 set_secondary_supers(Universe::the_array_interfaces_array());
115 return NULL;
116 }
117
|