Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
25 changes: 23 additions & 2 deletions .github/workflows/android.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,14 @@ jobs:
cmake ..
make -j $(nproc)
cd .. && rm -rf build
- name: Build iwasm [Classic interp]
- name: Build iwasm [classic interp]
run: |
cd product-mini/platforms/android
mkdir build && cd build
cmake .. -DWAMR_BUILD_FAST_INTERP=0
make -j $(nproc)
cd .. && rm -rf build
- name: Build iwasm [Multi module]
- name: Build iwasm [multi module]
run: |
cd product-mini/platforms/android
mkdir build && cd build
Expand Down Expand Up @@ -89,3 +89,24 @@ jobs:
cmake .. -DWAMR_BUILD_CUSTOM_NAME_SECTION=1
make -j $(nproc)
cd .. && rm -rf build
- name: Build iwasm [disable hardware boundary check]
run: |
cd product-mini/platforms/android
mkdir build && cd build
cmake .. -DWAMR_DISABLE_HW_BOUND_CHECK=1
make -j $(nproc)
cd .. && rm -rf build
- name: Build iwasm [reference types]
run: |
cd product-mini/platforms/android
mkdir build && cd build
cmake .. -DWAMR_BUILD_REF_TYPES=1
make -j $(nproc)
cd .. && rm -rf build
- name: Build iwasm [128-bit SIMD]
run: |
cd product-mini/platforms/android
mkdir build && cd build
cmake .. -DWAMR_BUILD_SIMD=1
make -j $(nproc)
cd .. && rm -rf build
41 changes: 39 additions & 2 deletions .github/workflows/linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,14 @@ jobs:
cmake ..
make -j $(nproc)
cd .. && rm -rf build
- name: Build iwasm [Classic interp]
- name: Build iwasm [classic interp]
run: |
cd product-mini/platforms/linux
mkdir build && cd build
cmake .. -DWAMR_BUILD_FAST_INTERP=0
make -j $(nproc)
cd .. && rm -rf build
- name: Build iwasm [Multi module]
- name: Build iwasm [multi module]
run: |
cd product-mini/platforms/linux
mkdir build && cd build
Expand Down Expand Up @@ -87,6 +87,27 @@ jobs:
cmake .. -DWAMR_BUILD_CUSTOM_NAME_SECTION=1
make -j $(nproc)
cd .. && rm -rf build
- name: Build iwasm [disable hardware boundary check]
run: |
cd product-mini/platforms/linux
mkdir build && cd build
cmake .. -DWAMR_DISABLE_HW_BOUND_CHECK=1
make -j $(nproc)
cd .. && rm -rf build
- name: Build iwasm [reference types]
run: |
cd product-mini/platforms/linux
mkdir build && cd build
cmake .. -DWAMR_BUILD_REF_TYPES=1
make -j $(nproc)
cd .. && rm -rf build
- name: Build iwasm [128-bit SIMD]
run: |
cd product-mini/platforms/linux
mkdir build && cd build
cmake .. -DWAMR_BUILD_SIMD=1
make -j $(nproc)
cd .. && rm -rf build
- name: Cache LLVM libraries
uses: actions/cache@v2
id: cache_llvm
Expand Down Expand Up @@ -132,7 +153,10 @@ jobs:
./callback_chain
./global
./hello
./hostref
./memory
./reflect
./table
./trap
cd .. && rm -r build
- name: Build Sample [wasm-c-api] [Jit]
Expand All @@ -145,7 +169,10 @@ jobs:
./callback_chain
./global
./hello
./hostref
./memory
./reflect
./table
./trap
cd .. && rm -r build
- name: Build Sample [wasm-c-api] [Aot]
Expand All @@ -158,7 +185,10 @@ jobs:
./callback_chain
./global
./hello
./hostref
./memory
./reflect
./table
./trap
cd .. && rm -r build
- name: Build Sample [basic]
Expand Down Expand Up @@ -187,3 +217,10 @@ jobs:
cmake ..
make -j $(nproc)
./spawn_thread
- name: Build Sample [ref-types]
run: |
cd samples/ref-types
mkdir build && cd build
cmake ..
make -j $(nproc)
./hello
53 changes: 40 additions & 13 deletions .github/workflows/mac.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,63 +26,84 @@ jobs:
cd product-mini/platforms/darwin
mkdir build && cd build
cmake ..
make
make -j $(nproc)
cd .. && rm -rf build
- name: Build iwasm [Classic interp]
- name: Build iwasm [classic interp]
run: |
cd product-mini/platforms/darwin
mkdir build && cd build
cmake .. -DWAMR_BUILD_FAST_INTERP=0
make
make -j $(nproc)
cd .. && rm -rf build
- name: Build iwasm [Multi module]
- name: Build iwasm [multi module]
run: |
cd product-mini/platforms/darwin
mkdir build && cd build
cmake .. -DWAMR_BUILD_MULTI_MODULE=1
make
make -j $(nproc)
cd .. && rm -rf build
- name: Build iwasm [lib-pthread]
run: |
cd product-mini/platforms/darwin
mkdir build && cd build
cmake .. -DWAMR_BUILD_LIB_PTHREAD=1
make
make -j $(nproc)
cd .. && rm -rf build
- name: Build iwasm [aot only]
run: |
cd product-mini/platforms/darwin
mkdir build && cd build
cmake .. -DWAMR_BUILD_AOT=1 -DWAMR_BUILD_INTERP=0
make
make -j $(nproc)
cd .. && rm -rf build
- name: Build iwasm [interp only]
run: |
cd product-mini/platforms/darwin
mkdir build && cd build
cmake .. -DWAMR_BUILD_AOT=0
make
make -j $(nproc)
cd .. && rm -rf build
- name: Build iwasm [memory profiling]
run: |
cd product-mini/platforms/darwin
mkdir build && cd build
cmake .. -DWAMR_BUILD_MEMORY_PROFILING=1
make
make -j $(nproc)
cd .. && rm -rf build
- name: Build iwasm [tail call]
run: |
cd product-mini/platforms/darwin
mkdir build && cd build
cmake .. -DWAMR_BUILD_TAIL_CALL=1
make
make -j $(nproc)
cd .. && rm -rf build
- name: Build iwasm [custom name section]
run: |
cd product-mini/platforms/darwin
mkdir build && cd build
cmake .. -DWAMR_BUILD_CUSTOM_NAME_SECTION=1
make
make -j $(nproc)
cd .. && rm -rf build
- name: Build iwasm [disable hardware boundary check]
run: |
cd product-mini/platforms/darwin
mkdir build && cd build
cmake .. -DWAMR_DISABLE_HW_BOUND_CHECK=1
make -j $(nproc)
cd .. && rm -rf build
- name: Build iwasm [ref types]
run: |
cd product-mini/platforms/darwin
mkdir build && cd build
cmake .. -DWAMR_BUILD_REF_TYPES=1
make -j $(nproc)
cd .. && rm -rf build
- name: Build iwasm [128-bit SIMD]
run: |
cd product-mini/platforms/darwin
mkdir build && cd build
cmake .. -DWAMR_BUILD_SIMD=1
make -j $(nproc)
cd .. && rm -rf build
- name: download and install wabt
run: |
Expand All @@ -96,6 +117,12 @@ jobs:
mkdir build && cd build
cmake ..
make
./hello
./global
./callback
./callback_chain
./global
./hello
./hostref
./memory
./reflect
./table
./trap
21 changes: 21 additions & 0 deletions .github/workflows/windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,4 +60,25 @@ jobs:
cmake .. -DWAMR_BUILD_CUSTOM_NAME_SECTION=1
cmake --build . --config Release
cd .. && rm -force -r build
- name: Build iwasm [disable hardware boundary check]
run: |
cd product-mini/platforms/windows
mkdir build && cd build
cmake .. -DWAMR_DISABLE_HW_BOUND_CHECK=1
cmake --build . --config Release
cd .. && rm -force -r build
- name: Build iwasm [reference types]
run: |
cd product-mini/platforms/windows
mkdir build && cd build
cmake .. -DWAMR_BUILD_REF_TYPES=1
cmake --build . --config Release
cd .. && rm -force -r build
- name: Build iwasm [128-bit SIMD]
run: |
cd product-mini/platforms/windows
mkdir build && cd build
cmake .. -DWAMR_BUILD_SIMD=1
cmake --build . --config Release
cd .. && rm -force -r build

