miscellaneous things
authorBrendan Hansen <brendan.f.hansen@gmail.com>
Wed, 21 Jun 2023 19:17:16 +0000 (14:17 -0500)
committerBrendan Hansen <brendan.f.hansen@gmail.com>
Wed, 21 Jun 2023 19:17:16 +0000 (14:17 -0500)
CHANGELOG
compiler/include/astnodes.h
compiler/src/builtins.c
compiler/src/onyx.c
compiler/src/wasm_emit.c
compiler/src/wasm_output.h
core/container/slice.onyx

index bece8908163a1d8fa9ae90133717380054dcf0b9..6c77eb3c28156c5fe9faf98bcdfbf18d63c48b82 100644 (file)
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,6 +1,19 @@
+Release v0.1.4
+-----------
+Not released
+
+Additions:
+
+Removals:
+
+Changes:
+
+Bugfixes:
+
+
 Release v0.1.3
 -----------
-Unreleased
+19th June 2023
 
 Additions:
 - New syntax for declaring quoted code blocks.
index 8dcca96b9067afcbceb7c498ba0c2423d77545fd..be3d5f18466853fe23e47c445509da6040107acd 100644 (file)
@@ -1818,7 +1818,8 @@ struct CompileOptions {
     const char* help_subcommand;
     bh_arr(DefinedVariable) defined_variables;
 
-    b32 debug_enabled;
+    b32 debug_session;
+    b32 debug_info_enabled;
     b32 stack_trace_enabled;
 
     i32    passthrough_argument_count;
index 0fa9e19fc98d08d33cae81d5752f837cabba03c9..8f256c5de3955879ceb28e50d4fe293f735edb07 100644 (file)
@@ -604,7 +604,7 @@ void introduce_build_options(bh_allocator a) {
     wait_notify_available->type_node = (AstType *) &basic_type_bool;
     symbol_builtin_introduce(p->scope, "Wait_Notify_Available", (AstNode *) wait_notify_available);
 
-    AstNumLit* debug_mode = make_int_literal(a, context.options->debug_enabled);
+    AstNumLit* debug_mode = make_int_literal(a, context.options->debug_info_enabled);
     debug_mode->type_node = (AstType *) &basic_type_bool;
     symbol_builtin_introduce(p->scope, "Debug_Mode_Enabled", (AstNode *) debug_mode);
 
index 5370ffd17d3216520d17827f5a59ad8a5ad162e8..635eb2142ba4749ada8fb9b819f4a54e1ea18659 100644 (file)
@@ -19,7 +19,7 @@ extern struct bh_allocator global_heap_allocator;
 #include "wasm_emit.h"
 #include "doc.h"
 
-#define VERSION "v0.1.2"
+#define VERSION "v0.1.3"
 
 
 Context context;
@@ -112,7 +112,7 @@ static CompileOptions compile_opts_parse(bh_allocator alloc, int argc, char *arg
 
         .defined_variables = NULL,
 
-        .debug_enabled = 0,
+        .debug_info_enabled = 0,
 
         .passthrough_argument_count = 0,
         .passthrough_argument_data  = NULL,
@@ -263,7 +263,12 @@ static CompileOptions compile_opts_parse(bh_allocator alloc, int argc, char *arg
                 options.symbol_info_file = argv[++i];
             }
             else if (!strcmp(argv[i], "--debug")) {
-                options.debug_enabled = 1;
+                options.debug_session = 1;
+                options.debug_info_enabled = 1;
+                options.stack_trace_enabled = 1;
+            }
+            else if (!strcmp(argv[i], "--debug-info")) {
+                options.debug_info_enabled = 1;
                 options.stack_trace_enabled = 1;
             }
             else if (!strcmp(argv[i], "--stack-trace")) {
@@ -978,7 +983,7 @@ static CompilerProgress onyx_flush_module() {
 
 #ifdef ENABLE_RUN_WITH_WASMER
 static b32 onyx_run_module(bh_buffer code_buffer) {
-    onyx_run_initialize(context.options->debug_enabled);
+    onyx_run_initialize(context.options->debug_session);
 
     if (context.options->verbose_output > 0)
         bh_printf("Running program:\n");
index 13507e0317a0690391729fe157d7a66009efb09d..be3fb191424187754530824baf2b9995ed77189f 100644 (file)
@@ -313,7 +313,7 @@ static void debug_set_position(OnyxWasmModule *mod, OnyxToken *token) {
 //    - REP
 //    - SET, REP 0
 static void debug_emit_instruction(OnyxWasmModule *mod, OnyxToken *token) {
-    if (!context.options->debug_enabled) {
+    if (!context.options->debug_info_enabled) {
         return;
     }
 
index ba47d0e069f2eb00fc588496a524f7dacf3c7e1b..a849939ec4e1546270927ec41a8663db521cc0b4 100644 (file)
@@ -428,7 +428,7 @@ static void output_instruction(WasmFunc* func, WasmInstruction* instr, bh_buffer
     i32 leb_len;
     u8* leb;
 
-    if (instr->type == WI_NOP && !context.options->debug_enabled) return;
+    if (instr->type == WI_NOP && !context.options->debug_info_enabled) return;
 
     if (instr->type & SIMD_INSTR_MASK) {
         bh_buffer_write_byte(buff, 0xFD);
@@ -765,7 +765,7 @@ static i32 output_onyx_func_offset_section(OnyxWasmModule* module, bh_buffer* bu
 
 #ifdef ENABLE_DEBUG_INFO
 static i32 output_ovm_debug_sections(OnyxWasmModule* module, bh_buffer* buff) {
-    if (!module->debug_context || !context.options->debug_enabled) return 0;
+    if (!module->debug_context || !context.options->debug_info_enabled) return 0;
 
     DebugContext *ctx = module->debug_context;
 
@@ -1090,7 +1090,7 @@ void onyx_wasm_module_write_to_buffer(OnyxWasmModule* module, bh_buffer* buffer)
     bh_buffer_append(buffer, WASM_VERSION, 4);
 
 #ifdef ENABLE_DEBUG_INFO
-    if (context.options->debug_enabled) {
+    if (context.options->debug_info_enabled) {
         output_ovm_debug_sections(module, buffer);
     }
 #endif
index 9c94b64a35e3c4c9724822f63dadbc68212ce961..8494710484e8840c6a26f285fcf6b66806e69865 100644 (file)
@@ -371,7 +371,7 @@ unique :: (arr: &[] $T) {
 
         // OR
 
-        slice.fold(arr, 0, [it](it + acc)) |> println();
+        slice.fold(arr, 0, [it, acc](it + acc)) |> println();
 """
 fold :: #match #local {}