26858 Commits

Author SHA1 Message Date
kcbanner
1acb6a53d0
wasm: support rendering unions using their backing type if they have no defined tag type 2023-11-07 00:49:39 +00:00
kcbanner
35c86984a6
cbe: support rendering union values that have no defined tag type
This was regressed in d657b6c0e2ab7c47f5416dc4df1abb2bfbecd4b6, when
the comptime memory model for unions was changed to allow them to have
no defined tag type.
2023-11-07 00:49:39 +00:00
kcbanner
f10499be0a
sema: analyze field init bodies in a second pass
This change allows struct field inits to use layout information
of their own struct without causing a circular dependency.

`semaStructFields` caches the ranges of the init bodies in the `StructType`
trailing data. The init bodies are then resolved by `resolveStructFieldInits`,
which is called before the inits are actually required.

Within the init bodies, the struct decl's instruction is repurposed to refer
to the field type itself. This is to allow us to easily rebuild the inst_map
mapping required for the init body instructions to refer to the field type.

Thanks to @mlugg for the guidance on this one!
2023-11-07 00:49:35 +00:00
Andrew Kelley
234693bcbb tests: skip native CPU std tests on Windows
See tracking issue #17902
2023-11-06 16:03:04 -07:00
XXIV
5ea973dc39 langref: fix malloc return type 2023-11-06 23:46:17 +02:00
Jacob Young
9ced27dace x86_64: fix passing register-sized payload as non-reigster-sized union
Closes #17885
2023-11-06 14:11:31 -05:00
Bogdan Romanyuk
62e67a2b56
Sema: emit error when pointer to extern function is called 2023-11-06 15:26:28 +00:00
Andrew Kelley
e74ced21b7 frontend: fix -fsingle-threaded default detection logic
The logic in 509be7cf1f10c5d329d2b0524f2af6bfcabd52de assumed that
`use_llvm` meant that the LLVM backend would be used, however, use_llvm
is false when there are no zig files to compile, which is the case for
zig cc. This logic resulted in `-fsingle-threaded` which made libc++
fail to compile for C++ code that includes the threading abstractions
(such as LLVM).
2023-11-06 01:16:09 -05:00
Andrew Kelley
1b0b46a8a9
Merge pull request #17871 from jacobly0/x86_64
x86_64: get a compiler compiled with the x86_64 backend passing x86_64 backend tests
2023-11-05 18:45:21 -05:00
Andrew Kelley
702b809ea3
Merge pull request #17815 from Luukdegram/wasm-no-entry
wasm-linker: implement `-fno-entry` and correctly pass `--shared` and `--pie` when given
2023-11-05 18:44:12 -05:00
Igor Anić
bec36aa7c0 io_uring: add multishot accept operation
Server networking application typically accept multiple connections. Multishot
accept simplifies handling these situations. Applications submits once and
receives CQE whenever a new connection request comes in.

Multishot is active until it is canceled or experience error. While active, and
further notification are expected CQE completion will have IORING_CQE_F_MORE set
in the flags. If this flag isn't set, the application must re-arm this request
by submitting a new one.

