Commit Graph

1070 Commits

Author SHA1 Message Date
0e2382a959 Disable aux stack allocations for threads spawned by wasi_thread_start (#1867)
This syscall doesn't need allocating stack or TLS and it's expected from the application
to do that instead. E.g. WASI-libc already does this for `pthread_create`.

Also fix some of the examples to allocate memory for stack and not use stack before
the stack pointer is set to a correct value.
2023-01-09 20:36:34 +08:00
2615646c20 Fix on-heap aux stack allocation (#1865)
Because stack grows from high address towards low address, the value
returned by malloc is the end of the stack, not top of the stack. The top
of the stack is the end of the allocated space (i.e. address returned by
malloc + cluster size).

Refer to #1790.
2023-01-06 18:21:28 +08:00
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
3403f0a7f4 Merge main into dev/wasi_threads 2023-01-03 18:15:23 +08:00
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
d5aa354d41 Return result directly if float cmp is called in AOT XIP (#1851) 2022-12-30 16:45:39 +08:00
d309091706 Register missing symbols for f32 to 64 bit integer conversion (#1850) 2022-12-30 15:21:25 +08:00
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
d1fe589d43 Fix fmin/fmax in AOT XIP intrinsics (#1848) 2022-12-29 18:48:55 +08:00
41eb938a95 Fix equal check in AOT XIP float cmp intrinsic (#1847) 2022-12-29 18:11:05 +08:00
6c7ca90229 Use float version library routine for XIP aot_intrinsic_xxx APIs (#1846) 2022-12-29 16:49:27 +08:00
b5f8a2bd08 Add missing soft float intrinsics for risc-v AOT (#1845) 2022-12-29 16:00:33 +08:00
26728cbef2 Remove unnecessary ret value control when spec test is enabled (#1839)
wamr-test-suites scripts can handle the return value correctly when
spec test is enabled.
2022-12-27 16:34:44 +08:00
679a8ab3cb Perfect the codebase for wamr-ide (#1817)
Fix errors and warnings reported by eslint
Add CONTRIBUTING document for vscode-extension
2022-12-27 15:04:36 +08:00
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
5d006ad263 Reuse build llvm libraries for spec test on nuttx (#1838)
Fix daily CI break on NuttX.
2022-12-26 14:22:15 +08:00
ba5cdbee3a Fix typo verify_module in aot_compiler.c (#1836) 2022-12-26 12:24:23 +08:00
2953614cb8 Port WAMR to the FreeBSD platform and update the document (#1825) 2022-12-24 10:11:10 +08:00
6fd8001eb6 Update CIs and documents to make naming of generated binaries consistent (#1823) 2022-12-24 09:17:39 +08:00
7d19b229eb feat(wasi-threads): Add CI for WASI threads (#1819)
Update wasi-sdk from 12.0 to 16.0 in CI
Build wasi-libc and build wai-threads sample in CI
2022-12-22 18:02:23 +08:00
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
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
7db49db777 Update release notes and fix issues reported by Coverity (#1813) 2022-12-20 14:37:07 +08:00
fe210f02f2 vscode-extension: Run docker image with the same version as WAMR (#1815) 2022-12-20 14:37:07 +08:00
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
4d0f5cfade Fix watchpoint segfault when using debug interp without server (#1806) 2022-12-20 14:37:07 +08:00
b826a84cd6 Use boringssl instead of openssl to implement wasm cache loading (#1804) 2022-12-20 14:37:07 +08:00
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
dbec3f0202 Enable XIP in CI daily test (#1793) 2022-12-20 14:37:07 +08:00
c613866bac Implement i32.div_s (#1792) 2022-12-20 14:37:07 +08:00
97a255ea83 Move the release note template content to the end of file (#1795)
Fix the issue that the release notes cannot be successfully created when
releasing a new version.
2022-12-20 14:37:07 +08:00
fbb369473d Fix link cxx object file error when building wamrc (#1794) 2022-12-20 14:37:07 +08:00
b08318b9c0 Fix link cpp object file error (#1791)
Error was reported when building docker image:
  /usr/bin/ld: libaotclib.a(aot_llvm_extra.cpp.o): relocation R_X86_64_32S against symbol 
  `_ZN4llvm30TargetTransformInfoWrapperPass2IDE' can not be used when making a PIE object;
  recompile with -fPIC

Add `-fPIC` to `CMAKE_CXX_FLAGS` and `CMAKE_SHARED_LIBRARY_LINK_C_FLAGS` to fix it.
2022-12-20 14:37:07 +08:00
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
bfd57558a7 Implement i32.rem_s and i32.rem_u intrinsic (#1789) 2022-12-20 14:37:07 +08:00
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
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
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
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
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
8fc641377a feat(wasi-threads): Add example of exception propagation (#1812) 2022-12-16 14:22:53 +08:00
fb8727ba68 Update release notes and fix issues reported by Coverity (#1813) 2022-12-16 14:16:58 +08:00
d0c4c7036b vscode-extension: Run docker image with the same version as WAMR (#1815) 2022-12-16 14:15:32 +08:00
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
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
ca0b5cf816 Fix watchpoint segfault when using debug interp without server (#1806) 2022-12-13 15:16:43 +08:00
294a625fe5 Use boringssl instead of openssl to implement wasm cache loading (#1804) 2022-12-13 14:23:37 +08:00
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
d827315122 Enable XIP in CI daily test (#1793) 2022-12-13 11:32:35 +08:00
ef4e795dba Implement i32.div_s (#1792) 2022-12-13 10:48:51 +08:00