diff --git a/.github/workflows/Test.yml b/.github/workflows/Test.yml index f604816e..929fc4e2 100644 --- a/.github/workflows/Test.yml +++ b/.github/workflows/Test.yml @@ -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: [''] diff --git a/src/jlgen.jl b/src/jlgen.jl index 7982fcbb..f98780f8 100644 --- a/src/jlgen.jl +++ b/src/jlgen.jl @@ -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 diff --git a/src/spirv.jl b/src/spirv.jl index 30461f1d..2015125d 100644 --- a/src/spirv.jl +++ b/src/spirv.jl @@ -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 diff --git a/test/native.jl b/test/native.jl index 19a6297c..18217613 100644 --- a/test/native.jl +++ b/test/native.jl @@ -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