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

Decouple interpreter values from interpreter #3698

Draft
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

turbolent
Copy link
Member

Work towards #3693

Description

Demonstrate how we could decouple methods of interpreter.Value types from Interpreter.

In particular, define interfaces for the functionality that is required by implementations of the Value.StaticType method and change the parameter type from Interpreter to the new combined interface (for now called StaticTypeGetter, for lack of a better name – suggestions are very welcome).

Most implementations of Value.StaticType only need to perform memory metering, so need a common.MemoryGauge. However, StorageReferenceValue.StaticType dereferences, which requires access to storage and a means to convert a static type to a sema type.

If this approach looks good, we can gradually refactor other methods of Value in a similar way.
Suggestions for improvements or alternatives are very welcome!


  • Targeted PR against master branch
  • Linked to Github issue with discussion and accepted design OR link to spec that describes this work
  • Code follows the standards mentioned here
  • Updated relevant documentation
  • Re-reviewed Files changed in the Github PR explorer
  • Added appropriate labels

@turbolent turbolent requested a review from jsproz November 26, 2024 22:14
@turbolent turbolent self-assigned this Nov 26, 2024
Copy link

Cadence Benchstat comparison

This branch with compared with the base branch onflow:master commit d555d17
The command for i in {1..N}; do go test ./... -run=XXX -bench=. -benchmem -shuffle=on; done was used.
Bench tests were run a total of 7 times on each branch.

Collapsed results for better readability

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.

1 participant