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

fix(storage): do not inhibit the dead code elimination. #8543

Merged
merged 2 commits into from
Nov 14, 2023
Merged

fix(storage): do not inhibit the dead code elimination. #8543

merged 2 commits into from
Nov 14, 2023

Conversation

dominiquelefevre
Copy link
Contributor

@dominiquelefevre dominiquelefevre commented Sep 10, 2023

When the go compiler encounters a call to MethodByName(), it assumes that every method of every reachable type can be accessed, and nothing may be eliminated.

Go 1.22 has gained support for calls like MethodByName("Foobar"). If the argument to MethodByName() is a compile-time constant, then the compiler no longer disables the DCE, and only keeps methods named Foobar.

Rewrite setConditionField() so that MethodByName() is only called with compile-time constants. This way importing cloud.google.com/go/storage will not inhibit the DCE.

Fixes #8745

@product-auto-label product-auto-label bot added size: m Pull request size is medium. api: storage Issues related to the Cloud Storage API. labels Sep 10, 2023
@dominiquelefevre
Copy link
Contributor Author

Hi there! Does anybody look at PRs in this repo? @codyoss? @jadekler? Please do have a look at the patch, or assign it to a person who reviews changes in /storage.

@codyoss
Copy link
Member

codyoss commented Sep 13, 2023

Hey @dominiquelefevre, this repo is monitored and we do accept PRs. That being said we may not always get to them immediately so please be patient with us.

Also, we encourage all PRs to start with an issue first for discussion and triage to see if it is a change we are willing to make -- it saves both parties time in the long run. I encourage to to please open a corresponding issue to this PR. Thanks.

@product-auto-label product-auto-label bot added the stale: old Pull request is old and needs attention. label Oct 11, 2023
Copy link
Contributor

@BrennaEpp BrennaEpp left a comment

Choose a reason for hiding this comment

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

Thank you for the PR!

storage/storage.go Outdated Show resolved Hide resolved
storage/storage.go Outdated Show resolved Hide resolved
When the go compiler encounters a call to MethodByName(), it
assumes that every method of every reachable type can be accessed,
and nothing may be eliminated.

Go 1.22 has gained support for calls like MethodByName("Foobar").
If the argument to MethodByName() is a compile-time constant, then
the compiler no longer disables the DCE, and only keeps methods
named Foobar.

Rewrite setConditionField() so that MethodByName() is only called with
compile-time constants. This way importing cloud.google.com/go/storage
will not inhibit the DCE.
@dominiquelefevre
Copy link
Contributor Author

ping @BrennaEpp

@dominiquelefevre
Copy link
Contributor Author

Hey, anybody out here? @BrennaEpp?

@product-auto-label product-auto-label bot added stale: extraold Pull request is critically old and needs prioritization. and removed stale: old Pull request is old and needs attention. labels Nov 10, 2023
@BrennaEpp BrennaEpp added the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Nov 14, 2023
@kokoro-team kokoro-team removed the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Nov 14, 2023
@BrennaEpp BrennaEpp merged commit ca2493f into googleapis:main Nov 14, 2023
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: storage Issues related to the Cloud Storage API. size: m Pull request size is medium. stale: extraold Pull request is critically old and needs prioritization.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

storage: importing cloud.google.com/go/storage disables the dead code elimination
4 participants