Skip to content

Fixes for 1.13 #693

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 5 commits into from
May 23, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/Test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
strategy:
fail-fast: false
matrix:
version: ['1.10', '1.11', '1.12-nightly'] # nightly
version: ['1.10', '1.11', '1.12-nightly', 'nightly']
os: [ubuntu-latest, macOS-latest, windows-latest]
arch: [x64]
llvm_args: ['']
Expand Down
20 changes: 20 additions & 0 deletions src/jlgen.jl
Original file line number Diff line number Diff line change
Expand Up @@ -698,6 +698,26 @@ function compile_method_instance(@nospecialize(job::CompilerJob))
cache_gbl = nothing
end

if VERSION >= v"1.13.0-DEV.623"
# Since Julia 1.13, the caller is responsible for initializing global variables that
# point to global values or bindings with their address in memory.
num_gvars = Ref{Csize_t}(0)
@ccall jl_get_llvm_gvs(native_code::Ptr{Cvoid}, num_gvars::Ptr{Csize_t},
C_NULL::Ptr{Cvoid})::Nothing
gvs = Vector{Ptr{LLVM.API.LLVMOpaqueValue}}(undef, num_gvars[])
@ccall jl_get_llvm_gvs(native_code::Ptr{Cvoid}, num_gvars::Ptr{Csize_t},
gvs::Ptr{LLVM.API.LLVMOpaqueValue})::Nothing
inits = Vector{Ptr{Cvoid}}(undef, num_gvars[])
@ccall jl_get_llvm_gv_inits(native_code::Ptr{Cvoid}, num_gvars::Ptr{Csize_t},
inits::Ptr{Cvoid})::Nothing

for (gv_ref, init) in zip(gvs, inits)
gv = GlobalVariable(gv_ref)
val = const_inttoptr(ConstantInt(Int64(init)), LLVM.PointerType())
initializer!(gv, val)
end
end

if VERSION >= v"1.12.0-DEV.1703"
# on sufficiently recent versions of Julia, we can query the MIs compiled.
# this is required after the move to `invokce(::CodeInstance)`, because our
Expand Down
4 changes: 2 additions & 2 deletions src/spirv.jl
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@ end
llvm_machine(::SPIRVCompilerTarget) = nothing

llvm_datalayout(::SPIRVCompilerTarget) = Int===Int64 ?
"e-i64:64-v16:16-v24:32-v32:32-v48:64-v96:128-v192:256-v256:256-v512:512-v1024:1024" :
"e-p:32:32-i64:64-v16:16-v24:32-v32:32-v48:64-v96:128-v192:256-v256:256-v512:512-v1024:1024"
"e-i64:64-v16:16-v24:32-v32:32-v48:64-v96:128-v192:256-v256:256-v512:512-v1024:1024-G1" :
"e-p:32:32-i64:64-v16:16-v24:32-v32:32-v48:64-v96:128-v192:256-v256:256-v512:512-v1024:1024-G1"


## job
Expand Down
4 changes: 3 additions & 1 deletion test/native.jl
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,9 @@ end
@test !occursin("%safepoint", ir)

ir = sprint(io->Native.code_llvm(io, identity, Tuple{Nothing}; entry_safepoint=true, optimize=false, dump_module=true))
@test occursin("%safepoint", ir)
@test occursin("%safepoint", ir) broken=(VERSION >= v"1.13.0-DEV.533")
# XXX: broken by JuliaLang/julia#57010,
# see https://github.com/JuliaLang/julia/pull/57010/files#r2079576894
end

@testset "always_inline" begin
Expand Down
Loading