Reference: [io_uring and networking in 2023](https://github.com/axboe/liburing/wiki/io_uring-and-networking-in-2023#multi-shot)
2023-11-06 00:12:39 +02:00
Jacob Young
0ea7189c23 behavior: enable test passing with x86_64 backend 2023-11-05 11:54:29 -05:00
Jacob Young
c2cda947c9 src: fix memory leaks 2023-11-05 11:54:29 -05:00
Jacob Young
7b9f8782c8 build: add option to specify whether to use the llvm backend 2023-11-05 09:30:28 -05:00
Jacob Young
8311fac7e8 x86_64: fix indirect return of f80 2023-11-05 06:09:06 -05:00
Jacob Young
803ea10107 x86_64: fix tracking during br 2023-11-05 06:08:06 -05:00
Bogdan Romanyuk
e9a6197a8e
Sema: fix error notes with wrong extern type 2023-11-05 12:36:06 +02:00
Andrew Kelley
33644546a0 Sema: fix memory leak in zirTypeInfo 2023-11-05 04:48:34 -05:00
Andrew Kelley
dc63426b1e
Merge pull request #17866 from ziglang/reduce-inline-import
zig reduce: support inlining `@import` and more
2023-11-05 03:39:01 -05:00
Andrew Kelley
a9002156a0 zig reduce: add reduction for removing var decls 2023-11-04 20:27:15 -07:00
Andrew Kelley
c4dddcbadb std.zig.render: ability to omit variable declarations 2023-11-04 20:26:39 -07:00
Andrew Kelley
e93d3a3cdb zig reduce: don't try to remove discard statements
those are handled separately
2023-11-04 19:27:46 -07:00
Andrew Kelley
9e81222d92 zig reduce: some adjustments to make it go faster
* don't reset the rng. it seems like it was getting stuck trying the
  same transforms over and over again.
* slide the window over after failing a large transform set, idea being
  that transformations in the failed set are more likely to be
  problematic.
2023-11-04 18:48:08 -07:00
Andrew Kelley
88acdb9aa6 zig reduce: delete statements from blocks 2023-11-04 18:06:11 -07:00
Andrew Kelley
212aa717d7 zig reduce: add transformation for removing container fields 2023-11-04 17:57:43 -07:00
Andrew Kelley
75efb736ce zig reduce: run results through astgen
and use that to fix up usused variable declarations and parameters that
are caused by transformations.

also add a transformation to replace global variable init with
`undefined`.
2023-11-04 17:38:10 -07:00
Andrew Kelley
31ad3af956 std.zig.render: support fixing unused parameter 2023-11-04 17:37:34 -07:00
Andrew Kelley
fc1e7a5644 zig reduce: rename identifiers when inlining an @import 2023-11-04 15:48:28 -07:00
Andrew Kelley
802c82b072 std.ArrayHashMap: add init function
for when you have keys and values array
2023-11-04 15:46:30 -07:00
Andrew Kelley
8bd01d2d9b zig reduce: add transformation for inlining file-based @import
One thing is missing for it to be useful, however, which is dealing with
ambiguous reference errors introduced by the inlining process.
2023-11-04 13:57:29 -07:00
Jakub Konka
f24ceec35a
Merge pull request #17844 from ziglang/elf-object
elf: handle emitting relocatables and static libraries - humble beginnings
2023-11-04 20:58:15 +01:00
Andrew Kelley
98dc28bbe2
Merge pull request #17852 from ziglang/zig-reduce
introduce `zig reduce` subcommand
2023-11-04 14:25:50 -04:00
Andrew Kelley
a7d8cd591c
Merge pull request #17788 from jacobly0/x86_64
x86_64: pass more tests
2023-11-04 14:24:59 -04:00
Jakub Konka
7a186d9eb6 Compilation: take into account if LLVM is available in lib-building logic 2023-11-04 16:09:52 +01:00
Jacob Young
095c4294aa x86_64: fix miscompilations
Closes #17618
2023-11-04 09:15:05 -04:00
Jacob Young
6553359f39 x86_64: fix ub that the llvm backend was hiding 2023-11-04 08:13:13 -04:00
Jakub Konka
533c88158e elf: actually capture positionals when linking static library 2023-11-04 09:14:15 +01:00
Jakub Konka
bd0416aeb6 elf: flag errors on hitting unimplemented codepaths 2023-11-04 09:14:05 +01:00
Jakub Konka
9cf3ebe524 elf: fix more int resolution issues 2023-11-04 09:13:50 +01:00
Jakub Konka
56296694d9 elf: fix 32bit build 2023-11-04 09:13:43 +01:00
Jakub Konka
ee66137269 elf: add link smoke tests covering emitting obj and static lib 2023-11-04 09:13:34 +01:00
Jakub Konka
e3b82eaa66 elf: do not store filename in strtab unless longer than 15 chars 2023-11-04 09:13:26 +01:00
Jakub Konka
acd700ac6b elf: store ar state per input object file 2023-11-04 09:13:18 +01:00
Jakub Konka
ed2984f335 elf: do not align end of archive to 2bytes; fix archive parser 2023-11-04 09:13:07 +01:00
Andrew Kelley
a333ac846d Compilation: refactor logic for library-building capabilities
And mark the stage2_x86_64 backend as being capable of building
compiler-rt and zig libc.
2023-11-04 09:12:54 +01:00
Jakub Konka
65adbec918 link: commit missing source StringTable.zig 2023-11-04 09:12:46 +01:00
Jakub Konka
912a774a15 x86_64: rewrite call r/m64 to call rel32 for .got.zig refs when object 2023-11-04 09:12:35 +01:00
Jakub Konka
33a0a72e87 elf: align ar_hdr to at least 2 bytes 2023-11-04 09:12:26 +01:00
Jakub Konka
875beb25b5 elf: fix writing symtab to an archive 2023-11-04 09:12:18 +01:00
Jakub Konka
3b9455f005 elf: generate pretty rudimentary archive 2023-11-04 09:12:07 +01:00