11638 Commits

Author SHA1 Message Date
Loris Cro
015ea6fd6c
Merge branch 'master' into autodoc-pkg-mod 2023-04-25 20:03:53 +02:00
Andrew Kelley
a2fe81a639
Merge pull request #15421 from Vexu/fixes
Runtime safety improvements
2023-04-24 16:23:03 -07:00
Andrew Kelley
ef0a02081d
Merge pull request #15290 from mlugg/feat/builtin-in-comptime
Add `@inComptime` builtin
2023-04-24 12:54:12 -07:00
Ian Johnson
2be347a2c8 Sema: allow method calls on optional pointers 2023-04-24 09:35:54 +03:00
Andrew Kelley
2dbcc03fb8
Merge pull request #15405 from Luukdegram/wasm
wasm: implement more runtime safety checks
2023-04-23 15:39:36 -07:00
mlugg
35d82d31be Add @inComptime builtin
Resolves: #868
2023-04-23 13:16:42 -07:00
kcbanner
42ee364e7b translate-c: support brace-enclosed string initializers (c++20 9.4.2.1) 2023-04-23 21:45:08 +03:00
zooster
bc8e1e1de4
Improvements to docs and text
* docs(std.math): elaborate on difference between absCast and absInt

* docs(std.rand.Random.weightedIndex): elaborate on likelihood

I think this makes it easier to understand.

* langref: add small reminder

* docs(std.fs.path.extension): brevity

* docs(std.bit_set.StaticBitSet): mention the specific types

* std.debug.TTY: explain what purpose this struct serves

This should also make it clearer that this struct is not supposed to provide unrelated terminal manipulation functionality such as setting the cursor position or something because terminals are complicated and we should keep this struct simple and focused on debugging.

* langref(package listing): brevity

* langref: explain what exactly `threadlocal` causes to happen

* std.array_list: link between swapRemove and orderedRemove

Maybe this can serve as a TLDR and make it easier to decide.

* PrefetchOptions.locality: clarify docs that this is a range

This confused me previously and I thought I can only use either 0 or 3.

* fix typos and more

* std.builtin.CallingConvention: document some CCs

* langref: explain possibly cryptic names

I think it helps knowing what exactly these acronyms (@clz and @ctz) and
abbreviations (@popCount) mean.

* variadic function error: add missing preposition

* std.fmt.format docs: nicely hyphenate

* help menu: say what to optimize for

I think this is slightly more specific than just calling it
"optimizations". These are speed optimizations. I used the word
"performance" here.
2023-04-23 21:06:21 +03:00
Veikka Tuominen
f1e43d1f4f Sema: emit cast to null panics for function pointers
Closes #14676
2023-04-23 19:09:14 +03:00
Veikka Tuominen
f3d18d5413 AstGen: fix debug info for some builtins
Closes #15163
2023-04-23 12:28:50 +03:00
Krzysztof Wolicki
a260fa8bf2 autodoc: Change package to module to better reflect the new names 2023-04-23 01:02:09 +02:00
Luuk de Gram
6c1ab376dd
wasm: store __zig_lt_errors_len in linear data
Rather than using a function call to verify if an error fits within
the global error set's length, we now store the error set' size in
the .rodata segment of the linear memory and load that value onto
the stack to check with the integer value.
2023-04-22 21:57:38 +02:00
Luuk de Gram
d4ceb12ae9
wasm: implement error_set_has_value
This implements the safety check for error casts. The instruction
generates a jump table with 2 possibilities. The operand is used
as an index into the jump table. For cases where the value does
not exist within the error set, it will generate a jump to the
'false' block. For cases where it does exist, it will generate
a jump to the 'true' block. By calculating the highest and lowest
value we can keep the jump table smaller, as it doesn't need to
contain an index into the entire error set.
2023-04-22 21:16:23 +02:00
Luuk de Gram
c4b295bb6e
wasm: implement cmp_lt_errors_len instruction
Creates a global undefined symbol when this instruction is called.
The linker will then resolve it as a lazy symbol, ensuring it is
only generated when the symbol was created. In `flush` it will then
generate the function as only then, all errors are known and we can
generate the function body. This logic allows us to re-use the same
functionality of linker-synthetic-functions.
2023-04-22 21:16:23 +02:00
Andrew Kelley
21aa55d34e
Merge pull request #15356 from jacobly0/cbe-std-tests
cbe: enable CI for std tests
2023-04-22 11:04:36 -07:00
Casey Banner
c7067ef6e8
sema: fix memory corruption caused by resolveStructLayout 2023-04-22 17:12:35 +00:00
Loris Cro
c5fb245f60
Merge branch 'master' into autodoc-src-files-dirs 2023-04-22 19:10:23 +02:00
Loris Cro
ad634bca9f
Merge pull request #15385 from der-teufel-programming/autodoc-cc-inline
autodoc: Handle calling conventions better
2023-04-22 19:07:28 +02:00
Jacob Young
08a8aa100d cbe: fix local aliasing issues in atomic ops 2023-04-21 23:08:48 -04:00
Jacob Young
5feb27c126 zig.h: fix float negation 2023-04-21 23:08:48 -04:00
Krzysztof Wolicki
428f745270 autodoc: Change html file destination dirs
Each file is now saved with its package index in data.json
2023-04-22 02:36:19 +02:00
Jakub Konka
14dfbbc213 macho: rebase lazy pointers and apply corrected base offset 2023-04-21 22:44:28 +02:00
Jakub Konka
9a181f367d macho: mark relocs dirty by target when updating GOT/stubs 2023-04-21 22:44:28 +02:00
Jakub Konka
a596e48d8f coff: mark relocs dirty by target when updating GOT 2023-04-21 22:44:28 +02:00
Jakub Konka
dd300d92e1 coff: treat vmaddr of 0 as unallocated when checking if resolvable 2023-04-21 22:44:28 +02:00
Jakub Konka
bee35fe3f0 coff: add image base to GOT relocations
Sort base relocations by address for deterministic debugging.
2023-04-21 22:44:28 +02:00
Jakub Konka
ae8fb21514 coff: use TableSection for GOT 2023-04-21 22:44:28 +02:00
Jakub Konka
d6e66cff12 macho: fix dirtying of GOT entries 2023-04-21 22:44:28 +02:00
Jakub Konka
f9e9974c8f macho: skip GOT for TLVs; handle them separately when lowering 2023-04-21 22:44:27 +02:00
Jakub Konka
9530b95afe macho: refactor common codepath for collecting bindings from TableSection 2023-04-21 22:44:27 +02:00
Jakub Konka
cec4755310 macho: do not allocate atom for __stub_helper preamble 2023-04-21 22:44:27 +02:00
Jakub Konka
fa40267b04 macho: do not allocate atoms for stub entries 2023-04-21 22:44:27 +02:00
Jakub Konka
c55e821df6 macho: resolve relocs before writing to memory (fixes HCS) 2023-04-21 22:44:27 +02:00
Jakub Konka
91bb9302e5 macho: correctly dirty the GOT table after memory realloc 2023-04-21 22:44:27 +02:00
Jakub Konka
c6e916d7fe macho: fix runtime panics 2023-04-21 22:44:27 +02:00
Jakub Konka
711bc2cf39 macho: use generic TableSection for GOT mgmt 2023-04-21 22:44:27 +02:00
Jakub Konka
8e3100ae02 elf: make TableSection a generic construct 2023-04-21 22:44:27 +02:00
Jakub Konka
8a3ad3f620 elf: do not reserve a GOT slot for every Atom 2023-04-21 22:44:25 +02:00
Jacob Young
d56c6c7791 cbe: implement 128-bit atomics support
* Disable 128-bit atomics for x86_64 generic (currently also baseline)
   because they require heavy abi agreement to correctly lower.
   ** This is a breaking change **
 * Enable 128-bit atomics for aarch64 in Sema since it just works.
