Skip to content

Commit

Permalink
Issue 6234 - 64-bit array append generates inline code to copy new da…
Browse files Browse the repository at this point in the history
…ta, but does not call postblit

Call postblit when appending an element on x86-64
  • Loading branch information
yebblies committed Jul 4, 2011
1 parent b135734 commit 74bbf3b
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions src/e2ir.c
Expand Up @@ -3101,8 +3101,8 @@ elem *CatAssignExp::toElem(IRState *irs)
elength = el_bin(OPmin, TYsize_t, elength, el_long(TYsize_t, 1));
elength = el_bin(OPmul, TYsize_t, elength, el_long(TYsize_t, this->e2->type->size()));
eptr = el_bin(OPadd, TYnptr, eptr, elength);
eptr = el_una(OPind, e2->Ety, eptr);
elem *eeq = el_bin(OPeq, e2->Ety, eptr, e2);
elem *ederef = el_una(OPind, e2->Ety, eptr);
elem *eeq = el_bin(OPeq, e2->Ety, ederef, e2);

if (tybasic(e2->Ety) == TYstruct)
{
Expand All @@ -3115,7 +3115,15 @@ elem *CatAssignExp::toElem(IRState *irs)
eeq->Ejty = eeq->Ety = TYstruct;
eeq->ET = tb1n->toCtype();
}

#if DMDV2
StructDeclaration *sd = needsPostblit(tb2);
if (sd)
{ FuncDeclaration *fd = sd->postblit;
elem *ec = el_copytree(eptr);
ec = callfunc(loc, irs, 1, Type::tvoid, ec, sd->type->pointerTo(), fd, fd->type, NULL, NULL);
eeq = el_bin(OPcomma, ec->Ety, eeq, ec);
}
#endif
e = el_combine(e2x, e);
e = el_combine(e, eeq);
e = el_combine(e, el_var(stmp));
Expand Down

4 comments on commit 74bbf3b

@WalterBright
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added as dlang@3a87293

Needed to add code to account for side effects.

@yebblies
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Finally, everything passing! (except freebsd64)
Is there any reason this wasn't done as a merge?

@WalterBright
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It wasn't set up as a pull request.

@yebblies
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That shouldn't be a prerequisite for a merge...
I don't know process you've been using (or if there are good reasons for it) but a standard fetch, merge --no-commit, edit, push should let you do the same thing (edit before committing) while preserving author information and keep track of parent commits.
I understand in some cases it's not sufficient, but for simple merge + edits like this it should work.

Please sign in to comment.