1
0
Fork 0
mirror of https://github.com/tobast/libunwind-eh_elf.git synced 2024-05-10 16:35:17 +02:00

Remove unnecessary calls to labs()

We've just traced a large memory increase to that patch (Google ref:
b/18069427).
It appears that labs() was there for a good reason.

Sorry about that :-(

For the curious:

  unsigned long u1 = ~0UL;
  unsigned long u2 = labs(u1);

  assert(u1 != u2);  // labs on unsigned *may* have an effect, despite
what Clang says.

Attached patch suppresses the Clang warning, while still keeping the
original behavior (which I believe to be correct).

Thanks,
--
Paul Pluzhnikov
This commit is contained in:
Paul Pluzhnikov 2014-10-22 11:23:32 -07:00 committed by Arun Sharma
parent 5b37b3cff1
commit 1bca6eb8ea

View file

@ -50,17 +50,17 @@ tdep_stash_frame (struct dwarf_cursor *d, struct dwarf_reg_state *rs)
&& (rs->reg[DWARF_CFA_REG_COLUMN].where == DWARF_WHERE_REG)
&& (rs->reg[DWARF_CFA_REG_COLUMN].val == RBP
|| rs->reg[DWARF_CFA_REG_COLUMN].val == RSP)
&& rs->reg[DWARF_CFA_OFF_COLUMN].val < (1 << 29)
&& labs((long) rs->reg[DWARF_CFA_OFF_COLUMN].val) < (1 << 29)
&& DWARF_GET_LOC(d->loc[d->ret_addr_column]) == d->cfa-8
&& (rs->reg[RBP].where == DWARF_WHERE_UNDEF
|| rs->reg[RBP].where == DWARF_WHERE_SAME
|| (rs->reg[RBP].where == DWARF_WHERE_CFAREL
&& rs->reg[RBP].val < (1 << 14)
&& labs((long) rs->reg[RBP].val) < (1 << 14)
&& rs->reg[RBP].val+1 != 0))
&& (rs->reg[RSP].where == DWARF_WHERE_UNDEF
|| rs->reg[RSP].where == DWARF_WHERE_SAME
|| (rs->reg[RSP].where == DWARF_WHERE_CFAREL
&& rs->reg[RSP].val < (1 << 14)
&& labs((long) rs->reg[RSP].val) < (1 << 14)
&& rs->reg[RSP].val+1 != 0)))
{
/* Save information for a standard frame. */