< prev index next >

src/hotspot/share/ci/ciField.cpp

Print this page

        

*** 66,76 **** // 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"); --- 66,76 ---- // decreases for complex compilation tasks. // ------------------------------------------------------------------ // ciField::ciField ciField::ciField(ciInstanceKlass* klass, int index) : ! _is_flattened(false), _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");
*** 89,99 **** BasicType field_type = FieldType::basic_type(signature); // If the field is a pointer type, get the klass of the // field. ! if (field_type == T_OBJECT || field_type == T_ARRAY) { 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. _type = ciEnv::current(THREAD)->get_klass_by_index(cpool, sig_index, ignore, klass); } else { --- 89,99 ---- BasicType field_type = FieldType::basic_type(signature); // If the field is a pointer type, get the klass of the // field. ! if (field_type == T_OBJECT || field_type == T_ARRAY || field_type == T_VALUETYPE) { 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. _type = ciEnv::current(THREAD)->get_klass_by_index(cpool, sig_index, ignore, klass); } else {
*** 198,208 **** BasicType field_type = fd->field_type(); // If the field is a pointer type, get the klass of the // field. ! if (field_type == T_OBJECT || field_type == T_ARRAY) { _type = NULL; // must call compute_type on first access } else { _type = ciType::make(field_type); } --- 198,208 ---- BasicType field_type = fd->field_type(); // If the field is a pointer type, get the klass of the // field. ! if (field_type == T_OBJECT || field_type == T_ARRAY || field_type == T_VALUETYPE) { _type = NULL; // must call compute_type on first access } else { _type = ciType::make(field_type); }
*** 211,220 **** --- 211,244 ---- // Either (a) it is marked shared, or else (b) we are done bootstrapping. assert(is_shared() || ciObjectFactory::is_initialized(), "bootstrap classes must not create & cache unshared fields"); } + // Special copy constructor used to flatten value type fields by + // copying the fields of the value type to a new holder klass. + ciField::ciField(ciField* field, ciInstanceKlass* holder, int offset, bool is_final) { + assert(field->holder()->is_valuetype(), "should only be used for value type field flattening"); + // Set the is_final flag + jint final = is_final ? JVM_ACC_FINAL : ~JVM_ACC_FINAL; + AccessFlags flags(field->flags().as_int() & final); + _flags = ciFlags(flags); + _holder = holder; + _offset = offset; + // Copy remaining fields + _name = field->_name; + _signature = field->_signature; + _type = field->_type; + _is_constant = field->_is_constant; + _known_to_link_with_put = field->_known_to_link_with_put; + _known_to_link_with_get = field->_known_to_link_with_get; + _constant_value = field->_constant_value; + assert(!field->is_flattened(), "field must not be flattened"); + assert(!field->is_flattenable(), "field must not be flattenable"); + _is_flattened = false; + _is_flattenable = false; + } + static bool trust_final_non_static_fields(ciInstanceKlass* holder) { if (holder == NULL) return false; if (holder->name() == ciSymbol::java_lang_System()) // Never trust strangely unstable finals: System.out, etc.
*** 248,257 **** --- 272,283 ---- _flags = ciFlags(fd->access_flags()); _offset = fd->offset(); Klass* field_holder = fd->field_holder(); assert(field_holder != NULL, "null field_holder"); _holder = CURRENT_ENV->get_instance_klass(field_holder); + _is_flattened = fd->is_flattened(); + _is_flattenable = fd->is_flattenable(); // Check to see if the field is constant. Klass* k = _holder->get_Klass(); bool is_stable_field = FoldStableValues && is_stable(); if ((is_final() && !has_initialized_final_update()) || is_stable_field) {
*** 360,371 **** // link errors? bool ciField::will_link(ciMethod* accessing_method, Bytecodes::Code bc) { VM_ENTRY_MARK; assert(bc == Bytecodes::_getstatic || bc == Bytecodes::_putstatic || ! bc == Bytecodes::_getfield || bc == Bytecodes::_putfield, ! "unexpected bytecode"); if (_offset == -1) { // at creation we couldn't link to our holder so we need to // maintain that stance, otherwise there's no safe way to use this // ciField. --- 386,397 ---- // link errors? bool ciField::will_link(ciMethod* accessing_method, Bytecodes::Code bc) { VM_ENTRY_MARK; assert(bc == Bytecodes::_getstatic || bc == Bytecodes::_putstatic || ! bc == Bytecodes::_getfield || bc == Bytecodes::_putfield || ! bc == Bytecodes::_withfield, "unexpected bytecode"); if (_offset == -1) { // at creation we couldn't link to our holder so we need to // maintain that stance, otherwise there's no safe way to use this // ciField.
< prev index next >