Commit Graph

2149 Commits

Author SHA1 Message Date
liang.he
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
Wenyong Huang
fbb369473d Fix link cxx object file error when building wamrc (#1794) 2022-12-20 14:37:07 +08:00
Wenyong Huang
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
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
f93434938a 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 15:05:36 +08:00
Wenyong Huang
27d112b052 Update release notes and fix issues reported by Coverity (#1813) 2022-12-19 15:05:36 +08:00
TianlongLiang
f5bf043b2b vscode-extension: Run docker image with the same version as WAMR (#1815) 2022-12-19 15:05:36 +08:00
Wenyong Huang
b441432b31 Publish the docker image with tar/zip files (#1808)
And fix issue found in fast jit call indirect.
2022-12-19 15:05:36 +08:00
Callum Macmillan
6fafa10fdf Fix watchpoint segfault when using debug interp without server (#1806) 2022-12-19 15:05:36 +08:00
liang.he
a61b1e0548 Use boringssl instead of openssl to implement wasm cache loading (#1804) 2022-12-19 15:05:36 +08:00
dongsheng28849455
74297a0142 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-19 15:05:36 +08:00
Huang Qi
198615f895 Enable XIP in CI daily test (#1793) 2022-12-19 15:05:36 +08:00
Huang Qi
a04b1305e9 Implement i32.div_s (#1792) 2022-12-19 15:05:36 +08:00
liang.he
bd2426ef7d 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-19 15:05:36 +08:00
Wenyong Huang
57e3d7e4bc Fix link cxx object file error when building wamrc (#1794) 2022-12-19 15:05:36 +08:00
Wenyong Huang
70c2a4f1c6 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-19 15:05:36 +08:00
Wenyong Huang
d2f858dec6 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-19 15:05:36 +08:00
Huang Qi
e2e7441c39 Implement i32.rem_s and i32.rem_u intrinsic (#1789) 2022-12-19 15:05:36 +08:00
Callum Macmillan
fcd96bfde8 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-19 15:05:36 +08:00
Wenyong Huang
0b48943915 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-19 15:05:36 +08:00
Wenyong Huang
078375c6d4 Enable bulk memory by default (#1781)
Enable bulk memory by default since it is a finished wasm spec proposal
and is enabled by default in latest wasi-sdk. Developer often encounters
"invalid section id" or "unsupported opcode" error if it isn't enabled.
2022-12-19 15:05:36 +08:00
liang.he
6c78988ae8 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-19 15:05:36 +08:00
liang.he
6807b9900f 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-19 15:05:36 +08:00
Huang Qi
9416ddf89e Dump more info when spec test fails with XIP mode (#1779) 2022-12-19 15:05:36 +08:00
Huang Qi
eed78fa74a Enable spec test on nuttx and daily run it (#1763)
- Spec test needs about 15 min
- Skip some test cases that cannot pass now, most of which are FP relative
  (due to potential bugs in NuttX's libc)
2022-12-19 15:05:36 +08:00
YAMAMOTO Takashi
53011b229f 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-19 15:05:36 +08:00
Andy
61442f0585 Add ARM aeabi memcpy/memmove/memset symbols for AOT bulk memory ops (#1777) 2022-12-19 15:05:36 +08:00
liang.he
264d56f84c 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-19 15:05:36 +08:00
Wenyong Huang
806cdbd1db Fix issues reported by Coverity (#1775)
Fix some issues reported by Coverity and fix windows exception
check with guard page issue
2022-12-19 15:05:36 +08:00
Callum Macmillan
fd6cebddfe Install patched LLDB on vscode extension activation (#1637)
Download and install the WAMR patched LLDB binary on vscode extension activation.

This allows the user to download the packaged .vsix file, where the activation script
should handle determining what LLDB binary they should use, and install it in the
correct location.
2022-12-19 15:05:36 +08:00
Wenyong Huang
93b7aadeaf 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-12-19 15:05:36 +08:00
Wenyong Huang
64f0aa51ed Fix compile warning in wasm_shared_memory.c (#1772) 2022-12-19 15:05:36 +08:00
Enrico Loparco
43d10918f3 Update document for MacOS compilation (#1770)
When building LLVM, if multiple SDKs are installed in `/Library/Developer/CommandLineTools/SDKs`,
headers from multiple SDKs are picked, generating build errors as describe here:
    https://github.com/bytecodealliance/wasm-micro-runtime/issues/1758.

Without disabling the bound checks (i.e. -DWAMR_DISABLE_HW_BOUND_CHECK=1)
when building `iwasm`, the `-g=127.0.0.1:1234` parameter makes the runtime crash.

Update the document to avoid the issues.

Signed-off-by: eloparco <eloparco@amazon.com>
2022-12-19 15:05:36 +08:00
Andy
3b7522405b 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-12-19 15:05:36 +08:00
liang.he
02571326e7 Fix a typo in workflow (#1760) 2022-12-19 15:05:36 +08:00
Marcin Kolny
a750b3352e Fix warnings in the posix socket implementation (#1768) 2022-12-19 15:05:36 +08:00
Marcin Kolny
3126573fb4 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-12-19 15:05:36 +08:00
guangyuhu
5d9721bc59 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-12-19 15:05:36 +08:00
TianlongLiang
6e29b8117d 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-12-19 15:05:36 +08:00
Wenyong Huang
ceb51c1331 Implement invokeNative asm code for MinGW (#1753)
And update the document of building iwasm for MinGW.
2022-12-19 15:05:36 +08:00
Wenyong Huang
a0d54cf4d5 Fix zephyr sample build errors (#1757) 2022-12-19 15:05:36 +08:00
Huang Qi
b334707a58 wamr-test-suites: Add support for ARM/RISCV by QEMU (#1704)
Enhance wamr-test-suites to add QEMU and Firmware options:
`./test_wamr.sh -Q <qemu> -F <firmware>`
2022-12-19 15:05:36 +08:00
Huang Qi
4d641df11d Clear some warnings and enable -Werror for NuttX (#1756) 2022-12-19 15:05:36 +08:00
Andy
530797c903 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-12-19 15:05:36 +08:00
Wenyong Huang
d068ba2f7d Remove unused LLVM JIT wapper functions (#1747)
Only create the necessary wrapper functions for LLVM JIT
2022-12-19 15:05:36 +08:00
Huang Qi
2ec8ad1528 Fix missing intrinsics for risc-v which were reported by spec test (#1750) 2022-12-19 15:05:36 +08:00