]> git.lizzy.rs Git - rust.git/commit
Rollup merge of #63034 - tmandry:reduce-generator-size-regressions, r=cramertj
authorMazdak Farrokhzad <twingoow@gmail.com>
Tue, 6 Aug 2019 23:39:25 +0000 (01:39 +0200)
committerGitHub <noreply@github.com>
Tue, 6 Aug 2019 23:39:25 +0000 (01:39 +0200)
commitfb1f57e0e5a78a803f1356813c8b70c5bc465efa
tree62426d9c56447eb1b513aa9224b7630e8d32e1b2
parent6a91782b72fca586b15ba68364bc7baab837af86
parentb40788e89fac38781ddb838bb4fb0d706a6a3546
Rollup merge of #63034 - tmandry:reduce-generator-size-regressions, r=cramertj

Fix generator size regressions due to optimization

I tested the generator optimizations in #60187 and #61922 on the Fuchsia
build, and noticed that some small generators (about 8% of the async fns
in our build) increased in size slightly.

This is because in #60187 we split the fields into two groups, a
"prefix" non-overlap region and an overlap region, and lay them out
separately. This can introduce unnecessary padding bytes between the two
groups.

In every single case in the Fuchsia build, it was due to there being
only a single variant being used in the overlap region. This means that
we aren't doing any overlapping, period. So it's better to combine the
two regions into one and lay out all the fields at once, which is what
this change does.

r? @cramertj
cc @eddyb @Zoxc
src/libcore/mem/maybe_uninit.rs
src/librustc/ty/context.rs
src/librustc/ty/layout.rs