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

Canonicalize IR to disallow throwing GlobalRef in value position #36450

Merged
merged 1 commit into from
Jun 29, 2020

Conversation

Keno
Copy link
Member

@Keno Keno commented Jun 26, 2020

In anticipation of making the SSA IR more of an interface
that packages can use to implement custom compiler transformation,
I'd like to do some cleanup first. The is the first of the items
on my list: Disallowing GlobalRef in value position if it could
potentially throw (because the binding doesn't exist yet).

This is done as part of SSA conversion, because we don't know
whether a binding will exist during parsing/lowering and we
don't modify the IR at all between lowering and the end of
type inference, so doing it during SSA conversion is the first
possible opportunity.

The reason to do this is to simplify transformation passes that
want to replace calls with sequences of other instructions. By
moving those GlobalRef that could potentially throw into statement
position, the order of argument evaluation does not matter (this
isn't quite true yet due to static parameters, but I'd like to
fix that in a separate commit). I think that's a desirable property
to simplify the life os pass authors.

In anticipation of making the SSA IR more of an interface
that packages can use to implement custom compiler transformation,
I'd like to do some cleanup first. The is the first of the items
on my list: Disallowing GlobalRef in value position if it could
potentially throw (because the binding doesn't exist yet).

This is done as part of SSA conversion, because we don't know
whether a binding will exist during parsing/lowering and we
don't modify the IR at all between lowering and the end of
type inference, so doing it during SSA conversion is the first
possible opportunity.

The reason to do this is to simplify transformation passes that
want to replace calls with sequences of other instructions. By
moving those GlobalRef that could potentially throw into statement
position, the order of argument evaluation does not matter (this
isn't quite true yet due to static parameters, but I'd like to
fix that in a separate commit). I think that's a desirable property
to simplify the life os pass authors.
@JeffBezanson JeffBezanson merged commit 39c278b into master Jun 29, 2020
@JeffBezanson JeffBezanson deleted the kf/globalrefstmt branch June 29, 2020 22:05
simeonschaub pushed a commit to simeonschaub/julia that referenced this pull request Aug 11, 2020
…iaLang#36450)

In anticipation of making the SSA IR more of an interface
that packages can use to implement custom compiler transformation,
I'd like to do some cleanup first. The is the first of the items
on my list: Disallowing GlobalRef in value position if it could
potentially throw (because the binding doesn't exist yet).

This is done as part of SSA conversion, because we don't know
whether a binding will exist during parsing/lowering and we
don't modify the IR at all between lowering and the end of
type inference, so doing it during SSA conversion is the first
possible opportunity.

The reason to do this is to simplify transformation passes that
want to replace calls with sequences of other instructions. By
moving those GlobalRef that could potentially throw into statement
position, the order of argument evaluation does not matter (this
isn't quite true yet due to static parameters, but I'd like to
fix that in a separate commit). I think that's a desirable property
to simplify the life os pass authors.
vtjnash added a commit that referenced this pull request Mar 2, 2021
Generally we assume parameters can be duplicated without seeing
side-effects. That is not entirely true of mutable global and
multi-threading.

Refs: #36450
vtjnash added a commit that referenced this pull request Mar 2, 2021
Generally we assume parameters can be duplicated without seeing
side-effects. That is not entirely true of mutable global and
multi-threading.

Refs: #36450
Fixes: #39508
vtjnash added a commit that referenced this pull request Mar 2, 2021
Generally we assume parameters can be duplicated without seeing
side-effects. That is not entirely true of mutable globals and
multi-threading.

Refs: #36450
Fixes: #39508
Keno pushed a commit that referenced this pull request Mar 3, 2021
Generally we assume parameters can be duplicated without seeing
side-effects. That is not entirely true of mutable globals and
multi-threading.

Refs: #36450
Fixes: #39508
KristofferC pushed a commit that referenced this pull request Mar 14, 2021
Generally we assume parameters can be duplicated without seeing
side-effects. That is not entirely true of mutable globals and
multi-threading.

Refs: #36450
Fixes: #39508
(cherry picked from commit c0f9666)
ElOceanografo pushed a commit to ElOceanografo/julia that referenced this pull request May 4, 2021
…aLang#39893)

Generally we assume parameters can be duplicated without seeing
side-effects. That is not entirely true of mutable globals and
multi-threading.

Refs: JuliaLang#36450
Fixes: JuliaLang#39508
antoine-levitt pushed a commit to antoine-levitt/julia that referenced this pull request May 9, 2021
…aLang#39893)

Generally we assume parameters can be duplicated without seeing
side-effects. That is not entirely true of mutable globals and
multi-threading.

Refs: JuliaLang#36450
Fixes: JuliaLang#39508
staticfloat pushed a commit that referenced this pull request Dec 23, 2022
Generally we assume parameters can be duplicated without seeing
side-effects. That is not entirely true of mutable globals and
multi-threading.

Refs: #36450
Fixes: #39508
(cherry picked from commit c0f9666)
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.

3 participants