Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix compile issue of zephyr #306

Merged
merged 61 commits into from
Jul 9, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
61 commits
Select commit Hold shift + click to select a range
b389628
Merge pull request #82 from bytecodealliance/master
wenyongh Mar 16, 2020
62a1992
Merge pull request #83 from bytecodealliance/master
wenyongh Mar 16, 2020
00c5daf
Merge pull request #84 from bytecodealliance/master
wenyongh Mar 17, 2020
7a46018
Merge pull request #85 from bytecodealliance/master
wenyongh Mar 18, 2020
6ed452c
Sync with internal feature
wenyongh Mar 18, 2020
632d63a
Merge pull request #86 from bytecodealliance/master
wenyongh Mar 20, 2020
ee37497
Merge pull request #87 from bytecodealliance/master
wenyongh Mar 23, 2020
44d041d
Merge pull request #88 from bytecodealliance/master
wenyongh Mar 24, 2020
b382a7f
Enable aarch64 support, add component test framework and test suite, …
wenyongh Mar 24, 2020
0a6cef7
Merge pull request #89 from bytecodealliance/master
wenyongh Mar 24, 2020
6df54ce
Merge pull request #90 from bytecodealliance/master
wenyongh Mar 27, 2020
5009206
Merge pull request #91 from bytecodealliance/master
wenyongh Mar 30, 2020
0ab53e6
Implement register/call native API with raw arguments
wenyongh Apr 1, 2020
f890529
Merge pull request #92 from bytecodealliance/master
wenyongh Apr 1, 2020
9d5bfda
Merge pull request #93 from bytecodealliance/master
wenyongh Apr 1, 2020
3b36fb8
Merge pull request #94 from bytecodealliance/master
wenyongh Apr 2, 2020
908c5f7
Merge pull request #95 from bytecodealliance/master
wenyongh Apr 9, 2020
5336e35
Merge pull request #96 from bytecodealliance/master
wenyongh Apr 12, 2020
21275d3
Merge pull request #97 from bytecodealliance/master
wenyongh Apr 13, 2020
4c56eb9
Make heap and linear memory contiguous to refine compilation time and…
wenyongh Apr 13, 2020
f984e20
Modify aot version
wenyongh Apr 13, 2020
5076b77
Merge pull request #98 from bytecodealliance/master
wenyongh Apr 13, 2020
1cf823d
Merge pull request #99 from bytecodealliance/master
wenyongh Apr 22, 2020
33a9f85
Refine aot memory boundary check, add more llvm passes
wenyongh Apr 22, 2020
be5d033
Merge pull request #100 from bytecodealliance/master
wenyongh Apr 22, 2020
aa69a45
Merge pull request #101 from bytecodealliance/master
wenyongh Apr 25, 2020
59f4d15
Sync with internal/feature
wenyongh Apr 30, 2020
af0e324
Merge pull request #102 from bytecodealliance/master
wenyongh Apr 30, 2020
4fa4bad
Sync with internal feature
wenyongh May 8, 2020
9ea9457
Merge pull request #103 from bytecodealliance/master
wenyongh May 8, 2020
54863ed
Fix issues of condition settings of app boundary check
wenyongh May 8, 2020
03ec08f
Merge pull request #104 from bytecodealliance/master
wenyongh May 8, 2020
87151ea
Replace llvm void ptr type with int8 ptr type to avoid assert failed
wenyongh May 8, 2020
ff5e90b
Merge pull request #105 from bytecodealliance/master
wenyongh May 8, 2020
23af40d
Merge pull request #106 from bytecodealliance/master
wenyongh May 15, 2020
f544940
Update API comments, refine footprint of wasm loader
wenyongh May 15, 2020
5568b52
Merge pull request #107 from bytecodealliance/master
wenyongh May 15, 2020
475669d
Merge pull request #108 from bytecodealliance/master
wenyongh May 28, 2020
0cc8c99
Merge pull request #109 from bytecodealliance/master
wenyongh Jun 1, 2020
75533fa
Sync with internal feature
wenyongh Jun 2, 2020
916a86f
update gitignore and clang-format
wenyongh Jun 2, 2020
55eee4c
Merge pull request #110 from bytecodealliance/master
wenyongh Jun 2, 2020
26515b0
Merge pull request #111 from bytecodealliance/master
wenyongh Jun 8, 2020
3c8251f
Sync with internal feature
wenyongh Jun 8, 2020
3de35d5
Merge pull request #112 from bytecodealliance/master
wenyongh Jun 8, 2020
71096fd
Sync with internal feature
wenyongh Jun 11, 2020
f5909d5
Merge pull request #113 from bytecodealliance/master
wenyongh Jun 11, 2020
4c4f8da
Merge pull request #114 from bytecodealliance/master
wenyongh Jun 12, 2020
c5d6754
Merge pull request #115 from bytecodealliance/master
wenyongh Jun 15, 2020
d371e9c
Merge pull request #116 from bytecodealliance/main
wenyongh Jun 27, 2020
c062708
Sync with internal/feature
wenyongh Jun 28, 2020
21d8754
Merge pull request #117 from bytecodealliance/main
wenyongh Jun 28, 2020
16df501
Refine opcode get/set_global for interpreter
wenyongh Jun 29, 2020
f4eb8b2
Merge pull request #118 from bytecodealliance/main
wenyongh Jun 29, 2020
5f56872
Fix issue of aot
wenyongh Jul 1, 2020
499fc94
Merge pull request #119 from bytecodealliance/main
wenyongh Jul 1, 2020
cb3dd0c
Merge pull request #120 from bytecodealliance/main
wenyongh Jul 1, 2020
47d08d0
Merge pull request #121 from bytecodealliance/main
wenyongh Jul 1, 2020
4fcf740
Enhance the native stack overflow check
wenyongh Jul 7, 2020
9d7a493
Merge pull request #122 from bytecodealliance/main
wenyongh Jul 7, 2020
e4b7c89
Fix compile issue of zephyr
wenyongh Jul 9, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Enable aarch64 support, add component test framework and test suite, …
…refine aot call indirect op
  • Loading branch information
wenyongh committed Mar 24, 2020
commit b382a7f5f34d51c711ee9f9aa91b2bb5e1f6e93f
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ The iwasm supports the following architectures:

- X86-64, X86-32
- ARM, THUMB (ARMV7 Cortex-M7 and Cortex-A15 are tested)
- AArch64 (Cortex-A57 and Cortex-A53 are tested)
- MIPS
- XTENSA

Expand Down
5 changes: 4 additions & 1 deletion build-scripts/config_common.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ elseif (WAMR_BUILD_TARGET MATCHES "THUMB.*")
add_definitions(-DBUILD_TARGET_THUMB)
add_definitions(-DBUILD_TARGET="${WAMR_BUILD_TARGET}")
endif ()
elseif (WAMR_BUILD_TARGET MATCHES "AARCH64.*")
add_definitions(-DBUILD_TARGET_AARCH64)
add_definitions(-DBUILD_TARGET="${WAMR_BUILD_TARGET}")
elseif (WAMR_BUILD_TARGET STREQUAL "MIPS")
add_definitions(-DBUILD_TARGET_MIPS)
elseif (WAMR_BUILD_TARGET STREQUAL "XTENSA")
Expand All @@ -40,7 +43,7 @@ if (CMAKE_BUILD_TYPE STREQUAL "Debug")
endif ()

if (CMAKE_SIZEOF_VOID_P EQUAL 8)
if (WAMR_BUILD_TARGET STREQUAL "X86_64" OR WAMR_BUILD_TARGET STREQUAL "AMD_64")
if (WAMR_BUILD_TARGET STREQUAL "X86_64" OR WAMR_BUILD_TARGET STREQUAL "AMD_64" OR WAMR_BUILD_TARGET MATCHES "AARCH64.*")
# Add -fPIC flag if build as 64-bit
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIC")
set (CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "${CMAKE_SHARED_LIBRARY_LINK_C_FLAGS} -fPIC")
Expand Down
2 changes: 1 addition & 1 deletion build-scripts/runtime_lib.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ endif ()
# Set default options

