11220 Commits

Author SHA1 Message Date
Jacob Young
d70955b0df x86_64: turn packed struct crashes into compile errors 2023-03-15 01:04:21 -04:00
Jacob Young
ba9d93dc9f x86_64: implement more binary immediate combinations 2023-03-15 01:04:21 -04:00
Jacob Young
05b12e6779 x86_64: handle duplicate prong deaths 2023-03-15 01:04:21 -04:00
Jacob Young
2386159840 x86_64: use short union init 2023-03-15 01:04:21 -04:00
Jacob Young
d14a9e82fe x86_64: use new for loop syntax 2023-03-15 01:04:21 -04:00
Jacob Young
bb6b9c19e0 x86_64: fix lowering of non-pointer optional is null 2023-03-15 01:04:21 -04:00
Jacob Young
5ab426a302 x86_64: fix store of undefined 2023-03-15 00:01:44 -04:00
Jacob Young
9a4e9215fc x86_64: fix error code paths to not have extra pops 2023-03-15 00:01:44 -04:00
DerryAlex
d6e48abde8
Implement readFromMemory/writeToMemory for ptrLikeOptional 2023-03-14 13:08:56 +02:00
mlugg
1e6d7f7763 Sema: allow comptime mutation of multiple array elements
Previously, if you had a pointer to multiple array elements and tried to
write to it at comptime, it was incorrectly treated as a pointer to one
specific array value, leading to an assertion down the line. If we try
to mutate a value at an elem_ptr larger than the element type, we need
to perform a modification to multiple array elements.

This solution isn't ideal, since it will result in storePtrVal
serializing the whole array, modifying the relevant parts, and storing
it back. Ideally, it would only take the required elements. However,
this change would have been more complex, and this is a fairly rare
operation (nobody ever ran into the bug before after all), so it doesn't
matter all that much.
2023-03-14 13:06:23 +02:00
Jakub Konka
d525ecb523
Merge pull request #14886 from ziglang/x86_64-encoder
x86_64: add table-driven instruction encoder
2023-03-13 20:48:41 +01:00
Ian Johnson
adc6dec26b Sema: avoid panic on callconv(.C) generic return type
Fixes #14854
2023-03-13 13:17:13 +02:00
Jakub Konka
ac434fd8cc x86_64: avoid inline for-loops when scanning the encodings table 2023-03-12 22:06:22 +01:00
mlugg
a8bd55e085 translate-c: translate extern unknown-length arrays using @extern
Resolves: #14743
2023-03-12 19:07:06 +02:00
mlugg
c93e0d8618 Sema: @extern fixes
* There was an edge case where the arena could be destroyed twice on
  error: once from the arena itself and once from the decl destruction.

* The type of the created decl was incorrect (it should have been the
  pointer child type), but it's not required anyway, so it's now just
  initialized to anyopaque (which more accurately reflects what's
  actually at that memory, since e.g. [*]T may correspond to nothing).

* A runtime bitcast of the pointer was performed, meaning @extern didn't
  work at comptime. This is unnecessary: the decl_ref can just be
  initialized with the correct pointer type.
