stage2: move undef, unreach, null values to InternPool

This commit is contained in:
Andrew Kelley
2023-05-04 21:40:35 -07:00
parent 773fabf361
commit 6ab8b6f8b2
10 changed files with 1492 additions and 1385 deletions

View File

@@ -932,7 +932,7 @@ pub const Decl = struct {
assert(decl.has_tv);
return switch (decl.val.tag()) {
.extern_fn => true,
.variable => decl.val.castTag(.variable).?.data.init.tag() == .unreachable_value,
.variable => decl.val.castTag(.variable).?.data.init.ip_index == .unreachable_value,
else => false,
};
}
@@ -4849,6 +4849,8 @@ fn semaDecl(mod: *Module, decl_index: Decl.Index) !bool {
var is_extern = false;
switch (decl_tv.val.ip_index) {
.generic_poison => unreachable,
.unreachable_value => unreachable,
.none => switch (decl_tv.val.tag()) {
.variable => {
const variable = decl_tv.val.castTag(.variable).?.data;
@@ -4869,8 +4871,6 @@ fn semaDecl(mod: *Module, decl_index: Decl.Index) !bool {
}
},
.unreachable_value => unreachable,
.function => {},
else => {
@@ -6592,7 +6592,7 @@ pub fn populateTestFunctions(
.len = try Value.Tag.int_u64.create(arena, test_name_slice.len),
}), // name
try Value.Tag.decl_ref.create(arena, test_decl_index), // func
Value.initTag(.null_value), // async_frame_size
Value.null, // async_frame_size
};
test_fn_vals[i] = try Value.Tag.aggregate.create(arena, field_vals);
}