< prev index next >

src/hotspot/share/ci/ciField.cpp

Print this page
   1 /*
   2  * Copyright (c) 1999, 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  *


  84 
  85   int nt_index = cpool->name_and_type_ref_index_at(index);
  86   int sig_index = cpool->signature_ref_index_at(nt_index);
  87   Symbol* signature = cpool->symbol_at(sig_index);
  88   _signature = ciEnv::current(THREAD)->get_symbol(signature);
  89 
  90   BasicType field_type = FieldType::basic_type(signature);
  91 
  92   // If the field is a pointer type, get the klass of the
  93   // field.
  94   if (field_type == T_OBJECT || field_type == T_ARRAY || field_type == T_VALUETYPE) {
  95     bool ignore;
  96     // This is not really a class reference; the index always refers to the
  97     // field's type signature, as a symbol.  Linkage checks do not apply.
  98     _type = ciEnv::current(THREAD)->get_klass_by_index(cpool, sig_index, ignore, klass);
  99   } else {
 100     _type = ciType::make(field_type);
 101   }
 102 
 103   _name = (ciSymbol*)ciEnv::current(THREAD)->get_symbol(name);



 104 
 105   // Get the field's declared holder.
 106   //
 107   // Note: we actually create a ciInstanceKlass for this klass,
 108   // even though we may not need to.
 109   int holder_index = cpool->klass_ref_index_at(index);
 110   bool holder_is_accessible;
 111 
 112   ciKlass* generic_declared_holder = ciEnv::current(THREAD)->get_klass_by_index(cpool, holder_index,
 113                                                                                 holder_is_accessible,
 114                                                                                 klass);
 115 
 116   if (generic_declared_holder->is_array_klass()) {
 117     // If the declared holder of the field is an array class, assume that
 118     // the canonical holder of that field is java.lang.Object. Arrays
 119     // do not have fields; java.lang.Object is the only supertype of an
 120     // array type that can declare fields and is therefore the canonical
 121     // holder of the array type.
 122     //
 123     // Furthermore, the compilers assume that java.lang.Object does not


   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  *


  84 
  85   int nt_index = cpool->name_and_type_ref_index_at(index);
  86   int sig_index = cpool->signature_ref_index_at(nt_index);
  87   Symbol* signature = cpool->symbol_at(sig_index);
  88   _signature = ciEnv::current(THREAD)->get_symbol(signature);
  89 
  90   BasicType field_type = FieldType::basic_type(signature);
  91 
  92   // If the field is a pointer type, get the klass of the
  93   // field.
  94   if (field_type == T_OBJECT || field_type == T_ARRAY || field_type == T_VALUETYPE) {
  95     bool ignore;
  96     // This is not really a class reference; the index always refers to the
  97     // field's type signature, as a symbol.  Linkage checks do not apply.
  98     _type = ciEnv::current(THREAD)->get_klass_by_index(cpool, sig_index, ignore, klass);
  99   } else {
 100     _type = ciType::make(field_type);
 101   }
 102 
 103   _name = (ciSymbol*)ciEnv::current(THREAD)->get_symbol(name);
 104   
 105   // this is needed if the field class is not yet loaded.
 106   _is_flattenable = _signature->is_Q_signature();
 107 
 108   // Get the field's declared holder.
 109   //
 110   // Note: we actually create a ciInstanceKlass for this klass,
 111   // even though we may not need to.
 112   int holder_index = cpool->klass_ref_index_at(index);
 113   bool holder_is_accessible;
 114 
 115   ciKlass* generic_declared_holder = ciEnv::current(THREAD)->get_klass_by_index(cpool, holder_index,
 116                                                                                 holder_is_accessible,
 117                                                                                 klass);
 118 
 119   if (generic_declared_holder->is_array_klass()) {
 120     // If the declared holder of the field is an array class, assume that
 121     // the canonical holder of that field is java.lang.Object. Arrays
 122     // do not have fields; java.lang.Object is the only supertype of an
 123     // array type that can declare fields and is therefore the canonical
 124     // holder of the array type.
 125     //
 126     // Furthermore, the compilers assume that java.lang.Object does not


< prev index next >