Skip to content

Fixes #432 ... #504

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 12 commits into from
Mar 14, 2022
7 changes: 6 additions & 1 deletion src/interpret.jl
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,12 @@ function bypass_builtins(@nospecialize(recurse), frame, call_expr, pc)
f = to_function(fargs[1])
fmod = parentmodule(f)::Module
if fmod === JuliaInterpreter.CompiledCalls || fmod === Core.Compiler
return Some{Any}(Base.invokelatest(f, fargs[2:end]...))
# Fixing https://github.com/JuliaDebug/JuliaInterpreter.jl/issues/432.
@static if VERSION >= v"1.7.0"
return Some{Any}(Base.invoke_in_world(get_world_counter(), f, fargs[2:end]...))
else
return Some{Any}(Base.invokelatest(f, fargs[2:end]...))
end
else
return Some{Any}(f(fargs[2:end]...))
end
Expand Down
10 changes: 10 additions & 0 deletions test/interpret.jl
Original file line number Diff line number Diff line change
Expand Up @@ -823,6 +823,16 @@ module ForInclude end
@test JuliaInterpreter.finish_and_return!(Frame(ForInclude, ex), true) == 55
end

@static if VERSION >= v"1.7.0"
@testset "issue #432" begin
function f()
t = @ccall time()::Cint
end
@test @interpret(f()) !== 0
@test @interpret(f()) !== 0
end
end

@testset "issue #385" begin
using FunctionWrappers:FunctionWrapper
@interpret FunctionWrapper{Int,Tuple{}}(()->42)
Expand Down