-
Notifications
You must be signed in to change notification settings - Fork 642
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
Instruction table #759
Instruction table #759
Conversation
@@ -829,6 +847,16 @@ const fn make_gas_table(spec: SpecId) -> [OpInfo; 256] { | |||
table | |||
} | |||
|
|||
pub fn make_instruction_table<H: Host, SPEC: Spec>() -> [Instruction<H>; 256] { |
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 think this and instruction
can be made const
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.
Tried it and the problem it with Host
it errors with something like "cant use parent generic" or something in that tone.
ed2d9cc
to
dec5e97
Compare
dec5e97
to
f988330
Compare
Put all instructions in the table and allow the table to be initialized. This is the first step towards introduction of custom opcodes.
Additionally, specify a Boxed instruction that is a little bit less performant (10-20%) but allows the use of closure over instructions.
An example of boxed instruction is used for
Inspector
, this is a step forward in having custom handles for some or all instructions.The plain instruction table had the same performance as the previous eval fn that used
match
(0.01% invariance with cachegrind)Removed generic of
INSTRUCTION
as benefits are neglectable, and code clarity is increased. Now EVMImpl hasOption
over instruction which is a lot nicer.Removed
step
andstep_end
fromHost
trait as closure over instruction allows us the same behaviour.