-
-
Notifications
You must be signed in to change notification settings - Fork 5.6k
Backports for Julia 1.12-rc2 #59006
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
Merged
Merged
Backports for Julia 1.12-rc2 #59006
+268
−16
Conversation
This file contains hidden or 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
Changes from #43151, github just didn't want me to re-open it. As discussed on slack, any `hygienic-scope` within an outer `hygienic-scope` can read and write variables in the outer one, so it's not particularly hygienic. The result is that we can't safely nest macro calls unless they know the contents of all inner macro calls. Should fix #48910. Co-authored-by: Michiel Dral <m.c.dral@gmail.com> (cherry picked from commit ff33305)
(cherry picked from commit 338f494)
In d2cc061 and prior commits, we made backdated access a conditional error (if depwarns are enabled or in generators). However, we did not touch `isdefinedglobal`. This resulted in the common pattern `isdefinedglobal(m, s) && getglobal(m, s)` to sometimes error. In particular, this could be observed when attempting to print a type from inside a generated function before that type's definition age. Additionally, I think the usage there, which used `invokelatest` on each of the two queries is problematic because it is racy, since the two `invokelatest` calls may be looking at different world ages. This makes two tweaks: 1. Makes `isdefinedglobal` consistent with `getglobal` in that it now returns false if `getglobal` would throw due to the above referenced restriction. 2. Removes the implicit `invokelatest` in _isself in the show code. Instead, it will use the current world. I considered having it use the exception age when used for MethodErrors. However, because this is used for printing it matters more how the object can be accessed *now* rather than how it could have been accessed in the past. (cherry picked from commit fb59b6d)
(cherry picked from commit 107e1ac)
Co-authored-by: Andy Dienes <51664769+adienes@users.noreply.github.com> Co-authored-by: Gabriel Baraldi <28694980+gbaraldi@users.noreply.github.com> Co-authored-by: Diogo Netto <61364108+d-netto@users.noreply.github.com> (cherry picked from commit 1367b3d)
…functions (#58996) Restores something very close to the previous inlining behavior, without reverting #54972 This is a hack to workaround #58915 (comment) for 1.12, but we should leave an issue open so that we can put in a proper fix to inlining for the next major version. Also improves #58915 (comment), which was a dynamic `call` on 1.11 and a poorly-chosen `invoke` of the generator fallback on 1.12. This is now an inlined version of the non-fallback path for the generator: ```julia julia> nt = (next = zero(UInt32), prev = zero(UInt32)) (next = 0x00000000, prev = 0x00000000) julia> f(nt) = @inline Base.setindex(nt, 2, :next) f (generic function with 1 method) julia> @code_warntype optimize=true f(nt) MethodInstance for f(::@NamedTuple{next::UInt32, prev::UInt32}) from f(nt) @ Main REPL[2]:1 Arguments #self#::Core.Const(Main.f) nt::@NamedTuple{next::UInt32, prev::UInt32} Body::@NamedTuple{next::Int64, prev::UInt32} 1 ─ %1 = builtin Base.getfield(nt, :prev)::UInt32 │ %2 = %new(@NamedTuple{next::Int64, prev::UInt32}, 2, %1)::@NamedTuple{next::Int64, prev::UInt32} └── return %2 ```
Will merge this to get a new 1.12-nightly but wait a bit with rc2. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
No description provided.