Commit Graph

556 Commits

Author SHA1 Message Date
Jeroen van Rijn 30388cada3 Fix os2.clean_path on Windows 2025-05-11 15:35:52 +02:00
Laytan Laats ebc63a7355 add hexfloat (0h) parsing to strconv 2025-05-10 15:11:52 +02:00
Jeroen van Rijn 062a3c2fae Fix parsing of CDATA tags (#5059)
Fixes #5054
2025-04-19 20:25:44 +02:00
Jeroen van Rijn 678fa897f5 signbit -> sign_bit in tests/core/math 2025-04-15 16:20:49 +02:00
Jeroen van Rijn 0fc141db5d core:mem/tlsf: Add early-out in OOM logic
This implementation doesn't allow for out-of-band allocations to be passed through, as it's not designed to
track those. Nor is it able to signal those allocations then need to be freed on the backing allocator,
as opposed to regular allocations handled for you when you `destroy` the TLSF instance.

So if we're asked for more than we're configured to grow by, we can fail with an OOM error early, without adding a new pool.
2025-04-14 20:40:05 +02:00
Jeroen van Rijn beee27dec0 Allow core:mem/tlsf to automatically add new pools.
New features:
- If TLSF can't service an allocation made on it, and it's initialized with `new_pool_size` > 0, it will ask the backing allocator for additional memory.

- `estimate_pool_size` can tell you what size your initial (and `new_pool_size`) ought to be if you want to make `count` allocations of `size` and `alignment`, or in its other form, how much backing memory is needed for `count` allocations of `type` and its corresponding size and alignment.
2025-04-14 19:49:55 +02:00
Jeroen van Rijn 7088284ff4 Refactor core:mem/tlsf, add free_all support.
TODO: Allow the TLSF allocator to add additional pools when it would ordinarily OOM
      by calling its backing allocator.
2025-04-14 17:13:27 +02:00
Jeroen van Rijn 0a97e01827 Add tests for type_elem_type on SIMD vectors 2025-04-11 23:31:02 +02:00
Barinzaya bbaec119e5 Added tests for math.nextafter. 2025-04-07 16:27:41 -04:00
Jeroen van Rijn a5e513567b Optimize regex match iterator.
Reuse virtual machine and capture groups between matches.
2025-04-07 14:58:41 +02:00
Jeroen van Rijn 9a2b6c01aa Return loop index in regex iterator. 2025-04-06 21:45:37 +02:00
Jeroen van Rijn 66077add33 {.Glboal} implicit in regex allocator. 2025-04-06 21:13:02 +02:00
Jeroen van Rijn 918d57fe01 Keep -vet happy. 2025-04-06 14:24:17 +02:00
Jeroen van Rijn cdc56dc691 Add iterator for core:text/regex.
Usage:
```odin
haystack := `xxfoobarxfoobarxx`
pattern  := `f(o)ob(ar)`

it := regex.create_iterator(haystack, pattern, {.Global}) or_return
defer regex.destroy(it)

for capture in regex.match(&it) {
	fmt.println(capture)
}
```
2025-04-06 14:19:14 +02:00
Laytan Laats ff7d55a8e1 net: rework errors to be cross-platform 2025-04-05 17:35:19 +02:00
gingerBill 4a595f9dac Merge pull request #4954 from Feoramund/os2-path
Add new path API for `os2`
2025-03-24 11:19:21 +00:00
Yawning Angel b220df60b8 core:crypto/deoxysii: Initial import 2025-03-23 19:14:33 +09:00
Yawning Angel c2786a6dd5 core/crypto/aegis: Initial import 2025-03-23 19:14:33 +09:00
Yawning Angel 9fdcc4e39a core/crypto/x448: Initial import 2025-03-23 19:14:33 +09:00
Feoramund 3525e71739 Add tests for new os2 path API 2025-03-21 19:14:15 -04:00
Feoramund 4e7f54c565 Decouple usage of filepath from os2 2025-03-21 19:14:15 -04:00
gingerBill 539e9bd2e3 Merge pull request #4836 from laytan/fix-wrong-out-of-memory
fix wrong out of memory in edge cases, just try allocate from block for one source of truth
2025-03-20 17:20:26 +00:00
gingerBill bb429696f8 Merge pull request #4877 from laytan/os2-additions
os/os2: recursive directory walker, expose errors in read_directory, file clone
2025-02-28 14:37:47 +00:00
Feoramund 6054b921db Add tests for new safe to_cstring 2025-02-27 18:54:38 -05:00
Laytan Laats 0e4140a602 os/os2: recursive directory walker, expose errors in read_directory, file clone
Adds a directory walker, a method of exposing and retrieving errors from
the existing read directory iterator, allows reusing of the existing
read directory iterator, and adds a file clone procedure
2025-02-24 20:40:44 +01:00
Laytan Laats 55302280d8 fix addrinfo struct def
Fixes #4816
2025-02-12 19:24:27 +01:00
Laytan Laats ae0f69fbe2 cleanup test arenas 2025-02-12 19:13:16 +01:00
Laytan Laats 7df5be2131 fix wrong out of memory in edge cases, just try allocate from block for one source of truth 2025-02-12 19:09:21 +01:00
jkenda 51b80c5a20 encoding/json: marshal enumerated arrays to objects with key-value pairs 2025-02-01 10:32:07 +01:00
Laytan Laats b673642412 os/os2: add get_executable_path and get_executable_directory 2025-01-21 18:54:45 +01:00
avanspector 9868c8292b Merge branch 'master' of https://github.com/avanspector/Odin 2025-01-10 06:42:42 +01:00
avanspector a704000c34 Haiku: add posix tests 2025-01-10 06:42:19 +01:00
gingerBill 2a29322c91 Merge pull request #4605 from karl-zylinski/tracking-allocator-bad-free-default-to-crash
Make tracking allocator default to crashing on a bad free instead of adding to bad_free_array
2025-01-08 16:24:20 +00:00
gingerBill 3d984d75cc Add #+feature dynamic-literals to tests 2025-01-05 14:00:23 +00:00
gingerBill a300a860ec Add #+feature dynamic-literals to tests 2025-01-05 13:46:58 +00:00
fleandro 1550eced04 also add a test for non power of 2 N for good measure 2025-01-03 16:58:03 +00:00
fleandro c93e096d8f fix N=1 and cleanup tests 2025-01-03 16:50:05 +00:00
fleandro 555bca2cb4 fix test leaks 2025-01-03 15:46:02 +00:00
fleandro e3de02eaa8 runtime: map_cell_index_static produced wrong results when the number of elements per cell was a power of 2 2025-01-03 15:33:34 +00:00
Karl Zylinski e5f32e1455 Makes tracking allocator default to crashing on a bad free instead of add to bad_free_array. The bad_free_array remains to not break old code. The new default behavior is implemented in a callback that you can override, there's a second provided callback that provides the old behavior where an element was added to bad_free_array. Rationale: Many people are just checking the allocation_map, but don't check the bad free array. Several examples throughout core that use tracking allocator don't check bad_free_array either, so people have been taught not to check it. 2024-12-21 15:49:48 +01:00
Adam Zadrożny ce51b79a37 Fix the unused variable errors 2024-12-04 21:09:47 +01:00
Adam Zadrożny 5dfc24882f improve strings.index_multi
There's no point searching for substrings after lowest_index,
so let's not.

This significantly improves performance on long strings.
2024-12-04 14:29:49 +01:00
Ycros bf63e9b093 Add test for regex preallocated captures. 2024-12-04 14:38:07 +11:00
Damian Tarnawski 26415bcb0e Correct handling newlines between build tags in core:odin
Previously I thought that each newline worked as `OR`
basically the same as `,`.

This corrects this to work as `AND` instead.
2024-12-01 18:21:26 +01:00
Jeroen van Rijn 1a0a6c485d Add comment explaining #4515 test. 2024-11-25 13:47:04 +01:00
Jeroen van Rijn 2dc0187836 Test #4515 2024-11-25 13:16:27 +01:00
Colin Davidson f8586d0051 oops, copy-paste-bug 2024-11-20 15:33:20 -08:00
Colin Davidson 3bb73eacfc fix parsing issue around utc/localtime split 2024-11-20 12:09:32 -08: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 282d956aa7 os2: skip dir test when unsupported 2024-11-15 21:56:55 +01:00