Commit Graph

683 Commits

Author SHA1 Message Date
Laytan Laats c35a45e823 fix global and static any
Fixes #4627
2025-05-17 16:49:30 +02:00
gingerBill 8a225a6887 Place RTTI into its own section .odin-rtti 2025-05-09 11:07:53 +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
Laytan Laats ad4866653a fix disposing builder when not created
Fixes #5128

p->builder is created in lb_begin_procedure_body, but that isn't called
if there is no body, and we were still calling dispose at that point.

Moved it into lb_end_procedure_body to match.
2025-05-07 14:39:51 +02:00
Harold Brenes 14e25c0f2a Fix lb_get_objc_type_encoding missing matrix and simdvec encodings and minor fixes. 2025-05-05 09:07:50 -04:00
Harold Brenes be2e4dec7d Resolve other TODOs 2025-05-03 13:06:57 -04:00
Harold Brenes fc082f5ea5 Remove some TODO. Leave important note 2025-05-03 03:21:03 -04:00
Harold Brenes 33d37c72f9 Register all classes unconditionally 2025-05-03 03:09:31 -04:00
Harold Brenes 0746127654 Minor fixes in data type usage and style. 2025-04-30 22:16:53 -04:00
Harold Brenes 1505edef01 Change ivar offsets from u32 to (odin base type) int/native pointer size. 2025-04-30 22:09:33 -04:00
Harold Brenes dc8692b504 Use correct alignment value for class_addIvar. 2025-04-30 21:52:29 -04:00
Harold Brenes abfbb2f9ed Use basic name instead of raw_name for type encoding complex and quats. 2025-04-30 20:32:28 -04:00
Harold Brenes 668a9a89b0 Complete lb_get_objc_type_encoding() implementation 2025-04-30 20:32:14 -04:00
Harold Brenes 2dc5653fd1 Name fixes 2025-04-30 20:31:54 -04:00
Harold Brenes 89533f49e4 Fix more styling and minor issues 2025-04-27 23:05:17 -04:00
Harold Brenes f3923ed666 Fix indentations
Fix Objective-C wrapper procs not forwarding return value
2025-04-27 22:55:53 -04:00
Barinzaya 9284ebb5e8 Add missing cast to global/static var alignments. 2025-04-24 14:35:00 -04:00
Barinzaya b41a776027 Correctly align global and static variables.
This can be important if matrices or SIMD vectors are being used in
global or static variables, as otherwise it may result in crashes due to
aligned instructions accessing misaligned variables.
2025-04-24 14:21:21 -04:00
Harold Brenes 974a197ce1 Allow the class's ivar to be used as a context provider receiver as well. 2025-04-23 02:06:01 -04: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 730c844fc6 Fix bug in @encode implementation. 2025-04-23 02:05:43 -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 b3b4d501ca Fix ivar in multi-module mode. 2025-04-21 02:43:16 -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 fe040d1bbd Propagate @(link_section=<string>) to nested declarations 2025-04-08 11:36:53 +01:00
gingerBill cd5bef4f61 Rewrite objc SEL/Class register handling code 2025-04-03 09:37:38 +01:00
Laytan Laats f80e73e036 few llvm 20 changes 2025-03-19 21:22:55 +01:00
gingerBill 4c3c3a0631 Add new LLVM 20 passes 2025-03-18 16:21:08 +00:00
gingerBill d209af5094 Update to LLVM 20.1.0 2025-03-18 15:39:18 +00:00
gingerBill d15be94a0f Remove debug print 2025-03-11 15:50:46 +00:00
gingerBill 6e1c21411d Fix object name generation 2025-03-11 15:50:31 +00:00
gingerBill ee84487106 Merge branch 'master' of https://github.com/odin-lang/Odin 2025-03-01 15:19:51 +00:00
gingerBill 211680569f Fix for -use-single-module 2025-03-01 15:19:46 +00:00
Laytan Laats 66540b75f5 fix hidden linkage applied to foreign symbols 2025-03-01 16:06:32 +01:00
gingerBill fd6d7d412d Use more predictable object name 2025-02-25 14:55:33 +00:00
gingerBill 83f1c879ec Canonicalize generated procedures (hasher/equal/map) 2025-02-24 15:18:27 +00:00
gingerBill 2c86fadee1 More name canonicalization for globals 2025-02-24 14:28:24 +00:00
gingerBill f0f395c510 Fix canonicalization 2025-02-24 14:24:06 +00:00
gingerBill 46a8991d0f Canonicalize generated procedures 2025-02-24 14:19:02 +00:00
gingerBill ebda946d61 Move temporary array out of CheckerInfo 2025-02-22 18:12:43 +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 4a29d9bb84 Simplify type info table construction 2025-02-17 16:29:42 +00:00
gingerBill 9b26bb2e6a Begin work on hash types 2025-02-17 13:10:38 +00:00
Laytan Laats 1053ec3051 make corrected linkage with -use-separate-modules apply hidden visibility
Fixes #4798

The DLL was using the type info of the host/exe, causing crashes.
This PR tries fixing by applying hidden visibility to these corrected
symbols which makes sure that the DLL can't see the type table of the host/exe.
2025-02-06 20:45:58 +01:00
Laytan Laats 9dc17f4c47 optimize fix 2025-01-24 19:33:57 +01:00
Laytan Laats b2aaf90f88 fix separate modules with objc code 2025-01-24 19:23:49 +01:00
gingerBill bca08d3b85 Make -no-dynamic-literals the default now 2025-01-05 13:33:06 +00:00
gingerBill a25a9e6ebe Check for LLVM_VERSION_MAJOR >= 18 2024-09-09 14:47:44 +01:00
gingerBill 0dddd2b97e Add internal flag
`-internal-fast-isel`
2024-09-09 14:39:53 +01:00