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

Avoids passing of useless parameter #1585

Merged
merged 2 commits into from
May 6, 2024

Conversation

Hsilgos
Copy link
Contributor

@Hsilgos Hsilgos commented May 6, 2024

convert_from_jni functions use last parameter only for function overloading because
normally those functions are different by the return parameter. In all places where
function convert_from_jni is used the last parameter is nullptr which is C-casted to the desired type.
As godbolt demonstrates modern clang and gcc have to pass this parameter without any optimisation.
This can be improved if this parameter is empty object (i.e. an object of a class without any fields) and
it's passed by value. As godbolt shows in this case modern cland and gcc generate code as if there is no any parameter at all.

Hsilgos added 2 commits May 6, 2024 10:34
Signed-off-by: Yauheni Khnykin <[email protected]>
@Hsilgos Hsilgos force-pushed the khnykin/avoid_passing_of_useless_argument branch from ed827e6 to b7e75c0 Compare May 6, 2024 09:17
@Hsilgos Hsilgos merged commit 34c24f4 into master May 6, 2024
17 checks passed
@Hsilgos Hsilgos deleted the khnykin/avoid_passing_of_useless_argument branch May 6, 2024 11:16
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.

2 participants