Skip to content

Commit f3069cd

Browse files
committed
add micro AMR_BUILD_LIME1 to enable minimal lime1 feature set
Signed-off-by: zhenweijin <zhenwei.jin@intel.com>
1 parent 14ced7c commit f3069cd

12 files changed

Lines changed: 85 additions & 35 deletions

File tree

build-scripts/config_common.cmake

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -251,6 +251,17 @@ if (NOT DEFINED WAMR_BUILD_EXTENDED_CONST_EXPR)
251251
set (WAMR_BUILD_EXTENDED_CONST_EXPR 0)
252252
endif ()
253253

254+
if (NOT DEFINED WAMR_BUILD_LIME1)
255+
set (WAMR_BUILD_LIME1 0)
256+
endif ()
257+
258+
if (WAMR_BUILD_LIME1 EQUAL 1)
259+
set (WAMR_BUILD_EXTENDED_CONST_EXPR 1)
260+
set (WAMR_BUILD_BULK_MEMORY 0)
261+
set (WAMR_BUILD_SIMD 0)
262+
set (WAMR_BUILD_REF_TYPES 0)
263+
endif ()
264+
254265
########################################
255266
# Compilation options to marco
256267
########################################
@@ -725,6 +736,13 @@ else()
725736
message (" Extended constant expression disabled")
726737
add_definitions(-DWASM_ENABLE_EXTENDED_CONST_EXPR=0)
727738
endif ()
739+
if (WAMR_BUILD_LIME1 EQUAL 1)
740+
message (" Lime1 enabled")
741+
add_definitions(-DWASM_ENABLE_LIME1=1)
742+
else()
743+
message (" Lime1 disabled")
744+
add_definitions(-DWASM_ENABLE_LIME1=0)
745+
endif ()
728746
########################################
729747
# Show Phase4 Wasm proposals status.
730748
########################################

core/config.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -724,4 +724,8 @@ unless used elsewhere */
724724
#define WASM_ENABLE_EXTENDED_CONST_EXPR 0
725725
#endif
726726

727+
#ifndef WASM_ENABLE_LIME1
728+
#define WASM_ENABLE_LIME1 0
729+
#endif
730+
727731
#endif /* end of _CONFIG_H_ */

core/iwasm/compilation/aot_compiler.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2532,6 +2532,8 @@ aot_compile_func(AOTCompContext *comp_ctx, uint32 func_index)
25322532
return false;
25332533
break;
25342534
}
2535+
#endif /* WASM_ENABLE_BULK_MEMORY */
2536+
#if WASM_ENABLE_BULK_MEMORY != 0 || WASM_ENABLE_LIME1 != 0
25352537
case WASM_OP_MEMORY_COPY:
25362538
{
25372539
frame_ip += 2;
@@ -2546,7 +2548,7 @@ aot_compile_func(AOTCompContext *comp_ctx, uint32 func_index)
25462548
return false;
25472549
break;
25482550
}
2549-
#endif /* WASM_ENABLE_BULK_MEMORY */
2551+
#endif /* WASM_ENABLE_BULK_MEMORY || WASM_ENABLE_LIME1 */
25502552
#if WASM_ENABLE_REF_TYPES != 0 || WASM_ENABLE_GC != 0
25512553
case WASM_OP_TABLE_INIT:
25522554
{

core/iwasm/compilation/aot_emit_memory.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1481,7 +1481,8 @@ aot_compile_op_memory_grow(AOTCompContext *comp_ctx, AOTFuncContext *func_ctx)
14811481
return false;
14821482
}
14831483

1484-
#if WASM_ENABLE_BULK_MEMORY != 0 || WASM_ENABLE_STRINGREF != 0
1484+
#if WASM_ENABLE_BULK_MEMORY != 0 || WASM_ENABLE_STRINGREF != 0 \
1485+
|| WASM_ENABLE_LIME1 != 0
14851486
LLVMValueRef
14861487
check_bulk_memory_overflow(AOTCompContext *comp_ctx, AOTFuncContext *func_ctx,
14871488
LLVMValueRef offset, LLVMValueRef bytes)
@@ -1769,7 +1770,9 @@ aot_compile_op_data_drop(AOTCompContext *comp_ctx, AOTFuncContext *func_ctx,
17691770
fail:
17701771
return false;
17711772
}
1773+
#endif /* end of WASM_ENABLE_BULK_MEMORY */
17721774

1775+
#if WASM_ENABLE_BULK_MEMORY != 0 || WASM_ENABLE_LIME1 != 0
17731776
bool
17741777
aot_compile_op_memory_copy(AOTCompContext *comp_ctx, AOTFuncContext *func_ctx)
17751778
{
@@ -1931,7 +1934,7 @@ aot_compile_op_memory_fill(AOTCompContext *comp_ctx, AOTFuncContext *func_ctx)
19311934
fail:
19321935
return false;
19331936
}
1934-
#endif /* end of WASM_ENABLE_BULK_MEMORY */
1937+
#endif /* end of WASM_ENABLE_BULK_MEMORY || WASM_ENABLE_LIME1 */
19351938

