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

copy effects key to Base.infer_effects #56363

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
75 changes: 40 additions & 35 deletions base/compiler/effects.jl
Original file line number Diff line number Diff line change
@@ -1,3 +1,42 @@
const effects_key_string = """
## Key for `show` output of Effects:

The output represents the state of different effect properties in the following order:

1. `consistent` (`c`):
- `+c` (green): `ALWAYS_TRUE`
- `-c` (red): `ALWAYS_FALSE`
- `?c` (yellow): `CONSISTENT_IF_NOTRETURNED` and/or `CONSISTENT_IF_INACCESSIBLEMEMONLY`
2. `effect_free` (`e`):
- `+e` (green): `ALWAYS_TRUE`
- `-e` (red): `ALWAYS_FALSE`
- `?e` (yellow): `EFFECT_FREE_IF_INACCESSIBLEMEMONLY`
3. `nothrow` (`n`):
- `+n` (green): `true`
- `-n` (red): `false`
4. `terminates` (`t`):
- `+t` (green): `true`
- `-t` (red): `false`
5. `notaskstate` (`s`):
- `+s` (green): `true`
- `-s` (red): `false`
6. `inaccessiblememonly` (`m`):
- `+m` (green): `ALWAYS_TRUE`
- `-m` (red): `ALWAYS_FALSE`
- `?m` (yellow): `INACCESSIBLEMEM_OR_ARGMEMONLY`
7. `noub` (`u`):
- `+u` (green): `true`
- `-u` (red): `false`
- `?u` (yellow): `NOUB_IF_NOINBOUNDS`
8. `:nonoverlayed` (`o`):
- `+o` (green): `ALWAYS_TRUE`
- `-o` (red): `ALWAYS_FALSE`
- `?o` (yellow): `CONSISTENT_OVERLAY`
9. `:nortcall` (`r`):
- `+r` (green): `true`
- `-r` (red): `false`
"""

"""
effects::Effects

Expand Down Expand Up @@ -74,42 +113,8 @@ initialized with `ALWAYS_TRUE`/`true` and then transitioned towards `ALWAYS_FALS
Note that within the current flow-insensitive analysis design, effects detected by local
analysis on each statement usually taint the global conclusion conservatively.

## Key for `show` output of Effects:

The output represents the state of different effect properties in the following order:

1. `consistent` (`c`):
- `+c` (green): `ALWAYS_TRUE`
- `-c` (red): `ALWAYS_FALSE`
- `?c` (yellow): `CONSISTENT_IF_NOTRETURNED` and/or `CONSISTENT_IF_INACCESSIBLEMEMONLY`
2. `effect_free` (`e`):
- `+e` (green): `ALWAYS_TRUE`
- `-e` (red): `ALWAYS_FALSE`
- `?e` (yellow): `EFFECT_FREE_IF_INACCESSIBLEMEMONLY`
3. `nothrow` (`n`):
- `+n` (green): `true`
- `-n` (red): `false`
4. `terminates` (`t`):
- `+t` (green): `true`
- `-t` (red): `false`
5. `notaskstate` (`s`):
- `+s` (green): `true`
- `-s` (red): `false`
6. `inaccessiblememonly` (`m`):
- `+m` (green): `ALWAYS_TRUE`
- `-m` (red): `ALWAYS_FALSE`
- `?m` (yellow): `INACCESSIBLEMEM_OR_ARGMEMONLY`
7. `noub` (`u`):
- `+u` (green): `true`
- `-u` (red): `false`
- `?u` (yellow): `NOUB_IF_NOINBOUNDS`
8. `:nonoverlayed` (`o`):
- `+o` (green): `ALWAYS_TRUE`
- `-o` (red): `ALWAYS_FALSE`
- `?o` (yellow): `CONSISTENT_OVERLAY`
9. `:nortcall` (`r`):
- `+r` (green): `true`
- `-r` (red): `false`
$(effects_key_string)
"""
struct Effects
consistent::UInt8
Expand Down
2 changes: 2 additions & 0 deletions base/reflection.jl
Original file line number Diff line number Diff line change
Expand Up @@ -877,6 +877,8 @@ signature, the `:nothrow` bit gets tainted.
The `Base.infer_effects` function should not be used from generated functions;
doing so will result in an error.
$(Core.Compiler.effects_key_string)
# See Also
- [`Core.Compiler.Effects`](@ref): A type representing the computational effects of a method call.
- [`Base.@assume_effects`](@ref): A macro for making assumptions about the effects of a method.
Expand Down