Commit Graph

632 Commits

Author SHA1 Message Date
YAMAMOTO Takashi
5a93f0d667
wasm_export.h: Add comments on wasm_runtime_register_natives (#1580) 2022-10-12 20:06:38 +08:00
Hanged Fish
f28a15bf2f
Wrap wasi_socket_ext api with extern "C" (#1575)
Fix wasi_socket_ext library failed to link with cxx project
2022-10-12 15:51:07 +08:00
tonibofarull
e53ab91439
Integrate WASI-NN into WAMR (#1521)
Initial integration of WASI-NN based on #1225:
- Implement the library core/iwasm/libraries/wasi-nn
- Support TensorFlow, CPU, F32 at the first stage
- Add cmake variable `-DWAMR_BUILD_WASI_NN`
- Add test case based on Docker image and update document

Refer to #1573
2022-10-12 12:09:29 +08:00
Jämes Ménétrey
78c38d088e
linux-sgx: Implement POSIX calls based on getsockname and set/getbooloption (#1574) 2022-10-12 09:57:01 +08:00
YAMAMOTO Takashi
1e22d1a9e5
Fix the "register native with iwasm" stuff for macOS (#1558)
- core/shared/platform/darwin/platform_internal.h: macOS has dlopen
- samples/native-lib/README.md: Mention macOS
2022-10-07 15:17:36 +08:00
Callum Macmillan
5ddc335a7f
Add timeout send/recv and multicast client/server socket examples (#1519)
Add a couple of socket examples that can be used with WAMR:
- The `timeout_client` and `timeout_server` examples demonstrate socket
  send and receive timeouts using the socket options
- The `multicast_client` and `multicast_server` examples demonstrate receiving
  multicast packets in WASM

And add several macro controls for `socket_opts` example.
2022-10-07 10:31:21 +08:00
Jämes Ménétrey
e2a3f0f387
linux-sgx: Implement socket API getpeername, recvfrom and sendto (#1556)
Implement some of the popular socket APIs left unimplemented for SGX,
following the merge of dev/socket.
2022-10-06 21:32:33 +08:00
Jämes Ménétrey
a7a9e40fc6
linux-sgx: Fix directional OCALL parameter for getsockname (#1554) 2022-10-04 21:40:37 +08:00
Wenyong Huang
a9e5150c82
Upgrade version number to 1.1.0 (#1536) 2022-09-30 17:24:43 +08:00
Jämes Ménétrey
4489c3da2b
hash map: Fix a wrongly named parameter and enhance the docs (#1540) 2022-09-30 03:02:22 +08:00
Jämes Ménétrey
5b10d4e630
socket: Explicit narrowing type cast and add missing static keywords (#1539)
While compiling the file wasi_socket_ext.c with pedantic options (typically
`-Wimplicit-int-conversion` and `-Wmissing-prototypes`), some warnings are raised.

This PR addresses those warnings by adding missing static statements before
functions and explicitly casting a narrowing conversion.

And fix the error handling after calling getpeername.
2022-09-29 22:44:57 +08:00
dzobbe
3fad613ea2
Enable build wasi_socket_ext.c with both clang and clang++ (#1527)
Enable to run WolfSSL into wasm and need some features from C++:
https://github.com/JamesMenetrey/wolfssl-examples/tree/wasm/Wasm
2022-09-29 20:52:11 +08:00
Wenyong Huang
3220ff6941
Clear Windows compile warnings (#1530) 2022-09-29 14:02:58 +08:00
Marcin Kolny
c505da7464
Update __wasi_sock_accept signature to match wasi_snapshot_preview1 (#1531)
The function was introduced to WASI about half a year ago after it already
existed in WAMR.

It caused problems with compiling `wasi_socket_ext.c` with the wasi-sdk
that already had this hostcall exported (wasi-sdk >= 15).

The approach we take is the following:
- we update WASI interface to be compatible with the wasi_snapshot_preview1
- compilation with `wasi_socket_ext.c` supports both wasi_sdk >= 15 and wasi_sdk < 15
  (although we intend to drop support for < 15 at one point of time)
- we override `accept()` from wasi-libc - we do that because `accept()` in `wasi-libc`
  doesn't support returning address (as it doesn't have `getpeername()` implemented),
  so `wasi_socket_ext.c` offers more functionality right now

Resolves #1167 and #1528.

[1] https://github.com/WebAssembly/WASI/blob/main/phases/snapshot/witx/wasi_snapshot_preview1.witx
2022-09-29 09:29:54 +08:00
Jämes Ménétrey
dfd16f8e4f
linux-sgx: Implement SGX IPFS as POSIX backend for file interaction (#1489)
This PR integrates an Intel SGX feature called Intel Protection File System Library (IPFS)
into the runtime to create, operate and delete files inside the enclave, while guaranteeing
the confidentiality and integrity of the data persisted. IPFS can be referred to here:
https://www.intel.com/content/www/us/en/developer/articles/technical/overview-of-intel-protected-file-system-library-using-software-guard-extensions.html

Introduce a cmake variable `WAMR_BUILD_SGX_IPFS`, when enabled, the files interaction
API of WASI will leverage IPFS, instead of the regular POSIX OCALLs. The implementation
has been written with light changes to sgx platform layer, so all the security aspects
WAMR relies on are conserved.

In addition to this integration, the following changes have been made:
 - The CI workflow has been adapted to test the compilation of the runtime and sample
    with the flag `WAMR_BUILD_SGX_IPFS` set to true
 - Introduction of a new sample that demonstrates the interaction of the files (called `file`),
 - Documentation of this new feature
2022-09-28 13:09:58 +08:00
dongsheng28849455
8436e88a07
Fix link error for ESP-IDF 4.4.2 (#1520)
Fix the issue reported by #1484:
Platform ESP-IDF broken for WAMR 1.0.0 with ESP-IDF 4.4.2
Let the dummy ftruncate only work with ESP-IDF earlier than 4.4.2
2022-09-27 09:00:38 +08:00
YAMAMOTO Takashi
3d56c8133c
Fix NuttX build error after dev/socket was merged (#1517) 2022-09-26 20:06:14 +08:00
Wenyong Huang
1ff04a9125
Fix issue in wasm/aot enlarge memory (#1512)
Memory num_bytes_per_page was incorrectly set in memory enlarging for
shared memory, we fix it. And don't set memory_data_size again for shared
memory.
2022-09-23 09:31:44 +08:00
Wenyong Huang
78b5c5b484
Merge dev/socket into main (#1393)
Implement more socket APIs, refer to #1336 and below PRs:
- Implement wasi_addr_resolve function (#1319)
- Fix socket-api byte order issue when host/network order are the same (#1327)
- Enhance sock_addr_local syscall (#1320)
- Implement sock_addr_remote syscall (#1360)
- Add support for IPv6 in WAMR (#1411)
- Implement ns lookup allowlist (#1420)
- Implement sock_send_to and sock_recv_from system calls (#1457)
- Added http downloader and multicast socket options (#1467)
- Fix `bind()` calls to receive the correct size of `sockaddr` structure (#1490)
- Assert on correct parameters (#1505)
- Copy only received bytes from socket recv buffer into the app buffer (#1497)

Co-authored-by: Marcin Kolny <mkolny@amazon.com>
Co-authored-by: Marcin Kolny <marcin.kolny@gmail.com>
Co-authored-by: Callum Macmillan <callumimacmillan@gmail.com>
2022-09-22 21:46:14 +08:00
Qiang
32d2d16908
Fix Fast JIT issues reported by instrument test (#1488)
- Add checks for `pack_argv`
- Fix the checks in creating cc entry/exit basic blocks
2022-09-22 19:37:59 +08:00
Shengyun Zhou
ba3af0b196
AOT: fix crash in dumping call stack when the AOT file doesn't contain custom name section (#1508) 2022-09-20 20:47:17 +08:00
YAMAMOTO Takashi
ab3ad535ab
core/iwasm/compilation/debug/dwarf_extractor.cpp: remove dead code (#1507)
Remove an unused function, dwarf_get_func_info, which is also
seemingly incomplete.
2022-09-20 14:43:29 +08:00
Wenyong Huang
64c0b15c52
loader: Sub local count can be 0 (#1504)
Sub local count is allowed to be 0 in each group of function local types.
2022-09-20 12:40:24 +08:00
Daniel Ludwig
046f5f2212
Fix Windows/MSVC build issues (#1498)
Fix two issues of building WAMR on Windows:
- The build_llvm.py script calls itself, spawning instances faster than they expire,
   which makes Python3 eat up the entire RAM in a pretty short time.
- The MSVC compiler doesn't support preprocessor statements inside macro expressions.
  Two places inside bh_assert() were found.
2022-09-17 21:16:38 +08:00
YAMAMOTO Takashi
f5939c7bc1
Fix AOT debug for macOS (#1494)
note: macOS doesn't have elf.h
2022-09-16 18:54:04 +08:00
YAMAMOTO Takashi
1eedde7c33
Fix several issues related to AOT debug (#1492) 2022-09-16 12:06:46 +08:00
Shengyun Zhou
edaff3c6ec
thread-mgr: Prevent an already detached thread from being detached again (#1487)
If WASM app has called pthread_detach() to detach a thread, it will be detached again
when thread exits. Attempting to detach an already detached thread may result in crash
in musl-libc. This patch fixes it.
2022-09-15 17:13:33 +08:00
Huang Qi
bbea005db6
Make libc-builtin buffered printf be a common feature (#1483)
Add macros to control whether to use the libc-builtin buffered printf
and the buffer size.
2022-09-15 15:09:01 +08:00
Wenyong Huang
ab929c20a3
Add check for code section size, fix interp float operations (#1480)
And enable classic interpreter instead fast interpreter when llvm jit is enabled,
so as to fix the issue that llvm jit cannot handle opcode drop_64/select_64.
2022-09-14 19:49:18 +08:00
Wenyong Huang
8a7dd4dc3e
Remove handling unsupported opcodes in loader (#1464)
Remove handling opcode DROP_64/SELECT_64 in loader stage
prepare_bytecode, as they are the modified opcodes of DROP/SELECT
for optimization purpose, but not the opcodes defined by spec.
2022-09-08 15:38:16 +08:00
Qiang
6820af6212
Fix a potential memory leak issue in wasm_native_init (#1465)
Should call `wasm_native_destroy` to destroy the registered native libs
when registering native lib failed in `wasm_native_init`.
2022-09-08 14:22:34 +08:00
Qiang
da79e3e9b2
Add more checks for Fast JIT gen insn and jit_lock_reg_in_insn (#1449)
Add more checks for Fast JIT generating insn and jit_lock_reg_in_insn
in compile_int_div_no_check and other places to avoid accessing
NULL insn.
2022-09-07 16:52:35 +08:00
Wenyong Huang
8a2c1a2471
Fix build error on alios platform (#1459)
Add the definition of `korp_sem` in platform_internal.h.
2022-09-07 13:50:11 +08:00
Xu Jun
5722fcc40a
Fix issue in multi-thread sample (#1458)
Set `WAMR_BUILD_LIB_PTHREAD_SEMAPHORE` for the sample,
and update document.
2022-09-07 12:56:50 +08:00
Zeuson
729c4aeeaa
Enable remote attestation by librats in SGX mode (#1445)
Add library librats, update SGX build scripts, add sample and update document.
2022-09-06 14:29:58 +08:00
YAMAMOTO Takashi
0ca271873d
debug-engine: Handle wasm_debug_instance_get_current_object_name failure (#1453)
Use an empty string instead of stack garbage.
2022-09-05 19:45:20 +08:00
Huang Qi
8fcc556e50
ci: Cover more configurations & targets on NuttX (#1448)
Enable building iwasm on Nuttx for target:
* x86
* cortex-m0
* cortex-m4
* cortex-m7
* rv32imac
* rv64imac
* rv64gc
2022-09-05 12:12:32 +08:00
Huang Qi
531a011700
Move WASM_ENABLE_SPEC_TEST to correct place (#1447)
Fix compilation warning:
```
wamr/product-mini/platforms/nuttx/../posix/main.c:622:5: warning: "WASM_ENABLE_SPEC_TEST" is not defined, evaluates to 0 [-Wundef]
  622 | #if WASM_ENABLE_SPEC_TEST != 0
```

Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
2022-09-03 08:18:45 +08:00
Wenyong Huang
d095876ae6
Enable memory leak check (#1429)
Report the memory leak info when building iwasm with
`cmake .. -DWAMR_BUILD_GC_VERIFY=1`
2022-09-01 16:15:00 +08:00
Qiang
18774805cc
Add more checks for Fast JIT (#1433)
Add more checks for Fast JIT to fix the issues reported by instrument test:
- add check for the jit_value before pushing it into the stack
- add check at the end of form_and_translate_func
- add checks after each jit pass
2022-09-01 15:31:00 +08:00
Wenyong Huang
22c235b5ec
Fix multi-module and some other issues (#1435)
Fix multi-module issue:
  don't call the sub module's function with "$sub_module_name$func_name"
Fix the aot_call_function free argv1 issue
Modify some API comments in wasm_export.h
Fix the wamrc help info
2022-08-31 17:38:38 +08:00
Huang Qi
77c516ac80
Add a new API to get free memory in memory pool (#1430) 2022-08-31 16:39:25 +08:00
YAMAMOTO Takashi
6b073af3b0
debug-engine: Reduce the default MAX_PACKET_SIZE (#1425) 2022-08-30 17:00:32 +08:00
YAMAMOTO Takashi
fba12e9969
debug-engine: constify several global variables (#1427) 2022-08-30 15:43:47 +08:00
liang.he
29dee732e9
Fix typo in simd_conversions.c (#1428)
Change "==" to "=" when setting trunc_type[] array elements.
2022-08-29 18:01:19 +08:00
YAMAMOTO Takashi
1985a251cd
debug-engine: Use default stack size for control thread (#1424) 2022-08-26 21:13:30 +08:00
YAMAMOTO Takashi
04c1eb30cf
debug-engine: allocate "tmpbuf" dynamically (#1423)
Some configurations (eg. esp32/nuttx) have limited space for BSS,
0x20000 byte buffer is huge on embedded systems, change to
allocate the buffer dynamically.
2022-08-26 19:49:57 +08:00
YAMAMOTO Takashi
3875c6649a
wasm_runtime_start_debug_instance: Allow to override port (#1421)
Allow the embedder to manage port number for this purpose by itself.
2022-08-26 16:33:47 +08:00
YAMAMOTO Takashi
ee98b583d5
debug-engine: Fix process_port handling (#1415)
process_port=1 means "use port 1"
2022-08-25 20:03:44 +08:00
YAMAMOTO Takashi
7c75f6cf63
wasm_debug_engine_create: Remove unused comment (#1416) 2022-08-25 19:29:26 +08:00
Wenyong Huang
903a27aff2
Fix fast jit destroy block issue (#1412)
Only destroy the block if it hasn't been pushed into the block stack,
or it will be destroyed again when destroying the block stack.
2022-08-24 22:00:16 +08:00
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