Commit Graph

21363 Commits

Author SHA1 Message Date
Veikka Tuominen
59dad43de2 Sema: add error for failed assumption about struct having runtime bits 2022-12-02 18:46:59 +02:00
Veikka Tuominen
86e6acb37b AstGen: improve error message for missing parameter name
Closes #13393
2022-12-02 15:39:40 +02:00
Andrew Kelley
665eba93c1 CBE: eliminate zig_void
C void is perfectly fine.
2022-12-02 00:46:27 -05:00
Andrew Kelley
e6e459e9e3 zig cc: detect -z stack-size arguments 2022-12-01 20:58:09 -07:00
Andrew Kelley
4071b22454
Merge pull request #13715 from Vexu/cbe
cbe bug fixes and improvements
2022-12-01 17:38:11 -05:00
Andrew Kelley
6e52f36d46 langref: eliminate dependencies on stage1
This commit removes async/await/suspend/resume from the language
reference, as that feature does not yet work in the self-hosted
compiler.

We will be regressing this feature temporarily. Users of these language
features should stick with 0.10.x with the `-fstage1` flag until they
are restored.

See tracking issue #6025.
2022-12-01 15:28:44 -07:00
Jakub Konka
2823fcabd1
Merge pull request #13725 from mathetake/fixreaddir
wasi: fixes IterableDir.nextWasi for large directory
2022-12-01 17:30:00 +01:00
Veikka Tuominen
b7066b6024 add workaround for compiler bug 2022-12-01 14:48:09 +02:00
Veikka Tuominen
6ded2d2adb cbe: disable failing behavior test on aarch64 2022-12-01 12:18:10 +02:00
Veikka Tuominen
d0edaabf9d Value: fix elemValueAdvanced for optional payloads
Closes #13707
2022-12-01 11:49:06 +02:00
Andrew Kelley
fc3142aa9a Merge branch 'ci-add-debug-aarch64-linux' 2022-12-01 00:38:21 -07:00
Andrew Kelley
8f079bad1f langref: acknowledge design flaw in the self-hosted compiler
See tracking issue #13724
2022-12-01 00:38:02 -07:00
Andrew Kelley
9f9f1aadc7 CI: add aarch64-linux-debug job and flatten dirs 2022-12-01 00:37:47 -07:00
Ryan Liptak
c37afa2811 std.testing: Improve expectEqualBytes for large inputs and make expectEqualSlices use it
`expectEqualBytes` will now truncate the hexdump of each input to a maximum window of 256 bytes, which makes it safe to use for arbitrarily large inputs. Therefore, it can be used in `expectEqualSlices` when the type is u8.
2022-12-01 02:18:51 -05:00
Takeshi Yoneda
829bf5a03e wasi: fixes IterableDir.nextWasi for large directory
Signed-off-by: Takeshi Yoneda <takeshi@tetrate.io>
2022-12-01 13:56:53 +09:00
Andrew Kelley
a943422672
Merge pull request #13717 from GethDW/option-fix
std.build.Builder: fix for Allocator changes
2022-11-30 19:43:51 -05:00
Andrew Kelley
94e751ad01
Merge pull request #13718 from Luukdegram/wasm-packed
stage2: Wasm - Implement packed structs
2022-11-30 19:29:26 -05:00
Ryan Liptak
34fa6a1e04 std.testing: Add expectEqualBytes that outputs hexdumps with diffs highlighted in red
The coloring is controlled by `std.debug.detectTTYConfig` so it will be disabled when appropriate.
2022-11-30 18:57:37 -05:00
Jacob Young
cf7a4de7f1 zig.h: fix disastrous typo 2022-11-30 15:48:44 -07:00
Andrew Kelley
16caea38d1 std.ArrayList: fix shrinkAndFree
Fixes a regression introduced in
e35f297aeb.

Now there is test coverage for ArrayList.shrinkAndFree in the case when
resizing fails.
2022-11-30 15:42:59 -07:00
Andrew Kelley
c84bc3a06b std.os.test: disable flaky timerfd test
See tracking issue #13721
2022-11-30 15:18:35 -07:00
Veikka Tuominen
34f96c5fd0
Merge pull request #13719 from Vexu/debug
Improve debuggability of programs built by the self hosted compiler
2022-11-30 22:51:39 +02:00
Andrew Kelley
b1793c2b52 add test coverage for zig build CLI and options API 2022-11-30 13:22:43 -07:00
Andrew Kelley
abd9089aa6 std.build: simpler fix to options implementation
Instead of messing with ArrayList and more logic, just unwrap the error
of toOwnedSlice().
2022-11-30 13:22:04 -07:00
GethDW
747f64b3fb std.build.Builder: fix for Allocator changes 2022-11-30 13:04:32 -07:00
Luuk de Gram
090deae41d
wasm: enable behavior tests for packed structs 2022-11-30 21:01:09 +01:00
Andrew Kelley
44ee1c885f std.os.windows.ReadLink: add missing alignment of local data buffer 2022-11-30 12:55:23 -07:00
Veikka Tuominen
fb4a5ccdee llvm: make debuggers actually usable
`@llvm.dbg.value` is absolutely useless, adding a temporary alloca
to store the constant in will make it actually show up in debuggers.
The effect on performance should be minimal since there is only one
store and it the change is not applied to ReleaseSafe builds.

```zig
fn foo(a: u32, b: []const u8, c: bool, d: enum { yes, no }) void {
    _ = a; _ = b; _ = c; _ = d;
}
```
before:
```
Breakpoint 1, a.foo (a=<optimized out>, b=..., c=<optimized out>, d=<optimized out>) at a.zig:18
18          _ = d;
```
after:
```
Breakpoint 1, a.foo (a=1, b=..., c=false, d=yes) at a.zig:15
15          _ = a; _ = b; _ = c; _ = d;
(gdb) p b
$1 = {ptr = 0x20854f <a.main.anon_3888> "bar", len = 3}
```
2022-11-30 19:33:03 +02:00
Veikka Tuominen
e4fd9acc2a CLI: allow using --debug-compile-errors with zig build 2022-11-30 19:14:04 +02:00
Veikka Tuominen
fba33ee58c Sema: print line column and path when using --debug-compile-errors 2022-11-30 19:12:05 +02:00
Luuk de Gram
3933a4bac5
codegen: support generating packed structs 2022-11-30 17:56:02 +01:00
Luuk de Gram
df7ddb475e
wasm: Fix pointer to field of packed struct
When requesting a pointer to a field of a packed struct (of which is
not byte-aligned), we simply provide the address of the packed struct
itself.
2022-11-30 17:56:02 +01:00
Luuk de Gram
6924f21bbd
wasm: support non-natural alignment in load/store
This implements support for loading and storing where the lhs is
of pointer type with host_size != 0. e.g. when loading a specific
field from a packed struct with a non-byte alignment such as (0:1:3).
2022-11-30 17:56:02 +01:00
Luuk de Gram
a7ad1212cb
wasm: airAggregateInit - Support packed structs
This allows the Wasm backend to construct an instance of a packed
struct during runtime. We first allocate a local, and then
shift+or each field's value into the result local. We then finally
return this result local as value.

The commit also fixes a type-issue in `airElemVal` where we used
the element type instead of a pointer type to store the value's
address into.
2022-11-30 17:56:02 +01:00
Luuk de Gram
a314e86772
wasm: support passing packed struct over C-ABI
This also adds support loading a runtime pointer from a packed struct.
Also, this commit improves many utility functions such as `trunc` and
`intcast` to also support non-integer types such as booleans.
2022-11-30 17:56:02 +01:00
Luuk de Gram
4af5bbde53
wasm: airStructFieldPtr - Support packed structs
Simplifies the airStructFieldPtr(index) functions to only obtain the
correct struct type and field index, which is then passed into the
structFieldPtr function. This function now calculates the byte-offset
of the field's address and returns a new `WValue` with this offset.
This means we only have to do this calculation in a single function,
and no longer have to duplicate any logic. This also handles both
regular (tagged) unions and packed unions.
2022-11-30 17:56:01 +01:00
Luuk de Gram
eb2caf9390
wasm: airStructFieldVal - Support packed structs
This implements loading a field from a packed struct, regardless of
its field's type. This means it supports pointers, floats and
integers. The commit also extracts the logic from airTrunc into its
own `trunc` function so it can be re-used.
2022-11-30 17:56:01 +01:00
Luuk de Gram
7cf442cabc
wasm: Support bitcasting between floats and ints 2022-11-30 17:56:01 +01:00
Luuk de Gram
2be0d5bbca
wasm: add support packed structs in lowerConstant
When lowering constants of packed structs, which are smaller than 65
bits, we lower the value to an integer rather than store it in the
constant data section. This allows us to use an immediate value,
for quick loads and stores.
2022-11-30 17:56:01 +01:00
Veikka Tuominen
98037a0238 compiler-rt: disable some exports for ofmt=c 2022-11-30 17:20:34 +02:00
Veikka Tuominen
f8b779c114 cbe: write more instructions inline 2022-11-30 17:13:56 +02:00
Veikka Tuominen
11ec7109c3 cbe: do not memcpy identical integer types when bitcasting 2022-11-30 17:11:06 +02:00
Veikka Tuominen
15cc83e27a cbe: reduce amount of temporary locals 2022-11-30 17:11:06 +02:00
Veikka Tuominen
f4afeb3ffd AstGen: fix incorrect handling of source cursor with shift builtins
Closes #13714
2022-11-30 17:11:06 +02:00
Veikka Tuominen
7be6f352e3 cbe: fix asm return values 2022-11-30 15:14:34 +02:00
Veikka Tuominen
3281494dc5 cbe: prevent access of inactive union field in unimplemented instructions 2022-11-30 15:14:34 +02:00
Veikka Tuominen
a67ea4a4ae cbe: include hash in tuple type name
Different (simple) tuple types do not necessarily print out as different strings.

This is issue would be caused by passing std.fmt.Formatter to std.fmt.format.
2022-11-30 15:14:33 +02:00
Veikka Tuominen
2dcac348e5 cbe: implement packed unions 2022-11-30 15:14:33 +02:00
Veikka Tuominen
1a1a5702ab cbe: correctly handle pointers to zero bit error union payloads 2022-11-30 15:14:33 +02:00
Veikka Tuominen
4def9c4a9b cbe: operand of address of operator must be an lvalue 2022-11-30 15:14:33 +02:00