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 *
23 */
24
25 #include "precompiled.hpp"
26 #include "ci/ciArrayKlass.hpp"
27 #include "ci/ciObjArrayKlass.hpp"
28 #include "ci/ciTypeArrayKlass.hpp"
29 #include "ci/ciUtilities.hpp"
30 #include "ci/ciValueArrayKlass.hpp"
31 #include "ci/ciValueKlass.hpp"
32
33 // ciArrayKlass
34 //
35 // This class represents a Klass* in the HotSpot virtual machine
36 // whose Klass part in an ArrayKlass.
37
38 // ------------------------------------------------------------------
39 // ciArrayKlass::ciArrayKlass
40 //
41 // Loaded array klass.
42 ciArrayKlass::ciArrayKlass(Klass* k) : ciKlass(k) {
43 assert(get_Klass()->is_array_klass(), "wrong type");
44 _dimension = get_ArrayKlass()->dimension();
45 }
46
47 // ------------------------------------------------------------------
48 // ciArrayKlass::ciArrayKlass
49 //
101 //
102 // What type is obtained when this array is indexed as many times as possible?
103 ciArrayKlass* ciArrayKlass::make(ciType* element_type, bool never_null) {
104 if (element_type->is_primitive_type()) {
105 return ciTypeArrayKlass::make(element_type->basic_type());
106 } else if (element_type->is_valuetype() && element_type->as_value_klass()->flatten_array() && never_null) {
107 return ciValueArrayKlass::make(element_type->as_klass());
108 } else {
109 return ciObjArrayKlass::make(element_type->as_klass(), never_null);
110 }
111 }
112
113 int ciArrayKlass::array_header_in_bytes() {
114 return get_ArrayKlass()->array_header_in_bytes();
115 }
116
117 ArrayStorageProperties ciArrayKlass::storage_properties() {
118 return get_ArrayKlass()->storage_properties();
119 }
120
|
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 *
23 */
24
25 #include "precompiled.hpp"
26 #include "ci/ciArrayKlass.hpp"
27 #include "ci/ciObjArrayKlass.hpp"
28 #include "ci/ciTypeArrayKlass.hpp"
29 #include "ci/ciUtilities.hpp"
30 #include "ci/ciUtilities.inline.hpp"
31 #include "ci/ciValueArrayKlass.hpp"
32 #include "ci/ciValueKlass.hpp"
33
34 // ciArrayKlass
35 //
36 // This class represents a Klass* in the HotSpot virtual machine
37 // whose Klass part in an ArrayKlass.
38
39 // ------------------------------------------------------------------
40 // ciArrayKlass::ciArrayKlass
41 //
42 // Loaded array klass.
43 ciArrayKlass::ciArrayKlass(Klass* k) : ciKlass(k) {
44 assert(get_Klass()->is_array_klass(), "wrong type");
45 _dimension = get_ArrayKlass()->dimension();
46 }
47
48 // ------------------------------------------------------------------
49 // ciArrayKlass::ciArrayKlass
50 //
102 //
103 // What type is obtained when this array is indexed as many times as possible?
104 ciArrayKlass* ciArrayKlass::make(ciType* element_type, bool never_null) {
105 if (element_type->is_primitive_type()) {
106 return ciTypeArrayKlass::make(element_type->basic_type());
107 } else if (element_type->is_valuetype() && element_type->as_value_klass()->flatten_array() && never_null) {
108 return ciValueArrayKlass::make(element_type->as_klass());
109 } else {
110 return ciObjArrayKlass::make(element_type->as_klass(), never_null);
111 }
112 }
113
114 int ciArrayKlass::array_header_in_bytes() {
115 return get_ArrayKlass()->array_header_in_bytes();
116 }
117
118 ArrayStorageProperties ciArrayKlass::storage_properties() {
119 return get_ArrayKlass()->storage_properties();
120 }
121
122 ciInstance* ciArrayKlass::component_mirror_instance() const {
123 GUARDED_VM_ENTRY(
124 oop component_mirror = ArrayKlass::cast(get_Klass())->component_mirror();
125 return CURRENT_ENV->get_instance(component_mirror);
126 )
127 }
|