stage2: improvements towards zig test
* Add AIR instruction: struct_field_val
- This is part of an effort to eliminate the AIR instruction `ref`.
- It's implemented for C backend and LLVM backend so far.
* Rename `resolvePossiblyUndefinedValue` to `resolveMaybeUndefVal` just
to save some columns on long lines.
* Sema: add `fieldVal` alongside `fieldPtr` (renamed from
`namedFieldPtr`). This is part of an effort to eliminate the AIR
instruction `ref`. The idea is to avoid unnecessary loads, stores,
stack usage, and IR instructions, by paying a DRY cost.
LLVM backend improvements:
* internal linkage vs exported linkage is implemented, along with
aliases. There is an issue with incremental updates due to missing
LLVM API for deleting aliases; see the relevant comment in this commit.
- `updateDeclExports` is hooked up to the LLVM backend now.
* Fix usage of `Type.tag() == .noreturn` rather than calling `isNoReturn()`.
* Properly mark global variables as mutable/constant.
* Fix llvm type generation of function pointers
* Fix codegen for calls of function pointers
* Implement llvm type generation of error unions and error sets.
* Implement AIR instructions: addwrap, subwrap, mul, mulwrap, div,
bit_and, bool_and, bit_or, bool_or, xor, struct_field_ptr,
struct_field_val, unwrap_errunion_err, add for floats, sub for
floats.
After this commit, `zig test` on a file with `test "example" {}`
correctly generates and executes a test binary. However the
`test_functions` slice is undefined and just happens to be going into
the .bss section, causing the length to be 0. The next step towards
`zig test` will be replacing the `test_functions` Decl Value with the
set of test function pointers, before it is sent to linker/codegen.
This commit is contained in:
@@ -3702,8 +3702,8 @@ pub fn analyzeExport(
|
||||
else => return mod.fail(scope, src, "unable to export type '{}'", .{exported_decl.ty}),
|
||||
}
|
||||
|
||||
try mod.decl_exports.ensureCapacity(mod.gpa, mod.decl_exports.count() + 1);
|
||||
try mod.export_owners.ensureCapacity(mod.gpa, mod.export_owners.count() + 1);
|
||||
try mod.decl_exports.ensureUnusedCapacity(mod.gpa, 1);
|
||||
try mod.export_owners.ensureUnusedCapacity(mod.gpa, 1);
|
||||
|
||||
const new_export = try mod.gpa.create(Export);
|
||||
errdefer mod.gpa.destroy(new_export);
|
||||
|
||||
Reference in New Issue
Block a user