Enable AoT and wamr-sdk, and change arguments of call wasm API (#157)
* Implement memory profiler, optimize memory usage, modify code indent * Implement memory.grow and limit heap space base offset to 1G; modify iwasm build type to Release and 64 bit by default * Add a new extension library: connection * Fix bug of reading magic number and version in big endian platform * Re-org platform APIs: move most platform APIs from iwasm to shared-lib * Enhance wasm loader to fix some security issues * Fix issue about illegal load of EXC_RETURN into PC on stm32 board * Updates that let a restricted version of the interpreter run in SGX * Enable native/app address validation and conversion for wasm app * Remove wasm_application_exectue_* APIs from wasm_export.h which makes confused * Refine binary size and fix several minor issues Optimize interpreter LOAD/STORE opcodes to decrease the binary size Fix issues when using iwasm library: _bh_log undefined, bh_memory.h not found Remove unused _stdin/_stdout/_stderr global variables resolve in libc wrapper Add macros of global heap size, stack size, heap size for Zephyr main.c Clear compile warning of wasm_application.c * Add more strict security checks for libc wrapper API's * Use one libc wrapper copy for sgx and other platforms; remove bh_printf macro for other platform header files * Enhance security of libc strcpy/sprintf wrapper function * Fix issue of call native for x86_64/arm/mips, add module inst parameter for native wrapper functions * Remove get_module_inst() and fix issue of call native * Refine wgl lib: remove module_inst parameter from widget functions; move function index check to runtime instantiate * Refine interpreter call native process, refine memory boudary check * Fix issues of invokeNative function of arm/mips/general version * Add a switch to build simple sample without gui support * Add BUILD_TARGET setting in makefile to replace cpu compiler flags in source code * Re-org shared lib header files, remove unused info; fix compile issues of vxworks * Add build target general * Remove unused files * Update license header * test push * Restore file * Sync up with internal/feature * Sync up with internal/feature * Rename build_wamr_app to build_wasm_app * Fix small issues of README * Enhance malformed wasm file checking Fix issue of print hex int and implement utf8 string check Fix wasi file read/write right issue Fix minor issue of build wasm app doc * Sync up with internal/feature * Sync up with internal/feature: fix interpreter arm issue, fix read leb issue * Sync up with internal/feature * Fix bug of config.h and rename wasi config.h to ssp_config.h * Sync up with internal/feature * Import wamr aot * update document * update document * Update document, disable WASI in 32bit * update document * remove files * update document * Update document * update document * update document * update samples * Sync up with internal repo
This commit is contained in:
@ -4,7 +4,7 @@
|
||||
*/
|
||||
|
||||
#include "host_tool_utils.h"
|
||||
#include "shared_utils.h"
|
||||
#include "bi-inc/shared_utils.h"
|
||||
|
||||
#include <time.h>
|
||||
#include <sys/stat.h>
|
||||
|
||||
@ -10,7 +10,7 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include "attr_container.h"
|
||||
#include "bi-inc/attr_container.h"
|
||||
#include "cJSON.h"
|
||||
|
||||
/**
|
||||
|
||||
@ -12,8 +12,8 @@
|
||||
#include <unistd.h>
|
||||
|
||||
#include "host_tool_utils.h"
|
||||
#include "shared_utils.h"
|
||||
#include "attr_container.h"
|
||||
#include "bi-inc/shared_utils.h"
|
||||
#include "bi-inc/attr_container.h"
|
||||
#include "coap_ext.h"
|
||||
#include "cJSON.h"
|
||||
#include "app_manager_export.h" /* for Module_WASM_App */
|
||||
@ -99,14 +99,10 @@ extern int g_mid;
|
||||
extern unsigned char leading[2];
|
||||
|
||||
/* -1 fail, 0 success */
|
||||
static int send_request(request_t *request, bool is_install_wasm_bytecode_app)
|
||||
static int send_request(request_t *request, uint16_t msg_type)
|
||||
{
|
||||
char *req_p;
|
||||
int req_size, req_size_n, ret = -1;
|
||||
uint16_t msg_type = REQUEST_PACKET;
|
||||
|
||||
if (is_install_wasm_bytecode_app)
|
||||
msg_type = INSTALL_WASM_BYTECODE_APP;
|
||||
|
||||
if ((req_p = pack_request(request, &req_size)) == NULL)
|
||||
return -1;
|
||||
@ -137,6 +133,7 @@ static int send_request(request_t *request, bool is_install_wasm_bytecode_app)
|
||||
return ret;
|
||||
}
|
||||
|
||||
/*
|
||||
static package_type_t get_app_package_type(const char *buf, int size)
|
||||
{
|
||||
if (buf && size > 4) {
|
||||
@ -147,6 +144,7 @@ static package_type_t get_app_package_type(const char *buf, int size)
|
||||
}
|
||||
return Package_Type_Unknown;
|
||||
}
|
||||
*/
|
||||
|
||||
#define url_remain_space (sizeof(url) - strlen(url))
|
||||
|
||||
@ -159,7 +157,6 @@ static int install(inst_info *info)
|
||||
char *app_file_buf;
|
||||
char url[URL_MAX_LEN] = { 0 };
|
||||
int ret = -1, app_size;
|
||||
bool is_wasm_bytecode_app;
|
||||
|
||||
snprintf(url, sizeof(url) - 1, "/applet?name=%s", info->name);
|
||||
|
||||
@ -188,13 +185,10 @@ static int install(inst_info *info)
|
||||
FMT_APP_RAW_BINARY, app_file_buf, app_size);
|
||||
request->mid = gen_random_id();
|
||||
|
||||
if ((info->module_type == NULL || strcmp(info->module_type, "wasm") == 0)
|
||||
&& get_app_package_type(app_file_buf, app_size) == Wasm_Module_Bytecode)
|
||||
is_wasm_bytecode_app = true;
|
||||
if (info->module_type == NULL || strcmp(info->module_type, "wasm") == 0)
|
||||
ret = send_request(request, INSTALL_WASM_APP);
|
||||
else
|
||||
is_wasm_bytecode_app = false;
|
||||
|
||||
ret = send_request(request, is_wasm_bytecode_app);
|
||||
ret = send_request(request, REQUEST_PACKET);
|
||||
|
||||
free(app_file_buf);
|
||||
|
||||
@ -217,7 +211,7 @@ static int uninstall(uninst_info *info)
|
||||
NULL, 0);
|
||||
request->mid = gen_random_id();
|
||||
|
||||
return send_request(request, false);
|
||||
return send_request(request, REQUEST_PACKET);
|
||||
}
|
||||
|
||||
static int query(query_info *info)
|
||||
@ -236,7 +230,7 @@ static int query(query_info *info)
|
||||
NULL, 0);
|
||||
request->mid = gen_random_id();
|
||||
|
||||
ret = send_request(request, false);
|
||||
ret = send_request(request, REQUEST_PACKET);
|
||||
|
||||
return ret;
|
||||
}
|
||||
@ -276,7 +270,7 @@ static int request(req_info *info)
|
||||
FMT_ATTR_CONTAINER, payload, payload_len);
|
||||
request->mid = gen_random_id();
|
||||
|
||||
ret = send_request(request, false);
|
||||
ret = send_request(request, REQUEST_PACKET);
|
||||
|
||||
if (info->json_payload_file != NULL && payload != NULL)
|
||||
attr_container_destroy(payload);
|
||||
@ -317,7 +311,7 @@ static int subscribe(reg_info *info)
|
||||
FMT_ATTR_CONTAINER,
|
||||
NULL, 0);
|
||||
request->mid = gen_random_id();
|
||||
ret = send_request(request, false);
|
||||
ret = send_request(request, REQUEST_PACKET);
|
||||
#endif
|
||||
return ret;
|
||||
}
|
||||
@ -350,7 +344,7 @@ static int unsubscribe(unreg_info *info)
|
||||
FMT_ATTR_CONTAINER,
|
||||
NULL, 0);
|
||||
request->mid = gen_random_id();
|
||||
ret = send_request(request, false);
|
||||
ret = send_request(request, REQUEST_PACKET);
|
||||
#endif
|
||||
return ret;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user