fixed a small alignment issue that could have been impacting performance
authorBrendan Hansen <brendan.f.hansen@gmail.com>
Tue, 19 Jan 2021 22:22:16 +0000 (16:22 -0600)
committerBrendan Hansen <brendan.f.hansen@gmail.com>
Tue, 19 Jan 2021 22:22:16 +0000 (16:22 -0600)
bin/onyx
examples/11_map.onyx
include/bh.h
onyx.exe
src/onyxsymres.c

index 2aa21033c93ca2c7d0ca828183d314962cb6e074..8ce0cff977b315bd38d9ebefd4dcb02963e4c12c 100755 (executable)
Binary files a/bin/onyx and b/bin/onyx differ
index 1400db296a05585dbce24562cf21dadce718a018..02af59eefdbc475c56ce821d5c17c4eef6796a9c 100644 (file)
@@ -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
index 5b708de9628a50f9e69bc69cbe993af2862e793d..c95af10e4efdeee836e15fabe30dc11dc4009f5b 100644 (file)
@@ -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)) {
index 06ab89e108cb35e367dbba5c28333add041e1dc4..11157fc213d3e7a80db82822f838879e37c475d7 100644 (file)
Binary files a/onyx.exe and b/onyx.exe differ
index fbf1f0923a17660003453641c833645853610553..24d16ee93f7d1e6042e972e8cdcfe8a2da7ad2bd 100644 (file)
@@ -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 {