Skip to content

Commit

Permalink
Adapt to upstream changes to return_types (#312)
Browse files Browse the repository at this point in the history
* adapt to upstream changes to `Base.return_types`

Especially this commits adds the update corresponding to 
<JuliaLang/julia#44515>.

* Fix test.

* more update with backports

Co-authored-by: Tim Besard <tim.besard@gmail.com>
  • Loading branch information
aviatesk and maleadt authored Mar 16, 2022
1 parent 9afda49 commit 8dba144
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/jlgen.jl
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ end

if isdefined(Base.Experimental, Symbol("@overlay"))
using Core.Compiler: OverlayMethodTable
if VERSION >= v"1.9.0-DEV.120"
if v"1.8-beta2" <= VERSION < v"1.9-" || VERSION >= v"1.9.0-DEV.120"
Core.Compiler.method_table(interp::GPUInterpreter) =
OverlayMethodTable(interp.world, interp.method_table)
else
Expand Down
7 changes: 6 additions & 1 deletion src/validation.jl
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,12 @@ function check_method(@nospecialize(job::CompilerJob))
cache = ci_cache(job)
mt = method_table(job)
interp = GPUInterpreter(cache, mt, job.source.world)
rt = Base.return_types(job.source.f, job.source.tt, interp)[1]
@static if v"1.8-beta2" <= VERSION < v"1.9-" || VERSION v"1.9.0-DEV.190"
# https://github.com/JuliaLang/julia/pull/44515
rt = Base.return_types(job.source.f, job.source.tt; interp)[1]
else
rt = Base.return_types(job.source.f, job.source.tt, interp)[1]
end
if rt != Nothing
throw(KernelError(job, "kernel returns a value of type `$rt`",
"""Make sure your kernel function ends in `return`, `return nothing` or `nothing`.
Expand Down
2 changes: 1 addition & 1 deletion test/native.jl
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,7 @@ end

# Test ABI removal
ir = sprint(io->native_code_llvm(io, call_real, Tuple{ComplexF64}))
if VERSION < v"1.8-"
if VERSION < v"1.8-" || v"1.8-beta2" <= VERSION < v"1.9-" || VERSION v"1.9.0-DEV.190"
@test !occursin("alloca", ir)
else
@test_broken !occursin("alloca", ir)
Expand Down

0 comments on commit 8dba144

Please sign in to comment.