-
Notifications
You must be signed in to change notification settings - Fork 56
refactor(levm): removed call frame as parameter from certain functions #2645
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
Conversation
Lines of code reportTotal lines added: Detailed view
|
EF Tests Comparison
|
Benchmark Results ComparisonPR ResultsBenchmark Results: Factorial
Benchmark Results: Factorial - Recursive
Benchmark Results: Fibonacci
Benchmark Results: ManyHashes
Benchmark Results: BubbleSort
Benchmark Results: ERC20 - Transfer
Benchmark Results: ERC20 - Mint
Benchmark Results: ERC20 - Approval
Main ResultsBenchmark Results: Factorial
Benchmark Results: Factorial - Recursive
Benchmark Results: Fibonacci
Benchmark Results: ManyHashes
Benchmark Results: BubbleSort
Benchmark Results: ERC20 - Transfer
Benchmark Results: ERC20 - Mint
Benchmark Results: ERC20 - Approval
|
4ee8c2f
to
3791861
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- I think it's best to rename
current_call_frame
toexecuted_call_frame
in scenarios in which the callframe has already been executed. Like inhandle_opcode_result
. - To be honest, I actually think that it is a little bit more clear if we pop the callframe in
run_execution
and send it as parameter, otherwise it is confusing when seeingself.current_call_frame_mut()
being called without knowing the callframe was popped. call_frame_to_execute
is not a bad name but may be misleading. In that context maybeparent_call_frame
is a more accurate name and the executed one could beexecuted_call_frame
.
My take on this is that maybe the best thing to do is leave the callframe as argument in those functions so that the popping of the callframe is clear in run_execution
(so that the execution flow is more clear) and only change the names of the callframes to the ones suggested: parent_call_frame
and executed_call_frame
.
This is just my opinion, maybe I'm biased and I don't see the decrease of complexity in this PR. Perhaps it should be also reviewed by somebody else.
This was closed because it added unwanted complexity. Some things will be implemented in another PRs, like name improvements and maybe some comments explaining confusing parts of the code regarding to callframes. |
Motivation
Simplify some function calls by removing unnecessary parameters and make the code of the handlers a bit more readable.
Description
The current call frame was being passed as a parameter to certain function calls in the VM. This removes it in favor of using the VM method. Some variables are also renamed for further clarity, and the responsability of popping the current call frame from the stack is delegated to the handle_return_call and handle_return_create methods (where both the call frame that has just been executed, and the one to be returned to, are needed).
Resolves #2542 and #2569