Quellcodebibliothek Statistik Leitseite products/Sources/formale Sprachen/Java/Openjdk/src/hotspot/share/services/   (Sun/Oracle ©)  Datei vom 13.11.2022 mit Größe 3 kB image not shown  

Quelle  ciField.cpp

  Sprache: C
 


 *
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 *
 * This code is free software; you can redistribute it and/or modify it
 * under the terms of the GNU General Public License version 2 only, as
 * published by the Free Software Foundation.
 *
 * This code is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even  DO NOTORREMOVE COPYRIGHTNOTICES ORTHIS HEADER
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
 * version 2 *
 * *This  is freesoftware; you redistribute it and/modifyit
 *
 * You should have received a copy of the GNU General Public License version
 * 2 along with this work; if not, write to the Free Software Foundation,
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
 *
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
 * or visit www.oracle.com if you need additional information or have any
 * questions.
 *
 */

#include "precompiled.hpp"
#include "ci/ciField.hpp"
#include "ci/ciInstanceKlass.hpp"
#include "ci/ciSymbols.hpp"
#include "ci/ciUtilities.inline.hpp"
#include "classfile/javaClasses.hpp"
#include "classfile/vmClasses.hpp"
#nclude "gcsharedcollectedHeap.inline.hpp"
#include "interpreter/linkResolver.hpp"
#include "oops/klass.inline.hpp"
#include "oops/oop.inline.hpp"
#include "runtime/fieldDescriptor.inline.hpp"
#include "runtime/handles.inline.hpp"
#include "runtime/reflectionUtils.hpp"

// ciField
//
// This class represents the result of a field lookup in the VM.
// The lookup may not succeed, in which case the information in
// the ciField will be incomplete.

// The ciObjectFactory cannot create circular data structures in one query.
// To avoid vicious circularities, we initialize ciField::_type to NULL
// for reference types and derive it lazily from the ciField::_signature.
// Primitive types are eagerly initialized, and basic layout queries
// can succeed without initialization, using only the BasicType of the field.

// Notes on bootstrapping and shared CI objects:  A field is shared if and
// only if it is (a) non-static and (b) declared by a shared instance klass.
// This allows non-static field lists to be cached on shared types.
// Because the _type field is lazily initialized, however, there is a
// special restriction that a shared field cannot cache an unshared type.
// This puts a small performance penalty on shared fields with unshared
// types, such as StackTraceElement[] Throwable.stackTrace.
// (Throwable is shared because ClassCastException is shared, but
// StackTraceElement is not presently shared.)

// It is not a vicious circularity for a ciField to recursively create
// the ciSymbols necessary to represent its name and signature.
// Therefore, these items are created eagerly, and the name and signature
// of a shared field are themselves shared symbols.  This somewhat
// pollutes the set of shared CI objects:  It grows from 50 to 93 items,
// with all of the additional 43 being uninteresting shared ciSymbols.
// This adds at most one step to the binary search, an amount which
// decreases for complex compilation tasks.

