| author | |
| committer | |
| log | 9b3a70c8aab74b804cac0d7c15e4e7518a88c868 |
| tree | 34e835a80ed4d835356fb1402c049d9ad65c0699 |
| parent | 0c598100d8dbcf94fa8916a8aa5dcf5f55ef6d46 |
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.2 files changed, 8 insertions(+), 4 deletions(-)
src-self-hosted/Module.zig+7-3| ... | ... | @@ -176,6 +176,13 @@ pub const Decl = struct { |
| 176 | 176 | /// This is populated regardless of semantic analysis and code generation. |
| 177 | 177 | link: link.File.Elf.TextBlock = link.File.Elf.TextBlock.empty, |
| 178 | 178 | |
| 179 | /// Represents the function in the linked output file, if the `Decl` is a function. | |
| 180 | /// This is stored here and not in `Fn` because `Decl` survives across updates but | |
| 181 | /// `Fn` does not. | |
| 182 | /// TODO Look into making `Fn` a longer lived structure and moving this field there | |
| 183 | /// to save on memory usage. | |
| 184 | fn_link: link.File.Elf.SrcFn = link.File.Elf.SrcFn.empty, | |
| 185 | ||
| 179 | 186 | contents_hash: std.zig.SrcHash, |
| 180 | 187 | |
| 181 | 188 | /// The shallow set of other decls whose typed_value could possibly change if this Decl's |
| ... | ... | @@ -280,9 +287,6 @@ pub const Fn = struct { |
| 280 | 287 | }, |
| 281 | 288 | owner_decl: *Decl, |
| 282 | 289 | |
| 283 | /// Represents the function in the linked output file. | |
| 284 | link: link.File.Elf.SrcFn = link.File.Elf.SrcFn.empty, | |
| 285 | ||
| 286 | 290 | /// This memory is temporary and points to stack memory for the duration |
| 287 | 291 | /// of Fn analysis. |
| 288 | 292 | pub const Analysis = struct { |
src-self-hosted/link.zig+1-1| ... | ... | @@ -1922,7 +1922,7 @@ pub const File = struct { |
| 1922 | 1922 | // Now we have the full contents and may allocate a region to store it. |
| 1923 | 1923 | |
| 1924 | 1924 | const debug_line_sect = &self.sections.items[self.debug_line_section_index.?]; |
| 1925 | const src_fn = &typed_value.val.cast(Value.Payload.Function).?.func.link; | |
| 1925 | const src_fn = &decl.fn_link; | |
| 1926 | 1926 | if (self.dbg_line_fn_last) |last| { |
| 1927 | 1927 | if (src_fn.prev == null and src_fn.next == null) { |
| 1928 | 1928 | // Append new function. |