diff --git a/src/JET.jl b/src/JET.jl index 8fecedd9d..8a52b919a 100644 --- a/src/JET.jl +++ b/src/JET.jl @@ -24,94 +24,51 @@ Base.Experimental.@optlevel 1 const CC = Core.Compiler -# imports -# ======= - -# `AbstractAnalyzer` -import .CC: - #= cicache.jl =# - # get, getindex, haskey, push!, setindex!, - #= types.jl =# - InferenceParams, OptimizationParams, add_remark!, bail_out_call, bail_out_toplevel_call, - code_cache, get_inference_cache, lock_mi_inference, may_compress, may_discard_trees, - may_optimize, unlock_mi_inference, verbose_stmt_info, method_table, - #= inferenceresult.jl =# - cache_lookup, - #= inferencestate.jl =# - InferenceState, - #= tfuncs.jl =# - builtin_tfunction, return_type_tfunc, - #= abstractinterpretation.jl =# - abstract_call_known, abstract_call_gf_by_type, abstract_call_method, - abstract_call_method_with_const_args, abstract_eval_value_expr, abstract_eval_special_value, - abstract_eval_statement, abstract_eval_value, abstract_invoke, add_call_backedges!, - concrete_eval_call, concrete_eval_eligible, from_interprocedural!, - #= typeinfer.jl =# - _typeinf, finish!, finish, transform_result_for_cache, typeinf, typeinf_edge, - #= optimize.jl =# - inlining_policy - -# `ConcreteInterpreter` -import JuliaInterpreter: evaluate_call_recurse!, handle_err, step_expr! - -# Test.jl integration -import Test: record - # usings # ====== -using Core: - Argument, Builtin, CodeInfo, CodeInstance, Const, GlobalRef, GotoIfNot, GotoNode, - IntrinsicFunction, Intrinsics, LineInfoNode, MethodInstance, MethodMatch, MethodTable, - ReturnNode, SSAValue, SimpleVector, SlotNumber, svec +using Core: Builtin, IntrinsicFunction, Intrinsics, SimpleVector, svec + +using Core.IR using .CC: @nospecs, βŠ‘, - AbstractInterpreter, ArgInfo, BasicBlock, Bottom, CFG, CachedMethodTable, CallMeta, - ConstCallInfo, InferenceResult, InternalMethodTable, InvokeCallInfo, LimitedAccuracy, - MethodCallResult, MethodLookupResult, MethodMatchInfo, MethodMatches, NOT_FOUND, - OptimizationState, OverlayMethodTable, StmtInfo, UnionSplitInfo, UnionSplitMethodMatches, - VarState, VarTable, WorldRange, WorldView, - argextype, argtype_by_index, argtype_tail, argtypes_to_type, compute_basic_blocks, - get_compileable_sig, hasintersect, has_free_typevars, ignorelimited, inlining_enabled, - instanceof_tfunc, is_inlineable, is_throw_call, isType, isconstType, issingletontype, - istopfunction, may_invoke_generator, singleton_type, slot_id, specialize_method, - switchtupleunion, tmerge, widenconst + AbstractInterpreter, AbstractLattice, ArgInfo, Bottom, CFG, CachedMethodTable, CallMeta, + ConstCallInfo, InferenceParams, InferenceResult, InferenceState, InternalMethodTable, + InvokeCallInfo, MethodCallResult, MethodMatchInfo, MethodMatches, NOT_FOUND, + OptimizationState, OptimizationParams, OverlayMethodTable, StmtInfo, UnionSplitInfo, + UnionSplitMethodMatches, VarState, VarTable, WorldRange, WorldView, + argextype, argtype_by_index, argtypes_to_type, hasintersect, ignorelimited, + instanceof_tfunc, istopfunction, singleton_type, slot_id, specialize_method, + tmeet, tmerge, typeinf_lattice, widenconst, widenlattice -using Base: IdSet +using Base: IdSet, get_world_counter -using Base.Meta: ParseError, _parse_string, isexpr, lower +using Base.Meta: ParseError, isexpr, lower using Base.Experimental: @MethodTable, @overlay -using LoweredCodeUtils, JuliaInterpreter - -using LoweredCodeUtils: - #=NamedVar,=# add_control_flow!, #=add_named_dependencies!, add_requests!,=# - add_ssa_preds!, add_typedefs!, callee_matches, find_typedefs, ismethod, istypedef, - print_with_code, pushall!, rng +using LoweredCodeUtils: LoweredCodeUtils, callee_matches -using JuliaInterpreter: - @lookup, _INACTIVE_EXCEPTION, bypass_builtins, collect_args, #=finish!,=# - is_quotenode_egal, maybe_evaluate_builtin, moduleof +using JuliaInterpreter: _INACTIVE_EXCEPTION, Frame, JuliaInterpreter, is_quotenode_egal -using MacroTools: @capture, MacroTools, normalise, striplines +using MacroTools: @capture, normalise, striplines -using InteractiveUtils +using InteractiveUtils: gen_call_with_extracted_types_and_kwargs -using Pkg, Pkg.TOML +using Pkg: Pkg, TOML using Test: Broken, DefaultTestSet, Error, Fail, FallbackTestSet, FallbackTestSetException, Pass, Result, TESTSET_PRINT_ENABLE, Test, get_testset -using Preferences +using Preferences: Preferences # common # ====== const Argtypes = Vector{Any} -const JET_DEV_MODE = @load_preference("JET_DEV_MODE", false) +const JET_DEV_MODE = Preferences.@load_preference("JET_DEV_MODE", false) const CONFIG_FILE_NAME = ".JET.toml" @@ -139,9 +96,8 @@ end @static if VERSION β‰₯ v"1.11.0-DEV.1498" import .CC: get_inference_world - using Base: get_world_counter else - import .CC: get_world_counter, get_world_counter as get_inference_world + import .CC: get_world_counter as get_inference_world end # macros @@ -301,7 +257,7 @@ end function is_compileable_mi(mi::MethodInstance) def = mi.def isa(def, Method) || return false - return get_compileable_sig(def, mi.specTypes, mi.sparam_vals) !== nothing + return CC.get_compileable_sig(def, mi.specTypes, mi.sparam_vals) !== nothing end get_linfo(sv::State) = sv.linfo @@ -657,7 +613,7 @@ function analyze_gf_by_type!(analyzer::AbstractAnalyzer, @nospecialize(tt::Type{ end function find_single_match(@nospecialize(tt), analyzer::AbstractAnalyzer) - match = Base._which(tt; method_table=method_table(analyzer), world=get_inference_world(analyzer), raise=false) + match = Base._which(tt; method_table=CC.method_table(analyzer), world=get_inference_world(analyzer), raise=false) match === nothing && single_match_error(tt) return match end @@ -709,7 +665,7 @@ end function analyze_frame!(analyzer::AbstractAnalyzer, frame::InferenceState) set_entry!(analyzer, frame.linfo) - typeinf(analyzer, frame) + CC.typeinf(analyzer, frame) return analyzer, frame.result end @@ -1103,7 +1059,7 @@ function call_test_ex(funcname::Symbol, testname::Symbol, ex0, __module__, __sou end function _call_test_ex(funcname::Symbol, testname::Symbol, ex0, __module__, __source__) - analysis = InteractiveUtils.gen_call_with_extracted_types_and_kwargs(__module__, funcname, ex0) + analysis = gen_call_with_extracted_types_and_kwargs(__module__, funcname, ex0) orig_expr = QuoteNode(Expr(:macrocall, GlobalRef(@__MODULE__, testname), __source__, ex0...)) source = QuoteNode(__source__) testres = :(try diff --git a/src/abstractinterpret/typeinfer.jl b/src/abstractinterpret/typeinfer.jl index 4fe24c5f9..45b3cb02e 100644 --- a/src/abstractinterpret/typeinfer.jl +++ b/src/abstractinterpret/typeinfer.jl @@ -117,7 +117,7 @@ function analyze_additional_pass_by_type!(analyzer::AbstractAnalyzer, @nospecial # the threaded code block as a usual code block, and thus the side-effects won't (hopefully) # confuse the abstract interpretation, which is supposed to terminate on any kind of code match = find_single_match(tt, newanalyzer) - abstract_call_method(newanalyzer, match.method, match.spec_types, match.sparams, + CC.abstract_call_method(newanalyzer, match.method, match.spec_types, match.sparams, #=hardlimit=#false, #=si=#StmtInfo(false), sv) return nothing @@ -132,7 +132,7 @@ function CC.return_type_tfunc(analyzer::AbstractAnalyzer, argtypes::Argtypes, si oldresult = analyzer[result] init_result!(analyzer, result) newanalyzer = AbstractAnalyzer(analyzer) - ret = @invoke return_type_tfunc(newanalyzer::AbstractInterpreter, argtypes::Argtypes, si::StmtInfo, sv::InferenceState) + ret = @invoke CC.return_type_tfunc(newanalyzer::AbstractInterpreter, argtypes::Argtypes, si::StmtInfo, sv::InferenceState) analyzer[result] = oldresult return ret end @@ -166,7 +166,7 @@ CC.haskey(wvc::WorldView{<:AbstractAnalyzerView}, mi::MethodInstance) = haskey(A function CC.typeinf_edge(analyzer::AbstractAnalyzer, method::Method, @nospecialize(atype), sparams::SimpleVector, caller::InferenceState) set_cache_target!(analyzer, :typeinf_edge => caller.result) - ret = @invoke typeinf_edge(analyzer::AbstractInterpreter, method::Method, atype::Any, sparams::SimpleVector, caller::InferenceState) + ret = @invoke CC.typeinf_edge(analyzer::AbstractInterpreter, method::Method, atype::Any, sparams::SimpleVector, caller::InferenceState) @assert get_cache_target(analyzer) === nothing "invalid JET analysis state" return ret end @@ -274,7 +274,7 @@ function CC.cache_lookup(𝕃ᡒ::CC.AbstractLattice, mi::MethodInstance, given_ cache_target = get_cache_target(analyzer) set_cache_target!(analyzer, nothing) - inf_result = cache_lookup(𝕃ᡒ, mi, given_argtypes, get_inf_cache(view.analyzer)) + inf_result = CC.cache_lookup(𝕃ᡒ, mi, given_argtypes, get_inf_cache(view.analyzer)) isa(inf_result, InferenceResult) || return inf_result @@ -334,7 +334,7 @@ function CC.typeinf(analyzer::AbstractAnalyzer, frame::InferenceState) filter_lineages!(analyzer, (parent::InferenceState).result, linfo) end - ret = @invoke typeinf(analyzer::AbstractInterpreter, frame::InferenceState) + ret = @invoke CC.typeinf(analyzer::AbstractInterpreter, frame::InferenceState) # elapsed = round(time() - sec; digits = 3) # print_rails(io, depth) @@ -459,7 +459,7 @@ function CC._typeinf(analyzer::AbstractAnalyzer, frame::InferenceState) end end for caller in frames - finish!(#=CHANGED caller.interp=#analyzer, caller) + CC.finish!(#=CHANGED caller.interp=#analyzer, caller) if CC.is_cached(caller) CC.cache_result!(#=CHANGED caller.interp=#analyzer, caller.result) end @@ -540,7 +540,7 @@ function CC.transform_result_for_cache(analyzer::AbstractAnalyzer, end cache_report!(cache, report) end - inferred_result = @invoke transform_result_for_cache(analyzer::AbstractInterpreter, + inferred_result = @invoke CC.transform_result_for_cache(analyzer::AbstractInterpreter, linfo::MethodInstance, valid_worlds::WorldRange, result::InferenceResult) return CachedAnalysisResult(inferred_result, cache) end diff --git a/src/analyzers/jetanalyzer.jl b/src/analyzers/jetanalyzer.jl index d8e420825..c4eccf1c3 100644 --- a/src/analyzers/jetanalyzer.jl +++ b/src/analyzers/jetanalyzer.jl @@ -89,13 +89,6 @@ CC.may_optimize(::JETAnalyzer) = false CC.method_table(analyzer::JETAnalyzer) = analyzer.method_table -import .CC: - typeinf_lattice, ipo_lattice, widenlattice, is_valid_lattice_norec, - βŠ‘, tmerge, tmeet, _getfield_tfunc -using .CC: - AbstractLattice, InferenceLattice, MustAliasesLattice, InterMustAliasesLattice, - BaseInferenceLattice, IPOResultLattice - """ IntrinsicErrorCheckLattice <: AbstractLattice @@ -111,9 +104,9 @@ CC.is_valid_lattice_norec(::IntrinsicErrorCheckLattice, @nospecialize(elem)) = f @nospecs CC.:βŠ‘(𝕃::IntrinsicErrorCheckLattice, x, y) = βŠ‘(widenlattice(𝕃), x, y) @nospecs CC.tmerge(𝕃::IntrinsicErrorCheckLattice, x, y) = tmerge(widenlattice(𝕃), x, y) @nospecs CC.tmeet(𝕃::IntrinsicErrorCheckLattice, x, t::Type) = tmeet(widenlattice(𝕃), x, t) -@nospecs CC._getfield_tfunc(𝕃::IntrinsicErrorCheckLattice, xs...) = _getfield_tfunc(widenlattice(𝕃), xs...) -CC.typeinf_lattice(::JETAnalyzer) = InferenceLattice(IntrinsicErrorCheckLattice(MustAliasesLattice(BaseInferenceLattice.instance))) -CC.ipo_lattice(::JETAnalyzer) = InferenceLattice(IntrinsicErrorCheckLattice(InterMustAliasesLattice(IPOResultLattice.instance))) +@nospecs CC._getfield_tfunc(𝕃::IntrinsicErrorCheckLattice, xs...) = CC._getfield_tfunc(widenlattice(𝕃), xs...) +CC.typeinf_lattice(::JETAnalyzer) = CC.InferenceLattice(IntrinsicErrorCheckLattice(CC.MustAliasesLattice(CC.BaseInferenceLattice.instance))) +CC.ipo_lattice(::JETAnalyzer) = CC.InferenceLattice(IntrinsicErrorCheckLattice(CC.InterMustAliasesLattice(CC.IPOResultLattice.instance))) # AbstractAnalyzer API # ==================== @@ -249,7 +242,7 @@ function CC.from_interprocedural!(analyzer::JETAnalyzer, end """ - bail_out_call(analyzer::JETAnalyzer, ...) + Core.Compiler.bail_out_call(analyzer::JETAnalyzer, ...) This overload makes call inference performed by `JETAnalyzer` not bail out even when inferred return type grows up to `Any` to collect as much error reports as possible. @@ -261,7 +254,7 @@ CC.bail_out_call(::JETAnalyzer, ::CC.InferenceLoopState, ::InferenceState) = fal struct __DummyConcrete__ end """ - add_call_backedges!(analyzer::JETAnalyzer, ...) + Core.Compiler.add_call_backedges!(analyzer::JETAnalyzer, ...) An overload for `abstract_call_gf_by_type(analyzer::JETAnalyzer, ...)`, which always add backedges (even if a new method can't refine the return type grew up to `Any`). @@ -450,7 +443,7 @@ function (::SoundBasicPass)(::Type{GeneratorErrorReport}, analyzer::JETAnalyzer, m = mi.def::Method if isdefined(m, :generator) # analyze_method_instance!(analyzer, linfo) XXX doesn't work - may_invoke_generator(mi) || return false + CC.may_invoke_generator(mi) || return false try ccall(:jl_code_for_staged, Any, (Any,), mi) # invoke the "erroneous" generator again catch err @@ -544,9 +537,9 @@ function report_uncaught_exceptions!(analyzer::JETAnalyzer, frame::InferenceStat for (pc, stmt) in enumerate(stmts) isa(stmt, Expr) || continue @static if VERSION β‰₯ v"1.11.0-DEV.888" - is_throw_call(stmt, stmts) || continue + CC.is_throw_call(stmt, stmts) || continue else - is_throw_call(stmt) || continue + CC.is_throw_call(stmt) || continue end # if this `throw` is already reported, don't duplicate if !isnothing(reported_locs) && linetable[codelocs[pc]]::LineInfoNode in reported_locs @@ -674,7 +667,7 @@ function report_method_error_for_union_split!(analyzer::JETAnalyzer, for (i, matchinfo) in enumerate(info.matches) if is_empty_match(matchinfo) if isnothing(split_argtypes) - split_argtypes = switchtupleunion(typeinf_lattice(analyzer), argtypes) + split_argtypes = CC.switchtupleunion(typeinf_lattice(analyzer), argtypes) end argtypesβ€² = split_argtypes[i]::Vector{Any} if !sound && report_reduce_empty_error!(analyzer, sv, argtypesβ€²) @@ -688,7 +681,7 @@ function report_method_error_for_union_split!(analyzer::JETAnalyzer, push!(empty_matches[1], sig_n) elseif sound && !is_fully_covered(matchinfo) if isnothing(split_argtypes) - split_argtypes = switchtupleunion(typeinf_lattice(analyzer), argtypes) + split_argtypes = CC.switchtupleunion(typeinf_lattice(analyzer), argtypes) end argtypesβ€² = split_argtypes[i]::Vector{Any} if uncovered_matches === nothing @@ -778,7 +771,7 @@ function print_report_message(io::IO, (; argtypes)::InvalidInvokeErrorReport) return end - argtype = argtypes_to_type(argtype_tail(argtypes, 4)) + argtype = argtypes_to_type(CC.argtype_tail(argtypes, 4)) nargtype = typeintersect(types, argtype) @assert nargtype === Bottom print(io, "actual argument type `", argtype, "` doesn't intersect with specified argument type `", types, '`') @@ -1153,8 +1146,6 @@ end return ok end -import .CC: bitcast_tfunc, conversion_tfunc, math_tfunc, shift_tfunc, cmp_tfunc, chk_tfunc - @nospecs CC.bitcast_tfunc(𝕃::IntrinsicErrorCheckLattice, t, x) = with_conversion_errorcheck(t, x, #=bitshift=#true) @nospecs CC.conversion_tfunc(𝕃::IntrinsicErrorCheckLattice, t, x) = with_conversion_errorcheck(t, x) @nospecs CC.math_tfunc(𝕃::IntrinsicErrorCheckLattice, a, bs...) = with_intrinsic_errorcheck(widenconst(a), a, bs...) @@ -1273,11 +1264,11 @@ function report_fieldaccess!(analyzer::JETAnalyzer, sv::InferenceState, @nospeci isa(name, Const) || return false s = Base.unwrap_unionall(s00) - if isType(s) + if CC.isType(s) if f === fieldtype # XXX this is a hack to share more code between `getfield`/`setfield!`/`fieldtype` s00 = s = s.parameters[1] - elseif isconstType(s) + elseif CC.isconstType(s) s = (s00::DataType).parameters[1] else return false @@ -1448,7 +1439,7 @@ The [general configurations](@ref) and [the error analysis specific configuratio can be specified as an optional argument. """ macro report_call(ex0...) - return InteractiveUtils.gen_call_with_extracted_types_and_kwargs(__module__, :report_call, ex0) + return gen_call_with_extracted_types_and_kwargs(__module__, :report_call, ex0) end # Test.jl integration diff --git a/src/analyzers/optanalyzer.jl b/src/analyzers/optanalyzer.jl index f27489268..a939c163d 100644 --- a/src/analyzers/optanalyzer.jl +++ b/src/analyzers/optanalyzer.jl @@ -251,7 +251,7 @@ function CC.const_prop_call(analyzer::OptAnalyzer, nothing::Nothing) end -# TODO better to work only `finish!` +# TODO better to work only `CC.finish!` function CC.finish(frame::InferenceState, analyzer::OptAnalyzer) ret = @invoke CC.finish(frame::InferenceState, analyzer::AbstractAnalyzer) @@ -449,7 +449,7 @@ The [general configurations](@ref) and [the optimization analysis specific confi can be specified as an optional argument. """ macro report_opt(ex0...) - return InteractiveUtils.gen_call_with_extracted_types_and_kwargs(__module__, :report_opt, ex0) + return gen_call_with_extracted_types_and_kwargs(__module__, :report_opt, ex0) end """ diff --git a/src/toplevel/virtualprocess.jl b/src/toplevel/virtualprocess.jl index bf40dbb8e..ae98bbd67 100644 --- a/src/toplevel/virtualprocess.jl +++ b/src/toplevel/virtualprocess.jl @@ -510,8 +510,8 @@ end const VIRTUAL_MODULE_NAME = :JETVirtualModule -gen_virtual_module(root = Main; name = VIRTUAL_MODULE_NAME) = - Core.eval(root, :(module $(gensym(name)) end))::Module +gen_virtual_module(parent::Module = Main; name = VIRTUAL_MODULE_NAME) = + Core.eval(parent, :(module $(gensym(name)) end))::Module # NOTE when `@generated` function has been defined, signatures of both its entry and # generator should have been collected, and we will just analyze them separately @@ -534,7 +534,7 @@ function analyze_from_definitions!(analyzer::AbstractAnalyzer, res::VirtualProce match = Base._which(tt; # NOTE use the latest world counter with `method_table(analyzer)` unwrapped, # otherwise it may use a world counter when this method isn't defined yet - method_table=unwrap_method_table(method_table(analyzer)), + method_table=unwrap_method_table(CC.method_table(analyzer)), world=new_world, raise=false) if match !== nothing @@ -1037,13 +1037,13 @@ function partially_interpret!(interp::ConcreteInterpreter, mod::Module, src::Cod with_toplevel_logger(interp.config; filter=β‰₯(JET_LOGGER_LEVEL_DEBUG)) do @nospecialize(io) line, file = interp.lnn.line, interp.lnn.file println(io, "concretization plan at $file:$line:") - print_with_code(io, src, concretize) + LoweredCodeUtils.print_with_code(io, src, concretize) end # NOTE if `JuliaInterpreter.optimize!` may modify `src`, `src` and `concretize` can be inconsistent # here we create `JuliaInterpreter.Frame` by ourselves disabling the optimization (#277) frame = Frame(mod, src; optimize=false) - selective_eval_fromstart!(interp, frame, concretize, #=istoplevel=#true) + LoweredCodeUtils.selective_eval_fromstart!(interp, frame, concretize, #=istoplevel=#true) return concretize end @@ -1051,7 +1051,7 @@ end # select statements that should be concretized, and actually interpreted rather than abstracted function select_statements(src::CodeInfo) stmts = src.code - edges = CodeEdges(src) + edges = LoweredCodeUtils.CodeEdges(src) concretize = falses(length(stmts)) @@ -1064,8 +1064,8 @@ end function select_direct_requirement!(concretize, stmts, edges) for (i, stmt) in enumerate(stmts) - if (ismethod(stmt) || # don't abstract away method definitions - istypedef(stmt) || # don't abstract away type definitions + if (LoweredCodeUtils.ismethod(stmt) || # don't abstract away method definitions + LoweredCodeUtils.istypedef(stmt) || # don't abstract away type definitions ismoduleusage(stmt)) # module usages are handled by `ConcreteInterpreter` concretize[i] = true continue @@ -1132,18 +1132,18 @@ function select_dependencies!(concretize, src, edges) # We'll mostly use generic graph traversal to discover all the lines we need, # but structs are in a bit of a different category (especially on Julia 1.5+). # It's easiest to discover these at the beginning. - typedefs = find_typedefs(src) + typedefs = LoweredCodeUtils.find_typedefs(src) changed = true while changed changed = false # track SSA predecessors of initial requirements - changed |= add_ssa_preds!(concretize, src, edges, ()) + changed |= LoweredCodeUtils.add_ssa_preds!(concretize, src, edges, ()) # add some domain-specific information # TODO changed |= add_iterblocks!(concretized, src, edges, iterblocks) - changed |= add_typedefs!(concretize, src, edges, typedefs, ()) + changed |= LoweredCodeUtils.add_typedefs!(concretize, src, edges, typedefs, ()) end # find a loop region and check if any of the requirements discovered so far is involved @@ -1154,7 +1154,7 @@ function select_dependencies!(concretize, src, edges) # cycle dection (, whose worst time complexity is exponential with the number of vertices) # and thus the analysis here should terminate in reasonable time even with a fairly # complex control flow graph - cfg = compute_basic_blocks(src.code) + cfg = CC.compute_basic_blocks(src.code) loops = filter!(>(1)∘length, strongly_connected_components(cfg)) critical_blocks = BitSet() @@ -1182,7 +1182,7 @@ function select_dependencies!(concretize, src, edges) norequire = BitSet() for (i, block) in enumerate(cfg.blocks) if i βˆ‰ critical_blocks - pushall!(norequire, rng(block)) + LoweredCodeUtils.pushall!(norequire, LoweredCodeUtils.rng(block)) end end @@ -1191,8 +1191,8 @@ function select_dependencies!(concretize, src, edges) changed = false # track SSA predecessors and control flows of the critical blocks - changed |= add_ssa_preds!(concretize, src, edges, norequire) - changed |= add_control_flow!(concretize, cfg, norequire) + changed |= LoweredCodeUtils.add_ssa_preds!(concretize, src, edges, norequire) + changed |= LoweredCodeUtils.add_control_flow!(concretize, cfg, norequire) end end @@ -1216,9 +1216,10 @@ end function collect_toplevel_signature!(interp::ConcreteInterpreter, frame::Frame, @nospecialize(node)) if isexpr(node, :method, 3) sigs = node.args[2] - atype_params, sparams, #=linenode=#_ = @lookup(moduleof(frame), frame, sigs)::SimpleVector + atype_params, sparams, #=linenode=#_ = + JuliaInterpreter.@lookup(JuliaInterpreter.moduleof(frame), frame, sigs)::SimpleVector tt = form_method_signature(atype_params::SimpleVector, sparams::SimpleVector) - @assert !has_free_typevars(tt) "free type variable left in toplevel_signatures" + @assert !CC.has_free_typevars(tt) "free type variable left in toplevel_signatures" push!(interp.res.toplevel_signatures, tt) end return nothing @@ -1278,11 +1279,11 @@ end function JuliaInterpreter.evaluate_call_recurse!(interp::ConcreteInterpreter, frame::Frame, call_expr::Expr; enter_generated::Bool=false) # @assert !enter_generated pc = frame.pc - ret = bypass_builtins(interp, frame, call_expr, pc) + ret = JuliaInterpreter.bypass_builtins(interp, frame, call_expr, pc) isa(ret, Some{Any}) && return ret.value - ret = @invokelatest maybe_evaluate_builtin(frame, call_expr, false) + ret = @invokelatest JuliaInterpreter.maybe_evaluate_builtin(frame, call_expr, false) isa(ret, Some{Any}) && return ret.value - args = collect_args(interp, frame, call_expr) + args = JuliaInterpreter.collect_args(interp, frame, call_expr) f = popfirst!(args) # now it's really just `args` isinclude(f) && return handle_include(interp, f, args) if f === Base._ccallable @@ -1394,7 +1395,7 @@ function JuliaInterpreter.handle_err(interp::ConcreteInterpreter, frame, err) break end - # other general errors may happen at `collect_args`, etc. + # other general errors may happen at `JuliaInterpreter.collect_args`, etc. # we don't show any stacktrace for those errors (by keeping the original `i = 0`) # since they are hopefully self-explanatory continue @@ -1439,7 +1440,7 @@ end function report_syntax_errors!(res, s, filename) index = line = 1 while begin - ex, nextindex = _parse_string(s, filename, line, index, :statement) + ex, nextindex = Base.Meta._parse_string(s, filename, line, index, :statement) !isnothing(ex) end line += count(==('\n'), s[index:nextindex-1])