Commit Graph

493 Commits

Author SHA1 Message Date
gingerBill 99520d82fd Add intrinsics.constant_(floor|truncate|ceil|round) 2025-10-30 08:52:21 +00:00
Jeroen van Rijn faa9222fef Set minimum #load(file, type) alignment to 16 bytes 2025-10-15 18:04:24 +02:00
Jeroen van Rijn 5dbade87e9 Simple compare is also comparable 2025-10-11 15:43:30 +02:00
Jeroen van Rijn e6754547ab Fix #5786 2025-10-11 15:17:23 +02:00
Jeroen van Rijn b3dfd34f2d #5788 2025-10-11 14:57:45 +02:00
Harold Brenes 5af13f5d53 Automatically emit objc_msgSend calls when calling imported or implemented Objective-C methods
- Add intrinsics.objc_super()

- Emit objc_msgSendSuper2 calls when an objc method call is combined with objc_super(self)

- Fix objc_block return value ABI for large struct returns

- Fix objc_implement method wrappers bad ABI for large struct returns and indirect args

- Simplify parameter forwarding for objc_imlpement methods

- Add intrinsics.objc_instancetype to mimi Objective-C instancetype* returns
  This facilitates returning the correct type on subclasses when calling mehtods
  such as `alloc`, `init`, `retain`, etc.

- Refactor Objective-C class implementations generation so that hierarchies are properly initialized

- Better codegen for context passing with ivar-based autocontext

- Allow @superclass on imported objc-c objects

- Better codegen for block forwarding invoker, arguments are forwarded directly
2025-09-29 20:37:48 -04:00
gingerBill 240b2f1819 Disable #raw_union constants for the time being 2025-09-29 12:54:52 +01:00
gingerBill 10ba956d6a Rudimentary support for some constant struct #raw_union 2025-09-29 10:28:16 +01:00
gingerBill 4877214f34 Add more check_is_operand_compound_lit_constant uses 2025-09-28 23:53:07 +01:00
gingerBill 8be18d9a40 Allow for constant []typeid 2025-09-28 21:47:56 +01:00
gingerBill ffdfbfe2c2 Begin to support constant array of unions 2025-09-28 20:20:26 +01:00
gingerBill dfb86db159 Fix absolutely random change between , and newline 2025-09-26 10:50:16 +01:00
gingerBill 01c10f3f5e Use RecursiveMutex to fix a race condition with parapoly records 2025-09-26 10:18:46 +01:00
gingerBill 549edcc0f9 Use a RwMutex instead of BlockingMutex 2025-09-10 21:00:43 +01:00
gingerBill 0476d33a6c Remove global PtrMap<Type *, GenTypesData *> and store on the TypeNamed directly 2025-09-10 20:45:26 +01:00
gingerBill 1e0902677f Multithread min dep set by removing the set itself 2025-09-10 17:29:11 +01:00
Jeroen van Rijn 1d561247f5 Add nullptr checks to more type helpers. 2025-09-09 20:45:32 +02:00
gingerBill af3184adc9 Change is_utf16 field to encoding and use an enum 2025-08-05 15:12:54 +01:00
gingerBill eae43f1225 Merge branch 'master' into bill/utf16-strings 2025-08-05 15:07:06 +01:00
gingerBill accdd7c2af Fix atomics for tuples 2025-08-05 12:31:57 +01:00
gingerBill 7f194080e6 Fix possible race condition with struct offsets 2025-08-05 12:28:18 +01:00
gingerBill c910b5e583 Add intrinsics.type_is_nearly_simple_compare 2025-08-04 12:13:30 +01:00
gingerBill 2561427dd3 Add string16 and cstring16 (UTF-16 based strings) 2025-08-02 11:00:15 +01:00
gingerBill 7057fc8dfc Remove the semantics of #no_copy, keep the grammar 2025-07-30 23:14:29 +01:00
Jeroen van Rijn 1fbc5641c0 Add to tests/internal
Turn repro code into a proper test, and delete superfluous files from Odin root.
2025-06-26 14:47:38 +02:00
Tohei Ichikawa 8410871cb8 Fix bug where compiler treats uint enums as ints 2025-06-24 22:58:00 -04:00
gingerBill 8d37f9de09 Merge pull request #5378 from laytan/fix-wasm-c-abi-raw-unions
Fix WASM C ABI for raw unions
2025-06-21 11:01:52 +01:00
Laytan 2995557394 Merge pull request #5211 from Barinzaya/union-custom-align-tag-size
Consider custom `#align` when determining union tag size
2025-06-20 22:31:31 +02:00
Laytan Laats 3db8972c99 add return 2025-06-20 22:07:46 +02:00
Laytan Laats 3a86bc9c6d Fix WASM C ABI for raw unions 2025-06-20 22:04:53 +02:00
Jeroen van Rijn cc08dca53d Add additional nullptr checks in types.cpp
Ran into a bunch of nullptr problems while reviving an 8-year old Odin problem.
2025-06-14 01:13:36 +02:00
Barinzaya 717b9f1578 Change union tag size to account for #align.
The prior behavior was adjusting the tag size based on the alignment of
the types in the union, even when the union has a custom alignment
specified with `#align`. This changes the behavior so that a custom
alignment, if specified, takes precedence over the alignment of the
types.
2025-05-24 12:41:28 -04:00
gingerBill 23aff08556 Merge pull request #5117 from bogwi/bug/5024
Bug/5024
2025-05-09 08:35:16 +01:00
gingerBill 92df892f25 Merge pull request #5064 from harold-b/hb/objc-classes
Add support for Objective-C class implementation
2025-05-08 12:58:33 +01:00
Jeroen van Rijn 2224911aca Fix type_union_tag_offset when all members are zero sized 2025-05-05 18:09:54 +02:00
bogwi af0e067a12 CHECK 2 done
Add support for handling generic types in LLVM backend

- Updated `lb_type_internal` to return a pointer type for unspecialized generics.
- Modified `write_type_to_canonical_string` to handle specialized generics without panicking.
- Enhanced `default_type` to return the default type of specialized generics when applicable.
2025-05-05 16:58:14 +09:00
Harold Brenes 47abea1229 Add support for Objective-C method implementation with Odin calling convention.
Use @objc_context_provider to provide a context for a type.
2025-04-23 02:05:51 -04:00
Harold Brenes bca02f81cd Include the ivar in the Objective-C class unconditionally of it being used or not.
Allow pseudo-fields for ivar access.
2025-04-22 19:18:53 -04:00
Harold Brenes a3de9c8de4 Add initial support for Objective-C class implementation 2025-04-20 21:53:46 -04:00
gingerBill 3dcc22fa6d Change hashing rules for float-like types to make 0 == -0 2025-04-16 10:52:35 +01:00
gingerBill 6045955c88 More improvements doc writer name canonicalization 2025-04-15 12:35:20 +01:00
gingerBill d0d5cf800e Fix nullptr check 2025-02-24 15:49:49 +00:00
gingerBill 614c0dd740 Fix typeid size for 32-bit platforms 2025-02-20 17:10:04 +00:00
gingerBill 5489a88983 Change typeid definition to be based around the canonical type hash
`typeid` used to be a fancy index with extra metadata stored on it. Now it is direct hash of the type.

This is safe to do in practice since any possible collisions are checked at compile time AND the chances of having a 1% collision are around 1 in 600K (see the Birthday Paradox).

Therefore accessing a `^Type_Info` is now a hash table lookup with linear probing. The table is twice the size than necessary so prevent too much probing due to an overly dense hash table.
2025-02-20 14:10:45 +00:00
gingerBill 0ab323012e Use TypeSet instead of PtrSet<Type *> 2025-02-20 11:12:59 +00:00
gingerBill 9b26bb2e6a Begin work on hash types 2025-02-17 13:10:38 +00:00
gingerBill 99d91ccd31 Work on making name mangling deterministic 2025-02-17 11:32:49 +00:00
gingerBill 4eba3698aa Begin work on nested declarations 2025-02-17 09:47:49 +00:00
gingerBill 2a5933513c Fill in more canonical types 2025-02-15 12:32:05 +00:00
gingerBill 98201962e0 Begin work on producing a canonicalized type string for hashing types. 2025-02-14 17:29:38 +00:00