https://github.com/JuliaLang/julia

sort by:
Revision Author Date Message Commit Date
256118a Make inference slightly faster 1. Force inference to union-split the `widenconst` dispatch rather than joing through dynamic dispatch. 2. Avoid widenconst(::Const) in a hot path when not necessary. This got faster (#44402), but is not quite fast yet. Makes inference a few % faster. 02 September 2022, 05:53:18 UTC
038d314 remove unused sorting functinons from compiler (#46588) 02 September 2022, 05:51:52 UTC
a19726b Faster cogen for isa(::Any, Type) (#46589) By directly inlining `jl_is_kind` into the generated code. 02 September 2022, 05:51:24 UTC
e6bf81f Provide unknown-object codegen fast paths for getfield/isdefined (#46572) I thought this might make inference a bit faster, but benchmark results seem to be in the noise locally, probably because the int being boxed is part of the box cache, so no allocation actually happens. Nevertheless, it's a nice, simple, optimization. 02 September 2022, 04:32:11 UTC
44c50ea Refactor lattice code to expose layering and enable easy extension (#46526) There's been two threads of work involving the compiler's notion of the inference lattice. One is that the lattice has gotten to complicated and with too many internal constraints that are not manifest in the type system. #42596 attempted to address this, but it's quite disruptive as it changes the lattice types and all the signatures of the lattice operations, which are used quite extensively throughout the ecosystem (despite being internal), so that change is quite disruptive (and something we'd ideally only make the ecosystem do once). The other thread of work is that people would like to experiment with a variety of extended lattices outside of base (either to prototype potential additions to the lattice in base or to do custom abstract interpretation over the Julia code). At the moment, the lattice is quite closely interwoven with the rest of the abstract interpreter. In response to this request in #40992, I had proposed a `CustomLattice` element with callbacks, but this doesn't compose particularly well, is cumbersome and imposes overhead on some of the hottest parts of the compiler, so it's a bit of a tough sell to merge into `Base`. In this PR, I'd like to propose a refactoring that is relatively non-invasive to non-Base users, but I think would allow easier experimentation with changes to the lattice for these two use cases. In essence, we're splitting the lattice into a ladder of 5 different lattices, each containing the previous lattice as a sub-lattice. These 5 lattices are: - `JLTypeLattice` (Anything that's a `Type`) - `ConstsLattice` ( + `Const`, `PartialTypeVar`) - `PartialsLattice` ( + `PartialStruct`, `PartialOpaque` ) - `ConditionalsLattice` ( + `Conditional` ) - `InferenceLattice` ( + `LimitedAccuracy` ) - `OptimizerLattice` ( + `MaybeUndef` ) The idea is that where a lattice element contains another lattice element (e.g. in `PartialStruct` or `Conditional`), the element contained may only be from a wider lattice. In this PR, this is not enforced by the type system. This is quite deliberate, as I want to retain the types and object layouts of the lattice elements, but of course a future #42596-like change could add such type enforcement. Of particular note is that the `PartialsLattice` and `ConditionalsLattice` is parameterized and additional layers may be added in the stack. For example, in #40992, I had proposed a lattice element that refines `Int` and tracks symbolic expressions. In this setup, this could be accomplished by adding an appropriate lattice in between the `ConstsLattice` and the `PartialsLattice` (of course, additional hooks would be required to make the tfuncs work, but that is outside the scope of this PR). I don't think this is a full solution, but I think it'll help us play with some of these extended lattice options over the next 6-12 months in the packages that want to do this sort of thing. Presumably once we know what all the potential lattice extensions look like, we will want to take another look at this (likely together with whatever solution we come up with for the AbstractInterpreter composability problem and a rebase of #42596). WIP because I didn't bother updating and plumbing through the lattice in all the call sites yet, but that's mostly mechanical, so if we like this direction, I will make that change and hope to merge this in short order (because otherwise it'll accumulate massive merge conflicts). 02 September 2022, 04:14:27 UTC
852e313 Merge pull request #46446 from N5N3/Fix-36443 Fix `typeintersect` bug on `Vararg` length. 02 September 2022, 01:00:17 UTC
31e4e26 Switch from sorted vector to heap in slot2ssa (#46510) * copy heap.jl from DataStructures.jl * use heap instead of sorted vector * add heap tests 01 September 2022, 23:58:01 UTC
8ee4b31 Make BackedgeIterator more type stable (#46584) Provides a slight improvement in inference performance 01 September 2022, 23:28:26 UTC
aa20b32 Semi-concrete IR interpreter (#44803) Co-authored-by: Keno Fischer <keno@juliacomputing.com> 01 September 2022, 21:54:39 UTC
db2c174 Add missing codegen mapping for _svec_ref (#46583) Was missed in #45062 and showed up in a performance profile as an unnecessary dynamic dispatch. 01 September 2022, 21:34:58 UTC
f73c225 Handle Vararg{} in isdefined_effects (#46580) Fixes issue reported by Oscar. 01 September 2022, 21:34:31 UTC
71131c9 inference: optimize compute_live_ins by avoiding sort (#46508) 01 September 2022, 16:37:01 UTC
cb5f401 Generalize `lyap` and `sylvester` to abstract matrices (#46545) 01 September 2022, 10:29:05 UTC
cb0721b Disambiguate invalidation types in jl_insert_method_instance (#46569) SnoopCompile parses the invalidation log to construct a causal chain for each invalidation. It turns out to be necessary to disambiguate invalidation of callers from invalidation of the primary trigger in jl_insert_method_instance. 01 September 2022, 04:00:17 UTC
4654cfa subtyping: add tests for various Vararg bounds bugs Refs #39088 Refs #39098 01 September 2022, 01:51:41 UTC
2abedf6 Avoid set var's lb if intersect return a Vararg with free length. (Null or a local type var) But `check_unsat_bound` should not be skipped. Co-Authored-By: Jameson Nash <vtjnash+github@gmail.com> 01 September 2022, 01:51:41 UTC
1268582 Make `bound_var_below` return `NULL` if the input typevar is not valid. If offset > 0, the correct result is `var - offset` if expressible. So an unbounded typevar should not be returned in this case as it might be a diagonal var. Since the result could be improved if `N` get fixed, set `intvalued` to 2 as a re-intersection hint. 01 September 2022, 01:51:41 UTC
a6a5f00 subtype: add tests for `Vararg` expansion. Ref #36443 Ref #37257 01 September 2022, 01:51:40 UTC
b7f47d5 Avoid set `var`'s bounds if `offset != 0` if `offset != 0`, then these 2 var should have different value, thus it's invalid to set bounds. 01 September 2022, 01:51:40 UTC
38829a0 Always return the shorter `Vararg` length. The type `var` might be switched during intersection. Thus previous result looks order dependent. When we intersect 2 `Vararg`s' length, we should always return the shorter one. As we has consumed the extra elements in `intersect_tuple`. Also fix #37257 Co-Authored-By: Jameson Nash <vtjnash+github@gmail.com> 01 September 2022, 01:51:40 UTC
f29a013 Add tuple length offset when we intersect 2 `Vararg`'s length. 01 September 2022, 00:30:19 UTC
e6d2624 Skip subtype check if `intersect_invariant` calls `set_vat_to_const`. Co-Authored-By: Jameson Nash <vtjnash+github@gmail.com> 01 September 2022, 00:30:19 UTC
01a4a30 Avoid setting `offset` when we intersect `Vararg`'s eltype. `var->offset` is used to recode the length difference of 2 `Vararg`s. But `Vararg`'s length might also be used in the type field, e.g. `Tuple{Vararg{Val{N}, N}} where {N}`, where we should ignore `offset` when we intersect `Val{N}`. This commit move the offset setting/erasing into `intersect_varargs`. 01 September 2022, 00:30:19 UTC
53bb7fb allow nested combinations of (named)tuples, symbols, and bits as type parameters (#46300) 31 August 2022, 18:42:41 UTC
1ece3f6 complex numbers should be given equal place in Julia (#46476) 31 August 2022, 17:20:24 UTC
8fa066b compiler: Get rid of has_struct_const_info (#46564) This was introduced by me in #39684, but the commit message has no discussion as to why `has_struct_const_info` and `has_nontrivial_const_info` are not the same function. Moreover, I don't think the `isa(x, Conditional)` branch ever did anything because even at the time of the commit, `tuple_tfunc` applied `widenconditional` to all incoming argtypes. That leaves `PartialTypeVar`, which seems reasonable to just include in the definition of `has_nontrivial_const_info`, so that we may be consistent between `tuple_tfunc` and `Expr(:new)`. 31 August 2022, 14:16:54 UTC
a83a0e6 Minor inference improvements in stdlibs (#46561) Since Julia unfortuantely still cannot propagate information from immutable fields loaded twice (see #39888, #41199), these kind of changes are necessary to achieve type stability. 31 August 2022, 13:16:45 UTC
5fe93ee `AbstractInterpreter`: allow overloading `merge_effects!` (#46559) This allows external `AbstractInterpreter`s to observe effects computed for each statement (as like `add_remark!`) and show more fine-grained effects information, e.g. in Cthulhu's code view. 31 August 2022, 12:33:29 UTC
dc27852 code loading fixes for cases where wrong version of package is loaded (#46068) 31 August 2022, 12:21:08 UTC
7537cb3 Improve inferrability of `open(f, cmd, ...)` (#46551) This fixes invalidations from loading Static.jl 31 August 2022, 12:12:01 UTC
adc72d1 Improve inference in REPL LineEdit.jl `getEntry` (#46550) This prevents invalidations from loading Static.jl 31 August 2022, 12:08:55 UTC
25a07bf Improve type stability of `platforms_match(::AbstractPlatform, ::AbstractPlatform)` (#46547) This improvement prevents invalidations in binaryplatforms.jl when loading Static.jl. 31 August 2022, 12:06:18 UTC
f1f5d59 fix another invalidation from Static.jl (#46546) This is a follow-up to https://github.com/JuliaLang/julia/pull/46481. I suggest the labels `latency` and `backport-1.8`. 31 August 2022, 12:04:37 UTC
5a02f3f Drive-by microopt - remove duplicated subtype query (#46560) `typeintersect` already performs this subtype query internally as the first thing it does, so just check after the fact rather than duplicating the query. 31 August 2022, 10:12:49 UTC
8adca3b require one based indexing in evalpoly (#46552) Co-authored-by: Lilith Hafner <Lilith.Hafner@gmail.com> 31 August 2022, 09:46:56 UTC
99d8c7b fix invalidations in REPL LineEdit.jl from Static.jl (#46548) * fix invalidations in REPL LineEdit.jl from Static.jl 31 August 2022, 09:30:54 UTC
4862893 Forward keyword arguments when using @deprecate without a signature (#46261) When using the @deprecate macro without specifying the deprecated signature, a method is created for the old name that accepts a variable number of positional arguments. This commit makes the created method also accept a variable number of keyword arguments. 31 August 2022, 09:24:43 UTC
559826e More info on nor(x, y) (#46505) 31 August 2022, 09:08:31 UTC
0a64f5b Improve `hvcat` signature in its docstring (#46518) Co-authored-by: Daniel Karrasch <daniel.karrasch@posteo.de> Co-authored-by: Mosè Giordano <giordano@users.noreply.github.com> 31 August 2022, 07:35:12 UTC
682ae8a Disable even more FileWatching tests (#46497) 31 August 2022, 06:33:58 UTC
7ab0c81 Loosen type signature on Dates' otherperiod_seed (#45886) 31 August 2022, 05:50:06 UTC
3c7d96f errorshow: Show hint when + is attempted on AbstractStrings (#45823) 31 August 2022, 05:44:07 UTC
f066855 inference: revive `CachedMethodTable` mechanism (#46535) `CachedMethodTable` was removed within #44240 as we couldn't confirm any performance improvement then. However it turns out the optimization was critical in some real world cases (e.g. #46492), so this commit revives the mechanism with the following tweaks that should make it more effective: - create method table cache per inference (rather than per local inference on a function call as on the previous implementation) - only use cache mechanism for abstract types (since we already cache lookup result at the next level as for concrete types) As a result, the following snippet reported at #46492 recovers the compilation performance: ```julia using ControlSystems a_2 = [-5 -3; 2 -9] C_212 = ss(a_2, [1; 2], [1 0; 0 1], [0; 0]) @time norm(C_212) ``` > on master ``` julia> @time norm(C_212) 364.489044 seconds (724.44 M allocations: 92.524 GiB, 6.01% gc time, 100.00% compilation time) 0.5345224838248489 ``` > on this commit ``` julia> @time norm(C_212) 26.539016 seconds (62.09 M allocations: 5.537 GiB, 5.55% gc time, 100.00% compilation time) 0.5345224838248489 ``` 31 August 2022, 02:40:04 UTC
97c853a `AbstractInterpreter`: allow overload of `type_annotate!` (#46554) So that external `AbstractInterpreter`s observe the DCE on type-inferred code based on reachability analysis of abstract interpretation. This is especially useful for Cthulhu to show collected remarks layered on DCE-ed `CodeInfo` object. 31 August 2022, 01:52:48 UTC
c2a1650 avoid one invalidation of `isinf` when loading Static.jl (#46493) 30 August 2022, 18:11:07 UTC
d1706d4 Remove backtrace entirely in shell mode (#42867) 30 August 2022, 14:51:04 UTC
fd6b485 Suggested refinement to Symbol docs (#45115) Moves the notice that `:` only works for valid identifiers up to the first sentence, and adds examples where `Symbol()` would be needed. 30 August 2022, 14:28:38 UTC
3242858 Fix Dict limit printing of small values ending with color (#45521) 30 August 2022, 13:48:22 UTC
b252d17 Increase code reuse in Dates.Period conversion and promotion (#45884) 30 August 2022, 13:32:53 UTC
909f153 Deprecate Dates.argerror (#46031) 30 August 2022, 13:30:05 UTC
1715110 Enhance `StringIndexError` display (correct escaping) (#46039) 30 August 2022, 13:29:03 UTC
c00f40b add partition specialization for Strings (#46234) This PR fixes JuliaLang/julia#45768 30 August 2022, 13:16:36 UTC
afb8c89 `@kwdef`: export and add to public api (#46273) 30 August 2022, 13:14:56 UTC
ca629f3 Add property in searchsortedfirst docstring (#46511) 30 August 2022, 13:11:37 UTC
710d9a0 Add link to appropriate section of devdocs (#46540) 30 August 2022, 13:10:18 UTC
6d6f3b7 🤖 Bump the Pkg stdlib from 8d77a6cac to aa3704d36 (#46543) Co-authored-by: Dilum Aluthge <dilum@aluthge.com> 30 August 2022, 13:02:21 UTC
fb19a0a Docs: Clarify docs of watch_file and watch_folder (#46523) This change adds additional information regarding the behavior of the functions "watch_file" and "watch_folder". Specifically, the use of events (as opposed to polling) is clarified. 30 August 2022, 11:12:58 UTC
fa90dc8 docs: LibGit2: use GitRepo constructor instead of init (#46442) init does not handle working trees, so the constructor must be used instead. 30 August 2022, 09:52:29 UTC
99340fe fix invalidations in REPLCompletions from Static.jl (#46494) 30 August 2022, 09:51:11 UTC
f9712f9 Allow redefinition of `invoke`d methods with new signatures (fixes #46503) (#46538) 30 August 2022, 01:21:10 UTC
ccf04c2 Improve the Core.Compiler.@show helper. (#46423) Add support for multiple arguments, returning the last value, just like how Base.@show works. 29 August 2022, 19:22:45 UTC
1fae1b9 fix invalidations in sort! from Static.jl (#46491) 29 August 2022, 19:21:59 UTC
6cd2a9d inference: handle `Union` with `TypeVar` properly within `isdefined_tfunc` (#46534) Improves the robustness of `isdefined_tfunc` when it splits `Union` with `TypeVar`s. Originally reported at <https://github.com/aviatesk/JET.jl/issues/379>. 29 August 2022, 16:45:30 UTC
431071b fix invalidations of REPL from HDF5.jl (#46486) 29 August 2022, 16:02:25 UTC
5c5af1f fix invalidations for Dicts from Static.jl (#46490) 29 August 2022, 15:49:08 UTC
91f068c Remove extra whitespace in `base/complex.jl` (#46532) 29 August 2022, 12:40:08 UTC
10961d1 Change description of underscore-only variables (#45964) * Change description of underscore-only variables Spawned by https://discourse.julialang.org/t/class-of-variables/83892 The rvalue/lvalue description does not seem benefitial. It confuse programmers that are not programming language nerds (it is a cool concept to learn, but this does not seem the place to learn it), and even programming language nerds may object. I for example, find kinda of a stretch to call `___` a lvalue because the linked wikipedia page says: > An l-value refers to an object that persists beyond a single expression. An r-value is a temporary value that does not persist beyond the expression that uses it.[3] Considering this description, the `___` matches more a rvalue than an lvalue (even if it is semantically a location and appear always in the left-hand side of an assignment). 29 August 2022, 09:40:45 UTC
6ba623e Add some more info to `Base.@irrational` (#46525) 29 August 2022, 09:19:14 UTC
72222d6 Docs: Remove static scheduling warning (#46519) The docs on multithreading still warns that the default scheduler for @threads uses static scheduling. However, since #44136, dynamic scheduling has been the default. This commit removes the warning. 29 August 2022, 09:16:56 UTC
c79b995 LinearAlgebra: Make kron with Diagonal matrices more efficient (#46463) Co-authored-by: Daniel Karrasch <daniel.karrasch@posteo.de> 29 August 2022, 09:09:29 UTC
f5db687 More specificity about the isreal(x) function (#46460) 29 August 2022, 09:05:23 UTC
b64743b Use Documenter 0.27.23 (#46516) 29 August 2022, 09:02:18 UTC
5e8e0a5 Fix union!(s::BitSet, r::AbstractUnitRange{<:Integer}) when two ranges do not overlap. (#45578) * Fix union!(s::BitSet, r::AbstractUnitRange{<:Integer}) when two ranges do not overlap. Resizing of BitSet should be filled with 0 by default. 29 August 2022, 07:27:51 UTC
3037c0a Try to fix FileWatching test more (#46524) I think the synchronization in #46028 was incomplete to actually fix the issue. Try to fix it by accounting the time taken to wait for the synchronization event into the lock time. Otherwise, the test pass/fail depends on the scheduler ordering. 29 August 2022, 03:06:56 UTC
5316549 Handle Vararg in PartialStruct fields in lattice ⊑ (#46515) This was an existing todo. While we're at it, also explicitly check the remaining cases where lattice elements survived all the way to the conservative fallback and remove it in preparation for some refactoring here. 28 August 2022, 21:02:52 UTC
6cdc4ce 🤖 Bump the SparseArrays stdlib from 78e48c3 to 91814c1 (#46513) Co-authored-by: Dilum Aluthge <dilum@aluthge.com> 28 August 2022, 02:32:11 UTC
293031b `AbstractInterpreter`: pass `InferenceResult` to `transform_result_for_cache` (#46488) This allows external `AbstractInterpreter`s to cache customized information more easily. 26 August 2022, 20:24:45 UTC
dfbb9c4 Add some examples for Task related functions and Examples cleanup (#46002) * Add some examples for Task related functions and Examples cleanup Co-authored-by: Fredrik Ekre <ekrefredrik@gmail.com> Co-authored-by: Viral B. Shah <ViralBShah@users.noreply.github.com> 26 August 2022, 18:53:31 UTC
316fc8c Information for specific operating system (#46438) * Information for specific operating system To not cause ambiguities, when a message is going to a specific operating system, say windows, its best to be spelled out explicitly if possible, so the reader on the docs can know what's happening, other than assuming with the prefix of `win`, one would immediately figure out its talking about windows. Co-authored-by: Kristoffer Carlsson <kcarlsson89@gmail.com> Co-authored-by: Viral B. Shah <ViralBShah@users.noreply.github.com> 26 August 2022, 18:51:15 UTC
3b81696 Fix ordering of headers so `#define _GNU_SOURCE` comes first (#46183) Co-authored-by: Kristoffer Carlsson <kcarlsson89@gmail.com> 26 August 2022, 16:49:43 UTC
98e1b13 fix type instability/invalidations from `nextind` (#46489) 26 August 2022, 13:38:28 UTC
ce6e9ee fix invalidations in logging (#46481) 26 August 2022, 13:37:16 UTC
c491e79 fix bug when error is infinite (#46436) 26 August 2022, 09:11:05 UTC
bea7b6f follow up the inlining unmatched type param PR (#46484) This commit follows up #45062: - eliminate closure capturing, and improve type stability a bit - refactor the test structure so that they are more aligned with the other parts of tests 26 August 2022, 04:25:54 UTC
19f44b6 Allow inlining methods with unmatched type parameters (#45062) 25 August 2022, 22:43:35 UTC
36aab14 IRShow: print invalid `SSAValue` in red (#46472) 25 August 2022, 10:17:38 UTC
c3d5009 Fix 3-arg `dot` for 1x1 structured matrices (#46473) 25 August 2022, 06:54:34 UTC
e7ef4b5 NFC simplifications on codegen.cpp (#46449) 24 August 2022, 19:51:51 UTC
dd375e1 `invoke`d calls: record invoke signature in backedges (#46010) This fixes a long-standing issue with how we've handled `invoke` calls with respect to method invalidation. When we load a package, we need to ask whether a given MethodInstance would be compiled in the same way now (aka, in the user's running session) as when the package was precompiled; in practice, the way we do that is to test whether the dispatches would be to the same methods in the current world-age. `invoke` presents special challenges because it allows the coder to deliberately select a different method than the one that would be chosen by ordinary dispatch; if there is no record of how this choice was made, it can look like it resolves to the wrong method and this can trigger invalidation. This allows a MethodInstance to store dispatch tuples as well as other MethodInstances among their backedges. Additionally: - provide backedge-iterators for both C and Julia that abstracts the specific storage mechanism. - fix a bug in the CodeInstance `relocatability` field, where methods that only return a constant (and hence store `nothing` for `inferred`) were deemed non-relocatable. - fix a bug in which #43990 should have checked that the method had not been deleted. Tests passed formerly simply because we weren't caching external CodeInstances that inferred down to a `Const`; fixing that exposed the bug. This bug has been exposed since merging #43990 for non-`Const` inference, and would affect Revise etc. Co-authored-by: Jameson Nash <vtjnash@gmail.com> 24 August 2022, 19:31:51 UTC
3b1c54d Consistently use `RUNPATH` in our libraries (#46464) * Consistently use `RUNPATH` in our libraries When loading dependencies on Linux, we can either use `RPATH` or `RUNPATH` as a list of relative paths to search for libraries. The difference, for our purposes, mainly lies within how this interacts with `LD_LIBRARY_PATH`: `RPATH` is searched first, then `LD_LIBRARY_PATH`, then `RUNPATH`. So by using `RUNPATH` here, we are explicitly allowing ourselves to be overridden by `LD_LIBRARY_PATH`. This is fine, as long as we are consistent across our entire library line, however in the `v1.8.0` release, there was an inconsistency, reported in [0]. The inconsistency occured because of the following confluence of factors: - Ancient `ld` builds (such as the one used in our build environment) do not default to using `RUNPATH`, but instead use `RPATH`. - `patchelf`, when it rewrites the RPATH, will default to using `RUNPATH` instead. - We were only using `patchelf` on `libjulia-internal`, not on `libjulia-codegen`, which was newly added in `v1.8`. These three factors together caused us to ship a binary with `RUNPATH` in `libjulia-internal`, but `RPATH` in `libjulia-codegen`, which caused loading to fail in [0] due to first `libjulia-internal` being loaded, (which brought in the external `libstdc++`), then `libjulia-codegen` failed to load (because it found an incompatible `libstdc++`), causing the mysterious compiler error. This PR fixes this twofold; first, when building the libraries in the first place, we pass `--enable-new-dtags` to the linker to encourage it to use `runpath` when possible. This removes the possibility for a missing `patchelf` invocation to break things in this way. Second, we apply `patchelf` properly to `libjulia-codegen` as well. [0] https://github.com/JuliaLang/julia/issues/46409 * Update Make.inc Co-authored-by: Mosè Giordano <giordano@users.noreply.github.com> Co-authored-by: Mosè Giordano <giordano@users.noreply.github.com> 24 August 2022, 15:38:20 UTC
8dde54d Specialize Diagonal * Matrix * Diagonal (#46400) 24 August 2022, 10:57:39 UTC
c876894 remove misleading comment (#46458) 24 August 2022, 02:21:13 UTC
f0b5556 Better error messages for getindex(::Number) (#46457) 23 August 2022, 21:25:29 UTC
18fa383 fix `Base.return_types` for direct builtin calls (#46443) This commit also changed this fragile test case ``` @test Base.return_types(Expr) == Any[Expr] ``` to ``` @test only(Base.return_types(Core._expr)) === Expr ``` since `Expr` is just a generic function and can be overloaded in the future (e.g. the JuliaSyntax.jl integration PR). 23 August 2022, 13:44:32 UTC
df3da05 implement `compilerbarrier` builtin (#46432) This builtin is useful to control compiler behavior. It could be considered as a more robust and generalized version of `inferencebarrier`. I scratched the following docstring for `compilerbarrier`, that hopefully explains its purpose. Base.compilerbarrier(setting::Symbol, val) This function puts a barrier at a specified compilation phase. It is supposed to only influence the compilation behavior according to `setting`, and its runtime semantics is just to return the second argument `val` (except that this function will perform additional checks on `setting` in a case when `setting` isn't known precisely at compile-time.) Currently either of the following `setting`s is allowed: - Barriers on abstract interpretation: * `:type`: the return type of this function call will be inferred as `Any` always (the strongest barrier on abstract interpretation) * `:const`: the return type of this function call will be inferred with widening constant information on `val` * `:conditional`: the return type of this function call will be inferred with widening conditional information on `val` (see the example below) - Any barriers on optimization aren't implemented yet !!! note This function is supposed to be used _with `setting` known precisely at compile-time_. Note that in a case when the `setting` isn't known precisely at compile-time, the compiler currently will put the most strongest barrier(s) rather than emitting a compile-time warning. \# Examples ```julia julia> Base.return_types((Int,)) do a x = compilerbarrier(:type, a) # `x` won't be inferred as `x::Int` return x end |> only Any julia> Base.return_types() do x = compilerbarrier(:const, 42) if x == 42 # no constant information here, so inference also accounts for the else branch return x # but `x` is still inferred as `x::Int` at least here else return nothing end end |> only Union{Nothing, Int64} julia> Base.return_types((Union{Int,Nothing},)) do a if compilerbarrier(:conditional, isa(a, Int)) # the conditional information `a::Int` isn't available here (leading to less accurate return type inference) return a else return nothing end end |> only Union{Nothing, Int64} ``` As a result, `Base.inferencebarrier` is now defined as ```julia inferencebarrier(@nospecialize(x)) = compilerbarrier(:type, x) ``` 23 August 2022, 05:19:59 UTC
80e50b5 Fix whitespace in timings.jl (#46439) 22 August 2022, 19:10:49 UTC
947c908 Fix multiplication of `AbstractQ`s (#46237) 22 August 2022, 15:53:08 UTC
baa85f4 See also `axes` from `eachindex`'s docstring, etc. (#45356) * mention pairs and axes in eachindex's docstring 22 August 2022, 15:49:12 UTC
99e8953 Fix `deepcopy` for `Base.GenericCondition` (#46406) 22 August 2022, 14:34:14 UTC
e0056c8 Fix `@time` compat description (#46416) 22 August 2022, 10:08:05 UTC
back to top