Commit Graph

25104 Commits

Author SHA1 Message Date
Eric Joldasov
a89b83cc9d
std.os.windows.advapi32: add RegGetValueW
Signed-off-by: Eric Joldasov <bratishkaerik@getgoogleoff.me>
2023-07-23 17:10:57 +06:00
Andrew Kelley
1bf16b1723
Merge pull request #16495 from ziglang/bun
fix recent compiler regressions found when compiling bun
2023-07-22 23:18:47 -07: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
Andrew Kelley
076b54c8e7 frontend: fix wrong result of Value.getFunction
Fixes regression introduced in
db33ee45b7.

Found from compiling bun. Unfortunately we do not have a behavior test
reduction for this bug.
2023-07-22 19:57:23 -07:00
Josh Wolfe
1ae839cd24
Update CODEOWNERS
Take ownership of std.json
2023-07-22 19:15:42 -04:00
Josh Wolfe
c72a9feabe
std.json: support parsing json at comptime using FixedBufferAllocator (#16488) 2023-07-22 18:52:26 -04:00
Josh Wolfe
2ad16248d7
std.json.WriteStream: eliminate dead memory in optimized modes (#16485) 2023-07-22 18:49:59 -04:00
Garrett
04c7b55de4
std.json: fix key allocation in HashMap for streaming json parsing (#16422) 2023-07-22 22:33:50 +00:00
Andrew Kelley
32a175740c cmake: don't ask zig2 to do hard things
Apparently hard things:
 * run autodoc on the std lib
 * build the langref

If any zig distros want these documentation, they'll need to get them
from a stage3 `zig build` instead of stage2 (LLVM backend instead of C
backend).
2023-07-22 11:04:38 -07:00
Krzysztof Wolicki
4bc90f17bb
autodoc: Fix an issue with aliased functions (#16421) 2023-07-22 16:36:26 +02:00
Andrew Kelley
6e4fff6ba6 move installation logic to the build script where it belongs
* build.zig: introduce `-Dflat` option which makes the installation
  match what we want to ship for our download tarballs. This allows
  deleting a bunch of shell script logic from the CI.
  - for example it puts the executable directly in prefix/zig rather
    than prefix/bin/zig and it additionally includes prefix/LICENSE.
* build.zig: by default also install std lib documentation to doc/std/
  - this can be disabled by `-Dno-autodocs` similar to how there is
    already `-Dno-langref`.
* build.zig: add `std-docs` and `langref` steps which build and install
  the std lib autodocs and langref to prefix/doc/std and
  prefix/doc/langref.html, respectively.

* std.Build: implement proper handling of `-femit-docs` using the
  LazyPath system. This is a breaking change.
  - this is a partial implementation of #16351
* frontend: fixed the handling of Autodocs with regards to caching and
  putting the artifacts in the proper location to integrate with the
  build system.
  - closes #15864

* CI: delete the logic for autodocs since it is now handled by build.zig
  and is enabled by default.
  - in the future we should strive to have nearly all the CI shell
    script logic deleted in favor of `zig build` commands.
* CI: pass `-DZIG_NO_LIB=ON`/`-Dno-lib` except for the one command where
  we want to actually generate the langref and autodocs. Generating the
  langref takes 14 minutes right now (why?!) so we don't want to do that
  more times than necessary.

* Autodoc: fixed use of a global variable. It works fine as a local
  variable instead.
  - note that in the future we will want to make Autodoc run
    simultaneously using the job system, but for now the principle of
    YAGNI dictates that we don't have an init()/deinit() API and instead
    simply call the function that does the things.
* Autodoc: only do it when there are no compile errors
2023-07-22 00:16:27 -07:00
Andrew Kelley
1291f4aca4
Merge pull request #16480 from r00ster91/embedfile
fix `@embedFile("")` not giving a proper error
2023-07-21 22:46:41 -07:00
iacore
f31e114f63
zig fmt: additionally auto-fix @byteSwap (#16462) 2023-07-22 01:42:39 -04:00
r00ster91
d962ad5ea0 codegen: writer().writeByteNTimes -> appendNTimes
Both ways do the same thing but I think the compiler might have an
easier time optimizing `appendNTimes` because it does less
things/the path is shorter.

I have not done any benchmarking at runtime but have compared the
instruction count of both ways a little here: https://zig.godbolt.org/z/vr193W9oj
`b` (`appendNTimes`) is ~103 instructions while `a`
(`writer().writeByteNTimes`) is ~117 instructions.

And looking at the implementation of `writeByteNTimes`, it only seems to
buffer up 256 bytes before doing another `writeAll` which for
`std.ArrayList` probably means another allocation, whereas when directly
using `appendNTimes`, the entire exact additional capacity required is known from the start.

Either way, this would be more consistent anyway.
2023-07-21 21:32:18 -07:00
Luuk de Gram
619140c0d2 wasm: correctly intcast signed integers
When a signed integer's bitsize is not 32 or 64, but the given
bitsize and wanted bitsize are either both represented by Wasm's i32
or i64, we must either sign extend or wrap the integer.
2023-07-22 02:12:07 +02:00
Josh Wolfe
8924f81d8c
std.json: Unify stringify and writeStream (#16405) 2023-07-21 19:56:46 -04:00
Andrew Kelley
a2d81c547c llvm: fix building for 32-bit targets 2023-07-21 16:37:50 -07:00
r00ster91
72ac37952e fix @embedFile("") not giving a proper error
Currently, in a debug build of the compiler, `@embedFile("")` is a crash;
in a release build the compiler, `@embedFile("")` is "error: unable to open '': OutOfMemory".
2023-07-21 23:39:42 +02:00
r00ster91
279ebabd7d fix some whitespace formatting in switchs
If you view this commit with `git show -w`, there is no diff.
2023-07-21 23:05:41 +02:00
r00ster91
295b96f78b langref builtin parameters: []u8 -> []const u8
None of these builtins modify the passed string.
This parameter type can be misleading.
2023-07-21 23:03:26 +02:00
Loris Cro
426e737292 autodoc: avoid recursing reference loops in call instructions 2023-07-21 18:45:50 +02:00
Jakub Konka
61d5b7c957
Merge pull request #15823 from kcbanner/dwarf_unwind
Add DWARF unwinding, and an external debug info loader for ELF
2023-07-21 17:37:22 +02:00
Jakub Konka
c43ee5bb22
Merge pull request #16456 from ziglang/check-object-more-elf
std: dump .dynamic, .symtab, .dysym for ELF in `CheckObject`; remove wildcard matchers in favour of `checkContains` helper
2023-07-21 07:25:44 +02:00
kcbanner
b1d86db7b4 dwarf: move macho unwind code from macho -> dwarf
dwarf: fixup unchecked .eh_frame CIE offset subtraction
2023-07-20 22:58:16 -04:00
kcbanner
8e6a62ba10 test: disable omit_frame_pointer unwinding tests on aarch64-macos
dwarf: handle signal frame CIE flag
2023-07-20 22:58:16 -04:00
kcbanner
6d87bb370a debug: disable the new unwinder on aarch64-macos 2023-07-20 22:58:16 -04:00
kcbanner
253e6971ad dwarf: implement aarch64 default register rules 2023-07-20 22:58:16 -04:00
kcbanner
4421b14878 dwarf: fixup rules for setting ip 2023-07-20 22:58:16 -04:00
kcbanner
2bc2b01dbc dwarf: update the pc register 2023-07-20 22:58:16 -04:00
kcbanner
d99b40d38b dwarf: fix the unwinder using the incorrect row from the FDE in certain cases 2023-07-20 22:58:16 -04:00
kcbanner
1a2bb70956 dwarf: write the CFA as SP before the register update, in case the SP itself is updated by a column rule 2023-07-20 22:58:16 -04:00
kcbanner
97bda56306 macho: don't scan all eh_frame entries, instead follow the offset from the __unwind_info directly 2023-07-20 22:58:16 -04:00
kcbanner
774dc2fdb7 dwarf: add explicit_fde_offset to support more optimal __unwind_info dwarf lookups 2023-07-20 22:58:16 -04:00
kcbanner
bdb0a6fa77 test: add a test for dwarf embedded in coff 2023-07-20 22:58:16 -04:00
kcbanner
2c76020e77 debug: load the macho unwind sections from the already-mapped image 2023-07-20 22:58:16 -04:00
kcbanner
618b0eb3d3 dwarf: fixup integer overflow in readEhPointer
debug: handle the possibility of eh_frame / debug_frame being mapped in memory or loaded from disk
2023-07-20 22:58:16 -04:00
kcbanner
5e399d97d7 use eh_frame from the mapped binary if available 2023-07-20 22:58:16 -04:00
kcbanner
ba813d00f5 dwarf: add abi.stripInstructionPtrAuthCode 2023-07-20 22:58:16 -04:00
kcbanner
ec96095efd compilation: pass omit_frame_pointer through to builtin.zig
Renamed dwarf_unwinding -> stack_iterator to better reflect that it's not just DWARF unwinding.
Added a test for unwinding with a frame pointer.
2023-07-20 22:58:16 -04:00
kcbanner
7d8b423477 macho: remove unnecessary checks 2023-07-20 22:58:16 -04:00
kcbanner
9549b4acf6 debug: fixup an inconsistency in the getcontext implementation on aarch64-macos 2023-07-20 22:58:16 -04:00
kcbanner
06bf2e048b tests: use a more portable way of determining the return address in the test code 2023-07-20 22:58:16 -04:00
kcbanner
b18031335a dwarf: use cie.return_address_register instead of assuming it's in the IP register 2023-07-20 22:58:16 -04:00
kcbanner
9b25bee42c debug: fixup have_getcontext 2023-07-20 22:58:15 -04:00
kcbanner
e5aa2bb224 debug: fixup last_error being printed too many times 2023-07-20 22:58:15 -04:00
kcbanner
891fa3b8b5 debug: fix initialization of the optional fields on StackIterator
dwarf: documentation fixups
target: enable unwind tables on macho
2023-07-20 22:58:15 -04:00
kcbanner
5dfb159e15 macho: add aarch64 implementation to unwindFrame
dwarf: map the V registers in abi.regBytes
test: add test case that exercises the stack-indirect __unwind_info mode in x86_64
2023-07-20 22:58:15 -04:00
kcbanner
203d96ae97 debug: add relocateContext
dwarf: fixup tests that used a ThreadContext
2023-07-20 22:58:15 -04:00
kcbanner
94354aa6aa macho: add unwindFrame which can unwind stack frames using the __unwind_info section
dwarf: fixup missing error
2023-07-20 22:58:15 -04:00