dubiousconst282/DistIL

Linq expansion planning/next steps

Closed this issue · 0 comments

  • Infrastructure:

    • Introduce a new IR::Lambda intrinsic to represent lambda factories in a single instruction, to make it easier to identify queries (this brings too many complications and it's wasteful; detecting queries isn't really difficult and it's easier to just rely on lambda devirtualization instead)
    • General refactor/rewrite
    • Allow single-def vars used inside regions to be SSA renamed (ILImporter.AnalyseVars())
  • Support for sources other than arrays:

    • Fallback to IEnumerator
    • Specialized source for Array, List<>, string
    • Specialized source for Enumerable.Range()
    • Specialize/devirtualize and inline boxed enumerators (ImmutableArray, ArraySegment)
  • Operators/stages:

    • Concretization:
      • ToArray
      • ToList
      • ToHashSet
      • ToDictionary
    • Aggregation:
      • Aggregate
        • Support for "unseeded" aggregates (throws if source is empty, somewhat tricky to implement)
      • Count (predicated only)
      • #23
      • Min, Max (vectorized in .NET 7)
    • Search:
      • Any, All
      • First[OrDefault]
      • Last[OrDefault] (will probably need some trickery to implement efficiently for random-access sources)
      • Single[OrDefault]
      • ElementAt[OrDefault] (not profitable)
    • Stages:
      • Select
      • Where
      • Cast, OfType
      • Skip, Take
      • SelectMany
      • Buffering:
        • Reverse (idea: could have an option to disable buffering for fast reverse)
        • Order* (this will be tricky since there's no other stable sort function in the BCL)
  • Other:

    • Support for loop consumed queries (port for the front-to-back rewrite)
    • #24
      • Otherwise we may leak memory for e.g. File.ReadLines()
    • Offer options to preserve behavior (alt: opt-in/out attributes)
      • List enumerator version/concurrent mod checking
      • Keep null arg checks (really?)
  • Known bugs:

    • Overlapping queries (.ToArray().ToArray())