opam-2.0.0
Vova 3 years ago
parent b474e8ee34
commit a0548538f1

@ -12,7 +12,7 @@ preprocess: preprocess_restore
cp ./source/m3_exec.h ./source/m3_exec.h.bak
cp ./source/m3_compile.c ./source/m3_compile.c.bak
awk 'BEGIN {RS=""}{gsub(/\\\n/,"\\\n__NL__ ")}1' ./source/m3_exec.h | sponge ./source/m3_exec.h
cpp -P ./source/m3_compile.c | sponge ./source/m3_compile.c
cpp -I./source -P ./source/m3_compile.c | sponge ./source/m3_compile.c
awk '{gsub(/__NL__/,"\n")}1' ./source/m3_compile.c | sponge ./source/m3_compile.c
mv ./source/m3_exec.h.bak ./source/m3_exec.h

@ -322,7 +322,7 @@ d_m3ErrorConst (trapStackOverflow, "[trap] stack overflow")
# define m3ApiGetArgMem(TYPE, NAME) TYPE NAME = (TYPE)m3ApiOffsetToPtr(* ((uint32_t *) (_sp++)));
# define m3ApiIsNullPtr(addr) ((void*)(addr) <= _mem)
# define m3ApiCheckMem(addr, len) { if (UNLIKELY(m3ApiIsNullPtr(addr) || ((uint64_t)(addr) + (len)) > ((uint64_t)(_mem)+m3_GetMemorySize(runtime)))) m3ApiTrap(m3Err_trapOutOfBoundsMemoryAccess); }
# define m3ApiCheckMem(addr, len) { if (M3_UNLIKELY(m3ApiIsNullPtr(addr) || ((uint64_t)(addr) + (len)) > ((uint64_t)(_mem)+m3_GetMemorySize(runtime)))) m3ApiTrap(m3Err_trapOutOfBoundsMemoryAccess); }
# define m3ApiRawFunction(NAME) const void * NAME (IM3Runtime runtime, IM3ImportContext _ctx, uint64_t * _sp, void * _mem)
# define m3ApiReturn(VALUE) { *raw_return = (VALUE); return m3Err_none; }

@ -257,4 +257,17 @@
# endif
# endif
/*
* Other
*/
# if defined(M3_COMPILER_GCC) || defined(M3_COMPILER_CLANG) || defined(M3_COMPILER_ICC)
# define M3_UNLIKELY(x) __builtin_expect(!!(x), 0)
# define M3_LIKELY(x) __builtin_expect(!!(x), 1)
# else
# define M3_UNLIKELY(x) (x)
# define M3_LIKELY(x) (x)
# endif
#endif // wasm3_defs_h

Loading…
Cancel
Save