From fe1c81c22433330a3af8212465eff5de27975fe7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ga=C3=ABtan=20LOUNES?= Date: Tue, 10 Dec 2024 03:09:35 +0100 Subject: [PATCH] remove ccall & struct, fix test GPU --- src/Compiler.jl | 7 ++----- test/basic.jl | 2 +- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/src/Compiler.jl b/src/Compiler.jl index ddbd1cb1e5..b9674c61a5 100644 --- a/src/Compiler.jl +++ b/src/Compiler.jl @@ -435,8 +435,7 @@ macro jit(args...) end is_a_module(s::Symbol)::Bool = begin - b = ccall(:jl_get_module_binding, Any, (Module, Symbol, Any), Main, s, 0) - isdefined(b, :value) && b.value isa Module + isdefined(@__MODULE__, s) && getproperty(@__MODULE__, s) isa Module end #create expression for more complex expression than a call @@ -449,9 +448,7 @@ function wrapped_expression(expr::Expr) return ( Expr(:tuple, args...), quote - struct $fname - ($fname)($(args...)) = $expr - end + ($fname)($(args...)) = $expr end, quote $(fname) diff --git a/test/basic.jl b/test/basic.jl index edc864cc88..b1b964416d 100644 --- a/test/basic.jl +++ b/test/basic.jl @@ -105,7 +105,7 @@ end x = Reactant.to_rarray(ones(3)) f(x) = x .+ 1 @test @jit(x + x - x + x * float(Base.pi) * 0) ≈ x - @test @jit(f(f(f(f(x))))) ≈ x .+ 4 + @test @jit(f(f(f(f(x))))) ≈ @allowscalar x .+ 4 end function sumcos(x)