forked from JuliaLang/julia
-
Notifications
You must be signed in to change notification settings - Fork 0
New try #10
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
Open
adienes
wants to merge
136
commits into
master
Choose a base branch
from
new_try
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
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
Replace all uses of `ptrdiff_t slide` and `int64_t slide` with
`uint64_t`. If a JITted object is ever assigned an address in the upper
half of the address space on a platform with `sizeof(char *) = 4`, which
is quite common on 32-bit Linux, the following can happen:
In JITDebugInfoRegistry::registerJITObject, `SectionAddr -
SectionLoadAddr` is computed in uint64_t (ok), then cast to ptrdiff_t
(two's complement of the uint64_t version mod 2^32). This is apparently
implementation-defined behaviour rather than undefined.
Say SectionAddr = 0x1000UL, SectionLoadAddr = 0xe93b2000UL and size_t
pointer = 0xe93b20abU.
```
(ptrdiff_t)(SectionAddr - SectionLoadAddr)
== (ptrdiff_t)0xffffffff16c4f000
== 382005248
```
jl_DI_for_fptr implicitly converts the ptrdiff_t to int64_t:
```
(int64_t)382005248 == 382005248L
```
lookup_pointer adds `size_t pointer` to `int64_t slide`. Both are
converted to int64_t because it can represent every size_t:
```
(int64_t)0xe93b20abU + 382005248L == 3912966315L + 382005248L
== 4294971563L
```
This is converted back to uint64_t by makeAddress, resulting in an
address other than the 0x10ab we expected:
```
(uint64_t)4294971563L == 0x1000010abUL
```
It is easier to use uint64_t everywhere we need a difference, since they
avoid the problem of losing upper bits after sign extension and avoid
weird UB from signed overflow.
Cherry-picked from JuliaLang#60031.
[1] https://buildkite.com/julialang/julia-master/builds/52196/steps/canvas?sid=019a9d6f-14a6-4ffc-be19-f2f835d1e719
Resolves JuliaLang#50351 albeit with a bit of a hack. I deliberately left "The Julia REPL" alone (so it is still sorted under "REPL") as that felt more natural to me compared to sorting it under "Julia" but obviously this could easily be changed as well.
Fixes JuliaLang#53435 With this change, internal calculations may still throw an `OverflowError` even if the true result would not overflow, but I think this is better than the current behavior of returning the wrong result: ```julia-repl julia> (Int8(-128) + Int8(-81)im) // (Int8(-42) + Int8(63)im) ERROR: OverflowError: 63 * 3 overflowed for type Int8 Stacktrace: [1] throw_overflowerr_binaryop(op::Symbol, x::Int8, y::Int8) @ Base.Checked ./checked.jl:164 [2] checked_mul @ ./checked.jl:298 [inlined] [3] //(x::Complex{Int8}, y::Complex{Int8}) @ Base ./rational.jl:124 [4] top-level scope @ REPL[23]:1 julia> (-128 + -81im) // (-42 + 63im) 1//21 + 2//1*im ``` Simple benchmarks: ```julia using Chairmarks @b (rand(1:1000), complex(rand(1:1000), rand(1:1000))) x->//(x...) seconds=1 @b (complex(rand(1:1000), rand(1:1000)), complex(rand(1:1000), rand(1:1000))) x->//(x...) seconds=1 ``` master: 16.122 ns, 59.158 ns PR: 12.720 ns, 15.447 ns Edit: I added a suggestion from JuliaLang#60137 so now this PR also fixes JuliaLang#60137 and fixes JuliaLang#56245
…JuliaLang#60196) Reverts JuliaLang#60105. Nightly builds of aarch64-darwin Julia hang at startup on some systems, notably on GitHub Actions, making all nightly jobs timeout (after 6 hours...), see https://discourse.julialang.org/t/ci-testing-hangs-on-macos-nightly/133909 (I had previously reported this issue on Slack at https://julialang.slack.com/archives/CPWJ5DGG1/p1763055610279379). See also julia-actions/julia-runtest#155. The error message when the process receives a SIGTERM signal is ``` in expression starting at none:0 __psynch_cvwait at /usr/lib/system/libsystem_kernel.dylib (unknown line) unknown function (ip: 0x0) at (unknown file) __psynch_mutexwait at /usr/lib/system/libsystem_kernel.dylib (unknown line) unknown function (ip: 0x0) at (unknown file) Allocations: 1 (Pool: 1; Big: 0); GC: 0 ``` I can reliably reproduce it locally on a M1 box with MacOSX 12.6 21.6.0, I can provide more information as needed. I bisected the issue to JuliaLang#60105.
Fix JuliaLang#60152, which impacted both lowering implementations. `remove-argument-side-effects` assumed all `kw` arguments from a `parameters` block had already been dumped into the argument list, which is not true in some cases. In addition: - JuliaLowering hit a MethodError in the dumped-`kw` case regardless. There are other issues with `kw` which I'm ignoring in this PR (see JuliaLang#60162) - Delete some ancient history: `&` [used to be a valid argument](JuliaLang@a378b75#diff-5d79463faae0f7f19454c7f9888498d9f876082e258ab3efdca36a0ee64b0c87L72) head sometime in 2012 apparently!
…60198) There are very nice `(BEGIN|END)_UNICODE_OPS` kinds; they should be used! --- Ported from JuliaLang/JuliaSyntax.jl#404; thanks are due to @c42f for the notification and instructions on how to move this.
Hex float literals like `0x1p3 `should not be allowed to be followed by decimal digits or decimal points, as this creates confusing implicit multiplication that looks like a malformed literal. This change makes the parser reject expressions like 0x1p3.2 (previously parsed as 0x1p3 * 0.2) as invalid numeric constants, consistent with the existing restriction on juxtaposing hex integer literals. Fixes JuliaLang#60189. Written by Claude (obviously - since it's set as the author - trying out the new web thing). I figure this situation is rare enough and bad enough that we should just change this unconditionally across syntax versions, but if preferred, we could make use of syntax evolution for this (although we'd have to start versioning the lexer). Co-authored-by: Claude <noreply@anthropic.com>
Replaced findfirst with findlast in the findlast docstring example. Fixes JuliaLang#60172.
Stdlib: Distributed URL: https://github.com/JuliaLang/Distributed.jl Stdlib branch: master Julia branch: master Old commit: 661112e New commit: cd92195 Julia version: 1.14.0-DEV Distributed version: 1.11.0 (Does not match) Bump invoked by: @Keno Powered by: [BumpStdlibs.jl](https://github.com/JuliaLang/BumpStdlibs.jl) Diff: JuliaLang/Distributed.jl@661112e...cd92195 ``` $ git log --oneline 661112e..cd92195 cd92195 Fix tests when JULIA_DEPOT_PATH is set (JuliaLang#154) ``` Co-authored-by: Keno <1291671+Keno@users.noreply.github.com>
Progress towards issue JuliaLang#56922 by @LilithHafner. Turns out I didn't find many uses of `Array{T, 1}` or `Array{T, 2}` in `doc` or `base` that were "clearly" in need of being updated to `Vector` or `Matrix`. There are a bunch that can't be changed because they occur before `Vector` or `Matrix` are even defined. There are a couple borderline cases, and I may have overlooked some, but most I looked at felt like "I could change it to Vector or Matrix but I think there is a didactical point in using `Array` here. E.g. in the definition of `struct BitVector <: AbstractArray{Bool, 1}; end` I think the context makes it desirable to leave it at that instead of changing it to `Vector` -- but I admit this is subjective. There was more in `test`, though that's perhaps less important. All in all I think we could close JuliaLang#56922
As discussed in JuliaLang#54393, `codepoint(c)` should succeed for overlong encodings, and whenever `ismalformed(c)` returns `false`. This should be backwards compatible since it simply removes an error, and should be strictly faster than before since it merely removes a call to `Base.is_overlong_enc`. Also, `Base.ismalformed` and `Base.isoverlong` are declared `public` (but not yet exported) and are included in the manual, since they are referenced in the docstring of `codepoint` etcetera. I also made `Base.show_invalid` a `public` and documented function, since it is referenced from the `ismalformed` docs and is required by new implementations of `AbstractChar` types that support malformed data. Fixes JuliaLang#54343, closes JuliaLang#54393.
Parameterize Base64{En,De}codepipe to avoid abstract field type, and
avoid the use of a mutating closure to avoid boxing a variable.
This should address the `# TODO` item in JuliaLang#57550. Unconditionally indexing `DataTypeFieldDesc(dt::DataType)[fidx]` will error when `dt` has no layout because we define ```julia struct DataTypeFieldDesc dt::DataType function DataTypeFieldDesc(dt::DataType) dt.layout == C_NULL && throw(UndefRefError()) new(dt) end end ``` For all the `DataType`s I could find, they only had `dt.layout == C_NULL` if `!isconcretetype(dt)`, so maybe it would be preferable to check if they're `!isconcretetype` rather than checking if `dt.layout == C_NULL`, but I figured it'd be safer to just mimic the validation logic in `DataTypeFieldDesc` instead. --------- Co-authored-by: Shuhei Kadowaki <aviatesk@gmail.com> Co-authored-by: James Wrigley <JamesWrigley@users.noreply.github.com>
I'm assuming this macro (which is defined as "go find the file or REPL history entry this Expr came from and re-parse the text to SyntaxTree") is mostly for convenience in interactive environments. It's also breakable at precompile time with changes in the way we expand `quote`, and it takes a noticable amount of time in inference. This change just uses the less-convenient `@ast` form like the rest of the project.
…uliaLang#60168) Evaluating a macro's name should be done in the same world we pass into lowering and use for expansion. Fix this for all reasonable macro names. The lowering iterator (currently very cold code only used for module/toplevel expressions that JuliaLowering "controls") also needs to update the expansion world between steps.
JuliaLang#60226) This is required to get Dates pre-compiling with JuliaLowering.
…ager/JuliaLang#60105) (JuliaLang#60230) Apple ARM CPUs treat the `ic ivau` as a memory read, which causes a confusing crash in DualMapAllocator if we try using it on a `wr_addr` that has been mprotected to `Prot::NO`, since we are still holding the allocator lock. For Apple aarch64 systems with SIP disabled, this will result in some memory savings, since DualMapAllocator will now work there. Like before, other JITLink platforms, namely Linux aarch64 and RISC-V, will benefit too. This re-lands JuliaLang#60105, after it was reverted in JuliaLang#60196. Thanks @giordano!
Fix JuliaLang#59786 Many of these links do not even exist and are broken. But even then, it is simply not the right place for such deep dive content. Co-authored-by: Viral B. Shah <ViralBShah@users.noreply.github.com>
…uliaLang#60233) Pass `expr_compat_mode` through to `GeneratedFunctionStub`. You can get surprisingly far into the stdlibs without testing this! Also reduce the IR printing I mentioned being an issue in JuliaLang#60226, which tests that we're keeping the whole green tree the same.
Stdlib: Pkg URL: https://github.com/JuliaLang/Pkg.jl.git Stdlib branch: master Julia branch: master Old commit: 2141bf17f New commit: 1e90f07f9 Julia version: 1.14.0-DEV Pkg version: 1.14.0 Bump invoked by: @IanButterworth Powered by: [BumpStdlibs.jl](https://github.com/JuliaLang/BumpStdlibs.jl) Diff: JuliaLang/Pkg.jl@2141bf1...1e90f07 ``` $ git log --oneline 2141bf17f..1e90f07f9 1e90f07f9 Fix is_stdlib uses when julia_version is used (JuliaLang#4534) 3f0c20ec7 Ensure `@stdlib` is on `LOAD_PATH` for `.pkg/` hooks (JuliaLang#3167) eaaecc75b Bump actions/checkout from 5 to 6 in the all-actions group (JuliaLang#4530) 56e16ea22 Fix more test cases for base CI (JuliaLang#4531) 0369c9363 Isolate more tests (JuliaLang#4528) 3bc7bff5c Propagate syntax version from Project to Manifest (JuliaLang#4520) 77db067f8 Publicize `Apps` (JuliaLang#4524) f370106a4 CI: Fix duplicate CI jobs on backports PRs (JuliaLang#4521) 1918a7624 ensure REPLExt is precompiled before we disallow it (JuliaLang#4517) 901e5f0f2 finish deprecating collect_delay (JuliaLang#4516) 854ac75ed Use `Sys.STDLIB` instead of hardcoding path to Julia stdlib (JuliaLang#4515) 0c7013bfa Fix some tests when run in base (JuliaLang#4499) 31ae9601a fix: work around string indexing issues in windows drive letter detection bf67f6342 test: isolate more tests that call subprocesses (JuliaLang#4504) 7302e1960 avoid some overhead from Tar.jl when unpacking the registry (JuliaLang#4505) 101997edf keep using gzip on Windows for the registry (JuliaLang#4496) db3e6f0b4 use the same value of `--check-bounds` as the process (JuliaLang#4494) e0af33508 only propagate paths in sources for fixed packages if they actually exist (JuliaLang#4503) d3c44751b Fix formatting of warning admonition (JuliaLang#4498) 10fc1126a show the original libgit2 error message which includes the `insteadOf` url (JuliaLang#4501) 7874cbd4f Merge pull request JuliaLang#4500 from JuliaLang/kc/substring 88a46e68f fix building packages on app add (JuliaLang#4491) 87a86dcfc use shallow clones for registry/packages (when supported by LibGit2) (JuliaLang#4487) efe1eaf7a stop "uncompressing" registry data (JuliaLang#4470) ca5b0896a Improve docs for test-specific deps with workspace approach (JuliaLang#4490) c1fee0e60 fix relative paths in Apps for dev (JuliaLang#4481) e6b1d0b24 Bump version from 1.13.0 to 1.14.0 (JuliaLang#4485) ``` Co-authored-by: IanButterworth <1694067+IanButterworth@users.noreply.github.com>
This dep locally compiles code by default, so it seems reasonable to clean it up with `make cleanall`. This change makes switching back and forth from a cross-compiled `x86_64-w64-mingw32` <-> native Linux build possible with `make cleanall`, instead of `make distcleanall`.
…ul types (JuliaLang#60388) This makes a few related improvements to on-stack struct layout: - Declaring that the on-stack format is the same layout as the on-heap format, allowing more zero-copy uses (esp of arguments) - Removing trailing pointers from the on-stack format, since they don't change the pointer or layout - Lazily load roots from where they already live on the stack in some frame. This is particularly impactful when calling a method and just forwarding the arguments, as it avoids an intermediate stack copy. Seemed to make the code text much smaller (about 5%) though doesn't appear to make much difference in nanosoldier benchmarks.
…ng#60403) Brings over JuliaLang/JuliaSyntax.jl#601 here now that the repo has moved. But we need this on 1.13 (and 1.12) as well. Without this the REPL becomes very laggy after loading GLMakie: ``` #= 3586.0 ms =# precompile(Tuple{typeof(REPL.LineEdit.refresh_multi_line), Base.Terminals.TerminalBuffer, Base.Terminals.UnixTerminal, Union{REPL.LineEdit.PrefixSearchState, REPL.LineEdit.PromptState}}) # recompile ``` Even though the function is directly called in the function body, I think the fact that there is a default argument prevents specialization from happening. To elaborate: ``` g(f, x=1) = f(..., x) ``` is rewritten internally as: ``` g(f, x) = f(..., x) g(f) = g(f, 1) ``` now, the second generated method does not call `f` directly so it will heuristically be despecialized. Co-authored-by: James Wrigley <JamesWrigley@users.noreply.github.com>
Very trivial change, but this is enough to get Statistics precompiling. I also confirmed that we see the expected performance delta on our [performance-tips example](https://docs.julialang.org/en/v1/manual/performance-tips/#man-performance-annotations): ```julia julia> timeit(1000, 1000) GFlop/sec = 3.918357111230404 GFlop/sec (SIMD) = 39.943280541630884 ```
Another easy fix, which should get `SparseArrays` up and running.
This is one of the rare locations where lowering needs to do string manipulation with non-ASCII strings, which can be very subtle since in Julia strings are indexed by byte for fast random access.
Also add tests for `inbounds`
This is a typo from JuliaLang#58344
Fixed `method_ir_ci` typo in the `abstract_invoke`.
…uliaLang#60433) The stack canary symbol is defined in libc on FreeBSD, so we can import it there like we do on macOS. Also, set `HAVE_SSP` because we have SSP.
The masking `& 1` was added to remove unused upper bits in `Bool`s. However, since then, Julia have decided that constructing booleans with bitpatterns other than 0b0 and 0b1 is undefined behaviour, and codegen now inserts these masks when loading booleans from memory. Therefore, they are redundant. See JuliaLang#60425
Co-authored-by: Lilith Orion Hafner <lilithhafner@gmail.com>
The README already references CONTRIBUTING.md, but the entry point for new contributors is easy to miss. This PR adds a small, dedicated “Contributing” section to improve discoverability, without duplicating existing documentation or changing contribution rules.
User xiaoxi originally reported some cases on [Discourse](https://discourse.julialang.org/t/possible-error-on-julia-documentation-page/134585). I found some more cases using a simple script: ```julia function checkfile(path) inside = false for (i, line) in enumerate(eachline(path)) if startswith(line, "!!!") inside = true elseif inside if startswith(line, "\"\"\"") inside = false elseif all(isspace, line) inside = false else indentation = line[begin:begin + 3] if !all(isspace, indentation) println("$path L$i wrong indentation: ", indentation) end end end end end function (@main)(args=ARGS) path = first(args) for (path, dirs, files) in walkdir(path) for file in files if endswith(file, ".jl") || endswith(file, ".md") checkfile(joinpath(path, file)) end end end end ```
In various packages I am JETing, I see the same error being reported: > local variable `pp` may be undefined: pp::Base.Process This patch helps JET proof that there is no actual problem. Would be kinda nice to see this backported to 1.12 so that if I run JET with 1.12.4 this is not reported anymore. And of course also to 1.13.
…!` (JuliaLang#60453) > local variable `msk_d1` may be undefined: msk_d1::UInt64 The code logic was actually right, but by transforming the code, JET can also see it (and arguably it is now also easier for a human to see that everything is correct)
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.