Commit Graph

1166 Commits

Author SHA1 Message Date
liang.he
e70867c64f
Update spec test cases to latest version (#889)
Update spec test cases to commit 2460ad02b51fb5ed5824f44de287a8638b19a5f8,
and modify wamr test suite script as the SIMD cases have been added into spec
main repo by default, no need to clone SIMD repo again when testing SIMD.
2021-12-15 14:39:54 +08:00
Wenyong Huang
bbaf0a3c37
Fix wamrc endian/bit-width check invalid issue on win32 target (#886)
Use the previous resolved binary type info (obj_data->target_info.bin_type) to
check the endian and bit-width but not the raw binary info, the latter is not
suitable for the check for Win32 object file type.

And fix the symbol comparison issue in resolve_target_sym(), as in Win32, the
symbol name of a function added by LLVMAddFunction() is prefixed by '_',
which leads to invalid result returned by strcmp().
2021-12-14 08:45:48 +08:00
zhouliang3
2917a0c814
libc-builtin: Fix the signature of strncasecmp native function (#888)
Fix the signature invalid issue in libc-builtin, modify signature of strncasecmp
native function from "($$i)" to "($$i)i".
2021-12-13 19:40:05 +08:00
Wenyong Huang
e3ef216258
Add mipsel to wamrc supported target list (#887)
Add "mipsel" (mips little endian) to wamrc supported target list
2021-12-13 17:49:21 +08:00
Wenyong Huang
5547924e28
Refine codes and fix several issues (#882)
Refine some codes in wasm loader
Add -Wshadow to gcc compile flags and fix some variable shadowed issues
Fix function parameter/return types not checked issue
Fix fast-interp loader reserve_block_ret() not handle V128 return type issue
Fix mini loader load_table_segment_section() failed issue
Add detailed comments for argc argument in wasm_runtime_call_wasm()
2021-12-10 18:13:17 +08:00
Huang Qi
915b26b0ec
Remove hardcoded stack size while creating pthread (#881)
Use original module instance's default_wasm_stack_size instead,
which is the stack size used to instantiate it.
2021-12-10 15:11:45 +08:00
Wenyong Huang
7505ae25a2
Fix run XIP file failure on SGX platform (#880) 2021-12-08 21:30:51 +08:00
Huang Qi
208cafc776
Add new E_TYPE_XIP to indicate XIP mode (#874)
Emit e_type = E_TYPE_XIP in target info section to indicate that it is
an XIP file, and replace related checks in aot loader.
2021-12-08 18:43:08 +08:00
Wenyong Huang
5fbf03fa6e
Exclude IoT-APP-Store-Demo from code guideline check (#879) 2021-12-08 18:41:09 +08:00
Xu Jun
b9fd8f916b
update IoT cloud demo (#876)
* update IoT APP store demo

* update IoT app store apps

* update IoT cloud demo document

* [Cloud demo] mount app store between two dockers

* [Cloud demo] update restart policy

* [Cloud demo] update help page

* [Cloud demo] update online demo address
2021-12-07 20:19:23 +08:00
Wenyong Huang
56ae28bb32
Implement relocation R_AARCH64_JUMP26 for aarch64 (#873)
Treat R_AARCH64_JUMP26 same as R_AARCH64_CALL26, both of their
relocation operation is S + A - P, the difference is that one is for call
(BL) instructions, the other is for jump (B) instructions.
2021-12-07 10:32:10 +08:00
Xu Jun
a06ede0de1
update source debugging document (#872) 2021-12-06 20:15:19 +08:00
Wenyong Huang
a5193686f5
Fix compile error when build target X86_32 (#869)
Fix compile error introduced by #866.
2021-12-06 19:01:09 +08:00
Wenyong Huang
b490a229f6
Enhance XIP and add XIP document (#863)
Auto detect whether file is XIP file before loading module in posix like and
linux-sgx platforms, and if yes, mmap executable memory automatically to
run the XIP file.
Add document about XIP feature.
Enable test spec cases with XIP feature.
2021-12-06 17:25:10 +08:00
Robin van Emden
3f808d4596
Fix -m32 unrecognized issue when compile 32-bit target on some 64-bit systems (#866)
When compile 32-bit targets on some 64-bit systems, the "-m32" flag might be
unrecognized by some gcc compilers, e.g. compiling arm32 in aarch64 system,
compiling riscv32 in riscv64 system.
Add check before adding "-m32" flag to gcc, and only add it if it is supported.
2021-12-06 16:40:48 +08:00
Xu Jun
2af5ae5abb
[source debug] refine some code in source debugging (#856)
- move the wait_cond from exec_env to debug_instance, so the debug thread can be waken up by any threads
- process more general query message from debugger
- refine debug instance create/destroy mechanism
- avoid creating debug instance during module instantiating
- avoid blocking execution thread during creating debug instance
- update related documents
2021-12-06 10:25:38 +08:00
Huang Qi
c8fe1004aa
Don't throw exception while module_malloc failed (#860)
Don't throw exception when module_malloc memory failed:
- Exception will terminate the wasm app, it's not necessary since app can
  check the result of dynamic allocation and do some cleanup or fallback
  operation on failure instead of 'crash' directly.
- In acquire_wait_info, call hasn_map_find only when the address isn't NULL,
  or there are many senseless error logs
2021-12-03 17:00:18 +08:00
Wenyong Huang
b73edc8587
Refine code when aux stack global isn't found (#862)
When auxiliary stack global isn't found in wasm app, it must be unused in
the wasm app, we set it to __heap_base global and set its size to 0, so as to
shrink the linear memory to reduce the memory consumption.
2021-12-03 15:30:32 +08:00
Javan
212810bc2f
Fix issue of wasm/aot file malformed format (#853)
Fix possible integer overflow unchecked issue when checking
wasm/aot file format.
2021-11-30 20:47:42 +08:00
Huang Qi
8d1c56bda4
Implement atomic and memset/memmove/memcpy intrinsic for riscv (#841)
- Lower aotmic instruction to non-atomic form on some platforms
- Lower memset/memmove/memcpy for XIP
- Disable rtti in cmake
2021-11-30 17:10:14 +08:00
Wenyong Huang
25b8f88dd4
Fix win32 aot endian and machine type check errors (#855)
Emit the correct binary type and machine type in AOT file
for win64/win32 system, and handle them in aot loader.
2021-11-30 14:16:21 +08:00
Xu Jun
9b0b33e4ae
fix duplicated debug instance id in multiple native thread issue (#847)
The debug_instance_list is not protected by mutex, and the debug instance uses
the length of this list as its id. If several threads create debug instance at the
same time, they may get duplicated/same ids. This patch adds mutex to protect
this list.
2021-11-25 12:15:37 +08:00
Therdel
d03a57fbff
fix link in multi_module.md (#846) 2021-11-25 11:26:06 +08:00
Wenyong Huang
16ebfc3781
Fix sample gui compile error (#845) 2021-11-23 17:19:28 +08:00
Wenyong Huang
39c68f66d7
Fix Win32 build error (#843)
Fix compilation error on Win32 platform.
2021-11-23 10:57:52 +08:00
zhouliang3
e64b6e8120
Fix bug of destroy_callback_list not cleared when thread mgr destroy (#844)
The destroy_callback_list variable in thread_manager_destroy is not cleared.
When wamr is started as a task, after exiting and restarting, it will loop
endlessly in traverse_list.

Signed-off-by: zhouliang3 <zhouliang3@xiaomi.com>
2021-11-23 10:57:01 +08:00
liang.he
1dccf39d16
Enable ref types and bulk memory by default for wamrc (#838)
Enable ref types feature and bulk memory feature by default for wamrc
and provide "--disable-ref-types", "--disable-bulk-memory"  to disable
them.
And remove the ref_type_flag option in wasm_loader.c which is used to
control whether to enable ref types or not when ENABLE_REF_TYPES
macro is enabled in wamrc. As the wasm binary format with ref types
is compatible with the binary format before, we can remove the option.
Also update the spec test scripts.
2021-11-18 17:42:49 +08:00
dslk
5d48a18614
wamr: Add shared memory and memory tracing config (#835)
Applied on the nuttx platform, some memory configurations are added,
and aot and interp can be completely closed or opened, thereby reducing
the flash size.
2021-11-16 15:54:46 +08:00
Wenyong Huang
3ded9ece83
Apply clang format for samples files (#833)
Apply clang format for c source files under samples folder
2021-11-15 12:48:35 +08:00
Wenyong Huang
37a14c9825
Add more reloc symbols for target arm/thumb/riscv (#834)
Add more reloc symbols for target arm/thumb/riscv and
implement relocation type R_ARM_ABS32 for thumb.
Tested in buildroot qemu.
2021-11-15 12:23:15 +08:00
Wenyong Huang
64be6ec9a7
Fix potential pointer overflows (#826)
Fix some potential pointer overflows in aot applying relocations and
several other places.
And add sanitizer compiler flags to wamrc CMakeLists.txt to detect
such issues.
2021-11-15 10:57:37 +08:00
Wenyong Huang
a1ad950ae1
Enable LLVM link time optimization (LTO) for AOT (#831)
Enable LLVM link time optimization for AOT and enable it by default,
and provide "wamrc --disable-llvm-lto" option to disable it.
And modify the spec test script, disable it by default when testing
spec cases.

Signed-off-by: Wenyong Huang <wenyong.huang@intel.com>
2021-11-13 16:59:35 +08:00
Wenyong Huang
9281286181
Enable huge page for posix platforms (#825)
This patch enables huge page support for posix platforms for performance
reason, if the request size to mmap is larger than 2MB, then we use madvise
to set some pages to huge page.
And add macro control to enable tracing the mmap/munmap.

Signed-off-by: Wenyong Huang <wenyong.huang@intel.com>
2021-11-12 16:19:26 +08:00
Huang Qi
0af7522e3e
Fix fail to get builtin functions in indirect call (XIP) mode (#829)
Fix fail to get builtin functions in indirect call (XIP) mode, e.g.
function aot_alloc_frame, aot_memory_init, aot_table_init and so on.

Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
2021-11-11 14:14:21 +08:00
YAMAMOTO Takashi
6edabbf632
Add __umoddi3 to target symbol map in aot_reloc_arm.c (#828) 2021-11-10 16:53:14 +08:00
liang.he
5b62fdd061
[skip ci] reorder options of test_wamr.sh (#824) 2021-11-10 09:41:42 +08:00
YAMAMOTO Takashi
d1be75c4a1
wamrc: return a non-zero exit code on failure (#822) 2021-11-09 13:13:20 +08:00
liang.he
69c004efb4
Enable SGX spec test for AOT mode and add SIMD option (#821) 2021-11-08 17:53:17 +08:00
YAMAMOTO Takashi
2613a68108
aot_reloc_x86_64: Fix pointer overflows (#809)
Fix pointer overflow of `(uint8 *)symbol_addr + reloc_addend` detected by UBSan:
```
core/iwasm/aot/arch/aot_reloc_x86_64.c:232:43: runtime error: addition of unsigned offset to 0x000041209004 overflowed to 0x000041209000
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior core/iwasm/aot/arch/aot_reloc_x86_64.c:232:43
```
2021-11-08 16:15:44 +08:00
liang.he
487072a78e
Speed up the spec case test by parallelism (#819)
Port spec-test-script/all.sh to spec-test-script/all.py and enable to run
spec cases with multiple threads parallelly:
- It reduces spec_test.yml from ~14min to ~9min and reduces
  compilation_on_sgx.yml from ~18min to ~12min
- run `./test_wamr.sh` will keep the same experience likes before by default
- run `./test_wamr.sh -P` will enable parallelism mode
- in parallelism mode, all.py will be in a less-output mode. It only outputs
  the last words of failed cases and will not output logs for those passed
2021-11-08 12:39:02 +08:00
Wenyong Huang
403a7d3f4f
Refine interp/aot string storage and emitting (#820)
Currently the string in the wasm/aot file will be duplicated and stored
into const string list/set in interpreter/aot loader, which leads to extra
unnecessary memory consumption if the file buffer can be referred to
after loading. We refine the string storage by:
- if the file buffer can be referred to after loading and it is writable, we
  reuse the file buffer to store the string but not store it into the const
  string set: move string backward and append '\0'
- emit string with '\0' only for XIP mode in which the AOT file is readonly
- if the file buffer cannot be referred to, e.g. in app manager, keep the
  same behavior as before

Signed-off-by: Wenyong Huang <wenyong.huang@intel.com>
2021-11-08 11:27:26 +08:00
Wenyong Huang
9424dad56a
Implement os_time_get_boot_microsecond() for sgx platform (#818) 2021-11-06 15:58:21 +08:00
liang.he
c591610111
Add CI tasks on SGX platform (#817)
Add CI tasks on SGX platform:
  build iwasm with some feature combinations
  build and run some samples
  test spec cases with interpreter mode and AOT mode
2021-11-05 19:07:54 +08:00
Xu Jun
703e724c99
[source debug] process ModuleInfo query message (#815) 2021-11-02 12:09:15 +08:00
Huang Qi
3fa91df754
Simplify some string size calculation when emitting AOT file (#813)
Simplify some string size calculation when emitting AOT file

Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
2021-11-01 20:03:13 +08:00
Wenyong Huang
4d14e41ce9
Build projects in wamr-test-suites with multiple cores (#811)
Build several projects in wamr-test-suites with multiple cores to reduce
the compilation time.
2021-10-30 21:03:46 +08:00
Xu Jun
83df8600f7
Support random debug port by assigning port = 0 (#807)
Support random debug port by assigning port = 0,
and update help and document.
2021-10-30 02:44:41 -05:00
Qinkun Bao
40ca5469dc
Remove duplicated wasi_dircookie_t typedef in libc_wasi_wrapper.h (#808)
Remove duplicated wasi_dircookie_t typedef in libc_wasi_wrapper.h to
fix clang warnings.
2021-10-30 14:41:57 +08:00
Wenyong Huang
5face80e0c
Fix spec test workflow issue and CI Dockerfile issue (#810)
Fix llvm binaries cache missed issue in spec test workflow,
fix CI Dockerfile issue and refine code format for libc_builtin_wrapper.c.
2021-10-30 09:24:03 +08:00
Xu Jun
164c3bff69
Fix lldb wasm patch to enable source debugging for windows (#806) 2021-10-27 21:26:53 +08:00