-
Notifications
You must be signed in to change notification settings - Fork 38
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
Convert instructions to vector<uint8_t> #620
Conversation
Codecov Report
@@ Coverage Diff @@
## master #620 +/- ##
=======================================
Coverage 98.32% 98.32%
=======================================
Files 67 67
Lines 9426 9429 +3
=======================================
+ Hits 9268 9271 +3
Misses 158 158 |
@@ -362,7 +362,7 @@ struct Code | |||
|
|||
// The instructions bytecode without immediate values. | |||
// https://webassembly.github.io/spec/core/binary/instructions.html | |||
std::vector<Instr> instructions; |
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.
Shouldn't we have a static_assert(sizeof(Instr) == sizeof(uint8_t));
in this 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.
This is not required because we don't reinterpret_cast<Instr*>(bytes_ptr)
or the other way.
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.
Yeah though if it is not too much hassle having that extra assert could be helpful down the line, in case we mess it up somewhere.
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.
The enum class Instr : uint8_t
is defined in this 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.
Oh right, lets hope the uint8_t
is not removed :)
5152ac9
to
d13addb
Compare
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.
Though not sure why oppose the static_assert
.
This allows to move immediate values to the same array later. That will increase overall performance.