-
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
refactor: use Stack class for control stack in parser #341
Conversation
@@ -28,6 +28,12 @@ class Stack : public std::vector<T> | |||
|
|||
void push(T val) { emplace_back(val); } | |||
|
|||
template <typename... Args> | |||
void emplace(Args&&... 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.
Should add a test case for this.
@@ -120,7 +121,7 @@ parser_result<Code> parse_expr(const uint8_t* pos, const uint8_t* end, const Mod | |||
// The stack of control frames allowing to distinguish between block/if/else and label | |||
// instructions as defined in Wasm Validation Algorithm. | |||
// For a block/if/else instruction the value is the block/if/else's immediate offset. | |||
std::stack<ControlFrame> control_stack; | |||
Stack<ControlFrame> control_stack; |
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 this makes any measurable difference in speed?
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.
This uses std::vector
instead of std::deque
now, but it seems make no difference (see below).
2ef08a5
to
ebd35f4
Compare
Benchmarked this on rather noisy could instance.
|
ebd35f4
to
c8bc582
Compare
Required for #312