Skip to content

Commit dd67487

Browse files
authored
Fixes #432 ... (#504)
* Fixes #432 ...
1 parent 2030a00 commit dd67487

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

src/interpret.jl

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,12 @@ function bypass_builtins(@nospecialize(recurse), frame, call_expr, pc)
196196
f = to_function(fargs[1])
197197
fmod = parentmodule(f)::Module
198198
if fmod === JuliaInterpreter.CompiledCalls || fmod === Core.Compiler
199-
return Some{Any}(Base.invokelatest(f, fargs[2:end]...))
199+
# Fixing https://github.com/JuliaDebug/JuliaInterpreter.jl/issues/432.
200+
@static if VERSION >= v"1.7.0"
201+
return Some{Any}(Base.invoke_in_world(get_world_counter(), f, fargs[2:end]...))
202+
else
203+
return Some{Any}(Base.invokelatest(f, fargs[2:end]...))
204+
end
200205
else
201206
return Some{Any}(f(fargs[2:end]...))
202207
end

test/interpret.jl

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -823,6 +823,16 @@ module ForInclude end
823823
@test JuliaInterpreter.finish_and_return!(Frame(ForInclude, ex), true) == 55
824824
end
825825

826+
@static if VERSION >= v"1.7.0"
827+
@testset "issue #432" begin
828+
function f()
829+
t = @ccall time()::Cint
830+
end
831+
@test @interpret(f()) !== 0
832+
@test @interpret(f()) !== 0
833+
end
834+
end
835+
826836
@testset "issue #385" begin
827837
using FunctionWrappers:FunctionWrapper
828838
@interpret FunctionWrapper{Int,Tuple{}}(()->42)

0 commit comments

Comments
 (0)