-
Notifications
You must be signed in to change notification settings - Fork 11.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[2/n][vm-rewrite][Move] Update runtime value representation to suppor…
…t global references. This updates the VM value representation to support global values, and "fingerprinting" of the global values so that they can be properly dirtied at the end of execution. **IMPORTANT**: Additional work is needed to make the fingerprinting of global values actually something we'd want to use in prod, but the underlying logic of what a fingerprint is, and how it is computed has been abstracted away into a newtype so we can update this fairly easily hopefully. **Semantic changes**: This changes the semantics of execution around global values. Previously a global value would always be counted as mutated if the reference was written, even with the same value. In the implementation here this is no longer the case -- if the value is the same at time of read and the conclusion of execution, the value will not be viewed as mutated. As an example of a program that would exhibit this change in behavior: ```move module 0x42::a; public struct X has key, store { id: UID, x: u64, } public fun update1(x: &mut UID) { let s: &mut X = dynamic_field::borrow_mut(x, 0); assert!(s.x == 10); s.x = 11; s.x = 12; s.x = 10; } public fun update2(x: &mut UID) { let s: &mut X = dynamic_field::borrow_mut(x, 0); assert!(s.x == 10); s.x = 10; } ``` In the previous semantics, the borrowed dynamic field would show as a mutated output of the transaction, in the new semantics it will not show up as mutated as extensionally the value was unchanged. NB: The code in the PR may not be working as future PRs will build on top of this.
- Loading branch information
Showing
1 changed file
with
78 additions
and
83 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters