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

feat: Add boxed precompile trait #1131

Merged
merged 3 commits into from
Mar 2, 2024
Merged

feat: Add boxed precompile trait #1131

merged 3 commits into from
Mar 2, 2024

Conversation

rakita
Copy link
Member

@rakita rakita commented Feb 27, 2024

closes: #798

Box is over the trait that has a call function. Trait is sync/send so it can be stored inside OnceBox.
And DynClone is added so precompiles can be cloned.

Copy link
Contributor

github-actions bot commented Feb 27, 2024

Valgrind Results:

==4271== Cachegrind, a cache and branch-prediction profiler
==4271== Copyright (C) 2002-2017, and GNU GPL'd, by Nicholas Nethercote et al.
==4271== Using Valgrind-3.18.1 and LibVEX; rerun with -h for copyright info
==4271== Command: target/release/snailtracer
==4271== 
--4271-- warning: L3 cache found, using its data for the LL simulation.
Snailtracer Host+Interpreter benchmark (2.0s) ...            not enough samples
==4271== 
==4271== I   refs:      463,577,809
==4271== I1  misses:          3,414
==4271== LLi misses:          2,967
==4271== I1  miss rate:        0.00%
==4271== LLi miss rate:        0.00%
==4271== 
==4271== D   refs:      237,187,097  (160,464,398 rd   + 76,722,699 wr)
==4271== D1  misses:        349,641  (    209,336 rd   +    140,305 wr)
==4271== LLd misses:        137,601  (      4,058 rd   +    133,543 wr)
==4271== D1  miss rate:         0.1% (        0.1%     +        0.2%  )
==4271== LLd miss rate:         0.1% (        0.0%     +        0.2%  )
==4271== 
==4271== LL refs:           353,055  (    212,750 rd   +    140,305 wr)
==4271== LL misses:         140,568  (      7,025 rd   +    133,543 wr)
==4271== LL miss rate:          0.0% (        0.0%     +        0.2%  )

@rakita
Copy link
Member Author

rakita commented Feb 27, 2024

@mattsse can you take a look? Is this going to work

crates/primitives/src/precompile.rs Outdated Show resolved Hide resolved
crates/primitives/src/precompile.rs Outdated Show resolved Hide resolved
crates/primitives/src/precompile.rs Outdated Show resolved Hide resolved
@rakita rakita requested a review from mattsse March 1, 2024 03:08
Copy link
Collaborator

@mattsse mattsse left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@gakonst
Copy link
Collaborator

gakonst commented Mar 1, 2024

v exciting. could we get an example of what a stateful precompile could look like?

@rakita rakita merged commit 077b267 into main Mar 2, 2024
25 checks passed
@github-actions github-actions bot mentioned this pull request Mar 2, 2024
@DaniPopes DaniPopes deleted the boxed_precompile branch March 13, 2024 23:38
fubuloubu pushed a commit to ApeWorX/revm that referenced this pull request Apr 11, 2024
* feat: Add boxed precompile trait

* add box

* Add mut Box and ref Arc precompiles, rename
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.

Allow precompiles to capture state
3 participants