1 /*
2 * Copyright (c) 1999, 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 *
240 ciInstanceKlass* ik = (ciInstanceKlass*)ak->element_type();
241 if (ik->is_loaded() && ik->is_final()) {
242 return ik;
243 }
244 }
245 }
246 return Instruction::exact_type();
247 }
248
249
250 ciType* LoadIndexed::declared_type() const {
251 ciType* array_type = array()->declared_type();
252 if (array_type == NULL || !array_type->is_loaded()) {
253 return NULL;
254 }
255 assert(array_type->is_array_klass(), "what else?");
256 ciArrayKlass* ak = (ciArrayKlass*)array_type;
257 return ak->element_type();
258 }
259
260
261 ciType* LoadField::declared_type() const {
262 return field()->type();
263 }
264
265
266 ciType* NewTypeArray::exact_type() const {
267 return ciTypeArrayKlass::make(elt_type());
268 }
269
270 ciType* NewObjectArray::exact_type() const {
271 ciKlass* element_klass = klass();
272 if (element_klass->is_valuetype()) {
273 return ciValueArrayKlass::make(element_klass);
274 } else {
275 return ciObjArrayKlass::make(element_klass);
276 }
277 }
278
279 ciType* NewMultiArray::exact_type() const {
|
1 /*
2 * Copyright (c) 1999, 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 *
240 ciInstanceKlass* ik = (ciInstanceKlass*)ak->element_type();
241 if (ik->is_loaded() && ik->is_final()) {
242 return ik;
243 }
244 }
245 }
246 return Instruction::exact_type();
247 }
248
249
250 ciType* LoadIndexed::declared_type() const {
251 ciType* array_type = array()->declared_type();
252 if (array_type == NULL || !array_type->is_loaded()) {
253 return NULL;
254 }
255 assert(array_type->is_array_klass(), "what else?");
256 ciArrayKlass* ak = (ciArrayKlass*)array_type;
257 return ak->element_type();
258 }
259
260 bool StoreIndexed::is_exact_flattened_array_store() const {
261 if (array()->is_loaded_flattened_array() && value()->as_Constant() == NULL) {
262 ciKlass* element_klass = array()->declared_type()->as_value_array_klass()->element_klass();
263 ciKlass* actual_klass = value()->declared_type()->as_klass();
264 if (element_klass == actual_klass) {
265 return true;
266 }
267 }
268 return false;
269 }
270
271 ciType* LoadField::declared_type() const {
272 return field()->type();
273 }
274
275
276 ciType* NewTypeArray::exact_type() const {
277 return ciTypeArrayKlass::make(elt_type());
278 }
279
280 ciType* NewObjectArray::exact_type() const {
281 ciKlass* element_klass = klass();
282 if (element_klass->is_valuetype()) {
283 return ciValueArrayKlass::make(element_klass);
284 } else {
285 return ciObjArrayKlass::make(element_klass);
286 }
287 }
288
289 ciType* NewMultiArray::exact_type() const {
|