-
Notifications
You must be signed in to change notification settings - Fork 34
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
Fix invoke: drop args after the call #573
Conversation
|
||
const auto ret = func(instance, call_args, depth + 1); | ||
// Bubble up traps | ||
if (ret.trapped) | ||
return false; | ||
|
||
stack.drop(num_args); |
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.
If we want to be pedantic, shouldn't this happen before the trap?
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. Trap terminates this execution, so we can keep stack unchanged.
Are tests possible for this? |
No, because |
How about the test to check that args remain on stack in case of trap, if want this to be intended behaviour? |
Stack is not accessible from outside. |
Codecov Report
@@ Coverage Diff @@
## master #573 +/- ##
=======================================
Coverage 98.24% 98.24%
=======================================
Files 62 62
Lines 9062 9062
=======================================
Hits 8903 8903
Misses 159 159 |
This fixes logical error in
invoke_function()
implementation. The call arguments are now dropped from the stack after the call returns.Performance difference is not significant.