-
Notifications
You must be signed in to change notification settings - Fork 0
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
Converted StableVec to use u64 virtual addresses rather than physical #13
base: master
Are you sure you want to change the base?
Conversation
sdk/stable-layout/src/stable_vec.rs
Outdated
self | ||
} | ||
self.deref() | ||
} // === is this right? |
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.
Whoops, left in a note by accident. Still, the question stands :). Deref and as_ref are .. fairly close in meaning I guess, and I think identical for our purposes here (?)
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 missed your comment before submitting my review, but did you hit errors just returning &self
or self
like before? I believe that should be sufficient given the struct implements the Deref
trait on L70 below.
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.
Ah, good question. Maybe that's unnecessary. Don't recall if I hit an error or just did it because it looked right to me. I'll have to check.
sdk/stable-layout/src/stable_vec.rs
Outdated
self | ||
} | ||
self.deref() | ||
} // === is this right? |
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.
nit: leftover comment
} // === is this right? | |
} |
sdk/stable-layout/src/stable_vec.rs
Outdated
use std::ops::{Deref, DerefMut}; | ||
use std::{marker::PhantomData, mem::ManuallyDrop}; |
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.
use std::ops::{Deref, DerefMut}; | |
use std::{marker::PhantomData, mem::ManuallyDrop}; | |
use std::{ | |
marker::PhantomData, | |
mem::ManuallyDrop, | |
ops::{Deref, DerefMut}, | |
}; |
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.
Other than these as
casts which look dangerous and are only testable with e-to-e tests inside both 64 and 32 bit environments, everything looks sound.
The logic is remaining the same, as well as the external API surface (apart from the move from as_ptr
to as_vaddr
. So I don't have any code related issues with this.
Problem
To address a 32-bit build issue, where cross-platform invocation fails due to bad virtual addressing, I have updated the StableVec class to use u64 for values, rather than a NonNull pointer class. There could be some issues if StableVecs are used indiscriminately to convert Vectors back and forth between virtual addressing and physical addressing (on a 32-bit build), but that's an issue of how it's used, not what it does.
Summary of Changes
Fixes #