Skip to content

Commit dcc2038

Browse files
authored
Fixes for 1.13 (#693)
2 parents bdf390a + 534dd85 commit dcc2038

File tree

4 files changed

+26
-4
lines changed

4 files changed

+26
-4
lines changed

.github/workflows/Test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818
strategy:
1919
fail-fast: false
2020
matrix:
21-
version: ['1.10', '1.11', '1.12-nightly'] # nightly
21+
version: ['1.10', '1.11', '1.12-nightly', 'nightly']
2222
os: [ubuntu-latest, macOS-latest, windows-latest]
2323
arch: [x64]
2424
llvm_args: ['']

src/jlgen.jl

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -698,6 +698,26 @@ function compile_method_instance(@nospecialize(job::CompilerJob))
698698
cache_gbl = nothing
699699
end
700700

701+
if VERSION >= v"1.13.0-DEV.623"
702+
# Since Julia 1.13, the caller is responsible for initializing global variables that
703+
# point to global values or bindings with their address in memory.
704+
num_gvars = Ref{Csize_t}(0)
705+
@ccall jl_get_llvm_gvs(native_code::Ptr{Cvoid}, num_gvars::Ptr{Csize_t},
706+
C_NULL::Ptr{Cvoid})::Nothing
707+
gvs = Vector{Ptr{LLVM.API.LLVMOpaqueValue}}(undef, num_gvars[])
708+
@ccall jl_get_llvm_gvs(native_code::Ptr{Cvoid}, num_gvars::Ptr{Csize_t},
709+
gvs::Ptr{LLVM.API.LLVMOpaqueValue})::Nothing
710+
inits = Vector{Ptr{Cvoid}}(undef, num_gvars[])
711+
@ccall jl_get_llvm_gv_inits(native_code::Ptr{Cvoid}, num_gvars::Ptr{Csize_t},
712+
inits::Ptr{Cvoid})::Nothing
713+
714+
for (gv_ref, init) in zip(gvs, inits)
715+
gv = GlobalVariable(gv_ref)
716+
val = const_inttoptr(ConstantInt(Int64(init)), LLVM.PointerType())
717+
initializer!(gv, val)
718+
end
719+
end
720+
701721
if VERSION >= v"1.12.0-DEV.1703"
702722
# on sufficiently recent versions of Julia, we can query the MIs compiled.
703723
# this is required after the move to `invokce(::CodeInstance)`, because our

src/spirv.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,8 @@ end
5151
llvm_machine(::SPIRVCompilerTarget) = nothing
5252

5353
llvm_datalayout(::SPIRVCompilerTarget) = Int===Int64 ?
54-
"e-i64:64-v16:16-v24:32-v32:32-v48:64-v96:128-v192:256-v256:256-v512:512-v1024:1024" :
55-
"e-p:32:32-i64:64-v16:16-v24:32-v32:32-v48:64-v96:128-v192:256-v256:256-v512:512-v1024:1024"
54+
"e-i64:64-v16:16-v24:32-v32:32-v48:64-v96:128-v192:256-v256:256-v512:512-v1024:1024-G1" :
55+
"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"
5656

5757

5858
## job

test/native.jl

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,9 @@ end
273273
@test !occursin("%safepoint", ir)
274274

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

279281
@testset "always_inline" begin

0 commit comments

Comments
 (0)