From 29981a8e6d0bab3fe3c22b8d34cd0a5aa1ef1dd2 Mon Sep 17 00:00:00 2001 From: Shuhei Kadowaki Date: Sat, 11 Sep 2021 15:18:54 +0900 Subject: [PATCH] update to https://github.com/JuliaLang/julia/pull/42125 --- src/Cthulhu.jl | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/Cthulhu.jl b/src/Cthulhu.jl index 34cb2882..a36203e5 100644 --- a/src/Cthulhu.jl +++ b/src/Cthulhu.jl @@ -13,6 +13,14 @@ using Core.Compiler: MethodMatch, LimitedAccuracy, ignorelimited const mapany = Base.mapany +# branch on https://github.com/JuliaLang/julia/pull/42125 +# TODO remove me once v1.7 is released +@static if isdefined(Base, Symbol("@constprop")) + import Base: @constprop +else + macro constprop(_, ex); esc(ex); end +end + Base.@kwdef mutable struct CthulhuConfig enable_highlighter::Bool = false highlighter::Cmd = `pygmentize -l` @@ -177,8 +185,8 @@ function codeinst_rt(code::CodeInstance) end end -# `Base.@aggressive_constprop` here in order to make sure the constant propagation of `allow_no_codeinf` -Base.@aggressive_constprop function lookup(interp::CthulhuInterpreter, mi::MethodInstance, optimize::Bool; allow_no_codeinf::Bool=false) +# `@constprop :aggressive` here in order to make sure the constant propagation of `allow_no_codeinf` +@constprop :aggressive function lookup(interp::CthulhuInterpreter, mi::MethodInstance, optimize::Bool; allow_no_codeinf::Bool=false) if !optimize codeinf = copy(interp.unopt[mi].src) rt = interp.unopt[mi].rt