Andrew Kelley
44a6172edb
Merge pull request #12405 from ziglang/macho-aligned-ptrs
...
link.MachO: use accurate alignment attribute on pointers
2022-08-11 06:19:10 -04:00
Andrew Kelley
9f1f60fd43
test-cases: remove multi-threading
...
This effectively reverts 22690efcc2378222503cb8aaad26a6f4a539f5aa,
re-opening #11818 .
This had the following problems:
* Buggy on some targets (macOS, Windows)
* Messy output to the terminal
These problems need to be solved before moving forward with this.
2022-08-11 00:46:44 -07:00
Andrew Kelley
933436dc52
stage2: remove destroyed functions from maps
...
This is likely the cause of the flaky test failures in master branch.
Since we have some test coverage for incremental compilation, it's not
OK to leave proper memory management of Fn objects as "TODO".
2022-08-10 23:23:30 -07:00
Andrew Kelley
fa620ef710
link.MachO: use accurate alignment attribute on pointers
...
Also adds a new method to ArrayList: appendUnalignedSlice
2022-08-10 22:28:05 -07:00
Andrew Kelley
cc56400e62
Revert "macho: allow unaligned offsets in object files"
...
This reverts commit 45c444ff18b43d30a7277e346174ba6eca4a6193.
2022-08-10 22:27:59 -07:00
Veikka Tuominen
74673b7f69
stage2 llvm: implement more C ABI
2022-08-10 20:52:36 -04:00
Andrew Kelley
4d7f5a1917
stage2: fix crash with comptime vector reduce
2022-08-10 16:45:29 -07:00
Andrew Kelley
d267f0f968
LLVM: respect linksection for exported variables
2022-08-10 16:43:30 -07:00
Andrew Kelley
e8d02c5b90
add ZIG_GLOBAL_CACHE_DIR env var
2022-08-10 16:43:25 -07:00
Andrew Kelley
9656ec271c
better default for use_stage1 when -ofmt=c is provided
2022-08-10 16:24:04 -07:00
Andrew Kelley
e0178890ba
Merge pull request #12379 from ifreund/packed-struct-explicit-backing-int
...
stage2: Implement explicit backing integers for packed structs
2022-08-10 19:13:29 -04:00
Jakub Konka
45c444ff18
macho: allow unaligned offsets in object files
2022-08-10 18:45:46 -04:00
InKryption
e218b7ea0c
stage2: add compile error for invalid null/undefined pointer cast
2022-08-10 16:39:46 -04:00
LeRoyce Pearson
0e118ed0ac
stage2: add compile error for shlExact overflow
...
- moves a stage1 test case and makes it target `llvm` backend instead
of `stage1` backend
2022-08-10 16:14:30 -04:00
Veikka Tuominen
40447b25e8
Sema: fix expansion of repeated value
...
Closes #12386
2022-08-10 15:18:09 -04:00
Isaac Freund
0d32b73078
stage2: Implement explicit backing integers for packed structs
...
Now the backing integer of a packed struct type may be explicitly
specified with e.g. `packed struct(u32) { ... }`.
2022-08-10 19:54:45 +02:00
Isaac Freund
bb1c3e8b7e
stage2: Handle lazy values for the % operator
2022-08-10 14:48:27 +02:00
Veikka Tuominen
b757a96d5c
Sema: add declared here note to function call errors
2022-08-09 23:37:26 +03:00
Veikka Tuominen
0778490283
AutoDoc: update to Zir call inst changes
2022-08-09 19:26:40 +03:00
Veikka Tuominen
0fd90749d1
stage2: generate call arguments in separate blocks
2022-08-09 16:19:55 +03:00
Andrew Kelley
85a3f9b054
Merge pull request #12383 from ziglang/stage2-stack-traces
...
several improvements to error return tracing in the self-hosted compiler
2022-08-09 02:11:58 -07:00
Veikka Tuominen
c76b5c1a31
stage2: correct node offset of nested declarations
2022-08-09 11:59:10 +03:00
Andrew Kelley
feb90f6ed4
AstGen: emit debug stmt for try
...
This improves the following test case:
```zig
pub fn main() !void {
try foo();
}
fn foo() !void {
return error.Bad;
}
```
The error return trace now points to the `try` token instead of pointing
to the foo() function call, matching stage1.
Closes #12308 .
2022-08-08 21:12:04 -07:00
Andrew Kelley
0648177ed7
AstGen: avoid multiple dbg_stmt instructions in a row
...
This is purely an optimization to emit fewer ZIR instructions.
2022-08-08 20:43:05 -07:00
Andrew Kelley
3389890709
stage2: error return tracing handles ret better
...
Sema: insert an error return trace frame when appropriate when analyzing
ret_load. Also optimize the instructions to avoid an unnecessary block
sent to the backends.
AstGen: always emit a dbg_stmt for return expressions, in between the
defer instructions and the return instruction.
This improves the following test case:
```zig
pub fn main() !void {
return foo();
}
fn foo() !void {
return error.Bad;
}
```
The error return trace now points to the return token instead of
pointing to the foo() function call, matching stage1.
2022-08-08 20:43:05 -07:00
Andrew Kelley
1a500b9699
Sema: avoid error return traces when possible
...
stage2 was adding bogus error return trace frames when an error was not
being returned. This commit makes several improvements:
* Make a runtime check if necessary to only emit a frame into the error
return trace when an actual error is returned.
* Use the `analyzeIsNonErrComptimeOnly` machinery to avoid runtime
checks when it is compile-time-known that the value is an error, or a
non-error.
* Make std.builtin.returnError take a non-optional stack trace pointer.
closes #12174
2022-08-08 19:16:21 -07:00
Veikka Tuominen
d769fd0102
stage2: pass anon name strategy to reify
2022-08-08 18:28:39 -07:00
Andrew Kelley
3afc4dff30
Merge pull request #12369 from ziglang/zig-cc-m-flag
...
cc: add support for -M flag
2022-08-08 18:26:26 -07:00
Jakub Konka
a0ec07fdec
cc: add support for -M flag
2022-08-08 14:26:10 +02:00
Meghan Denny
0879cbeed2
remove 'builtin.stage2_arch', Sema is smart enough now
2022-08-07 16:07:08 -07:00
Andrew Kelley
b3d463c9e6
Merge pull request #12337 from Vexu/stage2-safety
...
Stage2: implement remaining runtime safety checks
2022-08-06 14:59:10 -07:00
Veikka Tuominen
3e2defd36c
stage2: add a helpful error for when async is used
2022-08-06 14:51:20 -07:00
joachimschmidt557
b300eecb9d
stage2 DWARF: fix size and offset in slices
...
Previously, `@sizeOf(usize)` was used, however, the pointer size of
the host may differ from the target when cross-compiling.
2022-08-06 14:44:05 -07:00
Veikka Tuominen
bd21f499dc
Type: adjust C type sizes
2022-08-06 14:42:05 -07:00
Veikka Tuominen
75275a1514
Sema: do not emit pointer safety checks for pointers to zero-bit types
2022-08-06 15:22:14 +03:00
Anton Lilja
86d9c3de2b
Sema: fix infinite recursion in explainWhyTypeIsComptime
...
Co-authored-by: Veikka Tuominen <git@vexu.eu>
2022-08-06 14:17:09 +03:00
Andrew Kelley
5c9826630d
Sema: elide safety of modulus and remainder division sometimes
...
Piggybacking on 40f8f0134f5da9baaefd0fdab529d5585fa46199, remainder
division, modulus, and `%` syntax no longer emit safety checks for a
comptime-known denominator.
2022-08-05 21:13:18 -07:00
Veikka Tuominen
0daa77bd63
stage2 cbe: correct airIsNull ptr operand check
2022-08-05 22:13:58 +03:00
Veikka Tuominen
f46d7304b1
stage2: add runtime safety for invalid enum values
2022-08-05 22:13:58 +03:00
Veikka Tuominen
19d5ffc710
Sema: add safety check for non-power-of-two shift amounts
2022-08-05 22:13:58 +03:00
Veikka Tuominen
9116e26c1f
Sema: add null check for implicit casts
2022-08-05 22:13:58 +03:00
Veikka Tuominen
5605f6e0e3
Sema: account for sentinel in bounds check
2022-08-05 22:13:57 +03:00
Veikka Tuominen
6aa438f065
Sema: add null pointer slice safety check when len is comptime known
2022-08-05 22:13:57 +03:00
Veikka Tuominen
eec2978fac
Sema: better safety check on switch on corrupt value
2022-08-05 22:13:57 +03:00
joachimschmidt557
f46c80b267
stage2 AArch64: improve correctness of register aliases
...
Also implements ptr_elem_ptr
2022-08-05 20:30:52 +02:00
joachimschmidt557
508b90fcfa
stage2 AArch64: implement basic integer rem/mod
2022-08-05 20:30:52 +02:00
joachimschmidt557
8b24c783c5
stage2 AArch64: implement basic integer division
2022-08-05 20:30:51 +02:00
joachimschmidt557
dcb236acf4
stage2 AArch64: memcpy support in store and more complete intcast
2022-08-05 20:30:51 +02:00
joachimschmidt557
02738228f2
stage2 AArch64: support returning values by reference
...
also adds some more support for slices passed as stack arguments
2022-08-05 20:30:51 +02:00
joachimschmidt557
65b3c27f24
stage2 AArch64: all arguments passed via stack from now on
...
Only in the Undefined calling convention, not in other calling
conventions
2022-08-05 20:30:51 +02:00