Skip to content

Commit

Permalink
Fixes #432 ... (#504)
Browse files Browse the repository at this point in the history
* Fixes #432 ...
  • Loading branch information
goerch authored Mar 14, 2022
1 parent 2030a00 commit dd67487
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
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

0 comments on commit dd67487

Please sign in to comment.