Skip to content

Commit 046f5f2

Browse files
authoredSep 17, 2022
Fix Windows/MSVC build issues (bytecodealliance#1498)
Fix two issues of building WAMR on Windows: - The build_llvm.py script calls itself, spawning instances faster than they expire, which makes Python3 eat up the entire RAM in a pretty short time. - The MSVC compiler doesn't support preprocessor statements inside macro expressions. Two places inside bh_assert() were found.
1 parent 12bbb91 commit 046f5f2

File tree

3 files changed

+21
-13
lines changed

3 files changed

+21
-13
lines changed
 

‎core/iwasm/aot/aot_runtime.c

+7-3
Original file line numberDiff line numberDiff line change
@@ -244,14 +244,18 @@ table_instantiate(AOTModuleInstance *module_inst, AOTModule *module,
244244
tbl_inst = aot_get_table_inst(module_inst, table_seg->table_index);
245245
bh_assert(tbl_inst);
246246

247+
#if WASM_ENABLE_REF_TYPES != 0
247248
bh_assert(
248249
table_seg->offset.init_expr_type == INIT_EXPR_TYPE_I32_CONST
249250
|| table_seg->offset.init_expr_type == INIT_EXPR_TYPE_GET_GLOBAL
250-
#if WASM_ENABLE_REF_TYPES != 0
251251
|| table_seg->offset.init_expr_type == INIT_EXPR_TYPE_FUNCREF_CONST
252-
|| table_seg->offset.init_expr_type == INIT_EXPR_TYPE_REFNULL_CONST
252+
|| table_seg->offset.init_expr_type
253+
== INIT_EXPR_TYPE_REFNULL_CONST);
254+
#else
255+
bh_assert(table_seg->offset.init_expr_type == INIT_EXPR_TYPE_I32_CONST
256+
|| table_seg->offset.init_expr_type
257+
== INIT_EXPR_TYPE_GET_GLOBAL);
253258
#endif
254-
);
255259

256260
/* Resolve table data base offset */
257261
if (table_seg->offset.init_expr_type == INIT_EXPR_TYPE_GET_GLOBAL) {

‎core/iwasm/interpreter/wasm_runtime.c

+13-9
Original file line numberDiff line numberDiff line change
@@ -1587,17 +1587,21 @@ wasm_instantiate(WASMModule *module, bool is_sub_inst, uint32 stack_size,
15871587
#endif
15881588

15891589
/* init vec(funcidx) or vec(expr) */
1590-
bh_assert(
1591-
table_seg->base_offset.init_expr_type == INIT_EXPR_TYPE_I32_CONST
1592-
|| table_seg->base_offset.init_expr_type
1593-
== INIT_EXPR_TYPE_GET_GLOBAL
15941590
#if WASM_ENABLE_REF_TYPES != 0
1595-
|| table_seg->base_offset.init_expr_type
1596-
== INIT_EXPR_TYPE_FUNCREF_CONST
1597-
|| table_seg->base_offset.init_expr_type
1598-
== INIT_EXPR_TYPE_REFNULL_CONST
1591+
bh_assert(table_seg->base_offset.init_expr_type
1592+
== INIT_EXPR_TYPE_I32_CONST
1593+
|| table_seg->base_offset.init_expr_type
1594+
== INIT_EXPR_TYPE_GET_GLOBAL
1595+
|| table_seg->base_offset.init_expr_type
1596+
== INIT_EXPR_TYPE_FUNCREF_CONST
1597+
|| table_seg->base_offset.init_expr_type
1598+
== INIT_EXPR_TYPE_REFNULL_CONST);
1599+
#else
1600+
bh_assert(table_seg->base_offset.init_expr_type
1601+
== INIT_EXPR_TYPE_I32_CONST
1602+
|| table_seg->base_offset.init_expr_type
1603+
== INIT_EXPR_TYPE_GET_GLOBAL);
15991604
#endif
1600-
);
16011605

16021606
if (table_seg->base_offset.init_expr_type
16031607
== INIT_EXPR_TYPE_GET_GLOBAL) {

‎wamr-compiler/build_llvm.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,4 @@
1111
script = (
1212
pathlib.Path(__file__).parent.joinpath("../build-scripts/build_llvm.py").resolve()
1313
)
14-
subprocess.check_call([sys.executable, script.name])
14+
subprocess.check_call([sys.executable, script])

0 commit comments

Comments
 (0)
Please sign in to comment.