1. 11 8月, 2017 1 次提交
    • A
      Remove RemoveUnneededReferences from LamdaRewriter (#21367) · caa78300
      Andy Gocke 提交于
      Currently, the lambda rewriter has an early optimization pass in
      analysis that tries to find all local functions that only capture 'this'
      and remove references to local functions that do the same. There are two
      problems with this approach:
      
          1) Generally, removing information from the tree is a bad idea
          because it hurts further analysis passes that may have needed that
          information.
      
          2) The optimization strategy itself is very tricky and has a number
          of complex corner cases. This has lead to bugs, for example #19033.
      
      This PR deletes the current method and adds a new optimization routine
      at the end of the analysis, operating on assigned scopes and
      environments rather than removing captured variable analysis. The new
      optimization is as follows: if we end up with an environment containing
      only 'this', the environment can be removed, all containing methods can
      be moved to the top-level type, and all environments which capture the
      'this' environment can instead directly capture the 'this' parameter.
      This produces almost the same results as the previous optimization, but
      is easier to validate as an algebraic equivalence.
      
      The baseline changes come from the new optimization being less aggressive 
      about moving functions which only capture 'this' to the top level. This
      appears to be a wash -- some codegen gets slightly better, some gets
      slightly worse.
      
      Fixes #19033
      Fixes #20577
      caa78300
  2. 08 8月, 2017 1 次提交
    • A
      Re-baseline some emit tests · 343ada1b
      Andy Gocke 提交于
      The frame creation pass now considers scope of captured variable
      introduction instead of closure creation, so the ordering can change if
      two or more nested functions access variables 'outside-in', e.g.
      
      ```csharp
      {
          int x = 0;
          {
              int y = 0;
              int L1() => y;
      
              {
                   int z = 0;
                   int L2() => x;
              }
          }
      }
      ```
      
      If we visit closures in-order in the previous example, we create frames
      for L1, then L2. If we visit captured variables scopes, however, we
      visit `x` (captured by L2), then `y` (captued by L1).
      343ada1b
  3. 02 8月, 2017 1 次提交
  4. 29 6月, 2017 1 次提交
  5. 18 5月, 2017 1 次提交
  6. 31 12月, 2016 1 次提交
    • N
      Disallow expression variables in query clauses. (#16081) · 8d6e20e9
      Neal Gafter 提交于
      Fixes #15910
      Also fixes a sequence point issue with the let expression. Specifically, the source range for the query lambda included more than the expression of the let, but included the entire query clause. It now includes only the expression, like other query clauses.
      8d6e20e9
  7. 11 4月, 2016 1 次提交
    • A
      Add an instrumentation component that can be used to instrument certain... · b76cb911
      AlekseyTs 提交于
      Add an instrumentation component that can be used to instrument certain statements and expressions during lowering. Part 2.
      
      This finalizes the refactoring. Sequence points are no longer created before LocalRewriter is invoked. LocalRewriter completely relies on instrumentation for sequence points generation. There is an exception, LocalRewriter creates hidden sequence points in three places, but they are not associated with any executable code derived from C# syntax.
      
      Related to #9819.
      b76cb911
  8. 26 1月, 2016 1 次提交
  9. 08 12月, 2015 1 次提交
  10. 16 10月, 2015 1 次提交
  11. 10 9月, 2015 1 次提交
  12. 26 7月, 2015 1 次提交
  13. 07 7月, 2015 1 次提交
  14. 16 5月, 2015 1 次提交
  15. 15 5月, 2015 1 次提交
  16. 12 5月, 2015 1 次提交
  17. 07 5月, 2015 1 次提交
    • W
      Setting next statement inside a scope with a lambda cause NRE · dfdc94b6
      Wonseok Chae 提交于
      This happens since setting next statement skips the closure initialization, which marks as hidden sequence point.
      
      In this PR, we emit a regular sequence point instead of a hidden sequence point to closure initialization whenever necessary, so IP move won't skip closure initialization.
      dfdc94b6
  18. 10 4月, 2015 1 次提交
  19. 24 3月, 2015 1 次提交
  20. 06 3月, 2015 1 次提交
  21. 28 2月, 2015 1 次提交
    • B
      Code formatter run · ae1aeb41
      beep boop 提交于
      Been almost a month since the code formatter was run so this change was
      a bit larger than would be expected for a normal (weekly) update.  Diffs
      mostly around:
      
      - Whitespace changes
      - Missing copyright headers
      - Missing visibility modifiers
      ae1aeb41
  22. 31 1月, 2015 1 次提交
    • T
      EnC support for lambdas & closures in C# compiler · ebc795d4
      TomasMatousek 提交于
      1) Change MethdCompiler.BindMethodBody to associate correct syntax with BoundBlocks it creates when binding constructor with constructor initializer call (two bound blocks are created – outer one defines a closure scope for constructor parameters, the inner one defines a closure scope for variables in the body).
      2) Introduce MethodDebugId – a method ordinal and generation ordinal pair
      3) Introduce LamdbaDebugInfo and ClosureDebugInfo to represent information (syntax offset) we use to figure out how to map lambdas and closures to the previous generation.
      4) Adds a new PDB CDI record (#7) to store lambda and closure debug info.
      5) Generalizes CalculateLocalSyntaxOffset to handle positions in field/property initializers and constructor initializers. Use it to calculate syntax offsets of lambdas and closure scopes. (TODO: rename CalculateLocalSyntaxOffset to CalculateSyntaxOffset).
      6) Replace lambda and scope ordinal dispenser integers with array builders that collect LambdaDebugInfo and ClosureDebugInfo.
      7) Use TryGet- pattern for all VariableSlotAllocator APIs.
      8) Implements mapping of lambda method and display class names to previous generation via VariableSlotAllocator.
       (changeset 1407240)
      ebc795d4