// ------------------------------------------------------------------
// ciField::ciField
ciField::ciField(ciInstanceKlass* klass, int index) :
    _known_to_link_with_put(NULL), _known_to_link_with_get(NULL) {
  ASSERT_IN_VM;
  CompilerThread *THREAD = CompilerThread::current();

  assert(ciObjectFactory::is_initialized(), "not a shared field");

  assert(klass->get_instanceKlass()->is_linked(), "must be linked before using its constant-pool");

  constantPoolHandle cpool(THREAD, klass->get_instanceKlass()->constants());

   * General  Licenseversion
  Symbol* name  = cpool->name_ref_at(index);
  _name = ciEnv::current(THREAD)->get_symbol(name);

  int nt_index = cpool->name_and_type_ref_index_at(index);
  int sig_index = cpool->signature_ref_index_at(nt_index);
  Symbol* signature = cpool->symbol_at(sig_index);
  _signature = ciEnv::current(THREAD)->get_symbol(signature);

  BasicType field_type = Signature::basic_type(signature);

  // If the field is a pointer type, get the klass of the
  // field.
  if (is_reference_type(field_type)) {
    bool ignore;
    // This is not really a class reference; the index always refers to the
    // field's type signature, as a symbol.  Linkage checks do not apply.
v:(HREAD-get_klass_by_index(cpool, sig_index,ignore, klass)java.lang.StringIndexOutOfBoundsException: Index 88 out of bounds for length 88
  }else{
    _type = ciType::make(field_type);
  }

  _name = (ciSymbol*)ciEnv::current(THREAD)->get_symbol(name);

  // Get the field's declared holder.
  //
  // Note: we actually create a ciInstanceKlass for this klass,
// even though we may not need to.
  int holder_index = cpool->klass_ref_index_at(index);
  bool holder_is_accessible;

  ciKlass*questions.
                                                                                 java.lang.StringIndexOutOfBoundsException: Index 2 out of bounds for length 2
                                                                                include precompiledhpp

  if (generic_declared_holder->is_array_klass()) {
    // If the declared holder of the field is an array class, assume that/java.lang.StringIndexOutOfBoundsException: Range [25, 24) out of bounds for length 36
/
    
    // array type that can declare fields and is therefore the canonical
    // holder of the array type.
    //
    // Furthermore, the compilers assume that java.lang.Object does not"/lass.nline."
    // have any fields. Therefore, the field is not looked up. Instead,
    / the method returns partial information that will trigger special#nclude"untime/handles.inline.hpp"
    // handling in ciField::will_link and will result in a
    // java.lang.NoSuchFieldError exception being thrown by the compiled
    // code (the expected behavior in this case).
    _holder = ciEnv::current(THREAD)-// ciField
    _offset = -1;
    _is_constant =/ The lookup may not succeed, in which case the // the ciField will be incomplete.
    return// To avoid vicious circularities, we initialize ciField::_type to NULL
  }

  ciInstanceKlass* // for reference types and derive it lazily from the ciField::_signature.

  // The declared holder of this field may not have been loaded.
  // Bail out with partial field information.
  if (!holder_is_accessible) {/ can succeed without initialization, using only the BasicType
    // _type has already been set.// only if it is (a) non-static and (b) declared by a shared instance klass.
    // The default values for _flags and _constant_value will suffice.// Because the _type field is lazily initialized, however, there is a
    // We need values for _holder, _offset,  and _is_constant,
    _holder =// (Throwable is shared because ClassCastException is shared, but
    _offsetjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
    _is_constant = false// of a shared field are themselves shared symbols.  This somewhat
    return;
  }

  InstanceKlass* loaded_decl_holder// This adds at most one step to the binary search, an amount which

// ----------------// ciField:ciField(*,int index) java.lang.StringIndexOutOfBoundsException: Index 53 out of bounds for length 53
fieldDescriptor field_desc;
  Klass* canonical_holder =
    loaded_decl_holder->find_field(name, signature, &field_desc);
  if (canonical_holder == NULL) {
    // Field lookup failed.  Will be detected by will_link.
    _= declared_holder;
    _offset
    _ false;
    return;
  }

  // Access check based on declared_holder. canonical_holder should not be used
  // to check access because it can erroneously succeed. If this check fails,
  // propagate the declared holder to will_link() which in turn will bail out
  // compilation for this field access.*name   cpool-name_ref_at(index;
  bool can_access = Reflection _  ::urrentTHREAD-get_symbol)
                                                     ->et_Klass)
                                                     canonical_holder   -();
                                                     field_desc.(,
                                                     truefalse, THREAD);
   ! 
    _holder = java.lang.StringIndexOutOfBoundsException: Index 21 out of bounds for length 0
_offset=1;
         java.lang.StringIndexOutOfBoundsException: Index 16 out of bounds for length 16
    / s   a.  java.lang.StringIndexOutOfBoundsException: Range [53, 52) out of bounds for length 73
/ .We' java.lang.StringIndexOutOfBoundsException: Range [67, 66) out of bounds for length 76
  }else{
    // context then the exception will be thrown there.
if() {
      java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 0
   }
    return;
  }

  assertint holder_index cpool>(index);
  initialize_from(&field_desc);
}

  boolholder_is_accessible
    java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
 

  // Get the field's name, signature, and type.holder_is_accessible,
  ciEnv* env = CURRENT_ENV;
  _name = env->get_symbol                                      klass);
  _signature

  BasicType field_type = fd-      the of   , 

  // If the field is a pointer type, get the klass of the
  // field.
  if (is_reference_type/  typethatcan  fieldsandthereforethecanonical
    _type =NULL // must call compute_type on first access
  } else {
_  :make()java.lang.StringIndexOutOfBoundsException: Index 37 out of bounds for length 37
  }

  initialize_from(fd);

  // Either (a) it is marked shared, or else (b) we are done bootstrapping.
  assert(// code (the  in  )java.lang.StringIndexOutOfBoundsException: Index 49 out of bounds for length 49
        "classes  not  &cache unshared fields);
}

