Commit Graph

689 Commits

Author SHA1 Message Date
Qiang
4cd88a96d5
Add more types and APIs for attr_container (#1841)
Add more types for attr_container, e.g. uint8, uint32, uint64
Add more APIs for attr_container for int8, int16 and int32 types
Rename fields of the union 'jvalue' and refactor some files that use attr_container
2023-01-09 21:05:30 +08:00
Wenyong Huang
1f4580fbd8
Enable CI wasi test suite for x86-32 classic/fast interpreter (#1866)
The original CI didn't actually run wasi test suite for x86-32 since the `TEST_ON_X86_32=true`
isn't written into $GITHUB_ENV.

And refine the error output when failed to link import global.
2023-01-06 17:31:39 +08:00
liang.he
7401718311
Report error in instantiation when meeting unlinked import globals (#1859) 2023-01-06 15:24:11 +08:00
Wenyong Huang
0c4402293d
Refine Windows thread waiting list operations (#1853)
Add thread_wait_list_end node for thread data and cond for Windows platform
to speedup the thread join and cond wait operations: no need to traverse the
wait list to get the end node to append the wait node.
2023-01-06 14:51:07 +08:00
liang.he
bf2be805f9
Add more checks about the imports of wasm_instance_new (#1843)
Check whether the `imports` argument is NULL in wasm_instance_new and check
the import count of each kind.

Fix issue reported by https://github.com/bytecodealliance/wasm-micro-runtime/issues/1833
2023-01-03 17:16:49 +08:00
Huang Qi
d5aa354d41
Return result directly if float cmp is called in AOT XIP (#1851) 2022-12-30 16:45:39 +08:00
Huang Qi
d309091706
Register missing symbols for f32 to 64 bit integer conversion (#1850) 2022-12-30 15:21:25 +08:00
Wenyong Huang
0090d3e3fc
Fix issue of resolving func name in custom name section (#1849)
Should use import_function_count but not import_count to calculate
the func_index in handle_name_section when custom name section
feature is enabled.

And clear the compile warnings of mini loader.
2022-12-30 14:37:04 +08:00
Huang Qi
d1fe589d43
Fix fmin/fmax in AOT XIP intrinsics (#1848) 2022-12-29 18:48:55 +08:00
Huang Qi
41eb938a95
Fix equal check in AOT XIP float cmp intrinsic (#1847) 2022-12-29 18:11:05 +08:00
Huang Qi
6c7ca90229
Use float version library routine for XIP aot_intrinsic_xxx APIs (#1846) 2022-12-29 16:49:27 +08:00
Huang Qi
b5f8a2bd08
Add missing soft float intrinsics for risc-v AOT (#1845) 2022-12-29 16:00:33 +08:00
liang.he
676c3c7b04
Fix failure about preopen of reactor modules (#1816)
Support modes:
- run a commander module only
- run a reactor module only
- run a commander module and a/multiple reactor modules together
  commander propagates WASIArguments to reactors
2022-12-27 12:59:17 +08:00
tonibofarull
ba5cdbee3a
Fix typo verify_module in aot_compiler.c (#1836) 2022-12-26 12:24:23 +08:00
TianlongLiang
2953614cb8
Port WAMR to the FreeBSD platform and update the document (#1825) 2022-12-24 10:11:10 +08:00
YAMAMOTO Takashi
d04f3988c3
libc-wasi: Fix spurious poll timeout (#1824)
This reverts the "Fix libc-wasi poll_oneoff hang issue" change.
https://github.com/bytecodealliance/wasm-micro-runtime/pull/1300
2022-12-21 17:29:29 +08:00
Wenyong Huang
14288f59b0
Implement Multi-tier JIT (#1774)
Implement 2-level Multi-tier JIT engine: tier-up from Fast JIT to LLVM JIT to
get quick cold startup by Fast JIT and better performance by gradually
switching to LLVM JIT when the LLVM JIT functions are compiled by the
backend threads.

Refer to:
https://github.com/bytecodealliance/wasm-micro-runtime/issues/1302
2022-12-19 11:24:46 +08:00
Wenyong Huang
fb8727ba68
Update release notes and fix issues reported by Coverity (#1813) 2022-12-16 14:16:58 +08:00
Wenyong Huang
97d2b5a060
Publish the docker image with tar/zip files (#1808)
And fix issue found in fast jit call indirect.
2022-12-14 09:42:03 +08:00
Callum Macmillan
ca0b5cf816
Fix watchpoint segfault when using debug interp without server (#1806) 2022-12-13 15:16:43 +08:00
liang.he
294a625fe5
Use boringssl instead of openssl to implement wasm cache loading (#1804) 2022-12-13 14:23:37 +08:00
dongsheng28849455
9083334f69
Fix XIP issue of handling 64-bit const in 32-bit target (#1803)
- Handle i64 const like f64 const
- Ensure i64/f64 const is stored on 8-byte aligned address
2022-12-13 12:45:26 +08:00
Huang Qi
ef4e795dba
Implement i32.div_s (#1792) 2022-12-13 10:48:51 +08:00
Wenyong Huang
0d9e527fa0
Upgrade version number to 1.1.2 (#1788)
Upgrade version number to 1.1.2, update RELEASE_NOTES.md and
clear several compile warnings.
2022-12-08 12:21:34 +08:00
Huang Qi
f6bef1e604
Implement i32.rem_s and i32.rem_u intrinsic (#1789) 2022-12-08 09:38:20 +08:00
Callum Macmillan
c3d66f916e
Add memory watchpoint support for source debugger (#1762)
Allow to add watchpoints to variables for source debugging. For instance:
`breakpoint set variable var`
will pause WAMR execution when the address at var is written to.
Can also set read/write watchpoints by passing r/w flags. This will pause
execution when the address at var is read:
`watchpoint set variable -w read var`

Add two linked lists for read/write watchpoints. When the debug message
handler receives a watchpoint request, it adds/removes to one/both of these
lists. In the interpreter, when an address is read or stored to, check whether
the address is in these lists. If so, throw a sigtrap and suspend the process.
2022-12-07 17:18:28 +08:00
Wenyong Huang
9d52960e4d
Fix wasm-c-api import func link issue in wasm_instance_new (#1787)
When a wasm module is duplicated instantiated with wasm_instance_new,
the function import info of the previous instantiation may be overwritten by
the later instantiation, which may cause unexpected behavior.

Store the function import info into the module instance to fix the issue.
2022-12-07 16:43:04 +08:00
liang.he
f6d67c1cda
Enable wasm cache loading in wasm-c-api (#1759)
Use sha256 to hash binary file content. If the incoming wasm binary is
cached before, wasm_module_new() simply returns the existed one.

Use -DWAMR_BUILD_WASM_CACHE=0/1 to control the feature.
OpenSSL 1.1.1 is required if the feature is enabled.
2022-12-05 12:25:26 +08:00
liang.he
84a23d43ec
wasm-c-api: Fix init/destroy thread env multiple times issue (#1766)
Record the store number of current thread with struct thread_local_stores
or tls thread_local_stores_num to fix the issue:
- Only call wasm_runtime_init_thread_env() in the first wasm_store_new of
  current thread
- Only call wasm_runtime_destroy_thread_env() in the last wasm_store_delete
  of current thread

And remove the unused store list in the engine.
2022-12-05 11:16:14 +08:00
YAMAMOTO Takashi
822a8a5e66
wasm_native.c: Fix build with certain combinations of options (#1778)
Fix a regression in https://github.com/bytecodealliance/wasm-micro-runtime/pull/1756
2022-12-02 11:41:40 +08:00
Andy
191e4a8663
Add ARM aeabi memcpy/memmove/memset symbols for AOT bulk memory ops (#1777) 2022-12-02 10:18:20 +08:00
liang.he
fc8f70cfa4
Fix issues detected by Coverity (#1776)
- wasm_func_call always return trap if failed
- in Debug, always run LEAK_TEST in samples/wasm-c-api
2022-12-01 22:03:09 +08:00
Wenyong Huang
1652f22a77
Fix issues reported by Coverity (#1775)
Fix some issues reported by Coverity and fix windows exception
check with guard page issue
2022-12-01 19:24:13 +08:00
Wenyong Huang
ce3458da99
Refine AOT exception check when function return (#1752)
Refine AOT exception check in the caller when returning from callee function,
remove the exception check instructions when hw bound check is enabled to
improve the performance: create guard page to trigger signal handler when
exception occurs.
2022-11-30 20:18:28 +08:00
Wenyong Huang
7cb1ebc771
Fix compile warning in wasm_shared_memory.c (#1772) 2022-11-30 18:17:41 +08:00
Andy
3e8927a31b
Adding option to pass user data to allocator functions (#1765)
Add an option to pass user data to the allocator functions. It is common to
do this so that the host embedder can pass a struct as user data and access
that struct from the allocator, which gives the host embedder the ability to
do things such as track allocation statistics within the allocator.

Compile with `cmake -DWASM_MEM_ALLOC_WITH_USER_DATA=1` to enable
the option, and the allocator functions provided by the host embedder should
be like below (an extra argument `data` is added):
void *malloc(void *data, uint32 size) { .. }
void *realloc(void *data, uint32 size) { .. }
void free(void *data, void *ptr) { .. }

Signed-off-by: Andrew Chambers <ncham@amazon.com>
2022-11-30 16:19:18 +08:00
liang.he
216b2cb540
Fix a typo in workflow (#1760) 2022-11-30 14:00:30 +08:00
Marcin Kolny
f8701560df
Fix warnings in the posix socket implementation (#1768) 2022-11-29 20:04:07 +08:00
Marcin Kolny
4cbfeec1f5
Fix scenario where the timeout for atomic wait is set to negative number (#1767)
The code, when received -1, performed -1/1000 operation which rounds to 0,
i.e. no wait (instead of infinite wait)
2022-11-29 18:45:07 +08:00
guangyuhu
8d2aedca77
Compile WAMR on platforms that don't support IPV6 (#1754)
Modify posix_socket.c to support compile WAMR on platforms
that don't support IPV6
2022-11-29 07:45:25 +08:00
TianlongLiang
be7a4abee2
Fix source debugger error handling: continue executing when detached (#1725)
Change main thread hangs when encounter debugger encounters error to
main thread exits when debugger encounters error
Change main thread blocks when debugger detaches to
main thread continues executing when debugger detaches, and main thread
exits normally when finishing executing
2022-11-28 22:12:46 +08:00
Wenyong Huang
12bcc20710
Implement invokeNative asm code for MinGW (#1753)
And update the document of building iwasm for MinGW.
2022-11-28 17:48:06 +08:00
Wenyong Huang
ec5ab8274d
Fix zephyr sample build errors (#1757) 2022-11-28 11:23:51 +08:00
Huang Qi
93d3d09aa1
Clear some warnings and enable -Werror for NuttX (#1756) 2022-11-28 09:44:33 +08:00
Andy
1465901f6f
Create trap for error message when wasm_instance_new fails (#1751)
Create trap for error message when wasm_instance_new fails:
- Similar to [this PR](https://github.com/bytecodealliance/wasm-micro-runtime/pull/1526),
   but create a wasm_trap_t to output the error msg instead of adding error_buf to the API.
- Trap will need to be deleted by the caller but is not a breaking change as it is only
   created if trap is not NULL.
- Add error messages for all failure cases here, try to make them accurate but welcome
  feedback for improvements.

Signed-off-by: Andrew Chambers <ncham@amazon.com>
2022-11-25 17:45:19 +08:00
Wenyong Huang
96570cca22
Remove unused LLVM JIT wapper functions (#1747)
Only create the necessary wrapper functions for LLVM JIT
2022-11-25 11:26:08 +08:00
Huang Qi
0456043d8d
Fix missing intrinsics for risc-v which were reported by spec test (#1750) 2022-11-25 09:20:38 +08:00
liang.he
eaedceca2f
Add bh_print_proc_mem() to dump memory info of current process (#1734)
Only support Posix platforms currently, read memory consumption info from
file "/proc/self/status".
2022-11-25 08:33:44 +08:00
Wenyong Huang
29b76dd275
Create module hash for each module in SGX lib-rats (#1745)
Current SGX lib-rats wasm module hash is stored in a global buffer,
which may be overwritten if there are multiple wasm module loadings.
We move the module hash into the enclave module to resolve the issue.

And rename the SGX_IPFS macro/variable in Makefile and Enclave.edl to
make the code more consistent.

And refine the sgx-ra sample document.
2022-11-24 21:48:50 +08:00
YAMAMOTO Takashi
1032aac60b
Add wasm_runtime_get_wasi_exit_code (#1748)
Refer to https://github.com/bytecodealliance/wasm-micro-runtime/issues/1738
2022-11-24 20:26:18 +08:00