Skip to content

Commit 90cccda

Browse files
authored
Refine some error msg, comment and document (#921)
1 parent 50b6474 commit 90cccda

File tree

4 files changed

+20
-16
lines changed

4 files changed

+20
-16
lines changed

core/iwasm/common/wasm_application.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,9 +92,9 @@ wasm_application_execute_main(WASMModuleInstanceCommon *module_inst, int32 argc,
9292
bool ret, is_import_func = true;
9393

9494
#if WASM_ENABLE_LIBC_WASI != 0
95-
/* In wasi mode, we should call function named "_start"
95+
/* In wasi mode, we should call the function named "_start"
9696
which initializes the wasi envrionment and then calls
97-
the actual main function. Directly call main function
97+
the actual main function. Directly calling main function
9898
may cause exception thrown. */
9999
if ((func = wasm_runtime_lookup_wasi_start_function(module_inst))) {
100100
return wasm_runtime_create_exec_env_and_call_wasm(module_inst, func, 0,

core/iwasm/interpreter/wasm_loader.c

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3458,15 +3458,15 @@ load(const uint8 *buf, uint32 size, WASMModule *module, char *error_buf,
34583458
}
34593459

34603460
#if (WASM_ENABLE_MULTI_MODULE != 0) && (WASM_ENABLE_LIBC_WASI != 0)
3461-
/*
3461+
/**
34623462
* refer to
34633463
* https://github.com/WebAssembly/WASI/blob/main/design/application-abi.md
34643464
*/
34653465
static bool
34663466
check_wasi_abi_compatibility(const WASMModule *module, bool main_module,
34673467
char *error_buf, uint32 error_buf_size)
34683468
{
3469-
/*
3469+
/**
34703470
* need to handle:
34713471
* - non-wasi compatiable modules
34723472
* - a fake wasi compatiable module
@@ -3477,7 +3477,7 @@ check_wasi_abi_compatibility(const WASMModule *module, bool main_module,
34773477
*
34783478
* be careful with:
34793479
* wasi compatiable modules(command/reactor) which don't import any wasi
3480-
* APIs. usually, a command has to import a "prox_exit" at least. but a
3480+
* APIs. Usually, a command has to import a "prox_exit" at least, but a
34813481
* reactor can depend on nothing. At the same time, each has its own entry
34823482
* point.
34833483
*
@@ -3503,7 +3503,7 @@ check_wasi_abi_compatibility(const WASMModule *module, bool main_module,
35033503
->func_type;
35043504
if (func_type->param_count || func_type->result_count) {
35053505
set_error_buf(error_buf, error_buf_size,
3506-
"The builtin _start() is with a wrong signature");
3506+
"the signature of builtin _start function is wrong");
35073507
return false;
35083508
}
35093509
}
@@ -3518,7 +3518,7 @@ check_wasi_abi_compatibility(const WASMModule *module, bool main_module,
35183518
if (func_type->param_count || func_type->result_count) {
35193519
set_error_buf(
35203520
error_buf, error_buf_size,
3521-
"The builtin _initiazlie() is with a wrong signature");
3521+
"the signature of builtin _initialize function is wrong");
35223522
return false;
35233523
}
35243524
}
@@ -3532,7 +3532,7 @@ check_wasi_abi_compatibility(const WASMModule *module, bool main_module,
35323532
if (module->import_wasi_api && !start && !initialize) {
35333533
set_error_buf(
35343534
error_buf, error_buf_size,
3535-
"A module with WASI apis should be either a command or a reactor");
3535+
"a module with WASI apis must be either a command or a reactor");
35363536
return false;
35373537
}
35383538

@@ -3545,14 +3545,16 @@ check_wasi_abi_compatibility(const WASMModule *module, bool main_module,
35453545
if (start && initialize) {
35463546
set_error_buf(
35473547
error_buf, error_buf_size,
3548-
"Neither a command nor a reactor can have both at the same time");
3548+
"neither a command nor a reactor can both have _start function "
3549+
"and _initialize function at the same time");
35493550
return false;
35503551
}
35513552

35523553
/* filter out commands (with `_start`) cases */
35533554
if (start && !main_module) {
3554-
set_error_buf(error_buf, error_buf_size,
3555-
"A command(with _start) can not be a sud-module");
3555+
set_error_buf(
3556+
error_buf, error_buf_size,
3557+
"a command (with _start function) can not be a sub-module");
35563558
return false;
35573559
}
35583560

@@ -3564,9 +3566,8 @@ check_wasi_abi_compatibility(const WASMModule *module, bool main_module,
35643566
memory = wasm_loader_find_export(module, "", "memory", EXPORT_KIND_MEMORY,
35653567
error_buf, error_buf_size);
35663568
if (!memory) {
3567-
set_error_buf(
3568-
error_buf, error_buf_size,
3569-
"A module with WASI apis should export memory by default");
3569+
set_error_buf(error_buf, error_buf_size,
3570+
"a module with WASI apis must export memory by default");
35703571
return false;
35713572
}
35723573

@@ -3596,7 +3597,7 @@ wasm_loader_load(const uint8 *buf, uint32 size,
35963597
}
35973598

35983599
#if (WASM_ENABLE_MULTI_MODULE != 0) && (WASM_ENABLE_LIBC_WASI != 0)
3599-
/* do a check about WASI Application ABI */
3600+
/* Check the WASI application ABI */
36003601
if (!check_wasi_abi_compatibility(module, main_module, error_buf,
36013602
error_buf_size)) {
36023603
goto fail;

doc/build_wamr.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -306,7 +306,7 @@ WAMR provides some features which can be easily configured by passing options to
306306
307307
Zephyr
308308
-------------------------
309-
You need to prepare Zephyr first as described here https://docs.zephyrproject.org/latest/getting_started/index.html#get-zephyr-and-install-python-dependencies).
309+
You need to prepare Zephyr first as described here https://docs.zephyrproject.org/latest/getting_started/index.html#get-zephyr-and-install-python-dependencies.
310310
311311
After that you need to point the `ZEPHYR_BASE` variable to e.g. `~/zephyrproject/zephyr`. Also, it is important that you have `west` available for subsequent actions.
312312

product-mini/platforms/zephyr/simple/Dockerfile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
# Copyright (C) 2019 Intel Corporation. All rights reserved.
2+
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
3+
14
FROM ubuntu:20.04
25

36
ARG DOCKER_UID=1000

0 commit comments

Comments
 (0)