-
Notifications
You must be signed in to change notification settings - Fork 39
Execution context generalization #779
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
Codecov Report
@@ Coverage Diff @@
## master #779 +/- ##
=======================================
Coverage 99.24% 99.24%
=======================================
Files 78 79 +1
Lines 11962 11962
=======================================
Hits 11872 11872
Misses 90 90
Flags with carried forward coverage won't be shown. Click here to find out more.
|
|
Nit: the commit message |
| const auto& code = instance.module->get_code(func_idx); | ||
| auto* const memory = instance.memory.get(); | ||
|
|
||
| const auto local_ctx = ctx.create_local_context(); |
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.
Does moving this action from invoke to execute change the depth that host functions see?
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.
No. We record the value in many tests:
| recorded_depth = ctx.depth; |
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 thought so, but why?
Before: call opcode calls invoke_function, it increments depth, calls execute, it calls host function.
After: call opcode calls invoke_function, calls execute, it calls host function. (increment only if it's not imported)
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.
Before: execute(depth: D), call opcode, invoke_function(): increment depth, execute(depth: D+1).
After: execute(depth: D): increment depth, call opcode, invoke_function(), execute(depth: D+1).
So this changes the value of the depth only inside the execute().
This is needed because later I want to get access the ExecutionContext shared stack space in the same place where depth is incremented.
I was not able to also move the depth check to the same place easily. This may be handled later, e.g. by trapping inside the invoke_function().
To my understanding, move constructor is not implicitly generated if you declare a copy constructor. |
I think only if you define a custom one, but I might be wrong. |
|
I would add explicit deletions of move contructor and move assignment then. |
OK. |
5ad956b to
524e5aa
Compare
Before #777 lands I propose to generalize
ExecutionContext:execution_context.hpp,Guardto something likeLocalContext,increment_call_depth()to something likecreate_local_context().