Skip to content

Commit 49127ef

Browse files
authored
Re-org shared lib header files, remove unused info (#136)
And fix compile issues of vxworks
1 parent 2899394 commit 49127ef

File tree

24 files changed

+103
-130
lines changed

24 files changed

+103
-130
lines changed

core/app-mgr/app-manager/app_manager.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
#include "bh_platform.h"
2121
#include "bh_common.h"
2222
#include "bh_queue.h"
23-
#include "korp_types.h"
23+
#include "bh_types.h"
2424
#include "app_manager_export.h"
2525
#include "native_interface.h"
2626
#include "shared_utils.h"

core/app-mgr/app-manager/app_manager_host.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
*/
1616

1717
#include "bh_common.h"
18-
#include "korp_types.h"
18+
#include "bh_types.h"
1919
#include "app_manager_host.h"
2020
#include "app_manager.h"
2121
#include "app_manager_export.h"

core/app-mgr/app-manager/watchdog.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,8 @@ bool watchdog_timer_init(module_data *m_data)
5252
#ifdef WATCHDOG_ENABLED /* TODO */
5353
watchdog_timer *wd_timer = &m_data->wd_timer;
5454

55-
if (BH_SUCCESS != vm_mutex_init(&wd_timer->lock))
56-
return false;
55+
if (0 != vm_mutex_init(&wd_timer->lock))
56+
return false;
5757

5858
if (!(wd_timer->timer_handle =
5959
app_manager_timer_create(watchdog_timer_callback, wd_timer))) {

core/iwasm/lib/native/extension/connection/linux/connection_mgr.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@
2828
#include "conn_tcp.h"
2929
#include "conn_udp.h"
3030
#include "conn_uart.h"
31-
#include "bh_definition.h"
3231

3332
#include <unistd.h>
3433
#include <sys/epoll.h>
@@ -545,7 +544,7 @@ bool init_connection_framework()
545544
if (epollfd == -1)
546545
return false;
547546

548-
if (vm_mutex_init(&g_lock) != BH_SUCCESS) {
547+
if (vm_mutex_init(&g_lock) != 0) {
549548
close(epollfd);
550549
return false;
551550
}
@@ -562,7 +561,7 @@ bool init_connection_framework()
562561
if (vm_thread_create(&tid,
563562
polling_thread_routine,
564563
NULL,
565-
BH_APPLET_PRESERVED_STACK_SIZE) != BH_SUCCESS) {
564+
BH_APPLET_PRESERVED_STACK_SIZE) != 0) {
566565
goto fail;
567566
}
568567

core/iwasm/products/vxworks/CMakeLists.txt

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,13 +32,17 @@ if (NOT ("$ENV{VALGRIND}" STREQUAL "YES"))
3232
endif ()
3333

3434
# Set BUILD_TARGET, currently values supported:
35-
# "X86_64", "AMD_64", "X86_32", "ARM_32", "MIPS_32", "XTENSA_32"
35+
# "X86_64", "AMD_64", "X86_32", "ARM_32", "MIPS_32", "XTENSA_32", "GENERAL"
36+
#set (BUILD_TARGET "X86_64")
37+
3638
if (NOT BUILD_TARGET)
3739
if (CMAKE_SIZEOF_VOID_P EQUAL 8)
3840
# Build as X86_64 by default in 64-bit platform
41+
# if BUILD_TARGET isn't set
3942
set (BUILD_TARGET "X86_64")
4043
else ()
4144
# Build as X86_32 by default in 32-bit platform
45+
# if BUILD_TARGET isn't set
4246
set (BUILD_TARGET "X86_32")
4347
endif ()
4448
endif ()
@@ -58,6 +62,14 @@ elseif (BUILD_TARGET STREQUAL "MIPS_32")
5862
add_definitions(-DBUILD_TARGET_MIPS_32)
5963
elseif (BUILD_TARGET STREQUAL "XTENSA_32")
6064
add_definitions(-DBUILD_TARGET_XTENSA_32)
65+
elseif (BUILD_TARGET STREQUAL "GENERAL")
66+
# Will use invokeNative_general.c instead of assembly code,
67+
# but the maximum number of native arguments is limited to 20,
68+
# and there are possible issues when passing arguments to
69+
# native function for some cpus, e.g. int64 and double arguments
70+
# in arm and mips need to be 8-bytes aligned, and some arguments
71+
# of x86_64 are passed by registers but not stack
72+
add_definitions(-DBUILD_TARGET_GENERAL)
6173
else ()
6274
message (FATAL_ERROR "-- Build target isn't set")
6375
endif ()
@@ -91,6 +103,8 @@ include_directories (.
91103
../../runtime/platform/include
92104
${SHARED_LIB_DIR}/include)
93105

106+
enable_language (ASM)
107+
94108
include (../../runtime/platform/${PLATFORM}/platform.cmake)
95109
include (../../runtime/utils/utils.cmake)
96110
include (../../runtime/vmcore-wasm/vmcore.cmake)

core/iwasm/products/vxworks/main.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,9 @@
1919
#endif
2020
#include <stdlib.h>
2121
#include <string.h>
22+
#include "bh_platform.h"
2223
#include "wasm_assert.h"
2324
#include "wasm_log.h"
24-
#include "wasm_platform.h"
2525
#include "wasm_platform_log.h"
2626
#include "wasm_thread.h"
2727
#include "wasm_export.h"

core/iwasm/runtime/vmcore-wasm/vmcore.cmake

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ elseif (${BUILD_TARGET} STREQUAL "MIPS_32")
3030
set (source_all ${c_source_all} ${VMCORE_LIB_DIR}/invokeNative_mips.s)
3131
elseif (${BUILD_TARGET} STREQUAL "XTENSA_32")
3232
set (source_all ${c_source_all} ${VMCORE_LIB_DIR}/invokeNative_xtensa.s)
33+
elseif (${BUILD_TARGET} STREQUAL "GENERAL")
34+
set (source_all ${c_source_all} ${VMCORE_LIB_DIR}/invokeNative_general.c)
3335
else ()
3436
message (FATAL_ERROR "Build target isn't set")
3537
endif ()

core/shared-lib/include/bh_common.h

100755100644
Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
#define _BH_COMMON_H
1919

2020
#include "bh_assert.h"
21-
#include "bh_definition.h"
2221
#include "bh_platform.h"
2322
#include "bh_log.h"
2423
#include "bh_list.h"

core/shared-lib/include/bh_list.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
extern "C" {
2222
#endif
2323

24-
#include "korp_types.h" /*For bool type*/
24+
#include "bh_types.h" /*For bool type*/
2525
#include "bh_platform.h"
2626

2727
/* List user should embedded bh_list_link into list elem data structure

core/shared-lib/include/bh_log.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434

3535
#include <stdarg.h>
3636

37-
#include "korp_types.h"
37+
#include "bh_types.h"
3838

3939
#ifdef __cplusplus
4040
extern "C" {

0 commit comments

Comments
 (0)