1 /*
2 * Copyright (c) 2005, 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 *
774 #endif
775 first_ind, nfields);
776 sobj->init_req(0, C->root());
777 transform_later(sobj);
778
779 // Scan object's fields adding an input to the safepoint for each field.
780 for (int j = 0; j < nfields; j++) {
781 intptr_t offset;
782 ciField* field = NULL;
783 if (iklass != NULL) {
784 field = iklass->nonstatic_field_at(j);
785 offset = field->offset();
786 elem_type = field->type();
787 basic_elem_type = field->layout_type();
788 } else {
789 offset = array_base + j * (intptr_t)element_size;
790 }
791
792 const Type *field_type;
793 // The next code is taken from Parse::do_get_xxx().
794 if (basic_elem_type == T_OBJECT || basic_elem_type == T_ARRAY) {
795 if (!elem_type->is_loaded()) {
796 field_type = TypeInstPtr::BOTTOM;
797 } else if (field != NULL && field->is_static_constant()) {
798 // This can happen if the constant oop is non-perm.
799 ciObject* con = field->constant_value().as_object();
800 // Do not "join" in the previous type; it doesn't add value,
801 // and may yield a vacuous result if the field is of interface type.
802 field_type = TypeOopPtr::make_from_constant(con)->isa_oopptr();
803 assert(field_type != NULL, "field singleton type must be consistent");
804 } else {
805 field_type = TypeOopPtr::make_from_klass(elem_type->as_klass());
806 }
807 if (UseCompressedOops) {
808 field_type = field_type->make_narrowoop();
809 basic_elem_type = T_NARROWOOP;
810 }
811 } else {
812 field_type = Type::get_const_basic_type(basic_elem_type);
813 }
814
|
1 /*
2 * Copyright (c) 2005, 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 *
774 #endif
775 first_ind, nfields);
776 sobj->init_req(0, C->root());
777 transform_later(sobj);
778
779 // Scan object's fields adding an input to the safepoint for each field.
780 for (int j = 0; j < nfields; j++) {
781 intptr_t offset;
782 ciField* field = NULL;
783 if (iklass != NULL) {
784 field = iklass->nonstatic_field_at(j);
785 offset = field->offset();
786 elem_type = field->type();
787 basic_elem_type = field->layout_type();
788 } else {
789 offset = array_base + j * (intptr_t)element_size;
790 }
791
792 const Type *field_type;
793 // The next code is taken from Parse::do_get_xxx().
794 if (is_reference_type(basic_elem_type)) {
795 if (!elem_type->is_loaded()) {
796 field_type = TypeInstPtr::BOTTOM;
797 } else if (field != NULL && field->is_static_constant()) {
798 // This can happen if the constant oop is non-perm.
799 ciObject* con = field->constant_value().as_object();
800 // Do not "join" in the previous type; it doesn't add value,
801 // and may yield a vacuous result if the field is of interface type.
802 field_type = TypeOopPtr::make_from_constant(con)->isa_oopptr();
803 assert(field_type != NULL, "field singleton type must be consistent");
804 } else {
805 field_type = TypeOopPtr::make_from_klass(elem_type->as_klass());
806 }
807 if (UseCompressedOops) {
808 field_type = field_type->make_narrowoop();
809 basic_elem_type = T_NARROWOOP;
810 }
811 } else {
812 field_type = Type::get_const_basic_type(basic_elem_type);
813 }
814
|