You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Usage of the SPEC generic is unnecessary in gas calculation code as the SpecId is already known at compile-time in the instructions and these functions are marked with #[inline], so they would get optimized the same way.
By turning the SPEC generic into a SpecId parameter:
most gas calculation functions can be made const, allowing usage in compile-time gas tables and outside of SPEC-generic code
helps a bit with compile times by reducing monomorphization bloat
This likely applies to more places in revm-interpreter, but I haven't looked too deeply into it, and I'm confident that gas calculation is a good starting place.
Examples:
Gas::set_final_refund (cannot be made const due to &mut, rest still applies):
one note here is that I think we want a more flexible solution for the SpecId enum that would allow us to get rid of the duplicated op and ethereum SpecId enum.
because we want to abstract away all the OP cfgs
one note here is that I think we want a more flexible solution for the SpecId enum that would allow us to get rid of the duplicated op and ethereum SpecId enum. because we want to abstract away all the OP cfgs
@mattsse this is a different Issue, seems not related to this one. #918
Usage of the SPEC generic is unnecessary in gas calculation code as the SpecId is already known at compile-time in the instructions and these functions are marked with #[inline], so they would get optimized the same way.
By turning the SPEC generic into a SpecId parameter:
most gas calculation functions can be made const, allowing usage in compile-time gas tables and outside of SPEC-generic code
helps a bit with compile times by reducing monomorphization bloat
This likely applies to more places in revm-interpreter, but I haven't looked too deeply into it, and I'm confident that gas calculation is a good starting place.
In general supportive, it looks like a refactor without a lot of gains, but it can potentially be useful to const fn outside of Revm.
But would use spec_Id.is_enabled_in(BERLIN) as SpecId::enabled(BERLIN, X) can be a footgun with Spec order.
Usage of the
SPEC
generic is unnecessary in gas calculation code as theSpecId
is already known at compile-time in the instructions and these functions are marked with#[inline]
, so they would get optimized the same way.By turning the
SPEC
generic into aSpecId
parameter:const
, allowing usage in compile-time gas tables and outside ofSPEC
-generic codeSPEC::enabled(X)
becomesSpecId::enabled(spec, X)
.This likely applies to more places in
revm-interpreter
, but I haven't looked too deeply into it, and I'm confident that gas calculation is a good starting place.Examples:
Gas::set_final_refund
(cannot be made const due to&mut
, rest still applies):revm/crates/interpreter/src/gas.rs
Lines 89 to 92 in fda371f
gas::call_gas
:revm/crates/interpreter/src/gas/calc.rs
Lines 274 to 287 in c203f3d
The text was updated successfully, but these errors were encountered: