Skip to content

Conversation

@alistair23
Copy link
Contributor

Pull Request Overview

By enabling virtual-function-elimination we can reduce the size of the
final binaries. Here is a before and after for OpenTitan:

Before:
Binary: 139K
.text: 22818
After
Binary: 136K
.text: 21d0c

As virtual-function-elimination is still experimental let's not enable
it by default, but leave it as an option. This allows people to test it
and help contribute improvements and bug reports back to the Rust
compiler.

Testing Strategy

CI

TODO or Help Wanted

N/A

Documentation Updated

  • Updated the relevant files in /docs, or no updates are required.

Formatting

  • Ran make prepush.

@alistair23 alistair23 force-pushed the alistair/size-reduction branch from 0de7066 to 6bcb084 Compare July 4, 2022 04:00
@github-actions github-actions bot added chips/sam4l Change pertains to the SAM4L MCU. WG-OpenTitan In the purview of the OpenTitan working group. labels Jul 4, 2022
@hudson-ayers hudson-ayers changed the title Expose virtual-function-elimination Update Rust nightly version + Expose virtual-function-elimination Jul 4, 2022
By enabling virtual-function-elimination we can reduce the size of the
final binaries. Here is a before and after for OpenTitan:

Before:
    Binary: 139K
    .text: 22818
After
    Binary: 136K
    .text: 21d0c

As virtual-function-elimination is still experimental let's not enable
it by default, but leave it as an option. This allows people to test it
and help contribute improvements and bug reports back to the Rust
compiler.

Signed-off-by: Alistair Francis <[email protected]>
@alistair23 alistair23 force-pushed the alistair/size-reduction branch from 6bcb084 to cf60608 Compare July 4, 2022 23:24
@hudson-ayers
Copy link
Contributor

bradjc
bradjc previously approved these changes Jul 5, 2022
@github-actions github-actions bot added the tock-libraries This affects libraries supported by the Tock project label Jul 6, 2022
@alistair23
Copy link
Contributor Author

Fixed the build failures

// available.
/// Statically validate the size and offsets of the fields defined
/// within the register struct through the [`register_structs!`]
/// within the register struct through the `register_structs!()`
Copy link
Contributor

Choose a reason for hiding this comment

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

I took a stab at keeping the rustdoc link and failed to get it to build, so I am fine with removing it

@bradjc bradjc added the last-call Final review period for a pull request. label Jul 7, 2022
@hudson-ayers
Copy link
Contributor

bors r+

@bors
Copy link
Contributor

bors bot commented Jul 14, 2022

@bors bors bot merged commit 72d6445 into tock:master Jul 14, 2022
@alistair23 alistair23 deleted the alistair/size-reduction branch July 17, 2022 22:15
ppannuto added a commit that referenced this pull request Aug 19, 2022
`tock-registers` now supports stable Rust!

There is a small breaking change, documented below, required to support
Rust 2021 edition. Most of the remaining changes are improvements to the
internal self-testing infrastructure and documentation. There are also
some additions to `FieldValue` to improve ergonomics.

**Breaking Changes**

 - #2842: tock-registers: rename TryFromValue::try_from to try_from_value
 - #2833: Update to Rust 2021 edition

Other Changes

 - #3126: [trivial] tock-registers: mark two methods as `const`
 - #3088: tock_registers/test_fields: respect struct size padding w/ alignment
 - #3072: Update Rust nightly version + Expose virtual-function-elimination
     - libraries/tock-register-interface: Fixup register_structs documentation
 - #2988: Remove const_fn_trait_bound feature and update nightly (Mar 2022)
 - #3014: tock-registers: Implement From field enum value type for FieldValue
 - #3013: tock-register-interface: Provide none method for FieldValue type
 - #2916: tock-register-interface: improve read_as_enum documentation
 - #2922: tock-register-interface: replace register tests by const assertions
ppannuto added a commit that referenced this pull request Aug 19, 2022
`tock-registers` now supports stable Rust!

There is a small breaking change, documented below, required to support
Rust 2021 edition. Most of the remaining changes are improvements to the
internal self-testing infrastructure and documentation. There are also
some additions to `FieldValue` to improve ergonomics.

**Breaking Changes**

 - #2842: tock-registers: rename TryFromValue::try_from to try_from_value
 - #2833: Update to Rust 2021 edition

Other Changes

 - #3126: [trivial] tock-registers: mark two methods as `const`
 - #3088: tock_registers/test_fields: respect struct size padding w/ alignment
 - #3072: Update Rust nightly version + Expose virtual-function-elimination
     - libraries/tock-register-interface: Fixup register_structs documentation
 - #2988: Remove const_fn_trait_bound feature and update nightly (Mar 2022)
 - #3014: tock-registers: Implement From field enum value type for FieldValue
 - #3013: tock-register-interface: Provide none method for FieldValue type
 - #2916: tock-register-interface: improve read_as_enum documentation
 - #2922: tock-register-interface: replace register tests by const assertions
@ppannuto ppannuto mentioned this pull request Aug 19, 2022
2 tasks
ppannuto added a commit that referenced this pull request Aug 19, 2022
`tock-registers` now supports stable Rust!

There is a small breaking change, documented below, required to support
Rust 2021 edition. Most of the remaining changes are improvements to the
internal self-testing infrastructure and documentation. There are also
some additions to `FieldValue` to improve ergonomics.

**Breaking Changes**

 - #2842: tock-registers: rename TryFromValue::try_from to try_from_value
 - #2838: Update to Rust 2021 edition

Other Changes

 - #3126: [trivial] tock-registers: mark two methods as `const`
 - #3088: tock_registers/test_fields: respect struct size padding w/ alignment
 - #3072: Update Rust nightly version + Expose virtual-function-elimination
     - libraries/tock-register-interface: Fixup register_structs documentation
 - #2988: Remove const_fn_trait_bound feature and update nightly (Mar 2022)
 - #3014: tock-registers: Implement From field enum value type for FieldValue
 - #3013: tock-register-interface: Provide none method for FieldValue type
 - #2916: tock-register-interface: improve read_as_enum documentation
 - #2922: tock-register-interface: replace register tests by const assertions
bors bot added a commit that referenced this pull request Aug 24, 2022
3151: tock-registers: release v0.8 r=lschuermann a=ppannuto

### Pull Request Overview

Prepare a v0.8 release of tock-registers.

Fixes #2982.

---

`tock-registers` now supports stable Rust!

There is a small breaking change, documented below, required to support
Rust 2021 edition. Most of the remaining changes are improvements to the
internal self-testing infrastructure and documentation. There are also
some additions to `FieldValue` to improve ergonomics.

**Breaking Changes**

 - #2842: tock-registers: rename TryFromValue::try_from to try_from_value
 - #2838: Update to Rust 2021 edition

Other Changes

 - #3126: [trivial] tock-registers: mark two methods as `const`
 - #3088: tock_registers/test_fields: respect struct size padding w/ alignment
 - #3072: Update Rust nightly version + Expose virtual-function-elimination
     - libraries/tock-register-interface: Fixup register_structs documentation
 - #2988: Remove const_fn_trait_bound feature and update nightly (Mar 2022)
 - #3014: tock-registers: Implement From field enum value type for FieldValue
 - #3013: tock-register-interface: Provide none method for FieldValue type
 - #2916: tock-register-interface: improve read_as_enum documentation
 - #2922: tock-register-interface: replace register tests by const assertions

### Testing Strategy

N/A

### TODO or Help Wanted

N/A

### Documentation Updated

- [x] Updated the relevant files in `/docs`, or no updates are required.

### Formatting

- [ ] Ran `make prepush`.


Co-authored-by: Pat Pannuto <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

chips/sam4l Change pertains to the SAM4L MCU. last-call Final review period for a pull request. tock-libraries This affects libraries supported by the Tock project WG-OpenTitan In the purview of the OpenTitan working group.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants