-
-
Notifications
You must be signed in to change notification settings - Fork 5.6k
Backports release 1.12 #57955
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
Backports release 1.12 #57955
Conversation
@nanosoldier |
Should make the code less vulnerable to invalidation. (cherry picked from commit ed3fccc)
Fixes #57190 The fact that this passes thinks memcpy is a potential issue is quite annoying so it deserves a decent refactor, which flows through the type information from julia instead of trying to regenerate it on site, specially given that opaque pointers means we can't really instrospect into pointers at all (cherry picked from commit 2c7527b)
I've been a little frustrated with the IOBuffer code. It contains a whole bunch of implicit invariants, and is poorly commented. It also has several bugs that ultimately stems from the code being unclear about its own assumptions. This is a refactoring of IOBuffer. The primary goals are: * Comment the code more heavily * Test the code more thoroughly The secondary goals are * Fix a few outstanding bugs * Add some minor performance improvements This is a purely internal refactoring with be no change in behaviour of `IOBuffer`, except straight up bugfixes. However, note that previous code may have relied on buggy behaviour. Fixing bugs may therefore cause breakage. ## Current changes ### **BEHAVIOUR CHANGES** * The following code used to not throw an error, but now does: `IOBuffer(b"abc"; maxsize=2)`. I consider this a bugfix. It should not be possible to construct an IOBuffer with a buffersize larger than `maxsize`. * It used to be possible to write to indices higher than `maxindex`, which could trigger a bug causing data loss. The bug has been fixed, but as a result, some IOBuffers may reach full capacity faster (really: reach it at the correct point), changing writing behaviour. ### Bugfixes * Do not corrupt data on `copyline` on a non-appending buffer * Respect `maxsize` even after `take!` (fix #57549) * Fix bug when copying from an appending iobuffer to itself * Fix bug where re-allocating the buffer may cause it to shrink, discarding data. * Fix bug where `truncate` may throw a wrong BoundsError * Fix a bug where truncating a buffer may not correctly removed mark at position that has been deleted * Fix a bug where initializing an IOBuffer without an explicit buffer and with `truncate=false` makes it contain the full buffer * Current behaviour for `reset` and `position` did not work for `PipeBuffer`. Fix that ### Changes to brittle code * Removed some tests that explicitly tested internal code and internal behaviour. Some of that behaviour has changed. * Changed some internal `PipeBuffer` behaviour, which did not respect writable IOBuffer's ownership of their buffer and therefore failed spuriously ### Performance improvements * Writing to dense IOBuffer now uses memmove and is up to 10x faster for long writes. * Minor optimisations (about ten percent) for writing to IOBuffers in general Closes #57549 Co-authored-by: Jameson Nash <vtjnash@gmail.com> (cherry picked from commit 5419713)
…egen cache (#57272) Implements a way to add `CodeInstance`s compiled by external interpreters to JIT, such that they become legal targets for `invoke` calls. Based on a design proposed by @Keno, the `AbstractInterpreter` interface is extended to support providing a codegen cache that is filled during inference for future use with `add_codeinsts_to_jit!`. This allows `invoke(f, ::CodeInstance, args...)` to work on external interpreters, which is currently failing on `master` (see #57193). --------- Co-authored-by: Cédric Belmant <cedric.belmant@juliahub.com> (cherry picked from commit 9d2e9ed)
Helps avoids some code duplication and divergence of inference behaviors in some edge cases, also slightly more correct caching in some edge cases. (cherry picked from commit e7ff95d)
When pre-compiling `stdlib/` this cache has a 91% hit rate, so this seems fairly profitable. It also dramatically improves some pathological cases, a few of which have been hit in the wild (arguably due to inference bugs) Without this PR, this package takes exponentially long to pre-compile: ```julia function BigType(N) (N == 0) && return Nothing T = BigType(N-1) return Pair{T,T} end foo(::Type{T}) where T = T precompile(foo, (Type{BigType(40)},)) ``` For an in-the-wild test case hit by a customer, this reduces pre-compilation time from over an hour to just ~two and a half minutes. Resolves #53331. (cherry picked from commit 89271dc)
4533038
to
886d74b
Compare
The package evaluation job you requested has completed - possible new issues were detected. Report summary❗ Packages that crashed16 packages crashed only on the current version.
✖ Packages that failed506 packages failed only on the current version.
7 packages failed on the previous version too. ✔ Packages that passed tests2 packages passed tests only on the current version.
70 packages passed tests on the previous version too. |
886d74b
to
189359e
Compare
(cherry picked from commit 8fd3fb1)
Backported PRs:
macro
methods for pre-compilation #57833Compiler
:abstract_eval_invoke_inst
: type assertExpr
#57860Compiler
:walk_to_defs
,collect_leaves
: specialize forpredecessors
#57859Random
:show
method forMersenneTwister
: invalidation resistance #57913eachregion(::AnnotatedString)
implementation toBase
#57912Base
: shell escaping: inference improvement to prevent invalidation #57915_precompilepkgs
: interactive progress display: fix unintended capture #57932setglobal!
#57896type_in_worklist
query #57917Need manual backport:
reinit_ccallable
#56987Contains multiple commits, manual intervention needed:
Non-merged PRs with backport label:
oftype
#57951append_c_digits
: typeassertInt
to improve inference #57950string
(which is not always defined) #57925@nospecialize
macros #57782@nospecialize
forstring_index_err
#57604maxthreadid
fromThreads
#57490nextpow
,prevpow
for types withouttypemax
#49669