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.
This commit is contained in:
Andrew Kelley
2020-08-03 22:22:47 -07:00
parent 0c598100d8
commit 9b3a70c8aa
2 changed files with 8 additions and 4 deletions

View File

@@ -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 {