19361939
#if WASM_ENABLE_SHARED_MEMORY != 0
19371940
bool

core/iwasm/compilation/aot_emit_memory.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,9 @@ aot_compile_op_memory_init(AOTCompContext *comp_ctx, AOTFuncContext *func_ctx,
7878
bool
7979
aot_compile_op_data_drop(AOTCompContext *comp_ctx, AOTFuncContext *func_ctx,
8080
uint32 seg_index);
81+
#endif
8182

83+
#if WASM_ENABLE_BULK_MEMORY != 0 || WASM_ENABLE_LIME1 != 0
8284
bool
8385
aot_compile_op_memory_copy(AOTCompContext *comp_ctx, AOTFuncContext *func_ctx);
8486

core/iwasm/fast-jit/fe/jit_emit_memory.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -713,7 +713,9 @@ jit_compile_op_data_drop(JitCompContext *cc, uint32 seg_idx)
713713
return jit_emit_callnative(cc, wasm_data_drop, 0, args,
714714
sizeof(args) / sizeof(args[0]));
715715
}
716+
#endif
716717

718+
#if WASM_ENABLE_BULK_MEMORY != 0 || WASM_ENABLE_LIME1 != 0
717719
static int
718720
wasm_copy_memory(WASMModuleInstance *inst, uint32 src_mem_idx,
719721
uint32 dst_mem_idx, uint32 len, uint32 src_offset,
@@ -835,7 +837,7 @@ jit_compile_op_memory_fill(JitCompContext *cc, uint32 mem_idx)
835837
fail:
836838
return false;
837839
}
838-
#endif
840+
#endif /* end of WASM_ENABLE_BULK_MEMORY || WASM_ENABLE_LIME1 */
839841

840842
#if WASM_ENABLE_SHARED_MEMORY != 0
841843
#define GEN_AT_RMW_INSN(op, op_type, bytes, result, value, memory_data, \

core/iwasm/fast-jit/fe/jit_emit_memory.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,9 @@ jit_compile_op_memory_init(JitCompContext *cc, uint32 mem_idx, uint32 seg_idx);
5555

5656
bool
5757
jit_compile_op_data_drop(JitCompContext *cc, uint32 seg_idx);
58+
#endif
5859

60+
#if WASM_ENABLE_BULK_MEMORY != 0 || WASM_ENABLE_LIME1 != 0
5961
bool
6062
jit_compile_op_memory_copy(JitCompContext *cc, uint32 src_mem_idx,
6163
uint32 dst_mem_idx);

core/iwasm/fast-jit/jit_frontend.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1627,7 +1627,7 @@ jit_compile_func(JitCompContext *cc)
16271627

16281628
read_leb_uint32(frame_ip, frame_ip_end, type_idx);
16291629

