Commit Graph

658 Commits

Author SHA1 Message Date
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
Enrico Loparco
4e5529f21f
Reserve TID values for WASI threads (#1862)
According to the [WASI thread specification](https://github.com/WebAssembly/wasi-threads/pull/16),
some thread identifiers are reserved and should not be used. In fact, only IDs between `1` and
`0x1FFFFFFF` are valid.

The thread ID allocator has been moved to a separate class to avoid polluting the
`lib_wasi_threads_wrapper` logic.
2023-01-06 10:28:25 +08:00
Wenyong Huang
3403f0a7f4 Merge main into dev/wasi_threads 2023-01-03 18:15:23 +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
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
e8ce4c542e 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-20 14:37:07 +08:00
Wenyong Huang
7db49db777 Update release notes and fix issues reported by Coverity (#1813) 2022-12-20 14:37:07 +08:00
Wenyong Huang
97fda83c94 Publish the docker image with tar/zip files (#1808)
And fix issue found in fast jit call indirect.
2022-12-20 14:37:07 +08:00
Callum Macmillan
4d0f5cfade Fix watchpoint segfault when using debug interp without server (#1806) 2022-12-20 14:37:07 +08:00
liang.he
b826a84cd6 Use boringssl instead of openssl to implement wasm cache loading (#1804) 2022-12-20 14:37:07 +08:00
dongsheng28849455
d267121c88 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-20 14:37:07 +08:00
Huang Qi
c613866bac Implement i32.div_s (#1792) 2022-12-20 14:37:07 +08:00
Wenyong Huang
8fa7f1c4cf 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-20 14:37:07 +08:00
Huang Qi
bfd57558a7 Implement i32.rem_s and i32.rem_u intrinsic (#1789) 2022-12-20 14:37:07 +08:00
Callum Macmillan
ead6478285 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-20 14:37:07 +08:00
Wenyong Huang
37e9b9c510 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-20 14:37:07 +08:00
Enrico Loparco
0c85cb1fe6
feat(wasi-threads): Improve thread id allocator to reuse identifiers (#1809)
This PR allows reusing thread ids once they are released. That is done by using
a stack data structure to keep track of the used ids.
When a thread is created, it takes an available identifier from the stack. When
the thread exits, it returns the id to the stack of available identifiers.
2022-12-19 19:55:01 +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
Marcin Kolny
0f637cff07
Enable aux stack allocations on application heap (#1799)
This is necessary for WASI threads as the aux stack should be managed by the application.
See https://github.com/bytecodealliance/wasm-micro-runtime/issues/1790 for details.
2022-12-19 10:58:12 +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
Marcin Kolny
929d5942b9
Add implementation for wasi_thread_spawn() (#1786)
For now this implementation uses thread manager.

Not sure whether thread manager is needed in that case. In the future there'll be likely another syscall added (for pthread_exit) and for that we might need some kind of thread management - with that in mind, we keep thread manager for now and will refactor this later if needed.
2022-12-13 21:33:27 +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
Marcin Kolny
684ae6554d
Create a placeholder for WASI threads implementation (#1783)
This a simpler version of the PR: https://github.com/bytecodealliance/wasm-micro-runtime/pull/1638
2022-12-06 21:11:27 +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
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
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
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
dongsheng28849455
c4defb8877
Update xtensa LLVM version to 15.x (#1741)
Fix the issue that xtensa .aot size cannot be over 256K.
2022-11-24 12:48:31 +08:00
dependabot[bot]
2c5e7bc650
Bump tensorflow from 2.10.0 to 2.10.1 in /core/iwasm/libraries/wasi-nn/test (#1735)
Bumps [tensorflow](https://github.com/tensorflow/tensorflow) from 2.10.0 to 2.10.1.
- [Release notes](https://github.com/tensorflow/tensorflow/releases)
- [Changelog](https://github.com/tensorflow/tensorflow/blob/master/RELEASE.md)
- [Commits](https://github.com/tensorflow/tensorflow/compare/v2.10.0...v2.10.1)

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-11-22 16:21:06 +08:00
Wenyong Huang
da7117a092
Refine the stack frame size check in interpreter (#1730)
Limit max_stack_cell_num/max_csp_num to be no larger than UINT16_MAX,
and don't check all_cell_num in interpreter again.

And refine some codes in interpreter.
2022-11-22 15:32:48 +08:00
Zeuson
656a8427e6
linux-sgx: Improve the remote attestation (#1695)
The current implementation of remote attestation does not take into
account the integrity of the wasm module. The SHA256 of the wasm
module has been put into user_data to generate the quote, and more
parameters are exposed for further verification.
2022-11-22 14:45:03 +08:00
Wenyong Huang
87c3195d47
Revert "Implement call Fast JIT function from LLVM JIT jitted code" (#1737)
Reverts bytecodealliance/wasm-micro-runtime#1714, which was merged mistakenly.
2022-11-22 14:04:48 +08:00
Wenyong Huang
440bbea81e
Fix interp/fast-jit float min/max issues (#1733) 2022-11-22 09:14:20 +08:00
Wenyong Huang
89f9d695ed
Fix fast jit issue of translating opcode i32.rem_s/i64.rem_s (#1731) 2022-11-21 16:37:10 +08:00
Wenyong Huang
cf7b01ad82
Implement call Fast JIT function from LLVM JIT jitted code (#1714)
Basically implement the Multi-tier JIT engine.
And update document and wamr-test-suites script.
2022-11-21 10:42:18 +08:00
liang.he
3daa512925
Remove unused export index check in wasm-c-api (#1720) 2022-11-20 18:47:02 +08:00
Huang Qi
4e5ba6f6ef
Fix issue of thumb relocation R_ARM_THM_MOVT_ABS (#1723) 2022-11-19 19:36:02 +08:00
Xu Jun
032b9aa74b
Fix issue of restoring wasm operand stack (#1721) 2022-11-18 18:51:13 +08:00
Wenyong Huang
6c16ff7654
Update document and clear compile warnings (#1701)
Update build wasm app document, add how to set buildflags for Rust
project to reduce the footprint.

Clear Windows warnings and a shadow warning in aot_emit_numberic.c
2022-11-15 15:02:23 +08:00
Wenyong Huang
c70e1ebc3d
Avoid generating some unused LLVM IRs (#1696)
Refine the generated LLVM IRs at the beginning of each LLVM AOT/JIT function
to fasten the LLVM IR optimization:
- Only create argv_buf if there are func calls in this function
- Only create native stack bound if stack bound check is enabled
- Only create aux stack info if there is opcode set_global_aux_stack
- Only create native symbol if indirect_mode is enabled
- Only create memory info if there are memory operations
- Only create func_type_indexes if there is opcode call_indirect
2022-11-14 14:32:35 +08:00
Huang Qi
4b0660cf24
Fix missing float cmp for XIP (#1699) 2022-11-14 11:58:38 +08:00
YAMAMOTO Takashi
ff4ee4a95f
Add comments around wasm_runtime_set_wasi_args (#1692) 2022-11-09 17:18:22 +08:00
liang.he
30ee992762
Add wasm_module_obtain() to clone wasm_module_t (#1660)
Also add support for wasm_shared_module_t, and add lock for
wasm_module_t related operations.

And add wasm-c-api sample threads, update sample clone.
2022-11-09 12:50:58 +08:00
dongsheng28849455
f59ffa0d63
Enable Nuttx spec test option and register aot symbols (#1687)
Enable spec test option on Nuttx platform.
Register sqrt/sqrtf in aot global symbol map and
_fixdfdi/__floatundidf in xtensa symbol map.
2022-11-08 12:42:19 +08:00
Wenyong Huang
7fd37190e8
Add control for the native stack check with hardware trap (#1682)
Add a new options to control the native stack hw bound check feature:
- Besides the original option `cmake -DWAMR_DISABLE_HW_BOUND_CHECK=1/0`,
  add a new option `cmake -DWAMR_DISABLE_STACK_HW_BOUND_CHECK=1/0`
- When the linear memory hw bound check is disabled, the stack hw bound check
   will be disabled automatically, no matter what the input option is
- When the linear memory hw bound check is enabled, the stack hw bound check
  is enabled/disabled according to the value of input option
- Besides the original option `--bounds-checks=1/0`, add a new option
  `--stack-bounds-checks=1/0` for wamrc

Refer to: https://github.com/bytecodealliance/wasm-micro-runtime/issues/1677
2022-11-07 18:26:33 +08:00
Xu Jun
e278861206
Avoid raising exception when debugging with VSCode (#1686) 2022-11-07 11:57:53 +08:00
dongsheng28849455
52ebd98ff4
Fix a build failure error on nuttx (#1675)
NuttX doesn't have SO_REUSEPORT.
2022-11-03 16:29:58 +08:00
Huang Qi
c8cacbd883
Add LLVM_BUILD_OP_OR_INTRINSIC to avoid code dup (#1672) 2022-11-03 11:48:48 +08:00
dongheng
9ba8c8957d
esp-idf: Add socket support for esp-idf platform (#1364)
Support to get/set recv_buf_size/send_buf_size/reuse_port/reuse_addr for wasm app
Add socket APIs for esp-idf platform
Add setsockopt for linux-sgx platform
2022-11-02 18:02:58 +08:00
TianlongLiang
3b4033aceb
Allow source debugger reconnection (#1667)
Allow to wait for a new debugger connection once the previous one
is disconnected:
- when receiving a detach command
- when the client socket is closed (for example, lldb process is killed)
2022-11-02 17:12:34 +08:00
Wenyong Huang
5b144c491d
Avoid initialize LLVM repeatedly (#1671)
Currently we initialize and destroy LLVM environment in aot_create_comp_context
and aot_destroy_comp_context, which are called in wasm_module_load/unload,
and the latter may be invoked multiple times, which leads to duplicated LLVM
initialization/destroy and may result in unexpected behaviors.

Move the LLVM init/destroy into runtime init/destroy to resolve the issue.
2022-11-02 16:13:58 +08:00
liang.he
f1f6f4a125
Remove unused codes in AOT compiler (#1668)
Remove the setup of JIT LLVMOrcIRTransformLayerSetTransform and
LLVMOrcObjectTransformLayerSetTransform which is commented.
2022-11-02 08:32:16 +08:00
Huang Qi
94cecbe4cb
Fix XIP issues of fp to int cast and int rem/div (#1654) 2022-11-01 20:29:07 +08:00
liang.he
a1f7832625
Remove an improper assumption when creating wasm_trap (#1657)
Allow to have multiple stores in an engine and multiple instances
in a store. Letting a wasm_function_t pass its wasm_store_t to make
it more efficient.
2022-11-01 11:56:28 +08:00
Blaine Bublitz
101ea0ea3c
Update libuv version number (#1666)
Update the libuv version to work around a mingw64 bug, refer to:
  https://github.com/libuv/libuv/pull/3345
2022-11-01 11:07:35 +08:00
dongsheng28849455
e517dbc7b2
XIP adaptation for xtensa platform (#1636)
Add macro WASM_ENABLE_WORD_ALING_READ to enable reading
1/2/4 and n bytes data from vram buffer, which requires 4-byte addr
alignment reading.

Eliminate XIP AOT relocations related to the below ones:
   i32_div_u, f32_min, f32_max, f32_ceil, f32_floor, f32_trunc, f32_rint
2022-10-31 17:25:24 +08:00
liang.he
dba9e52f2f
Change wasm-c-api default log level (#1658)
Change wasm-c-api default log level to output less logs by default:
- For debug mode, change log level from 5 to 4
- For release mode, change log level from 3 to 2
2022-10-31 14:02:00 +08:00
Wenyong Huang
0f5b73ae67
Add mutex initializer for wasm-c-api engine operations (#1656)
The host embedder may new/delete wasm-c-api engine simultaneously
in multiple threads, which requires lock for the operations. Since there
isn't one time called global init/destroy APIs provided by wasm-c-api,
we define a global lock and initialize it with thread mutex initializer if
the platform supports that, and use it to lock the operations of engine.

If the platform doesn't support thread mutex initializer, we require
developer to create the lock by himself to ensure the thread-safe of the
engine operations.
2022-10-31 11:48:07 +08:00
YAMAMOTO Takashi
77ff7daaf4
Add wasm_runtime_unregister_natives (#1647)
Allow to unregister (or unload) the previously registered native libs,
so that no need to restart the whole engine by using
`wasm_runtime_destroy/wasm_runtime_init`.
2022-10-28 11:03:39 +08:00
Wenyong Huang
ef21f0c951
Implement Fast JIT dump call stack and perf profiling (#1633)
Implement dump call stack and perf profiling features for Fast JIT,
and refine some code.
2022-10-27 09:28:32 +08:00
Huang Qi
4a1e522c53
Move indirect mode optimization to the last of LLVM pipelines (#1627)
The general optimizations may create some intrinsic function calls
like llvm.memset, so we move indirect mode optimization after them
to remove these function calls at last.

Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
2022-10-24 10:20:05 +08:00
Wenyong Huang
bbfa39c32c
Refine Fast JIT accessing memory/table instance and global data (#1623)
Some offsets can be directly gotten at the compilation stage after the interp/AOT
module instance refactoring PR was merged, so as to reduce some unnecessary
load instructions and improve the Fast JIT performance:
- Access fields of wasm memory instance structure
- Access fields of wasm table instance structure
- Access the global data
2022-10-21 09:32:51 +08:00
casaroli
4c61bfd10d
Suppress the warnings when building with GCC11 (#1622)
Add pragma to ignore "-Waddress-of-packed-member"
Adds `void` parameter to the prototype of some functions to make them
have strict declarations
2022-10-20 21:26:57 +08:00
Wenyong Huang
1d4cbfceac
Refine Fast JIT call indirect and call native process (#1620)
Translate call_indirect opcode by calling wasm functions with Fast JIT IRs instead of
calling jit_call_indirect runtime API, so as to improve the performance.

Translate call native function process with Fast JIT IRs to validate each pointer argument
and convert it into native address, and then call the native function directly instead
of calling jit_invoke_native runtime API, so as to improve the performance.
2022-10-19 17:11:38 +08:00
Huang Qi
73809efb5d
Fix XIP issue caused by rem_s on RISC-V (#1619) 2022-10-19 16:46:26 +08:00
liang.he
1c5034bdfa
Fix a bug of the return value of memory_instantiate (#1616)
Since `memory` is not NULL, memory_instantiate will return non-null
value when failed.
2022-10-19 07:23:03 +08:00