Skip to content

Commit

Permalink
Setup inlined CStruct assigned during construction
Browse files Browse the repository at this point in the history
  • Loading branch information
scovit committed May 12, 2020
1 parent 5fe4a81 commit e4ff694
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/6model/reprs/CStruct.c
Expand Up @@ -609,7 +609,15 @@ static void bind_attribute(MVMThreadContext *tc, MVMSTable *st, MVMObject *root,
if (REPR(value)->ID != MVM_REPR_ID_MVMCStruct)
MVM_exception_throw_adhoc(tc,
"Can only store CStruct attribute in CStruct slot in CStruct");
cobj = ((MVMCStruct *)value)->body.cstruct;
if (repr_data->attribute_locations[slot] & MVM_CSTRUCT_ATTR_INLINED) {
memcpy((char *)body->cstruct + repr_data->struct_offsets[slot],
((MVMCStruct *)value)->body.cstruct,
((MVMCStructREPRData *)STABLE(value)->REPR_data)->struct_size);
((MVMCStruct *)value)->body.cstruct = (char *)body->cstruct + repr_data->struct_offsets[slot];
break;
}
else
cobj = ((MVMCStruct *)value)->body.cstruct;
}
else if (type == MVM_CSTRUCT_ATTR_CPPSTRUCT) {
if (REPR(value)->ID != MVM_REPR_ID_MVMCPPStruct)
Expand Down

0 comments on commit e4ff694

Please sign in to comment.