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

Research on moving to a compiler and a vm #2266

Closed
SupunS opened this issue Jan 23, 2023 · 3 comments
Closed

Research on moving to a compiler and a vm #2266

SupunS opened this issue Jan 23, 2023 · 3 comments
Assignees
Labels

Comments

@SupunS
Copy link
Member

SupunS commented Jan 23, 2023

Issue to be solved

Explore the possibility of replacing the existing interpreter-based run-time with a compiler and a VM.

There are several key questions that need to be answered about the implementation approach.
e.g:

  • A custom VM or Using an existing bytecode/vm
    • Performance?
    • Interoperability? (e.g: The host environment, ie.: fvm, the storage interactions like atree are implemented in Go. How easy/hard would it be to interact with these from the existing VM?)
    • How to extend existing VMs to support Cadence specifics. e.g: runtime type checking, defensive checks, etc.
  • If a custom vm: stack-based Vs register-based.
    • Performance?
    • How easy to validate?
@SupunS SupunS self-assigned this Jan 23, 2023
@dreamsmasher
Copy link
Contributor

during execution, how often do we call into the FVM? I think that's probably the biggest factor in determining our approach - i.e. minimizing FFI overhead. If FVM calls are rare compared to interpreter overhead, then we could even look into an IPC implementation that completely separates the two runtimes

@SupunS
Copy link
Member Author

SupunS commented Jan 25, 2023

That's a good thought indeed!

We did explore this path sometime back and came to the realization that the Cadence <-> FVM interactions are quite high and heavy. For example, the program cache is maintained at FVM (because it needs to be fork-aware), and Cadence constantly accesses this cache at runtime. Serializing a program (elaboration in particular) or a part of it through an IPC is a big overhead.

More details on: https://github.com/dapperlabs/cadence-private-issues/issues/21

@j1010001
Copy link
Member

j1010001 commented Nov 1, 2024

Related to #3612

@j1010001 j1010001 closed this as completed Nov 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants