From aa44483c6e895a7b54f033b2b264decdb89cd635 Mon Sep 17 00:00:00 2001 From: William Moses Date: Tue, 22 Oct 2024 16:39:58 -0700 Subject: [PATCH] Fix inlining for nightly (#2005) * Fix inlining for nightly * Update interpreter.jl --- src/compiler/interpreter.jl | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/src/compiler/interpreter.jl b/src/compiler/interpreter.jl index 937f61e77d..19337961f6 100644 --- a/src/compiler/interpreter.jl +++ b/src/compiler/interpreter.jl @@ -247,6 +247,7 @@ let # overload `inlining_policy` argtypes::Vector{Any}, ) end + @static if isdefined(Core.Compiler, :inlining_policy) @eval function Core.Compiler.inlining_policy($(sigs_ex.args...)) if info isa NoInlineCallInfo if info.kind === :primitive @@ -266,6 +267,27 @@ let # overload `inlining_policy` end return @invoke Core.Compiler.inlining_policy($(args_ex.args...)) end + else + @eval function Core.Compiler.src_inlining_policy($(sigs_ex.args...)) + if info isa NoInlineCallInfo + if info.kind === :primitive + @safe_debug "Blocking inlining for primitive func" info.tt + elseif info.kind === :inactive + @safe_debug "Blocking inlining due to inactive rule" info.tt + elseif info.kind === :frule + @safe_debug "Blocking inlining due to frule" info.tt + else + @assert info.kind === :rrule + @safe_debug "Blocking inlining due to rrule" info.tt + end + return nothing + elseif info isa AlwaysInlineCallInfo + @safe_debug "Forcing inlining for primitive func" info.tt + return src + end + return @invoke Core.Compiler.src_inlining_policy($(args_ex.args...)) + end + end end import Core.Compiler: