aboutsummaryrefslogtreecommitdiff
path: root/src/Module.zig
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2021-07-07 00:39:23 -0700
committerAndrew Kelley <andrew@ziglang.org>2021-07-07 00:39:23 -0700
commit13f04e3012b6b2eee141923f9780fce55f7a999d (patch)
treefd8d164d7926d76a1e967b89283322ee6ad88bb0 /src/Module.zig
parentd481acc7dbebb5501b5fef608ee1f6b13c442c6a (diff)
downloadzig-13f04e3012b6b2eee141923f9780fce55f7a999d.tar.gz
zig-13f04e3012b6b2eee141923f9780fce55f7a999d.zip
stage2: implement `@panic` and beginnigs of inferred error sets
* ZIR: add two instructions: - ret_err_value_code - ret_err_value * AstGen: add countDefers and utilize it to emit more efficient ZIR for return expressions in the presence of defers. * AstGen: implement |err| payloads for `errdefer` syntax. - There is not an "unused capture" error for it yet. * AstGen: `return error.Foo` syntax gets a hot path in return expressions, using the new ZIR instructions. This also is part of implementing inferred error sets, since we need to tell Sema to add an error value to the inferred error set before it gets coerced. * Sema: implement `@setCold`. - Implement `@setCold` support for C backend. * `@panic` and regular safety panics such as `unreachable` now properly invoke `std.builtin.panic`. * C backend: improve pointer and function value rendering. * C linker: fix redundant typedefs. * Add Type.error_set_inferred. * Fix Value.format for enum_literal, enum_field_index, bytes. * Remove the C backend test that checks for identical text I measured a 14% reduction in Total ZIR Bytes from master branch for std/os.zig.
Diffstat (limited to 'src/Module.zig')
-rw-r--r--src/Module.zig4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/Module.zig b/src/Module.zig
index 1d715448da..c48440ccc2 100644
--- a/src/Module.zig
+++ b/src/Module.zig
@@ -755,6 +755,7 @@ pub const Fn = struct {
rbrace_column: u16,
state: Analysis,
+ is_cold: bool = false,
pub const Analysis = enum {
queued,
@@ -3453,6 +3454,9 @@ pub fn clearDecl(
for (decl.dependencies.keys()) |dep| {
dep.removeDependant(decl);
if (dep.dependants.count() == 0 and !dep.deletion_flag) {
+ log.debug("insert {*} ({s}) dependant {*} ({s}) into deletion set", .{
+ decl, decl.name, dep, dep.name,
+ });
// We don't recursively perform a deletion here, because during the update,
// another reference to it may turn up.
dep.deletion_flag = true;