-
Notifications
You must be signed in to change notification settings - Fork 294
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
New metrics table #168
New metrics table #168
Conversation
Codecov Report
@@ Coverage Diff @@
## master #168 +/- ##
=========================================
Coverage ? 88.66%
=========================================
Files ? 22
Lines ? 2249
Branches ? 217
=========================================
Hits ? 1994
Misses ? 228
Partials ? 27 |
How are they modified? |
lib/evmone/analysis.cpp
Outdated
const auto metrics = instr_table[opcode]; | ||
const auto instr_stack_req = metrics.num_stack_arguments; | ||
const auto instr_stack_change = metrics.num_stack_returned_items - instr_stack_req; | ||
const auto opcode_info = op_tbl[opcode]; |
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 not reference?
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 adds modified instruction metrics to op_table
How are they modified?
It contains "stack height change" instead of "number of returned items".
This allows using the value directly in https://github.com/ethereum/evmone/pull/168/files#diff-79f19d4cf3a33e26add73cd9c0ad79cbR50 instead of computing it.
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 not reference?
I'd prefer the values are loaded in single go, but when checking assembly - it does not matter: values are loaded individually anyway.
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.
Actually, using reference is ~27% faster in one case.
Comparing bin/evmone-bench to bin/evmone-bench-ref
Benchmark Time CPU Time Old Time New CPU Old CPU New
-------------------------------------------------------------------------------------------------------------------------------
blake2b_huff/analysis -0.0002 -0.0002 40 40 40 40
blake2b_shifts/analysis -0.2770 -0.2770 26 19 26 19
sha1_divs/analysis -0.0052 -0.0052 4 4 4 4
sha1_shifts/analysis -0.0104 -0.0104 4 4 4 4
weierstrudel/analysis -0.0290 -0.0290 48 46 48 46
micro/loop_with_many_jumpdests/analysis -0.0359 -0.0360 149 143 149 143
c8af365
to
ab3ed68
Compare
ab3ed68
to
f3f0f0d
Compare
f3f0f0d
to
9e8957b
Compare
9e8957b
to
70ec348
Compare
Would it make sense to create a unit test that checks op_table against metrics of EVMC ? |
table[OP_MSIZE] = op_msize; | ||
table[OP_GAS] = op_gas; | ||
table[OPX_BEGINBLOCK] = opx_beginblock; // Replaces JUMPDEST. | ||
t = {op_undefined, 0, 0, 0}; |
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 could be done in op_table_entry
constructor
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 op_undefined
is not available there. And I will need to declare 2 constructors.
Added. |
993c0ed
to
867a4ec
Compare
Closes #161
This adds modified instruction metrics to op_table (previously containing only function pointers to instruction implementations). This should improve cache locality, but no performance improvement noticed.