-
Notifications
You must be signed in to change notification settings - Fork 780
ExpressionRunner class hierarchy #2797
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Yeah, that's a refactor I'm not especially proud of. Essentially, what happened there is that most of The underlying concern for extending Perhaps we should pick up the idea again to add a class in between, what previously was
|
I didn't review that PR, so could you elaborate on what parts were overly confusing in doing that? |
Sure, the pivotal discussion was #2702 (comment), then leading to that change. |
Sorry, I read the comment and am still at a loss.
|
This has implications on the way we track intermediate values of locals (which is one of my additions that precompute didn't have previously). If execution was not be linear, we cannot simply use a map that we write to on
See also #2804 (comment) on the other thread. Mostly boils down to the precompute pass having one special mechanism. |
I'd support a refactoring here, I agree this should be cleaner. Hopefully we can find a nice solution! Sorry I didn't push on this more in reviewing that PR. Part of the reason is I had "tunnel vision" in a large and long-running review of a PR - over time in review I focused less on the big picture and more on specific details. But in a big refactoring like that I should have re-read the entire thing more frequently. |
Can we please agree that this is all my fault for being terrible at C++ and too inexperienced with Binaryen's codebase, making my PR's hard to review in the first place? :) I promise this will improve a lot over time, when I become more confident! (I guess it also takes a little longer than usual since I'm external and mostly relying on somewhat indirect, so sometimes inefficient means of communication.) |
Tackles the concerns raised in #2797 directly related to #2702 by reverting merging all of `PrecomputeExpressionRunner` into the base `ExpressionRunner`, instead adding a common base for both the precompute pass and the new C-API to inherit. No functional changes. --- ### Current hierarchy after #2702 is ``` ExpressionRunner ├ [PrecomputeExpressionRunner] ├ [CExpressionRunner] ├ ConstantExpressionRunner └ RuntimeExpressionRunner ``` where `ExpressionRunner` contains functionality not utilized by `ConstantExpressionRunner` and `RuntimeExpressionRunner`. ### New hierarchy will be: ``` ExpressionRunner ├ ConstantExpressionRunner │ ├ [PrecomputeExpressionRunner] │ └ [CExpressionRunner] ├ InitializerExpressionRunner └ RuntimeExpressionRunner ``` with the precompute pass's and the C-API's shared functionality now moved out of `ExpressionRunner` into a new `ConstantExpressionRunner`. Also renames the previous `ConstantExpressionRunner` to `InitializerExpressionRunner` to [better represent its uses](https://webassembly.org/docs/modules/#initializer-expression) and to make its previous name usable for the new intermediate template, where it fits perfectly. Also adds a few comments answering some of the questions that came up recently. ### Old hierarchy before #2702 for comparison: ``` ExpressionRunner ├ [PrecomputeExpressionRunner] ├ ConstantExpressionRunner └ RuntimeExpressionRunner ```
Addressed by #2804. Thanks! |
#2702 exposes functionalities of
ExpressionRunner
to Binaryen and C API. I find most usages there is about precomputing certain expression, and we havePrecomputeExpressionRunner
for that. But after #2702 some functionalities ofPrecomputeExpressionRunner
are duplicated inExpressionRunner
to make them exposed to Binaryen and C API, and I'm not very sure what the difference betweenExpressionRunner
andPrecomputeExpressionRunner
is at this point.So I'm not sure the functionalities of
ExpressionRunner
class hierarchy is very well defined now. Can't Binaryen and C API make use ofPrecomputeExpressionRunner
instead, if the main purpose of that is precomputing?I might be mistaken, so please advise me if so :)
cc @dcodeIO @kripken @tlively
The text was updated successfully, but these errors were encountered: