32332 Commits

Author SHA1 Message Date
Eric Joldasov
5bbf3f5561
std.fs.path.joinSepMaybeZ: replace while-loops with for-loops
Signed-off-by: Eric Joldasov <bratishkaerik@landless-city.net>
2025-01-20 14:29:01 +05:00
Alex Rønne Petersen
d5db02728c
Merge pull request #22530 from alexrp/omit-unwind-tables
Fix building the standard library without CFI directives
2025-01-20 07:24:12 +01:00
Jacob Young
5cfcb01503 llvm: convert @divFloor and @mod to forms llvm will recognize
On x86_64, the `@divFloor` change is a strict improvement, and the
`@mod` change adds one zero latency instruction.  In return, once we
upgrade to LLVM 20, when the optimizer discovers one of these operations
has a power-of-two constant rhs, it will be able to optimize the entire
operation into an `ashr` or `and`, respectively.

                      #I   CPL   CPT
    old `@divFloor` |  8 | 15 | .143 |
    new `@divFloor` |  7 | 15 | .148 |
    old `@mod`      |  9 | 17 | .134 | (rip llvm
    new `@mod`      | 10 | 17 | .138 |  scheduler)
2025-01-19 22:10:39 -05:00
Alex Rønne Petersen
b074fb7dda std.zig.system.x86: Update Intel/AMD model detection. 2025-01-19 23:42:39 +01:00
Alex Rønne Petersen
0ead0beb83
Merge pull request #22524 from alexrp/libunwind-exceptions
`libunwind`: Build C files with `-fexceptions`.
2025-01-19 06:46:24 +01:00
Jacob Young
8ee80d61f6 x86_64: add a bunch of instruction encodings
Closes #19773
2025-01-18 23:30:45 -05:00
Alex Rønne Petersen
db8ed730e7 std.Thread: Fix wasi_thread_start() export to use a pointer.
Closes #22518.
2025-01-19 03:23:00 +01:00
Alex Rønne Petersen
45bb4f955c
test: Add a standalone test for omitting CFI directives. 2025-01-19 02:15:30 +01:00
Alex Rønne Petersen
8a78d875cc
std.os.linux: Don't emit CFI directives if unwind tables are disabled. 2025-01-19 02:15:30 +01:00
Alex Rønne Petersen
4de661ef18
start: Don't emit CFI directives if unwind tables are disabled. 2025-01-19 02:15:30 +01:00
Matthew Lugg
ebf782e944
Merge pull request #22531 from mlugg/various-fixes
incremental, Sema: minor fixes
2025-01-19 00:16:26 +00:00
Andrew Kelley
a5d2aaa936
Merge pull request #22526 from alexrp/cpu-feature-hacks
`std.zig.system`: Move CPU feature hacks after ABI detection.
2025-01-18 18:22:11 -05:00
Jacob Young
128658038d debug: fix std.debug.NoPanic compile errors 2025-01-18 17:33:10 -05:00
Jacob Young
a446101677 x86_64: enable struct field reordering
The blocker for enabling this feature was my need to debug the emitted
assembly without debug info and having to manually inspect memory to
determine struct contents.  However, we now have debug info!

    (lldb) v -L foo bar
    0x00007fffffffda20: (repro.repro.Foo) foo = {
    0x00007fffffffda24:   .x = 12
    0x00007fffffffda20:   .y = 34
    }
    0x00007fffffffda28: (repro.repro.Bar) bar = {
    0x00007fffffffda28:   .x = 56
    0x00007fffffffda2c:   .y = 78
    }

Updates #21530
2025-01-18 16:14:51 -05:00
andrewkraevskii
3dadb8c4c9 autodocs: reflow comment to prevent it from been put in blockquote 2025-01-18 15:45:03 +01:00
mlugg
3b6e5ba490
Sema: don't try to initialize global union pointer at comptime
Resolves: #19832
2025-01-18 14:30:06 +00:00
mlugg
f7b9f84df2
incremental: fix enum resolution bugs 2025-01-18 14:30:06 +00:00
Alex Rønne Petersen
566cc4f99d
compiler: Fix @import("builtin").unwind_tables logic. 2025-01-18 14:57:41 +01:00
Alex Rønne Petersen
332add7a65
libunwind: Build C files with -fexceptions.
See: https://github.com/llvm/llvm-project/pull/121819

This fixes LTO for libunwind, so also re-enable support for that.

Closes #12828.
2025-01-18 13:15:58 +01:00
Alex Rønne Petersen
515c97065a
Revert "work around llvm failing to lower memcpy"
This reverts commit acf70439551fc3f49b2d292ff93ee519901cdf42.

