extensions
Volodymyr Shymanskyy 4 years ago
parent a2da1e1cf7
commit fbd555c62c

@ -427,7 +427,7 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
timeout-minutes: 10 timeout-minutes: 10
#TODO: d_m3RuntimeStackDumps, d_m3EnableOpProfiling #TODO: d_m3EnableOpTracing, d_m3EnableOpProfiling
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
- name: Build - name: Build
@ -435,7 +435,6 @@ jobs:
mkdir build mkdir build
cd build cd build
g++ -xc++ -Dd_m3HasWASI -Dd_m3LogsDefined \ g++ -xc++ -Dd_m3HasWASI -Dd_m3LogsDefined \
-Dd_m3TraceExec=1 \
-Dd_m3LogParse=1 \ -Dd_m3LogParse=1 \
-Dd_m3LogModule=1 \ -Dd_m3LogModule=1 \
-Dd_m3LogCompile=1 \ -Dd_m3LogCompile=1 \

@ -46,28 +46,26 @@
# define d_m3Use32BitSlots 1 # define d_m3Use32BitSlots 1
# endif # endif
//# ifndef d_m3EnableOptimizations # ifndef d_m3ProfilerSlotMask
//# define d_m3EnableOptimizations 0 # define d_m3ProfilerSlotMask 0xFFFF
//# endif # endif
// logging -------------------------------------------------------------------- // logging --------------------------------------------------------------------
#ifndef d_m3LogsDefined #ifndef d_m3LogsDefined
# define d_m3EnableOpProfiling 0 # define d_m3EnableOpProfiling 0 // profiling or tracing can be used
# define d_m3RuntimeStackDumps 0 # define d_m3EnableOpTracing 0 // only works with DEBUG
# define d_m3TraceExec (1 && d_m3RuntimeStackDumps && DEBUG) # define d_m3LogParse 0 // .wasm binary decoding info
# define d_m3LogModule 0 // wasm module info
# define d_m3LogParse 0 // .wasm binary decoding info # define d_m3LogCompile 0 // wasm -> metacode generation phase
# define d_m3LogModule 0 // Wasm module info # define d_m3LogWasmStack 0 // dump the wasm stack when pushed or popped
# define d_m3LogCompile 0 // wasm -> metacode generation phase # define d_m3LogEmit 0 // metacode generation info
# define d_m3LogWasmStack 0 // dump the wasm stack when pushed or popped # define d_m3LogCodePages 0 // dump metacode pages when released
# define d_m3LogEmit 0 // metacode generation info # define d_m3LogExec 0 // low-level interpreter specific logs
# define d_m3LogCodePages 0 // dump metacode pages when released # define d_m3LogRuntime 0 // higher-level runtime information
# define d_m3LogExec 0 // low-level interpreter specific logs # define d_m3LogStackTrace 0 // dump the call stack when traps occur
# define d_m3LogRuntime 0 // higher-level runtime information # define d_m3LogNativeStack 0 // track the memory usage of the C-stack
# define d_m3LogStackTrace 0 // dump the call stack when traps occur
# define d_m3LogNativeStack 0 // track the memory usage of the C-stack
#endif #endif

