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

Add 1st draft of copy elision #14903

Merged
merged 5 commits into from
Feb 19, 2020
Merged

Add 1st draft of copy elision #14903

merged 5 commits into from
Feb 19, 2020

Conversation

mppf
Copy link
Member

@mppf mppf commented Feb 13, 2020

This PR adds a 1st draft of copy elision. It works during callDestructors
and looks for a copy being the last mention of a variable before the
deinitializer is run for that variable. In that event, it elides the copy
and does not deinitialize the variable.

Copy elision is discussed in issues #13704, #9490, #9421,
#14860, #14870, and #14874.

This PR is closest to the proposal in #14860 of any of those,
but it does not quite match that proposal.

In the future, we expect to separate the effort of deciding which copies
are elide-able from the work of doing the actual elision. Since the
elision involves not deinitializing something, it makes sense to continue
to do that in callDestructors. However, the work of deciding which copies
are elide-able will move to some part of the compiler before nil checking
(because nil checking can find certain errors after an elided copy makes
a variable invalid). Additionally we are planning to use a simpler rule
for when a copy can be elided (#14874).

Reviewed by @benharsh - thanks!

  • full local testing
  • full local gasnet testing

@mppf mppf changed the title Add copy elision Add draft copy elision Feb 13, 2020
@mppf mppf requested a review from benharsh February 14, 2020 01:23
Copy link
Member

@benharsh benharsh left a comment

Choose a reason for hiding this comment

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

There are some commented-out lines of code in the compiler to clean up. Otherwise looks good.

@mppf mppf changed the title Add draft copy elision Add 1st draft of copy elision Feb 19, 2020
@mppf mppf merged commit 3cbf78a into chapel-lang:master Feb 19, 2020
@mppf mppf deleted the copy-elision2 branch February 19, 2020 12:10
e-kayrakli added a commit that referenced this pull request Feb 21, 2020
Add performance annotations

Adds annotation for the following perf changes and the responsible PRs

- Gasnet Performance improvements on cs xc
    #14912
- Memory leak
    #14907
- Compiler performance
    #14887
- String temporary copy performance
    #14903 
- Unordered GET improvements on ofi
    #14810

[Reviewed by @ronawho]
mppf added a commit that referenced this pull request Mar 27, 2020
Language evolution updates for 1.21

Updates the language evolution document with various language changes.

See also PRs #14903 #14903 #15041 #14564.

Reviewed by @bradcray - thanks!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants