Skip to content

Commit

Permalink
make the .line and inlined_at fields in LineInfoNode Int32
Browse files Browse the repository at this point in the history
  • Loading branch information
KristofferC committed Mar 10, 2022
1 parent 8076517 commit 5d9a2f1
Show file tree
Hide file tree
Showing 8 changed files with 14 additions and 14 deletions.
6 changes: 3 additions & 3 deletions base/boot.jl
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,8 @@
# module::Module
# method::Symbol
# file::Symbol
# line::Int
# inlined_at::Int
# line::Int32
# inlined_at::Int32
#end

#struct GotoNode
Expand Down Expand Up @@ -408,7 +408,7 @@ eval(Core, quote
isa(f, String) && (f = Symbol(f))
return $(Expr(:new, :LineNumberNode, :l, :f))
end
LineInfoNode(mod::Module, @nospecialize(method), file::Symbol, line::Int, inlined_at::Int) =
LineInfoNode(mod::Module, @nospecialize(method), file::Symbol, line::Int32, inlined_at::Int32) =
$(Expr(:new, :LineInfoNode, :mod, :method, :file, :line, :inlined_at))
GlobalRef(m::Module, s::Symbol) = $(Expr(:new, :GlobalRef, :m, :s))
SlotNumber(n::Int) = $(Expr(:new, :SlotNumber, :n))
Expand Down
4 changes: 2 additions & 2 deletions base/compiler/ssair/inlining.jl
Original file line number Diff line number Diff line change
Expand Up @@ -316,10 +316,10 @@ function ir_inline_item!(compact::IncrementalCompact, idx::Int, argexprs::Vector
inline_cfg = spec.ir.cfg
linetable_offset::Int32 = length(linetable)
# Append the linetable of the inlined function to our line table
inlined_at = Int(compact.result[idx][:line])
inlined_at = compact.result[idx][:line]
topline::Int32 = linetable_offset + Int32(1)
coverage = coverage_enabled(def.module)
push!(linetable, LineInfoNode(def.module, def.name, def.file, Int(def.line), inlined_at))
push!(linetable, LineInfoNode(def.module, def.name, def.file, def.line, inlined_at))
oldlinetable = spec.ir.linetable
for oldline in 1:length(oldlinetable)
entry = oldlinetable[oldline]
Expand Down
2 changes: 1 addition & 1 deletion base/compiler/typeinfer.jl
Original file line number Diff line number Diff line change
Expand Up @@ -910,7 +910,7 @@ function typeinf_ext(interp::AbstractInterpreter, mi::MethodInstance)
tree.slotflags = fill(IR_FLAG_NULL, nargs)
tree.ssavaluetypes = 1
tree.codelocs = Int32[1]
tree.linetable = [LineInfoNode(method.module, method.name, method.file, Int(method.line), 0)]
tree.linetable = [LineInfoNode(method.module, method.name, method.file, method.line, Int32(0))]
tree.inferred = true
tree.ssaflags = UInt8[0]
tree.pure = true
Expand Down
8 changes: 4 additions & 4 deletions src/codegen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6344,7 +6344,7 @@ static std::pair<std::unique_ptr<Module>, jl_llvm_functions_t>
else if (jl_array_len(src->linetable) > 0) {
jl_value_t *locinfo = jl_array_ptr_ref(src->linetable, 0);
ctx.file = jl_symbol_name((jl_sym_t*)jl_fieldref_noalloc(locinfo, 2));
toplineno = jl_unbox_long(jl_fieldref(locinfo, 3));
toplineno = jl_unbox_int32(jl_fieldref(locinfo, 3));
}
if (ctx.file.empty())
ctx.file = "<missing>";
Expand Down Expand Up @@ -6997,15 +6997,15 @@ static std::pair<std::unique_ptr<Module>, jl_llvm_functions_t>
topinfo.inlined_at = 0;
topinfo.loc = topdebugloc;
for (size_t i = 0; i < nlocs; i++) {
// LineInfoNode(mod::Module, method::Any, file::Symbol, line::Int, inlined_at::Int)
// LineInfoNode(mod::Module, method::Any, file::Symbol, line::Int32, inlined_at::Int32)
jl_value_t *locinfo = jl_array_ptr_ref(src->linetable, i);
DebugLineTable &info = linetable[i + 1];
assert(jl_typeis(locinfo, jl_lineinfonode_type));
jl_module_t *module = (jl_module_t*)jl_fieldref_noalloc(locinfo, 0);
jl_value_t *method = jl_fieldref_noalloc(locinfo, 1);
jl_sym_t *filesym = (jl_sym_t*)jl_fieldref_noalloc(locinfo, 2);
info.line = jl_unbox_long(jl_fieldref(locinfo, 3));
info.inlined_at = jl_unbox_long(jl_fieldref(locinfo, 4));
info.line = jl_unbox_int32(jl_fieldref(locinfo, 3));
info.inlined_at = jl_unbox_int32(jl_fieldref(locinfo, 4));
assert(info.inlined_at <= i);
info.file = jl_symbol_name(filesym);
if (info.file.empty())
Expand Down
2 changes: 1 addition & 1 deletion src/jltypes.c
Original file line number Diff line number Diff line change
Expand Up @@ -2288,7 +2288,7 @@ void jl_init_types(void) JL_GC_DISABLED
jl_lineinfonode_type =
jl_new_datatype(jl_symbol("LineInfoNode"), core, jl_any_type, jl_emptysvec,
jl_perm_symsvec(5, "module", "method", "file", "line", "inlined_at"),
jl_svec(5, jl_module_type, jl_any_type, jl_symbol_type, jl_long_type, jl_long_type),
jl_svec(5, jl_module_type, jl_any_type, jl_symbol_type, jl_int32_type, jl_int32_type),
jl_emptysvec, 0, 0, 5);

jl_gotonode_type =
Expand Down
2 changes: 1 addition & 1 deletion src/method.c
Original file line number Diff line number Diff line change
Expand Up @@ -495,7 +495,7 @@ void jl_add_function_name_to_lineinfo(jl_code_info_t *ci, jl_value_t *name)
jl_value_t *file = jl_fieldref_noalloc(ln, 2);
lno = jl_fieldref(ln, 3);
inl = jl_fieldref(ln, 4);
jl_value_t *ln_name = (jl_is_long(inl) && jl_unbox_long(inl) == 0) ? name : jl_fieldref_noalloc(ln, 1);
jl_value_t *ln_name = (jl_is_int32(inl) && jl_unbox_int32(inl) == 0) ? name : jl_fieldref_noalloc(ln, 1);
rt = jl_new_struct(jl_lineinfonode_type, mod, ln_name, file, lno, inl);
jl_array_ptr_set(li, i, rt);
}
Expand Down
2 changes: 1 addition & 1 deletion stdlib/Serialization/src/Serialization.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1112,7 +1112,7 @@ function deserialize(s::AbstractSerializer, ::Type{Core.LineInfoNode})
method = mod
mod = Main
end
return Core.LineInfoNode(mod, method, deserialize(s)::Symbol, deserialize(s)::Int, deserialize(s)::Int)
return Core.LineInfoNode(mod, method, deserialize(s)::Symbol, deserialize(s)::Int32, deserialize(s)::Int32)
end

function deserialize(s::AbstractSerializer, ::Type{PhiNode})
Expand Down
2 changes: 1 addition & 1 deletion test/compiler/ssair.jl
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ end
# false, false, false, false
# ))
#
# NullLineInfo = Core.LineInfoNode(Main, Symbol(""), Symbol(""), 0, 0)
# NullLineInfo = Core.LineInfoNode(Main, Symbol(""), Symbol(""), Int32(0), Int32(0))
# Compiler.run_passes(ci, 1, [NullLineInfo])
# # XXX: missing @test
#end
Expand Down

0 comments on commit 5d9a2f1

Please sign in to comment.