Commit Graph

21156 Commits

Author SHA1 Message Date
Veikka Tuominen
9e276d32f3 Sema: fix memory management of missing field error
Closes #13590
2022-11-20 20:25:12 +02:00
Veikka Tuominen
9e7293619f llvm: aarch64 C ABI: pass byref params as mutable pointers
Closes  #13597
2022-11-20 20:25:12 +02:00
Veikka Tuominen
08a00f0d1c llvm: use alignment of ABI return type when it differs from raw return type
This would previously cause miscompilations when the ABI type had
bigger alignment than the raw type.
2022-11-20 20:25:12 +02:00
Veikka Tuominen
835a1f7f0c Sema: fix missing error on mismatched array init count
Closes #13582
2022-11-20 20:25:12 +02:00
Veikka Tuominen
034507ef7c Module: fix compile error for non-comptime-known global initializer 2022-11-20 20:25:12 +02:00
Veikka Tuominen
98b3734b67 Sema: prioritize Value.variable over OPV when resolving const value
Closes #12275
2022-11-20 20:25:12 +02:00
Veikka Tuominen
9877a7d36c print_air: print ty_pl type 2022-11-20 20:25:11 +02:00
Veikka Tuominen
bc76873827 Sema: fix type check in zirIntToPtr
Simple fix: don't assume a ptr type before it has been checked.

