Conversation
Agent-Logs-Url: https://github.com/dadhi/FastExpressionCompiler/sessions/7d16be33-857d-4217-8cbc-c6e95d110f84 Co-authored-by: dadhi <39516+dadhi@users.noreply.github.com>
dadhi
left a comment
There was a problem hiding this comment.
The ubuntu build is failed:
/home/runner/work/FastExpressionCompiler/FastExpressionCompiler/src/FastExpressionCompiler.LightExpression/FlatExpression.cs(1793,6): error CS0246: The type or namespace name 'DoesNotReturnAttribute' could not be found (are you missing a using directive or an assembly reference?) [/home/runner/work/FastExpressionCompiler/FastExpressionCompiler/src/FastExpressionCompiler.LightExpression/FastExpressionCompiler.LightExpression.csproj::TargetFramework=net472]
Also just to verify. We are using the same condition for FE as for SE and LE in FEC to decide what to store in ClosureConstants. We did not change that. The only change is for non closure constants that previosly can be stored inplace in Constant node for up to 8 bytes, but now - just up to 4 bytes. So bigger than 4 bytes non-closure values dtored in Obj (possibly boxed). Please check that.
Agent-Logs-Url: https://github.com/dadhi/FastExpressionCompiler/sessions/e4fd589e-da46-45a0-877b-94c254d85cd8 Co-authored-by: dadhi <39516+dadhi@users.noreply.github.com>
Fixed in def9eb9. I removed the |
dadhi
left a comment
There was a problem hiding this comment.
Vi errors:
Error: /home/runner/work/FastExpressionCompiler/FastExpressionCompiler/src/FastExpressionCompiler.LightExpression/FlatExpression.cs(1315,40): error CS0117: 'BitConverter' does not contain a definition for 'SingleToInt32Bits' [/home/runner/work/FastExpressionCompiler/FastExpressionCompiler/src/FastExpressionCompiler.LightExpression/FastExpressionCompiler.LightExpression.csproj::TargetFramework=net472]
Agent-Logs-Url: https://github.com/dadhi/FastExpressionCompiler/sessions/72f15b2a-4d12-499c-a213-bcad43d6e4be Co-authored-by: dadhi <39516+dadhi@users.noreply.github.com>
Fixed in 5ce2ffc. I replaced the |
| tag = pointsToParent | ||
| ? (byte)(tag | nextPointsToParentMask) | ||
| : (byte)(tag & ~nextPointsToParentMask); | ||
| _data = (_data & KeepWithoutTagAndNextMask) |
There was a problem hiding this comment.
Let split to 4 bytes _data and 4 bytes _nodeTypeAndKind
There was a problem hiding this comment.
Done in 1484adf. ExprNode now uses a 4-byte _data field plus a 4-byte _nodeTypeAndKind field, while keeping the 24-byte explicit layout intact.
Agent-Logs-Url: https://github.com/dadhi/FastExpressionCompiler/sessions/4b99052f-cb83-4a38-8342-f53e859ddbc9 Co-authored-by: dadhi <39516+dadhi@users.noreply.github.com>
dadhi
left a comment
There was a problem hiding this comment.
Right now I am not sure about shape of the complex expression for declaration and usage nodes. Could you please add a comments in code describing the decl and usage shape of Lambda, Block, etc.
Agent-Logs-Url: https://github.com/dadhi/FastExpressionCompiler/sessions/cec4f4cc-6325-4330-b621-6a290f3fef7e Co-authored-by: dadhi <39516+dadhi@users.noreply.github.com>
Added the shape comments in 331ecce. |
dadhi
left a comment
There was a problem hiding this comment.
Let look at how do prepare the expression for compilation in FEC by gathering the info in TryCollectInfo. We are doing so by walking throw expression tree and collecting info about nested lambdas, closue constants, parameter usage, gotos, etc. We collect this info into list which is very remeniscent of our current FE.
So my idea would to do as much as possible of this separate TryCollectInfo work why building FE incrementally without additional step. And may be find/prevent some invalid expressions by construction.
We already building ClosureConstants as we go.
Can we do the same for lambdas, e.g. create a separate Lambdas small list with Lsmbda specialized declaration node to simplify its construction and handling? Create and link those nodes in such a way to directly help.nested lambda emit and closure construction whic TryCollectInfo does? Can we solve identical lsmbdas should be compilef once problem right hetr?
What about blocks? They very similar to lambdas in the regard of having parameter declarations. And teir parameters may be set to closure to be used by the nested lambdas.
Yes, partially. FE can absorb a good chunk of What I would keep separate for now is the part that depends on whole-subtree/outer-context analysis: propagation of non-passed params to outer lambdas, goto/label usage accounting, complex-expression classification, and lambda dedup/compile-once. The compile-once part especially wants a stable canonicalized key, not just “same FE node built here”, otherwise we may dedup too early or by the wrong identity. So my take is: use FE construction to accumulate the structural data and some capture facts, then shrink |
|
@copilot Agree. Let do the first part here for lmbdas and blocks, this will clarify the next steps. |
Agent-Logs-Url: https://github.com/dadhi/FastExpressionCompiler/sessions/be12d6ed-b5f1-46be-828a-a7673aba6a54 Co-authored-by: dadhi <39516+dadhi@users.noreply.github.com>
Agent-Logs-Url: https://github.com/dadhi/FastExpressionCompiler/sessions/be12d6ed-b5f1-46be-828a-a7673aba6a54 Co-authored-by: dadhi <39516+dadhi@users.noreply.github.com>
Implemented in 83123e9. FE now records lambda and block owner metadata during construction in separate small lists, with keyed lookup by owner node index: lambdas store body plus parameter declarations, and blocks store body-expression-list plus variable declarations. I also added coverage for both direct FE construction and flattening from system expressions. |
I don’t have a tool here to post a regular issue comment to #533 directly, but here is the summary text ready to paste there:
|
|
dead end |
FlatExpression needs a more direct node model to support upcoming canonicalization and chaining work: compact constant storage, explicit parameter declaration/usage identity, reliable parent reachability from child chains, and owner-side lambda/block metadata that can absorb part of later compilation-prep analysis. This update reshapes the flat node metadata so those semantics are encoded directly instead of inferred indirectly.
Constant node layout
Objinstead of routing them throughClosureConstants.Parameter declaration vs usage
ChildIdxand declaration position inChildCount.Child chain parent linkage
Lambda / block owner metadata
LambdasandBlockssmall lists onExprTree.TryGetLambdaInfoandTryGetBlockInfo.System.Linq.Expressions.Reader / builder updates
GetSurePresentRef/direct refs in hot paths.Focused coverage
Example of the new parameter model:
Example of the new owner metadata: