1019 if (klass->superklass() != NULL) { 1020 svIndex = reassign_fields_by_klass(klass->superklass(), fr, reg_map, sv, svIndex, obj, skip_internal, 0, CHECK_0); 1021 } 1022 1023 GrowableArray<ReassignedField>* fields = new GrowableArray<ReassignedField>(); 1024 for (AllFieldStream fs(klass); !fs.done(); fs.next()) { 1025 if (!fs.access_flags().is_static() && (!skip_internal || !fs.access_flags().is_internal())) { 1026 ReassignedField field; 1027 field._offset = fs.offset(); 1028 field._type = FieldType::basic_type(fs.signature()); 1029 if (field._type == T_VALUETYPE) { 1030 if (fs.is_flatten()) { 1031 // Resolve klass of flattened value type field 1032 SignatureStream ss(fs.signature(), false); 1033 Klass* vk = ss.as_klass(Handle(THREAD, klass->class_loader()), Handle(THREAD, klass->protection_domain()), SignatureStream::NCDFError, THREAD); 1034 guarantee(!HAS_PENDING_EXCEPTION, "Should not have any exceptions pending"); 1035 assert(vk->is_value(), "must be a ValueKlass"); 1036 field._klass = InstanceKlass::cast(vk); 1037 } else { 1038 // Non-flattened value type field 1039 // TODO change this when we use T_VALUETYPEPTR 1040 field._type = T_OBJECT; 1041 } 1042 } 1043 fields->append(field); 1044 } 1045 } 1046 fields->sort(compare); 1047 for (int i = 0; i < fields->length(); i++) { 1048 intptr_t val; 1049 ScopeValue* scope_field = sv->field_at(svIndex); 1050 StackValue* value = StackValue::create_stack_value(fr, reg_map, scope_field); 1051 int offset = base_offset + fields->at(i)._offset; 1052 BasicType type = fields->at(i)._type; 1053 switch (type) { 1054 case T_OBJECT: case T_ARRAY: 1055 assert(value->type() == T_OBJECT, "Agreement."); 1056 obj->obj_field_put(offset, value->get_obj()()); 1057 break; 1058 1059 case T_VALUETYPE: { 1060 // Recursively re-assign flattened value type fields 1061 InstanceKlass* vk = fields->at(i)._klass; 1062 assert(vk != NULL, "must be resolved"); 1063 offset -= ValueKlass::cast(vk)->first_field_offset(); // Adjust offset to omit oop header 1064 svIndex = reassign_fields_by_klass(vk, fr, reg_map, sv, svIndex, obj, skip_internal, offset, CHECK_0); 1065 continue; // Continue because we don't need to increment svIndex 1066 } 1067 1068 // Have to cast to INT (32 bits) pointer to avoid little/big-endian problem. 1069 case T_INT: case T_FLOAT: { // 4 bytes. 1070 assert(value->type() == T_INT, "Agreement."); 1071 bool big_value = false; 1072 if (i+1 < fields->length() && fields->at(i+1)._type == T_INT) { 1073 if (scope_field->is_location()) { 1074 Location::Type type = ((LocationValue*) scope_field)->location().type(); | 1019 if (klass->superklass() != NULL) { 1020 svIndex = reassign_fields_by_klass(klass->superklass(), fr, reg_map, sv, svIndex, obj, skip_internal, 0, CHECK_0); 1021 } 1022 1023 GrowableArray<ReassignedField>* fields = new GrowableArray<ReassignedField>(); 1024 for (AllFieldStream fs(klass); !fs.done(); fs.next()) { 1025 if (!fs.access_flags().is_static() && (!skip_internal || !fs.access_flags().is_internal())) { 1026 ReassignedField field; 1027 field._offset = fs.offset(); 1028 field._type = FieldType::basic_type(fs.signature()); 1029 if (field._type == T_VALUETYPE) { 1030 if (fs.is_flatten()) { 1031 // Resolve klass of flattened value type field 1032 SignatureStream ss(fs.signature(), false); 1033 Klass* vk = ss.as_klass(Handle(THREAD, klass->class_loader()), Handle(THREAD, klass->protection_domain()), SignatureStream::NCDFError, THREAD); 1034 guarantee(!HAS_PENDING_EXCEPTION, "Should not have any exceptions pending"); 1035 assert(vk->is_value(), "must be a ValueKlass"); 1036 field._klass = InstanceKlass::cast(vk); 1037 } else { 1038 // Non-flattened value type field 1039 field._type = T_VALUETYPEPTR; 1040 } 1041 } 1042 fields->append(field); 1043 } 1044 } 1045 fields->sort(compare); 1046 for (int i = 0; i < fields->length(); i++) { 1047 intptr_t val; 1048 ScopeValue* scope_field = sv->field_at(svIndex); 1049 StackValue* value = StackValue::create_stack_value(fr, reg_map, scope_field); 1050 int offset = base_offset + fields->at(i)._offset; 1051 BasicType type = fields->at(i)._type; 1052 switch (type) { 1053 case T_OBJECT: 1054 case T_VALUETYPEPTR: 1055 case T_ARRAY: 1056 assert(value->type() == T_OBJECT, "Agreement."); 1057 obj->obj_field_put(offset, value->get_obj()()); 1058 break; 1059 1060 case T_VALUETYPE: { 1061 // Recursively re-assign flattened value type fields 1062 InstanceKlass* vk = fields->at(i)._klass; 1063 assert(vk != NULL, "must be resolved"); 1064 offset -= ValueKlass::cast(vk)->first_field_offset(); // Adjust offset to omit oop header 1065 svIndex = reassign_fields_by_klass(vk, fr, reg_map, sv, svIndex, obj, skip_internal, offset, CHECK_0); 1066 continue; // Continue because we don't need to increment svIndex 1067 } 1068 1069 // Have to cast to INT (32 bits) pointer to avoid little/big-endian problem. 1070 case T_INT: case T_FLOAT: { // 4 bytes. 1071 assert(value->type() == T_INT, "Agreement."); 1072 bool big_value = false; 1073 if (i+1 < fields->length() && fields->at(i+1)._type == T_INT) { 1074 if (scope_field->is_location()) { 1075 Location::Type type = ((LocationValue*) scope_field)->location().type(); |