26962 Commits

Author SHA1 Message Date
Bogdan Romanyuk
547481c31c
Sema: fix comparison with undefined 2023-11-12 11:03:23 +02:00
Jacob Young
2eeb735822 Dwarf: improve x86_64 backend debug info
Closes #17811
2023-11-12 03:21:52 -05:00
kcbanner
3fc6a2f113 sema: pass sema through if available for the array_type case in bitSizeAdvanced 2023-11-11 13:11:51 +00:00
Andrew Kelley
63e5476450
Merge pull request #17963 from jacobly0/workaround/16392
llvm: workaround SROA misoptimizations in LLVM
2023-11-11 05:08:36 -05:00
Andrew Kelley
78df899b88
Merge pull request #17967 from jacobly0/x86_64-cases 2023-11-11 04:42:33 -05:00
Jacob Young
ae8992629c BitcodeReader: followup cleanup 2023-11-10 22:35:35 -05:00
Jacob Young
d93f1f3c72 Sema: detect unneeded source locations earlier
This avoids a lot of work that just needs deferred cleanup anyway.
Crucially, also avoids use of undefined in `failWithNeededComptime`.
2023-11-10 22:35:35 -05:00
Jacob Young
b5f89d681f Module: fix use of undefined during decl cleanup 2023-11-10 22:35:35 -05:00
Andrew Kelley
97e23896a9
Merge pull request #17962 from ziglang/libssp
move libssp into libcompiler_rt
2023-11-10 22:27:45 -05:00
Jacob Young
89cac88e91 behavior: add testing for LLVM SROA bugs 2023-11-10 18:04:09 -05:00
Jacob Young
59375b3c22 llvm: workaround SROA misoptimizations in LLVM
Workaround #16392
2023-11-10 15:46:42 -05:00
dweiller
138a35df8f zstandard: fix division by zero when using RingBuffer
This change fixes some division-by-zero bugs introduced by the optimized
ring buffer read/write functions in d8c067966.

There are edge cases where decompression can use a length zero ring
buffer as the size of the ring buffer used is exactly the the window
size specified by a Zstandard frame, and this can be zero. Switching
away from loops to mem copies means that we need to ensure ring buffers
do not have length zero ring when attempting to read/write from them.
2023-11-10 15:18:16 -05:00
Andrew Kelley
dfee782d7c compiler_rt: provide strncpy impl for ssp 2023-11-10 13:12:16 -07:00
Andrew Kelley
53f74d6a04 move libssp into libcompiler_rt
closes #7265
2023-11-10 13:12:10 -07:00
Andrew Kelley
2a81a0f388 stage1: we don't need have_stage1 config option anymore 2023-11-10 13:12:05 -07:00
Andrew Kelley
24b020d9f6 Compilation: fix logic regarding needs_c_symbols 2023-11-10 13:12:00 -07:00
Jakub Konka
9ad03b628f
Merge pull request #17955 from ziglang/issue-17951
macho: handle special section/segment boundary symbols
2023-11-10 18:36:06 +01:00
Bogdan Romanyuk
ec934c6d32 disallow calling @trap at comptime 2023-11-10 18:39:42 +02:00
Jakub Konka
17177727c0 test/link: refactor common bits between ELF and MachO tests 2023-11-10 13:50:33 +01:00
Jakub Konka
7566a8fbd8 test/link: spawn ELF and MachO tests from the same root test/link/link.zig 2023-11-10 13:44:43 +01:00
Jakub Konka
197fd41e27 macho: check for null Module before creating llvm_object 2023-11-10 13:43:43 +01:00
Jakub Konka
0f2489d8fc macho: resolve special section/segment boundary symbols
Boundary symbols have a special name prefix:

* section$start$segname$sectname
* section$stop$segname$sectname
* segment$start$segname
* segment$stop$segname

and will resolve to either start or end of the respective
section/segment if found.

