stage2: move link.File.ELF.SrcFn field from Module.Fn to Module.Decl
SrcFn represents the function in the linked output file, if the `Decl` is a function. This is stored here and not in `Fn` because `Decl` survives across updates but `Fn` does not. TODO Look into making `Fn` a longer lived structure and moving this field there to save on memory usage.master
parent
0c598100d8
commit
9b3a70c8aa
|
@ -176,6 +176,13 @@ pub const Decl = struct {
|
|||
/// This is populated regardless of semantic analysis and code generation.
|
||||
link: link.File.Elf.TextBlock = link.File.Elf.TextBlock.empty,
|
||||
|
||||
/// Represents the function in the linked output file, if the `Decl` is a function.
|
||||
/// This is stored here and not in `Fn` because `Decl` survives across updates but
|
||||
/// `Fn` does not.
|
||||
/// TODO Look into making `Fn` a longer lived structure and moving this field there
|
||||
/// to save on memory usage.
|
||||
fn_link: link.File.Elf.SrcFn = link.File.Elf.SrcFn.empty,
|
||||
|
||||
contents_hash: std.zig.SrcHash,
|
||||
|
||||
/// The shallow set of other decls whose typed_value could possibly change if this Decl's
|
||||
|
@ -280,9 +287,6 @@ pub const Fn = struct {
|
|||
},
|
||||
owner_decl: *Decl,
|
||||
|
||||
/// Represents the function in the linked output file.
|
||||
link: link.File.Elf.SrcFn = link.File.Elf.SrcFn.empty,
|
||||
|
||||
/// This memory is temporary and points to stack memory for the duration
|
||||
/// of Fn analysis.
|
||||
pub const Analysis = struct {
|
||||
|
|
|
@ -1922,7 +1922,7 @@ pub const File = struct {
|
|||
// Now we have the full contents and may allocate a region to store it.
|
||||
|
||||
const debug_line_sect = &self.sections.items[self.debug_line_section_index.?];
|
||||
const src_fn = &typed_value.val.cast(Value.Payload.Function).?.func.link;
|
||||
const src_fn = &decl.fn_link;
|
||||
if (self.dbg_line_fn_last) |last| {
|
||||
if (src_fn.prev == null and src_fn.next == null) {
|
||||
// Append new function.
|
||||
|
|
Loading…
Reference in New Issue