Commit 7826d5c
[release-1.12] Workaround poor inlining behavior for
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
```if @generated functions (#58996)1 parent 227ff67 commit 7826d5c
2 files changed
+36
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
88 | 88 | | |
89 | 89 | | |
90 | 90 | | |
91 | | - | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
92 | 98 | | |
93 | 99 | | |
94 | 100 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2310 | 2310 | | |
2311 | 2311 | | |
2312 | 2312 | | |
| 2313 | + | |
| 2314 | + | |
| 2315 | + | |
| 2316 | + | |
| 2317 | + | |
| 2318 | + | |
| 2319 | + | |
| 2320 | + | |
| 2321 | + | |
| 2322 | + | |
| 2323 | + | |
| 2324 | + | |
| 2325 | + | |
| 2326 | + | |
| 2327 | + | |
| 2328 | + | |
| 2329 | + | |
| 2330 | + | |
| 2331 | + | |
| 2332 | + | |
| 2333 | + | |
| 2334 | + | |
| 2335 | + | |
| 2336 | + | |
| 2337 | + | |
| 2338 | + | |
| 2339 | + | |
| 2340 | + | |
| 2341 | + | |
0 commit comments