Commit Graph

16119 Commits

Author SHA1 Message Date
Jacob Young e5d5a8bc4e x86_64: implement switch jump tables 2025-01-16 20:42:08 -05:00
Jacob Young ac1a975f9b x86_64: implement clz and not 2025-01-16 20:42:08 -05:00
Jacob Young a7efc56d86 x86_64: the previous loop abstraction was too confusing
The temp usage was non-obvious, and implicit instructions hard to
reason about.
2025-01-16 20:42:08 -05:00
Jacob Young a1828ebcda x86_64: demolish the old 2025-01-16 20:42:08 -05:00
Jacob Young 73a42953c9 x86_64: 2 means better 2025-01-16 20:42:08 -05:00
Jacob Young b9c4400776 x86_64: implement fallback for pcmpeqq 2025-01-16 20:42:08 -05:00
Jacob Young c4b93555b0 x86_64: testing 2025-01-16 20:42:08 -05:00
Jacob Young 7c713251ca x86_64: looped instructions 2025-01-16 20:42:08 -05:00
Jacob Young beadf702b8 x86_64: rewrite arithmetic 2025-01-16 20:42:08 -05:00
Jacob Young af1191ea8b x86_64: rewrite 2025-01-16 20:42:07 -05:00
mlugg 9804cc8bc6 all: update to std.builtin.Type.{Pointer,Array,StructField} field renames 2025-01-16 12:49:58 +00:00
mlugg 726c94d5f1 Sema: prepare for sentinel -> sentinel_ptr field rename
The commit 2 after this will explain this diff.
2025-01-16 12:49:58 +00:00
mlugg b6abe1dbf7 compiler: make it easier to apply breaking changes to std.builtin
Documentation for this will be on the wiki shortly.

Resolves: #21842
2025-01-16 12:49:48 +00:00
mlugg d00e05f186 all: update to std.builtin.Type.Pointer.Size field renames
This was done by regex substitution with `sed`. I then manually went
over the entire diff and fixed any incorrect changes.

This diff also changes a lot of `callconv(.C)` to `callconv(.c)`, since
my regex happened to also trigger here. I opted to leave these changes
in, since they *are* a correct migration, even if they're not the one I
was trying to do!
2025-01-16 12:46:29 +00:00
Andrew Kelley eda8b6e137 link.MachO: fix error reporting in flushModule 2025-01-15 20:21:33 -08:00
Andrew Kelley ed810eeb06 link.Elf: fix error reporting for failed hot swap 2025-01-15 20:16:40 -08:00
Andrew Kelley e4868693a5 Compilation: windows doesn't prelink yet 2025-01-15 19:59:53 -08:00
Andrew Kelley 605311211b wasm linker: omit data count section when value is zero 2025-01-15 19:43:31 -08:00
Andrew Kelley 744bb5d16a wasm linker: change rules about symbol visibility
export by default means export, as expected. if you want hidden
visibility then use hidden visibility.
2025-01-15 18:31:44 -08:00
Andrew Kelley dcb4134835 wasm linker: delete commented out code
this logic has not yet been ported to the new design, but the logic is
safe and sound in the git history and does not need to also live as
commented out code
2025-01-15 18:19:46 -08:00
Andrew Kelley 9dd6efb7e4 wasm linker: fix TLS data segments
fix calculation of alignment and size

include __tls_align and __tls_size globals along with __tls_base

include them only if the TLS segment is emitted

add missing reloc logic for memory_addr_tls_sleb