28 changes: 15 additions & 13 deletions core/iwasm/common/wasm_c_api.c
Original file line number Diff line number Diff line change
Expand Up @@ -130,8 +130,8 @@ failed: \
} \
\
if (data) { \
unsigned int size_in_bytes = 0; \
size_in_bytes = size * sizeof(wasm_##name##_t); \
uint32 size_in_bytes = 0; \
size_in_bytes = (uint32)(size * sizeof(wasm_##name##_t)); \
bh_memcpy_s(out->data, size_in_bytes, data, size_in_bytes); \
out->num_elems = size; \
} \
Expand Down Expand Up @@ -173,8 +173,8 @@ failed: \
} \
\
if (data) { \
unsigned int size_in_bytes = 0; \
size_in_bytes = size * sizeof(wasm_##name##_t *); \
uint32 size_in_bytes = 0; \
size_in_bytes = (uint32)(size * sizeof(wasm_##name##_t *)); \
bh_memcpy_s(out->data, size_in_bytes, data, size_in_bytes); \
out->num_elems = size; \
} \
Expand Down Expand Up @@ -434,12 +434,14 @@ wasm_store_delete(wasm_store_t *store)
for (i = 0; i != store_count; ++i) {
wasm_store_t *tmp;

if (!bh_vector_get((Vector *)singleton_engine->stores, i, &tmp)) {
if (!bh_vector_get((Vector *)singleton_engine->stores,
(uint32)i, &tmp)) {
break;
}

if (tmp == store) {
bh_vector_remove((Vector *)singleton_engine->stores, i, NULL);
bh_vector_remove((Vector *)singleton_engine->stores,
(uint32)i, NULL);
break;
}
}
Expand Down Expand Up @@ -1509,9 +1511,9 @@ wasm_frame_new(wasm_instance_t *instance,
}

frame->instance = instance;
frame->module_offset = module_offset;
frame->module_offset = (uint32)module_offset;
frame->func_index = func_index;
frame->func_offset = func_offset;
frame->func_offset = (uint32)func_offset;
return frame;
}

Expand Down Expand Up @@ -1787,7 +1789,7 @@ wasm_foreign_new(wasm_store_t *store)

foreign->store = store;
foreign->kind = WASM_REF_foreign;
foreign->foreign_idx_rt = bh_vector_size(store->foreigns);
foreign->foreign_idx_rt = (uint32)bh_vector_size(store->foreigns);
if (!(bh_vector_append(store->foreigns, &foreign))) {
wasm_runtime_free(foreign);
return NULL;
Expand Down Expand Up @@ -1932,10 +1934,10 @@ wasm_module_validate(wasm_store_t *store, const wasm_byte_vec_t *binary)

if (!store || !binary || binary->size > UINT32_MAX) {
LOG_ERROR("%s failed", __FUNCTION__);
return NULL;
return false;
}

if ((module_rt = wasm_runtime_load((uint8 *)binary->data, binary->size,
if ((module_rt = wasm_runtime_load((uint8 *)binary->data, (uint32)binary->size,
error_buf, 128))) {
wasm_runtime_unload(module_rt);
return true;
Expand Down Expand Up @@ -3415,7 +3417,7 @@ wasm_table_get(const wasm_table_t *table, wasm_table_size_t index)
if (table->inst_comm_rt->module_type == Wasm_Module_AoT) {
AOTModuleInstance *inst_aot = (AOTModuleInstance *)table->inst_comm_rt;
AOTTableInstance *table_aot =
inst_aot->tables.ptr + table->table_idx_rt;
(AOTTableInstance*)inst_aot->tables.ptr + table->table_idx_rt;
if (index >= table_aot->cur_size) {
return NULL;
}
Expand Down Expand Up @@ -3478,7 +3480,7 @@ wasm_table_set(wasm_table_t *table,
AOTModuleInstance *inst_aot = (AOTModuleInstance *)table->inst_comm_rt;
AOTModule *module_aot = (AOTModule *)inst_aot->aot_module.ptr;
AOTTableInstance *table_aot =
inst_aot->tables.ptr + table->table_idx_rt;
(AOTTableInstance *)inst_aot->tables.ptr + table->table_idx_rt;

if (index >= table_aot->cur_size) {
return false;
Expand Down
2 changes: 1 addition & 1 deletion core/iwasm/common/wasm_runtime_common.c
Original file line number Diff line number Diff line change
Expand Up @@ -4110,7 +4110,7 @@ wasm_runtime_invoke_c_api_native(WASMModuleInstanceCommon *module_inst,
char trap_message[128] = { 0 };
bh_memcpy_s(
trap_message, 127, trap->message->data,
(trap->message->size < 127 ? trap->message->size : 127));
(trap->message->size < 127 ? (uint32)trap->message->size : 127));
wasm_runtime_set_exception(module_inst, trap_message);
}
else {
Expand Down
2 changes: 1 addition & 1 deletion samples/wasm-c-api/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ foreach(EX ${EXAMPLES})
# generate .aot file
if(${WAMR_BUILD_AOT} EQUAL 1)
add_custom_target(${EX}_AOT
COMMAND ${WAMRC} -o ${PROJECT_BINARY_DIR}/${EX}.aot
COMMAND ${WAMRC} --enable-ref-types -o ${PROJECT_BINARY_DIR}/${EX}.aot
${PROJECT_BINARY_DIR}/${EX}.wasm
DEPENDS ${EX}_WASM
BYPRODUCTS ${PROJECT_BINARY_DIR}/${EX}.aot
Expand Down
4 changes: 4 additions & 0 deletions samples/wasm-c-api/src/hostref.c
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,11 @@ int main(int argc, const char* argv[]) {

// Load binary.
printf("Loading binary...\n");
#if WASM_ENABLE_AOT != 0 && WASM_ENABLE_INTERP == 0
FILE* file = fopen("hostref.aot", "rb");
#else
FILE* file = fopen("hostref.wasm", "rb");
#endif
if (!file) {
printf("> Error loading module!\n");
return 1;
Expand Down
Loading