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

[move-cm][closures] Refactor: Move type conversions out of Loader into a trait #15669

Open
wants to merge 1 commit into
base: wrwg/clos_ability_move
Choose a base branch
from

Conversation

wrwg
Copy link
Contributor

@wrwg wrwg commented Jan 4, 2025

Description

[PR 3/n vm closures]

Type conversions from runtime types to MoveTypeLayout and TypeTag currently are associated with the Loader type. However, they are needed for the FunctionValueExtension trait which needs to be constructed in contexts where no loader but only ModuleStorage exists.

This PR moves the conversion functions into a new trait TypeConverter. The trait is then implemented two times, once based on ModuleStorage only and once based on the existing Loader, for downwards compatibility.

How Has This Been Tested?

Refactoring only, existing tests

Type of Change

  • New feature
  • Bug fix
  • Breaking change
  • Performance improvement
  • Refactoring
  • Dependency update
  • Documentation update
  • Tests

Which Components or Systems Does This Change Impact?

  • Validator Node
  • Full Node (API, Indexer, etc.)
  • Move/Aptos Virtual Machine
  • Aptos Framework
  • Aptos CLI/SDK
  • Developer Infrastructure
  • Move Compiler
  • Other (specify)

Copy link

trunk-io bot commented Jan 4, 2025

⏱️ 50m total CI duration on this PR
Job Cumulative Duration Recent Runs
rust-move-tests 13m 🟩
rust-cargo-deny 8m 🟩🟩🟩🟩
rust-move-tests 8m 🟥
rust-move-tests 7m 🟥
check-dynamic-deps 6m 🟩🟩🟩🟩🟩
general-lints 2m 🟩🟩🟩🟩🟩
rust-move-tests 2m 🟥
semgrep/ci 2m 🟩🟩🟩🟩🟩
file_change_determinator 56s 🟩🟩🟩🟩🟩
rust-move-tests 31s
permission-check 15s 🟩🟩🟩🟩🟩
permission-check 12s 🟩🟩🟩🟩🟩
check-branch-prefix 1s 🟩

settingsfeedbackdocs ⋅ learn more about trunk.io

Copy link
Contributor Author

wrwg commented Jan 4, 2025

@wrwg wrwg force-pushed the wrwg/clos_ability_move branch from 34517a1 to 7862e77 Compare January 5, 2025 05:50
@wrwg wrwg force-pushed the wrwg/clos_type_conv branch from 4972a5c to 2fed681 Compare January 5, 2025 05:50
@wrwg wrwg force-pushed the wrwg/clos_ability_move branch from 7862e77 to ee49138 Compare January 5, 2025 23:50
@wrwg wrwg force-pushed the wrwg/clos_type_conv branch from 2fed681 to 9c0814c Compare January 6, 2025 02:47
@wrwg wrwg force-pushed the wrwg/clos_ability_move branch from ee49138 to 9fbe74f Compare January 6, 2025 02:47
@wrwg wrwg force-pushed the wrwg/clos_type_conv branch from 9c0814c to 8b11451 Compare January 6, 2025 02:47
…nto a trait

Type conversions from runtime types to `MoveTypeLayout` and `TypeTag` currently are associated with the `Loader` type. However, they are needed for the `FunctionValueExtension` trait which needs to be constructed in contexts where no loader but only `ModuleStorage` exists.

This PR moves the conversion functions into a new trait `TypeConverter`. The trait is then implemented two times based on `ModuleStorage` only and based on the existing `Loader`, for downwards compatibility.
@wrwg wrwg force-pushed the wrwg/clos_type_conv branch from 8b11451 to dcb6bc5 Compare January 6, 2025 03:25
@wrwg wrwg mentioned this pull request Jan 7, 2025
16 tasks
@wrwg wrwg marked this pull request as ready for review January 8, 2025 06:17
}

/// Converts a runtime type to a type tag.
fn type_to_type_tag(&self, ty: &Type) -> PartialVMResult<TypeTag> {
Copy link
Contributor

Choose a reason for hiding this comment

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

FYI, I have a PR to move type tag conversion outside of loader as well...: #15676. We should probably sync changes for this one.

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