-
-
Notifications
You must be signed in to change notification settings - Fork 770
2.0: Remove SuccessWithValue #2430
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
Conversation
645d2a4
to
5c3de11
Compare
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.
Looks good modulo the IPC change, of course
impl From<ReturnCode> for isize { | ||
fn from(original: ReturnCode) -> isize { | ||
match original { | ||
ReturnCode::SuccessWithValue { value } => value as isize, |
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.
HURRAY!
5c3de11
to
2edf62d
Compare
Ok new plan...we leave But seriously, this change seems to increase the imix kernel size by 4512 bytes. Before:
after
|
Just adding the
|
I will look into this. I'll try to improve the print tool to see what's happening. |
2edf62d
to
a89173c
Compare
Rebased ontop of 2.0-dev now that I merged master in |
After the rebase, this PR adds just under 2kB of code, but Imix now fits. |
Some tidbits from my investigating the size changes:
pub enum ReturnCode {
SuccessWithValue { value },
SUCCESS Total Imix size: 184996 bytes pub enum ReturnCode {
SUCCESS, Total Imix size: 186980 #[repr(isize)]
pub enum ReturnCode {
SUCCESS, Total Imix size: 184485 #[repr(rust)]
pub enum ReturnCode {
SUCCESS,
// ...
#[repr(rust)] // previously was #[repr(usize)]
pub enum ErrorCode {
SUCCESS, Total Imix size: 185541 Hypothesis: Making ReturnCode 1 byte instead of 4 decreases stack memory use, however doing so also increases code size, because now kernel has to sign extend values when moving ReturnCodes in/out of a word-size register at the userspace boundary. Looking at the difference in stack frame sizes, most functions are unchanged. the biggest changes are:
|
Following some side discussion, @hudson-ayers's theory seems to hold water and his proposal to just force A note: I'm very skeptical that we get any actual memory savings from the ReturnCode being smaller than a word since likely the compiler is using a word for it on the stack anyway in most cases. |
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.
bors r+
bors r+ |
Already running a review |
This seems to be a case where you can trade off RAM for flash; given we are much more cramped for flash, a possible few extra bytes of RAM here or there are well worth it. |
2430: 2.0: Remove SuccessWithValue r=ppannuto a=bradjc ### Pull Request Overview This pull request removes `SuccessWithValue` for 2.0. Other than IPC, nothing was using SuccessWithValue anymore. ### Testing Strategy travis ### TODO or Help Wanted Need the IPC updates first. ### Documentation Updated - [x] Updated the relevant files in `/docs`, or no updates are required. ### Formatting - [x] Ran `make prepush`. 2443: 2.0: lps25hb r=alevy a=bradjc ### Pull Request Overview Update the last capsule to 2.0. ### Testing Strategy travis. ### TODO or Help Wanted n/a ### Documentation Updated - [x] Updated the relevant files in `/docs`, or no updates are required. ### Formatting - [x] Ran `make prepush`. Co-authored-by: Brad Campbell <[email protected]> Co-authored-by: Hudson Ayers <[email protected]>
2430: 2.0: Remove SuccessWithValue r=ppannuto a=bradjc ### Pull Request Overview This pull request removes `SuccessWithValue` for 2.0. Other than IPC, nothing was using SuccessWithValue anymore. ### Testing Strategy travis ### TODO or Help Wanted Need the IPC updates first. ### Documentation Updated - [x] Updated the relevant files in `/docs`, or no updates are required. ### Formatting - [x] Ran `make prepush`. 2443: 2.0: lps25hb r=alevy a=bradjc ### Pull Request Overview Update the last capsule to 2.0. ### Testing Strategy travis. ### TODO or Help Wanted n/a ### Documentation Updated - [x] Updated the relevant files in `/docs`, or no updates are required. ### Formatting - [x] Ran `make prepush`. Co-authored-by: Brad Campbell <[email protected]> Co-authored-by: Hudson Ayers <[email protected]>
Pull Request Overview
This pull request removes
SuccessWithValue
for 2.0. Other than IPC, nothing was using SuccessWithValue anymore.Testing Strategy
travis
TODO or Help Wanted
Need the IPC updates first.
Documentation Updated
/docs
, or no updates are required.Formatting
make prepush
.