forked from chapel-lang/chapel
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Spec changes for const [cvref] (chapel-lang#23447)
This PR adjusts the spec to change the approach for the default & `const` intent to mean `const` [cvref] (chapel-lang#21499). It builds upon PR chapel-lang#23097. * The approach used here is to describe `const` intent as one where the compiler will choose between `const in` and `const ref`, with the implication that programs relying on one or the other (due to updates to the referred-to-value by other means than the formal) will have unexpected behavior when the compiler makes a different choice. As an extension to the above implication, it adds the constraint that the compiler can assume that the referred-to value will not change. * This leaves it implementation-dependent for example whether a `.locale` query on a `const` (including default intent for most types) formal argument will refer to the original value when the compiler chooses `const ref` vs to a local copy when it chooses `const in`. * The PR switches to treating `const` as a concrete intent and removes the distinction between abstract and concrete intents. The abstract/concrete structure is not worth keeping just for the exception that the default intent for `sync` and `atomic` is `ref`. Additionally this PR adjusts the spec to take the following steps to address concerns raised in chapel-lang#22770: * disallow const arrays over domains that could change (to address a correctness concern) * require const domain formals to remain unchanged during the call (although this is an implication of the more general extension to the implication that is described above) * require the domain of a const array formal to remain unchanged during the call (to address a concern about the optimizability of Chapel programs). As we gain experience with these rules, and in particular, as we implement compiler changes to rely on them, we will almost certainly update the spec to make it more specific. The language in this version is intentionally general to give us more room to avoid breaking programs that follow the spec. Reviewed by @vasslitvinov - thanks!
- Loading branch information
Showing
9 changed files
with
284 additions
and
123 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.