Christoffer Lerno
945a3f3fc0
Add mem::store and mem::load which may combine both aligned and volatile operations.
2026-01-17 18:52:30 +01:00
BWindey
12eea4a98d
[STDLIB] Add macro return types ( #2487 )
...
* add return types to macros where applicable
* std::time::clock::now() -> clock::now()
2025-09-18 14:06:58 +02:00
Christoffer Lerno
ca2fabc9f9
- $defined(#hash) will not check the internal expression, just that #hash exists.
...
- Added optional macro arguments using `macro foo(int x = ...)` which can be checked using `$defined(x)`.
- Supplemental `roundeven` has a normal implementation.
2025-08-29 11:23:39 +02:00
Christoffer Lerno
8f3cb9c6e9
Add more comments to mem functions.
2025-08-28 18:23:01 +02:00
Christoffer Lerno
239d249f01
- Added $kindof compile time function.
...
- Deprecated `@typekind` macro in favour of `$kindof`.
- Deprecated `@typeis` macro in favour of `$typeof(#foo) == int`.
2025-08-27 20:38:12 +02:00
Christoffer Lerno
cb17cfff7d
Deprecation of @assignable_to
2025-08-26 13:21:42 +02:00
Christoffer Lerno
e4e499edd2
Allow $defined take declarations: $defined(int x = y)
...
Taking the address of a label would cause a crash. #2430
2025-08-23 12:00:17 +02:00
Zack Puhl
ad02fad167
Add Freestanding OS Types ( #2399 )
...
* Add Freestanding OS Types to `env::`
2025-08-16 19:47:03 +02:00
Zack Puhl
702b63ddb7
Add array::zip and Related Macros ( #2370 )
...
* zip / zip_into
* Deprecate `add_array` in favour of `push_all` on lists.
* Add support for generic lists for zip.
---------
Co-authored-by: Christoffer Lerno <christoffer@aegik.com >
2025-08-16 13:30:24 +02:00
Christoffer Lerno
5f0a7dd63e
Rename AlignedRef -> UnalignedRef
2025-07-22 15:55:43 +02:00
Christoffer Lerno
b45c337515
Contract fix.
2025-07-22 15:14:10 +02:00
Christoffer Lerno
9dc6b0e660
Added AlignedRef generic type.
2025-07-22 15:11:14 +02:00
Christoffer Lerno
428165590e
Add Volatile type.
2025-07-22 14:13:48 +02:00
Christoffer Lerno
908d705669
Removing use of $assignable and deprecate it.
2025-07-20 20:07:06 +02:00
Christoffer Lerno
efaac43248
- Virtual memory library.
...
- New virtual emory arena allocator.
- Fixed resize bug when resizing memory down in ArenaAllocator, DynamicArenaAllocator, BackedArenaAllocator.
- Added feature flag "SLOW_TESTS"
2025-07-14 22:36:43 +02:00
Christoffer Lerno
2bd289ebd6
Added VirtualMemory
2025-07-14 03:07:03 +02:00
Christoffer Lerno
aba9baf207
Added Vmem allocator
2025-07-13 17:26:57 +02:00
Christoffer Lerno
e755c36ea2
Removed the use of temp allocator in backtrace printing.
...
Added string::bformat.
2025-07-13 02:58:57 +02:00
Christoffer Lerno
2f45beecbe
@pool now has an optional reserve parameter, some minor changes to the temp_allocator API
2025-06-19 01:13:43 +02:00
Christian Buttner
0595270d9a
Fix mem::copy_inline compile.
2025-04-25 16:04:41 +02:00
Christoffer Lerno
8a2907806b
Fixes to tclone and other temp allocations with overaligned data.
2025-04-20 21:30:36 +02:00
Christoffer Lerno
f778e75757
Added missing @clone_aligned and add checks to @tclone
2025-04-20 18:31:52 +02:00
Christoffer Lerno
ff2809a3ac
Fix of regression in @assert_leak.
2025-03-25 22:11:47 +01:00
Christoffer Lerno
82f1b543ed
&self not runtime null-checked in macro #1827 . Regression in temp allocators.
2025-03-23 22:50:09 +01:00
Christoffer Lerno
a03d821602
- Use @pool_init() to set up a temp pool on a thread. Only the main thread has implicit temp pool setup.
...
- `tmem` is now a variable.
2025-03-21 17:08:58 +01:00
Christoffer Lerno
7e100472e7
- AnyList now also defaults to the temp allocator.
...
- `os::getcwd` and `os::get_home_dir` requires an explicit allocator.
- `file::load_new` and `file::load_path_new` removed.
2025-03-18 18:34:52 +01:00
Christoffer Lerno
72608ce01d
- Temp allocator now supports more than 2 in-flight stacks.
...
- Printing stacktrace uses its own temp allocator.
- `@pool` no longer takes an argument.
- `Allocator` interface removes `mark` and `reset`.
- DynamicArenaAllocator has changed init function.
- Added `BackedArenaAllocator` which is allocated to a fixed size, then allocates on the backing allocator and supports mark/reset.
2025-03-18 15:16:22 +01:00
Christoffer Lerno
425676a98d
Bug due to missing cast when doing $i[$x] = $z.
...
Added `math::iota`.
2025-03-16 10:58:13 +01:00
Christoffer Lerno
5c77c9a754
- Change distinct -> typedef.
...
- Order of attribute declaration is changed for `alias`.
- Added `LANGUAGE_DEV_VERSION` env constant.
- Rename `anyfault` -> `fault`.
- Changed `fault` -> `faultdef`.
- Added `attrdef` instead of `alias` for attribute aliases.
2025-03-15 20:10:47 +01:00
Christoffer Lerno
25bccf4883
New faults and syntax ( #2034 )
...
- Remove `[?]` syntax.
- Change `int!` to `int?` syntax.
- New `fault` declarations.
- Enum associated values can reference the calling enum.
2025-03-10 00:11:35 +01:00
Christoffer Lerno
c0b80eccad
Change @return! syntax to require ":" after faults. Update all contracts to consistently use ":" before the description.
2025-03-05 17:11:45 +01:00
Christoffer Lerno
2439405e70
- $foreach "()" replaced by trailing ":" $foreach ($x, $y : $foo) -> $foreach $x, $y : $foo:
...
- `$for` "()" replaced by trailing ":" `$for (var $x = 0; $x < FOO; $x++)` -> `$for var $x = 0; $x < FOO; $x++:`
- `$switch` "()" replaced by trailing ":" `$switch ($Type)` -> `$switch $Type:`
- Empty `$switch` requires trailing ":" `$switch` -> `$switch:`
2025-03-04 16:13:47 +01:00
Christoffer Lerno
c40198b016
- new_* functions in general moved to version without new_ prefix.
...
- `string::new_from_*` changed to `string::from_*`.
- `String.to_utf16_copy` and related changed to `String.to_utf16`.
- `String.to_utf16_tcopy` and related changed to `String.to_temp_utf16`
- `mem::temp_new` changed to `mem::tnew`.
- `mem::temp_alloc` and related changed to `mem::talloc`.
- `mem::temp_new_array` changed to `mem::temp_array`.
2025-03-03 00:32:20 +01:00
Christoffer Lerno
45eb3acffe
Remove unused parameter in mem::clear.
2025-02-11 00:15:33 +01:00
Christoffer Lerno
ac3b2f0fea
- Fix bug where in dead code, only the first statement would be turned into a nop.
...
- Remove unused $inline argument to mem::copy.
2025-01-29 13:07:19 +01:00
Christoffer Lerno
02c3d5419b
Add with_padding convenience functions.
2025-01-28 00:18:08 +01:00
Christoffer Lerno
e40bab2d30
Allow (int[*]) { 1, 2 } cast style initialization. Experimental change from [*] to [?]. Fix issue where compile time declarations in expression list would not be handled properly.
2025-01-25 22:10:12 +01:00
konimarti
190dc246b3
mem: add macro to assert on memory leak in scope ( #1792 )
...
* mem: add macro to assert on memory leak in scope
Implement `mem::@assert_leak` to assert on a memory leak in the scope of
the macro body. Memory report for the leak can be disabled by setting
the boolean argument to false.
* fix: add conditional compilation flags
* Moved the code into `mem.c3` and made it a builtin.
---------
Co-authored-by: Christoffer Lerno <christoffer@aegik.com >
2025-01-10 13:33:33 +01:00
Christoffer Lerno
cdc1656f3a
#foo style arguments were not type checked when given a type. #1790
2025-01-09 01:28:30 +01:00
Christoffer Lerno
8e0d6d11b9
Deprecated '&' macro arguments.
2025-01-08 22:13:49 +01:00
Christoffer Lerno
e453e6f9ca
- Add enum.from_ordinal and fault.from_ordinal
...
- Deprecate cast-style conversion from integer to enum.
- Make deprecation an error in test mode.
2024-12-23 15:27:59 +01:00
Christoffer Lerno
6ca5bcc6b8
Add simple memcpy, memcmp and memset functions for nolibc.
2024-11-27 13:45:41 +01:00
Christoffer Lerno
0e213ae777
Disable report heap allocs using parameter.
2024-11-26 03:11:10 +01:00
Christoffer Lerno
705856d51a
- Disallow casting a void* to any or an interface, unless it is null.
...
- Defer resolution of declarations when looked up in `def` aliased #1559 .
2024-10-16 12:50:47 +02:00
Christoffer Lerno
31cd839063
Switch to <* *> docs. Fix issue with dynamically loaded C3 libs with other C3 code.
2024-10-14 02:14:34 +02:00
Christoffer Lerno
a665978b64
Fixing some whitespace issues.
2024-10-08 19:38:31 +02:00
Christoffer Lerno
c8018c5543
Added generic PBKDF2 implementation.
2024-09-30 00:07:49 +02:00
Christoffer Lerno
26acce246d
Fixed int128 div/mod. Fix WASM memory init priority.
2024-08-27 04:31:14 +02:00
Christoffer Lerno
388578c209
Too restrictive compile time checks for @const. Fixes to wasm nolibc in the standard library.
2024-08-26 13:33:15 +02:00
Christoffer Lerno
edfea639cf
- Introduce $vaarg[...] syntax and deprecate the old $vaarg(...).
...
- Similar change to `$vasplat`: `$vasplat` and `$vasplat[1..]`.
2024-08-16 09:28:28 +02:00