comparison src/hotspot/share/ci/ciInstanceKlass.cpp @ 52848:448c8cd077c9

8214303: [lworld] Value types consistency checks should have been removed with 8214138
author fparain
date Mon, 26 Nov 2018 11:38:13 -0500
parents d02b39679f11
children 128ccaa6d2e3
comparison
equal deleted inserted replaced
22:0daa96de7df6 23:736969e87ce5
419 ciField* field = new (CURRENT_THREAD_ENV->arena()) ciField(&fd); 419 ciField* field = new (CURRENT_THREAD_ENV->arena()) ciField(&fd);
420 return field; 420 return field;
421 } 421 }
422 422
423 // ------------------------------------------------------------------ 423 // ------------------------------------------------------------------
424 // ciInstanceKlass::get_field_type_by_offset
425 ciType* ciInstanceKlass::get_field_type_by_offset(int field_offset) {
426 ASSERT_IN_VM;
427 fieldDescriptor fd;
428 InstanceKlass* klass = get_instanceKlass();
429 // Important: We cannot get the field type via get_field_by_offset() because if the field
430 // is another value type, the offset would refer to the first field of that value type due
431 // to flattening. Instead, do a SystemDictionary lookup for the type of the declared field.
432 bool found = klass->find_field_from_offset(field_offset, false, &fd);
433 assert(found, "field not found");
434 BasicType field_type = fd.field_type();
435 if (is_java_primitive(field_type)) {
436 // Primitive type
437 return ciType::make(field_type);
438 } else {
439 // Do a SystemDictionary lookup for the type
440 ciEnv* env = CURRENT_ENV;
441 ciSymbol* signature = env->get_symbol(fd.signature());
442 return env->get_klass_by_name_impl(this, constantPoolHandle(), signature, false);
443 }
444 }
445
446 // ------------------------------------------------------------------
447 // ciInstanceKlass::get_field_by_name 424 // ciInstanceKlass::get_field_by_name
448 ciField* ciInstanceKlass::get_field_by_name(ciSymbol* name, ciSymbol* signature, bool is_static) { 425 ciField* ciInstanceKlass::get_field_by_name(ciSymbol* name, ciSymbol* signature, bool is_static) {
449 VM_ENTRY_MARK; 426 VM_ENTRY_MARK;
450 InstanceKlass* k = get_instanceKlass(); 427 InstanceKlass* k = get_instanceKlass();
451 fieldDescriptor fd; 428 fieldDescriptor fd;
543 fieldDescriptor& fd = fs.field_descriptor(); 520 fieldDescriptor& fd = fs.field_descriptor();
544 if (fd.is_flattened() && flatten) { 521 if (fd.is_flattened() && flatten) {
545 // Value type fields are embedded 522 // Value type fields are embedded
546 int field_offset = fd.offset(); 523 int field_offset = fd.offset();
547 // Get ValueKlass and adjust number of fields 524 // Get ValueKlass and adjust number of fields
548 ciValueKlass* vk = get_field_type_by_offset(field_offset)->as_value_klass(); 525 Klass* k = get_instanceKlass()->get_value_field_klass(fd.index());
526 ciValueKlass* vk = CURRENT_ENV->get_klass(k)->as_value_klass();
549 flen += vk->nof_nonstatic_fields() - 1; 527 flen += vk->nof_nonstatic_fields() - 1;
550 // Iterate over fields of the flattened value type and copy them to 'this' 528 // Iterate over fields of the flattened value type and copy them to 'this'
551 for (int i = 0; i < vk->nof_nonstatic_fields(); ++i) { 529 for (int i = 0; i < vk->nof_nonstatic_fields(); ++i) {
552 ciField* flattened_field = vk->nonstatic_field_at(i); 530 ciField* flattened_field = vk->nonstatic_field_at(i);
553 // Adjust offset to account for missing oop header 531 // Adjust offset to account for missing oop header