-
Notifications
You must be signed in to change notification settings - Fork 293
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
Pass gas to instructions by value #600
Conversation
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## master #600 +/- ##
==========================================
- Coverage 97.21% 97.21% -0.01%
==========================================
Files 74 74
Lines 7575 7571 -4
==========================================
- Hits 7364 7360 -4
Misses 211 211
Flags with carried forward coverage won't be shown. Click here to find out more.
|
BenchmarksHaswell, GCC12-4.0%
Haswell, Clang16-3.3%
Skylake, Clang17-2.4%
Apple M1, Clang16-3.4%
|
abec11f
to
477dd5b
Compare
@@ -7,7 +7,7 @@ | |||
namespace evmone::instr::core | |||
{ | |||
template <Opcode Op> | |||
evmc_status_code call_impl(StackTop stack, ExecutionState& state) noexcept | |||
Result call_impl(StackTop stack, int64_t gas_left, ExecutionState& state) noexcept |
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.
Nit: it's called gas
in invoke
wrappers, should it be also gas
here?
Result call_impl(StackTop stack, int64_t gas_left, ExecutionState& state) noexcept | |
Result call_impl(StackTop stack, int64_t gas, ExecutionState& state) noexcept |
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.
I'm switching from gas_left
to gas
because seems good enough.
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.
I will leave gas_left
in instructions this time because it comes from state.gas_left
. This slightly limits the number of change.s
- Pass to and return gas counter to instructions implementations by value, don't use ExecutionState::gas_left. This improves performance. - Introduce Result type {status, gas}. - Change StopToken to TermResult (strong alias of Result).
ExecutionState::gas_left
. This improves performance.Result
type{status, gas}
.StopToken
toTermResult
(strong alias ofResult
).gas_left
fromExecutionState
.