-
Notifications
You must be signed in to change notification settings - Fork 11.3k
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
[3/n][vm-rewrite][Move] Update native context extensions to support Cloning #21067
base: tzakian/vm-rewrite-adapter-2
Are you sure you want to change the base?
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
2 Skipped Deployments
|
c07295c
to
1c7a767
Compare
a1a87a0
to
bba3dc9
Compare
…loning, and let extension determine how to handle interior mutability. This updates the `NativeContextExtensions` struct to be `Clone`able. This updates the `Box<dyn Tid<'a>>` to a `Rc<dyn Tid<'a>>` and the extension is responsible for handling interior mutability. As a helper struct the `NativeContextMut` was added to allow for easy writing/handling of native extensions that need interior mutability. NB: The code in the PR may not be working as future PRs will build on top of this. In particular, for this PR, the changes to the object runtime/sui-adapter/sui-execution natives will be needed.
bba3dc9
to
e390092
Compare
/// | ||
/// Note that this is _not_ threadsafe. If you need threadsafe access to the `T` you will need to | ||
/// handle that within `T'`s type (just like in the previous implementation of the | ||
/// `NativeContextExtensions`). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am a little confused. It appears we are making it so that all mutability needs to be explicit when building up the native context extension, whereas before everything was arbitrarily mutable. What is the motivation for this change?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, modulo understanding the motivation for this change.
This updates the
NativeContextExtensions
struct to beClone
able. This updates theBox<dyn Tid<'a>>
to aRc<dyn Tid<'a>>
and the extension is responsible for handling interior mutability.As a helper struct the
NativeContextMut
was added to allow for easy writing/handling of native extensions that need interior mutability.NB: The code in the PR may not be working as future PRs will build on top of this. In particular, for this PR, the changes to the object runtime/sui-adapter/sui-execution natives will be needed.