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

EVM-C update #108

Merged
merged 9 commits into from
Jan 20, 2017
Merged

EVM-C update #108

merged 9 commits into from
Jan 20, 2017

Conversation

chfast
Copy link
Member

@chfast chfast commented Dec 14, 2016

Preview of proposed EVM-C changes. Currently, users have to carry 2 objects: EVM-C interface and instance. Interface describes ABI version and set of "virtual" functions to manage instances. This is inconvenient as users typically create single interface and single instance but need to have both to execute any code.

This PR propose a change to always create an EVM instance, "virtual" functions are included in the instance object. Still initialization must be perform in two steps (create and init), because we want (do we?) init step to be able to be changed in future ABI versions.

I have not updated any comments around the changes yet, sorry.

@chfast chfast force-pushed the evmc branch 3 times, most recently from b666038 to acf60f7 Compare December 20, 2016 16:16
@chfast chfast changed the title Preview of single object EVM-C EVM-C update Dec 22, 2016
@chfast
Copy link
Member Author

chfast commented Dec 22, 2016

This needs another review. Maybe @axic and @fjl could have take a look.

/// The function has to be named as `<vm-name>_get_interface(void)`.
/// Each EVM implementation is obligated to provided a function returning
/// an EVM instance.
/// The function has to be named as `<vm-name>_get_factory(void)`.
Copy link

Choose a reason for hiding this comment

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

Why does the function have to have a particular form of name?

Copy link
Member Author

Choose a reason for hiding this comment

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

This is more convention than strict requirement. I was also thinking about having a registry of VM implementation, where you could get one by name... But this is not worth the trouble.

@fjl
Copy link

fjl commented Jan 11, 2017

Sorry, I didn't manage to look at this yet.

@chfast
Copy link
Member Author

chfast commented Jan 11, 2017

No problem @fjl. Actually, can you check if the description in #110 matches geth?

The evm_result was planned to be used as the return struct of the call callback. The address was added to support CREATE, but it is never used and the union here confuses many languages like Go and Python.
Replace evm_interface with evm_factory. The factory provides ABI protection and the function for creating EVM instances. After the instance is create you can discard the factory as it is no longer needed.
We try to avoid C ABI complex rules like passing structs by value to increase portability.
In evm_query_fn, return result by explicit output parameter to avoid C ABI issues and inrease portability. C compiler would do the same implicitly.
@chfast chfast merged commit 86c37a0 into develop Jan 20, 2017
@chfast chfast deleted the evmc branch January 20, 2017 13:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants