Commit Graph

805 Commits

Author SHA1 Message Date
YAMAMOTO Takashi
d41543f829
cmake: Use CMAKE_BINARY_DIR instead of ${CMAKE_CURRENT_SOURCE_DIR}/build (#1410) 2022-08-24 15:57:03 +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
Wenyong Huang
a517bb249a
Fix socket sample issue reported by coverity (#1397) 2022-08-19 18:06:26 +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
Wenyong Huang
9cf7b88bad
Enhance cmake makefiles (#1390)
Upgrade `cmake_minimum_required` from `(VERSION 2.8)` to `(VERSION 2.9)` to
yield the warning:
"Compatibility with CMake < 2.8.12 will be removed from a future version of CMake"

Add "-Wno-unused" for CMAKE_CXX_FLAGS to yield the compilation warnings
when build LLVM JIT.

Fix the link error when code coverage is enabled.
2022-08-18 16:27:01 +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
liang.he
aa7d447ee5
Update Ubuntu CI platforms to 20.04 and 22.04 (#1385)
From Gtihub:
The ubuntu-18.04 environment is deprecated, consider switching to
ubuntu-20.04 (ubuntu-latest), or ubuntu-22.04 instead.
https://github.com/actions/runner-images/issues/6002
2022-08-16 10:02:02 +08:00
YAMAMOTO Takashi
e0a943ee9c
nuttx: Provide a default WASM_STACK_GUARD_SIZE (#1386)
Unbreak builds with a bit older nuttx/apps for now.

Note: The default value here (0) was chosen to match the new default
in nuttx/apps, which is different from the old value used before
the introduction of WASM_STACK_GUARD_SIZE. (1024)
2022-08-15 19:49:39 +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
bc86674a45
Let iwasm return non-zero value when running failed (#1377)
Let iwasm return non-zero value when running failed
so that the caller (e.g. test framework) can check the
running status according to the return value.
2022-08-12 18:03:14 +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
2ee01657a6
Add semaphore support for NuttX (#1367) 2022-08-09 19:35:16 +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
e8f0c9580b
Some wamr-ide improvements (#1354)
including:
- enable macOS support
- documentation improvements
- fix some warnings
2022-08-08 17:52:47 +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
liang.he
0020b3ae68
Add a dev docker container for WAMR repo (#1260)
- in vscode, open the workspace in container with *Remote-Containers*
- in codespaces, it will create a container
2022-08-04 17:00:38 +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
Wang Ning
653b926d53
Upgrade WAMR-IDE (#1313)
Upgrade WAMR-IDE: test-tools/wamr-ide folder
- add `wamr-sdk` to include libc-builtin-sysroot header files
- add `prettier` check and apply script in `package.json`
- update `wasm-toolchain` dockerfile and resource
- enhance `build | run | debug` process to clean up the container
- enhance the change workspace
- enhance `wasm` type project check before building, running and debugging
- format the project_compilation.json
- update documents
2022-07-29 08:12:36 +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
liang.he
ab752cd5c3
Apply latest env variables in github host runner to fix CI (#1334)
Currently we are using `ANDROID_HOME` and `ANDROID_NDK_LATEST_HOME`.
All variables should follow definitions in https://github.com/actions/virtual-environments/blob/main/images/linux/Ubuntu2004-Readme.md#environment-variables-3
2022-07-27 14:11:51 +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
Xu Jun
9d689b3a22
Set noexecstack CXX link flags for wamrc (#1303)
Set noexecstack CXX link flags for wamrc to avoid generating binary
with exec stack.
2022-07-18 18:47:44 +08:00