support non-init output slots on STMT_call

80a6dfb
Opened by Graydon Hoare at 2011-01-27 00:49:28

Currently Trans.trans_call takes an argument indicating whether it's an initializing call, but it always behaves as though it's initializing, even if the argument is false. This is because there's a bit of a subtlety involved in refcounted values: the same referent may be used as both dst of the call and as an arg, and we want to avoid having it drop before being pinned as an arg, because the dst was dropped.

The existing code may have been born in the CoW era and may no longer represent a real hazard if rearranged to just pin args first then drop dst; will need a few careful tests to be sure the arrangement actually works.

(Alternatively: worst case, make a static pass that prohibits x = f(x) the same way f(x,x) is to be prohibited if both slots are alias-mode.)

  1. Now actually dropping on non-init; added output-slot-variants.rs to test somewhat more thoroughly and of course several forms crash. More work to do here.

    Graydon Hoare at 2010-06-24 20:38:09

  2. WONTFIX (not required for bootstrapping)

    Graydon Hoare at 2011-01-27 00:49:28