Fix app manager install atomics app issue and optimize workload scripts (#458)

This commit is contained in:
Wenyong Huang
2020-12-04 15:35:45 +08:00
committed by GitHub
parent c8b0a1cee1
commit 2f530e67fc
13 changed files with 206 additions and 26 deletions

View File

@ -45,4 +45,18 @@ uint16 ntohs(uint16 value);
// We are not worried for the WASM world since the sandbox will catch it.
#define bh_memcpy_s(dst, dst_len, src, src_len) memcpy(dst, src, src_len)
#ifdef NDEBUG
#define bh_assert(v) (void)0
#else
#define bh_assert(v) do { \
if (!(v)) { \
int _count; \
printf("ASSERTION FAILED: %s, at %s, line %d",\
#v, __FILE__, __LINE__); \
_count = printf("\n"); \
printf("%d\n", _count / (_count - 1)); \
} \
} while (0)
#endif
#endif /* DEPS_IWASM_APP_LIBS_BASE_BH_PLATFORM_H_ */

View File

@ -703,7 +703,11 @@ wasm_app_module_install(request_t * msg)
SECTION_TYPE_GLOBAL,
SECTION_TYPE_EXPORT,
SECTION_TYPE_START,
SECTION_TYPE_ELEM
SECTION_TYPE_ELEM,
#if WASM_ENABLE_BULK_MEMORY != 0
SECTION_TYPE_DATACOUNT
#endif
};
/* Sections to be released after instantiating */
uint8 sections2[] = { SECTION_TYPE_DATA };
@ -1174,7 +1178,12 @@ wasm_app_module_on_install_request_byte_arrive(uint8 ch,
}
else if (recv_ctx.phase == Phase_Wasm_Section_Type) {
uint8 section_type = ch;
if (section_type <= SECTION_TYPE_DATA) {
#if WASM_ENABLE_BULK_MEMORY == 0
uint8 section_type_max = SECTION_TYPE_DATA;
#else
uint8 section_type_max = SECTION_TYPE_DATACOUNT;
#endif
if (section_type <= section_type_max) {
wasm_section_t *new_section;
if (!(new_section = (wasm_section_t *) APP_MGR_MALLOC(sizeof(wasm_section_t)))) {
app_manager_printf("Allocate memory failed!\n");

View File

@ -8,13 +8,9 @@
#define bh_assert(v) do { \
if (!(v)) { \
int _count; \
printf("\nASSERTION FAILED: %s, at %s, line %d\n", \
#v, __FILE__, __LINE__); \
_count = printf(" "); \
/* divived by 0 to make it abort */ \
printf("%d\n", _count / (_count - 1)); \
while (1); \
abort(); \
} \
} while (0)