# Set WAMR_BUILD_TARGET, currently values supported:
# "X86_64", "AMD_64", "X86_32", "ARM[sub]", "THUMB[sub]", "MIPS", "XTENSA"
# "X86_64", "AMD_64", "X86_32", "AARCH64[sub]", "ARM[sub]", "THUMB[sub]", "MIPS", "XTENSA"
if (NOT DEFINED WAMR_BUILD_TARGET)
if (CMAKE_SIZEOF_VOID_P EQUAL 8)
# Build as X86_64 by default in 64-bit platform
Expand Down
3 changes: 3 additions & 0 deletions core/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

#if !defined(BUILD_TARGET_X86_64) \
&& !defined(BUILD_TARGET_AMD_64) \
&& !defined(BUILD_TARGET_AARCH64) \
&& !defined(BUILD_TARGET_X86_32) \
&& !defined(BUILD_TARGET_ARM) \
&& !defined(BUILD_TARGET_ARM_VFP) \
Expand All @@ -19,6 +20,8 @@
#define BUILD_TARGET_X86_64
#elif defined(__amd64__) || defined(__amd64)
#define BUILD_TARGET_AMD_64
#elif defined(__aarch64__)
#define BUILD_TARGET_AARCH64
#elif defined(__i386__) || defined(__i386) || defined(i386)
#define BUILD_TARGET_X86_32
#elif defined(__thumb__)
Expand Down
2 changes: 2 additions & 0 deletions core/iwasm/aot/aot_loader.c
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@ GET_U64_FROM_ADDR(uint32 *addr)
#define E_MACHINE_MIPS 8 /* MIPS R3000 big-endian */
#define E_MACHINE_MIPS_RS3_LE 10 /* MIPS R3000 little-endian */
#define E_MACHINE_ARM 40 /* ARM/Thumb */
#define E_MACHINE_AARCH64 183 /* AArch64 */
#define E_MACHINE_ARC 45 /* Argonaut RISC Core */
#define E_MACHINE_IA_64 50 /* Intel Merced */
#define E_MACHINE_MIPS_X 51 /* Stanford MIPS-X */
Expand Down Expand Up @@ -196,6 +197,7 @@ get_aot_file_target(AOTTargetInfo *target_info,
machine_type = "i386";
break;
case E_MACHINE_ARM:
case E_MACHINE_AARCH64:
machine_type = target_info->arch;
break;
case E_MACHINE_MIPS:
Expand Down
3 changes: 1 addition & 2 deletions core/iwasm/aot/aot_reloc.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,8 @@ typedef struct {

#define REG_COMMON_SYMBOLS \
REG_SYM(aot_set_exception_with_id), \
REG_SYM(aot_get_exception), \
REG_SYM(aot_is_wasm_type_equal), \
REG_SYM(aot_invoke_native), \
REG_SYM(aot_call_indirect), \
REG_SYM(wasm_runtime_enlarge_memory), \
REG_SYM(wasm_runtime_set_exception), \
REG_SYM(fmin), \
Expand Down
78 changes: 68 additions & 10 deletions core/iwasm/aot/aot_runtime.c
Original file line number Diff line number Diff line change
Expand Up @@ -811,7 +811,7 @@ aot_is_wasm_type_equal(AOTModuleInstance *module_inst,
return wasm_type_equal(type1, type2);
}

void
bool
aot_invoke_native(WASMExecEnv *exec_env, uint32 func_idx,
uint32 *frame_lp, uint32 argc, uint32 *argv_ret)
{
Expand All @@ -827,18 +827,76 @@ aot_invoke_native(WASMExecEnv *exec_env, uint32 func_idx,
const char *signature = NULL;
char buf[128];

bh_assert(func_idx < aot_module->import_func_count);

import_func = aot_module->import_funcs + func_idx;
if (!func_ptr) {
snprintf(buf, sizeof(buf),
"fail to call unlinked import function (%s, %s)",
import_func->module_name, import_func->func_name);
aot_set_exception(module_inst, buf);
return false;
}

signature = import_func->signature;
return wasm_runtime_invoke_native(exec_env, func_ptr,
func_type, signature,
frame_lp, argc, argv_ret);
}

bool
aot_call_indirect(WASMExecEnv *exec_env,
uint32 func_type_idx, uint32 table_elem_idx,
uint32 *frame_lp, uint32 argc, uint32 *argv_ret)
{
AOTModuleInstance *module_inst = (AOTModuleInstance*)
wasm_runtime_get_module_inst(exec_env);
AOTModule *aot_module = (AOTModule*)module_inst->aot_module.ptr;
uint32 *func_type_indexes = (uint32*)module_inst->func_type_indexes.ptr;
uint32 *table_data = (uint32*)module_inst->table_data.ptr;
AOTFuncType *func_type = aot_module->func_types[func_type_idx];;
void **func_ptrs = (void**)module_inst->func_ptrs.ptr, *func_ptr;
uint32 table_size = module_inst->table_size;
uint32 func_idx, func_type_idx1;
AOTImportFunc *import_func;
const char *signature = NULL;
char buf[128];

if (table_elem_idx >= table_size) {
aot_set_exception_with_id(module_inst, EXCE_UNDEFINED_ELEMENT);
return false;
}

func_idx = table_data[table_elem_idx];
if (func_idx == (uint32)-1) {
aot_set_exception_with_id(module_inst, EXCE_UNINITIALIZED_ELEMENT);
return false;
}

func_type_idx1 = func_type_indexes[func_idx];
if (!aot_is_wasm_type_equal(module_inst, func_type_idx, func_type_idx1)) {
aot_set_exception_with_id(module_inst, EXCE_INVALID_FUNCTION_TYPE_INDEX);
return false;
}

if (func_idx < aot_module->import_func_count) {
/* Call native function */
import_func = aot_module->import_funcs + func_idx;
if (!func_ptr) {
snprintf(buf, sizeof(buf),
"fail to call unlinked import function (%s, %s)",
import_func->module_name, import_func->func_name);
aot_set_exception(module_inst, buf);
return;
}
signature = import_func->signature;
}
wasm_runtime_invoke_native(exec_env, func_ptr,
func_type, signature, frame_lp, argc, argv_ret);

if (!(func_ptr = func_ptrs[func_idx])) {
bh_assert(func_idx < aot_module->import_func_count);
import_func = aot_module->import_funcs + func_idx;
snprintf(buf, sizeof(buf),
"fail to call unlinked import function (%s, %s)",
import_func->module_name, import_func->func_name);
aot_set_exception(module_inst, buf);
return false;
}

return wasm_runtime_invoke_native(exec_env, func_ptr,
func_type, signature,
frame_lp, argc, argv_ret);
}

7 changes: 6 additions & 1 deletion core/iwasm/aot/aot_runtime.h
Original file line number Diff line number Diff line change
Expand Up @@ -435,10 +435,15 @@ aot_is_wasm_type_equal(AOTModuleInstance *module_inst,
/**
* Invoke native function from aot code
*/
void
bool
aot_invoke_native(WASMExecEnv *exec_env, uint32 func_idx,
uint32 *frame_lp, uint32 argc, uint32 *argv_ret);

bool
aot_call_indirect(WASMExecEnv *exec_env,
uint32 func_type_idx, uint32 table_elem_idx,
uint32 *frame_lp, uint32 argc, uint32 *argv_ret);

uint32
aot_get_plt_table_size();

Expand Down
Loading