extensions
Steven Massey 3 years ago
parent 0dbc617a23
commit 2c1a2af2c8

@ -112,7 +112,7 @@ i16 GetStackTopIndex (IM3Compilation o)
u16 GetStackHeight (IM3Compilation o)
{
return o->stackIndex - o->stackFirstDynamicIndex;
return o->stackIndex - o->stackFirstDynamicIndex;
}
u8 GetStackTopTypeAtOffset (IM3Compilation o, u16 i_offset)
@ -1243,8 +1243,10 @@ _ ((i_opcode == 0x23) ? Compile_GetGlobal (o, global) : Compile_SetGlo
M3Result EmitPatchingBranch (IM3Compilation o, IM3CompilationScope i_scope)
{
M3Result result;
M3Result result ;
_try {
_ (EmitOp (o, op_Branch));
// IM3BranchPatch is two word struct; reserve two words
@ -1253,7 +1255,7 @@ _ (EmitOp (o, op_Branch));
patch->next = i_scope->patches;
i_scope->patches = patch;
_catch:
} _catch:
return result;
}

@ -240,7 +240,7 @@ M3Result ReadLEB_i32 (i32 * o_value, bytes_t * io_bytes, cbytes_t
M3Result ReadLEB_i64 (i64 * o_value, bytes_t * io_bytes, cbytes_t i_end);
M3Result Read_utf8 (cstr_t * o_utf8, bytes_t * io_bytes, cbytes_t i_end);
cstr_t SPrintValue (void * i_value, u8 i_type);
cstr_t SPrintValue (void * i_value, u8 i_type);
size_t SPrintArg (char * o_string, size_t i_stringBufferSize, m3stack_t i_sp, u8 i_type);
void ReportError (IM3Runtime io_runtime, IM3Module i_module, IM3Function i_function, ccstr_t i_errorMessage, ccstr_t i_file, u32 i_lineNum);

@ -291,8 +291,8 @@ M3Result EvaluateExpression (IM3Module i_module, void * o_expressed, u8 i_type
m3ret_t r = Call (m3code, stack, NULL, d_m3OpDefaultArgs);
if (r == 0)
{ m3log (runtime, "expression result: %s", SPrintValue (stack, i_type));
if (SizeOfType (i_type) == sizeof (u32))
{ m3log (runtime, "expression result: %s", SPrintValue (stack, i_type));
if (SizeOfType (i_type) == sizeof (u32))
{
* (u32 *) o_expressed = * ((u32 *) stack);
}

@ -16,8 +16,8 @@
// a central function you can be breakpoint:
void ExceptionBreakpoint (cstr_t i_exception, cstr_t i_message)
{
printf ("\nexception: '%s' @ %s\n", i_exception, i_message);
return;
printf ("\nexception: '%s' @ %s\n", i_exception, i_message);
return;
}
@ -122,9 +122,9 @@ size_t SPrintArg (char * o_string, size_t i_stringBufferSize, m3stack_t i_sp,
cstr_t SPrintValue (void * i_value, u8 i_type)
{
static char string [100];
SPrintArg (string, 100, (m3stack_t) i_value, i_type);
return string;
static char string [100];
SPrintArg (string, 100, (m3stack_t) i_value, i_type);
return string;
}

@ -36,7 +36,7 @@ void m3_FreeModule (IM3Module i_module)
for (u32 i = 0; i < i_module->numGlobals; ++i)
{
m3_Free (i_module->globals[i].name);
m3_Free (i_module->globals[i].name);
}
for (u32 i = 0; i < i_module->numGlobals; ++i)
{

@ -412,7 +412,7 @@ _ (ReadLEB_u32 (& segment->size, & i_bytes, i_end));
i, segment->memoryRegion, segment->initExprSize, segment->size);
i_bytes += segment->size;
_throwif("data segment underflow", i_bytes > i_end);
_throwif("data segment underflow", i_bytes > i_end);
}
_catch:

Loading…
Cancel
Save