Commit Graph

46 Commits

Author SHA1 Message Date
Jon Lipstate
231ce2da59 windows i386 support 2025-08-29 12:41:38 -07:00
Harold Brenes
9d8e15b3af Implementes the block ABI.2010.3.16 natively via the objc_block intrinsic and the Objc_Block builtin type.
See: https://clang.llvm.org/docs/Block-ABI-Apple.html
2025-08-06 20:27:31 -04:00
gingerBill
2561427dd3 Add string16 and cstring16 (UTF-16 based strings) 2025-08-02 11:00:15 +01:00
Feoramund
61f9fb7232 runtime: Remove unneeded max(0, ...)
`len` never returns negative numbers, so this was an overcautious
expression.
2025-06-13 12:09:10 -04:00
Feoramund
91111937a7 Guard against negative index in inject_at
Fixes #4595
2025-06-04 13:58:06 -04:00
gingerBill
98efb03934 Merge pull request #4599 from Barinzaya/fix_dynamic_resize_zeroing_on_grow
Fix dynamic array not zeroing when growing
2025-01-06 12:37:05 +00:00
gingerBill
a6f1046fc0 Merge pull request #4533 from laytan/map-entry
add `map_entry` procedure
2025-01-06 12:36:27 +00:00
Yawning Angel
3a5440e4ed base/runtime: Add ensure and ensure_contextless
This provides an equivalent to `assert` and `assert_contextless` that
are always evaluated, ignoring `ODIN_DISABLE_ASSERT`, which is useful
for enforcing API contracts or "asserting" on conditionals with
side-effects.
2024-12-25 00:08:09 +09:00
Barinzaya
5f46b5ca50 Fixed zeroing in resize_dynamic_array.
When a dynamic array has unused capacity and is resized to a size
greater than its capacity, the unused part of its capacity wasn't being
zeroed.
2024-12-19 17:52:09 -05:00
Laytan Laats
8050622fe6 add map_entry procedure 2024-11-28 20:07:54 +01:00
Tetralux
2f85257bad [runtime] make(map[K]V) should not allocate any capacity
`make(map[K]V)` was resolving to `make_map_cap()` which allocates initial capacity when it wasn't intended to.
It now calls `make_map()` which doesn't allocate any capacity.

Both `make(map[K]V)` and `make(map[K]V, allocator)` will NOT allocate initial capacity now.
2024-11-16 06:13:12 +00:00
Laytan Laats
10c2f8dbeb math/rand: add choice_bit_set 2024-10-26 13:50:28 +02:00
Karl Zylinski
fd05d94789 Add make_map that just takes an allocator and no capacity, similar to make_dynamic_array. This renames the old make_map to make_map_cap. 2024-10-02 17:47:04 +02:00
mtarik34b
82aefd4203 Add documentation to runtime.container_of 2024-09-29 16:04:39 +02:00
Laytan Laats
603efa860a add '#caller_expression' 2024-09-14 22:13:37 +02:00
Franz Hoeltermann
02da1ac9af Added #any_int directive to some more builtin slice/dynamic array
procedures
2024-09-03 12:36:32 +02:00
gingerBill
78fa675c1a Add assert_contextless, panic_contextless, unimplemented_contextless 2024-08-14 11:18:24 +01:00
Laytan Laats
26fa3aca44 fix copy-paste error in make docs 2024-08-11 17:09:26 +02:00
gingerBill
196ac7e6d6 Type erase _make_dynamic_array_len_cap 2024-07-15 00:01:26 +01:00
gingerBill
26a9416a41 Minor clean ups 2024-07-14 23:33:35 +01:00
gingerBill
e768bddaeb Inline _append_elem_string further 2024-07-14 23:22:22 +01:00
gingerBill
83b7dd122a Type erase for append_elems 2024-07-14 23:20:50 +01:00
gingerBill
b0fbaf24a0 Type erase append_elem 2024-07-14 23:16:11 +01:00
gingerBill
15fb4ded2a type erase resize and reserve internals 2024-07-14 23:09:10 +01:00
gingerBill
8642d719f0 Imply #no_capture to all variadic parameters 2024-07-14 12:19:47 +01:00
gingerBill
c7bd954752 Add more uses of #no_capture 2024-07-14 11:56:04 +01:00
gingerBill
942f3f5220 Add non_zero_* variants for #soa dynamic array 2024-07-01 12:04:29 +01:00
gingerBill
8ddfcf174d Add #soa support to append directly 2024-07-01 11:51:28 +01:00
gingerBill
7f6fe91896 Add #soa forms to reserve, clear, and resize 2024-07-01 11:37:21 +01:00
gingerBill
11617af8f5 Add support for make(#soa[]T) etc 2024-07-01 11:34:50 +01:00
Karl Zylinski
679f9b4e41 Made default capacity of dynamic arrays more consistent.
Before this if you do `arr: [dynamic]int` and then append to arr, then it will have capacity 8.
But if you did `arr := make([dynamic]int, context.temp_allocator)` then arr would have capacity 16.

Now both `arr: [dynamic]int` and `arr := make([dynamic]int, context.temp_allocator)` will resut in arr having zero 0. The only reason to use `make` without an explicit len or cap now is because you want to set it up for a non-default allocator. After the first call to `append` it will now in both cases have capacity 8.

I also updated the documentation on the strings builder, both to reflect this, and also to fix it incorrectly saying that len would be 'max(16,len)', which wasn't true even before these changes.
2024-06-29 08:57:21 +02:00
gingerBill
a1ae6f161b Merge pull request #3502 from ARtemachka/master
Fix typo in core_builtin
2024-06-28 12:00:10 +01:00
Karl Zylinski
f227a40652 Replace max(8, 1) in _append_elem with just 8 and a comment. 2024-06-25 22:48:14 +02:00
Feoramund
50464bdce3 Use #any_int for reserve_* and resize_* procs
Resolves #3088
2024-06-10 20:51:58 -04:00
Artsiom Babukh
805bb69c6c Fix typo in core_builtin 2024-04-28 15:27:34 +00:00
Chris
6dcf38b85b Correct copy_from_string docs 2024-04-16 21:36:54 +01:00
gingerBill
34247b2658 Fix resize bug caused by typo 2024-03-24 12:24:44 +00:00
gingerBill
45d7dd8f27 Fix resize zeroing behaviour 2024-03-24 12:20:39 +00:00
gingerBill
29e5f94c2a Add #no_broadcast procedure parameter to disallow automatic array programming broadcasting on procedure arguments 2024-03-21 11:52:48 +00:00
gingerBill
9a41a450e7 Add builtin map_upsert 2024-03-11 12:30:24 +00:00
gingerBill
fa093d9b09 Add runtime.map_insert_and_check_for_previous 2024-02-06 23:58:22 +00:00
gingerBill
55ff9b857e Add contextless where missing 2024-02-02 11:51:26 +00:00
gingerBill
9c9ae5987a Fix #3150 2024-01-29 16:21:26 +00:00
gingerBill
59575d9b22 Remove incl and excl 2024-01-29 12:52:41 +00:00
gingerBill
9e7cc8cf93 Remove core:os dependency from base:runtime; change to base:intrinsics 2024-01-28 21:59:43 +00:00
gingerBill
09fa1c29cd Move core:runtime to base:runtime; keep alias around 2024-01-28 21:05:53 +00:00