Fix some compilation warnings and add esp-idf platform for experiment (#454)

And fix some code indent issues.
This commit is contained in:
Wenyong Huang
2020-11-30 16:03:51 +08:00
committed by GitHub
parent 7d8b79a7a7
commit 282831eba5
35 changed files with 342 additions and 363 deletions

View File

@ -1663,6 +1663,10 @@ load_from_sections(AOTModule *module, AOTSection *sections,
error_buf, error_buf_size))
return false;
break;
default:
set_error_buf(error_buf, error_buf_size,
"invalid aot section type");
return false;
}
section = section->next;

View File

@ -36,8 +36,8 @@ typedef struct {
REG_SYM(aot_call_indirect), \
REG_SYM(wasm_runtime_enlarge_memory), \
REG_SYM(wasm_runtime_set_exception), \
REG_SYM(memset), \
REG_SYM(memmove), \
REG_SYM(aot_memset), \
REG_SYM(aot_memmove), \
REG_BULK_MEMORY_SYM() \
REG_ATOMIC_WAIT_SYM()
#else /* else of (defined(_WIN32) || defined(_WIN32_)) && defined(NDEBUG) */
@ -47,8 +47,8 @@ typedef struct {
REG_SYM(aot_call_indirect), \
REG_SYM(wasm_runtime_enlarge_memory), \
REG_SYM(wasm_runtime_set_exception), \
REG_SYM(memset), \
REG_SYM(memmove), \
REG_SYM(aot_memset), \
REG_SYM(aot_memmove), \
REG_SYM(fmin), \
REG_SYM(fminf), \
REG_SYM(fmax), \

View File

@ -1907,6 +1907,18 @@ aot_call_indirect(WASMExecEnv *exec_env,
}
}
void *
aot_memmove(void *dest, const void *src, size_t n)
{
return memmove(dest, src, n);
}
void *
aot_memset(void *s, int c, size_t n)
{
return memset(s, c, n);
}
#if WASM_ENABLE_BULK_MEMORY != 0
bool
aot_memory_init(AOTModuleInstance *module_inst, uint32 seg_index,

View File

@ -527,6 +527,12 @@ aot_call_indirect(WASMExecEnv *exec_env,
uint32
aot_get_plt_table_size();
void *
aot_memmove(void *dest, const void *src, size_t n);
void *
aot_memset(void *s, int c, size_t n);
#if WASM_ENABLE_BULK_MEMORY != 0
bool
aot_memory_init(AOTModuleInstance *module_inst, uint32 seg_index,

View File

@ -7,6 +7,8 @@
#include "bh_platform.h"
#include "mem_alloc.h"
#define BH_ENABLE_MEMORY_PROFILING 0
#if BH_ENABLE_MEMORY_PROFILING != 0
/* Memory profile data of a function */

View File

@ -8,7 +8,7 @@
#include "bh_log.h"
#if !defined(BH_PLATFORM_ZEPHYR) && !defined(BH_PLATFORM_ALIOS_THINGS) \
&& !defined(BH_PLATFORM_FREERTOS)
&& !defined(BH_PLATFORM_OPENRTOS) && !defined(BH_PLATFORM_ESP_IDF)
#define ENABLE_QUICKSORT 1
#else
#define ENABLE_QUICKSORT 0

View File

@ -6,7 +6,7 @@
#ifndef _AOT_EXPORT_H
#define _AOT_EXPORT_H
#include <inttypes.h>
#include <stdint.h>
#include <stdbool.h>

View File

@ -6393,6 +6393,9 @@ handle_op_block_and_loop:
}
#endif
break;
default:
bh_assert(0);
break;
}
ref_type = *(loader_ctx->frame_ref - 1);

View File

@ -399,6 +399,31 @@ sprintf_out(int c, struct str_context *ctx)
return c;
}
#ifdef BH_PLATFORM_OPENRTOS
PRIVILEGED_DATA static char print_buf[128] = { 0 };
PRIVILEGED_DATA static int print_buf_size = 0;
static int
printf_out(int c, struct str_context *ctx)
{
if (c == '\n') {
print_buf[print_buf_size] = '\0';
os_printf("%s\n", print_buf);
print_buf_size = 0;
}
else if (print_buf_size >= sizeof(print_buf) - 2) {
print_buf[print_buf_size++] = (char)c;
print_buf[print_buf_size] = '\0';
os_printf("%s\n", print_buf);
print_buf_size = 0;
}
else {
print_buf[print_buf_size++] = (char)c;
}
ctx->count++;
return c;
}
#else
static int
printf_out(int c, struct str_context *ctx)
{
@ -406,6 +431,7 @@ printf_out(int c, struct str_context *ctx)
ctx->count++;
return c;
}
#endif
static int
printf_wrapper(wasm_exec_env_t exec_env,