Closes #13567
2022-11-20 20:25:11 +02:00
Veikka Tuominen
7b131a7cd4 Module: fix fieldSrcLoc for generated types 2022-11-20 20:25:11 +02:00
Veikka Tuominen
510b891d27 Sema: handle opt_payload in beginComptimePtrLoad 2022-11-20 20:25:11 +02:00
Veikka Tuominen
0616d2966a Sema: allow coercing typed undefined to int
Closes #13556
2022-11-20 20:25:11 +02:00
Veikka Tuominen
e5a3eb9777 Type: make hasRuntimeBitsAdvanced take AbiAlignmentAdvancedStrat
I wasn't able to create a reduced test case for this but the reasoning
can be seen in `abiAlignmentAdvancedUnion` where if `strat` was lazy
`hasRuntimeBitsAdvanced` would be given `null` instead of `sema`
which would cause eager evaluation when it is not valid or desired.
2022-11-20 20:25:11 +02:00
Veikka Tuominen
44f8714dfb translate-c: cast unsuffixed floats to f64 2022-11-20 16:10:54 +02:00
Guillaume Wenzek
476b946802
compute LLVMTypes in ParamTypeIterator (#13592)
follow up on #13376 - fixes a bug in the x86_64 C ABI. 

Co-authored-by: Veikka Tuominen <git@vexu.eu>
2022-11-20 01:14:02 -08:00
Ali Chraghi
fca776f8f5 os: windows: fix unhandled error 2022-11-19 22:48:32 +02:00
Jimmi Holst Christensen
adc3fafbc0 c backend: Output string literals for array init of bytes 2022-11-19 11:59:33 -05:00
Casey Banner
f746e11879
linker: fail the compilation if there were linker errors
There was no check for linker errors after flushing,
which meant that if the link failed the build would
continue and try to copy the non-existant exe, and
also write the manifest as if it had succeeded.

Also adds parsing of lld output, which is surfaced at the
end of the compilation with the other errors instead
of via stderr
2022-11-19 15:57:08 +02:00
Andrew Kelley
0697883d01 extract C backend behavior tests with vectors
No functional change. Separates various float operations behavior tests
from the ones that test vectors.
2022-11-19 01:29:51 -05:00
kkHAIKE
ea590ece4b
Sema: optimize compare comptime float with int 2022-11-18 22:06:49 +02:00
Stevie Hryciw
04f3067a79 run zig fmt on everything checked by CI 2022-11-18 19:22:42 +00:00
Stevie Hryciw
e999f9f472 std: replace parseAppend with parseWrite in std.zig.string_literal 2022-11-18 19:22:42 +00:00
Stevie Hryciw
ca9e1760e8 fmt: canonicalize identifiers 2022-11-18 19:22:42 +00:00
Stevie Hryciw
d6d4f2481d translate-c: use .identifier tokens in .identifier AST nodes 2022-11-18 19:22:42 +00:00
Stevie Hryciw
be737bb5cc stage1: delete keywords
Backports 05cf449 to the C++ implementation.
2022-11-18 19:22:42 +00:00
remeh
e7424d5d2a std.array_list: add a comment on every methods invalidating pointers.
While it is already mentioned on the `items` attributes of the structs, it is
interesting to comment in every method potentially invalidating pointers to items
that they may do so.
2022-11-18 14:49:31 +02:00
Veikka Tuominen
3c0c0f899b
Merge pull request #13417 from InKryption/rand-deterministic-indexing
std.Random: add functions with explicit index type
2022-11-18 14:48:51 +02:00
Veikka Tuominen
8082323dfd
Merge pull request #13411 from dweiller/custom-test-runner
Custom test runner
2022-11-18 14:47:21 +02:00
Stevie Hryciw
5f6f38ff31 std.math.big.int: implement popCount() for Const 2022-11-18 14:31:30 +02:00
Guillaume Wenzek
5221c90164
add C ABI tests with double
const DC = extern struct { v1: f64, v2: u8 };
const CFF = extern struct { v1: u8, v2: f32, v3: f32 };
const PD = extern struct { v1: ?*anyopaque, v2: f64 };

Signed-off-by: Guillaume Wenzek <gwenzek@users.noreply.github.com>
2022-11-18 14:05:25 +02:00
Andrew Kelley
6c931c32bb
Merge pull request #13579 from jedisct1/ghash-fix-wasm32 2022-11-18 04:17:35 -05:00
Frank Denis
4dd061a7ac ghash: handle the .hi_lo case when no CLMUL acceleration is present, too 2022-11-17 23:54:21 +01:00
Frank Denis
3051e279a5 Reapply "std.crypto.onetimeauth.ghash: faster GHASH on modern CPUs (#13566)"
This reapplies commit 72d3f4b5dc.
2022-11-17 23:52:58 +01:00
Andrew Kelley
72d3f4b5dc Revert "std.crypto.onetimeauth.ghash: faster GHASH on modern CPUs (#13566)"
This reverts commit 7cfeae1ce7 which
is causing std lib tests to fail on wasm32-wasi.
2022-11-17 15:37:37 -07:00
kcbanner
88a0f3d0e5 windows: fix _tls_index not being defined if libc wasn't linked, and fix x86 name mangling 2022-11-17 11:08:21 -05:00
Frank Denis
7cfeae1ce7
std.crypto.onetimeauth.ghash: faster GHASH on modern CPUs (#13566)
* std.crypto.onetimeauth.ghash: faster GHASH on modern CPUs

Carryless multiplication was slow on older Intel CPUs, justifying
the need for using Karatsuba multiplication.

This is not the case any more; using 4 multiplications to multiply
two 128-bit numbers is actually faster than 3 multiplications +
shifts and additions.

This is also true on aarch64.

Keep using Karatsuba only when targeting x86 (granted, this is a bit
of a brutal shortcut, we should really list all the CPU models that
had a slow clmul instruction).

Also remove useless agg_2 treshold and restore the ability to
precompute only H and H^2 in ReleaseSmall.

Finally, avoid using u256. Using 128-bit registers is actually faster.

* Use a switch, add some comments
2022-11-17 13:07:07 +01:00
Jonathan Marler
58d9004cea packed struct fix example and clarify least to most significant ordering
The packed struct example was mistakenly applying endianness where it
shouldn't have been.  This wasn't being caught because we don't currently
test the examples on Big-endian systems.

I updated the test to remove the endianness where it didn't apply, and
added a new part of the test to demonstrate when it would apply.
2022-11-17 12:11:43 +02:00
Björn Linse
a09a5ad574 stdlib: make linux.PERF.TYPE non-exhaustive
perf_event_attr.type needs to take a runtime defined value to enable
dynamic PMU:s, such as kprobe and uprobe. This value can exceed
predefined values defined in the linux headers.

reference: perf_event_open(2) man page
2022-11-16 19:02:24 -05:00
Eric Joldasov
3c3def6ac2 process.zig: remove unused function getSelfExeSharedLibPaths 2022-11-16 18:51:11 -05:00
Guillaume Wenzek
699e7f721b fix Nvptx backend outputing files at the top level of zig-cache 2022-11-16 18:49:04 -05:00
Andrew Kelley
07671838b0
Merge pull request #13561 from jacobly0/gcc-warnings 2022-11-16 10:38:44 -05:00
Eric Joldasov
684264908e compiler_rt: fix TODOs in udivmod.zig 2022-11-16 13:08:41 +02:00
Veikka Tuominen
eed82ca287
Merge pull request #13558 from Vexu/stage2-fixes
Stage2 bug fixes to get third party projects building
2022-11-16 12:56:51 +02:00
Jacob Young
3ae04ed949 cbe: fix identifiers colliding with the short keyword 2022-11-16 01:26:37 -05:00
Jacob Young
a9c005e0e4 cbe: fixed tagged union initializers of a zero-bit field type
Fixes missing braces warnings on gcc 11.3.0.
2022-11-15 23:33:48 -05:00
Jacob Young
b82aec5a15 cbe: fix indexing with a zero-bit element type
Fixes void dereference warnings on gcc 11.3.0.
2022-11-15 23:33:48 -05:00
Jacob Young
b5b507a742 zig.h: match float comparison signatures from compiler rt 2022-11-15 23:33:48 -05:00
mike
a93fa29d8f zig-cache: support windows drive + fwd-slash paths
closes #13539
2022-11-15 22:12:52 -05:00
Veikka Tuominen
28cbe5e92a Sema+llvm: improve handling of namespace-like unions
Closes #13557
2022-11-16 01:13:35 +02:00
Veikka Tuominen
fe6249348f Sema: ensure comptime reference to function points to original decl
This prevents sema from creating new decls for the functions and
passing them to the backends as non-function decls.

Closes #12501
2022-11-16 01:12:54 +02:00
Veikka Tuominen
fb09093d95 Module: call ensureDeclAnalyzed on builtin.test_functions
Previously the compiler would crash on branching on undefined values
if you tried using `zig test` with a freestanding target since there
was no start code referencing `builtin.test_functions`.

Closes #12554
2022-11-16 01:12:28 +02:00