26753 Commits

Author SHA1 Message Date
Luuk de Gram
2c2bc9c8df
wasm: fix bitcasting to -and from arrays
Arrays are currently always passed by reference, this means that we
always keep the value in linear memory and never load it to Wasm's
stack. Scalar values however do get lowered to Wasm's stack.
This means when bitcasting from an array to a scalar value, we must
load the memory of the array as such scalar type. To bitcast
a scalar type to an array, we allocate a new temporary in the
linear data segment, and then store the scalar value there.
2023-11-01 19:47:15 +01:00
Andrew Kelley
7c5d01b95e CI: disable MSVC C backend checks
Tracking issue: #17817
2023-11-01 11:42:47 -07:00
Kai Jellinghaus
7ee7c90274 Fix regressing #17290 from #17734 2023-11-01 18:30:56 +02:00
Jordyfel
61861ef395 std.http: account for renames in docs 2023-11-01 14:46:00 +02:00
Kai Jellinghaus
084a7cf028
Use ArenaAllocator.reset in MemoryPool 2023-11-01 14:45:35 +02:00
Andrew Kelley
725f765c37
Merge pull request #17802 from jacobly0/read-write-int
mem: fix UB in `readInt`/`writeInt` and delete variants
2023-11-01 06:33:40 -04:00
Jacob Young
13b1e10b8f cbe: fix @bitCast warnings 2023-10-31 21:37:40 -04:00
Andrew Kelley
3fc6fc6812 std.builtin.Endian: make the tags lower case
Let's take this breaking change opportunity to fix the style of this
enum.
2023-10-31 21:37:35 -04:00
Jacob Young
149200aac5 mem: delete readIntSlice and writeIntSlice
After deleting all potentially incorrect usages, there were no more
remaining.
2023-10-31 21:37:35 -04:00
Jacob Young
d890e81761 mem: fix ub in writeInt
Use inline to vastly simplify the exposed API.  This allows a
comptime-known endian parameter to be propogated, making extra functions
for a specific endianness completely unnecessary.
2023-10-31 21:37:35 -04:00
Jacob Young
50cdb65784 Sema: fix incorrect error comptime-mutating empty array 2023-10-31 21:37:35 -04:00
XXIV
46062f1c13
std.fs: remove unnecessary @ptrCast (#17805) 2023-10-31 20:15:40 -04:00
Andrew Kelley
8457439a84
Merge pull request #17797 from squeek502/utf16-ascii-fast-path
std.unicode: Add ASCII fast path to UTF-16 <-> UTF-8 conversion functions
2023-10-31 13:32:01 -04:00
Ryan Liptak
13c8ec9db0 std.unicode: Add ASCII fast path to UTF-16 -> UTF-8 conversion functions 2023-10-31 02:23:35 -07:00
Ryan Liptak
03117c5290 std.unicode: Add ASCII fast path to UTF-8 -> UTF-16 conversion functions 2023-10-31 02:23:33 -07:00
Jakub Konka
a09ba455c2
Merge pull request #17791 from ziglang/elf-object
elf: rename ZigModule to ZigObject and move all codegen hooks into it
2023-10-31 07:51:26 +01:00
XXIV
34aac2bae1
std/Thread: remove unnecessary @ptrCast (#17766) 2023-10-31 00:17:39 -04:00
kcbanner
825da34769 Add compile error test case for union layout depending on pointer alignment 2023-10-31 01:35:58 +00:00
kcbanner
fb523c6283 sema: when guessing union alignment, save the result and check if the guess was correct 2023-10-31 01:35:58 +00:00
kcbanner
4d044ee7e0 sema: Add union alignment resolution
- Add resolveUnionAlignment, to resolve a union's alignment only, without triggering layout resolution.
- Update resolveUnionLayout to cache size, alignment, and padding. abiSizeAdvanced and abiAlignmentAdvanced
  now use this information instead of computing it each time.
2023-10-31 01:35:58 +00:00
Andrew Kelley
ffaeb45333 langref: clarify struct memory layout 2023-10-30 16:27:12 -07:00
Krzysztof Wolicki
1880c799ae
autodoc: Some support for field_call (#16853)
* autodoc: Some support for field_call

* autodoc: Change handling of field_call to respect tryResolveRefPath, add fieldVal to Expr

* autodoc: Fixed errors

* autodoc: sync with latest master changes

---------

Co-authored-by: Loris Cro <kappaloris@gmail.com>
2023-10-30 21:04:49 +00:00
Karl Seguin
f52a228a5d
Fix http.Headers.initList
Use correct return type (error union), cast field length for hashmap capacity.
2023-10-30 20:35:24 +00:00
Jakub Konka
ea95c74948 elf: encapsulate ZigObject-specific logic in flushModule hook 2023-10-30 20:36:34 +01:00
Jakub Konka
b1a735ac65 elf: put init logic of ZigObject in init function 2023-10-30 19:44:27 +01:00
Jakub Konka
9bdbb6312f elf: move incremental codegen bits into ZigObject.zig 2023-10-30 19:09:13 +01:00
Jakub Konka
b2e847a41a elf: rename ZigModule to ZigObject 2023-10-30 19:09:13 +01:00
Jakub Konka
10d03acdb5
Merge pull request #17773 from ziglang/elf-exports
link: implement exporting anon decls
2023-10-30 17:29:05 +01:00
Jakub Konka
324a93e673 coff: implement enough of extern handling to pass comptime export tests 2023-10-30 12:44:50 +01:00
Jakub Konka
2e690f5c74 macho: implement enough of extern handling to pass comptime export tests 2023-10-30 00:09:32 +01:00
DilithiumNitrate
91e117697a
Fix hasRuntimeBitsAdvanced lazy case for pointers and optionals
As suggested by mlugg, always returns `error.NeedLazy`. If this has a
performance impact, it could be replaced by adding lazy handling to
`comptimeOnlyAdvanced`.
2023-10-29 21:12:43 +00:00
Jakub Konka
71dfea1f17 coff: implement exporting anon decls 2023-10-29 18:55:58 +01:00
Jakub Konka
a7a95ce9c4 macho: implement exporting anon decls 2023-10-29 18:55:58 +01:00
Jakub Konka
eaca72534c elf: implement exporting anon decls 2023-10-29 18:55:58 +01:00
Jakub Konka
209fd8cb93 elf: add partial implementation of exporting anon decls 2023-10-29 18:55:58 +01:00
Andrew Kelley
fa022d1ecc
Merge pull request #17759 from jacobly0/x86_64
x86_64: pass more tests
2023-10-29 13:10:51 -04:00
Jacob Young
f6f2708d82 x86_64: fix compiler rt test failures 2023-10-29 07:20:36 -04:00
Jacob Young
1fecf86ebf x86_64: refactor codegen memory repr
Also refactor linker reloc lowering.
2023-10-29 05:17:43 -04:00
Jacob Young
20ade4ce7f tests: change some x86_64 backend targets to pic for more coverage 2023-10-29 05:15:35 -04:00
Jacob Young
f133bcba9f x86_64: fix hazard between pic call and sysv cc 2023-10-29 05:15:35 -04:00
Kamil T
37295696ec std.os.windows additions and fixes 2023-10-29 11:01:54 +02:00
Andrew Kelley
e7ead9c5ea std: delete psapi, gdi32, and winmm
The only remaining Windows APIs now are the ones that the standard
library itself depends on for its cross-platform abstractions.

closes #4426
2023-10-29 00:58:00 -04:00
Jakub Konka
13c7aa5fef
Merge pull request #17727 from ziglang/elf-memory-deferred
x86_64+elf: do not pass hardcoded memory addresses in prep for build-obj
2023-10-28 19:41:07 +02:00
Andrew Kelley
d817a3c517 delete std.os.windows.user32
This is progress towards #4426
Closes #17417
2023-10-28 13:16:47 -04:00
Andrew Kelley
e69fd4d696
Merge pull request #17762 from ziglang/zir-index-type-safety
make Zir.Inst.Index typed
2023-10-28 13:14:40 -04:00
Andrew Kelley
62f45b802c make Zir.Inst.Index typed
This commit starts by making Zir.Inst.Index a nonexhaustive enum rather
than a u32 alias for type safety purposes, and the rest of the changes
are needed to get everything compiling again.
2023-10-28 10:14:15 -07:00
Andrew Kelley
49b9e1e69b std.mem.minMax: make it return a tuple
this is a breaking change
2023-10-28 10:14:15 -07:00
Andrew Kelley
256ab68a97 frontend: make Decl.zir_decl_index typed
This field had the wrong type. It's not a `Zir.Inst.Index`, it's
actually a `Zir.OptionalExtraIndex`. Also, the former is currently
aliased to `u32` while the latter is a nonexhaustive enum that gives us
more type checking.

This commit is preparation for making this field non-optional. Now it
can be changed to `Zir.ExtraIndex` and then the compiler will point out
all the places that the non-optional assumption is being violated.
2023-10-28 04:30:27 -04:00
Jacob Young
12b5c8156a x86_64: handle .load_symbol in more places 2023-10-28 03:51:05 -04:00
Jakub Konka
20a3664153 x86_64: handle .load_symbol in mul_with_overflow and mul_div 2023-10-28 03:48:18 -04:00