1630-
#if WASM_ENABLE_REF_TYPES != 0
1630+
#if WASM_ENABLE_REF_TYPES != 0 || WASM_ENABLE_LIME1 != 0
16311631
read_leb_uint32(frame_ip, frame_ip_end, tbl_idx);
16321632
#else
16331633
frame_ip++;
@@ -2336,6 +2336,8 @@ jit_compile_func(JitCompContext *cc)
23362336
return false;
23372337
break;
23382338
}
2339+
#endif /* WASM_ENABLE_BULK_MEMORY */
2340+
#if WASM_ENABLE_BULK_MEMORY != 0 || WASM_ENABLE_LIME1 != 0
23392341
case WASM_OP_MEMORY_COPY:
23402342
{
23412343
uint32 src_mem_idx, dst_mem_idx;
@@ -2353,7 +2355,7 @@ jit_compile_func(JitCompContext *cc)
23532355
return false;
23542356
break;
23552357
}
2356-
#endif /* WASM_ENABLE_BULK_MEMORY */
2358+
#endif /* WASM_ENABLE_BULK_MEMORY || WASM_ENABLE_LIME1 */
23572359
#if WASM_ENABLE_REF_TYPES != 0
23582360
case WASM_OP_TABLE_INIT:
23592361
{

core/iwasm/interpreter/wasm_interp_classic.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1567,7 +1567,7 @@ wasm_interp_call_func_bytecode(WASMModuleInstance *module,
15671567
WASMMemoryInstance *memory = wasm_get_default_memory(module);
15681568
#if !defined(OS_ENABLE_HW_BOUND_CHECK) \
15691569
|| WASM_CPU_SUPPORTS_UNALIGNED_ADDR_ACCESS == 0 \
1570-
|| WASM_ENABLE_BULK_MEMORY != 0
1570+
|| WASM_ENABLE_BULK_MEMORY != 0 || WASM_ENABLE_LIME1 != 0
15711571
uint64 linear_mem_size = 0;
15721572
if (memory)
15731573
#if WASM_ENABLE_THREAD_MGR == 0
@@ -2367,7 +2367,7 @@ wasm_interp_call_func_bytecode(WASMModuleInstance *module,
23672367
cur_type = wasm_types[tidx];
23682368

23692369
/* clang-format off */
2370-
#if WASM_ENABLE_REF_TYPES != 0 || WASM_ENABLE_GC != 0
2370+
#if WASM_ENABLE_REF_TYPES != 0 || WASM_ENABLE_GC != 0 || WASM_ENABLE_LIME1 != 0
23712371
read_leb_uint32(frame_ip, frame_ip_end, tbl_idx);
23722372
#else
23732373
frame_ip++;
@@ -5768,6 +5768,8 @@ wasm_interp_call_func_bytecode(WASMModuleInstance *module,
57685768
segment);
57695769
break;
57705770
}
5771+
#endif /* WASM_ENABLE_BULK_MEMORY */
5772+
#if WASM_ENABLE_BULK_MEMORY != 0 || WASM_ENABLE_LIME1 != 0
57715773
case WASM_OP_MEMORY_COPY:
57725774
{
57735775
mem_offset_t dst, src, len;
@@ -5888,7 +5890,7 @@ wasm_interp_call_func_bytecode(WASMModuleInstance *module,
58885890
memset(mdst, fill_val, len);
58895891
break;
58905892
}
5891-
#endif /* WASM_ENABLE_BULK_MEMORY */
5893+
#endif /* WASM_ENABLE_BULK_MEMORY || WASM_ENABLE_LIME1 */
58925894
#if WASM_ENABLE_REF_TYPES != 0 || WASM_ENABLE_GC != 0
58935895
case WASM_OP_TABLE_INIT:
58945896
{
@@ -6873,7 +6875,7 @@ wasm_interp_call_func_bytecode(WASMModuleInstance *module,
68736875

68746876
#if !defined(OS_ENABLE_HW_BOUND_CHECK) \
68756877
|| WASM_CPU_SUPPORTS_UNALIGNED_ADDR_ACCESS == 0 \
6876-
|| WASM_ENABLE_BULK_MEMORY != 0
6878+
|| WASM_ENABLE_BULK_MEMORY != 0 || WASM_ENABLE_LIME1 != 0
68776879
out_of_bounds:
68786880
wasm_set_exception(module, "out of bounds memory access");
68796881
#endif

core/iwasm/interpreter/wasm_interp_fast.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1501,7 +1501,7 @@ wasm_interp_call_func_bytecode(WASMModuleInstance *module,
15011501
WASMMemoryInstance *memory = wasm_get_default_memory(module);
15021502
#if !defined(OS_ENABLE_HW_BOUND_CHECK) \
15031503
|| WASM_CPU_SUPPORTS_UNALIGNED_ADDR_ACCESS == 0 \
1504-
|| WASM_ENABLE_BULK_MEMORY != 0
1504+
|| WASM_ENABLE_BULK_MEMORY != 0 || WASM_ENABLE_LIME1 != 0
15051505
uint64 linear_mem_size = 0;
15061506
if (memory)
15071507
#if WASM_ENABLE_THREAD_MGR == 0
@@ -5200,6 +5200,8 @@ wasm_interp_call_func_bytecode(WASMModuleInstance *module,
52005200
segment);
52015201
break;
52025202
}
5203+
#endif /* WASM_ENABLE_BULK_MEMORY */
5204+
#if WASM_ENABLE_BULK_MEMORY != 0 || WASM_ENABLE_LIME1 != 0
52035205
case WASM_OP_MEMORY_COPY:
52045206
{
52055207
uint32 dst, src, len;
@@ -5290,7 +5292,7 @@ wasm_interp_call_func_bytecode(WASMModuleInstance *module,
52905292
memset(mdst, fill_val, len);
52915293
break;
52925294
}
5293-
#endif /* WASM_ENABLE_BULK_MEMORY */
5295+
#endif /* WASM_ENABLE_BULK_MEMORY || WASM_ENABLE_LIME1 */
52945296
#if WASM_ENABLE_REF_TYPES != 0 || WASM_ENABLE_GC != 0
52955297
case WASM_OP_TABLE_INIT:
52965298
{
@@ -7805,7 +7807,7 @@ wasm_interp_call_func_bytecode(WASMModuleInstance *module,
78057807

78067808
#if !defined(OS_ENABLE_HW_BOUND_CHECK) \
78077809
|| WASM_CPU_SUPPORTS_UNALIGNED_ADDR_ACCESS == 0 \
7808-
|| WASM_ENABLE_BULK_MEMORY != 0
7810+
|| WASM_ENABLE_BULK_MEMORY != 0 || WASM_ENABLE_LIME1 != 0
78097811
out_of_bounds:
78107812
wasm_set_exception(module, "out of bounds memory access");
78117813
#endif

0 commit comments

Comments
 (0)