From 98072a0824d4c9e886d2f1a49030441f2a66e16d Mon Sep 17 00:00:00 2001 From: Shuhei Kadowaki Date: Mon, 20 Nov 2023 15:31:54 +0900 Subject: [PATCH] adjust to JuliaLang/julia#51754 --- src/abstractinterpret/typeinfer.jl | 8 +++++++- src/analyzers/jetanalyzer.jl | 8 +++++++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/src/abstractinterpret/typeinfer.jl b/src/abstractinterpret/typeinfer.jl index 0c5713201..18f94db81 100644 --- a/src/abstractinterpret/typeinfer.jl +++ b/src/abstractinterpret/typeinfer.jl @@ -639,7 +639,9 @@ function CC.abstract_eval_special_value(analyzer::AbstractAnalyzer, @nospecializ # in this call graph, but it's highly possible this is a toplevel callsite # and we take a risk here since we can't enter the analysis otherwise val = getglobal(mod, name) - @static if VERSION ≥ v"1.11.0-DEV.797" + @static if VERSION ≥ v"1.11.0-DEV.945" + ret = CC.RTEffects(isa(val, AbstractGlobal) ? val.t : Const(val), ret.exct, ret.effects) + elseif VERSION ≥ v"1.11.0-DEV.797" ret = CC.RTEffects(isa(val, AbstractGlobal) ? val.t : Const(val), ret.effects) else ret = isa(val, AbstractGlobal) ? val.t : Const(val) @@ -675,7 +677,11 @@ end function CC.abstract_eval_statement(analyzer::AbstractAnalyzer, @nospecialize(e), vtypes::VarTable, sv::InferenceState) if istoplevel(sv) if get_concretized(analyzer)[get_currpc(sv)] + @static if VERSION ≥ v"1.11.0-DEV.945" + return CC.RTEffects(Any, Any, CC.Effects()) # bail out if it has been interpreted by `ConcreteInterpreter` + else return Any # bail out if it has been interpreted by `ConcreteInterpreter` + end end end diff --git a/src/analyzers/jetanalyzer.jl b/src/analyzers/jetanalyzer.jl index 21943991f..d6d3ba13f 100644 --- a/src/analyzers/jetanalyzer.jl +++ b/src/analyzers/jetanalyzer.jl @@ -365,8 +365,13 @@ function CC.concrete_eval_eligible(analyzer::JETAnalyzer, @nospecialize(f), result::MethodCallResult, arginfo::ArgInfo, sv::InferenceState) if CC.is_nothrow(result.effects) neweffects = CC.Effects(result.effects; nonoverlayed=true) + @static if VERSION ≥ v"1.11.0-DEV.945" + newresult = MethodCallResult(result.rt, result.exct, result.edgecycle, result.edgelimited, + result.edge, neweffects) + else newresult = MethodCallResult(result.rt, result.edgecycle, result.edgelimited, result.edge, neweffects) + end res = @invoke CC.concrete_eval_eligible(analyzer::AbstractAnalyzer, f::Any, newresult::MethodCallResult, arginfo::ArgInfo, sv::InferenceState) @static if VERSION ≥ v"1.10.0-DEV.1345" @@ -453,8 +458,9 @@ end ret = @invoke CC.abstract_eval_basic_statement(analyzer::AbstractAnalyzer, stmt::Any, pc_vartable::VarTable, frame::InferenceState) if isexpr(stmt, :(=)) && (lhs = stmt.args[1]; isa(lhs, GlobalRef)) + rt = @static VERSION ≥ v"1.11.0-DEV.945" ? ret.rt : ret.type ReportPass(analyzer)(InvalidGlobalAssignmentError, analyzer, - frame, lhs.mod, lhs.name, ret.type) + frame, lhs.mod, lhs.name, rt) end return ret end