2023-04-21 16:36:31 -04:00
Jacob Young
a519c9dace cbe: fix atomic float min/max
These need `zig_atomic`, unlike int min/max.
2023-04-21 16:36:31 -04:00
Jacob Young
e364627e3e cbe: fix float casts involving f16
Fixes bugs with a previous fix to the f16 abi on x86 darwin.
2023-04-21 16:36:31 -04:00
Jacob Young
a1ed4bd796 cbe: fix remaining aarch64 issues 2023-04-21 16:36:31 -04:00
Jacob Young
d98974e826 cbe: fix issues with atomic floats
Since the Zig language documentation claims support for `.Min` and
`.Max` in `@atomicRmw` with floats, allow in Sema and implement for both
the llvm and C backends.
2023-04-21 16:36:30 -04:00
Jacob Young
bf6fd9ae3f cbe: enable CI for std tests 2023-04-21 16:36:10 -04:00
Andrew Kelley
528b66f6ec
Merge pull request #15355 from mlugg/feat/liveness-control-flow
Liveness: control flow analysis and other goodies
2023-04-21 13:32:25 -07:00
Krzysztof Wolicki
7e18bd7f71 autodoc: Handle calling conventions better
special case inline cc in exprName
2023-04-21 11:52:07 +02:00
Eric Rowley
a774f93344 Do not use -fPIC when compiling a UEFI application 2023-04-21 08:22:27 +03:00
Andrew Kelley
ceff278202 fixes to the previous commit
* CompileStep: Avoid calling producesPdbFile() to determine whether the
   option should be respected. If the user asks for it, put it on the
   command line and let the Zig CLI deal with it appropriately.
 * Make the namespace of `std.dwarf.Format.dwarf32` no longer have a
   redundant "dwarf" in it.
 * Add `zig cc` integration for `-gdwarf32` and `-gdwarf64`.
 * Toss in a bonus bug fix for `-gdwarf-2`, `-gdwarf-3`, etc.
 * Avoid using default init values for struct fields unnecessarily.
 * Add missing cache hash addition for the new option.
2023-04-20 15:17:07 -07:00
David Gonzalez Martin
d026202a26 Expose an option for producing 64-bit DWARF format
This commit enables producing 64-bit DWARF format for Zig executables
that are produced through the LLVM backend. This is achieved by exposing
both command-line flags and CompileStep flags. The production of the
64-bit format only affects binaries that use the DWARF format and it is
disabled on MacOS due to it being problematic. This commit, despite
generating the interface for the Zig user to be able to tell the compile
which format is wanted, is just implemented for the LLVM backend, so
clang and the self-hosted backends will need this to be implemented in a
future commit.

This is an effort to work around #7962, since the emission of the 64-bit
format automatically produces 64-bit relocations. Further investigation
will be needed to make DWARF 32-bit format to emit bigger relocations
when needed and not make the linker angry.
2023-04-20 14:46:53 -07:00
Jacob Young
06992e159b
x86_64: fix merge conflict 2023-04-20 20:49:35 +01:00