Skip to content

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.

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
@rakita rakita force-pushed the instruction_table branch from dec5e97 to f988330 Compare October 10, 2023 12:57
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.

2 participants