Allocate linear memory on regular (non-microchip) builds

extensions
Volodymyr Shymanskyy 5 years ago
parent 2f1d485d9f
commit 37877ab810

@ -65,6 +65,7 @@ include_directories("./source/")
#-fno-optimize-sibling-calls
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Dd_m3AllocateLinearMemory=1")
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -DDEBUG=1")
if(EMSCRIPTEN)

@ -1,6 +1,7 @@
cmake_minimum_required(VERSION 3.4.1)
add_definitions(-DANDROID -Wno-format-security -O3
-Dd_m3AllocateLinearMemory=1
#-fno-optimize-sibling-calls
-fstrict-aliasing -flto -fno-fat-lto-objects)

@ -42,6 +42,13 @@
//# define d_m3FixedHeap (32*1024)
# endif
// TODO: This flag is temporary
// It's enabled by default for Linux, OS X, Win32 and Android builds
// and disabled on other platforms, i.e. microcontrollers
# ifndef d_m3AllocateLinearMemory
# define d_m3AllocateLinearMemory false
# endif
# ifndef d_m3FixedHeapAlign
# define d_m3FixedHeapAlign 16
# endif

@ -398,7 +398,9 @@ M3Result m3_CallWithArgs (IM3Function i_function, uint32_t i_argc, const char
IM3FuncType ftype = i_function->funcType;
//_ (Module_EnsureMemorySize (module, & i_function->module->memory, 3000000));
#if d_m3AllocateLinearMemory
_ (Module_EnsureMemorySize (module, & i_function->module->memory, 3000000));
#endif
u8 * linearMemory = module->memory.wasmPages;
@ -483,7 +485,9 @@ M3Result m3_CallMain (IM3Function i_function, uint32_t i_argc, const char * co
IM3Runtime env = module->runtime;
#if d_m3AllocateLinearMemory
_ (Module_EnsureMemorySize (module, & i_function->module->memory, 3000000));
#endif
u8 * linearMemory = module->memory.wasmPages;

Loading…
Cancel
Save