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

Converted StableVec to use u64 virtual addresses rather than physical #13

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

jason-nitro
Copy link

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 #

self
}
self.deref()
} // === is this right?
Copy link
Author

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 (?)

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.

Copy link
Author

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.

self
}
self.deref()
} // === is this right?

Choose a reason for hiding this comment

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

nit: leftover comment

Suggested change
} // === is this right?
}

Comment on lines 3 to 4
use std::ops::{Deref, DerefMut};
use std::{marker::PhantomData, mem::ManuallyDrop};

Choose a reason for hiding this comment

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

Suggested change
use std::ops::{Deref, DerefMut};
use std::{marker::PhantomData, mem::ManuallyDrop};
use std::{
marker::PhantomData,
mem::ManuallyDrop,
ops::{Deref, DerefMut},
};

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.

@jason-nitro jason-nitro changed the base branch from master to feat/sp1 November 11, 2024 22:03
@jason-nitro jason-nitro changed the base branch from feat/sp1 to master November 11, 2024 22:04
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.

4 participants