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

Convert instructions to vector<uint8_t> #620

Merged
merged 1 commit into from
Oct 22, 2020
Merged

Convert instructions to vector<uint8_t> #620

merged 1 commit into from
Oct 22, 2020

Conversation

chfast
Copy link
Collaborator

@chfast chfast commented Oct 22, 2020

This allows to move immediate values to the same array later. That will increase overall performance.

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

codecov bot commented Oct 22, 2020

Codecov Report

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

@@           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;
Copy link
Member

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?

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 is not required because we don't reinterpret_cast<Instr*>(bytes_ptr) or the other way.

Copy link
Member

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.

Copy link
Collaborator Author

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.

Copy link
Member

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 :)

@chfast chfast force-pushed the test_instructions_check branch from 5152ac9 to d13addb Compare October 22, 2020 10:46
Base automatically changed from test_instructions_check to master October 22, 2020 13:56
test/utils/asserts.hpp Outdated Show resolved Hide resolved
Copy link
Member

@axic axic left a 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.

@chfast chfast merged commit 0dbf5ed into master Oct 22, 2020
@chfast chfast deleted the code_as_bytes branch October 22, 2020 21:03
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