-
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
Move instantiation to separate file #518
Conversation
b05a2aa
to
03d4343
Compare
Codecov Report
@@ Coverage Diff @@
## master #518 +/- ##
=======================================
Coverage 98.73% 98.73%
=======================================
Files 54 56 +2
Lines 8695 8695
=======================================
Hits 8585 8585
Misses 110 110 |
Weird, that I can't reproduce clang-tidy warning locally, using clang 10.0.1... |
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.
Are there any changes in the moved code?
lib/fizzy/instantiate.cpp
Outdated
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
#include "instantiate.hpp" | ||
#include "execute.hpp" |
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.
Why? Looks like cyclic dependency.
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.
There are calls to execute
when initializing table elements etc.
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.
Ugh. Can you leave a comment perhaps?
No. I only tried to remove unnecessary |
The only change is suppressing clang-tidye in the last commit. |
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.
Looks good.
lib/fizzy/execute.cpp
Outdated
@@ -685,142 +469,6 @@ std::optional<uint32_t> find_export(const Module& module, ExternalKind kind, std | |||
|
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.
Where is the find_export
helper above used? I always thought it is used by instantiation, but it is used in the execution loop?!
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.
No, it's used only in find_exported_*
API, which stays in execute.cpp
for now
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.
Those operate on the instance, shouldn't they belong into instantiate.cpp
?
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.
Logically they are neither instantiation nor execution, I would put them into separate header, maybe export.hpp
, or api.hpp
because we have api_test.cpp
for them. What do you think?
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.
It is hard for me to discriminate what they are for (not my area of knowledge) so "kinda whatever". Can be also "module.hpp/cpp" if that make sense (I know this is non-functional name, but this can be found in other projects).
But I really want to have only execute() function in execute.cpp what makes execution optimizations easier to conduct. In the end we can think about it as: extracting execute() from the instatiate.cpp file...
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.
That was getting a bit too complicated for one PR, will keep them in instantiate.
This actually makes execution significant faster (GCC10, no-LTO):
|
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.
There are some function after execute()
that also should be moved to instantiate.cpp
But no much change for LTO builds:
|
cd55a7d
to
eb6b556
Compare
No clang-tidy warning again. |
Now some benchmarks gets slower. LTO
non-LTO
|
My results are mostly within 1-2% change GCC10, LTO
GCC10, non-LTO
|
For me this is still good to merge this. |
47321bd
to
06b5b47
Compare
@gumb0 sorry for being late to the party, but the first commit renames execute to instantiate, which in practice means we value the history of instantiate code lines more, than the execute lines. I would argue the history of So I suggest we do the inverse, and keep the |
@axic That rename is only in the branch, the final merge commit resolves it in a way that history is kept for both instantiate.* and execute.*, check it locally. |
06b5b47
to
0ffccc2
Compare
The following steps allow us to keep the history of both execute.* and instantiate.*: 1. In branch1 rename execute.* -> instantiate.* (git's history will consider instantiate to be the continuation of execute) 2. In branch1 remove execution code from instantiate.* 3. In branch2 rename instantiation code from execute.* 4. Merge branch1 into branch2.
0ffccc2
to
48fd8f8
Compare
This tries to keep git blame results clear, therefore needs a merge commit for that.
Suppressing clang-tidy false positive warning was added first in aba1d78, then was removed in #314, now it looks to be needed again.