Commit Graph
818 Commits
Author SHA1 Message Date
bbodi 8dbbbd2d64 Fix -debug when every initial file is excluded
The debug compile unit was made from the first file of the initial
package. When build tags exclude all of its files, as for the
Windows-only tests/issues/test_issue_7547.odin on other targets, there
is none, and `odin test -debug` crashed on an out-of-bounds index.
Without `-debug` such a test builds and reports that there are no
tests to run, which `tests/issues/run.sh` relies on.

Fall back to the package's path for the compile unit's file.
2026-10-08 15:51:24 +02:00
bbodi 1448ac3494 Hash all bytes of string16 and cstring16 map keys
Map keys of type `string16` used `default_hasher_string`, which reads
the length as a byte count; for a `string16` it counts u16 units, so
only the first half of the key was hashed. `cstring16` keys took the
same path and were read as a pointer and a length, which crashes.

Add `default_hasher_string16` and `default_hasher_cstring16` to the
runtime and use them for the generated key hashers, which are also
what the runtime and `intrinsics.type_hasher_proc` use.
2026-10-08 15:51:24 +02:00
gingerBill 6bc36986d2 Keep the names of big endian types in CodeView and add RAD views to swap their bytes 2026-10-08 13:41:52 +01:00
gingerBill 4d8e8aaf4a Mark optimized procedures, add assignment tracking, and add MD5 file checksums on LLVM 22+ 2026-10-08 12:28:21 +01:00
gingerBill f689471c90 Embed the gdb pretty printers in the .debug_gdb_scripts section of ELF binaries built with -debug, and move the script next to the runtime it reads 2026-10-08 11:54:08 +01: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 399b6d4a36 Name procedures and globals in debug info by package and enclosing procedure, with literals named by line, one shared name for all polymorphic instances, and exported and custom link names kept 2026-10-08 10:10:15 +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 6cfa3dafb7 Finalize debug info per module in parallel, and skip debug info work that was never used 2026-10-08 01:05:24 +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 0de10624fe Name single-module output after the main package when -out is a directory 2026-10-06 18:14:29 +01: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 8c55db676a Revert running each module's backend stages as one task, as it did not help in terms of performance 2026-10-05 11:57:07 +01:00
gingerBill 8cadb56bbb Run each module's stages after procedure generation as one task, from verification through its object, ordered by the module's cost 2026-10-05 11:45:46 +01:00
gingerBill e774d7954c Allow the compiler with slightly older forms of the compiler which only have default_hasher and not default_hasher_fixed 2026-10-04 19:36:19 +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 6fbc112088 Lower more instructions for the fast instruction selector in LLVM 2026-10-04 10:05:19 +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 cd08004d33 Free the temporary memory of each procedure once it is generated; keep the strings used as keys of the constant string maps permanently 2026-10-03 18:38:09 +01:00
gingerBill b4612c77c4 Merge branch 'master' into bill/map-improvements 2026-10-03 17:24:54 +01:00
gingerBill 70f6767776 Make lb_map_set_proc_for_type prefer to go through the runtime for unoptimized builds 2026-10-03 16:15:59 +01:00
gingerBill f86c53f13a Do Robin Hood displacement in __$map_set when no tombstone is in the way 2026-10-03 15:32:09 +01:00
gingerBill 0ea9b17c36 Fix the probe distance in __$map_get and store directly into an empty slot in __$map_set, which also improves a map's performance 2026-10-03 14:53:55 +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 e7b7705042 Setup the type info data in the default module's task rather than before the modules are generated in parallel 2026-10-02 23:30:24 +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 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 6a8d6e0ca4 Verify each module once its procedures are generated rather than each procedure, which for those referenced by the type info walked all of the type info each time; only verify the procedures on their own on a failure 2026-10-02 15:55:54 +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 5f579a1a10 Fix numerous race conditions: clone polymorphic defaults per call, evaluate foreign import attributes after collection, own dependencies for record instances, sorted Objective-C emission, no debug line for anonymous records 2026-10-01 21:55:25 +01:00
gingerBill 73c3a96de1 Make global checking state thread-safe: read-only global scopes, per-group untyped and #soa, deferred link-name checks, fresh contexts for on-demand globals 2026-10-01 21:07:41 +01:00
gingerBill 38fa57e907 Make global checking and codegen order-independent 2026-10-01 15:01:14 +01:00
Jeroen van Rijn 650c558cb9 Merge pull request #7445 from kalsprite/target_feature_empty_element
string_split_iterator fix
2026-08-24 18:03:35 -07:00
kalsprite 7bf266ef93 string_split_iterator fix 2026-08-24 17:32:30 -07:00
Mihail Moskov 74ac336ef1 fixes -o:size 2026-08-24 12:53:05 +03:00
korvahkh 02246ac6fd Implement fixes for constant unions
Note that with this commit, casting through
multiply-nested unions is forbidden, e.g.
```
U :: union {int, V}
V :: union {bool}
x: U = true
```
does not compile.
(Previously the compiler would simply crash)

This is to avoid situations where adding variants
can lead to unexpected changes in the value.

For example if `U` is changed to have a `bool`
variant of its own:
```
U :: union {int, bool, V}
```
Then `x: U = true` would equal
`U(true)` instead of `U(V(true))`.

Single-variant unions are exempt, primarily to
improve the ergonomics of `Maybe` in cases like:
```
x: Maybe(union{int, bool}) = 1
```

Fix #6100
Fix #6699
Fix #6895
Fix #6896
Fix #6897
Fix #7036
Fix #7083
Fix #7091
2026-08-19 20:12:56 -05:00
kalsprite cf5f181228 peel union constant to its variant 2026-08-19 16:30:37 -07:00
kalsprite cd8fc51efc codegen worker must not exit process with running siblings 2026-08-19 13:44:32 -07:00
gingerBill 9870cd4c36 Merge pull request #7271 from odin-lang/bill/inline-asm
`asm` templates
2026-08-18 19:19:40 +02:00
gingerBill 645b57be9f Merge pull request #7327 from kalsprite/abi_conformance
ABI Conformance Harness + Fixes
2026-08-17 16:28:01 +02:00
gingerBill 1f2234a4b2 Merge branch 'master' into bill/inline-asm 2026-08-17 11:44:14 +01:00
kalsprite 9047c60ec1 arm32: default to arm1176jzf-s so the gnueabihf triple actually has an FPU,
arm32: implement AAPCS32 homogeneous float aggregates incl unions,
arm32: fix reversed arguments in the small-struct return coercion,abi test: __aeabi_uldivmod so the arm32 corpus links
2026-08-14 18:08:11 -07:00
corley de9d6d7dcc Reenables LLVMSetUnnamedAddress for global constants folding 2026-08-14 23:12:25 +03:00
A1029384756 a08682bcd3 [llvm_backend] fix duplicated name for .ll files 2026-08-11 16:30:35 -04:00
gingerBill 036e38442b Begin work on lb_emit_asm_template_call 2026-08-09 21:55:36 +01:00