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

Instruction table #759

Merged
merged 4 commits into from
Oct 12, 2023
Merged

Instruction table #759

merged 4 commits into from
Oct 12, 2023

Conversation

rakita
Copy link
Member

@rakita rakita commented Sep 28, 2023

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 has Option over instruction which is a lot nicer.

Removed step and step_end from Host trait as closure over instruction allows us the same behaviour.

@@ -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] {
Copy link
Collaborator

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

Copy link
Member Author

@rakita rakita Oct 3, 2023

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.

@rakita rakita force-pushed the instruction_table branch 6 times, most recently from ed2d9cc to dec5e97 Compare October 10, 2023 12:47
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.

None yet

2 participants