@ -53,9 +53,9 @@ M3Result EmitOp (IM3Compilation o, IM3Operation i_operation)
// it's OK for page to be null; when compile-walking the bytecode without emitting // it's OK for page to be null; when compile-walking the bytecode without emitting
if (o->page) if (o->page)
{ {
# if d_m3RuntimeStackDumps # if d_m3EnableOpTracing
if (i_operation != op_DumpStack) if (i_operation != op_DumpStack)
# endif # endif
o->numEmits++; o->numEmits++;
result = BridgeToNewPageIfNecessary (o); result = BridgeToNewPageIfNecessary (o);

@ -404,7 +404,7 @@ d_m3OpDef (PreserveCopySlot_64)
} }
#if d_m3RuntimeStackDumps #if d_m3EnableOpTracing
//-------------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------------
d_m3OpDef (DumpStack) d_m3OpDef (DumpStack)
{ {
@ -439,19 +439,19 @@ d_m3OpDef (DumpStack)
# if d_m3EnableOpProfiling # if d_m3EnableOpProfiling
//-------------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------------
M3ProfilerSlot s_opProfilerCounts [c_m3ProfilerSlotMask + 1] = {}; static M3ProfilerSlot s_opProfilerCounts [d_m3ProfilerSlotMask + 1] = {};
void ProfileHit (cstr_t i_operationName) void ProfileHit (cstr_t i_operationName)
{ {
u64 ptr = (u64) i_operationName; u64 ptr = (u64) i_operationName;
M3ProfilerSlot * slot = & s_opProfilerCounts [ptr & c_m3ProfilerSlotMask]; M3ProfilerSlot * slot = & s_opProfilerCounts [ptr & d_m3ProfilerSlotMask];
if (slot->opName) if (slot->opName)
{ {
if (slot->opName != i_operationName) if (slot->opName != i_operationName)
{ {
m3Abort ("profiler slot collision; increase c_m3ProfilerSlotMask"); m3Abort ("profiler slot collision; increase d_m3ProfilerSlotMask");
} }
} }
@ -469,7 +469,7 @@ void m3_PrintProfilerInfo ()
{ {
maxSlot->hitCount = 0; maxSlot->hitCount = 0;
for (u32 i = 0; i <= c_m3ProfilerSlotMask; ++i) for (u32 i = 0; i <= d_m3ProfilerSlotMask; ++i)
{ {
M3ProfilerSlot * slot = & s_opProfilerCounts [i]; M3ProfilerSlot * slot = & s_opProfilerCounts [i];

@ -55,14 +55,10 @@ d_m3BeginExternC
#define jumpOpDirect(PC) ((IM3Operation)(* PC))( PC + 1, d_m3OpArgs) #define jumpOpDirect(PC) ((IM3Operation)(* PC))( PC + 1, d_m3OpArgs)
# if d_m3EnableOpProfiling # if d_m3EnableOpProfiling
d_m3RetSig profileOp (d_m3OpSig, cstr_t i_operationName);
d_m3RetSig profileOp (d_m3OpSig, cstr_t i_operationName);
# define nextOp() return profileOp (d_m3OpAllArgs, __FUNCTION__) # define nextOp() return profileOp (d_m3OpAllArgs, __FUNCTION__)
# elif d_m3TraceExec # elif d_m3EnableOpTracing
d_m3RetSig debugOp (d_m3OpSig, cstr_t i_operationName);
d_m3RetSig debugOp (d_m3OpSig, cstr_t i_operationName);
# define nextOp() return debugOp (d_m3OpAllArgs, __FUNCTION__) # define nextOp() return debugOp (d_m3OpAllArgs, __FUNCTION__)
# else # else
# define nextOp() return nextOpDirect() # define nextOp() return nextOpDirect()
@ -913,7 +909,7 @@ d_m3Store_i (i64, i64)
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
// debug/profiling // debug/profiling
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
#if d_m3TraceExec #if d_m3EnableOpTracing
d_m3RetSig debugOp (d_m3OpSig, cstr_t i_opcode) d_m3RetSig debugOp (d_m3OpSig, cstr_t i_opcode)
{ {
char name [100]; char name [100];
@ -928,12 +924,11 @@ d_m3RetSig debugOp (d_m3OpSig, cstr_t i_opcode)
} }
# endif # endif
# if d_m3RuntimeStackDumps # if d_m3EnableOpTracing
d_m3OpDecl (DumpStack) d_m3OpDecl (DumpStack)
# endif # endif
# if d_m3EnableOpProfiling # if d_m3EnableOpProfiling
static const u32 c_m3ProfilerSlotMask = 0xFFFF;
typedef struct M3ProfilerSlot typedef struct M3ProfilerSlot
{ {

@ -412,7 +412,7 @@ void log_opcode (IM3Compilation o, u8 i_opcode)
void emit_stack_dump (IM3Compilation o) void emit_stack_dump (IM3Compilation o)
{ {
# if d_m3RuntimeStackDumps # if d_m3EnableOpTracing
if (o->numEmits) if (o->numEmits)
{ {
EmitOp (o, op_DumpStack); EmitOp (o, op_DumpStack);

Loading…
Cancel
Save