updated CHANGELOG and call site bugfix
authorBrendan Hansen <brendan.f.hansen@gmail.com>
Mon, 28 Sep 2020 13:08:14 +0000 (08:08 -0500)
committerBrendan Hansen <brendan.f.hansen@gmail.com>
Mon, 28 Sep 2020 13:08:14 +0000 (08:08 -0500)
CHANGELOG
onyx
src/onyxwasm.c
tests/i32map.onyx

index c71302992ceb41fbbef820e8f240897b72b13163..7becc5f10d499dd511befd0e0a9f5827a37f3119 100644 (file)
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -5,14 +5,28 @@ Additions:
 * bitwise not operator, ~
 * auto cast operator, ~~. In many circumstances, will automatically determine what to cast to.
     - Will also report errors in the cast is not possible.
+* Arbitrarily typed varargs. They behave similar to C-style varargs.
+* vararg_get builtin procedure to retrieve a value from a ... vararg.
+* #private_file directive for placing a symbol at file scope.
+* a basic implentation of printf in the standard library.
+* use statements at the function level.
 
 Removals:
 
 Changes:
 * Procedure definitions now require parentheses, even if there are no arguments. This was
     done to allow for `proc { foo, bar }` to be the overload syntax.
+* array_map takes an arbitrary parameter of polymorphic type to make up for the fact that
+    anonymous procs do not have closure. New type signature is:
+        array_map :: proc (arr: ^[..] $T, data: $R, f: proc (T, R) -> T)
+* better syntax highlighting for VIM.
 
 Bug fixes:
+* many bugs related to var args and procedure calls in general.
+* polymorphic structs caused segmentation fault when trying to produce an error message.
+* polymorhpic structs caused scope to change when using a struct literal of a polymoprhic type.
+* #char "\"" did not work.
+* nested function calls returning non-basic types would simply be wrong.
 
 
 
diff --git a/onyx b/onyx
index 7d901db82bacb5bec2d66a15b90397174f0b91fc..d1898c4eb835a8234c6da71778b0dc2646ed9e8b 100755 (executable)
Binary files a/onyx and b/onyx differ
index 3d055bc6cf06eb410638daf6f1a082dda1e798fe..23ff7745dec8533511283ba4efed31c0948b15b0 100644 (file)
@@ -1326,6 +1326,7 @@ EMIT_FUNC(call, AstCall* call) {
 
     u32 vararg_count = 0;
     u32 vararg_offset = -1;
+    u64 stack_top_store_local;;
 
     bh_arr_each(AstArgument *, parg, call->arg_arr) {
         AstArgument* arg = *parg;
@@ -1341,8 +1342,26 @@ EMIT_FUNC(call, AstCall* call) {
 
         if (place_on_stack && !arg_is_struct) WID(WI_GLOBAL_GET, stack_top_idx);
 
+        if (stack_grow_amm != 0) {
+            stack_top_store_local = local_raw_allocate(mod->local_alloc, WASM_TYPE_INT32);
+            WID(WI_GLOBAL_GET, stack_top_idx);
+            WIL(WI_LOCAL_SET, stack_top_store_local);
+
+            WID(WI_GLOBAL_GET, stack_top_idx);
+            WID(WI_I32_CONST, stack_grow_amm);
+            WI(WI_I32_ADD);
+            WID(WI_GLOBAL_SET, stack_top_idx);
+        }
+
         emit_expression(mod, &code, arg->value);
 
+        if (stack_grow_amm != 0) {
+            WIL(WI_LOCAL_GET, stack_top_store_local);
+            WID(WI_GLOBAL_SET, stack_top_idx);
+
+            local_raw_free(mod->local_alloc, WASM_TYPE_INT32);
+        }
+
         if (place_on_stack) {
             if (arg_is_struct) WID(WI_GLOBAL_GET, stack_top_idx);
             emit_store_instruction(mod, &code, arg->value->type, stack_grow_amm);
index a6f3e6f1d8ef74671742f97284131d4c475e5938..da65ae3e041f996cb1456d0da8f4a532bcea35cc 100644 (file)
@@ -17,8 +17,7 @@ main :: proc (args: [] cstring) {
     println(i32map_has(^imap, 50));
     println(i32map_has(^imap, 51));
 
-    print(i32map_get(^imap, 50, ""));
-    println(i32map_get(^imap, 1234, ""));
+    printf("%s%s\n", i32map_get(^imap, 50, ""), i32map_get(^imap, 1234, ""));
 
     i32map_delete(^imap, 50);
     println(i32map_has(^imap, 50));