stack trace option

extensions
Steven Massey 5 years ago
parent 9b0b3dcdfa
commit 283cda22ee

@ -145,6 +145,10 @@ extern const M3OpInfo c_operations [];
//-----------------------------------------------------------------------------------------------------------------------------------
bool IsRegisterAllocated (IM3Compilation o, u32 i_register);
bool IsRegisterLocation (i16 i_location);
bool IsFpRegisterLocation (i16 i_location);
bool IsIntRegisterLocation (i16 i_location);
M3Result EmitOp (IM3Compilation o, IM3Operation i_operation);
void EmitConstant (IM3Compilation o, const u64 immediate);

@ -204,7 +204,7 @@ typedef struct M3Runtime
IM3Environment environment;
M3CodePage * pagesOpen; // linked list of code pages with writable space on them
M3CodePage * pagesFull; // linked list of finalized pages
M3CodePage * pagesFull; // linked list of at-capacity pages
u32 numCodePages;
u32 numActiveCodePages;
@ -220,6 +220,8 @@ typedef struct M3Runtime
M3Memory memory;
M3ErrorInfo error;
}
M3Runtime;

@ -177,11 +177,7 @@ d_m3OpDef (Compile)
d_m3OpDef (Entry)
{
M3MemoryHeader * header = (M3MemoryHeader *) _mem - 1;
size_t offset = (u8*) header->maxStack - (u8*) _sp;
// printf ("%ld\n", offset);
if ((void *) _sp <= header->maxStack)
{
IM3Function function = immediate (IM3Function);
@ -207,14 +203,15 @@ d_m3OpDef (Entry)
m3log (exec, " exit < %s %s %s %s", function->name, returnType ? "->" : "", str, r ? r : "");
# endif
# if d_m3LogStackTrace
if (r)
printf (" ** %s %p\n", function->name, _sp);
# endif
return r;
}
else
{
// printf ("stk: %ld %p %p\n", offset, _sp, header->maxStack);
return c_m3Err_trapStackOverflow;
}
else return c_m3Err_trapStackOverflow;
}
@ -388,7 +385,7 @@ d_m3OpDef (BranchTable)
{
i32 branchIndex = slot (i32); // branch index is always in a slot
u32 numTargets = immediate (u32);
i32 numTargets = immediate (i32);
pc_t * branches = (pc_t *) _pc;

@ -396,13 +396,7 @@ void log_opcode (IM3Compilation o, u8 i_opcode)
# else
m3log (compile, "%4d | 0x%02x %s", o->numOpcodes++, i_opcode, GetOpcodeIndentionString (o));
# endif
if (o->numOpcodes == 1198)
{
if (strncmp (o->function->name, "rad", 3) == 0)
printf ("hmmm...\n");
}
if (i_opcode == c_waOp_end or i_opcode == c_waOp_else)
o->block.depth++;
}

Loading…
Cancel
Save