Convert constants to defines, so it actually compiles 😁

extensions
Volodymyr Shymanskyy 5 years ago
parent 2e6a77d34b
commit ef59f8b2bf

@ -79,13 +79,12 @@ void log_opcode (IM3Compilation o, u8 i_opcode)
//-------------------------------------------------------------------------------------------------------------------------
// just want less letter and numbers to stare at down the way in the compiler table
const u8 i_32 = c_m3Type_i32,
i_64 = c_m3Type_i64,
f_32 = c_m3Type_f32,
f_64 = c_m3Type_f64,
none = c_m3Type_none,
any = -1
;
#define i_32 c_m3Type_i32
#define i_64 c_m3Type_i64
#define f_32 c_m3Type_f32
#define f_64 c_m3Type_f64
#define none c_m3Type_none
#define any (u8)-1
bool IsRegisterLocation (i16 i_location) { return (i_location >= c_m3Reg0Id); }

@ -171,28 +171,27 @@ typedef struct M3CodePageInfo
M3CodePageHeader;
static const u32 c_m3CodePageFreeLinesThreshold = 10;
#define c_m3CodePageFreeLinesThreshold 10
static const u32 c_m3MemPageSize = 65536;
static const u32 c_m3MaxFunctionStackHeight = d_m3MaxFunctionStackHeight;
static const u32 c_m3MaxFunctionLocals = 512;
#define c_m3MemPageSize 65536
#define c_m3MaxFunctionStackHeight d_m3MaxFunctionStackHeight
#define c_m3MaxFunctionLocals 512
static const u32 c_m3Reg0Id = c_m3MaxFunctionStackHeight + 1;
static const u32 c_m3Fp0Id = c_m3MaxFunctionStackHeight + 2;
#define c_m3Reg0Id c_m3MaxFunctionStackHeight + 1
#define c_m3Fp0Id c_m3MaxFunctionStackHeight + 2
static const u32 c_m3MaxNumFunctionConstants = 60;
#define c_m3MaxNumFunctionConstants 60
static const bool c_m3AlignWasmMemoryToPages = d_m3AlignWasmMemoryToPages;
#define c_m3AlignWasmMemoryToPages d_m3AlignWasmMemoryToPages
//static const u32 c_m3MaxSaneWasmSize = 1000000000;
static const u32 c_m3MaxSaneUtf8Length = 2000;
static const u32 c_m3MaxNumFunctionArgs = d_m3MaxNumFunctionArgs;
//#define c_m3MaxSaneWasmSize 1000000000
#define c_m3MaxSaneUtf8Length 2000
#define c_m3MaxNumFunctionArgs d_m3MaxNumFunctionArgs
static const u8 c_externalKind_function = 0,
c_externalKind_table = 1,
c_externalKind_memory = 2,
c_externalKind_global = 3
;
#define c_externalKind_function 0
#define c_externalKind_table 1
#define c_externalKind_memory 2
#define c_externalKind_global 3
static const char * const c_waTypes [] = { "nil", "i32", "i64", "f32", "f64", "void", "void *" };

@ -40,8 +40,9 @@ typedef i64 arch_i;
//---------------------------------------------------------------------------------------------------------------
static const i64 c_m3NumIntRegisters = 1;
static const i64 c_m3NumFpRegisters = 1;
#define c_m3NumIntRegisters 1
#define c_m3NumFpRegisters 1
#define c_m3NumRegisters (c_m3NumIntRegisters + c_m3NumFpRegisters)
# define d_m3OpSig pc_t _pc, u64 * _sp, u8 * _mem, m3reg_t _r0, f64 _fp0
# define d_m3OpArgs _sp, _mem, _r0, _fp0
@ -49,8 +50,6 @@ static const i64 c_m3NumFpRegisters = 1;
# define d_m3OpDefaultArgs 666, NAN
static const i64 c_m3NumRegisters = c_m3NumIntRegisters + c_m3NumFpRegisters;
typedef m3ret_t (vectorcall * IM3Operation) (d_m3OpSig);

@ -92,11 +92,10 @@ size_t SPrintArg (char * o_string, size_t i_n, m3stack_t i_sp, u8 i_type)
ccstr_t SPrintFunctionArgList (IM3Function i_function, m3stack_t i_sp)
{
const u32 bufferSize = 1000;
static char string [bufferSize];
static char string [256];
char * s = string;
ccstr_t e = string + bufferSize - 1;
ccstr_t e = string + sizeof(string) - 1;
s += max (0, snprintf (s, e-s, "("));

Loading…
Cancel
Save