From b9e508c410cd077d704a73418281f6d7839df241 Mon Sep 17 00:00:00 2001 From: Andrew Kelley Date: Thu, 8 Apr 2021 11:29:31 -0700 Subject: stage2: revert to only has_decl and export ZIR support Reverting most of the code from the previous commits in this branch. Will pull in the code with modifications bit by bit. --- src/Module.zig | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) (limited to 'src/Module.zig') diff --git a/src/Module.zig b/src/Module.zig index dab3319b2e..933917d948 100644 --- a/src/Module.zig +++ b/src/Module.zig @@ -35,11 +35,8 @@ comp: *Compilation, zig_cache_artifact_directory: Compilation.Directory, /// Pointer to externally managed resource. `null` if there is no zig file being compiled. root_pkg: *Package, -/// This is populated when `@import("root")` is analysed. -root_scope: ?*Scope.File, -start_pkg: *Package, /// Module owns this resource. -start_scope: *Scope.File, +root_scope: *Scope.File, /// It's rare for a decl to be exported, so we save memory by having a sparse map of /// Decl pointers to details about them being exported. /// The Export memory is owned by the `export_owners` table; the slice itself is owned by this table. @@ -2344,9 +2341,7 @@ pub fn deinit(mod: *Module) void { mod.export_owners.deinit(gpa); mod.symbol_exports.deinit(gpa); - - mod.start_scope.destroy(gpa); - mod.start_pkg.destroy(gpa); + mod.root_scope.destroy(gpa); var it = mod.global_error_set.iterator(); while (it.next()) |entry| { @@ -2518,7 +2513,6 @@ fn astgenAndSemaDecl(mod: *Module, decl: *Decl) !bool { const block_expr = node_datas[decl_node].lhs; _ = try AstGen.comptimeExpr(&gen_scope, &gen_scope.base, .none, block_expr); - _ = try gen_scope.addBreak(.break_inline, gen_scope.break_block, .void_value); const code = try gen_scope.finish(); if (std.builtin.mode == .Debug and mod.comp.verbose_ir) { @@ -2863,9 +2857,8 @@ fn astgenAndSemaFn( _ = try AstGen.expr(&gen_scope, params_scope, .none, body_node); - const inst_tags = astgen.instructions.items(.tag); - if (inst_tags.len == 0 or - !inst_tags[inst_tags.len - 1] + if (gen_scope.instructions.items.len == 0 or + !astgen.instructions.items(.tag)[gen_scope.instructions.items.len - 1] .isNoReturn()) { // astgen uses result location semantics to coerce return operands. -- cgit v1.2.3