diff --git a/base/compiler/typeinfer.jl b/base/compiler/typeinfer.jl index d1a1fa5ff8e3f..7233cf62f6b93 100644 --- a/base/compiler/typeinfer.jl +++ b/base/compiler/typeinfer.jl @@ -1065,15 +1065,6 @@ N.B.: The same caching considerations as SOURCE_MODE_ABI apply. """ const SOURCE_MODE_FORCE_SOURCE = 0x2 -""" - SOURCE_MODE_FORCE_SOURCE_UNCACHED - -Like `SOURCE_MODE_FORCE_SOURCE`, but ensures that the resulting code instance is -not part of the cache hierarchy, so the `->inferred` field may be safely used -without the possibility of deletion by the compiler. -""" -const SOURCE_MODE_FORCE_SOURCE_UNCACHED = 0x3 - function ci_has_source(code::CodeInstance) inf = @atomic :monotonic code.inferred return isa(inf, CodeInfo) || isa(inf, String) @@ -1095,7 +1086,6 @@ function ci_meets_requirement(code::CodeInstance, source_mode::UInt8, ci_is_cach source_mode == SOURCE_MODE_NOT_REQUIRED && return true source_mode == SOURCE_MODE_ABI && return ci_has_abi(code) source_mode == SOURCE_MODE_FORCE_SOURCE && return ci_has_source(code) - source_mode == SOURCE_MODE_FORCE_SOURCE_UNCACHED && return (!ci_is_cached && ci_has_source(code)) return false end @@ -1108,7 +1098,7 @@ function typeinf_ext(interp::AbstractInterpreter, mi::MethodInstance, source_mod code = get(code_cache(interp), mi, nothing) if code isa CodeInstance # see if this code already exists in the cache - if source_mode in (SOURCE_MODE_FORCE_SOURCE, SOURCE_MODE_FORCE_SOURCE_UNCACHED) && use_const_api(code) + if source_mode == SOURCE_MODE_FORCE_SOURCE && use_const_api(code) code = codeinstance_for_const_with_code(interp, code) ccall(:jl_typeinf_timing_end, Cvoid, (UInt64,), start_time) return code @@ -1130,7 +1120,7 @@ function typeinf_ext(interp::AbstractInterpreter, mi::MethodInstance, source_mod end lock_mi_inference(interp, mi) result = InferenceResult(mi, typeinf_lattice(interp)) - frame = InferenceState(result, #=cache_mode=#source_mode == SOURCE_MODE_FORCE_SOURCE_UNCACHED ? :volatile : :global, interp) + frame = InferenceState(result, #=cache_mode=#:global, interp) frame === nothing && return nothing typeinf(interp, frame) ccall(:jl_typeinf_timing_end, Cvoid, (UInt64,), start_time) @@ -1149,14 +1139,13 @@ function typeinf_ext(interp::AbstractInterpreter, mi::MethodInstance, source_mod # store the source in the cache, but the caller wanted it anyway (e.g. for reflection). # We construct a new CodeInstance for it that is not part of the cache hierarchy. can_discard_trees = source_mode ≠ SOURCE_MODE_FORCE_SOURCE && - source_mode ≠ SOURCE_MODE_FORCE_SOURCE_UNCACHED && is_result_constabi_eligible(result) code = CodeInstance(interp, result; can_discard_trees) # If the caller cares about the code and this is constabi, still use our synthesis function # anyway, because we will have not finished inferring the code inside the CodeInstance once # we realized it was constabi, but we want reflection to pretend that we did. - if use_const_api(code) && source_mode in (SOURCE_MODE_FORCE_SOURCE, SOURCE_MODE_FORCE_SOURCE_UNCACHED) + if use_const_api(code) && source_mode == SOURCE_MODE_FORCE_SOURCE return codeinstance_for_const_with_code(interp, code) end @assert ci_meets_requirement(code, source_mode, false) diff --git a/src/julia_internal.h b/src/julia_internal.h index 2f7a971045251..6f71b6018606f 100644 --- a/src/julia_internal.h +++ b/src/julia_internal.h @@ -651,7 +651,6 @@ typedef union { #define SOURCE_MODE_NOT_REQUIRED 0x0 #define SOURCE_MODE_ABI 0x1 #define SOURCE_MODE_FORCE_SOURCE 0x2 -#define SOURCE_MODE_FORCE_SOURCE_UNCACHED 0x3 JL_DLLEXPORT jl_code_instance_t *jl_type_infer(jl_method_instance_t *li, size_t world, int force, uint8_t source_mode); JL_DLLEXPORT jl_code_info_t *jl_gdbcodetyped1(jl_method_instance_t *mi, size_t world);