From: Brendan Hansen Date: Tue, 19 Jan 2021 22:22:16 +0000 (-0600) Subject: fixed a small alignment issue that could have been impacting performance X-Git-Url: https://git.brendanfh.com/?a=commitdiff_plain;h=85ac416936b18dd4d07d9b48a538848f353c2a7e;p=onyx.git fixed a small alignment issue that could have been impacting performance --- diff --git a/bin/onyx b/bin/onyx index 2aa21033..8ce0cff9 100755 Binary files a/bin/onyx and b/bin/onyx differ diff --git a/examples/11_map.onyx b/examples/11_map.onyx index 1400db29..02af59ee 100644 --- a/examples/11_map.onyx +++ b/examples/11_map.onyx @@ -12,6 +12,10 @@ main :: proc (args: [] cstr) { map.init(^ages, default=0, hash_count=16); defer map.free(^ages); + // Alternatively you can use the map.make function to achieve the + // same thing: + // ages := map.make(str, u32, default = 0); + // The defer statement ensures that the map memory will be freed // when this procedure exits, no matter through which way. The // 'default' argument is used to specify what value should be diff --git a/include/bh.h b/include/bh.h index 5b708de9..c95af10e 100644 --- a/include/bh.h +++ b/include/bh.h @@ -1002,6 +1002,8 @@ BH_ALLOCATOR_PROC(bh_arena_allocator_proc) { switch (action) { case bh_allocator_action_alloc: { + bh_align(alloc_arena->size, alignment); + // TODO: Do this better because right now bh__align is bad // size = bh__align(size, alignment); if (size > alloc_arena->arena_size - size_of(ptr)) { diff --git a/onyx.exe b/onyx.exe index 06ab89e1..11157fc2 100644 Binary files a/onyx.exe and b/onyx.exe differ diff --git a/src/onyxsymres.c b/src/onyxsymres.c index fbf1f092..24d16ee9 100644 --- a/src/onyxsymres.c +++ b/src/onyxsymres.c @@ -569,7 +569,7 @@ static void symres_directive_solidify(AstDirectiveSolidify** psolid) { symres_expression(&sln->value); if (onyx_has_errors()) return; - if (node_is_type(sln->value)) { + if (node_is_type((AstNode *) sln->value)) { sln->type = type_build_from_ast(semstate.node_allocator, sln->ast_type); sln->kind = PSK_Type; } else {