-
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
Asserts for checking expected number of inputs/outputs #547
Conversation
lib/fizzy/execute.cpp
Outdated
|
||
return stack.size() != 0 ? ExecutionResult{stack.pop()} : Void; | ||
return !func_type.outputs.empty() ? ExecutionResult{stack.pop()} : Void; |
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.
Use func_type
, the stack.size()
is only used in asserts.
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 didn't get, why is it better?
It looks you could do assertions like
assert(args.size() == instance.module.get_function_type(func_idx).inputs.size());
assert(stack.size() == instance.module.get_function_type(func_idx).inputs.outputs.size());
and then avoid another variable declaration in outer scope and get_function_type()
call.
I kind of liked the fact that execute
doesn't need to access called function type, because all type stuff is handled at validation...
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.
You are right here.
It looks we don't need information about number of outputs. But we will probably need the information about number of arguments. In the end to bootstrap execution we need:
- number of arguments,
- number of locals,
- max stack height.
Codecov Report
@@ Coverage Diff @@
## master #547 +/- ##
=======================================
Coverage 98.64% 98.64%
=======================================
Files 59 59
Lines 8932 8948 +16
=======================================
+ Hits 8811 8827 +16
Misses 121 121 |
91b2b3e
to
5116a0c
Compare
5116a0c
to
be1589c
Compare
be1589c
to
c440459
Compare
18a67f3
to
7208c06
Compare
7208c06
to
12d71d3
Compare
No description provided.