aboutsummaryrefslogtreecommitdiff
path: root/main.c
diff options
context:
space:
mode:
authorGravatar Moon Flower <moon@coffin.ir> 2025-03-10 00:11:21 +0330
committerGravatar Moon Flower <moon@coffin.ir> 2025-03-10 00:11:21 +0330
commit4aef86c3e641cbff8e0155589f9cc9172aa1051c (patch)
tree55d0e6d340ded45737959c3cd94fccceddc550a8 /main.c
parentFixed stuff broken woohoo (diff)
New moonshine release! What's changed?
> - New allocator based on sbrk and linked lists > - Hybrid allocator switching mechanism to swap sbrk and mmap whenever needed > - Better internal exception detector to prevent useless uninformative stackoverflow exceptions > - Moved a bunch of the code around, as always! > Have a great night!
Diffstat (limited to 'main.c')
-rw-r--r--main.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/main.c b/main.c
index 8c7585c..2e774b8 100644
--- a/main.c
+++ b/main.c
@@ -90,11 +90,13 @@ int main() {
collect_garbage(true);
} else if (current_test == test_minor_features) {
- // Minor feature: Custom, better designed float representation
- auto x = (struct moonshine_float) { .number = 1234, .decimal = 2 };
- println(x);
- // Normal float enhancement
- println(12.34);
+ // Minor feature: sbrk allocator
+ auto ptr = sbrkocator_alloc(10);
+ sbrkocator_release(ptr);
+ ptr = sbrkocator_alloc(1000);
+ sbrkocator_release(sbrkocator_alloc(500));
+ sbrkocator_release(ptr);
+ puts("Wowie\n");
} else if (current_test == test_garbage_collector_2) {
for (u8 i = 0; i < 9999; i++) new (int, 9999);
collect_garbage(true);