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 *
52 ObjArrayKlass() {}
53
54 // Instance variables
55 Klass* element_klass() const { return _element_klass; }
56 void set_element_klass(Klass* k) { _element_klass = k; }
57 Klass** element_klass_addr() { return &_element_klass; }
58
59 Klass* bottom_klass() const { return _bottom_klass; }
60 void set_bottom_klass(Klass* k) { _bottom_klass = k; }
61 Klass** bottom_klass_addr() { return &_bottom_klass; }
62
63 ModuleEntry* module() const;
64 PackageEntry* package() const;
65
66 // Compiler/Interpreter offset
67 static ByteSize element_klass_offset() { return in_ByteSize(offset_of(ObjArrayKlass, _element_klass)); }
68
69 // Dispatched operation
70 bool can_be_primary_super_slow() const;
71 GrowableArray<Klass*>* compute_secondary_supers(int num_extra_slots,
72 Array<Klass*>* transitive_interfaces);
73 bool compute_is_subtype_of(Klass* k);
74 DEBUG_ONLY(bool is_objArray_klass_slow() const { return true; })
75 int oop_size(oop obj) const;
76
77 // Allocation
78 static Klass* allocate_objArray_klass(ClassLoaderData* loader_data,
79 int n, Klass* element_klass, TRAPS);
80
81 objArrayOop allocate(int length, TRAPS);
82 oop multi_allocate(int rank, jint* sizes, TRAPS);
83
84 // Copying
85 void copy_array(arrayOop s, int src_pos, arrayOop d, int dst_pos, int length, TRAPS);
86
87 // Compute protection domain
88 oop protection_domain() const { return bottom_klass()->protection_domain(); }
89
90 virtual void metaspace_pointers_do(MetaspaceClosure* iter);
91
92 private:
|
1 /*
2 * Copyright (c) 1997, 2018, 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 *
52 ObjArrayKlass() {}
53
54 // Instance variables
55 Klass* element_klass() const { return _element_klass; }
56 void set_element_klass(Klass* k) { _element_klass = k; }
57 Klass** element_klass_addr() { return &_element_klass; }
58
59 Klass* bottom_klass() const { return _bottom_klass; }
60 void set_bottom_klass(Klass* k) { _bottom_klass = k; }
61 Klass** bottom_klass_addr() { return &_bottom_klass; }
62
63 ModuleEntry* module() const;
64 PackageEntry* package() const;
65
66 // Compiler/Interpreter offset
67 static ByteSize element_klass_offset() { return in_ByteSize(offset_of(ObjArrayKlass, _element_klass)); }
68
69 // Dispatched operation
70 bool can_be_primary_super_slow() const;
71 GrowableArray<Klass*>* compute_secondary_supers(int num_extra_slots,
72 Array<InstanceKlass*>* transitive_interfaces);
73 bool compute_is_subtype_of(Klass* k);
74 DEBUG_ONLY(bool is_objArray_klass_slow() const { return true; })
75 int oop_size(oop obj) const;
76
77 // Allocation
78 static Klass* allocate_objArray_klass(ClassLoaderData* loader_data,
79 int n, Klass* element_klass, TRAPS);
80
81 objArrayOop allocate(int length, TRAPS);
82 oop multi_allocate(int rank, jint* sizes, TRAPS);
83
84 // Copying
85 void copy_array(arrayOop s, int src_pos, arrayOop d, int dst_pos, int length, TRAPS);
86
87 // Compute protection domain
88 oop protection_domain() const { return bottom_klass()->protection_domain(); }
89
90 virtual void metaspace_pointers_do(MetaspaceClosure* iter);
91
92 private:
|