Merge pull request #906 from bytecodealliance/main

Merge main into dev/gc
This commit is contained in:
Wenyong Huang 2021-12-20 22:14:40 +08:00 committed by GitHub
commit 52f374ab8d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
40 changed files with 1197 additions and 524 deletions

View File

@ -6,10 +6,11 @@ WAMR project reused some components from other open source project:
- **contiki-ng**: for the coap protocol implementation
- **freebsd libm**: used in core/shared/platform/alios/bh_math.c
- **littlevgl**: for the gui samples and wrapped the wasm graphic layer
- **llvm**. for the AOT/JIT compilation
- **wasm-c-api**. to implement the C-APIs of wasm. using headers and sameples
- **llvm**: for the AOT/JIT compilation
- **wasm-c-api**: to implement the C-APIs of wasm. using headers and sameples
- **wasmtime**: for the wasi libc implementation
- **zephyr**. for several platform specific examples
- **zephyr**: for several platform specific examples
- **WebAssembly debugging patch for LLDB**: for extending the ability of LLDB to support wasm debugging
The WAMR fast interpreter is a clean room development. We would acknowledge the inspirations by [WASM3](https://github.com/wasm3/wasm3) open source project for the approach of pre-calculated oprand stack location.
@ -23,6 +24,7 @@ The WAMR fast interpreter is a clean room development. We would acknowledge the
| wasm-c-api | ac9b509f4df86e40e56e9b01f3f49afab0100037 | c9d31284651b975f05ac27cee0bab1377560b87e | https://github.com/WebAssembly/wasm-c-api | |
| wasmtime | unspecified | v0.26.0 | https://github.com/bytecodealliance/wasmtime | |
| zephyr | unspecified | v2.5.0 | https://www.zephyrproject.org/ | https://www.cvedetails.com/vendor/19255/Zephyrproject.html |
| WebAssembly debugging patch for LLDB | unspecified | unspecified | https://reviews.llvm.org/D78801 | |
## Licenses

View File

@ -11,6 +11,7 @@ import shlex
import shutil
import subprocess
import sys
import unittest
CLANG_FORMAT_CMD = "clang-format-12"
GIT_CLANG_FORMAT_CMD = "git-clang-format-12"
@ -155,7 +156,7 @@ def run_aspell(file_path: pathlib, root: pathlib) -> bool:
def check_dir_name(path: pathlib, root: pathlib) -> bool:
m = re.search(INVALID_DIR_NAME_SEGMENT, str(path.relative_to(root)))
m = re.search(INVALID_DIR_NAME_SEGMENT, str(path.relative_to(root).parent))
if m:
print(f"--- found a character '_' in {m.groups()} in {path}")
@ -271,5 +272,30 @@ def main() -> int:
return process_entire_pr(wamr_root, options.commits)
# run with python3 -m unitest ci/coding_guidelines_check.py
class TestCheck(unittest.TestCase):
def test_check_dir_name_failed(self):
root = pathlib.Path("/root/Workspace/")
new_file_path = root.joinpath("core/shared/platform/esp_idf/espid_memmap.c")
self.assertFalse(check_dir_name(new_file_path, root))
def test_check_dir_name_pass(self):
root = pathlib.Path("/root/Workspace/")
new_file_path = root.joinpath("core/shared/platform/esp-idf/espid_memmap.c")
self.assertTrue(check_dir_name(new_file_path, root))
def test_check_file_name_failed(self):
new_file_path = pathlib.Path(
"/root/Workspace/core/shared/platform/esp-idf/espid-memmap.c"
)
self.assertFalse(check_file_name(new_file_path))
def test_check_file_name_pass(self):
new_file_path = pathlib.Path(
"/root/Workspace/core/shared/platform/esp-idf/espid_memmap.c"
)
self.assertTrue(check_file_name(new_file_path))
if __name__ == "__main__":
sys.exit(0 if main() else 1)

View File

@ -61,6 +61,8 @@ static const aot_intrinsic g_intrinsic_mapping[] = {
{ "f64_promote_f32", "aot_intrinsic_f32_to_f64", AOT_INTRINSIC_FLAG_F32_TO_F64 },
{ "f32_cmp", "aot_intrinsic_f32_cmp", AOT_INTRINSIC_FLAG_F32_CMP },
{ "f64_cmp", "aot_intrinsic_f64_cmp", AOT_INTRINSIC_FLAG_F64_CMP },
{ "f32.const", NULL, AOT_INTRINSIC_FLAG_F32_CONST},
{ "f64.const", NULL, AOT_INTRINSIC_FLAG_F64_CONST},
};
/* clang-format on */
@ -617,6 +619,13 @@ aot_intrinsic_fill_capability_flags(AOTCompContext *comp_ctx)
add_f64_common_intrinsics(comp_ctx);
add_common_float_integer_convertion(comp_ctx);
}
else {
/*
* Use constant value table by default
*/
add_intrinsic_capability(comp_ctx, AOT_INTRINSIC_FLAG_F32_CONST);
add_intrinsic_capability(comp_ctx, AOT_INTRINSIC_FLAG_F64_CONST);
}
}
#endif /* WASM_ENABLE_WAMR_COMPILER != 0 || WASM_ENABLE_JIT != 0 */

View File

