[dmd-internals] [D-Programming-Language/dmd] 19fa1f: Function calls: destruct temporary args if last th...

GitHub via dmd-internals dmd-internals at puremagic.com
Sun Jan 31 12:32:22 PST 2016


  Branch: refs/heads/master
  Home:   https://github.com/D-Programming-Language/dmd
  Commit: 19fa1f81127f171d39fa71cedd813c7f47cccb81
      https://github.com/D-Programming-Language/dmd/commit/19fa1f81127f171d39fa71cedd813c7f47cccb81
  Author: Martin <noone at nowhere.com>
  Date:   2015-10-01 (Thu, 01 Oct 2015)

  Changed paths:
    M src/expression.d

  Log Message:
  -----------
  Function calls: destruct temporary args if last throwing arg throws

Previously, if the last potentially throwing argument expression's
`type->baseElemOf()` yielded a struct type, the arg would incorrectly
NOT be added to `eprefix`.
This led to the destructor gate being set to true (disabling all dtors)
right BEFORE evluating the last potentially throwing argument. So in
case it threw, no dtors would be triggered.


  Commit: fb5797fe3e9b26147f32ad7d1e2565810f22b86d
      https://github.com/D-Programming-Language/dmd/commit/fb5797fe3e9b26147f32ad7d1e2565810f22b86d
  Author: Martin <noone at nowhere.com>
  Date:   2015-10-02 (Fri, 02 Oct 2015)

  Changed paths:
    M src/expression.d
    A test/runnable/test14903.d

  Log Message:
  -----------
  Strive for a sane evaluation order of arguments when using argprefix

If argprefix is required, make sure it covers the very first argument up
to and including the last potentially throwing argument. Only evaluate
subsequent arguments directly.
This also includes ref and out params, but not lazy ones.

Note that previously, `appendToPrefix` would be set by the first arg with
dtor (if a subsequent arg may throw), and only reset when processing the
last throwing arg (i == lastthrow).
So all non-ref/out/lazy args inbetween would be added to `eprefix`,
leading to this staggering evaluation order:

  [firstDtor..lastThrow (except for ref/out/lazy)]
  [0..firstDtor]
  [firstDtor..lastThrow (only ref/out/lazy)]
  [lastThrow..$]

Also prepare for potential right-to-left arguments evaluation order
(array ops).


  Commit: 944756b763758944e00d434d862da743d1f2f28e
      https://github.com/D-Programming-Language/dmd/commit/944756b763758944e00d434d862da743d1f2f28e
  Author: Martin Nowak <code at dawg.eu>
  Date:   2016-01-31 (Sun, 31 Jan 2016)

  Changed paths:
    M src/expression.d
    A test/runnable/test14903.d

  Log Message:
  -----------
  Merge pull request #5151 from kinke/argprefixD

argprefix: fix evaluation order and missing cleanup bug [bugzilla 14903]


Compare: https://github.com/D-Programming-Language/dmd/compare/eb5fddb916e0...944756b76375


More information about the dmd-internals mailing list