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

Validate stack height at branch instructions #386

Merged
merged 3 commits into from
Jun 17, 2020
Merged

Conversation

gumb0
Copy link
Collaborator

@gumb0 gumb0 commented Jun 15, 2020

No description provided.

@codecov
Copy link

codecov bot commented Jun 15, 2020

Codecov Report

Merging #386 into master will increase coverage by 0.01%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##           master     #386      +/-   ##
==========================================
+ Coverage   99.32%   99.33%   +0.01%     
==========================================
  Files          42       42              
  Lines       12489    12688     +199     
==========================================
+ Hits        12405    12604     +199     
  Misses         84       84              

@gumb0 gumb0 force-pushed the validate-br-stack branch 4 times, most recently from b5d528e to a5b0de0 Compare June 15, 2020 14:21
@gumb0 gumb0 marked this pull request as ready for review June 15, 2020 14:21
inline void validate_branch_stack_height(
const ControlFrame& current_frame, const ControlFrame& branch_frame)
{
// assert(current_frame.stack_height >= current_frame.parent_stack_height);
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This can be enabled after #384 is merged

@gumb0 gumb0 requested review from chfast and axic June 15, 2020 14:37
@gumb0 gumb0 changed the title Validate stack height at branch instuctions Validate stack height at branch instructions Jun 15, 2020
{
// assert(current_frame.stack_height >= current_frame.parent_stack_height);

if (!current_frame.unreachable && get_branch_arity(branch_frame) == 1 &&
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think this can be expressed without assuming branch_airty ∈{0,1}. E.g. like

current_frame.stack_height - get_branch_arity(branch_frame) < current_frame.parent_stack_height

Just make sure this uses signed integer types.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Nice suggestion, I changed it to be similar to checks in validate_result_count

@gumb0 gumb0 merged commit 1b70939 into master Jun 17, 2020
@gumb0 gumb0 deleted the validate-br-stack branch June 17, 2020 10:51
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