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 notasklocal effect #45422

Merged
merged 1 commit into from
May 24, 2022
Merged

Add notasklocal effect #45422

merged 1 commit into from
May 24, 2022

Conversation

Keno
Copy link
Member

@Keno Keno commented May 22, 2022

Split out from #45272. This effect models the legality of moving code
between tasks. It is somewhat related to effect-free/consistent, but
only with respect to task-local state. As an example consider something
like:

global glob
function bar()
    @async (global glob = 1; some_other_code())
end

The newly created task is not effect-free, but it would be legal to inline
the assignment of glob into bar (as long it is inlined before the creation
of the task of some_other_code does not access glob). For comparison,
the following is neither notls, nor effect_free:

function bar()
    @async (task_local_storage()[:var] = 1; some_other_code())
end

The same implies to implicit task-local state such as the RNG state.

Implementation wise, there isn't a lot here, because the implicit
tainting by ccall is the correct conservative default. In the future,
we may want to annotate various ccalls as being permissible for
notls, but let's worry about that when we have a case that needs it.

@@ -76,41 +82,46 @@ function Effects(
effect_free::TriState,
nothrow::TriState,
terminates::TriState,
nonoverlayed::Bool)
nonoverlayed::Bool,
notls::TriState)
Copy link
Contributor

Choose a reason for hiding this comment

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

Apologies (and please ignore) if this is unappreciated bikeshedding, but notls is a less immediately obvious name than the other effects. notasklocal would be more similar in clarity and roughly the same length as the other effects names.

Copy link
Member Author

Choose a reason for hiding this comment

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

fair enough. The other effects do tend to be more verbose.

Copy link
Member

Choose a reason for hiding this comment

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

especially since TLS=Transport Layer Security.

Copy link
Contributor

Choose a reason for hiding this comment

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

That was how I initially read it.

Split out from #45272. This effect models the legality of moving code
between tasks. It is somewhat related to effect-free/consistent, but
only with respect to task-local state. As an example consider something
like:

```
global glob
function bar()
    @async (global glob = 1; some_other_code())
end
```

The newly created task is not effect-free, but it would be legal to inline
the assignment of `glob` into `bar` (as long it is inlined before the creation
of the task of `some_other_code` does not access `glob`). For comparison,
the following is neither `notls`, nor `effect_free`:

```
function bar()
    @async (task_local_storage()[:var] = 1; some_other_code())
end
```

The same implies to implicit task-local state such as the RNG state.

Implementation wise, there isn't a lot here, because the implicit
tainting by ccall is the correct conservative default. In the future,
we may want to annotate various ccalls as being permissible for
notls, but let's worry about that when we have a case that needs it.
@Keno Keno merged commit 8bb973a into master May 24, 2022
@Keno Keno deleted the kf/notls branch May 24, 2022 19:26
@oscardssmith oscardssmith changed the title Add notls effect Add notasklocal effect Jun 2, 2022
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.

4 participants