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

codegen: Restore ct->scope in jl_eh_restore_state #55907

Merged
merged 1 commit into from
Nov 18, 2024

Conversation

topolarity
Copy link
Member

This eliminates the need to associate a catch with every with(...) do ... end block, which was really just acting as a landing pad to restore jl_current_task->scope in the majority of cases.

This change does not actually update lowering to remove the unnecessary catch block - that's left as a follow-up.

This eliminates the need to associate a `catch` with every
`with(...) do ... end` block, which was really just acting as a landing
pad to restore `jl_current_task->scope` in the majority of cases.

This change does not actually update lowering to remove the unnecessary
`catch` block - that's left as a follow-up.
Copy link
Member

@Keno Keno left a comment

Choose a reason for hiding this comment

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

Seems sensible to me.

@vtjnash vtjnash merged commit aff6512 into JuliaLang:master Nov 18, 2024
7 checks passed
@lgoettgens
Copy link
Contributor

Since yesterday we see the following error in our nightly CI (see thofma/Hecke.jl#1687):

TypeError: in typeassert, expected Union{Nothing, Base.ScopedValues.Scope}, got a value of type ZZRingElem
  Stacktrace:
    [1] get
      @ ./scopedvalues.jl:152 [inlined]
    [2] _precision_with_base_2
      @ ./mpfr.jl:1041 [inlined]
    [3] BigFloat
      @ ./mpfr.jl:150 [inlined]
    [4] _arf_get_mpfr(t::Nemo.arf_struct, ::RoundingMode{:Nearest})
      @ Nemo ~/.julia/packages/Nemo/0TzOv/src/arb/arb.jl:129
[...]

From the set of changes since this appeared I assume this is due to this PR, but I am not sure if this PR is faulty or just brings already existing misusage of setprecision up to surface.

cc @thofma

@lgoettgens
Copy link
Contributor

@thofma reported to see

  TypeError: in typeassert, expected Union{Nothing, Base.ScopedValues.Scope}, got a value of type Tuple{Base.MP
FR.MPFRRoundingMode}

which seems to be unrelated to any setprecision calls in the surrounding code.

So this seems to be a genuine issue with this PR.

topolarity added a commit to topolarity/julia that referenced this pull request Nov 19, 2024
…itted

This fixes a bug introduced by JuliaLang#55907, which was neglecting that it's possible
for `Expr(:enter, ...)` to have no `catch` destination and still have a scope,
especially if the compiler has decided that the body is `nothrow` and chooses
to optimize away the `catch` destination.
@topolarity
Copy link
Member Author

Thanks for the heads up @lgoettgens, just opened #56612 to hopefully fix the regression

topolarity added a commit to topolarity/julia that referenced this pull request Nov 19, 2024
…itted

This fixes a bug introduced by JuliaLang#55907, which was neglecting that it's possible
for `Expr(:enter, ...)` to have no `catch` destination and still have a scope,
especially if the compiler has decided that the body is `nothrow` and chooses
to optimize away the `catch` destination.
topolarity added a commit to topolarity/julia that referenced this pull request Nov 19, 2024
…itted

This fixes a bug introduced by JuliaLang#55907, which was neglecting that it's possible
for `Expr(:enter, ...)` to have no `catch` destination and still have a scope,
especially if the compiler has decided that the body is `nothrow` and chooses
to optimize away the `catch` destination.
topolarity added a commit to topolarity/julia that referenced this pull request Nov 19, 2024
…itted

This fixes a bug introduced by JuliaLang#55907, which was neglecting that it's possible
for `Expr(:enter, ...)` to have no `catch` destination and still have a scope,
especially if the compiler has decided that the body is `nothrow` and chooses
to optimize away the `catch` destination.
topolarity added a commit to topolarity/julia that referenced this pull request Nov 19, 2024
…itted

This fixes a bug introduced by JuliaLang#55907, which was neglecting that it's possible
for `Expr(:enter, ...)` to have no `catch` destination and still have a scope,
especially if the compiler has decided that the body is `nothrow` and chooses
to optimize away the `catch` destination.
topolarity added a commit that referenced this pull request Nov 19, 2024
…itted (#56612)

This fixes a bug introduced by #55907, which was neglecting that it's
possible for `EnterNode` to have no `catch` destination and still have a
scope.

This can especially happen if the compiler has decided that the body is
`nothrow` and chooses to optimize away the `catch` destination, but also
#55907 intended to make the scope-only form of `:enter` legal (and not
need an exception handler) even if the body is _not_ `nothrow`.

This fixes all that up to restore the scope correctly on the happy path.

~~Needs tests - will add those soon~~
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