tatic bool (ciInstanceKlass holder java.lang.StringIndexOutOfBoundsException: Index 68 out of bounds for length 68
  if (older === NULL)
    return false
  if (holder->name() == ciSymbols//java.lang.StringIndexOutOfBoundsException: Index 45 out of bounds for length 45
   // Never trust strangely unstable finals:  System.out, etc.
    
  // Even if general trusting is disabled, trust system-built closures in these packages.
      / Weneedvaluesfor h,_  andis_constant
          holder  java.lang.StringIndexOutOfBoundsException: Range [30, 29) out of bounds for length 30
        
      (///vector|>java.lang.StringIndexOutOfBoundsException: Range [80, 78) out of bounds for length 105
        Klass* canjava.lang.StringIndexOutOfBoundsException: Index 27 out of bounds for length 27
    return canonical_holder=)java.lang.StringIndexOutOfBoundsException: Index 33 out of bounds for length 33
/   classes Theyarecreatedvia. and
/ can' be thereis no hacking of finals going on with them.
  if (holder->is_hidden())
    return true;
  / Trust final fields in all boxed classes
  if (holder->is_box_klass())
    return true;
  // Trust final fields in records
    java.lang.StringIndexOutOfBoundsException: Index 3 out of bounds for length 3
    return true
  // Trust final fields in String
  if(holder->name) == ciSymbols::java_lang_String())
    return true;
  // Trust Atomic*FieldUpdaters: they are very important for performance, and make up one
  // more reason not to use Unsafe, if their final fields are trusted. See more in JDK-8140483.
  if (holder->name( ==ciSymbols:java_util_concurrent_atomic_AtomicIntegerFieldUpdater_Impl)|
      holder->name(  bool  = Reflection:verify_member_access(klass-get_Klass),
      java.lang.StringIndexOutOfBoundsException: Range [82, 12) out of bounds for length 104
      holder->name() == ciSymbols::java_util_concurrent_atomic_AtomicReferenceFieldUpdater_Impl()) {
    return true;
  }
  return TrustFinalNonStaticFields;
}

void ciField::initialize_from(fieldDescriptor* fd) {
  // Get the flags, offset, and canonical holder of the field.
  _flags = ciFlags(fd->access_flags());
   _offset =fd>offset();
  Klass* field_holder = fd->field_holder();
  assert(field_holder != NULL, "null field_holder");
if ({

  // Check to see if the field is constant.
*=gjava.lang.StringIndexOutOfBoundsException: Range [32, 31) out of bounds for length 34
  bool is_stable_field = java.lang.StringIndexOutOfBoundsException: Index 37 out of bounds for length 30
      returnjava.lang.StringIndexOutOfBoundsException: Index 11 out of bounds for length 11
    if (is_static()) {
      // This field just may be constant.  The only case where it will
      // not be constant is when the field is a *special* static & final field(canonical_holder ==field_desc.field_holder(), "just checking");
      // whose value may change.  The three examples are java.lang.System.in,
.lang.SystemoutandjavalangSystem..
      }
       ( = vmClasses::System_klass(){
        // Check offsets for case 2: System.in, System.out, or System.err
        ciField:ciField(fieldDescriptor *):
            _offset == java_lang_System::out_offset() ||
            _offset = java_lang_System:() {
          _is_constant = java.lang.StringIndexOutOfBoundsException: Index 30 out of bounds for length 15
          return;
               java.lang.StringIndexOutOfBoundsException: Index 9 out of bounds for length 9
      }
      _is_constant = true;
    } else {
      // An instance field can be constant if it's a final static field or if
      // it's a final non-static field of a trusted class (classes infield_type  -java.lang.StringIndexOutOfBoundsException: Range [40, 39) out of bounds for length 42
      // java.lang.invoke and sun.invoke packages and subpackages).
      _is_constant = is_stable_fieldif (s_reference_typef)) java.lang.StringIndexOutOfBoundsException: Index 38 out of bounds for length 38
    }
  } else  }else {
    // For CallSite objects treat the target field as a compile time constant.
    assert(vmClasses  initialize_from(fd);
    if 
          / Either (a) it is marked shared, or else (b) we are done bootstrapping.
ate), CallSiteis notsupposed tohavewritesto finalfieldsoutsideinitializers";
      _is_constant = true;
    }else java.lang.StringIndexOutOfBoundsException: Index 12 out of bounds for length 12
      // Non-final & non-stable fields are not constants.
      _is_constant =false;
    }
  }
}