Fixed as of ec768b7fa2f9c7dea6b92651bef59a7eea3299f2.
2025-01-18 12:59:41 +01:00
Alex Rønne Petersen
9758371419
std.zig.system: Move CPU feature hacks after ABI detection.
This was accidentally broken in #22434.
2025-01-18 12:59:38 +01:00
Andrew Kelley
f38d7a92cc
Merge pull request #22513 from ziglang/memcpy
enhance memcpy and remove redundant implementations
2025-01-17 22:52:03 -05:00
Andrew Kelley
f7f6217df9 macho linker: adjust symbol priority
strong symbols always take precedence over weak symbols.
2025-01-17 15:12:01 -08:00
axel escalada
f9a43770c8
std.zip: Add ZIP64 support for local file header extra field
This PR adds support for handling ZIP64 format in local file headers,
when a zip file contains entries where the compressed or uncompressed
size fields are set to 0xFFFFFFFF, and the extra field contains ZIP64
extended information tag (0x0001)

The code now:

Reads the actual sizes from the ZIP64 extra field data
Validates these sizes against the entry's compressed and uncompressed sizes

Zip file format spec.: https://pkware.cachefly.net/webdocs/casestudies/APPNOTE.TXT

This change allows proper extraction of ZIP files that use ZIP64 format in their
local file headers.

Fixes: #22329
2025-01-17 22:55:55 +01:00
Andrew Kelley
acf7043955 work around llvm failing to lower memcpy
triggers an assertion in LegalizeDAG otherwise
2025-01-17 13:21:30 -08:00
Andrew Kelley
59acfb1263 compiler_rt: don't rely on weak aliases 2025-01-17 12:53:25 -08:00
David Rubin
f278038923 replace compiler_rt memcpy with a better version 2025-01-17 12:34:15 -08:00
Andrew Kelley
b07958e6b7 delete asm files from wasi libc
why the hell are there asm files in wasi libc to begin with?
2025-01-17 12:34:15 -08:00
Andrew Kelley
e6dc85f1b4 remove memcpy and memmove from bundled libcs
These are provided instead by compiler_rt.

Part of #2879
2025-01-17 12:34:15 -08:00
pfg
c748eb2416
std.Build: fix setLibCFile() to add step dependencies 2025-01-17 20:42:55 +01:00
Andrew Kelley
4bace0f621
Merge pull request #22386 from jacobly0/x86_64-rewrite
x86_64: begin rewriting instruction selection
2025-01-17 01:20:11 -05:00
Jacob Young
8c8dfb35f3 x86_64: fix crashes compiling the compiler and tests 2025-01-16 20:47:30 -05:00
Jacob Young
c3d33440f0 x86_64: pass more behavior tests 2025-01-16 20:47:30 -05:00
Jacob Young
666d76d85c x86_64: implement load and store 2025-01-16 20:47:30 -05:00
Jacob Young
6d1fc0f51c x86_64: implement aggregate access 2025-01-16 20:47:30 -05:00
Jacob Young
63730441d0 x86_64: implement union access 2025-01-16 20:47:30 -05:00
Jacob Young
5069f574f4 x86_64: remove pointless jump to epilogue 2025-01-16 20:47:30 -05:00
Jacob Young
3240adfa16 x86_64: implement pointer addition and subtraction 2025-01-16 20:47:30 -05:00
Jacob Young
0d9079f466 x86_64: implement element access 2025-01-16 20:47:30 -05:00
Jacob Young
870443f7fa x86_64: implement passing undefined as a call arg with the new cc 2025-01-16 20:47:30 -05:00
Jacob Young
094ac8c3dc x86_64: fix f16 miscomp exposed by new calling convention 2025-01-16 20:47:30 -05:00
Jacob Young
b7acd97789 x86_64: fix hazards exposed by new calling convention 2025-01-16 20:47:30 -05:00
Jacob Young
074232b3e5 x86_64: implement a custom calling convention for the Zig language 2025-01-16 20:47:30 -05:00
Jacob Young
3c74a478a4 x86_64: fix unnecessary register saving 2025-01-16 20:42:08 -05:00
Jacob Young
7f22c41e09 x86_64: add some ReleaseSmall support 2025-01-16 20:42:08 -05:00
Jacob Young
df7661b8d3 x86_64: optimize value copying slightly 2025-01-16 20:42:08 -05:00
Jacob Young
e5d5a8bc4e x86_64: implement switch jump tables 2025-01-16 20:42:08 -05:00
Jacob Young
ac1a975f9b x86_64: implement clz and not 2025-01-16 20:42:08 -05:00
Jacob Young
a7efc56d86 x86_64: the previous loop abstraction was too confusing
The temp usage was non-obvious, and implicit instructions hard to
reason about.
2025-01-16 20:42:08 -05:00
Jacob Young
a1828ebcda x86_64: demolish the old 2025-01-16 20:42:08 -05:00