extensions
Steven Massey 5 years ago
parent 215e13d331
commit 89444fee9b

@ -154,9 +154,7 @@ typedef int64_t (* M3Callback) (IM3Function i_currentFunction, void * i_ref);
d_m3AlignWasmMemoryToPages false The WebAssembly spec defines a 64kB page size and memory size is always
quantized to pages. In a non-Javascript centric WA host this seems
unnecessary.
d_m3CodePageSize 4096 WebAssembly is compiled to M3 code pages of this size.
*/
*/
//--------------------------------------------------------------------------------------------------------------------------------------------

@ -1041,7 +1041,7 @@ M3Result ReadBlockType (IM3Compilation o, u8 * o_blockType)
}
M3Result Compile_Loop_Block (IM3Compilation o, u8 i_opcode)
M3Result Compile_LoopOrBlock (IM3Compilation o, u8 i_opcode)
{
M3Result result;
@ -1244,8 +1244,8 @@ const M3OpInfo c_operations [] =
{
{ "unreachable", 0, none, NULL, NULL, NULL, Compile_Trap }, // 0x00
{ "nop", 0, none, NULL, NULL, NULL, Compile_Nop }, // 0x01 .
{ "block", 0, none, NULL, NULL, NULL, Compile_Loop_Block }, // 0x02
{ "loop", 0, none, NULL, NULL, NULL, Compile_Loop_Block }, // 0x03
{ "block", 0, none, NULL, NULL, NULL, Compile_LoopOrBlock }, // 0x02
{ "loop", 0, none, NULL, NULL, NULL, Compile_LoopOrBlock }, // 0x03
{ "if", -1, none, NULL, NULL, NULL, Compile_If }, // 0x04
{ "else", 0, none, NULL, NULL, NULL, Compile_Else_End }, // 0x05
@ -1280,10 +1280,10 @@ const M3OpInfo c_operations [] =
{ "f32.load", 0, f_32, NULL, NULL, NULL}, // 0x2a
{ "f64.load", 0, f_64, NULL, NULL, NULL}, // 0x2b
{ "i32.load8_s", 0, i_32, op_i32_Load_i8_r, op_i32_Load_i8_s, NULL, Compile_Load_Store }, // 0x2c
{ "i32.load8_u", 0, i_32, op_i32_Load_u8_r, op_i32_Load_u8_s, NULL, Compile_Load_Store }, // 0x2d
{ "i32.load16_s", 0, i_32, NULL, NULL, NULL, Compile_Load_Store }, // 0x2e
{ "i32.load16_u", 0, i_32, op_i32_Load_u16_r, op_i32_Load_u16_s, NULL, Compile_Load_Store }, // 0x2f
{ "i32.load8_s", 0, i_32, op_i32_Load_i8_r, op_i32_Load_i8_s, NULL, Compile_Load_Store }, // 0x2c
{ "i32.load8_u", 0, i_32, op_i32_Load_u8_r, op_i32_Load_u8_s, NULL, Compile_Load_Store }, // 0x2d
{ "i32.load16_s", 0, i_32, op_i32_Load_i16_r, op_i32_Load_i16_s, NULL, Compile_Load_Store }, // 0x2e
{ "i32.load16_u", 0, i_32, op_i32_Load_u16_r, op_i32_Load_u16_s, NULL, Compile_Load_Store }, // 0x2f
{ "i64.load8_s", 0, i_64, NULL, NULL, NULL, }, // 0x30
{ "i64.load8_u", 0, i_64, NULL, NULL, NULL }, // 0x31

@ -59,15 +59,6 @@ const void * const cvptr_t;
# endif
typedef struct M3MemoryHeader
{
IM3Module module;
void * end;
}
M3MemoryHeader;
static const char * m3LogTruncFilename (const char * i_file)
{
const char * file = i_file + strlen (i_file);
@ -161,6 +152,15 @@ static const char * m3LogTruncFilename (const char * i_file)
typedef void /*const*/ * code_t;
typedef code_t const * /*__restrict__*/ pc_t;
typedef struct M3MemoryHeader
{
IM3Module module;
void * end;
}
M3MemoryHeader;
typedef struct M3CodePageInfo
{
struct M3CodePage * next;
@ -173,7 +173,7 @@ typedef struct M3CodePageInfo
M3CodePageHeader;
static const u32 c_m3CodePageFreeLinesThreshold = 10;
static const u32 c_m3CodePageFreeLinesThreshold = 10;
static const u32 c_m3MemPageSize = 65536;
static const u32 c_m3MaxFunctionStackHeight = d_m3MaxFunctionStackHeight;

@ -9,6 +9,10 @@
#ifndef m3_exec_h
#define m3_exec_h
// TODO: all these functions could move over to the .c at some point. normally, i'd say screw it,
// but it might prove useful to be able to compile m3_exec alone w/ optimizations while the remaining
// code is at debug O0
#include "m3_exec_defs.h"
#include <math.h>
@ -822,11 +826,11 @@ d_m3Op (SRC_TYPE##_Store_##SIZE_TYPE##_rs) \
} \
d_m3Op (SRC_TYPE##_Store_##SIZE_TYPE##_ss) \
{ \
i32 slot = immediate (i32); \
i32 slot = immediate (i32); \
SRC_TYPE value = * (SRC_TYPE *) (_sp + slot); \
\
u32 operand = * (u32 *) (_sp + immediate (i32)); \
u32 offset = immediate (u32); \
u32 operand = * (u32 *) (_sp + immediate (i32)); \
u32 offset = immediate (u32); \
operand += offset; \
\
u8 * end = * ((u8 **) _mem - 1); \

@ -29,6 +29,8 @@ _ (ReadLEB_u32 (& numTypes, & i_bytes, i_end)); m3log (parse, "** Type [%d
if (numTypes)
{
// FIX: these need to be instead added to a set in the runtime struct to facilitate IndirectCall
_ (m3Alloc (& io_module->funcTypes, M3FuncType, numTypes));
io_module->numFuncTypes = numTypes;

Loading…
Cancel
Save