Commit Graph

581 Commits

Author SHA1 Message Date
YAMAMOTO Takashi
ebcbe0b571
wasm_application.c: Do not start debug instance automatically (#1407)
Leave the control from wasm_application_execute_main to host embedders,
eg. product-mini.
2022-08-24 20:50:26 +08:00
Qiang
1dcc59f234
Fix fast jit destroy entry/exit basic block issue in jit_cc_destroy (#1401)
The entry and exit basic blocks might be destroyed before they are created.
Found by instrument test. Add checks to fix the issue.
2022-08-24 17:56:38 +08:00
YAMAMOTO Takashi
5586f7b82d
source debug: Remove unused platform_port (#1403) 2022-08-24 16:39:32 +08:00
Wenyong Huang
08eeeb748c
Add more fast jit fixed virtual regs (#1409)
Add fast jit fixed virtual register import_func_ptrs_reg and func_type_indexes_reg
for the preparation of further optimizations.
2022-08-24 14:05:51 +08:00
YAMAMOTO Takashi
f5283399ec
debug: Retire wasm_debug_(get|set)_engine_active mechanism (#1404)
They are no longer necessary because we no longer create
debug instances automatically for exec env at this layer.
2022-08-24 12:15:37 +08:00
Xu Jun
28d9fb60d2
Add missing symbols for arc aot relocation (#1408) 2022-08-23 17:38:55 +08:00
Wenyong Huang
ccd627d2c6
Fix linear memory page count issues (#1380)
Fix issue reported in #1289 and #1371.
Enable to set the max page count to 65536.
2022-08-23 16:05:13 +08:00
Wenyong Huang
e15db8d732
Destroy fast-jit compiler after destroy loaded modules (#1402)
Destroy Fast-JIT compiler after destroying the modules loaded by
multi-module feature, since the Fast JIT's code cache allocator may
be used by these modules. If the Fast JIT's code cache allocator was
destroyed, then runtime will fail to destroy these modules.

And fix the issue of destroying import module's memory instance.
2022-08-22 14:52:33 +08:00
YAMAMOTO Takashi
1fc01fab4b
wasm_create_exec_env_and_call_function: Remove "enable_debug" argument (#1398)
No one uses the `enable_debug` argument after the removal of
wasm_runtime_create_exec_env_and_call_wasm.
2022-08-19 20:28:10 +08:00
YAMAMOTO Takashi
ccd664b81e
wasm_runtime_start_debug_instance: Don't create debug instance for AOT (#1395) 2022-08-19 17:10:50 +08:00
YAMAMOTO Takashi
0ec99e9522
Remove unused wasm_runtime_create_exec_env_and_call_wasm (#1396)
It's unused since the following commit:
  commit 260d36a62d
2022-08-19 15:23:31 +08:00
FromLiQg
a382a02ea9
Fix wasm_type_equal check in wasm_mini_loader.c (#1394)
Fix wasm_type_equal check error in wasm_mini_loader.c:
  wasm_type_equal(type, j) -> wasm_type_equal(type, module->types[j])
And remove unused comments in aot_runtime.h
2022-08-19 12:56:24 +08:00
liang.he
717e8a48e2
Enable the semantic version mechanism for WAMR (#1374)
Use the semantic versioning (https://semver.org) to replace the current date
versioning system, which is more general and is requested by some developers,
e.g. issue #1357.

There are three parts in the new version string:
- major. Any incompatible modification on ABIs and APIs will lead to an increment
  in the value of major, which mainly includes: AOT calling conventions, AOT file
  format, wasm_export.h, wasm_c_api.h, and so on.
- minor. It represents new features, including MVP/POST-MVP features, libraries,
  WAMR private ones, and so one.
- patch. It represents patches.

The new version will start from 1.0.0. Update the help info and version showing for
iwasm and wamrc.
2022-08-18 19:01:05 +08:00
FromLiQg
88bb4f3c81
Normalize wasm types (#1378)
Normalize wasm types, for the two wasm types, if their parameter types
and result types are the same, we only save one copy, so as to reduce
the footprint and simplify the type comparison in opcode CALL_INDIRECT.

And fix issue in interpreter globals_instantiate, and remove used codes.
2022-08-18 17:52:02 +08:00
YAMAMOTO Takashi
12931e7f59
Expose wasm_runtime_get_exec_env_singleton to the API users (#1388)
Sometimes it can be useful to access the singleton.
E.g. use wasm_runtime_set_user_data on it.
2022-08-17 16:13:46 +08:00
Wenyong Huang
6caa6b1d73
Support get return value for SGX os_printf/os_vprintf (#1387)
Fix the issue reported in #1359, change the implementation of
os_printf/os_vprintf for Intel SGX to get the actual bytes written.
2022-08-16 14:23:34 +08:00
dongheng
071b8c2510
esp-idf: Make esp-idf support Libc WASI (#1356)
esp-idf: Make esp-idf support Libc WASI

1. Support to get WASM APP libs' DIR from upper layer
2. Add SSP support for esp-idf platform
3. Change the errno of readlinkat
2022-08-15 16:17:28 +08:00
Xu Jun
3b641b17d8
Reserve one pointer size for fast-interp code_compiled_size (#1382)
Reserve one pointer size for fast-interp code_compiled_size: if the last opcode of
current function is to be dropped (e.g. OP_DROP), the peak memory usage will
be larger than the final code_compiled_size, we record the peak size to ensure
there won't be invalid memory access during the second traversing.
2022-08-15 11:33:20 +08:00
Wenyong Huang
6798637891
Remove some unused codes (#1379)
Remove some unused fields in module instance and the related codes,
which are introduced by emsdk some special mode (-DSIDE_MODULE=1),
and are not required now.
2022-08-15 10:13:37 +08:00
Xu Jun
872cc51881
Fix mini-loader issue (#1383) 2022-08-12 16:35:57 +08:00
Wenyong Huang
b65befd5e7
Fix load type not initialized issue for LLVMBuildLoad2 (#1381)
Fix the issue introduced by #1202, clear the compilation warning
when building wamrc based on LLVM 14/15.
2022-08-12 14:18:47 +08:00
Huang Qi
2178787664
Implement i64.div and i64.rem intrinsics (#1375) 2022-08-12 11:09:06 +08:00
Huang Qi
88cf1e36c1
Support custom stack guard size (#1368)
Add a new option WAMR_BUILD_STACK_GUARD_SIZE to set the custom
stack guard size. For most RTOS systems, we use the native stack base
address as the check boundary which may be not safe as POSIX based
systems (like Linux).
2022-08-12 10:17:11 +08:00
Wenyong Huang
e23acfab36
Fix windows thread data issue and enhance windows os_mmap (#1372)
Thread data should not be destroyed when thread exits, or other thread
may not be able to join it. This PR saves the thread data into thread data
list when thread exits, sets thread status and stores the return value, so
that other thread can join it.

Also set MEM_TOP_DOWN flag for Windows VirtualAlloc to yield LLVM
JIT relocation error.

And set opt/size level to 3 for LLVM JIT for future use, currently the flags
are not used by LLVM JIT.
2022-08-11 16:57:32 +08:00
Xu Jun
4653de90d2
Fix a maybe-uninitialized use warning (#1370)
When `OS_ENABLE_HW_BOUND_CHECK` isn't defined and
`WASM_ENABLE_THREAD_MGR == 0`, the `exec_env` is used
without initialization.
2022-08-10 12:26:17 +08:00
Huang Qi
f3f8d684b3
Implement POSIX semaphore support for linux platform (#1345)
Implement POSIX semaphore support for linux platform
2022-08-08 19:59:46 +08:00
YAMAMOTO Takashi
425efb875f
wasm_c_api.c: improve unimplemented cases (#1355)
ASSERT_NOT_IMPLEMENTED is bh_assert, which might be no-op.
in that case, it's better to fall back to the "default" case,
which reports an error properly.
2022-08-08 16:46:54 +08:00
Wenyong Huang
1fff8d5cbc
Fix wasm loader issues (#1363)
Should not clear last label's polymorphic state after current label is popped
Fix invalid func_idx check in opcode REF_FUNC
Add check when there are extra unneeded bytecodes for a wasm function
2022-08-08 13:22:23 +08:00
Xu Jun
4b00432c1a
Fix dump call stack issue in interpreter (#1358)
Fix dump call stack issue in interpreter introduced by hw bound check:
the call stack isn't dumped if the exception is thrown and caught by
signal handler.
And restore the wasm stack frame to the original status after calling a
wasm function.
2022-08-08 11:15:30 +08:00
Wenyong Huang
6922f3ac68
Implement xtensa XIP (#1202)
Lookup table for i32.const and i64.const for xtensa XIP
Lookup const offset from table for load/store opcodes for xtensa XIP
Fill capability flags for xtensa XIP
Enable lower switch pass for xtensa XIP
2022-08-04 14:42:28 +08:00
dongheng
b75ae3363d
esp32: Support app management and thread (#1350)
Support app management and thread on esp-idf platform:
- Fix compile issues when app management is enabled
- Add missing thread related APIs
2022-08-02 16:37:55 +08:00
Wenyong Huang
bf28030993
Import WAMR Fast JIT (#1343)
Import WAMR Fast JIT which is a lightweight JIT with quick startup, small footprint,
relatively good performance (~40% to ~50% of LLVM JIT) and good portability.

Platforms supported: Linux, MacOS and Linux SGX.
Arch supported: x86-64.
2022-08-02 16:03:50 +08:00
Xu Jun
1c6d10095e
add missing symbol for aot_reloc_arc.c (#1344) 2022-08-02 09:43:52 +08:00
Petr Penzin
c075844001
Add our own legacy loop unswitch pass (#1339)
Since legacy binding for loop unswitch pass was removed and we can't get
it back. Implement its equivalent in `aot_llvm_extra.cpp` and use it in
`aot_compiler.c`.

Follow up to #1183.
2022-07-29 10:29:02 +08:00
yaozhongxiao
efc8bc10a9
[bugfix] initialize "module->retain_function" for wasm_mini_loader (#1333)
Before resolving the module function's export in wasm_mini_loader,
"module->retain_function" need to be initialized, otherwise,
the "__new" function export will lead to abort.

issue: https://github.com/bytecodealliance/wasm-micro-runtime/issues/1332

Co-authored-by: yaozhongxiao <yaozhongxiao@bytedance.com>
2022-07-27 18:01:20 +08:00
Wenyong Huang
8de5168cea
Refine wasm_runtime_call_wasm_a/v (#1326)
Refine wasm_runtime_call_wasm_a/v by adding cache buf
for arguments/results to avoid allocating memory frequently.
2022-07-25 13:53:42 +08:00
Wenyong Huang
dd62b32b20
Fix interp hw bound check issues (#1322)
Fix build script to enable hw bound check for interpreter when
AOT is disabled, so as to enable spec cases test for interp with
hw bound check. And fix the issues found.
2022-07-23 20:39:01 +08:00
Wenyong Huang
fd5030e02e
Implement interpreter hw bound check (#1309)
Implement boundary check with hardware trap for interpreter on
64-bit platforms:
- To improve the performance of interpreter and Fast JIT
- To prepare for multi-tier compilation for the feature

Linux/MacOS/Windows 64-bit are enabled.
2022-07-22 11:05:40 +08:00
Wenyong Huang
32c94161d1
Clear compilation warnings on Windows (#1307) 2022-07-21 09:32:28 +08:00
Wenyong Huang
d955aa1bcc
Fix libc-wasi/uvwasi poll/environ_get issues (#1300)
Fix libc-wasi poll_oneoff hang issue
Fix libc-uvwasi environ_get sanity check issue
2022-07-20 20:02:26 +08:00
liang.he
1ee0d90d81
Add import subtyping validation (#1308)
According to import subtyping validation:
  https://webassembly.github.io/spec/core/valid/types.html#import-subtyping
wasm-c-api needs to check types when linking.
2022-07-20 18:31:19 +08:00
Wenyong Huang
0ec27af9df
Add API wasm_runtime_set_module_inst (#1286)
Add API wasm_runtime_set_module_inst, per request from #1275
2022-07-14 11:36:11 +08:00
Marcin Kolny
d08e13c5ad
Fix socket api verification of addresses in the address pool (#1270)
The existing validation didn't work as expected; e.g. for address
pool: 8.8.8.8/24 the application had access to the 127.0.0.1 address (which
should not).
2022-07-12 16:21:49 +08:00
Wenyong Huang
177aa4fc79
Fix aot rotl/rotr 0 issue (#1285)
Fix the issue reported in #1282.
When i32/i64 rotate (rotl/rotr) with 0, the LLVM IRs translated are:
left<<0 | left>>64 and left >>0 | left<<64
The value of left >> 64 and left <<64 in LLVM are treated as poison,
which causes invalid result when executing the aot function.

Directly return left when right is 0 to fix the issue.
2022-07-12 13:43:56 +08:00
liang.he
0f6e5a55a4
Fix sub module's aux stack info not synchronized to main module issue (#1279)
Sub module's auxiliary stack boundary and bottom may be different from
main module's counterpart, so when calling sub module, its aux stack info
should be gotten and set to exec_env firstly, or aux stack overflow and out
of bounds memory access exception may be thrown when calling sub
module's function.
Fix the issue reported in PR #1278.
2022-07-11 19:42:29 +08:00
Xu Jun
db210fbc66
Remove unnecessary memset after mmap (#1273)
Remove unnecessary memset after mmap to decrease the number of
page faults, as reported in #1269.
2022-07-07 13:53:50 +08:00
YAMAMOTO Takashi
be8ba9e1fd
wasm_export.h: mention module byte buffer mutability (#1271) 2022-07-07 10:06:31 +08:00
Wenyong Huang
daeb7a4265
Don't suppress prev signal handler in hw bound check (#1268)
Enhance the hw bound check reported in #1262:

When registering signal handlers for SIGSEGV & SIGBUS in boundary
check with hardware trap, preserve the previous handlers for signal
SIGSEGV and SIGBUS, and forward the signal to the preserved signal
handlers if it isn't handled by hw bound check.
2022-07-06 16:53:05 +08:00
YAMAMOTO Takashi
653efecd02
debug_engine: Fix a few typos (#1261)
no functional changes are intended.

cf.
https://sourceware.org/gdb/onlinedocs/gdb/General-Query-Packets.html#General-Query-Packets
2022-06-30 15:45:46 +08:00
YAMAMOTO Takashi
2b49a0b817
wasm_cluster_spread_custom_data: Fix a crash when called before exec (#1257) 2022-06-29 13:21:03 +08:00
YAMAMOTO Takashi
d5d6b7284d
Fix a few redefinition warnings for WAMR_BUILD_DEBUG_INTERP=1 (#1256) 2022-06-29 12:23:58 +08:00
Wenyong Huang
625d59191d
Update spec cases to latest version (#1253)
Update spec cases of mvp/threads to latest version, update wabt
to 1.0.29. And enhance the wasm loader.
2022-06-28 16:05:16 +08:00
Wenyong Huang
5e238322c2
Enable aot compiler with llvm-14/15 (#1252)
Enable aot compiler and jit based on llvm-14.0 and llvm-15.0git,
replace LLVMBuildLoad/LLVMBuildInBoundsGEP/LLVMBuildCall with
LLVMBuildLoad2/LLVMBuildInBoundsGEP2/LLVMBuildCall2, and pass
them with related types, so as to meet the requirements of opaque
pointers.

And fix several compilation errors for llvm-14.0/15.0git.

Most spec cases and standalone cases are tested.
2022-06-28 14:53:01 +08:00
YAMAMOTO Takashi
eb3cdaaf32
Fix macro redifinition warning for NuttX (#1250)
Fix the following warning introduced by the recent change.

```
In file included from wamr/core/iwasm/libraries/libc-wasi/sandboxed-system-primitives/src/locking.h:17,
                 from wamr/core/iwasm/libraries/libc-wasi/sandboxed-system-primitives/src/posix.h:18,
                 from wamr/core/iwasm/aot/../common/wasm_runtime_common.h:18,
                 from wamr/core/iwasm/aot/aot_runtime.h:10,
                 from wamr/core/iwasm/aot/aot_loader.c:6:
wamr/core/iwasm/libraries/libc-wasi/sandboxed-system-primitives/src/ssp_config.h:55: error: "CONFIG_HAS_ISATTY" redefined [-Werror]
 #define CONFIG_HAS_ISATTY 1

In file included from wamr/core/shared/utils/../platform/include/platform_common.h:13,
                 from wamr/core/shared/utils/bh_platform.h:9,
                 from wamr/core/iwasm/aot/aot_runtime.h:9,
                 from wamr/core/iwasm/aot/aot_loader.c:6:
wamr/core/shared/platform/nuttx/platform_internal.h:75: note: this is the location of the previous definition
 #define CONFIG_HAS_ISATTY 0
```
2022-06-26 10:06:34 +08:00
Wenyong Huang
114bf9408b
Fix get invokeNative float ret value issue with clang compiler (#1248)
When using clang compiler, the f32/f64 return value might be
invalid when calling invokeNative asm code. Declare the return
type of invokeNative as void, and set volatile for the converted
function pointers to resolve the issue.
2022-06-26 09:33:54 +08:00
Xu Jun
471cac4719
Enable dump call stack to a buffer (#1244)
Enable dump call stack to a buffer, use API
`wasm_runtime_get_call_stack_buf_size` to get the required buffer size
and use API
`wasm_runtime_dump_call_stack_to_buf` to dump call stack to a buffer
2022-06-25 21:38:43 +08:00
Xu Jun
53b775aa4b
Support integrate 3rd-party toolchains into wamrc (#1237)
Support integrating 3rd-party toolchain llc compiler or asm compiler
into wamrc by setting environment variable WAMRC_LLC_COMPILER
or WAMRC_ASM_COMPILER, wamrc will use these tools to generate
object file from LLVM IR firstly, and then refactor the object file into
aot file.
2022-06-20 13:13:41 +08:00
dongsheng28849455
bc6eda2803
Set nuttx isatty definition according to CONFIG_SERIAL_TERMIOS (#1234)
The isatty definition on nuttx depends on CONFIG_SERIAL_TERMIOS
2022-06-20 11:58:48 +08:00
Xu Jun
d0676930dc
Add arc compiler-rt functions and reloc type for mwdt (#1238)
Add arc compiler-rt functions and reloc type for arc MetaWare
Development Toolkit (mwdt), controlled by macro __CCAC__.
2022-06-20 09:03:31 +08:00
liang.he
f975a987bf
Separate MacOS workflows from the big one (#1236)
Separate MacOS workflows from the big one so as to avoid too much tasks
And optimize the total duration by reducing getting LLVM libraries times
2022-06-17 17:44:20 +08:00
dongsheng28849455
cc942e8c68
Add missing aot relocation symbols for xtensa target (#1235)
Some symbols are missing when loading the xtensa aot file.
2022-06-17 15:11:56 +08:00
Xu Jun
4b38205023
Fix some issues reported by klocwork (#1233)
Change memcpy to bh_memcpy_s and add some asserts to
enhance the security.
2022-06-16 19:50:47 +08:00
Xu Jun
188d5e70e9
Fix typo in wasm_mini_loader.c (#1232) 2022-06-16 12:07:32 +08:00
Xu Jun
b39f4c5c9b
Fix drop opcode issue in fast interpreter (#1231)
Fix fast interpreter issue reported in #1230
2022-06-16 09:51:01 +08:00
Xu Jun
e0a8aa09be
Fix build error when enable custom section without interpreter (#1229) 2022-06-15 18:14:39 +08:00
Xu Jun
77595c9560
Support emit specified custom sections into AoT file (#1207)
And add API to get the content of custom section with
section name for both wasm file and aot file.
2022-06-10 21:51:13 +08:00
Xu Jun
93607d0fac
Support print exception info in source debugger (#1212) 2022-06-08 12:17:48 +08:00
YAMAMOTO Takashi
ec299554dd
Remove the code for WASM_ENABLE_GC (#1200)
Remove the code for WASM_ENABLE_GC as it is for a dev branch
2022-06-01 16:46:11 +08:00
Wenyong Huang
5b1dcf2fa2
Implement Go language binding (#1196)
Implement Go binding APIs of runtime, module and instance
Add sample, build scripts and update the document

Co-authored-by: venus-taibai <97893654+venus-taibai@users.noreply.github.com>
2022-06-01 11:35:05 +08:00
YAMAMOTO Takashi
3168ba8dcf
Add comments on trailing uint8[1] members in the "Common" structures (#1189)
Add comments to avoid abusing these members to store extra data.
2022-05-26 11:53:50 +08:00
YAMAMOTO Takashi
3fd763a95c
wasm_export.h: Make RuntimeInitArgs less config dependent (#1190)
This header file is supposed to be used by user code, which is not
a part of WAMR. Usually WAMR configuration is not available there,
remove DEBUG_INTERP macro control in it.
2022-05-25 18:15:51 +08:00
YAMAMOTO Takashi
da3b519642
core/shared/platform/nuttx: mock several APIs for libc-wasi (#1127) 2022-05-24 12:03:40 +08:00
liang.he
565c1c04db
Fix bh_vector extend_vector not locked issue (#1187)
Fix issue that func `extend_vector` isn't locked in vector insert and append.
2022-05-24 09:10:43 +08:00
YAMAMOTO Takashi
723a808106
nuttx: Use text heap for executable memory (#1181)
Based on nuttx patch "Add up_textheap_heapmember":
  https://github.com/apache/incubator-nuttx/pull/6306
2022-05-23 10:58:09 +08:00
YAMAMOTO Takashi
69c23aa2d4
aot_reloc_xtensa.c: define __packed if not available (#1179) 2022-05-21 16:46:02 +08:00
YAMAMOTO Takashi
a50011a4dd
core/iwasm/common/wasm_application.c: Fix a typo of macro (#1180)
Change WAMR_ENABLE_PERF_PROFILING to WASM_ENABLE_PERF_PROFILING
2022-05-21 12:53:11 +08:00
Wenyong Huang
37cc6eac3b
Implement SGX getrandom/getentropy without ocall (#1176)
Implement SGX getrandom with sgx_read_rand and getentropy with `rdseed` instruction
instead of ocall to improve the security.
2022-05-21 12:21:09 +08:00
Wenyong Huang
c72501781a
Fix module_realloc with NULL ptr issue (#1175)
Fix module_realloc with NULL ptr issue reported by #1173.
2022-05-19 11:57:33 +08:00
Wenyong Huang
d7a2888b18
Fix Windows compilation warnings (#1171)
And update the Zephyr platform sample help, add arc target into usage list.
2022-05-16 09:12:58 +08:00
Namhyeon, Go
0993601d55
Add check for stack_min_addr in bound check with hardware trap (#1166)
Add return value check for os_thread_get_stack_boundary before touch_pages
in the initialization of memory access bound check with hardware trap.
2022-05-12 12:23:35 +08:00
Wenyong Huang
3d1dad7792
Fix x86-32 compile warning and update document (#1164) 2022-05-10 15:22:20 +08:00
liang.he
ceaf7dc660
Fix invalid calculation of total size of bytes to send and recv (#1162)
The total size of bytes to send and recv should be set to 0 before calculation,
but not including the size of iovec_app_t structure.
2022-05-10 10:43:34 +08:00
liang.he
3ba2d7e7de
Fix socket-api send/recv issue and c-api sample callback_chain issue (#1158)
Re-implement socket api send/recv in an atomic-like way, fix the return value
check in posix.c.
And fix wasm-c-api sample callback_chain calling malloc issue.
2022-05-09 16:52:43 +08:00
Wenyong Huang
ca4b60b335
Auto dump mem/perf profiling in execute_main/execute_func (#1157)
Automatically dump memory/performance profiling data in
wasm_application_execute_main and wasm_application_execute_func when
the related feature is enabled.

And remove unused aot_compile_wasm_file func declaration in aot_compiler.h.
2022-05-09 15:19:55 +08:00
Xu Jun
474f081f56
Fix return value not checked issue reported by Coverity (#1156)
Fix return value not checked issue in function init_wasm_timer,
reported by Coverity
2022-05-07 19:22:00 +08:00
liang.he
ed512c6867
Fix issues detected by Coverity (#1154)
wasm_c_api.c: add more checks, fix LOG_WARNING invalid specifier
aot_emit_aot_file: fix strncpy max size length to copy
posix.c: fix potential socket not close issue
wasm-c-api samples: add return value checks for fseek/ftell
cJSON.c: remove dead code
2022-05-07 18:53:02 +08:00
Wenyong Huang
2bac6a42a7
Fix some issues reported by Coverity (#1150)
module_wasm_app.c: add return value check for wasm_runtime_call_wasm
aot_runtime.c: add return value check for aot_get_default_memory
aot_runtime.c: add return value check before calling wasm app malloc/free func
wasm_runtime_common.c: fix dead code warning in wasm_runtime_load_from_sections
aot_emit_memory.c: fix potential integer overflow issue
wasm_runtime.c: remove dead code in memory_instantiate, add assertion for globals
samples simple/gui/littlevgl: fix fields of struct sigaction initialization issue
host-tool: add return value check for sendto
2022-05-07 16:51:43 +08:00
Wenyong Huang
d62543c99c
Enlarge max pool size and fix bh_memcpy_s dest max size check (#1151)
Enlarge max pool size and fix bh_memcpy_s dest max size check to support
large linear memory, e.g. with initial page count 65535.
2022-05-07 16:09:16 +08:00
Xu Jun
a7f4c3c15c
Fix app manager/framework issues reported by Coverity (#1155)
runtime_sensor.c: add return value check for os_mutex_init
                             fix find_sensor_client
sensor_mgr_ref.c: add return value check for init_sensor_framework
app_manager_host.c: add return value check for app_manager_host_init
module_wasm_app.c: add bh_assert for m_data
                                   fix mkdir potential issue
sample littlevgl/gui/simple: add return value check for init_sensor_framework
host_tool: add more check for g_conn_fd
2022-05-07 15:43:34 +08:00
YAMAMOTO Takashi
3edb832f76
aot_reloc_arm.c: Implement R_ARM_MOVW_ABS_NC and R_ARM_MOVT_ABS (#1148)
Implement reloc type R_ARM_MOVW_ABS_NC and R_ARM_MOVT_ABS for arm,
refer to:
https://github.com/ARM-software/abi-aa/blob/main/aaelf32/aaelf32.rst#5614static-arm-relocations
2022-05-07 10:22:05 +08:00
YAMAMOTO Takashi
8db6f5978b
aot_emit_aot_file.c: Convert switch lookup table relocation (#1149)
Fix the symbol resolving failure with recent version of wamrc:
```
AOT module load failed: resolve symbol .Lswitch.table.aot _func#82.2 failed
```
Replace the relocations for such symbols with .rodata section.
2022-05-07 08:41:53 +08:00
YAMAMOTO Takashi
6fb402aeec
wasm_export.h: Add a few comments about heap and threads (#1147) 2022-05-06 18:30:48 +08:00
YAMAMOTO Takashi
03f2153270
wasm_runtime_common.c: add assertion for BH_MALLOC/BH_FREE (#1139)
Add assertion for BH_MALLOC/BH_FREE in wasm_runtime_common.c,
when building runtime, the BH_MALLOC/BH_FREE macros should be
defined as wasm_runtime_malloc/wasm_runtime_free.
2022-05-06 13:47:56 +08:00
Xu Jun
16cfd4764d
Fix atomic wait not thread safe issue (#1146)
Add lock for acquire_wait_info and release_wait_info, and
remove release_wait_info in wasm_runtime_atomic_notify.
2022-05-06 12:52:17 +08:00
Wenyong Huang
07829b90d7
Fix allocate zero size memory warning (#1143)
Fix allocate zero size memory warning reported by wasm_runtime_malloc
when allocating the import fun pointers if the import func count is 0:
    `warning: wasm_runtime_malloc with size zero`
2022-05-05 12:43:00 +08:00
Wenyong Huang
749f2f1f34
Fix wamrc build error with llvm-14 (#1140)
Fix aot compiler compilation errors when the llvm version is 14.0,
and clear one compilation warning of thread_manager.c.
2022-05-03 09:12:03 +08:00
Wenyong Huang
c6997aa68a
Fix execute_main not wait for other threads (#1137)
Fix wasm_application_execute_main/wasm_application_execute_func not waiting for
other threads to terminate in multi-thread mode, which causes that the exception
thrown by other threads may haven't been spreaded to current main thread, and
cannot be detected by the caller, as reported in #1131.
2022-04-29 15:47:43 +08:00
YAMAMOTO Takashi
2e27d506d8
posix os_socket_inet_network: Use inet_addr instead of inet_network (#1133) 2022-04-28 13:53:01 +08:00
YAMAMOTO Takashi
d9d0777051
Move dlfcn.h availability check to platform_common.h (#1134) 2022-04-28 12:31:28 +08:00
Xu Jun
98431225f2
Store import function pointer in module instance (#1130)
Fix the issue reported by #1118 , use this approach since it avoids copying
unnecessary static information into instance and reduces the footprint.
2022-04-27 20:21:51 +08:00