Commit Graph
340 Commits
Author SHA1 Message Date
corleypc 829b04e20b fixes alignment on union variant loads with custom #align 2026-10-13 15:19:23 +03:00
gingerBill bd104663c9 Revert lowering a tuple return containing a proc as rawptr 2026-10-12 15:32:10 +01:00
joel freed 64d2fe9a26 fix issue 7741 2026-10-12 01:35:45 +02:00
gingerBill 97c7f0214f Move a DeclInfo's procedure-only fields to a ProcDeclInfo only procedures allocate; remove the unused type_and_value_mutex fields 2026-10-11 20:08:31 +01:00
gingerBill 9672dca06d Fallback to the pre-split bounds check handlers when the runtime lacks the new ones 2026-10-11 10:36:15 +01:00
Matthew Winter 3c6fe188dd Publish the backend's entity names atomically so parallel modules never read a half-written name
With `-use-separate-modules`, modules are generated on parallel threads and
name the same entities (e.g. a struct from a shared package) at the same time.
`lb_get_entity_name` cached the name by writing plain `String` fields on the
shared `Entity` (`TypeName.ir_mangled_name`, `Procedure.link_name` and
`Variable.link_name`), so another thread could read a non-zero `len` with a
null or partially written `text` and crash in `alloc_cstring`.

Cache the name in an `std::atomic<String *>` on `Entity` published with a
compare-exchange, as `lb_local_proc_name` already does, and stop writing the
name back into `link_name`, which other threads also read whilst
canonicalizing names. `link_name` now only ever holds the checker's name.

Fixes #7862
2026-10-11 14:23:18 +11:00
gingerBill f254e28068 Zero the extra bytes when widening a value in OdinLLVMBuildTransmute 2026-10-10 15:27:18 +01:00
corley 6c6a750bbf fixes compiler treating ptr storage alignment as ptr alignment in vector casts for array arith 2026-10-09 14:54:57 +03:00
corley bf9d096191 fixes the compiler incorrectly treating the alignment of a loaded pointer as the alignment of the pointed data 2026-10-09 00:14:06 +03:00
gingerBill 81842d44dc Improve RAD Debugger view information for unions, string16, and anything else need to be generated 2026-10-08 11:09:33 +01:00
gingerBill 216bcf7475 Split the debug types module into eight picked by a hash of each type's name, defined in parallel rounds and anchored by a union of pointers to its types 2026-10-08 09:48:40 +01:00
gingerBill 0a4724602b Define record debug types once in a debug types module with forward declarations in every other module 2026-10-08 09:18:15 +01:00
gingerBill 8c692ad0e9 Give debug types unique identifiers, describe self-referencing procedure types per debug format, declare range loop variables once, and use DWARF 5 on Darwin and Linux 2026-10-08 08:56:39 +01:00
gingerBill 35fdd3c499 Fix infinite recursion lowering procedure types that contain themselves 2026-10-08 00:26:40 +01:00
gingerBill 5ff7268cab Add @(align=N) for variables, raising the alignment of globals, locals, @(static) and @(thread_local) variables to at least N 2026-10-07 15:54:21 +01:00
gingerBill 30f80e1079 Align matrices to their largest power-of-two column/row stride, capped at 16; pad fixed capacity dynamic arrays of over-aligned elements to their full size 2026-10-07 15:40:59 +01:00
gingerBill 09726b1ee0 Merge pull request #7761 from RoryO/master
LLVMBr opcode split to LLVMCondBr and LLVMUncondBr in LLVM >=23
2026-10-07 10:22:56 +01:00
gingerBill 25946eb2f1 Merge pull request #7789 from Barinzaya/bounds_check_with_context
Context-aware bounds check handling
2026-10-06 15:55:45 +01:00
Barinzaya 8075b343c5 Split bounds check handlers into contextless and with_context.
When a `context` is available, the `with_context` variant will be called
and the `context.assertion_failure_proc` will be called, instead of
forcibly trapping. This allows bounds check errors able to be handled by
custom assertion failure procs.
2026-10-06 09:45:36 -04:00
Rory OConnell 57948b15da LLVMBr opcode split to LLVMCondBr and LLVMUncondBr in LLVM >=23 2026-10-05 12:31:40 -07:00
gingerBill c5cfff4e3c With -use-separate-modules, make the type info in modules of its own of about ~1000 entries each rather than all in the default module 2026-10-05 12:25:58 +01:00
gingerBill 7cbb04159d Name nested and anonymous procedures from their enclosing declarations alone so the name never depends on which module names them first 2026-10-04 23:22:32 +01:00
gingerBill 0cbc5a6602 Define an anonymous procedure in every module that reaches it, so which module defines it never depends on timing 2026-10-04 23:02:40 +01:00
gingerBill 18aead3ba1 Merge pull request #7729 from odin-lang/bill/llvm-backend-improvements
LLVM Backend Performance Improvements to Reduce Compile Times Part 2
2026-10-04 19:01:11 +01:00
gingerBill ccf1ae4fe9 Move the lowering for LLVM's fast instruction selector to llvm_backend_opt.cpp 2026-10-04 10:16:50 +01:00
gingerBill bdb0364739 Remove the missing procedures fallback from the backend: the checker adds the Objective-C runtime procedures the backend calls, local foreign procedures with a duplicate name are bound to the existing declaration, and local procedures passed to a $ parameter are created up front 2026-10-03 22:26:08 +01:00
gingerBill b4612c77c4 Merge branch 'master' into bill/map-improvements 2026-10-03 17:24:54 +01:00
gingerBill 93e160582c Pass a copy of a value within a packed struct to a procedure by reference when its address is not known to be aligned to its type, and lower the alignment of loads and stores to that known from the GEPs leading to their address 2026-10-03 16:41:48 +01:00
gingerBill d8da5185c9 Store a constant holding a misaligned pointer directly rather than copying it from a constant global, which Apple's linker rejects 2026-10-03 14:47:38 +01:00
gingerBill 5031e2733e Add the comparison procedures of types in the type table and map keys as dependencies making the backend no longer has to create missing procedures 2026-10-03 12:38:00 +01:00
gingerBill e5cc35c445 Lower what LLVM's fast instruction selector cannot select before emitting objects, and declare debug variables through stack slots 2026-10-03 11:02:55 +01:00
gingerBill f670de9e80 Define and initialize global variables in their own modules 2026-10-03 08:28:31 +01:00
gingerBill 29106aaa1e Cache type layouts and union constantability, build nested constants once, create debug files lazily 2026-10-03 01:26:01 +01:00
gingerBill a7ded94e52 Begin the costliest modules first in each backend stage; run function passes in parallel with -debug; spread the instances of oversized modules over further modules; trim comments 2026-10-02 23:15:43 +01:00
gingerBill 735b2c7060 Pass a copy of a packed struct's field by reference when it may be under-aligned; lower load and store alignment to that known 2026-10-02 22:49:26 +01:00
gingerBill 63d28377bb Pass a copy of a value within a packed struct to a procedure by reference when its address is not known to be aligned to its type, and lower the alignment of loads and stores to that known from the GEPs leading to their address 2026-10-02 17:22:15 +01:00
gingerBill d958fd7abb Allow -build-mode with odin test; Copy a "just loaded" aggregate as integers in the startup procedure and with -o:none as LLVM's fast instruction selector cannot select an aggregate load or store 2026-10-02 16:40:54 +01:00
gingerBill cbcf315184 Generate a package with much more code than a 32nd of all of it in several modules of contiguous files, estimated by the bodies of its used procedures, as each module is generated by one thread 2026-10-02 16:11:18 +01:00
gingerBill 03852e7af8 Generate each global's initialization in its own block of the startup procedure; generate the procedure literals reached from the initializations of globals in their own package's module rather than the default module 2026-10-02 15:36:04 +01:00
gingerBill 40f3df53bb Merge pull request #7694 from odin-lang/bill/multithread-global-decls
Make global checking codegen order-independent
2026-10-01 15:36:48 +01:00
gingerBill 38fa57e907 Make global checking and codegen order-independent 2026-10-01 15:01:14 +01:00
Mihail Moskov 8d745e8288 fixes the nocapture attribute on llvm >= 21 2026-09-30 17:10:18 +03:00
gingerBill 3f518fd130 Merge pull request #7602 from corleypc/lifetime-markers
Adds lifetime markers for named locals
2026-09-29 17:44:06 +01:00
gingerBill 6653101e61 Fix race condition with unlocking something too early 2026-09-29 16:46:46 +01:00
corley bac6130710 lifetime markers for named locals 2026-09-20 15:55:26 +03:00
Mihail Moskov 74ac336ef1 fixes -o:size 2026-08-24 12:53:05 +03:00
mo 23bd3cd927 detect invalid block size caused by a void type
Fixes #7008

When a union variant includes a pointer to a forward type, `lb_sizeof`
returns 0 for the size of the block. This causes an extra padding word
to be added to the llvm type, causing a size_of and type_of mismatch.

The fix detects the 0 size and falls back to using `type_size_of` on
the first variant.
2026-08-21 21:58:21 +12:00
kalsprite cd8fc51efc codegen worker must not exit process with running siblings 2026-08-19 13:44:32 -07:00
gingerBill 645b57be9f Merge pull request #7327 from kalsprite/abi_conformance
ABI Conformance Harness + Fixes
2026-08-17 16:28:01 +02:00
Jeroen van Rijn a0b475eef9 Merge pull request #7361 from ssenthilnathan3/fix/recursive-soa-sigbus
Fix: SIGBUS/segfault when compiling recursive #soa slice/dynamic array types
2026-08-17 13:16:18 +02:00