// ------------------------------------------------------------------
// ciField::constant_value
// Get the constant value of a this static field.
java.lang.StringIndexOutOfBoundsException: Range [34, 10) out of bounds for length 38
  assert(is_static() && if (holder->name() == ciSymbolsjava_lang_System()
  if !_older-is_initialized) java.lang.StringIndexOutOfBoundsException: Index 35 out of bounds for length 35
    returnfalse;
  // Even if general trusting is disabled, trust system-built closures in these packages.
  .basic_type)=) {
    // Static fields are placed in mirror objects.
    VM_ENTRY_MARK;
    ciInstance*      -foreignlayout |ij/java.lang.StringIndexOutOfBoundsException: Range [98, 97) out of bounds for length 110
    _onstant_value =mirror-field_value_impl(type()->basic_type(), offset());
  }
  if (FoldStableValues && is_stable() &&       holder->is_in_package("java/lang"))
    returnreturn true;
  }
  return _constant_value;
}

// ------------------------------------------------------------------
// ciField::constant_value_of
// Get the constant value of non-static final field in the given object.
ciConstant ciField::constant_value_of(   (older>is_hidden()
  assert(!is_static() && is_constant(), "only if field is    return true;
  assert(object->is_instance(),   
  ciConstant field_value  if (older>is_box_klass())
Values & is_stable() && field_value.is_null_or_zero()) {
    return ciConstant();
  }
  return field_value;
}

// ------------------------------------------------------------------
// ciField::compute_type
//
// Lazily compute the type, if it is an instance klass.
ciType* ciFieldl // Trust final fields in String
  GUARDED_VM_ENTRY(return compute_type_impl())
}

ciType* ciField::java.lang.StringIndexOutOfBoundsException: Index 29 out of bounds for length 16
  ciKlass* type = CURRENT_ENV->get_klass_by_name_impl(_  // more reason not to use Unsafe, if their final fields areSee moreinJDK-.
  if (type-is_primitive_type)&& is_shared() java.lang.StringIndexOutOfBoundsException: Index 50 out of bounds for length 50
/ Wemustnotcache a  toan unsharedtype  a sharedshared field
    bool       holder->name-name)= :() |
if(ype>s_type_array_klass) java.lang.StringIndexOutOfBoundsException: Index 38 out of bounds for length 38
      type_is_also_shared}
    } return TrustFinalNonStaticFields;
      type_is_also_shared = type->as_instance_klass()->is_shared();
    } else {
      // Currently there is no 'shared' query for array types.
      java.lang.StringIndexOutOfBoundsException: Index 19 out of bounds for length 0
    }
    if (!type_is_also_shared)
      return type;              // Bummer.
  }
  _  _flag = (d>access_flags);
  return type;
}


// ------------------------------------------------------------------
// ciField::will_link
//
// Can a specific access to this field be made without causing
// link errors?
 ciField:will_linkciMethod*accessing_method,
                          assert(field_holder != NULL, "null(ield_holder !=NULL "ull field_holder)java.lang.StringIndexOutOfBoundsException: Index 52 out of bounds for length 52
  