@ -57,6 +57,7 @@ extern "C" {
#define AOT_INTRINSIC_FLAG_F32_TO_U64 AOT_INTRINSIC_FLAG(0, 23)
#define AOT_INTRINSIC_FLAG_F32_TO_F64 AOT_INTRINSIC_FLAG(0, 24)
#define AOT_INTRINSIC_FLAG_F32_CMP AOT_INTRINSIC_FLAG(0, 25)
#define AOT_INTRINSIC_FLAG_F32_CONST AOT_INTRINSIC_FLAG(0, 26)
#define AOT_INTRINSIC_FLAG_F64_FADD AOT_INTRINSIC_FLAG(1, 0)
#define AOT_INTRINSIC_FLAG_F64_FSUB AOT_INTRINSIC_FLAG(1, 1)
@ -84,6 +85,7 @@ extern "C" {
#define AOT_INTRINSIC_FLAG_F64_TO_U64 AOT_INTRINSIC_FLAG(1, 23)
#define AOT_INTRINSIC_FLAG_F64_TO_F32 AOT_INTRINSIC_FLAG(1, 24)
#define AOT_INTRINSIC_FLAG_F64_CMP AOT_INTRINSIC_FLAG(1, 25)
#define AOT_INTRINSIC_FLAG_F64_CONST AOT_INTRINSIC_FLAG(1, 26)
/* clang-format on */
float32

View File

@ -465,6 +465,12 @@ get_native_symbol_by_name(const char *name)
return func;
}
static bool
str2uint32(const char *buf, uint32 *p_res);
static bool
str2uint64(const char *buf, uint64 *p_res);
static bool
load_native_symbol_section(const uint8 *buf, const uint8 *buf_end,
AOTModule *module, bool is_load_from_file_buf,
@ -487,11 +493,39 @@ load_native_symbol_section(const uint8 *buf, const uint8 *buf_end,
for (i = cnt - 1; i >= 0; i--) {
read_string(p, p_end, symbol);
module->native_symbol_list[i] = get_native_symbol_by_name(symbol);
if (module->native_symbol_list[i] == NULL) {
set_error_buf_v(error_buf, error_buf_size,
"missing native symbol: %s", symbol);
goto fail;
if (!strncmp(symbol, "f32#", 4)) {
uint32 u32;
/* Resolve the raw int bits of f32 const */
if (!str2uint32(symbol + 4, &u32)) {
set_error_buf_v(error_buf, error_buf_size,
"resolve symbol %s failed", symbol);
goto fail;
}
*(uint32 *)(&module->native_symbol_list[i]) = u32;
}
else if (!strncmp(symbol, "f64#", 4)) {
uint64 u64;
/* Resolve the raw int bits of f64 const */
if (!str2uint64(symbol + 4, &u64)) {
set_error_buf_v(error_buf, error_buf_size,
"resolve symbol %s failed", symbol);
goto fail;
}
*(uint64 *)(&module->native_symbol_list[i]) = u64;
}
else if (!strncmp(symbol, "__ignore", 8)) {
/* Padding bytes to make f64 on 8-byte aligned address,
or it is the second 32-bit slot in 32-bit system */
continue;
}
else {
module->native_symbol_list[i] =
get_native_symbol_by_name(symbol);
if (module->native_symbol_list[i] == NULL) {
set_error_buf_v(error_buf, error_buf_size,
"missing native symbol: %s", symbol);
goto fail;
}
}
}
}
@ -1718,7 +1752,6 @@ is_literal_relocation(const char *reloc_sec_name)
return !strcmp(reloc_sec_name, ".rela.literal");
}
#if defined(BH_PLATFORM_WINDOWS)
static bool
str2uint32(const char *buf, uint32 *p_res)
{
@ -1764,7 +1797,6 @@ str2uint64(const char *buf, uint64 *p_res)
*p_res = res;
return true;
}
#endif
static bool
do_text_relocation(AOTModule *module, AOTRelocationGroup *group,

View File

@ -1403,7 +1403,7 @@ aot_call_function(WASMExecEnv *exec_env, AOTFunctionInstance *function,
bool ret;
if (argc < func_type->param_cell_num) {
char buf[128];
char buf[108];
snprintf(buf, sizeof(buf),
"invalid argument count %u, must be no smaller than %u", argc,
func_type->param_cell_num);

View File

@ -357,7 +357,7 @@ apply_relocation(AOTModule *module, uint8 *target_section_addr,
if (error_buf != NULL)
snprintf(error_buf, error_buf_size,
"Load relocation section failed: "
"invalid relocation type %d.",
"invalid relocation type %" PRIu32 ".",
reloc_type);
return false;
}

View File

@ -417,7 +417,7 @@ wasm_application_execute_func(WASMModuleInstanceCommon *module_inst,
char *endptr = NULL;
bh_assert(argv[i] != NULL);
if (argv[i][0] == '\0') {
snprintf(buf, sizeof(buf), "invalid input argument %d", i);
snprintf(buf, sizeof(buf), "invalid input argument %" PRId32, i);
wasm_runtime_set_exception(module_inst, buf);
goto fail;
}
@ -554,8 +554,8 @@ wasm_application_execute_func(WASMModuleInstanceCommon *module_inst,
break;
}
if (endptr && *endptr != '\0' && *endptr != '_') {
snprintf(buf, sizeof(buf), "invalid input argument %d: %s", i,
argv[i]);
snprintf(buf, sizeof(buf), "invalid input argument %" PRId32 ": %s",
i, argv[i]);
wasm_runtime_set_exception(module_inst, buf);
goto fail;
}
@ -573,7 +573,7 @@ wasm_application_execute_func(WASMModuleInstanceCommon *module_inst,
switch (type->types[type->param_count + j]) {
case VALUE_TYPE_I32:
{
os_printf("0x%x:i32", argv1[k]);
os_printf("0x%" PRIx32 ":i32", argv1[k]);
k++;
break;
}
@ -586,16 +586,7 @@ wasm_application_execute_func(WASMModuleInstanceCommon *module_inst,
u.parts[0] = argv1[k];
u.parts[1] = argv1[k + 1];
k += 2;
#ifdef PRIx64
os_printf("0x%" PRIx64 ":i64", u.val);
#else
char buf[16];
if (sizeof(long) == 4)
snprintf(buf, sizeof(buf), "%s", "0x%llx:i64");
else
snprintf(buf, sizeof(buf), "%s", "0x%lx:i64");
os_printf(buf, u.val);
#endif
break;
}
case VALUE_TYPE_F32:
@ -645,17 +636,8 @@ wasm_application_execute_func(WASMModuleInstanceCommon *module_inst,
case VALUE_TYPE_V128:
{
uint64 *v = (uint64 *)(argv1 + k);
#if defined(PRIx64)
os_printf("<0x%016" PRIx64 " 0x%016" PRIx64 ">:v128", *v,
*(v + 1));
#else
if (4 == sizeof(long)) {
os_printf("<0x%016llx 0x%016llx>:v128", *v, *(v + 1));
}
else {
os_printf("<0x%016lx 0x%016lx>:v128", *v, *(v + 1));
}
#endif /* PRIx64 */
k += 4;
break;
}

View File

@ -273,7 +273,7 @@ typedef struct AOTCompData {
typedef struct AOTNativeSymbol {
bh_list_link link;
const char *symbol;
char symbol[32];
int32 index;
} AOTNativeSymbol;

View File

@ -64,8 +64,9 @@ read_leb(const uint8 *buf, const uint8 *buf_end, uint32 *p_offset,
}
bcnt += 1;
}
if (bcnt > (((maxbits + 8) >> 3) - (maxbits + 8))) {
aot_set_last_error("read leb failed: unsigned leb overflow.");
if (bcnt > (maxbits + 6) / 7) {
aot_set_last_error("read leb failed: "
"integer representation too long");
return false;
}
if (sign && (shift < maxbits) && (byte & 0x40)) {

View File

@ -4,6 +4,7 @@
*/
#include "aot_emit_const.h"
#include "aot_intrinsic.h"
bool
aot_compile_op_i32_const(AOTCompContext *comp_ctx, AOTFuncContext *func_ctx,
@ -36,9 +37,22 @@ aot_compile_op_f32_const(AOTCompContext *comp_ctx, AOTFuncContext *func_ctx,
LLVMValueRef alloca, value;
if (!isnan(f32_const)) {
value = F32_CONST(f32_const);
CHECK_LLVM_CONST(value);
PUSH_F32(value);
if (comp_ctx->is_indirect_mode
&& aot_intrinsic_check_capability(comp_ctx, "f32.const")) {
WASMValue wasm_value;
memcpy(&wasm_value.f32, &f32_const, sizeof(float32));
value = aot_load_const_from_table(comp_ctx, func_ctx->native_symbol,
&wasm_value, VALUE_TYPE_F32);
if (!value) {
return false;
}
PUSH_F32(value);
}
else {
value = F32_CONST(f32_const);
CHECK_LLVM_CONST(value);
PUSH_F32(value);
}
}
else {
int32 i32_const;
@ -77,9 +91,22 @@ aot_compile_op_f64_const(AOTCompContext *comp_ctx, AOTFuncContext *func_ctx,
LLVMValueRef alloca, value;
if (!isnan(f64_const)) {
value = F64_CONST(f64_const);
CHECK_LLVM_CONST(value);
PUSH_F64(value);
if (comp_ctx->is_indirect_mode
&& aot_intrinsic_check_capability(comp_ctx, "f64.const")) {
WASMValue wasm_value;
memcpy(&wasm_value.f64, &f64_const, sizeof(float64));
value = aot_load_const_from_table(comp_ctx, func_ctx->native_symbol,
&wasm_value, VALUE_TYPE_F64);
if (!value) {
return false;
}
PUSH_F64(value);
}
else {
value = F64_CONST(f64_const);
CHECK_LLVM_CONST(value);
PUSH_F64(value);
}
}
else {
int64 i64_const;

View File

@ -74,41 +74,41 @@ format_block_name(char *name, uint32 name_size, uint32 block_index,
#define SET_BUILDER_POS(llvm_block) \
LLVMPositionBuilderAtEnd(comp_ctx->builder, llvm_block)
#define CREATE_RESULT_VALUE_PHIS(block) \
do { \
if (block->result_count && !block->result_phis) { \
uint32 i; \
uint64 size; \
LLVMBasicBlockRef block_curr = CURR_BLOCK(); \
/* Allocate memory */ \
size = sizeof(LLVMValueRef) * (uint64)block->result_count; \
if (size >= UINT32_MAX \
|| !(block->result_phis = \
wasm_runtime_malloc((uint32)size))) { \
aot_set_last_error("allocate memory failed."); \
goto fail; \
} \
SET_BUILDER_POS(block->llvm_end_block); \
for (i = 0; i < block->result_count; i++) { \
if (!(block->result_phis[i] = LLVMBuildPhi( \
comp_ctx->builder, \
TO_LLVM_TYPE(block->result_types[i]), "phi"))) { \
aot_set_last_error("llvm build phi failed."); \
goto fail; \
} \
} \
SET_BUILDER_POS(block_curr); \
} \
#define CREATE_RESULT_VALUE_PHIS(block) \
do { \
if (block->result_count && !block->result_phis) { \
uint32 _i; \
uint64 _size; \
LLVMBasicBlockRef _block_curr = CURR_BLOCK(); \
/* Allocate memory */ \
_size = sizeof(LLVMValueRef) * (uint64)block->result_count; \
if (_size >= UINT32_MAX \
|| !(block->result_phis = \
wasm_runtime_malloc((uint32)_size))) { \
aot_set_last_error("allocate memory failed."); \
goto fail; \
} \
SET_BUILDER_POS(block->llvm_end_block); \
for (_i = 0; _i < block->result_count; _i++) { \
if (!(block->result_phis[_i] = LLVMBuildPhi( \
comp_ctx->builder, \
TO_LLVM_TYPE(block->result_types[_i]), "phi"))) { \
aot_set_last_error("llvm build phi failed."); \
goto fail; \
} \
} \
SET_BUILDER_POS(_block_curr); \
} \
} while (0)
#define ADD_TO_RESULT_PHIS(block, value, idx) \
do { \
LLVMBasicBlockRef block_curr = CURR_BLOCK(); \
LLVMBasicBlockRef _block_curr = CURR_BLOCK(); \
LLVMTypeRef phi_ty = LLVMTypeOf(block->result_phis[idx]); \
LLVMTypeRef value_ty = LLVMTypeOf(value); \
bh_assert(LLVMGetTypeKind(phi_ty) == LLVMGetTypeKind(value_ty)); \
bh_assert(LLVMGetTypeContext(phi_ty) == LLVMGetTypeContext(value_ty)); \
LLVMAddIncoming(block->result_phis[idx], &value, &block_curr, 1); \
LLVMAddIncoming(block->result_phis[idx], &value, &_block_curr, 1); \
(void)phi_ty; \
(void)value_ty; \
} while (0)
@ -122,10 +122,10 @@ format_block_name(char *name, uint32 name_size, uint32 block_index,
} \
} while (0)
#define ADD_TO_PARAM_PHIS(block, value, idx) \
do { \
LLVMBasicBlockRef block_curr = CURR_BLOCK(); \
LLVMAddIncoming(block->param_phis[idx], &value, &block_curr, 1); \
#define ADD_TO_PARAM_PHIS(block, value, idx) \
do { \
LLVMBasicBlockRef _block_curr = CURR_BLOCK(); \
LLVMAddIncoming(block->param_phis[idx], &value, &_block_curr, 1); \
} while (0)
static LLVMBasicBlockRef

View File

@ -348,14 +348,37 @@ aot_compile_op_i32_trunc_f32(AOTCompContext *comp_ctx, AOTFuncContext *func_ctx,
POP_F32(value);
if (sign) {
min_value = F32_CONST(-2147483904.0f);
max_value = F32_CONST(2147483648.0f);
if (!comp_ctx->is_indirect_mode) {
if (sign) {
min_value = F32_CONST(-2147483904.0f);
max_value = F32_CONST(2147483648.0f);
}
else {
min_value = F32_CONST(-1.0f);
max_value = F32_CONST(4294967296.0f);
}
}
else {
min_value = F32_CONST(-1.0f);
max_value = F32_CONST(4294967296.0f);
WASMValue wasm_value;
if (sign) {
wasm_value.f32 = -2147483904.0f;
min_value = aot_load_const_from_table(
comp_ctx, func_ctx->native_symbol, &wasm_value, VALUE_TYPE_F32);
wasm_value.f32 = 2147483648.0f;
max_value = aot_load_const_from_table(
comp_ctx, func_ctx->native_symbol, &wasm_value, VALUE_TYPE_F32);
}
else {
wasm_value.f32 = -1.0f;
min_value = aot_load_const_from_table(
comp_ctx, func_ctx->native_symbol, &wasm_value, VALUE_TYPE_F32);
wasm_value.f32 = 4294967296.0f;
max_value = aot_load_const_from_table(
comp_ctx, func_ctx->native_symbol, &wasm_value, VALUE_TYPE_F32);
}
}
CHECK_LLVM_CONST(min_value);
CHECK_LLVM_CONST(max_value);
if (!saturating)
return trunc_float_to_int(
@ -378,14 +401,37 @@ aot_compile_op_i32_trunc_f64(AOTCompContext *comp_ctx, AOTFuncContext *func_ctx,
POP_F64(value);
if (sign) {
min_value = F64_CONST(-2147483649.0);
max_value = F64_CONST(2147483648.0);
if (!comp_ctx->is_indirect_mode) {
if (sign) {
min_value = F64_CONST(-2147483649.0);
max_value = F64_CONST(2147483648.0);
}
else {
min_value = F64_CONST(-1.0);
max_value = F64_CONST(4294967296.0);
}
}
else {
min_value = F64_CONST(-1.0);
max_value = F64_CONST(4294967296.0);
WASMValue wasm_value;
if (sign) {
wasm_value.f64 = -2147483649.0;
min_value = aot_load_const_from_table(
comp_ctx, func_ctx->native_symbol, &wasm_value, VALUE_TYPE_F64);
wasm_value.f64 = 2147483648.0;
max_value = aot_load_const_from_table(
comp_ctx, func_ctx->native_symbol, &wasm_value, VALUE_TYPE_F64);
}
else {
wasm_value.f64 = -1.0;
min_value = aot_load_const_from_table(
comp_ctx, func_ctx->native_symbol, &wasm_value, VALUE_TYPE_F64);
wasm_value.f64 = 4294967296.0;
max_value = aot_load_const_from_table(
comp_ctx, func_ctx->native_symbol, &wasm_value, VALUE_TYPE_F64);
}
}
CHECK_LLVM_CONST(min_value);
CHECK_LLVM_CONST(max_value);
if (!saturating)
return trunc_float_to_int(
@ -509,14 +555,37 @@ aot_compile_op_i64_trunc_f32(AOTCompContext *comp_ctx, AOTFuncContext *func_ctx,
POP_F32(value);
if (sign) {
min_value = F32_CONST(-9223373136366403584.0f);
max_value = F32_CONST(9223372036854775808.0f);
if (!comp_ctx->is_indirect_mode) {
if (sign) {
min_value = F32_CONST(-9223373136366403584.0f);
max_value = F32_CONST(9223372036854775808.0f);
}
else {
min_value = F32_CONST(-1.0f);
max_value = F32_CONST(18446744073709551616.0f);
}
}
else {
min_value = F32_CONST(-1.0f);
max_value = F32_CONST(18446744073709551616.0f);
WASMValue wasm_value;
if (sign) {
wasm_value.f32 = -9223373136366403584.0f;
min_value = aot_load_const_from_table(
comp_ctx, func_ctx->native_symbol, &wasm_value, VALUE_TYPE_F32);
wasm_value.f32 = 9223372036854775808.0f;
max_value = aot_load_const_from_table(
comp_ctx, func_ctx->native_symbol, &wasm_value, VALUE_TYPE_F32);
}
else {
wasm_value.f32 = -1.0f;
min_value = aot_load_const_from_table(
comp_ctx, func_ctx->native_symbol, &wasm_value, VALUE_TYPE_F32);
wasm_value.f32 = 18446744073709551616.0f;
max_value = aot_load_const_from_table(
comp_ctx, func_ctx->native_symbol, &wasm_value, VALUE_TYPE_F32);
}
}
CHECK_LLVM_CONST(min_value);
CHECK_LLVM_CONST(max_value);
if (!saturating)
return trunc_float_to_int(
@ -539,14 +608,37 @@ aot_compile_op_i64_trunc_f64(AOTCompContext *comp_ctx, AOTFuncContext *func_ctx,
POP_F64(value);
if (sign) {
min_value = F64_CONST(-9223372036854777856.0);
max_value = F64_CONST(9223372036854775808.0);
if (!comp_ctx->is_indirect_mode) {
if (sign) {
min_value = F64_CONST(-9223372036854777856.0);
max_value = F64_CONST(9223372036854775808.0);
}
else {
min_value = F64_CONST(-1.0);
max_value = F64_CONST(18446744073709551616.0);
}
}
else {
min_value = F64_CONST(-1.0);
max_value = F64_CONST(18446744073709551616.0);
WASMValue wasm_value;
if (sign) {
wasm_value.f64 = -9223372036854777856.0;
min_value = aot_load_const_from_table(
comp_ctx, func_ctx->native_symbol, &wasm_value, VALUE_TYPE_F64);
wasm_value.f64 = 9223372036854775808.0;
max_value = aot_load_const_from_table(
comp_ctx, func_ctx->native_symbol, &wasm_value, VALUE_TYPE_F64);
}
else {
wasm_value.f64 = -1.0;
min_value = aot_load_const_from_table(
comp_ctx, func_ctx->native_symbol, &wasm_value, VALUE_TYPE_F64);
wasm_value.f64 = 18446744073709551616.0;
max_value = aot_load_const_from_table(
comp_ctx, func_ctx->native_symbol, &wasm_value, VALUE_TYPE_F64);
}
}
CHECK_LLVM_CONST(min_value);
CHECK_LLVM_CONST(max_value);
if (!saturating)
return trunc_float_to_int(

View File

@ -85,7 +85,7 @@ aot_check_memory_overflow(AOTCompContext *comp_ctx, AOTFuncContext *func_ctx,
LLVMValueRef mem_base_addr, mem_check_bound;
LLVMBasicBlockRef block_curr = LLVMGetInsertBlock(comp_ctx->builder);
LLVMBasicBlockRef check_succ;
AOTValue *aot_value;
AOTValue *aot_value_top;
uint32 local_idx_of_aot_value = 0;
bool is_target_64bit, is_local_of_aot_value = false;
#if WASM_ENABLE_SHARED_MEMORY != 0
@ -114,13 +114,13 @@ aot_check_memory_overflow(AOTCompContext *comp_ctx, AOTFuncContext *func_ctx,
}
}
aot_value =
aot_value_top =
func_ctx->block_stack.block_list_end->value_stack.value_list_end;
if (aot_value) {
/* aot_value is freed in the following POP_I32(addr),
if (aot_value_top) {
/* aot_value_top is freed in the following POP_I32(addr),
so save its fields here for further use */
is_local_of_aot_value = aot_value->is_local;
local_idx_of_aot_value = aot_value->local_idx;
is_local_of_aot_value = aot_value_top->is_local;
local_idx_of_aot_value = aot_value_top->local_idx;
}
POP_I32(addr);

View File

@ -32,7 +32,7 @@ aot_compile_op_get_local(AOTCompContext *comp_ctx, AOTFuncContext *func_ctx,
{
char name[32];
LLVMValueRef value;
AOTValue *aot_value;
AOTValue *aot_value_top;
CHECK_LOCAL(local_idx);
@ -45,10 +45,10 @@ aot_compile_op_get_local(AOTCompContext *comp_ctx, AOTFuncContext *func_ctx,
PUSH(value, get_local_type(func_ctx, local_idx));
aot_value =
aot_value_top =
func_ctx->block_stack.block_list_end->value_stack.value_list_end;
aot_value->is_local = true;
aot_value->local_idx = local_idx;
aot_value_top->is_local = true;
aot_value_top->local_idx = local_idx;
return true;
fail:

View File

@ -1814,7 +1814,7 @@ aot_create_comp_context(AOTCompData *comp_data, aot_comp_option_t option)
if (option->enable_simd) {
char *tmp;
bool ret;
bool check_simd_ret;
comp_ctx->enable_simd = true;
@ -1823,9 +1823,10 @@ aot_create_comp_context(AOTCompData *comp_data, aot_comp_option_t option)
goto fail;
}
ret = aot_check_simd_compatibility(comp_ctx->target_arch, tmp);
check_simd_ret =
aot_check_simd_compatibility(comp_ctx->target_arch, tmp);
LLVMDisposeMessage(tmp);
if (!ret) {
if (!check_simd_ret) {
aot_set_last_error("SIMD compatibility check failed, "
"try adding --cpu=<cpu> to specify a cpu "
"or adding --disable-simd to disable SIMD");
@ -2004,6 +2005,30 @@ aot_destroy_comp_context(AOTCompContext *comp_ctx)
wasm_runtime_free(comp_ctx);
}
static bool
insert_native_symbol(AOTCompContext *comp_ctx, const char *symbol, int32 idx)
{
AOTNativeSymbol *sym = wasm_runtime_malloc(sizeof(AOTNativeSymbol));
if (!sym) {
aot_set_last_error("alloc native symbol failed.");
return false;
}
memset(sym, 0, sizeof(AOTNativeSymbol));
bh_assert(strlen(symbol) <= sizeof(sym->symbol));
snprintf(sym->symbol, sizeof(sym->symbol), "%s", symbol);
sym->index = idx;
if (BH_LIST_ERROR == bh_list_insert(&comp_ctx->native_symbols, sym)) {
wasm_runtime_free(sym);
aot_set_last_error("insert native symbol to list failed.");
return false;
}
return true;
}
int32
aot_get_native_symbol_index(AOTCompContext *comp_ctx, const char *symbol)
{
@ -2025,22 +2050,30 @@ aot_get_native_symbol_index(AOTCompContext *comp_ctx, const char *symbol)
/* Given symbol is not exist in list, then we alloc a new index for it */
if (idx < 0) {
sym = wasm_runtime_malloc(sizeof(AOTNativeSymbol));
if (!sym) {
aot_set_last_error("alloc native symbol failed.");
return idx;
if (comp_ctx->pointer_size == sizeof(uint32)
&& !strncmp(symbol, "f64#", 4)) {
idx = bh_list_length(&comp_ctx->native_symbols);
/* Add 4 bytes padding on 32-bit target to make sure that
the f64 const is stored on 8-byte aligned address */
if ((idx & 1) && !strncmp(comp_ctx->target_arch, "i386", 4)) {
if (!insert_native_symbol(comp_ctx, "__ignore", idx)) {
return -1;
}
}
}
idx = bh_list_length(&comp_ctx->native_symbols);
sym->symbol = symbol;
sym->index = idx;
if (BH_LIST_ERROR == bh_list_insert(&comp_ctx->native_symbols, sym)) {
wasm_runtime_free(sym);
aot_set_last_error("alloc index for native symbol failed.");
if (!insert_native_symbol(comp_ctx, symbol, idx)) {
return -1;
}
if (comp_ctx->pointer_size == sizeof(uint32)
&& !strncmp(symbol, "f64#", 4)) {
/* f64 const occupies 2 pointer slots on 32-bit target */
if (!insert_native_symbol(comp_ctx, "__ignore", idx + 1)) {
return -1;
}
}
}
return idx;
@ -2445,3 +2478,61 @@ aot_get_func_from_table(const AOTCompContext *comp_ctx, LLVMValueRef base,
fail:
return NULL;
}
LLVMValueRef
aot_load_const_from_table(AOTCompContext *comp_ctx, LLVMValueRef base,
const WASMValue *value, uint8 value_type)
{
LLVMValueRef const_index, const_addr, const_value;
LLVMTypeRef const_ptr_type;
char buf[128] = { 0 };
int32 index;
switch (value_type) {
case VALUE_TYPE_F32:
/* Store the raw int bits of f32 const as a hex string */
snprintf(buf, sizeof(buf), "f32#%08" PRIX32, value->i32);
const_ptr_type = F32_PTR_TYPE;
break;
case VALUE_TYPE_F64:
/* Store the raw int bits of f64 const as a hex string */
snprintf(buf, sizeof(buf), "f64#%016" PRIX64, value->i64);
const_ptr_type = F64_PTR_TYPE;
break;
default:
bh_assert(0);
return NULL;
}
/* Load f32/f64 const from exec_env->native_symbol[index] */
index = aot_get_native_symbol_index(comp_ctx, buf);
if (index < 0) {
return NULL;
}
if (!(const_index = I32_CONST(index))) {
aot_set_last_error("construct const index failed.");
return NULL;
}
if (!(const_addr = LLVMBuildInBoundsGEP(
comp_ctx->builder, base, &const_index, 1, "const_addr_tmp"))) {
aot_set_last_error("get const addr by index failed.");
return NULL;
}
if (!(const_addr = LLVMBuildBitCast(comp_ctx->builder, const_addr,
const_ptr_type, "const_addr"))) {
aot_set_last_error("cast const fialed.");
return NULL;
}
if (!(const_value =
LLVMBuildLoad(comp_ctx->builder, const_addr, "const_value"))) {
aot_set_last_error("load const failed.");
return NULL;
}
return const_value;
}

View File

@ -442,6 +442,10 @@ LLVMValueRef
aot_get_func_from_table(const AOTCompContext *comp_ctx, LLVMValueRef base,
LLVMTypeRef func_type, int32 index);
LLVMValueRef
aot_load_const_from_table(AOTCompContext *comp_ctx, LLVMValueRef base,
const WASMValue *value, uint8 value_type);
bool
aot_check_simd_compatibility(const char *arch_c_str, const char *cpu_c_str);

View File

@ -3813,8 +3813,9 @@ wasm_interp_call_wasm(WASMModuleInstance *module_inst, WASMExecEnv *exec_env,
if (argc < function->param_cell_num) {
char buf[128];
snprintf(buf, sizeof(buf),
"invalid argument count %u, must be no smaller than %u", argc,
function->param_cell_num);
"invalid argument count %" PRIu32
", must be no smaller than %" PRIu32,
argc, (uint32)function->param_cell_num);
wasm_set_exception(module_inst, buf);
return;
}

View File

@ -493,7 +493,6 @@ load_init_expr(const uint8 **p_buf, const uint8 *buf_end,
/* v128.const */
case INIT_EXPR_TYPE_V128_CONST:
{
uint8 flag;
uint64 high, low;
if (type != VALUE_TYPE_V128)

View File

@ -769,7 +769,7 @@ exit_wrapper(wasm_exec_env_t exec_env, int32 status)
{
wasm_module_inst_t module_inst = get_module_inst(exec_env);
char buf[32];
snprintf(buf, sizeof(buf), "env.exit(%i)", status);
snprintf(buf, sizeof(buf), "env.exit(%" PRId32 ")", status);
wasm_runtime_set_exception(module_inst, buf);
}
@ -1012,7 +1012,7 @@ abort_wrapper(wasm_exec_env_t exec_env, int32 code)
{
wasm_module_inst_t module_inst = get_module_inst(exec_env);
char buf[32];
snprintf(buf, sizeof(buf), "env.abort(%i)", code);
snprintf(buf, sizeof(buf), "env.abort(%" PRId32 ")", code);
wasm_runtime_set_exception(module_inst, buf);
}
@ -1021,7 +1021,7 @@ abortStackOverflow_wrapper(wasm_exec_env_t exec_env, int32 code)
{
wasm_module_inst_t module_inst = get_module_inst(exec_env);
char buf[32];
snprintf(buf, sizeof(buf), "env.abortStackOverflow(%i)", code);
snprintf(buf, sizeof(buf), "env.abortStackOverflow(%" PRId32 ")", code);
wasm_runtime_set_exception(module_inst, buf);
}
@ -1030,7 +1030,7 @@ nullFunc_X_wrapper(wasm_exec_env_t exec_env, int32 code)
{
wasm_module_inst_t module_inst = get_module_inst(exec_env);
char buf[32];
snprintf(buf, sizeof(buf), "env.nullFunc_X(%i)", code);
snprintf(buf, sizeof(buf), "env.nullFunc_X(%" PRId32 ")", code);
wasm_runtime_set_exception(module_inst, buf);
}

View File

@ -722,7 +722,8 @@ void
gc_dump_heap_stats(gc_heap_t *heap)
{
os_printf("heap: %p, heap start: %p\n", heap, heap->base_addr);
os_printf("total free: %u, current: %u, highmark: %u\n",
os_printf("total free: %" PRIu32 ", current: %" PRIu32
", highmark: %" PRIu32 "\n",
heap->total_free_size, heap->current_size, heap->highmark_size);
os_printf("g_total_malloc=%lu, g_total_free=%lu, occupied=%lu\n",
g_total_malloc, g_total_free, g_total_malloc - g_total_free);
@ -765,9 +766,10 @@ gci_dump(gc_heap_t *heap)
return;
}
os_printf("#%d %08x %x %x %d %c %d\n", i,
(int32)((char *)cur - (char *)heap->base_addr), ut, p, mark,
inuse, (int32)hmu_obj_size(size));
os_printf("#%d %08" PRIx32 " %" PRIx32 " %d %d"
" %c %" PRId32 "\n",
i, (int32)((char *)cur - (char *)heap->base_addr), (int32)ut,
p, mark, inuse, (int32)hmu_obj_size(size));
#if BH_ENABLE_GC_VERIFY != 0
if (inuse == 'V') {
gc_object_prefix_t *prefix = (gc_object_prefix_t *)(cur + 1);

View File

@ -59,8 +59,8 @@ gc_init_with_pool(char *buf, gc_size_t buf_size)
gc_size_t heap_max_size;
if (buf_size < APP_HEAP_SIZE_MIN) {
os_printf("[GC_ERROR]heap init buf size (%u) < %u\n", buf_size,
APP_HEAP_SIZE_MIN);
os_printf("[GC_ERROR]heap init buf size (%" PRIu32 ") < %" PRIu32 "\n",
buf_size, (uint32)APP_HEAP_SIZE_MIN);
return NULL;
}
@ -93,7 +93,7 @@ gc_init_with_struct_and_pool(char *struct_buf, gc_size_t struct_buf_size,
}
if (struct_buf_size < sizeof(gc_handle_t)) {
os_printf("[GC_ERROR]heap init struct buf size (%u) < %zu\n",
os_printf("[GC_ERROR]heap init struct buf size (%" PRIu32 ") < %zu\n",
struct_buf_size, sizeof(gc_handle_t));
return NULL;
}
@ -104,8 +104,8 @@ gc_init_with_struct_and_pool(char *struct_buf, gc_size_t struct_buf_size,
}
if (pool_buf_size < APP_HEAP_SIZE_MIN) {
os_printf("[GC_ERROR]heap init buf size (%u) < %u\n", pool_buf_size,
APP_HEAP_SIZE_MIN);
os_printf("[GC_ERROR]heap init buf size (%" PRIu32 ") < %u\n",
pool_buf_size, APP_HEAP_SIZE_MIN);
return NULL;
}

View File

@ -0,0 +1,72 @@
/*
* Copyright (C) 2019 Intel Corporation. All rights reserved.
* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
*/
#include "platform_api_vmcore.h"
#include "platform_api_extension.h"
void *
os_malloc(unsigned size)
{
void *buf_origin;
void *buf_fixed;
uintptr_t *addr_field;
buf_origin = malloc(size + 8 + sizeof(uintptr_t));
buf_fixed = buf_origin + sizeof(void *);
if ((uintptr_t)buf_fixed & (uintptr_t)0x7) {
buf_fixed = (void *)((uintptr_t)(buf_fixed + 8) & (~(uintptr_t)7));
}
addr_field = buf_fixed - sizeof(uintptr_t);
*addr_field = (uintptr_t)buf_origin;
return buf_fixed;
}
void *
os_realloc(void *ptr, unsigned size)
{
void *mem_origin;
void *mem_new;
void *mem_new_fixed;
uintptr_t *addr_field;
if (!ptr) {
return NULL;
}
addr_field = ptr - sizeof(uintptr_t);
mem_origin = (void *)(*addr_field);
mem_new = realloc(mem_origin, size + 8 + sizeof(uintptr_t));
if (mem_origin != mem_new) {
mem_new_fixed = mem_new + sizeof(uintptr_t);
if ((uint32)mem_new_fixed & 0x7) {
mem_new_fixed =
(void *)((uintptr_t)(mem_new + 8) & (~(uintptr_t)7));
}
addr_field = mem_new_fixed - sizeof(uintptr_t);
*addr_field = (uintptr_t)mem_new;
return mem_new_fixed;
}
return ptr;
}
void
os_free(void *ptr)
{
void *mem_origin;
uintptr *addr_field;
if (ptr) {
addr_field = ptr - sizeof(uintptr_t);
mem_origin = (void *)(*addr_field);
free(mem_origin);
}
}

View File

@ -0,0 +1,29 @@
/*
* Copyright (C) 2019 Intel Corporation. All rights reserved.
* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
*/
#include "platform_api_vmcore.h"
#include "platform_api_extension.h"
void *
os_mmap(void *hint, size_t size, int prot, int flags)
{
return os_malloc((int)size);
}
void
os_munmap(void *addr, size_t size)
{
return os_free(addr);
}
int
os_mprotect(void *addr, size_t size, int prot)
{
return 0;
}
void
os_dcache_flush()
{}

View File

@ -6,25 +6,15 @@
#include "platform_api_vmcore.h"
#include "platform_api_extension.h"
int errno = 0;
int
os_thread_sys_init();
void
os_thread_sys_destroy();
int
bh_platform_init()
{
return os_thread_sys_init();
return 0;
}
void
bh_platform_destroy()
{
os_thread_sys_destroy();
}
{}
int
os_printf(const char *format, ...)
@ -45,76 +35,20 @@ os_vprintf(const char *format, va_list ap)
return vprintf(format, ap);
}
void *
os_mmap(void *hint, size_t size, int prot, int flags)
uint64
os_time_get_boot_microsecond(void)
{
return BH_MALLOC(size);
return (uint64)esp_timer_get_time();
}
void
os_munmap(void *addr, size_t size)
uint8 *
os_thread_get_stack_boundary(void)
{
BH_FREE(addr);
return NULL;
}
int
os_mprotect(void *addr, size_t size, int prot)
os_usleep(uint32 usec)
{
return 0;
}
void
os_dcache_flush()
{}
int
atoi(const char *nptr)
{
bool is_negative = false;
int total = 0;
const char *p = nptr;
char temp = '0';
if (NULL == p) {
os_printf("invlaid atoi input\n");
return 0;
}
if (*p == '-') {
is_negative = true;
p++;
}
while ((temp = *p++) != '\0') {
if (temp > '9' || temp < '0') {
continue;
}
total = total * 10 + (int)(temp - '0');
}
if (is_negative)
total = 0 - total;
return total;
}
void *
memmove(void *dest, const void *src, size_t n)
{
char *d = dest;
const char *s = src;
if (d < s) {
while (n--)
*d++ = *s++;
}
else {
const char *lasts = s + (n - 1);
char *lastd = d + (n - 1);
while (n--)
*lastd-- = *lasts--;
}
return dest;
return usleep(usec);
}

View File

@ -3,12 +3,204 @@
* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
*/
#ifndef _GNU_SOURCE
#define _GNU_SOURCE
#endif
#include "platform_api_vmcore.h"
#include "platform_api_extension.h"
uint8 *
os_thread_get_stack_boundary()
typedef struct {
thread_start_routine_t start;
void *arg;
} thread_wrapper_arg;
static void *
os_thread_wrapper(void *arg)
{
/* TODO: implement os_thread_get_stack_boundary */
thread_wrapper_arg *targ = arg;
thread_start_routine_t start_func = targ->start;
void *thread_arg = targ->arg;
os_printf("THREAD CREATED %jx\n", (uintmax_t)(uintptr_t)pthread_self());
BH_FREE(targ);
start_func(thread_arg);
return NULL;
}
korp_tid
os_self_thread(void)
{
/* only allowed if this is a thread, xTaskCreate is not enough look at
* product_mini for how to use this*/
return pthread_self();
}
int
os_mutex_init(korp_mutex *mutex)
{
return pthread_mutex_init(mutex, NULL);
}
int
os_mutex_destroy(korp_mutex *mutex)
{
return pthread_mutex_destroy(mutex);
}
int
os_mutex_lock(korp_mutex *mutex)
{
return pthread_mutex_lock(mutex);
}
int
os_mutex_unlock(korp_mutex *mutex)
{
return pthread_mutex_unlock(mutex);
}
int
os_thread_create_with_prio(korp_tid *tid, thread_start_routine_t start,
void *arg, unsigned int stack_size, int prio)
{
pthread_attr_t tattr;
thread_wrapper_arg *targ;
assert(stack_size > 0);
assert(tid);
assert(start);
pthread_attr_init(&tattr);
pthread_attr_setdetachstate(&tattr, PTHREAD_CREATE_JOINABLE);
if (pthread_attr_setstacksize(&tattr, stack_size) != 0) {
os_printf("Invalid thread stack size %u. Min stack size = %u",
stack_size, PTHREAD_STACK_MIN);
pthread_attr_destroy(&tattr);
return BHT_ERROR;
}
targ = (thread_wrapper_arg *)BH_MALLOC(sizeof(*targ));
if (!targ) {
pthread_attr_destroy(&tattr);
return BHT_ERROR;
}
targ->start = start;
targ->arg = arg;
if (pthread_create(tid, &tattr, os_thread_wrapper, targ) != 0) {
pthread_attr_destroy(&tattr);
os_free(targ);
return BHT_ERROR;
}
pthread_attr_destroy(&tattr);
return BHT_OK;
}
int
os_thread_create(korp_tid *tid, thread_start_routine_t start, void *arg,
unsigned int stack_size)
{
return os_thread_create_with_prio(tid, start, arg, stack_size,
BH_THREAD_DEFAULT_PRIORITY);
}
int
os_thread_join(korp_tid thread, void **retval)
{
return pthread_join(thread, retval);
}
int
os_thread_detach(korp_tid tid)
{
return pthread_detach(tid);
}
void
os_thread_exit(void *retval)
{
pthread_exit(retval);
}
int
os_cond_init(korp_cond *cond)
{
return pthread_cond_init(cond, NULL);
}
int
os_cond_destroy(korp_cond *cond)
{
return pthread_cond_destroy(cond);
}
int
os_cond_wait(korp_cond *cond, korp_mutex *mutex)
{
return pthread_cond_wait(cond, mutex);
}
static void
msec_nsec_to_abstime(struct timespec *ts, uint64 usec)
{
struct timeval tv;
time_t tv_sec_new;
long int tv_nsec_new;
gettimeofday(&tv, NULL);
tv_sec_new = (time_t)(tv.tv_sec + usec / 1000000);
if (tv_sec_new >= tv.tv_sec) {
ts->tv_sec = tv_sec_new;
}
else {
/* integer overflow */
ts->tv_sec = BH_TIME_T_MAX;
os_printf("Warning: os_cond_reltimedwait exceeds limit, "
"set to max timeout instead\n");
}
tv_nsec_new = (long int)(tv.tv_usec * 1000 + (usec % 1000000) * 1000);
if (tv.tv_usec * 1000 >= tv.tv_usec && tv_nsec_new >= tv.tv_usec * 1000) {
ts->tv_nsec = tv_nsec_new;
}
else {
/* integer overflow */
ts->tv_nsec = LONG_MAX;
os_printf("Warning: os_cond_reltimedwait exceeds limit, "
"set to max timeout instead\n");
}
if (ts->tv_nsec >= 1000000000L && ts->tv_sec < BH_TIME_T_MAX) {
ts->tv_sec++;
ts->tv_nsec -= 1000000000L;
}
}
int
os_cond_reltimedwait(korp_cond *cond, korp_mutex *mutex, uint64 useconds)
{
int ret;
struct timespec abstime;
if (useconds == BHT_WAIT_FOREVER)
ret = pthread_cond_wait(cond, mutex);
else {
msec_nsec_to_abstime(&abstime, useconds);
ret = pthread_cond_timedwait(cond, mutex, &abstime);
}
if (ret != BHT_OK && ret != ETIMEDOUT)
return BHT_ERROR;
return ret;
}
int
os_cond_signal(korp_cond *cond)
{
return pthread_cond_signal(cond);
}

View File

@ -14,88 +14,35 @@
#include <stdlib.h>
#include <ctype.h>
#include <errno.h>
#include <math.h>
#include <unistd.h>
#include <pthread.h>
#include <FreeRTOS.h>
#include <semphr.h>
#include <task.h>
#include <os_api.h>
#include "esp_pthread.h"
#include "esp_timer.h"
#include "freertos/FreeRTOS.h"
#include "freertos/task.h"
#ifdef __cplusplus
extern "C" {
#endif
#ifndef BH_PLATFORM_ESP_IDF
#define BH_PLATFORM_ESP_IDF
#endif
typedef pthread_t korp_tid;
typedef pthread_mutex_t korp_mutex;
typedef pthread_cond_t korp_cond;
typedef pthread_t korp_thread;
#define BH_APPLET_PRESERVED_STACK_SIZE (2 * BH_KB)
/* Default thread priority */
#define BH_THREAD_DEFAULT_PRIORITY 5
extern int errno;
typedef TaskHandle_t korp_thread;
typedef korp_thread korp_tid;
typedef struct {
bool is_recursive;
SemaphoreHandle_t sem;
} korp_mutex;
struct os_thread_wait_node;
typedef struct os_thread_wait_node *os_thread_wait_list;
typedef struct korp_cond {
SemaphoreHandle_t wait_list_lock;
os_thread_wait_list thread_wait_list;
} korp_cond;
int
os_printf(const char *format, ...);
int
os_vprintf(const char *format, va_list ap);
/* clang-format off */
/* math functions which are not provided by os */
double sqrt(double x);
double floor(double x);
double ceil(double x);
double fmin(double x, double y);
double fmax(double x, double y);
double rint(double x);
double fabs(double x);
double trunc(double x);
float floorf(float x);
float ceilf(float x);
float fminf(float x, float y);
float fmaxf(float x, float y);
float rintf(float x);
float truncf(float x);
int signbit(double x);
int isnan(double x);
int atoi(const char *s);
int strncasecmp(const char *s1, const char *s2, size_t n);
long int strtol(const char *str, char **endptr, int base);
unsigned long int strtoul(const char *str, char **endptr, int base);
unsigned long long int strtoull(const char *nptr, char **endptr, int base);
double strtod(const char *nptr, char **endptr);
float strtof(const char *nptr, char **endptr);
char *strstr(const char *haystack, const char *needle);
size_t strspn(const char *s, const char *accept);
size_t strcspn(const char *s, const char *reject);
void *memchr(const void *s, int c, size_t n);
int isalnum(int c);
int isxdigit(int c);
int isdigit(int c);
int isprint(int c);
int isgraph(int c);
int isspace(int c);
int isalpha(int c);
int isupper(int c);
int toupper(int c);
int tolower(int c);
void *memmove(void *dest, const void *src, size_t n);
uint32_t htonl(uint32_t hostlong);
uint16_t htons(uint16_t hostshort);
uint32_t ntohl(uint32_t netlong);
uint16_t ntohs(uint16_t netshort);
/* clang-format on */
#ifdef __cplusplus
}
#endif
#endif

View File

@ -8,12 +8,6 @@ add_definitions(-DBH_PLATFORM_ESP_IDF)
include_directories(${PLATFORM_SHARED_DIR})
include_directories(${PLATFORM_SHARED_DIR}/../include)
include (${CMAKE_CURRENT_LIST_DIR}/../common/freertos/platform_api_freertos.cmake)
include (${CMAKE_CURRENT_LIST_DIR}/../common/math/platform_api_math.cmake)
file (GLOB_RECURSE source_all ${PLATFORM_SHARED_DIR}/*.c)
set (PLATFORM_SHARED_SOURCE ${source_all}
${PLATFORM_COMMON_MATH_SOURCE}
${PLATFORM_COMMON_FREERTOS_SOURCE})
set (PLATFORM_SHARED_SOURCE ${source_all} ${PLATFORM_COMMON_MATH_SOURCE})

View File

@ -31,7 +31,7 @@ extern "C" {
*/
/**
* Ceates a thread
* Creates a thread
*
* @param p_tid [OUTPUT] the pointer of tid
* @param start main routine of the thread

View File

@ -104,6 +104,48 @@ typedef int64_t int64;
typedef void *(*thread_start_routine_t)(void *);
#ifndef PRId32
#define PRId32 "d"
#endif
#ifndef PRIi32
#define PRIi32 "i"
#endif
#ifndef PRIu32
#define PRIu32 "u"
#endif
#ifndef PRIx32
#define PRIx32 "x"
#endif
#ifndef PRIX32
#define PRIX32 "X"
#endif
#ifndef __PRI64_PREFIX
#if UINTPTR_MAX == UINT64_MAX
#define __PRI64_PREFIX "l"
#define __PRIPTR_PREFIX "l"
#else
#define __PRI64_PREFIX "ll"
#define __PRIPTR_PREFIX
#endif
#endif
#ifndef PRId64
#define PRId64 __PRI64_PREFIX "d"
#endif
#ifndef PRIu64
#define PRIu64 __PRI64_PREFIX "u"
#endif
#ifndef PRIx64
#define PRIx64 __PRI64_PREFIX "x"
#endif
#ifndef PRIX64
#define PRIX64 __PRI64_PREFIX "X"
#endif
#ifndef PRIXPTR
#define PRIXPTR __PRIPTR_PREFIX "X"
#endif
#ifdef __cplusplus
}
#endif

View File

@ -39,9 +39,11 @@ bh_log(LogLevel log_level, const char *file, int line, const char *fmt, ...)
s = t % 60;
mills = (uint32)(usec % 1000);
snprintf(buf, sizeof(buf), "%02u:%02u:%02u:%03u", h, m, s, mills);
snprintf(buf, sizeof(buf),
"%02" PRIu32 ":%02" PRIu32 ":%02" PRIu32 ":%03" PRIu32, h, m, s,
mills);
os_printf("[%s - %X]: ", buf, (uint32)(uintptr_t)self);
os_printf("[%s - %" PRIXPTR "]: ", buf, (uintptr_t)self);
if (file)
os_printf("%s, line %d, ", file, line);
@ -71,8 +73,9 @@ bh_print_time(const char *prompt)
total_time_ms += curr_time_ms - last_time_ms;
os_printf("%-48s time of last stage: %u ms, total time: %u ms\n", prompt,
curr_time_ms - last_time_ms, total_time_ms);
os_printf("%-48s time of last stage: %" PRIu32 " ms, total time: %" PRIu32
" ms\n",
prompt, curr_time_ms - last_time_ms, total_time_ms);
last_time_ms = curr_time_ms;
}

View File

@ -176,6 +176,9 @@ cmake .. -DCMAKE_TOOLCHAIN_FILE=$TOOL_CHAIN_FILE \
Refer to toolchain sample file [`samples/simple/profiles/arm-interp/toolchain.cmake`](../samples/simple/profiles/arm-interp/toolchain.cmake) for how to build mini product for ARM target architecture.
If you compile for ESP-IDF, make sure to set the right toolchain file for the chip you're using (e.g. `$IDF_PATH/tools/cmake/toolchain-esp32c3.cmake`).
Note that all ESP-IDF toolchain files live under `$IDF_PATH/tools/cmake/`.
Linux
-------------------------
First of all please install the dependent packages.
@ -457,6 +460,18 @@ NuttX
-------------------------
WAMR is intergrated with NuttX, just enable the WAMR in Kconfig option (Application Configuration/Interpreters).
ESP-IDF
-------------------------
WAMR integrates with ESP-IDF both for the XTENSA and RISC-V chips (esp32x and esp32c3 respectively).
In order to use this, you need at least version 4.3.1 of ESP-IDF.
If you don't have it installed, follow the instructions [here](https://docs.espressif.com/projects/esp-idf/en/latest/esp32/get-started/#get-started-get-prerequisites).
ESP-IDF also installs the toolchains needed for compiling WAMR and ESP-IDF.
A small demonstration of how to use WAMR and ESP-IDF can be found under [product_mini](/product-mini/platforms/esp-idf).
The demo builds WAMR for ESP-IDF and runs a small wasm program.
In order to run it for your specific Espressif chip, edit the ['build.sh'](/product-mini/platforms/esp-idf/build.sh) file and put the correct toolchain file (see #Cross-compilation) and `IDF_TARGET`.
Before compiling it is also necessary to call ESP-IDF's `export.sh` script to bring all compile time relevant information in scope.
Docker
-------------------------
[Docker](https://www.docker.com/) will download all the dependencies and build WAMR Core on your behalf.

View File

@ -2,6 +2,8 @@
WAMR supports source level debugging based on DWARF (normally used in C/C++/Rust), source map (normally used in AssemblyScript) is not supported.
**The lldb's ability to debug wasm application is based on the patch [Add class WasmProcess for WebAssembly debugging](https://reviews.llvm.org/D78801). Thanks very much to the author @paolosev for such a great work!**
## Build wasm application with debug information
To debug your application, you need to compile them with debug information. You can use `-g` option when compiling the source code if you are using wasi-sdk (also work for emcc and rustc):
``` bash

View File

@ -3,53 +3,75 @@
# from ESP-IDF 4.0 examples/build_system/cmake/idf_as_lib
cmake_minimum_required(VERSION 3.5)
project(wamr_on_esp32c3)
project(wamr_esp_idf C)
enable_language(ASM)
enable_language (ASM)
if (NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Release)
endif ()
if("${IDF_TARGET}" STREQUAL "")
message(FATAL_ERROR "You need to set IDF_TARGET to your target string")
endif()
# Include for ESP-IDF build system functions
include($ENV{IDF_PATH}/tools/cmake/idf.cmake)
# Create idf::esp32c3 and idf::freertos static libraries
idf_build_process(${IDF_TARGET}
# try and trim the build; additional components
# will be included as needed based on dependency tree
#
# although esptool_py does not generate static library,
# processing the component is needed for flashing related
# targets and file generation
COMPONENTS ${IDF_TARGET} freertos esptool_py
SDKCONFIG ${CMAKE_BINARY_DIR}/sdkconfig
BUILD_DIR ${CMAKE_BINARY_DIR})
# Create idf::esp32 and idf::freertos static libraries
idf_build_process(esp32
# try and trim the build; additional components
# will be included as needed based on dependency tree
#
# although esptool_py does not generate static library,
# processing the component is needed for flashing related
# targets and file generation
COMPONENTS esp32 freertos esptool_py
SDKCONFIG ${CMAKE_BINARY_DIR}/sdkconfig
BUILD_DIR ${CMAKE_BINARY_DIR})
include_directories(build/config
xtensa/include
$ENV{IDF_PATH}/components/esp32/include
$ENV{IDF_PATH}/components/esp_common/include
$ENV{IDF_PATH}/components/esp_rom/include
$ENV{IDF_PATH}/components/freertos/include
$ENV{IDF_PATH}/components/heap/include
$ENV{IDF_PATH}/components/soc/esp32/include
$ENV{IDF_PATH}/components/xtensa/include
$ENV{IDF_PATH}/components/xtensa/esp32/include)
# Set WAMR's build options
if("${IDF_TARGET}" STREQUAL "esp32c3")
set(WAMR_BUILD_TARGET "RISCV32")
else()
set(WAMR_BUILD_TARGET "XTENSA")
add_compile_options(-DWAMR_BUILD_TARGET_XTENSA=1)
endif()
set(WAMR_BUILD_PLATFORM "esp-idf")
set(WAMR_BUILD_TARGET "XTENSA")
set(WAMR_BUILD_INTERP 1)
set(WAMR_BUILD_FAST_INTERP 1)
set(WAMR_BUILD_AOT 1)
set(WAMR_BUILD_LIBC_BUILTIN 1)
set(WAMR_BUILD_LIBC_WASI 0)
if (NOT DEFINED WAMR_BUILD_INTERP)
set (WAMR_BUILD_INTERP 0)
endif ()
if (NOT DEFINED WAMR_BUILD_FAST_INTERP)
set (WAMR_BUILD_FAST_INTERP 0)
endif ()
if (NOT DEFINED WAMR_BUILD_AOT)
set (WAMR_BUILD_AOT 1)
endif ()
if (NOT DEFINED WAMR_BUILD_LIBC_BUILTIN)
set (WAMR_BUILD_LIBC_BUILTIN 1)
endif ()
if (NOT DEFINED WAMR_BUILD_APP_FRAMEWORK)
set (WAMR_BUILD_APP_FRAMEWORK 0)
endif ()
# Set the compile time variable so that the right binary is selected
add_compile_options(-DWAMR_BUILD_INTERP=${WAMR_BUILD_INTERP})
set(WAMR_ROOT_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../../..)
include(${WAMR_ROOT_DIR}/build-scripts/runtime_lib.cmake)
# define WAMR as library and provide it the esp-idf srcs
add_library(vmlib ${WAMR_RUNTIME_LIB_SOURCE})
target_link_libraries(vmlib PUBLIC idf::pthread idf::${IDF_TARGET} idf::freertos)
# Define the final executable
set(elf_file ${CMAKE_PROJECT_NAME}.elf)
add_executable(${elf_file} main.c iwasm_main.c)
# Link the static libraries to the executable
target_link_libraries(${elf_file} idf::esp32 idf::freertos idf::spi_flash vmlib)
add_executable(${elf_file} main.c test_wasm.h)
target_link_libraries(${elf_file} idf::${IDF_TARGET} idf::freertos idf::spi_flash vmlib)
idf_build_executable(${elf_file})

View File

@ -0,0 +1,4 @@
rm -rf build && mkdir build && cd build
cmake .. -DCMAKE_TOOLCHAIN_FILE=$IDF_PATH/tools/cmake/toolchain-esp32c3.cmake -DIDF_TARGET=esp32c3 -DCMAKE_BUILD_TYPE=Release -GNinja
cmake --build .
ninja flash

View File

@ -1,105 +0,0 @@
/*
* Copyright (C) 2019 Intel Corporation. All rights reserved.
* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
*/
#include "bh_platform.h"
#include "wasm_export.h"
#include "test_wasm.h"
#define CONFIG_GLOBAL_HEAP_BUF_SIZE 131072
#define CONFIG_APP_STACK_SIZE 8192
#define CONFIG_APP_HEAP_SIZE 8192
static int app_argc;
static char **app_argv;
static void *
app_instance_main(wasm_module_inst_t module_inst)
{
const char *exception;
wasm_application_execute_main(module_inst, app_argc, app_argv);
if ((exception = wasm_runtime_get_exception(module_inst)))
os_printf("%s\n", exception);
return NULL;
}
static char global_heap_buf[CONFIG_GLOBAL_HEAP_BUF_SIZE] = { 0 };
void
iwasm_main(void)
{
uint8 *wasm_file_buf = NULL;
uint32 wasm_file_size;
wasm_module_t wasm_module = NULL;
wasm_module_inst_t wasm_module_inst = NULL;
RuntimeInitArgs init_args;
char error_buf[128];
#if WASM_ENABLE_LOG != 0
int log_verbose_level = 2;
#endif
os_printf("### iwasm main begin\n");
memset(&init_args, 0, sizeof(RuntimeInitArgs));
init_args.mem_alloc_type = Alloc_With_Pool;
init_args.mem_alloc_option.pool.heap_buf = global_heap_buf;
init_args.mem_alloc_option.pool.heap_size = sizeof(global_heap_buf);
/* initialize runtime environment */
if (!wasm_runtime_full_init(&init_args)) {
os_printf("Init runtime environment failed.\n");
return;
}
os_printf("### wasm runtime initialized.\n");
#if WASM_ENABLE_LOG != 0
bh_log_set_verbose_level(log_verbose_level);
#endif
/* load WASM byte buffer from byte buffer of include file */
wasm_file_buf = (uint8 *)wasm_test_file;
wasm_file_size = sizeof(wasm_test_file);
/* load WASM module */
if (!(wasm_module = wasm_runtime_load(wasm_file_buf, wasm_file_size,
error_buf, sizeof(error_buf)))) {
os_printf("%s\n", error_buf);
goto fail1;
}
os_printf("### wasm runtime load module success.\n");
/* instantiate the module */
if (!(wasm_module_inst = wasm_runtime_instantiate(
wasm_module, CONFIG_APP_STACK_SIZE, CONFIG_APP_HEAP_SIZE,
error_buf, sizeof(error_buf)))) {
os_printf("%s\n", error_buf);
goto fail2;
}
os_printf("### wasm runtime instantiate module success.\n");
/* invoke the main function */
app_instance_main(wasm_module_inst);
os_printf("### wasm runtime execute app's main function success.\n");
/* destroy the module instance */
wasm_runtime_deinstantiate(wasm_module_inst);
os_printf("### wasm runtime deinstantiate module success.\n");
fail2:
/* unload the module */
wasm_runtime_unload(wasm_module);
os_printf("### wasm runtime unload module success.\n");
fail1:
/* destroy runtime environment */
wasm_runtime_destroy();
os_printf("### wasm runtime destroy success.\n");
}

View File

@ -2,38 +2,104 @@
* Copyright (C) 2019 Intel Corporation. All rights reserved.
* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
*/
#include <stdio.h>
#include "freertos/FreeRTOS.h"
#include "freertos/task.h"
#include "wasm_export.h"
#include "bh_platform.h"
#include "test_wasm.h"
extern void
iwasm_main(void);
static void
wamr_task(void *param)
static void *
app_instance_main(wasm_module_inst_t module_inst)
{
os_printf("WAMR task started\n");
const char *exception;
iwasm_main();
wasm_application_execute_main(module_inst, 0, NULL);
if ((exception = wasm_runtime_get_exception(module_inst)))
printf("%s\n", exception);
return NULL;
}
while (1) {
task_sleep(1000);
/*os_printf("Hello WAMR\n");*/
void *
iwasm_main(void *arg)
{
(void)arg; /* unused */
/* setup variables for instantiating and running the wasm module */
uint8_t *wasm_file_buf = NULL;
unsigned wasm_file_buf_size = 0;
wasm_module_t wasm_module = NULL;
wasm_module_inst_t wasm_module_inst = NULL;
char error_buf[128];
void *ret;
RuntimeInitArgs init_args;
/* configure memory allocation */
memset(&init_args, 0, sizeof(RuntimeInitArgs));
init_args.mem_alloc_type = Alloc_With_Allocator;
init_args.mem_alloc_option.allocator.malloc_func = (void *)os_malloc;
init_args.mem_alloc_option.allocator.realloc_func = (void *)os_realloc;
init_args.mem_alloc_option.allocator.free_func = (void *)os_free;
printf("wasm_runtime_full_init\n");
/* initialize runtime environment */
if (!wasm_runtime_full_init(&init_args)) {
printf("Init runtime failed.\n");
return NULL;
}
(void)param;
/* load WASM byte buffer from byte buffer of include file */
printf("use an internal test file, that's going to output Hello World\n");
wasm_file_buf = (uint8_t *)wasm_test_file;
wasm_file_buf_size = sizeof(wasm_test_file);
/* load WASM module */
if (!(wasm_module = wasm_runtime_load(wasm_file_buf, wasm_file_buf_size,
error_buf, sizeof(error_buf)))) {
printf("Error in wasm_runtime_load: %s\n", error_buf);
goto fail1;
}
printf("about to call wasm_runtime_instantiate\n");
if (!(wasm_module_inst =
wasm_runtime_instantiate(wasm_module, 32 * 1024, // stack size
32 * 1024, // heap size
error_buf, sizeof(error_buf)))) {
printf("Error while instantiating: %s\n", error_buf);
goto fail2;
}
printf("run main() of the application\n");
ret = app_instance_main(wasm_module_inst);
assert(!ret);
/* destroy the module instance */
printf("wasm_runtime_deinstantiate\n");
wasm_runtime_deinstantiate(wasm_module_inst);
fail2:
/* unload the module */
printf("wasm_runtime_unload\n");
wasm_runtime_unload(wasm_module);
fail1:
/* destroy runtime environment */
printf("wasm_runtime_destroy\n");
wasm_runtime_destroy();
return NULL;
}
static bool
app_init(uint32_t id)
void
app_main(void)
{
os_printf("WAMR init, id: %d\n", id);
task_start("wamr_task", 8192, 4, wamr_task, NULL);
return true;
}
pthread_t t;
int res;
static void
app_exit(uint32_t id)
{
os_printf("WAMR exit, id: %d\n", id);
}
res = pthread_create(&t, NULL, iwasm_main, (void *)NULL);
assert(res == 0);
INTERNAL_APP_DEFINE("WAMR", APP_VERSION(0, 0, 0, 1), 0, app_init, app_exit);
res = pthread_join(t, NULL);
assert(res == 0);
printf("Exiting... \n");
}

View File

@ -1,56 +0,0 @@
# TODO: set WAMR root dir
WAMR_ROOT := ../../..
override PROJECT_CFLAGS := $(PROJECT_CFLAGS) -Wno-unused-parameter -Wno-pedantic
override PROJECT_CFLAGS := $(PROJECT_CFLAGS) -I$(PROJECTS_SRC_ROOT)/include
override PROJECT_CFLAGS := $(PROJECT_CFLAGS) \
-I$(WAMR_INC_ROOT)/core \
-I$(WAMR_INC_ROOT)/core/iwasm/include \
-I$(WAMR_INC_ROOT)/core/iwasm/common \
-I$(WAMR_INC_ROOT)/core/shared/utils \
-I$(WAMR_INC_ROOT)/core/shared/mem-alloc \
-I$(WAMR_INC_ROOT)/core/shared/platform/include \
-I$(WAMR_INC_ROOT)/core/shared/platform/esp-idf \
-I$(WAMR_INC_ROOT)/core/iwasm/interpreter
override PROJECT_CFLAGS := $(PROJECT_CFLAGS) \
-DBH_PLATFORM_ESP_IDF \
-DBH_MALLOC=wasm_runtime_malloc \
-DBH_FREE=wasm_runtime_free \
-DBUILD_TARGET_X86_32 \
-DWASM_ENABLE_INTERP=1 \
-DWASM_ENABLE_FAST_INTERP=0 \
-DWASM_ENABLE_LIBC_BUILTIN=1
override PROJECT_CSRC := $(PROJECT_CSRC) \
$(WAMR_SRC_ROOT)/core/shared/platform/esp-idf/espidf_platform.c \
$(WAMR_SRC_ROOT)/core/shared/platform/esp-idf/espidf_thread.c \
$(WAMR_SRC_ROOT)/core/shared/platform/common/freertos/freertos_malloc.c \
$(WAMR_SRC_ROOT)/core/shared/platform/common/freertos/freertos_thread.c \
$(WAMR_SRC_ROOT)/core/shared/platform/common/freertos/freertos_time.c \
$(WAMR_SRC_ROOT)/core/shared/mem-alloc/mem_alloc.c \
$(WAMR_SRC_ROOT)/core/shared/mem-alloc/ems/ems_kfc.c \
$(WAMR_SRC_ROOT)/core/shared/mem-alloc/ems/ems_hmu.c \
$(WAMR_SRC_ROOT)/core/shared/mem-alloc/ems/ems_alloc.c \
$(WAMR_SRC_ROOT)/core/shared/utils/bh_assert.c \
$(WAMR_SRC_ROOT)/core/shared/utils/bh_common.c \
$(WAMR_SRC_ROOT)/core/shared/utils/bh_hashmap.c \
$(WAMR_SRC_ROOT)/core/shared/utils/bh_list.c \
$(WAMR_SRC_ROOT)/core/shared/utils/bh_log.c \
$(WAMR_SRC_ROOT)/core/shared/utils/bh_vector.c \
$(WAMR_SRC_ROOT)/core/iwasm/libraries/libc-builtin/libc_builtin_wrapper.c \
$(WAMR_SRC_ROOT)/core/iwasm/common/wasm_application.c \
$(WAMR_SRC_ROOT)/core/iwasm/common/wasm_runtime_common.c \
$(WAMR_SRC_ROOT)/core/iwasm/common/wasm_exec_env.c \
$(WAMR_SRC_ROOT)/core/iwasm/common/wasm_native.c \
$(WAMR_SRC_ROOT)/core/iwasm/common/wasm_memory.c \
$(WAMR_SRC_ROOT)/core/iwasm/common/wasm_shared_memory.c \
$(WAMR_SRC_ROOT)/core/iwasm/common/wasm_c_api.c \
$(WAMR_SRC_ROOT)/core/iwasm/common/arch/invokeNative_ia32.s \
$(WAMR_SRC_ROOT)/core/iwasm/interpreter/wasm_interp_classic.c \
$(WAMR_SRC_ROOT)/core/iwasm/interpreter/wasm_loader.c \
$(WAMR_SRC_ROOT)/core/iwasm/interpreter/wasm_runtime.c \
$(WAMR_SRC_ROOT)/product-mini/platforms/esp-idf/iwasm_main.c \
$(WAMR_SRC_ROOT)/product-mini/platforms/esp-idf/main.c

View File

@ -9,6 +9,8 @@
* product-mini/app-samples/hello-world/main.c.
*/
unsigned char __aligned(4) wasm_test_file[] = {
// binary for the interpreter
#if WAMR_BUILD_INTERP != 0
0x00, 0x61, 0x73, 0x6D, 0x01, 0x00, 0x00, 0x00, 0x01, 0x10, 0x03, 0x60,
0x01, 0x7F, 0x01, 0x7F, 0x60, 0x02, 0x7F, 0x7F, 0x01, 0x7F, 0x60, 0x01,
0x7F, 0x00, 0x02, 0x31, 0x04, 0x03, 0x65, 0x6E, 0x76, 0x04, 0x70, 0x75,
@ -43,4 +45,242 @@ unsigned char __aligned(4) wasm_test_file[] = {
0x3A, 0x20, 0x25, 0x73, 0x00, 0x48, 0x65, 0x6C, 0x6C, 0x6F, 0x20, 0x77,
0x6F, 0x72, 0x6C, 0x64, 0x21, 0x00, 0x6D, 0x61, 0x6C, 0x6C, 0x6F, 0x63,
0x20, 0x62, 0x75, 0x66, 0x20, 0x66, 0x61, 0x69, 0x6C, 0x65, 0x64, 0x00
// binary for the xtensa aot compiler
#elif WAMR_BUILD_TARGET_XTENSA != 0
0x00, 0x61, 0x6F, 0x74, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x24, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x5E, 0x00,
0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x78, 0x74, 0x65, 0x6E, 0x73, 0x61, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x38, 0x01, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x40, 0x14, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x41, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
0x39, 0x00, 0x00, 0x00, 0x62, 0x75, 0x66, 0x20, 0x70, 0x74, 0x72, 0x3A,
0x20, 0x25, 0x70, 0x0A, 0x00, 0x31, 0x32, 0x33, 0x34, 0x0A, 0x00, 0x62,
0x75, 0x66, 0x3A, 0x20, 0x25, 0x73, 0x00, 0x48, 0x65, 0x6C, 0x6C, 0x6F,
0x20, 0x77, 0x6F, 0x72, 0x6C, 0x64, 0x21, 0x00, 0x6D, 0x61, 0x6C, 0x6C,
0x6F, 0x63, 0x20, 0x62, 0x75, 0x66, 0x20, 0x66, 0x61, 0x69, 0x6C, 0x65,
0x64, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
0x01, 0x00, 0x00, 0x00, 0x7F, 0x7F, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
0x01, 0x00, 0x00, 0x00, 0x7F, 0x7F, 0x7F, 0x00, 0x01, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x7F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x03, 0x00, 0x00, 0x00, 0x7F, 0x01, 0x41, 0x00, 0x40, 0x14, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x7F, 0x00, 0x41, 0x00, 0x3A, 0x04, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x7F, 0x00, 0x41, 0x00, 0x40, 0x14, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00,
0x65, 0x6E, 0x76, 0x00, 0x04, 0x00, 0x70, 0x75, 0x74, 0x73, 0x00, 0x00,
0x03, 0x00, 0x65, 0x6E, 0x76, 0x00, 0x06, 0x00, 0x6D, 0x61, 0x6C, 0x6C,
0x6F, 0x63, 0x01, 0x00, 0x03, 0x00, 0x65, 0x6E, 0x76, 0x00, 0x06, 0x00,
0x70, 0x72, 0x69, 0x6E, 0x74, 0x66, 0x02, 0x00, 0x03, 0x00, 0x65, 0x6E,
0x76, 0x00, 0x04, 0x00, 0x66, 0x72, 0x65, 0x65, 0x01, 0x00, 0x00, 0x00,
0xFF, 0xFF, 0xFF, 0xFF, 0x01, 0x00, 0x00, 0x00, 0x40, 0x04, 0x00, 0x00,
0x02, 0x00, 0x00, 0x00, 0x40, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x40, 0x14, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x02, 0x00, 0x00, 0x00, 0x70, 0x02, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x36, 0xC1, 0x00, 0x98,
0x62, 0x78, 0x22, 0x82, 0x27, 0x6A, 0x32, 0xC8, 0xE0, 0x0C, 0xD4, 0x37,
0xB9, 0x08, 0xA8, 0x72, 0x0C, 0xEB, 0x37, 0xBA, 0x0F, 0x4D, 0x0B, 0x81,
0xFF, 0xFF, 0xAD, 0x07, 0xBD, 0x04, 0xE0, 0x08, 0x00, 0x0C, 0x02, 0x1D,
0xF0, 0xB9, 0x51, 0x49, 0x81, 0xA9, 0x61, 0x99, 0x91, 0x89, 0xC1, 0x68,
0x32, 0x82, 0x27, 0x64, 0x89, 0xB1, 0x82, 0x27, 0x62, 0x89, 0x71, 0x82,
0x27, 0x56, 0x89, 0xA1, 0x0C, 0x05, 0x32, 0x67, 0x6A, 0x52, 0x46, 0x03,
0x52, 0x46, 0x02, 0x0C, 0x48, 0x89, 0xE1, 0x82, 0x46, 0x01, 0x1C, 0xB8,
0x82, 0x46, 0x00, 0x0C, 0x1C, 0x41, 0xFF, 0xFF, 0xAD, 0x02, 0xBD, 0x05,
0xDD, 0x06, 0xE0, 0x04, 0x00, 0x92, 0xA0, 0xFF, 0x90, 0x8A, 0x10, 0x16,
0xA8, 0x1E, 0x0C, 0x05, 0x52, 0x46, 0x03, 0x52, 0x46, 0x02, 0x88, 0xE1,
0x82, 0x46, 0x01, 0x52, 0x46, 0x00, 0x0C, 0x1B, 0xAD, 0x02, 0xCD, 0x0B,
0x99, 0xD1, 0xDD, 0x06, 0xE0, 0x04, 0x00, 0x98, 0xD1, 0x90, 0x8A, 0x10,
0x16, 0x58, 0x1C, 0x49, 0x41, 0xE8, 0x06, 0x16, 0xCE, 0x17, 0x88, 0xC1,
0x82, 0xC8, 0xF0, 0x0C, 0x24, 0x37, 0xB8, 0x02, 0xC6, 0xDB, 0xFF, 0x98,
0xB1, 0x87, 0xB9, 0x02, 0xC6, 0xD9, 0xFF, 0x98, 0xA1, 0x8A, 0x99, 0x1C,
0x8B, 0x00, 0x0B, 0x40, 0xE0, 0xA0, 0x91, 0xA2, 0x49, 0x03, 0x1C, 0x0C,
0x00, 0x0C, 0x40, 0xE0, 0xA0, 0x91, 0xA2, 0x49, 0x02, 0xE0, 0xA8, 0x41,
0xA9, 0x01, 0xA2, 0x49, 0x01, 0xE2, 0x49, 0x00, 0xC9, 0x11, 0x00, 0x0C,
0x40, 0x80, 0x90, 0x91, 0x92, 0x46, 0x06, 0xB9, 0x21, 0x00, 0x0B, 0x40,
0x80, 0x90, 0x91, 0x92, 0x46, 0x07, 0x82, 0x46, 0x04, 0x80, 0x88, 0x41,
0x82, 0x46, 0x05, 0x0C, 0x05, 0x52, 0x46, 0x02, 0x52, 0x46, 0x03, 0x52,
0x46, 0x00, 0x88, 0xE1, 0x82, 0x46, 0x01, 0x0C, 0x24, 0xAD, 0x02, 0xBD,
0x04, 0xCD, 0x04, 0xDD, 0x06, 0x88, 0x41, 0xE9, 0x31, 0xE0, 0x08, 0x00,
0x88, 0xD1, 0x80, 0x8A, 0x10, 0x16, 0xC8, 0x13, 0xF8, 0x31, 0x4B, 0x8F,
0x98, 0x71, 0x87, 0xB9, 0x02, 0x86, 0xBB, 0xFF, 0x92, 0xA4, 0x11, 0xD8,
0xA1, 0x9A, 0x9D, 0x92, 0x09, 0x00, 0x8A, 0x8D, 0xA2, 0xA4, 0x12, 0xAA,
0xAD, 0xA2, 0x0A, 0x00, 0xA2, 0x48, 0x01, 0x92, 0x48, 0x00, 0xE8, 0xB1,
0xF7, 0xBE, 0x02, 0x06, 0xB3, 0xFF, 0x82, 0xA4, 0x0E, 0x8A, 0x8D, 0x82,
0x08, 0x00, 0x92, 0xA4, 0x0D, 0x9A, 0x9D, 0x92, 0x09, 0x00, 0xA2, 0xA4,
0x10, 0xAA, 0xAD, 0xA2, 0x0A, 0x00, 0xFA, 0xBD, 0xC2, 0xA4, 0x0F, 0xCA,
0xCD, 0xC2, 0x0C, 0x00, 0xC2, 0x4B, 0x02, 0xA2, 0x4B, 0x03, 0x92, 0x4B,
0x00, 0x82, 0x4B, 0x01, 0x37, 0xBE, 0x02, 0x06, 0xA6, 0xFF, 0x88, 0xA1,
0x3A, 0x88, 0xA8, 0x21, 0x00, 0x0A, 0x40, 0xF0, 0x90, 0x91, 0x92, 0x48,
0x03, 0x98, 0x11, 0x00, 0x09, 0x40, 0xF0, 0x90, 0x91, 0x92, 0x48, 0x02,
0x98, 0x01, 0x92, 0x48, 0x01, 0xF2, 0x48, 0x00, 0x30, 0x80, 0x91, 0x82,
0x46, 0x06, 0x00, 0x0A, 0x40, 0x30, 0x80, 0x91, 0x82, 0x46, 0x07, 0x32,
0x46, 0x04, 0x30, 0x88, 0x41, 0x82, 0x46, 0x05, 0x0C, 0x05, 0x52, 0x46,
0x02, 0x52, 0x46, 0x03, 0x1C, 0x38, 0x82, 0x46, 0x00, 0x88, 0xE1, 0x82,
0x46, 0x01, 0x0C, 0x2B, 0xAD, 0x02, 0xCD, 0x0B, 0xDD, 0x06, 0x48, 0x41,
0x3D, 0x0F, 0xE0, 0x04, 0x00, 0x98, 0xD1, 0x90, 0x8A, 0x10, 0x16, 0x78,
0x07, 0x32, 0x46, 0x00, 0x88, 0x21, 0x00, 0x08, 0x40, 0x30, 0x80, 0x91,
0x82, 0x46, 0x03, 0x88, 0x11, 0x00, 0x08, 0x40, 0x30, 0x80, 0x91, 0x82,
0x46, 0x02, 0x88, 0x01, 0x82, 0x46, 0x01, 0x0C, 0x3B, 0x0C, 0x1C, 0xAD,
0x02, 0x5D, 0x09, 0xDD, 0x06, 0xE0, 0x04, 0x00, 0x50, 0x8A, 0x10, 0x0C,
0x05, 0x56, 0xB8, 0x02, 0x46, 0x10, 0x00, 0x0C, 0x05, 0x52, 0x46, 0x03,
0x52, 0x46, 0x02, 0x88, 0xE1, 0x82, 0x46, 0x01, 0x2C, 0x88, 0x82, 0x46,
0x00, 0x0C, 0x1C, 0xAD, 0x02, 0xBD, 0x05, 0x4D, 0x09, 0xDD, 0x06, 0x88,
0x41, 0xE0, 0x08, 0x00, 0x40, 0x8A, 0x10, 0x16, 0xA8, 0x01, 0x7C, 0xF5,
0x48, 0x81, 0x88, 0xC1, 0x98, 0x91, 0x87, 0x39, 0x02, 0x86, 0x72, 0xFF,
0x48, 0x51, 0x98, 0x61, 0x87, 0xB9, 0x02, 0x06, 0x70, 0xFF, 0x82, 0x67,
0x6A, 0x2D, 0x05, 0x1D, 0xF0, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
0x04, 0x00, 0x00, 0x00, 0x47, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x06, 0x00, 0x6D, 0x65, 0x6D, 0x6F,
0x72, 0x79, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00,
0x6D, 0x61, 0x69, 0x6E, 0x01, 0x00, 0x00, 0x00, 0x03, 0x00, 0x0A, 0x00,
0x5F, 0x5F, 0x64, 0x61, 0x74, 0x61, 0x5F, 0x65, 0x6E, 0x64, 0x00, 0x00,
0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x0B, 0x00, 0x5F, 0x5F, 0x68, 0x65,
0x61, 0x70, 0x5F, 0x62, 0x61, 0x73, 0x65, 0x00, 0x05, 0x00, 0x00, 0x00,
0xC8, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x0C, 0x00, 0x00, 0x00, 0x16, 0x00, 0x00, 0x00, 0x26, 0x00, 0x00, 0x00,
0x3A, 0x00, 0x00, 0x00, 0x56, 0x00, 0x00, 0x00, 0x0A, 0x00, 0x2E, 0x72,
0x65, 0x6C, 0x61, 0x2E, 0x74, 0x65, 0x78, 0x74, 0x08, 0x00, 0x2E, 0x6C,
0x69, 0x74, 0x65, 0x72, 0x61, 0x6C, 0x0D, 0x00, 0x2E, 0x72, 0x65, 0x6C,
0x61, 0x2E, 0x6C, 0x69, 0x74, 0x65, 0x72, 0x61, 0x6C, 0x00, 0x11, 0x00,
0x61, 0x6F, 0x74, 0x5F, 0x69, 0x6E, 0x76, 0x6F, 0x6B, 0x65, 0x5F, 0x6E,
0x61, 0x74, 0x69, 0x76, 0x65, 0x00, 0x19, 0x00, 0x61, 0x6F, 0x74, 0x5F,
0x73, 0x65, 0x74, 0x5F, 0x65, 0x78, 0x63, 0x65, 0x70, 0x74, 0x69, 0x6F,
0x6E, 0x5F, 0x77, 0x69, 0x74, 0x68, 0x5F, 0x69, 0x64, 0x00, 0x00, 0x00,
0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
0x1B, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00,
0x01, 0x00, 0x00, 0x00, 0x5D, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x14, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x01, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00
// binary for the riscv aot compiler
#else
0x00, 0x61, 0x6F, 0x74, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x24, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0xF3, 0x00,
0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x72, 0x69, 0x73, 0x63, 0x76, 0x33, 0x32, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x38, 0x01, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x40, 0x14, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x41, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
0x39, 0x00, 0x00, 0x00, 0x62, 0x75, 0x66, 0x20, 0x70, 0x74, 0x72, 0x3A,
0x20, 0x25, 0x70, 0x0A, 0x00, 0x31, 0x32, 0x33, 0x34, 0x0A, 0x00, 0x62,
0x75, 0x66, 0x3A, 0x20, 0x25, 0x73, 0x00, 0x48, 0x65, 0x6C, 0x6C, 0x6F,
0x20, 0x77, 0x6F, 0x72, 0x6C, 0x64, 0x21, 0x00, 0x6D, 0x61, 0x6C, 0x6C,
0x6F, 0x63, 0x20, 0x62, 0x75, 0x66, 0x20, 0x66, 0x61, 0x69, 0x6C, 0x65,
0x64, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
0x01, 0x00, 0x00, 0x00, 0x7F, 0x7F, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
0x01, 0x00, 0x00, 0x00, 0x7F, 0x7F, 0x7F, 0x00, 0x01, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x7F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x03, 0x00, 0x00, 0x00, 0x7F, 0x01, 0x41, 0x00, 0x40, 0x14, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x7F, 0x00, 0x41, 0x00, 0x3A, 0x04, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x7F, 0x00, 0x41, 0x00, 0x40, 0x14, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00,
0x65, 0x6E, 0x76, 0x00, 0x04, 0x00, 0x70, 0x75, 0x74, 0x73, 0x00, 0x00,
0x03, 0x00, 0x65, 0x6E, 0x76, 0x00, 0x06, 0x00, 0x6D, 0x61, 0x6C, 0x6C,
0x6F, 0x63, 0x01, 0x00, 0x03, 0x00, 0x65, 0x6E, 0x76, 0x00, 0x06, 0x00,
0x70, 0x72, 0x69, 0x6E, 0x74, 0x66, 0x02, 0x00, 0x03, 0x00, 0x65, 0x6E,
0x76, 0x00, 0x04, 0x00, 0x66, 0x72, 0x65, 0x65, 0x01, 0x00, 0x00, 0x00,
0xFF, 0xFF, 0xFF, 0xFF, 0x01, 0x00, 0x00, 0x00, 0x40, 0x04, 0x00, 0x00,
0x02, 0x00, 0x00, 0x00, 0x40, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x40, 0x14, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x02, 0x00, 0x00, 0x00, 0x18, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x13, 0x01, 0x01, 0xFC, 0x23, 0x2E, 0x11, 0x02, 0x23, 0x2C, 0x81, 0x02,
0x23, 0x2A, 0x91, 0x02, 0x23, 0x28, 0x21, 0x03, 0x23, 0x26, 0x31, 0x03,
0x23, 0x24, 0x41, 0x03, 0x23, 0x22, 0x51, 0x03, 0x23, 0x20, 0x61, 0x03,
0x23, 0x2E, 0x71, 0x01, 0x23, 0x2C, 0x81, 0x01, 0x23, 0x2A, 0x91, 0x01,
0x23, 0x28, 0xA1, 0x01, 0x23, 0x26, 0xB1, 0x01, 0x83, 0x29, 0x85, 0x00,
0x03, 0xAA, 0x89, 0x1A, 0x83, 0x2A, 0x85, 0x01, 0x93, 0x0B, 0x0A, 0xFE,
0x13, 0x04, 0xD0, 0x00, 0x63, 0xFA, 0x7A, 0x01, 0x93, 0x04, 0x05, 0x00,
0x03, 0x2B, 0xC5, 0x01, 0x13, 0x04, 0xE0, 0x00, 0x63, 0x7A, 0x7B, 0x05,
0x13, 0x85, 0x09, 0x00, 0x93, 0x05, 0x04, 0x00, 0x97, 0x00, 0x00, 0x00,
0xE7, 0x80, 0x00, 0x00, 0x13, 0x05, 0x00, 0x00, 0x83, 0x2D, 0xC1, 0x00,
0x03, 0x2D, 0x01, 0x01, 0x83, 0x2C, 0x41, 0x01, 0x03, 0x2C, 0x81, 0x01,
0x83, 0x2B, 0xC1, 0x01, 0x03, 0x2B, 0x01, 0x02, 0x83, 0x2A, 0x41, 0x02,
0x03, 0x2A, 0x81, 0x02, 0x83, 0x29, 0xC1, 0x02, 0x03, 0x29, 0x01, 0x03,
0x83, 0x24, 0x41, 0x03, 0x03, 0x24, 0x81, 0x03, 0x83, 0x20, 0xC1, 0x03,
0x13, 0x01, 0x01, 0x04, 0x67, 0x80, 0x00, 0x00, 0x03, 0xA9, 0xC4, 0x00,
0x03, 0xAC, 0x89, 0x15, 0x83, 0xAD, 0x89, 0x18, 0x83, 0xAC, 0x09, 0x19,
0x23, 0xA4, 0x79, 0x1B, 0xA3, 0x01, 0x09, 0x00, 0x23, 0x01, 0x09, 0x00,
0x13, 0x04, 0x40, 0x00, 0xA3, 0x00, 0x89, 0x00, 0x13, 0x05, 0xB0, 0x01,
0x23, 0x00, 0xA9, 0x00, 0x13, 0x06, 0x10, 0x00, 0x13, 0x85, 0x04, 0x00,
0x93, 0x05, 0x00, 0x00, 0x93, 0x06, 0x09, 0x00, 0x97, 0x00, 0x00, 0x00,
0xE7, 0x80, 0x00, 0x00, 0x13, 0x75, 0xF5, 0x0F, 0xE3, 0x0C, 0x05, 0xF6,
0xA3, 0x01, 0x09, 0x00, 0x23, 0x01, 0x09, 0x00, 0xA3, 0x00, 0x89, 0x00,
0x23, 0x00, 0x09, 0x00, 0x93, 0x05, 0x10, 0x00, 0x13, 0x06, 0x10, 0x00,
0x13, 0x85, 0x04, 0x00, 0x93, 0x06, 0x09, 0x00, 0x97, 0x00, 0x00, 0x00,
0xE7, 0x80, 0x00, 0x00, 0x13, 0x75, 0xF5, 0x0F, 0xE3, 0x04, 0x05, 0xF4,
0x03, 0x2D, 0x09, 0x00, 0x63, 0x08, 0x0D, 0x18, 0x13, 0x05, 0x0A, 0xFF,
0xB3, 0x35, 0x75, 0x01, 0x33, 0xB6, 0xAC, 0x00, 0xB3, 0xE5, 0xC5, 0x00,
0x13, 0x04, 0x20, 0x00, 0xE3, 0x9C, 0x05, 0xF0, 0xB3, 0x05, 0xAC, 0x00,
0x13, 0x56, 0x8D, 0x01, 0x23, 0x24, 0xC1, 0x00, 0xA3, 0x81, 0xC5, 0x00,
0x13, 0x56, 0x0D, 0x01, 0x23, 0x22, 0xC1, 0x00, 0x23, 0x81, 0xC5, 0x00,
0x13, 0x56, 0x8D, 0x00, 0x23, 0x20, 0xC1, 0x00, 0xA3, 0x80, 0xC5, 0x00,
0x23, 0x80, 0xA5, 0x01, 0x23, 0x01, 0x09, 0x00, 0xA3, 0x01, 0x09, 0x00,
0x23, 0x00, 0x09, 0x00, 0x93, 0x05, 0x40, 0x00, 0xA3, 0x00, 0xB9, 0x00,
0x93, 0x55, 0x05, 0x01, 0x23, 0x03, 0xB9, 0x00, 0x93, 0x55, 0x85, 0x01,
0xA3, 0x03, 0xB9, 0x00, 0x23, 0x02, 0xA9, 0x00, 0x13, 0x55, 0x85, 0x00,
0xA3, 0x02, 0xA9, 0x00, 0x93, 0x05, 0x20, 0x00, 0x13, 0x06, 0x20, 0x00,
0x13, 0x04, 0x20, 0x00, 0x13, 0x85, 0x04, 0x00, 0x93, 0x06, 0x09, 0x00,
0x97, 0x00, 0x00, 0x00, 0xE7, 0x80, 0x00, 0x00, 0x13, 0x75, 0xF5, 0x0F,
0xE3, 0x04, 0x05, 0xEA, 0x13, 0x05, 0x4D, 0x00, 0xE3, 0xE8, 0xAD, 0xE8,
0x83, 0x05, 0x2C, 0x41, 0x03, 0x46, 0x1C, 0x41, 0x33, 0x05, 0xAC, 0x00,
0xA3, 0x00, 0xB5, 0x00, 0x23, 0x00, 0xC5, 0x00, 0xE3, 0xEC, 0xAC, 0xE7,
0x03, 0x45, 0xEC, 0x40, 0x83, 0x45, 0xFC, 0x40, 0x03, 0x46, 0x0C, 0x41,
0x83, 0x46, 0xDC, 0x40, 0x33, 0x07, 0xAC, 0x01, 0x23, 0x01, 0xB7, 0x00,
0xA3, 0x01, 0xC7, 0x00, 0x23, 0x00, 0xD7, 0x00, 0xA3, 0x00, 0xA7, 0x00,
0xE3, 0xE8, 0x7C, 0xE5, 0x33, 0x05, 0x7C, 0x01, 0x03, 0x24, 0x81, 0x00,
0xA3, 0x01, 0x85, 0x00, 0x03, 0x2C, 0x41, 0x00, 0x23, 0x01, 0x85, 0x01,
0x83, 0x2C, 0x01, 0x00, 0xA3, 0x00, 0x95, 0x01, 0x23, 0x00, 0xA5, 0x01,
0x23, 0x01, 0x09, 0x00, 0xA3, 0x01, 0x09, 0x00, 0x13, 0x05, 0x30, 0x01,
0x23, 0x00, 0xA9, 0x00, 0x13, 0x05, 0x40, 0x00, 0xA3, 0x00, 0xA9, 0x00,
0x13, 0xD5, 0x0B, 0x01, 0x23, 0x03, 0xA9, 0x00, 0x13, 0xD5, 0x8B, 0x01,
0xA3, 0x03, 0xA9, 0x00, 0x23, 0x02, 0x79, 0x01, 0x13, 0xD5, 0x8B, 0x00,
0xA3, 0x02, 0xA9, 0x00, 0x93, 0x05, 0x20, 0x00, 0x13, 0x06, 0x20, 0x00,
0x13, 0x85, 0x04, 0x00, 0x93, 0x06, 0x09, 0x00, 0x97, 0x00, 0x00, 0x00,
0xE7, 0x80, 0x00, 0x00, 0x13, 0x75, 0xF5, 0x0F, 0xE3, 0x06, 0x05, 0xDE,
0x23, 0x00, 0xA9, 0x01, 0xA3, 0x01, 0x89, 0x00, 0x23, 0x01, 0x89, 0x01,
0xA3, 0x00, 0x99, 0x01, 0x93, 0x05, 0x30, 0x00, 0x13, 0x06, 0x10, 0x00,
0x13, 0x85, 0x04, 0x00, 0x93, 0x06, 0x09, 0x00, 0x97, 0x00, 0x00, 0x00,
0xE7, 0x80, 0x00, 0x00, 0x93, 0x75, 0xF5, 0x0F, 0x13, 0x05, 0x00, 0x00,
0x63, 0x92, 0x05, 0x04, 0x6F, 0xF0, 0x9F, 0xDB, 0xA3, 0x01, 0x09, 0x00,
0x23, 0x01, 0x09, 0x00, 0x13, 0x05, 0x40, 0x00, 0xA3, 0x00, 0xA9, 0x00,
0x13, 0x05, 0x80, 0x02, 0x23, 0x00, 0xA9, 0x00, 0x13, 0x06, 0x10, 0x00,
0x13, 0x85, 0x04, 0x00, 0x93, 0x05, 0x00, 0x00, 0x93, 0x06, 0x09, 0x00,
0x97, 0x00, 0x00, 0x00, 0xE7, 0x80, 0x00, 0x00, 0x93, 0x75, 0xF5, 0x0F,
0x13, 0x05, 0xF0, 0xFF, 0xE3, 0x8C, 0x05, 0xD6, 0x13, 0x04, 0xD0, 0x00,
0xE3, 0xF0, 0x4A, 0xD7, 0x13, 0x04, 0xE0, 0x00, 0xE3, 0x6C, 0x4B, 0xD5,
0x23, 0xA4, 0x49, 0x1B, 0x6F, 0xF0, 0x5F, 0xD6, 0x03, 0x00, 0x00, 0x00,
0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
0x04, 0x00, 0x00, 0x00, 0x47, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x06, 0x00, 0x6D, 0x65, 0x6D, 0x6F,
0x72, 0x79, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00,
0x6D, 0x61, 0x69, 0x6E, 0x01, 0x00, 0x00, 0x00, 0x03, 0x00, 0x0A, 0x00,
0x5F, 0x5F, 0x64, 0x61, 0x74, 0x61, 0x5F, 0x65, 0x6E, 0x64, 0x00, 0x00,
0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x0B, 0x00, 0x5F, 0x5F, 0x68, 0x65,
0x61, 0x70, 0x5F, 0x62, 0x61, 0x73, 0x65, 0x00, 0x05, 0x00, 0x00, 0x00,
0xCC, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x0C, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00, 0x3C, 0x00, 0x00, 0x00,
0x0A, 0x00, 0x2E, 0x72, 0x65, 0x6C, 0x61, 0x2E, 0x74, 0x65, 0x78, 0x74,
0x19, 0x00, 0x61, 0x6F, 0x74, 0x5F, 0x73, 0x65, 0x74, 0x5F, 0x65, 0x78,
0x63, 0x65, 0x70, 0x74, 0x69, 0x6F, 0x6E, 0x5F, 0x77, 0x69, 0x74, 0x68,
0x5F, 0x69, 0x64, 0x00, 0x11, 0x00, 0x61, 0x6F, 0x74, 0x5F, 0x69, 0x6E,
0x76, 0x6F, 0x6B, 0x65, 0x5F, 0x6E, 0x61, 0x74, 0x69, 0x76, 0x65, 0x00,
0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
0x68, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x00, 0x00,
0x01, 0x00, 0x00, 0x00, 0xEC, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x13, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x1C, 0x01, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
0xBC, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x00, 0x00,
0x02, 0x00, 0x00, 0x00, 0x78, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x13, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0xA8, 0x02, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
0xE8, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x00, 0x00,
0x02, 0x00, 0x00, 0x00
#endif
};

View File

@ -10,16 +10,17 @@
extern "C" {
#endif
/* clang-format off */
typedef char int8_t;
typedef short int int16_t;
typedef int int32_t;
typedef long int int64_t;
typedef long long int int64_t;
/* Unsigned. */
typedef unsigned char uint8_t;
typedef unsigned short int uint16_t;
typedef unsigned int uint32_t;
typedef unsigned long int uint64_t;
typedef unsigned char uint8_t;
typedef unsigned short int uint16_t;
typedef unsigned int uint32_t;
typedef unsigned long long int uint64_t;
typedef __INTPTR_TYPE__ intptr_t;
typedef __UINTPTR_TYPE__ uintptr_t;
@ -40,6 +41,7 @@ typedef __UINTPTR_TYPE__ uintptr_t;
# define UINT16_MAX (65535)
# define UINT32_MAX (4294967295U)
# define UINT64_MAX (__UINT64_C(18446744073709551615))
/* clang-format on */
#ifdef __cplusplus
}