From 3692e88ec47994d5ffad997e11947b348d5d8245 Mon Sep 17 00:00:00 2001 From: Tim Holy Date: Sun, 8 Sep 2019 08:13:03 -0500 Subject: [PATCH] Don't interpret methods calling iolock_begin (#335) This is a temporary workaround for #330 --- src/construct.jl | 4 +++- src/utils.jl | 2 ++ test/interpret.jl | 3 +++ 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/construct.jl b/src/construct.jl index 67ef747e1f2f4..9a6fa7a0f2c21 100644 --- a/src/construct.jl +++ b/src/construct.jl @@ -181,7 +181,9 @@ function prepare_framecode(method::Method, @nospecialize(argtypes); enter_genera end # Currenly, our strategy to deal with llvmcall can't handle parametric functions # (the "mini interpreter" runs in module scope, not method scope) - if !isempty(lenv) && (hasarg(isequal(:llvmcall), code.code) || hasarg(a->is_global_ref(a, Base, :llvmcall), code.code)) + if (!isempty(lenv) && (hasarg(isequal(:llvmcall), code.code) || + hasarg(a->is_global_ref(a, Base, :llvmcall), code.code))) || + hasarg(isequal(:iolock_begin), code.code) return Compiled() end framecode = FrameCode(method, code; generator=generator) diff --git a/src/utils.jl b/src/utils.jl index a7a3181c175a1..fc1245071eb46 100644 --- a/src/utils.jl +++ b/src/utils.jl @@ -95,6 +95,8 @@ function hasarg(predicate, args) hasarg(predicate, a.args) && return true elseif isa(a, QuoteNode) predicate(a.value) && return true + elseif isa(a, GlobalRef) + predicate(a.name) && return true end end return false diff --git a/test/interpret.jl b/test/interpret.jl index 731f0860ff756..1511710bf0ab1 100644 --- a/test/interpret.jl +++ b/test/interpret.jl @@ -585,3 +585,6 @@ module DataFramesTest end @test @interpret(df_debug1()) == df_debug1() end + +# issue #330 +@test @interpret(Base.PipeEndpoint()) isa Base.PipeEndpoint