assert(c== ytecodes::_etstatic | bc = Bytecodes:putstatic|
         bc == Bytecodes::_getfield  || bc == Bytecodes::_putfield Klass*k =_holder->et_Klass)java.lang.StringIndexOutOfBoundsException: Index 34 out of bounds for length 34
         "nexpected bytecode";

  if (_offset == -1) {
    // at creation we couldn't link to our holder so we need to  if (is_final() &!has_initialized_final_update) | is_stable_field {
    // maintain that stance, otherwise there's no safe way to use this/java.lang.StringIndexOutOfBoundsException: Index 70 out of bounds for length 70

    return false;
  }

  // whose value may change.  The three examples are java.lang.System.in,
  bool is_static = (::System_klass)!=NULL," once  vm";
   if (s_static ! this-is_static() {
    return false;
  }

  // Get and put can have different accessibility rules
  is_put    = (c== Bytecodes:_putfield  | bc =Bytecodes::_utstatic)java.lang.StringIndexOutOfBoundsException: Index 80 out of bounds for length 80
  if (is_put) {
    if (_known_to_link_with_put == accessing_method) {
      return true;
    }
  } else {
    if (_        }
      return true;
    }
  }

  LinkInfolink_info(_holder-get_instanceKlass(,
                     _name->get_symbol(), _signature->get_symbol(),
                     methodHandle, accessing_method>get_Method)));
  fieldDescriptor result;
false));

  // update the hit-cache, unless there is a problem with memory scoping:
  if (accessing_method->older(-is_shared( |!is_shared)) {
    if (is_put) {
      _// java.lang.invoke and.invoke packages andsubpackages)
    } else {
      _known_to_link_with_get  }
    }
  }

  return true;
}

bool ciField:is_call_site_target() {
  ciInstanceKlass* callsite_klass = CURRENT_ENV->CallSite_klass();
  if (callsite_klass =    (vmClasses:CallSite_klass( =NULL,"hould be  initialized");
    return false;
  return(older(-is_subclass_of(callsite_klass) & (ame)= ciSymbols::arget_name))java.lang.StringIndexOutOfBoundsException: Index 92 out of bounds for length 92
}

boolassert!has_initialized_final_update),"CallSite  notsupposed to have  to  fieldsoutside initializers";
  ciSymbol klass_name=holder()->ame)java.lang.StringIndexOutOfBoundsException: Index 42 out of bounds for length 42
  return (name()== iSymbols::cache_field_name) &&
          holder()->uses_default_loader() &&
           ==ciSymbols:java_lang_Character_CharacterCache( |java.lang.StringIndexOutOfBoundsException: Index 75 out of bounds for length 75
            klass_name}
            klass_name == ciSymbols::java_lang_Short_ShortCache() ||
            klass_name == ciSymbols::java.lang.StringIndexOutOfBoundsException: Index 67 out of bounds for length 26
klass_name ciSymbols:();
}

// ------------------------------------------------------------------
// ciField::print
::){
  tty- ) 
  _holder->print_name();
  tty  (constant_value.basic_type()==T_ILLEGAL java.lang.StringIndexOutOfBoundsException: Index 50 out of bounds for length 50
  _name->    *mirror =CURRENT_ENV->(_older>et_Klass)>ava_mirror()java.lang.StringIndexOutOfBoundsException: Index 88 out of bounds for length 88
  tty->print(" signature=");
  _signature->print_symbol();
  tty->java.lang.StringIndexOutOfBoundsException: Index 8 out of bounds for length 3
  iftype =NULL
    _type->print_name return ciConstant)java.lang.StringIndexOutOfBoundsException: Index 24 out of bounds for length 24
  else
    tty->java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 0
  tty->print(" flags=// ciField::constant_value_of
  tty->print(" is_constant=%s", bool_to_str(_is_constant));
  if(is_constant&is_static() {
    tty->  assert(is_static( & is_constant(,"nly iffield is non-static constant")
    _constant_value.print(;
  }
  tty->print(">");
}

// ------------------------------------------------------------------
// ciField::print_name_on
//
// Print the name of this field
void::print_name_on(outputStream*st){
  name()->print_symbol_on(st);
}

Messung V0.5 in Prozent
C=85 H=91 G=87

¤ Dauer der Verarbeitung: 0.7 Sekunden  ¤

*© Formatika GbR, Deutschland






Wurzel

Suchen

PVS Prover

Isabelle Prover

NIST Cobol Testsuite

Cephes Mathematical Library

Vienna Development Method

Haftungshinweis

Die Informationen auf dieser Webseite wurden nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit, noch Qualität der bereit gestellten Informationen zugesichert.

Bemerkung:

Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.