mirror of
https://github.com/bytecodealliance/wasm-micro-runtime.git
synced 2025-06-18 02:59:21 +00:00
Compare commits
8 Commits
9c483f4e73
...
5aa93ed71d
Author | SHA1 | Date | |
---|---|---|---|
![]() |
5aa93ed71d | ||
![]() |
0e8b57d8a8 | ||
![]() |
88b5f6a535 | ||
![]() |
ac2fe552d5 | ||
![]() |
ea417d7619 | ||
![]() |
bb36a43fa4 | ||
![]() |
e82bd0b451 | ||
![]() |
cf8b932e34 |
|
@ -898,6 +898,17 @@ aot_intrinsic_fill_capability_flags(AOTCompContext *comp_ctx)
|
||||||
if (!strncmp(comp_ctx->target_arch, "riscv32", 7)) {
|
if (!strncmp(comp_ctx->target_arch, "riscv32", 7)) {
|
||||||
add_i64_common_intrinsics(comp_ctx);
|
add_i64_common_intrinsics(comp_ctx);
|
||||||
}
|
}
|
||||||
|
/*
|
||||||
|
* LLVM 16 and later expands cttz intrinsic to a table lookup,
|
||||||
|
* which involves some relocations. (unless ZBB is available,
|
||||||
|
* in which case the native instructions are preferred over
|
||||||
|
* the table-based lowering.)
|
||||||
|
* https://reviews.llvm.org/D128911
|
||||||
|
*/
|
||||||
|
#if LLVM_VERSION_MAJOR >= 16
|
||||||
|
add_intrinsic_capability(comp_ctx, AOT_INTRINSIC_FLAG_I32_CTZ);
|
||||||
|
add_intrinsic_capability(comp_ctx, AOT_INTRINSIC_FLAG_I64_CTZ);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
else if (!strncmp(comp_ctx->target_arch, "xtensa", 6)) {
|
else if (!strncmp(comp_ctx->target_arch, "xtensa", 6)) {
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -4127,6 +4127,12 @@ create_module(char *name, char *error_buf, uint32 error_buf_size)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if WASM_ENABLE_LIBC_WASI != 0
|
||||||
|
module->wasi_args.stdio[0] = os_invalid_raw_handle();
|
||||||
|
module->wasi_args.stdio[1] = os_invalid_raw_handle();
|
||||||
|
module->wasi_args.stdio[2] = os_invalid_raw_handle();
|
||||||
|
#endif
|
||||||
|
|
||||||
return module;
|
return module;
|
||||||
#if WASM_ENABLE_GC != 0
|
#if WASM_ENABLE_GC != 0
|
||||||
fail2:
|
fail2:
|
||||||
|
|
|
@ -4007,8 +4007,12 @@ aot_resolve_object_relocation_group(AOTObjectData *obj_data,
|
||||||
&& (str_starts_with(relocation->symbol_name, ".LCPI")
|
&& (str_starts_with(relocation->symbol_name, ".LCPI")
|
||||||
|| str_starts_with(relocation->symbol_name, ".LJTI")
|
|| str_starts_with(relocation->symbol_name, ".LJTI")
|
||||||
|| str_starts_with(relocation->symbol_name, ".LBB")
|
|| str_starts_with(relocation->symbol_name, ".LBB")
|
||||||
|| str_starts_with(relocation->symbol_name,
|
|| str_starts_with(relocation->symbol_name, ".Lswitch.table.")
|
||||||
".Lswitch.table."))) {
|
#if LLVM_VERSION_MAJOR >= 16
|
||||||
|
/* cf. https://reviews.llvm.org/D123264 */
|
||||||
|
|| str_starts_with(relocation->symbol_name, ".Lpcrel_hi")
|
||||||
|
#endif
|
||||||
|
)) {
|
||||||
/* change relocation->relocation_addend and
|
/* change relocation->relocation_addend and
|
||||||
relocation->symbol_name */
|
relocation->symbol_name */
|
||||||
LLVMSectionIteratorRef contain_section;
|
LLVMSectionIteratorRef contain_section;
|
||||||
|
|
|
@ -6376,6 +6376,12 @@ create_module(char *name, char *error_buf, uint32 error_buf_size)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if WASM_ENABLE_LIBC_WASI != 0
|
||||||
|
module->wasi_args.stdio[0] = os_invalid_raw_handle();
|
||||||
|
module->wasi_args.stdio[1] = os_invalid_raw_handle();
|
||||||
|
module->wasi_args.stdio[2] = os_invalid_raw_handle();
|
||||||
|
#endif
|
||||||
|
|
||||||
(void)ret;
|
(void)ret;
|
||||||
return module;
|
return module;
|
||||||
|
|
||||||
|
@ -9197,6 +9203,15 @@ preserve_referenced_local(WASMLoaderContext *loader_ctx, uint8 opcode,
|
||||||
loader_ctx->preserved_local_offset += 2;
|
loader_ctx->preserved_local_offset += 2;
|
||||||
emit_label(EXT_OP_COPY_STACK_TOP_I64);
|
emit_label(EXT_OP_COPY_STACK_TOP_I64);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* overflow */
|
||||||
|
if (preserved_offset > loader_ctx->preserved_local_offset) {
|
||||||
|
set_error_buf_v(error_buf, error_buf_size,
|
||||||
|
"too much local cells 0x%x",
|
||||||
|
loader_ctx->preserved_local_offset);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
emit_operand(loader_ctx, local_index);
|
emit_operand(loader_ctx, local_index);
|
||||||
emit_operand(loader_ctx, preserved_offset);
|
emit_operand(loader_ctx, preserved_offset);
|
||||||
emit_label(opcode);
|
emit_label(opcode);
|
||||||
|
|
|
@ -3137,6 +3137,12 @@ create_module(char *name, char *error_buf, uint32 error_buf_size)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if WASM_ENABLE_LIBC_WASI != 0
|
||||||
|
module->wasi_args.stdio[0] = os_invalid_raw_handle();
|
||||||
|
module->wasi_args.stdio[1] = os_invalid_raw_handle();
|
||||||
|
module->wasi_args.stdio[2] = os_invalid_raw_handle();
|
||||||
|
#endif
|
||||||
|
|
||||||
(void)ret;
|
(void)ret;
|
||||||
return module;
|
return module;
|
||||||
}
|
}
|
||||||
|
@ -4778,6 +4784,11 @@ preserve_referenced_local(WASMLoaderContext *loader_ctx, uint8 opcode,
|
||||||
loader_ctx->preserved_local_offset += 2;
|
loader_ctx->preserved_local_offset += 2;
|
||||||
emit_label(EXT_OP_COPY_STACK_TOP_I64);
|
emit_label(EXT_OP_COPY_STACK_TOP_I64);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* overflow */
|
||||||
|
bh_assert(preserved_offset
|
||||||
|
<= loader_ctx->preserved_local_offset);
|
||||||
|
|
||||||
emit_operand(loader_ctx, local_index);
|
emit_operand(loader_ctx, local_index);
|
||||||
emit_operand(loader_ctx, preserved_offset);
|
emit_operand(loader_ctx, preserved_offset);
|
||||||
emit_label(opcode);
|
emit_label(opcode);
|
||||||
|
|
|
@ -79,3 +79,9 @@ os_dcache_flush()
|
||||||
void
|
void
|
||||||
os_icache_flush(void *start, size_t len)
|
os_icache_flush(void *start, size_t len)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
os_raw_file_handle
|
||||||
|
os_invalid_raw_handle(void)
|
||||||
|
{
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
|
@ -1032,4 +1032,10 @@ char *
|
||||||
os_realpath(const char *path, char *resolved_path)
|
os_realpath(const char *path, char *resolved_path)
|
||||||
{
|
{
|
||||||
return realpath(path, resolved_path);
|
return realpath(path, resolved_path);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
os_raw_file_handle
|
||||||
|
os_invalid_raw_handle(void)
|
||||||
|
{
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
|
@ -1032,4 +1032,10 @@ char *
|
||||||
os_realpath(const char *path, char *resolved_path)
|
os_realpath(const char *path, char *resolved_path)
|
||||||
{
|
{
|
||||||
return realpath(path, resolved_path);
|
return realpath(path, resolved_path);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
os_raw_file_handle
|
||||||
|
os_invalid_raw_handle(void)
|
||||||
|
{
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
|
@ -1607,6 +1607,15 @@ os_is_dir_stream_valid(os_dir_stream *dir_stream);
|
||||||
os_file_handle
|
os_file_handle
|
||||||
os_get_invalid_handle(void);
|
os_get_invalid_handle(void);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns an invalid raw file handle that is guaranteed to cause failure when
|
||||||
|
* called with any filesystem operation.
|
||||||
|
*
|
||||||
|
* @return the invalid raw file handle
|
||||||
|
*/
|
||||||
|
os_raw_file_handle
|
||||||
|
os_invalid_raw_handle(void);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks whether the given file handle is valid. An invalid handle is
|
* Checks whether the given file handle is valid. An invalid handle is
|
||||||
* guaranteed to cause failure when called with any filesystem operation.
|
* guaranteed to cause failure when called with any filesystem operation.
|
||||||
|
|
|
@ -95,3 +95,9 @@ os_dcache_flush(void)
|
||||||
void
|
void
|
||||||
os_icache_flush(void *start, size_t len)
|
os_icache_flush(void *start, size_t len)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
os_raw_file_handle
|
||||||
|
os_invalid_raw_handle(void)
|
||||||
|
{
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
|
@ -192,3 +192,9 @@ posix_fallocate(int __fd, off_t __offset, off_t __length)
|
||||||
errno = ENOSYS;
|
errno = ENOSYS;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
os_raw_file_handle
|
||||||
|
os_invalid_raw_handle(void)
|
||||||
|
{
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
|
@ -1810,3 +1810,9 @@ os_realpath(const char *path, char *resolved_path)
|
||||||
|
|
||||||
return resolved_path;
|
return resolved_path;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
os_raw_file_handle
|
||||||
|
os_invalid_raw_handle(void)
|
||||||
|
{
|
||||||
|
return INVALID_HANDLE_VALUE;
|
||||||
|
}
|
||||||
|
|
|
@ -255,3 +255,9 @@ set_exec_mem_alloc_func(exec_mem_alloc_func_t alloc_func,
|
||||||
exec_mem_alloc_func = alloc_func;
|
exec_mem_alloc_func = alloc_func;
|
||||||
exec_mem_free_func = free_func;
|
exec_mem_free_func = free_func;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
os_raw_file_handle
|
||||||
|
os_invalid_raw_handle(void)
|
||||||
|
{
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
|
@ -1,14 +1,17 @@
|
||||||
# WARM API
|
# WAMR API
|
||||||
|
|
||||||
* **Notice**: The python package `wamr.wamrapi.wamr` need python >= `3.10`.
|
* **Notice**: The python package `wamr.wamrapi.wamr` requires a python version >= `3.10`.
|
||||||
|
|
||||||
## Setup
|
## Setup
|
||||||
|
|
||||||
### Pre-requisites
|
### Pre-requisites
|
||||||
|
#### Install requirements
|
||||||
|
Before proceeding it is necessary to make sure your Python environment is correctly configured. To do ths open a terminal session in this directory and perfom the following:
|
||||||
|
|
||||||
Install requirements,
|
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
|
python3 -m venv venv
|
||||||
|
source venv/bin/activate
|
||||||
pip install -r requirements.txt
|
pip install -r requirements.txt
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
|
@ -205,12 +205,3 @@ foreach(EX ${EXAMPLES})
|
||||||
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
|
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
|
||||||
)
|
)
|
||||||
endforeach()
|
endforeach()
|
||||||
|
|
||||||
if (CMAKE_BUILD_TYPE STREQUAL "Debug")
|
|
||||||
find_program(VALGRIND
|
|
||||||
valgrind
|
|
||||||
REQUIRED
|
|
||||||
)
|
|
||||||
|
|
||||||
# run `ctest -T memcheck -V --test-dir build`
|
|
||||||
endif()
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user