From 048bb4bd744ad3432486d818f3bfa53c5d8877ca Mon Sep 17 00:00:00 2001 From: Steven Massey Date: Wed, 11 Dec 2019 19:59:39 -0800 Subject: [PATCH] cleanup --- source/m3_config.h | 14 +++++++------- source/m3_info.c | 16 ++++++++++++++++ source/m3_info.h | 1 + 3 files changed, 24 insertions(+), 7 deletions(-) diff --git a/source/m3_config.h b/source/m3_config.h index 1c441e8..7728cb8 100644 --- a/source/m3_config.h +++ b/source/m3_config.h @@ -34,7 +34,7 @@ # endif # ifndef d_m3LogOutput -# define d_m3LogOutput true +# define d_m3LogOutput 1 # endif # ifndef d_m3FixedHeap @@ -46,7 +46,7 @@ // It's enabled by default for Linux, OS X, Win32 and Android builds // and disabled on other platforms, i.e. microcontrollers # ifndef d_m3AllocateLinearMemory -# define d_m3AllocateLinearMemory false +# define d_m3AllocateLinearMemory true # endif # ifndef d_m3FixedHeapAlign @@ -64,13 +64,13 @@ // m3log (...) -------------------------------------------------------------------- # define d_m3LogParse 0 -# define d_m3LogCompile 0 -# define d_m3LogStack 0 -# define d_m3LogEmit 0 -# define d_m3LogCodePages 0 +# define d_m3LogCompile 1 +# define d_m3LogStack 1 +# define d_m3LogEmit 1 +# define d_m3LogCodePages 1 # define d_m3LogModule 0 # define d_m3LogRuntime 0 -# define d_m3LogExec 0 +# define d_m3LogExec 1 # define d_m3LogNativeStack 0 diff --git a/source/m3_info.c b/source/m3_info.c index ca126d4..1593725 100644 --- a/source/m3_info.c +++ b/source/m3_info.c @@ -384,4 +384,20 @@ void log_opcode (IM3Compilation o, u8 i_opcode) o->block.depth++; } +u16 GetMaxExecSlot (IM3Compilation o); + +void emit_stack_dump (IM3Compilation o) +{ +# if d_m3RuntimeStackDumps + if (o->numEmits) + { + EmitOp (o, op_DumpStack); + EmitConstant (o, o->numOpcodes); + EmitConstant (o, GetMaxExecSlot (o)); + EmitConstant (o, (u64) o->function); + + o->numEmits = 0; + } +# endif +} diff --git a/source/m3_info.h b/source/m3_info.h index 6412ff2..a91d2f6 100644 --- a/source/m3_info.h +++ b/source/m3_info.h @@ -25,6 +25,7 @@ OpInfo find_operation_info (IM3Operation i_operation); void dump_type_stack (IM3Compilation o); void log_opcode (IM3Compilation o, u8 i_opcode); const char * get_indention_string (IM3Compilation o); +void emit_stack_dump (IM3Compilation o); #endif /* m3_info_h */