12482 Commits

Author SHA1 Message Date
Andrew Kelley
6393928d50 link: add more respect for -fno-emit-bin
closes #16347
2023-07-30 11:19:36 -07:00
Jacob Young
6f0a613b6f
Merge pull request #16611 from xxxbxxx/packed-struct
codegen: fix various packed struct issues

Closes #16609
Closes #15337
2023-07-29 23:49:14 -04:00
Frank Denis
7ad4aede7a Remove obsolete comment in wasi_libc.zig
The referenced bug in LLD has been fixed:
https://reviews.llvm.org/D85567
2023-07-29 20:33:29 -07:00
Jacob Young
dc8a80a191 llvm: support read-write output constraints in assembly
Closes #15227
2023-07-29 09:49:04 -07:00
Andrew Kelley
b8dda2dbe1
Merge pull request #16594 from squeek502/windows-sdk-com
windows_sdk.zig: Reinstate COM ISetupEnumInstances logic
2023-07-29 09:47:39 -07:00
AdamGoertz
796927b900
Allow zero-sized fields in extern structs (#16404)
This change allows the following types to appear in extern structs:
* Zero-bit integers
* void
* zero-sized structs and packed structs
* enums with zero-bit backing integers
* arrays of any length with zero-size elements
2023-07-29 12:45:01 -04:00
Xavier Bouchoux
8c367ef99a codegen: fix access to byte-aligned nested packed struct elems
When acessing a packed struct member via a byte aligned ptr (from the optimisation in Sema.structFieldPtrByIndex())
the codegen must apply the parent ptr packed_offset in addition to the field offset itself.

resolves https://github.com/ziglang/zig/issues/16609
2023-07-29 18:16:13 +02:00
Xavier Bouchoux
46abf20454 llvm: partial fix of store undefined to packed result location
prefer marking too few undefined bits, rather than too many that may overwrite nearby values.
partially resolves https://github.com/ziglang/zig/issues/15337
2023-07-29 11:56:27 +02:00
Ryan Liptak
41aaf1e6e8 windows_sdk: Get the latest installed version when using COM
Before, iteration would stop whenever an installation with vcruntime.lib was found, but that may not be the most recent installed version. Instead, we now iterate all installed instances and choose the one with the newest version.
2023-07-28 23:36:04 -07:00
mlugg
417b92f085 package manager: don't show progress indicator on dumb terminals
This mirrors the behavior of the progress indicator for the actual
compilation. Not doing this was causing sporadic CI failures due to the
(non-existent) fetches taking long enough to appear in stderr.
2023-07-28 21:45:00 -07:00
xdBronch
2826f78a61
suggest using else when '_' is used for exhaustive enums (#16583) 2023-07-28 22:28:55 -04:00
Ryan Liptak
8579f720b0 windows_sdk.zig: Reinstate COM ISetupEnumInstances logic
The C++ version of this code used this logic, and it turns out it is able to find some setups that the current registry/Vs7 methods cannot.

For example, if only the "Build Tools for Visual Studio" are installed but not Visual Studio itself, then only the ISetupEnumInstances method seems to find it.

Follow up to #15657, fixes a regression caused by moving from the C++ version to the Zig version
2023-07-28 19:19:32 -07:00
Jacob Young
125b453c58 llvm: fix SysV C abi for structs smaller than two eightbytes
Closes #16038
Closes #16288
2023-07-28 19:27:08 -04:00
Jacob Young
c80609dfec Sema: don't reorder tuple fields
This conflicts with anon structs which can be in-memory coercible but
are never reordered.

Closes #16242
2023-07-28 19:27:08 -04:00
Andrew Kelley
282cb5ee5d
Merge pull request #16559 from kcbanner/improve_compiler_rt_stack_trace
Unwinding follow up: Don't strip compiler_rt symbols, enable unwind tables on supported platforms
2023-07-27 11:07:10 -07:00
Andrew Kelley
e66190025f frontend: make fn calls byval; fix false positive isNonErr
This commit does two things which seem unrelated at first, but,
together, solve a miscompilation, and potentially slightly speed up
compiler perf, at the expense of making #2765 trickier to implement in
the future.

Sema: avoid returning a false positive for whether an inferred error set
is comptime-known to be empty.

AstGen: mark function calls as not being interested in a result
location. This prevents the test case "ret_ptr doesn't cause own
inferred error set to be resolved" from being regressed. If we want to
accept and implement #2765 in the future, it will require solving this
problem a different way, but the principle of YAGNI tells us to go ahead
with this change.

Old ZIR looks like this:

  %97 = ret_ptr()
  %101 = store_node(%97, %100)
  %102 = load(%97)
  %103 = ret_is_non_err(%102)

New ZIR looks like this:

  %97 = ret_type()
  %101 = as_node(%97, %100)
  %102 = ret_is_non_err(%101)

closes #15669
2023-07-27 10:12:08 -07:00
Andrew Kelley
0f21d3d4d1 LLVM: always add argument attributes to calls
These are needed for correctness. There's no reason to only add them for
function pointers.

closes #16290
2023-07-27 00:49:25 -07:00
Jacob Young
7201e69454 AstGen: fix missing deferred ref
Closes #16524
2023-07-26 22:19:30 -07:00
kcbanner
661028a907 target: emit unwind tables if the platform supports unwinding 2023-07-26 20:58:29 -04:00
kcbanner
f2aab12a86 compilation: change compiler_rt to inherit strip and want_unwind_tables from the parent compilation 2023-07-26 20:58:29 -04:00
Jacob Young
f9717f87f5 llvm: fix data layout on ios
Closes #16549
2023-07-26 16:49:32 -07:00
Jakub Konka
f821543e4b
Merge pull request #16553 from ziglang/issue-11896
macho: fix parsing of TBDv3 dylib stubs
2023-07-26 18:22:59 +02:00
Jakub Konka
59284a1085 macho: create export trie root explicitly with Trie.init 2023-07-26 13:37:37 +02:00
kcbanner
a8a2f2b58b Add --verbose-generic-instances to provide visibility on the number of generic function instantiations 2023-07-26 02:20:29 -07:00
Jakub Konka
3b3ce449e3 tapi: do not log errors using log.err 2023-07-26 08:10:52 +02:00
Jakub Konka
27f471860a macho: fix matching target triples for TBDv3 2023-07-26 08:10:52 +02:00
Andrew Kelley
6cee98eb30 frontend: forbid packed and extern tuples 2023-07-25 21:45:33 -07:00
Andrew Kelley
4b7fa0fce9 AstGen: avoid unnecessary mutable local 2023-07-25 21:45:33 -07:00
Xavier Bouchoux
5ab1854602 codegen/llvm: fix memset with vectors smaller than one byte
The special case to take advantage of llvm's intrinsic
was generating invalid llvm ir:

```
Invalid bitcast
  %60 = bitcast <2 x i2> %59 to i8, !dbg !3122
thread 145453 panic: LLVM module verification failed
```
2023-07-25 18:14:10 -07:00
Andrew Kelley
71dfce31bb
Merge pull request #16548 from mlugg/feat/package-dl-progress
Display package download progress
2023-07-25 18:12:00 -07:00
Jacob G-W
3c08fe931a make @typeInfo not return private decls
fixes #10731
Thanks @nektro for previous work in #14878

This change creates a small breaking change:
It removes the `is_pub` field of a decl in `@typeInfo`
2023-07-25 16:19:08 -07:00
mlugg
7a57f82976
Package: add progress indicator for package fetching 2023-07-25 19:17:53 +01:00
Ian Johnson
9892ec31a0 zig fmt: make --exclude work on files
Closes #16178
2023-07-24 19:41:59 -07:00
Zachary Raineri
10d940d7f4 src.link | Remove unused import
Removed Package import as it's not used in file
2023-07-24 18:48:01 -07:00
Andrew Kelley
77b96231a6
Merge pull request #15657 from BratishkaErik/windows-sdk-finder-port-to-zig
src/windows_sdk.cpp: port to Zig
2023-07-24 09:34:56 -07:00
Andrew Kelley
575a7cccc0 CLI: delete dead option -femit-analysis
This used to do something with the old autodocs system. Now it does
nothing.
2023-07-24 02:37:25 -07:00
Andrew Kelley
d21d1d4ba2
Merge pull request #16487 from jacobly0/llvm-builder
llvm: incremental Builder improvements
2023-07-24 02:16:00 -07:00
Andrew Kelley
98c7aec4e4
Merge pull request #16518 from ziglang/fix-func-body
InternPool: fix handling of coerced function bodies
2023-07-23 22:57:11 -07:00
Jacob Young
3fc2e36de2 llvm: convert global assembly 2023-07-23 23:48:19 -04:00
Jacob Young
533111e849 llvm: convert inline assembly
Also, implement TODOs from a previous commit.
2023-07-23 23:48:19 -04:00
Jacob Young
c610cde1eb test: test for issues starting codegen on many targets
Specifically this is to make sure llvm data layout generation doesn't
regress.  The no emit bin is to allow testing targets that can't
currently be linked.  The commented out targets are ones that fail in
the linker anyway when no emit bin is passed.
2023-07-23 23:48:19 -04:00
Jacob Young
06af9cc101 llvm: fix datalayout generation for more targets
Closes #16482
2023-07-23 23:48:18 -04:00
Jacob Young
aa44f8f0fd llvm: convert attributes and non-intrinsic calls 2023-07-23 23:48:18 -04:00
Andrew Kelley
8199428beb Compilation: fix autodocs CLI
6e4fff6ba62ae3e61a948c98fa8fea7e35732cc0 regressed the direct CLI
interface of -femit-docs.

This commit fixes it and also hooks up to the progress bar.
2023-07-23 19:16:33 -07:00
Andrew Kelley
d92cca9324 InternPool: add func_coerced handling to getFuncInstanceIes
Oops, there was a missing call to `unwrapCoercedFunc`.
2023-07-23 18:39:58 -07:00
Andrew Kelley
cc6964c5dc InternPool: add func_coerced handling to funcIesResolved 2023-07-23 17:47:18 -07:00
Andrew Kelley
a7f3c2eab4 InternPool: fix coerced func hash/eql same as uncoerced
Since the same Key.Func data structure is used for coerced function
bodies as well as uncoerced function bodies, there is danger of them
being hashed and equality-checked as the same. When that happens, the
type of a function body value might be wrong, causing lots of problems.
In this instance, it causes an assertion failure.

This commit fixes it by introducing an `uncoerced_ty` field which
is different than `ty` in the case of `func_coerced` and is used to
differentiate when doing hashing and equality checking.

I have a new behavior test to cover this bug, but it revealed *another*
bug at the same time, so I will fix it in the next commit and and add
the new test therein.
2023-07-23 17:47:18 -07:00
Eric Joldasov
38d10ee4d0
src/windows_sdk.cpp: port to Zig
Signed-off-by: Eric Joldasov <bratishkaerik@getgoogleoff.me>
2023-07-23 17:10:57 +06:00
Andrew Kelley
c804abc7f6 Sema: handle adhoc inferred error sets in helper functions
There were two missing places.

Regressed in the #16318 branch.

Found from compiling Bun. Unfortunately we do not have a behavior test
reduction for this bug.
2023-07-22 20:21:27 -07:00
Andrew Kelley
012cbdb422 Sema: fix adhoc inferred error sets in analyzeIsNonErrComptimeOnly
The logic incorrectly assumed that adhoc_inferred_error_set_type would
be part of the inferred_error_set InternPool.Key when it actually is
part of `simple_type`.

Regressed in the #16318 branch.

Found from compiling Bun. Unfortunately we do not have a behavior test
reduction for this bug.
2023-07-22 19:58:52 -07:00