Skip to content

Commit 5e878f0

Browse files
authored
CodeInstance: remove relocatability field (JuliaLang#56975)
This field lost its meaning awhile back and is better tracked only as part of the compressed CodeInfo instead of trying to accurately copy and update this field.
1 parent df90c4f commit 5e878f0

File tree

2 files changed

+6
-17
lines changed

2 files changed

+6
-17
lines changed

src/typeinfer.jl

Lines changed: 5 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,6 @@ function finish!(interp::AbstractInterpreter, caller::InferenceState)
120120
end
121121
inferred_result = nothing
122122
uncompressed = inferred_result
123-
relocatability = 0x1
124123
const_flag = is_result_constabi_eligible(result)
125124
discard_src = caller.cache_mode === CACHE_MODE_NULL || const_flag
126125
if !discard_src
@@ -139,22 +138,14 @@ function finish!(interp::AbstractInterpreter, caller::InferenceState)
139138
elseif ci.owner === nothing
140139
# The global cache can only handle objects that codegen understands
141140
inferred_result = nothing
142-
else
143-
relocatability = 0x0
144-
end
145-
if isa(inferred_result, String)
146-
t = @_gc_preserve_begin inferred_result
147-
relocatability = unsafe_load(unsafe_convert(Ptr{UInt8}, inferred_result), Core.sizeof(inferred_result))
148-
@_gc_preserve_end t
149141
end
150142
end
151-
# n.b. relocatability = !isa(inferred_result, String) || inferred_result[end]
152143
if !@isdefined di
153144
di = DebugInfo(result.linfo)
154145
end
155-
ccall(:jl_update_codeinst, Cvoid, (Any, Any, Int32, UInt, UInt, UInt32, Any, UInt8, Any, Any),
146+
ccall(:jl_update_codeinst, Cvoid, (Any, Any, Int32, UInt, UInt, UInt32, Any, Any, Any),
156147
ci, inferred_result, const_flag, first(result.valid_worlds), last(result.valid_worlds), encode_effects(result.ipo_effects),
157-
result.analysis_results, relocatability, di, edges)
148+
result.analysis_results, di, edges)
158149
engine_reject(interp, ci)
159150
if !discard_src && isdefined(interp, :codegen) && uncompressed isa CodeInfo
160151
# record that the caller could use this result to generate code when required, if desired, to avoid repeating n^2 work
@@ -176,7 +167,6 @@ end
176167
function finish!(interp::AbstractInterpreter, mi::MethodInstance, ci::CodeInstance, src::CodeInfo)
177168
user_edges = src.edges
178169
edges = user_edges isa SimpleVector ? user_edges : user_edges === nothing ? Core.svec() : Core.svec(user_edges...)
179-
relocatability = 0x1
180170
const_flag = false
181171
di = src.debuginfo
182172
rettype = Any
@@ -196,8 +186,8 @@ function finish!(interp::AbstractInterpreter, mi::MethodInstance, ci::CodeInstan
196186
end
197187
ccall(:jl_fill_codeinst, Cvoid, (Any, Any, Any, Any, Int32, UInt, UInt, UInt32, Any, Any, Any),
198188
ci, rettype, exctype, nothing, const_flags, min_world, max_world, ipo_effects, nothing, di, edges)
199-
ccall(:jl_update_codeinst, Cvoid, (Any, Any, Int32, UInt, UInt, UInt32, Any, UInt8, Any, Any),
200-
ci, nothing, const_flag, min_world, max_world, ipo_effects, nothing, relocatability, di, edges)
189+
ccall(:jl_update_codeinst, Cvoid, (Any, Any, Int32, UInt, UInt, UInt32, Any, Any, Any),
190+
ci, nothing, const_flag, min_world, max_world, ipo_effects, nothing, di, edges)
201191
code_cache(interp)[mi] = ci
202192
if isdefined(interp, :codegen)
203193
interp.codegen[ci] = src
@@ -523,7 +513,6 @@ function finishinfer!(me::InferenceState, interp::AbstractInterpreter)
523513
rettype_const = nothing
524514
const_flags = 0x0
525515
end
526-
relocatability = 0x1
527516
di = nothing
528517
edges = empty_edges # `edges` will be updated within `finish!`
529518
ci = result.ci
@@ -827,7 +816,7 @@ function codeinst_as_edge(interp::AbstractInterpreter, sv::InferenceState, @nosp
827816
end
828817
end
829818
ci = CodeInstance(mi, cache_owner(interp), Any, Any, nothing, nothing, zero(Int32),
830-
min_world, max_world, zero(UInt32), nothing, zero(UInt8), nothing, edges)
819+
min_world, max_world, zero(UInt32), nothing, nothing, edges)
831820
if max_world == typemax(UInt)
832821
# if we can record all of the backedges in the global reverse-cache,
833822
# we can now widen our applicability in the global cache too

test/abioverride.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ let world = Base.tls_world_age()
4646
#=owner=#SecondArgConstOverride(1), new_source.rettype, Any#=new_source.exctype is missing=#,
4747
#=inferred_const=#nothing, #=code=#nothing, #=const_flags=#Int32(0),
4848
new_source.min_world, new_source.max_world, #=new_source.ipo_purity_bits is missing=#UInt32(0),
49-
#=analysis_results=#nothing, #=not relocatable?=#UInt8(0), new_source.debuginfo, new_source.edges)
49+
#=analysis_results=#nothing, new_source.debuginfo, new_source.edges)
5050

5151
# Poke the CI into the global cache
5252
# This isn't necessary, but does conveniently give it the mandatory permanent GC-root before calling `invoke`

0 commit comments

Comments
 (0)