fix name of data segments to include only the prefix
2025-01-15 18:17:37 -08:00
Andrew Kelley 10db1b9eda wasm linker: fix explicit exports not affecting object files 2025-01-15 18:17:20 -08:00
Andrew Kelley a4b7e9b97d fix compiler unit tests 2025-01-15 15:22:57 -08:00
Andrew Kelley ae16414121 wasm linker: ability to get data and functions from objects 2025-01-15 15:11:37 -08:00
Andrew Kelley a7bd1a631b wasm codegen: fix mistaking extern data as function 2025-01-15 15:11:37 -08:00
Andrew Kelley 9ddb1c5092 wasm linker: implement --export-table 2025-01-15 15:11:37 -08:00
Andrew Kelley 617eca13eb wasm-linker: remap function types during flush
this is technically not necessary, and loses value the bigger the output
binary is, however it means a smaller output file, so let's do it.
2025-01-15 15:11:36 -08:00
Andrew Kelley c2a918b7a3 wasm linker: implement __wasm_init_tls synthetic function 2025-01-15 15:11:36 -08:00
Andrew Kelley f7f8878716 wasm linker: correct export visibility logic
exports are hidden unless protected or rdynamic or explicitly asked for,
matching master branch
2025-01-15 15:11:36 -08:00
Andrew Kelley b37ad5110c wasm linker: always passive when importing memory
and detect passive inits from Zcu

don't forget to intern function type for __wasm_init_memory

make that function the start function if it is present

don't skip emitting passive data segment data to the binary
2025-01-15 15:11:36 -08:00
Andrew Kelley c535422423 wasm linker: implement hidden visibility 2025-01-15 15:11:36 -08:00
Andrew Kelley f89ef2f7cd Compilation.saveState implement saving wasm linker state 2025-01-15 15:11:36 -08:00
Andrew Kelley 1fe1d55c7b wasm linker: reset function exports after flush 2025-01-15 15:11:36 -08:00
Andrew Kelley 4cc9cfa7e8 wasm linker: track overaligned uavs 2025-01-15 15:11:36 -08:00
Andrew Kelley ba4521ac85 wasm linker: fix data segment names 2025-01-15 15:11:36 -08:00
Andrew Kelley 0cf163089e wasm linker: fix @tagName for auto-numbered non-exhaustive enums 2025-01-15 15:11:36 -08:00
Andrew Kelley cde84c8795 wasm linker: fix missed addend for uav and nav fixups 2025-01-15 15:11:36 -08:00
Andrew Kelley dd9a647210 wasm linker: fix bad export index math 2025-01-15 15:11:36 -08:00
Andrew Kelley 8abdebecdc wasm linker: implement @tagName for sparse enums 2025-01-15 15:11:36 -08:00
Andrew Kelley b5261599d7 wasm linker: implement @tagName functions when tags are autoassigned 2025-01-15 15:11:36 -08:00
Andrew Kelley d0d0847cd0 wasm linker: don't crash on ref to void 2025-01-15 15:11:36 -08:00
Andrew Kelley e5d78f0b55 codegen: empty tuple can be stored in a runtime var 2025-01-15 15:11:36 -08:00
Andrew Kelley fbdcb2289b wasm linker: don't pretend it's possible to export data symbols 2025-01-15 15:11:36 -08:00
Andrew Kelley 0dd0ebb6e2 frontend: don't increment remaining_prelink_tasks for windows implibs
yet because they aren't hooked up to the new linker API
2025-01-15 15:11:36 -08:00
Andrew Kelley 220af3f446 wasm-linker: add updateFunc log 2025-01-15 15:11:36 -08:00
Andrew Kelley 7b255235d6 wasm linker: fix off-by-one in function table indexes 2025-01-15 15:11:36 -08:00
Andrew Kelley e44bafe5ff wasm linker: mark symbol deps on intrinsics 2025-01-15 15:11:36 -08:00
Andrew Kelley e18a397c85 wasm linker: fix corruption of string bytes
if any fixups are emitted in lowering data, keep the string bytes
allocated even if all zeroes because it is used as a fixup staging area.
2025-01-15 15:11:36 -08:00
Andrew Kelley 9c14645b58 wasm codegen: fix freeing of locals 2025-01-15 15:11:36 -08:00
Andrew Kelley a327d238f1 wasm linker: handle function data references properly 2025-01-15 15:11:36 -08:00