Skip to content
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

Stack depth counting (and preallocation) #210

Closed
wants to merge 5 commits into from
Closed

Stack depth counting (and preallocation) #210

wants to merge 5 commits into from

Conversation

axic
Copy link
Member

@axic axic commented Feb 26, 2020

No description provided.

Stack<uint64_t> stack;
stack.reserve(code.max_stack_depth);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To use full potential of this we need custom stack implementation.

@@ -408,8 +411,12 @@ parser_result<Code> parse_expr(const uint8_t* pos, const uint8_t* end, bool have
}
}
code.instructions.emplace_back(instr);
max_stack_depth += instr_stack_change(instr);
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we need to move this into/after a validation phase so that we have access to each of the sections (such as types) to know how many stack items are we popping/pushing (for example in call/call_indirect/etc).

@axic
Copy link
Member Author

axic commented Apr 23, 2020

Superseded by #244 and #247.

@axic axic closed this Apr 23, 2020
@axic axic deleted the stack-depth branch April 23, 2020 17:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants