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

Extend call depth tests #580

Merged
merged 1 commit into from
Oct 7, 2020
Merged

Extend call depth tests #580

merged 1 commit into from
Oct 7, 2020

Conversation

chfast
Copy link
Collaborator

@chfast chfast commented Oct 6, 2020

No description provided.

@chfast chfast requested review from gumb0 and axic October 6, 2020 08:29
@codecov
Copy link

codecov bot commented Oct 6, 2020

Codecov Report

Merging #580 into master will increase coverage by 0.00%.
The diff coverage is 100.00%.

@@           Coverage Diff           @@
##           master     #580   +/-   ##
=======================================
  Coverage   98.23%   98.23%           
=======================================
  Files          62       62           
  Lines        8990     9023   +33     
=======================================
+ Hits         8831     8864   +33     
  Misses        159      159           

TEST(execute_call, call_imported_infinite_recursion)
{
/* wat2wasm
(import "mod" "foo" (func (result i32)))
(func (result i32)
call 0
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why didn't you add it as a new test, but modified this one? This was testing call instruction and was in execute_call suite, now it goes another code path...

Copy link
Member

Choose a reason for hiding this comment

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

Actually I think this code can remain, the point of the change was to assert in the host function. Would just need to check for MaxDepth - 1 there.

Copy link
Member

Choose a reason for hiding this comment

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

Actually this was calling function 0 which is the import. Probably we should duplicate this to have both cases covered.

@@ -530,8 +530,8 @@ TEST(execute_call, call_max_depth)
const auto module = parse(bin);
auto instance = instantiate(module);

EXPECT_THAT(execute(*instance, 0, {}, 2048), Result(42));
EXPECT_THAT(execute(*instance, 1, {}, 2048), Traps());
EXPECT_THAT(execute(*instance, 0, {}, 512), Result(42));
Copy link
Collaborator

Choose a reason for hiding this comment

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

This could you MaxDepth constant from below, too.

@axic axic changed the title Lower call depth limit to 512 test: Extend call depth tests Oct 6, 2020
@axic axic changed the title test: Extend call depth tests Extend call depth tests Oct 6, 2020
Copy link
Collaborator Author

@chfast chfast left a comment

Choose a reason for hiding this comment

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

LGTM

@@ -518,6 +518,9 @@ TEST(execute_call, call_indirect_infinite_recursion)
EXPECT_TRUE(execute(module, 0, {}).trapped);
}

constexpr int MaxDepth = 2048;
static_assert(MaxDepth == CallStackLimit);
Copy link
Member

Choose a reason for hiding this comment

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

I think we can remove this now, given the tests should exactly capture it.

@axic axic requested a review from gumb0 October 6, 2020 17:40
@axic
Copy link
Member

axic commented Oct 6, 2020

@chfast I think you did not see the call_via_* tests.

Copy link
Collaborator Author

@chfast chfast left a comment

Choose a reason for hiding this comment

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

LGTM

@chfast chfast merged commit bfcd177 into master Oct 7, 2020
@chfast chfast deleted the call_depth branch October 7, 2020 07:22
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.

3 participants