If not found, we return an error stating we couldn't find the
requested section/segment rather than silently failing and resolving
the address to 0 which seems to be the case with Apple's ld64.
2023-11-10 12:52:56 +01:00
Andrew Kelley
03adafd802
Merge pull request #17947 from jacobly0/fwd-clang-errs
Compilation: forward clang diagnostics to error bundles
2023-11-10 02:35:22 -05:00
Jakub Konka
c550eb3e8a
Merge pull request #17933 from ziglang/elf-r-mode
elf: the dreaded `-r` mode
2023-11-10 07:57:52 +01:00
mlugg
3f10b3ee1e Sema: do not allow comptime-only pointer fields in packed structs 2023-11-10 06:51:48 +00:00
mlugg
e9b3fcaa43 Sema: remove unused function 2023-11-10 06:51:48 +00:00
Jacob Young
a67d378543 stage1: implement wasi seek shim 2023-11-09 20:12:47 -05:00
Jakub Konka
73fd4ed54b test/link/elf: make .eh_frame relocatable test also verify COMDATs we emit 2023-11-09 23:22:47 +01:00
Jakub Konka
08882234d1 elf: fix overflowing designated capacity when writing COMDAT groups 2023-11-09 23:16:41 +01:00
Jacob Young
10f4486c0b Compilation: forward clang diagnostics to error bundles 2023-11-09 16:43:12 -05:00
Jakub Konka
6e797d8648 elf: add SHF_INFO_LINK flag to any emitted SHT_RELA section 2023-11-09 19:41:50 +01:00
Jakub Konka
27970bab07 elf: format shdr flags when dumping state 2023-11-09 18:49:19 +01:00
Bogdan Romanyuk
6b9f7e26c9 preserve 'undefined' in @bitCast 2023-11-09 19:40:20 +02:00
Jakub Konka
03c3a85ea3 elf: write out COMDAT groups to file 2023-11-09 18:29:58 +01:00
Jakub Konka
acd7cbf0b5 elf: init output COMDAT group sections 2023-11-09 17:41:14 +01:00
Bogdan Romanyuk
ee8da40769 replace deprecated std.math.absCast 2023-11-09 17:39:27 +02:00
Jakub Konka
031d9faf02 elf: separate logic for reseting shdr indexes into a separate fn 2023-11-09 15:05:29 +01:00
Jakub Konka
50f48022f0 test/link/elf: fix .eh_frame test 2023-11-09 14:51:00 +01:00
Jakub Konka
1f8dd27e40 elf: correctly format output .eh_frame when emitting relocatable 2023-11-09 14:46:28 +01:00
Jakub Konka
b1fcf0ed8f elf: emit .rela.eh_frame section contents 2023-11-09 12:24:49 +01:00
Jakub Konka
0efc471122 elf: calculate required size for .rela.eh_frame 2023-11-09 12:02:20 +01:00
Jakub Konka
666ac6bf9b elf: track .rela.eh_frame section and emit .eh_frame section symbol 2023-11-09 11:49:32 +01:00
Jakub Konka
f607126614 test/link/elf: verify we can output a valid relocatable with .eh_frame section 2023-11-09 11:49:04 +01:00
Jakub Konka
0de5dd2ef1 elf: misc fixes 2023-11-09 10:32:39 +01:00
Linus Groh
e72049bc61 std.math: Add isPositiveZero() and isNegativeZero() 2023-11-09 00:55:43 -07:00
Andrew Kelley
b2ed2c4d4f
Merge pull request #17888 from AdamGoertz/zig-reduce
zig-reduce: Add reductions for `if` and `while`
2023-11-09 00:52:38 -07:00
mlugg
d99bed1b10 Sema: optimize runtime array_mul
There are two optimizations here, which work together to avoid a
pathological case.

The first optimization is that AstGen now records the result type of an
array multiplication expression where possible. This type is not used
according to the language specification, but instead as an optimization.
In the expression '.{x} ** 1000', if we know that the result must be an
array, then it is much more efficient to coerce the LHS to an array with
length 1 before doing the multiplication. Otherwise, we end up with a
1000-element tuple which we must coerce to an array by individually
extracting each field.

Secondly, the previous logic would repeatedly extract element/field
values from the LHS when initializing the result. This is unnecessary:
each element must only be extracted once, and the result reused.

These changes together give huge improvements to compiler performance on
a pathological case: AIR instructions go from 65551 to 15, and total AIR
bytes go from 1.86MiB to 264.57KiB. Codegen time spent on this function
(in a debug compiler build) goes from minutes to essentially zero.

Resolves: #17586
2023-11-08 23:55:53 -07:00
Andrew Kelley
a1d688b86a
Merge pull request #17913 from jacobly0/vararg-int
Sema: implement vararg integer promotions
2023-11-08 23:52:59 -07:00
mlugg
997eaf6d87 Sema: do not force resolution of struct field inits when calling function pointer field
b3462b7 caused a regression in a third-party project, since it forced
resolution of field initializers for any field call 'foo.bar()', despite
this only being necessary when 'bar' is a comptime field.

See https://github.com/ziglang/zig/pull/17692#issuecomment-1802096734.
2023-11-08 23:47:10 -07:00
frmdstryr
f258a391da
Speed up ast.tokenLocation 2023-11-09 01:45:25 +00:00