Rewrite the funcletizer to support precompiled queries
Here's the rewrite of ParameterExtractingExpressionVisitor, to support precompiled queries.
- The new ExpressionTreeFuncletizer now has a new "path calculation" mode, where it returns a tree representing the paths to all parameterized nodes in the input tree. This will be used when generating precompiled query interceptors in order to generate code that extracts the parameterizable nodes and evaluates them at runtime.
- To support this, the new funcletizer has a visitation method for each node type (that's required for generating the correct path through each node). This is different from the previous approach, where the same semi-generic code attempted to handle the work for all node types (but in practice there were many exceptions and special code paths for specific node types).
- In addition, the new funcletizer does its work in a single visitation pass; the old approach was to visit once to identify evaluatable nodes, and then to visit again and evaluate the top-level nodes. This is better for perf.
Closes #32999 Closes #32698 Closes #33012
FYI I'm happy to go over the code with whoever wants to review, or possibly to do a brown bag if people are interested.
Note: the new mode (path calculation for precompiled queries) is obviously not well-tested; I will very likely be revisiting the funceltizer as part of later NativeAOT work. So there are likely some bugs in those specific bugs of the code - that's expected.
awesome stuff!
Thanks for the reviewing and the suggestions @maumar!