digitalmars.D - DMD: Finding symbol value references to enable more move optimizations
- =?UTF-8?B?Tm9yZGzDtnc=?= (27/27) Sep 27 2016 I'm currently trying to understand if it's possible to add more
I'm currently trying to understand if it's possible to add more move-optimizations in parameter passing for those parameters whole symbols aren't used after the call or for `const` or `immutable` parameters to ` safe pure` (strictly pure) functions. This similar to function call optimizations possible in Rust but less restrictive because the symbol is allowed to be used after the call aswell. Could somebody please highlight suitable places in DMD that checks if the value of a specific symbol is read or written to, typically inside a given `Scope` instance? My guess is `doCopyOrMove` in `expression.d` is good contender, right? Is this the place where I should scan for further references to expression if it's an Lvalue? If there currently is no such code that does this, does anybody have any advice on how to write this? Further, AFAICT, parameters passed as `const` or `immutable` to ` safe pure` functions can also be passed with a move. This traversal is a key-feature that could also provide better diagnostics for unused symbols. I also realize the risk of introducing quadratic complexity in `doCopyOrMove` but this can be avoided by memoizing the result of the symbol scan upon the first call to `doCopyOrMove` for the Lvalue case. I've tried posting this the DMD group but it enters an infinite post loop. I have registered my email and name on the mailing list aswell.
Sep 27 2016