From: Brendan Hansen Date: Wed, 21 Jun 2023 19:17:16 +0000 (-0500) Subject: miscellaneous things X-Git-Url: https://git.brendanfh.com/?a=commitdiff_plain;h=dbf0ef457879fa047ef276dad95bc74630f7a41e;p=onyx.git miscellaneous things --- diff --git a/CHANGELOG b/CHANGELOG index bece8908..6c77eb3c 100644 --- 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. diff --git a/compiler/include/astnodes.h b/compiler/include/astnodes.h index 8dcca96b..be3d5f18 100644 --- a/compiler/include/astnodes.h +++ b/compiler/include/astnodes.h @@ -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; diff --git a/compiler/src/builtins.c b/compiler/src/builtins.c index 0fa9e19f..8f256c5d 100644 --- a/compiler/src/builtins.c +++ b/compiler/src/builtins.c @@ -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); diff --git a/compiler/src/onyx.c b/compiler/src/onyx.c index 5370ffd1..635eb214 100644 --- a/compiler/src/onyx.c +++ b/compiler/src/onyx.c @@ -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"); diff --git a/compiler/src/wasm_emit.c b/compiler/src/wasm_emit.c index 13507e03..be3fb191 100644 --- a/compiler/src/wasm_emit.c +++ b/compiler/src/wasm_emit.c @@ -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; } diff --git a/compiler/src/wasm_output.h b/compiler/src/wasm_output.h index ba47d0e0..a849939e 100644 --- a/compiler/src/wasm_output.h +++ b/compiler/src/wasm_output.h @@ -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 diff --git a/core/container/slice.onyx b/core/container/slice.onyx index 9c94b64a..84947104 100644 --- a/core/container/slice.onyx +++ b/core/container/slice.onyx @@ -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 {}