2023-03-12 18:55:23 +02:00
mlugg
948926c513 Sema: improve error message when calling non-member function as method
Resolves: #14880
2023-03-12 18:47:02 +02:00
Jakub Konka
955e394792 x86_64: fix 32bit build issues in the encoder 2023-03-12 08:47:23 +01:00
Jakub Konka
707a74655b x86_64: downstream encoder/assembler tests 2023-03-12 08:41:44 +01:00
Jakub Konka
433558a92f x86_64: clean up 2023-03-11 20:05:50 +01:00
Jakub Konka
f279ccb807 x86_64: rename asmNone to asmOpOnly 2023-03-11 20:05:50 +01:00
Jakub Konka
fb38e3d6b2 x86_64: simplify immediate handling at MIR level 2023-03-11 20:05:50 +01:00
Jakub Konka
0a8b5c20aa x86_64: add wrapper for .jcc with relocation 2023-03-11 20:05:50 +01:00
Jakub Konka
c9a153c797 x86_64: add .dead pseudo-instruction to mark an unused MIR instruction 2023-03-11 20:05:50 +01:00
Jakub Konka
621fc36b55 x86_64: add wrapper for .jmp_reloc 2023-03-11 20:05:50 +01:00
Jakub Konka
21630ea17f x86_64: apply couple of tweaks and pass behavior tests 2023-03-11 20:05:50 +01:00
Jakub Konka
6e1da36503 x86_64: PtrSize.fromSize() should take into account nonexact sizes too 2023-03-11 20:05:50 +01:00
Jakub Konka
e34e7d5ad1 x86_64: add missing decodings for .movsx 2023-03-11 20:05:50 +01:00
Jakub Konka
fe1fab4a8e x86_64: fix CALL emits for ELF and Plan9 2023-03-11 20:05:49 +01:00
Jakub Konka
d0e7212539 x86_64: finish rolling out all MIR assembly helpers 2023-03-11 20:05:49 +01:00
Jakub Konka
022b308d6a x86_64: start converting MI references 2023-03-11 20:05:49 +01:00
Jakub Konka
4af8313f36 x86_64: plug up all RM/MR references 2023-03-11 20:05:49 +01:00
Jakub Konka
32708dd6e2 x86_64: add RM and MR helpers to codegen 2023-03-11 20:05:49 +01:00
Jakub Konka
9658ab6766 x86_64: handle all instructions without introducing Memory operand 2023-03-11 20:05:49 +01:00
Jakub Konka
1bde522c2c x86_64: add helper for Jcc instruction 2023-03-11 20:05:49 +01:00
Jakub Konka
7221cd8ec9 x86_64: add helpers for CMOVcc and SETcc at the MIR level 2023-03-11 20:05:49 +01:00
Jakub Konka
f61a70e812 x86_64: handle encoding and decoding Imm64 unsigned 2023-03-11 20:05:49 +01:00
Jakub Konka
aa8fda799e x86_64: split up assemble() into more declarative single-purpose helpers 2023-03-11 20:05:49 +01:00
Jakub Konka
6e882d730b x86_64: introduce assemble() helper which encodes/decodes into MIR -> Instruction 2023-03-11 20:05:49 +01:00
Jakub Konka
5b37701028 x86_64: refactor immediate selection logic 2023-03-11 20:05:49 +01:00
Jakub Konka
219c1261a5 x86_64: all behavior tests passing 2023-03-11 20:05:49 +01:00
Jakub Konka
292f91aef2 Handle .ah vs .spl register aliases 2023-03-11 20:05:49 +01:00
Jakub Konka
bc43cee775 Get more things passing 2023-03-11 20:05:49 +01:00
Jakub Konka
ea3b3e94ab x86_64: clean up call semantics in codegen 2023-03-11 20:05:49 +01:00
Jakub Konka
f14831ec73 x86_64: truncate immediates 2023-03-11 20:05:49 +01:00
Jakub Konka
817fb263b5 x86_64: downstream table-driven instruction encoder 2023-03-11 20:05:49 +01:00
Andrius Bentkus
4ea2f441df Module: retry ZIR cache file creation
There are no dir components, so you would think that this was
unreachable, however we have observed on macOS two processes racing to
do openat() with O_CREAT manifest in ENOENT.

closes #12138
2023-03-11 06:20:51 -05:00
Luuk de Gram
904f414e7e
Merge pull request #14869 from Luukdegram/wasm-linker
wasm-linker: refactor virtual addresses
2023-03-10 16:48:30 +01:00
mlugg
023753b469 Sema: correctly detect use of undefined within slices in @Type
Resolves: #14712
2023-03-10 12:18:06 +02:00
Luuk de Gram
0ee9a52507
wasm-linker: remove synthetic segments & atoms 2023-03-10 06:20:10 +01:00
antlilja
b445bbfea2 Add ability to import dependencies from build.zig 2023-03-09 22:38:14 -05:00