diff --git a/targets/lib.h b/targets/lib.h index 208a9a2..2a2f7ed 100644 --- a/targets/lib.h +++ b/targets/lib.h @@ -40,6 +40,7 @@ #ifdef TARGET_LINUX #include "stdio.h" +#include #define MAIN int main(int argc, char *argv[]) #define PRINT(fmt, ...) fprintf(stdout, fmt, ##__VA_ARGS__) #define PRINT_ERROR(fmt, ...) \ diff --git a/targets/wasm-host/wasm_host.c b/targets/wasm-host/wasm_host.c index 5c98121..17444d9 100644 --- a/targets/wasm-host/wasm_host.c +++ b/targets/wasm-host/wasm_host.c @@ -3,10 +3,6 @@ #include "bh_platform.h" #include "__WASM_ARRAY_FILE__" -#ifdef TARGET_LINUX -#include -#include -#endif // FAIL* instrumentation symbols void fail_start_trace(void) {} @@ -38,12 +34,12 @@ void host_print(wasm_exec_env_t exec_env, const char *msg) { // Another bump allocator #define WASM_LINEAR_MEMORY_SIZE (64 * 1024) // Need to match --initial-memory? -#define RUNTIME_POOL_SIZE (2 * 1024 * 1024) -#define LINEAR_POOL_SIZE (WASM_LINEAR_MEMORY_SIZE + 512 * 1024) +#define RUNTIME_POOL_SIZE (2 * 1024 * 1024) +#define LINEAR_POOL_SIZE (WASM_LINEAR_MEMORY_SIZE + 512 * 1024) #define ALIGNMENT 8 typedef struct { - char *buf; + char *buf; size_t size; size_t offset; } BumpPool; @@ -60,13 +56,11 @@ static char linear_pool_buf[LINEAR_POOL_SIZE]; // mem_alloc_usage_t: 0 = Alloc_For_Runtime, 1 = Alloc_For_LinearMemory static BumpPool pools[] = { - { runtime_pool_buf, RUNTIME_POOL_SIZE, 0 }, - { linear_pool_buf, LINEAR_POOL_SIZE, 0 }, + {runtime_pool_buf, RUNTIME_POOL_SIZE, 0}, + {linear_pool_buf, LINEAR_POOL_SIZE, 0}, }; -static size_t align_up(size_t x, size_t a) { - return (x + a - 1) & ~(a - 1); -} +static size_t align_up(size_t x, size_t a) { return (x + a - 1) & ~(a - 1); } static size_t alloc_size(void *ptr) { size_t header_size = align_up(sizeof(size_t), ALIGNMENT);