Skip to content

Commit d2b10a3

Browse files
authored
Merge pull request #707 from bytecodealliance/main
Merge bytecodealliance:main into wenyongh:main
2 parents b12cbdf + 3cc132e commit d2b10a3

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+2302
-182
lines changed

.github/workflows/build_iwasm_release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ jobs:
3636
- name: generate iwasm binary release
3737
run: |
3838
cmake -S . -B build \
39-
-DWAMR_BUILD_AOT=1 -DWAMR_BUILD_INTERP=1 -DWAMR_BUILD_JIT=0 \
39+
-DWAMR_BUILD_AOT=1 -DWAMR_BUILD_INTERP=1 -DWAMR_BUILD_FAST_JIT=1 -DWAMR_BUILD_JIT=1 \
4040
-DWAMR_BUILD_CUSTOM_NAME_SECTION=0 \
4141
-DWAMR_BUILD_DEBUG_INTERP=0 \
4242
-DWAMR_BUILD_DEBUG_AOT=0 \

.github/workflows/compilation_on_android_ubuntu.yml

Lines changed: 32 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ env:
5353
FAST_JIT_BUILD_OPTIONS: " -DWAMR_BUILD_AOT=1 -DWAMR_BUILD_FAST_INTERP=0 -DWAMR_BUILD_INTERP=0 -DWAMR_BUILD_FAST_JIT=1 -DWAMR_BUILD_JIT=0 -DWAMR_BUILD_LAZY_JIT=0"
5454
LLVM_LAZY_JIT_BUILD_OPTIONS: " -DWAMR_BUILD_AOT=1 -DWAMR_BUILD_FAST_INTERP=0 -DWAMR_BUILD_INTERP=0 -DWAMR_BUILD_FAST_JIT=0 -DWAMR_BUILD_JIT=1 -DWAMR_BUILD_LAZY_JIT=1"
5555
LLVM_EAGER_JIT_BUILD_OPTIONS: "-DWAMR_BUILD_AOT=1 -DWAMR_BUILD_FAST_INTERP=0 -DWAMR_BUILD_INTERP=0 -DWAMR_BUILD_FAST_JIT=0 -DWAMR_BUILD_JIT=1 -DWAMR_BUILD_LAZY_JIT=0"
56+
MULTI_TIER_JIT_BUILD_OPTIONS: "-DWAMR_BUILD_AOT=1 -DWAMR_BUILD_FAST_INTERP=0 -DWAMR_BUILD_INTERP=1 -DWAMR_BUILD_FAST_JIT=1 -DWAMR_BUILD_JIT=1 -DWAMR_BUILD_LAZY_JIT=1"
5657
# For Spec Test
5758
DEFAULT_TEST_OPTIONS: "-s spec -b -P"
5859
MULTI_MODULES_TEST_OPTIONS: "-s spec -b -M -P"
@@ -128,6 +129,7 @@ jobs:
128129
$FAST_JIT_BUILD_OPTIONS,
129130
$LLVM_LAZY_JIT_BUILD_OPTIONS,
130131
$LLVM_EAGER_JIT_BUILD_OPTIONS,
132+
$MULTI_TIER_JIT_BUILD_OPTIONS,
131133
]
132134
make_options_feature: [
133135
# Features
@@ -160,6 +162,8 @@ jobs:
160162
make_options_feature: "-DWAMR_BUILD_MULTI_MODULE=1"
161163
- make_options_run_mode: $LLVM_EAGER_JIT_BUILD_OPTIONS
162164
make_options_feature: "-DWAMR_BUILD_MULTI_MODULE=1"
165+
- make_options_run_mode: $MULTI_TIER_JIT_BUILD_OPTIONS
166+
make_options_feature: "-DWAMR_BUILD_MULTI_MODULE=1"
163167
# SIMD only on JIT/AOT mode
164168
- make_options_run_mode: $CLASSIC_INTERP_BUILD_OPTIONS
165169
make_options_feature: "-DWAMR_BUILD_SIMD=1"
@@ -176,6 +180,8 @@ jobs:
176180
make_options_feature: "-DWAMR_BUILD_DEBUG_INTERP=1"
177181
- make_options_run_mode: $LLVM_EAGER_JIT_BUILD_OPTIONS
178182
make_options_feature: "-DWAMR_BUILD_DEBUG_INTERP=1"
183+
- make_options_run_mode: $MULTI_TIER_JIT_BUILD_OPTIONS
184+
make_options_feature: "-DWAMR_BUILD_DEBUG_INTERP=1"
179185
# DEBUG_AOT only on JIT/AOT mode
180186
- make_options_run_mode: $CLASSIC_INTERP_BUILD_OPTIONS
181187
make_options_feature: "-DWAMR_BUILD_DEBUG_AOT=1"
@@ -188,6 +194,8 @@ jobs:
188194
make_options_feature: "-DWAMR_BUILD_DEBUG_AOT=1"
189195
- make_options_run_mode: $LLVM_EAGER_JIT_BUILD_OPTIONS
190196
make_options_feature: "-DWAMR_BUILD_DEBUG_AOT=1"
197+
- make_options_run_mode: $MULTI_TIER_JIT_BUILD_OPTIONS
198+
make_options_feature: "-DWAMR_BUILD_DEBUG_AOT=1"
191199
# MINI_LOADER only on INTERP mode
192200
- make_options_run_mode: $AOT_BUILD_OPTIONS
193201
make_options_feature: "-DWAMR_BUILD_MINI_LOADER=1"
@@ -197,9 +205,13 @@ jobs:
197205
make_options_feature: "-DWAMR_BUILD_MINI_LOADER=1"
198206
- make_options_run_mode: $LLVM_EAGER_JIT_BUILD_OPTIONS
199207
make_options_feature: "-DWAMR_BUILD_MINI_LOADER=1"
200-
# Fast-JIT mode doesn't support android(X86-32)
208+
- make_options_run_mode: $MULTI_TIER_JIT_BUILD_OPTIONS
209+
make_options_feature: "-DWAMR_BUILD_MINI_LOADER=1"
210+
# Fast-JIT and Multi-Tier-JIT mode don't support android(X86-32)
201211
- make_options_run_mode: $FAST_JIT_BUILD_OPTIONS
202212
platform: android
213+
- make_options_run_mode: $MULTI_TIER_JIT_BUILD_OPTIONS
214+
platform: android
203215
# only test andorid on ubuntu latest
204216
- os: ubuntu-20.04
205217
platform: android
@@ -256,6 +268,7 @@ jobs:
256268
$FAST_JIT_BUILD_OPTIONS,
257269
$LLVM_LAZY_JIT_BUILD_OPTIONS,
258270
$LLVM_EAGER_JIT_BUILD_OPTIONS,
271+
$MULTI_TIER_JIT_BUILD_OPTIONS,
259272
]
260273
os: [ubuntu-20.04, ubuntu-22.04]
261274
wasi_sdk_release:
@@ -404,7 +417,14 @@ jobs:
404417
strategy:
405418
matrix:
406419
running_mode:
407-
["classic-interp", "fast-interp", "jit", "aot", "fast-jit"]
420+
[
421+
"classic-interp",
422+
"fast-interp",
423+
"jit",
424+
"aot",
425+
"fast-jit",
426+
"multi-tier-jit",
427+
]
408428
test_option:
409429
[
410430
$DEFAULT_TEST_OPTIONS,
@@ -430,26 +450,33 @@ jobs:
430450
test_option: $WASI_TEST_OPTIONS
431451
- running_mode: "jit"
432452
test_option: $MULTI_MODULES_TEST_OPTIONS
433-
# fast-jit is only tested on default mode, exclude other three
453+
# fast-jit doesn't support multi module, simd, and threads
434454
- running_mode: "fast-jit"
435455
test_option: $MULTI_MODULES_TEST_OPTIONS
436456
- running_mode: "fast-jit"
437457
test_option: $SIMD_TEST_OPTIONS
438458
- running_mode: "fast-jit"
439459
test_option: $THREADS_TEST_OPTIONS
460+
# multi-tier-jit doesn't support multi module, simd, and threads
461+
- running_mode: "multi-tier-jit"
462+
test_option: $MULTI_MODULES_TEST_OPTIONS
463+
- running_mode: "multi-tier-jit"
464+
test_option: $SIMD_TEST_OPTIONS
465+
- running_mode: "multi-tier-jit"
466+
test_option: $THREADS_TEST_OPTIONS
440467
steps:
441468
- name: checkout
442469
uses: actions/checkout@v3
443470

444471
- name: set env variable(if llvm are used)
445-
if: matrix.running_mode == 'aot' || matrix.running_mode == 'jit'
472+
if: matrix.running_mode == 'aot' || matrix.running_mode == 'jit' || matrix.running_mode == 'multi-tier-jit'
446473
run: echo "USE_LLVM=true" >> $GITHUB_ENV
447474

448475
- name: set env variable(if x86_32 test needed)
449476
if: >
450477
(matrix.test_option == '$DEFAULT_TEST_OPTIONS' || matrix.test_option == '$THREADS_TEST_OPTIONS'
451478
|| matrix.test_option == '$WASI_TEST_OPTIONS')
452-
&& matrix.running_mode != 'fast-jit' && matrix.running_mode != 'jit'
479+
&& matrix.running_mode != 'fast-jit' && matrix.running_mode != 'jit' && matrix.running_mode != 'multi-tier-jit'
453480
run: echo "TEST_ON_X86_32=true" >> $GITHUB_ENV
454481

455482
#only download llvm libraries in jit and aot mode

core/iwasm/common/wasm_shared_memory.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,7 @@ shared_memory_dec_reference(WASMModuleCommon *module)
172172
bh_list_remove(shared_memory_list, node);
173173
os_mutex_unlock(&shared_memory_list_lock);
174174

175+
os_mutex_destroy(&node->shared_mem_lock);
175176
os_mutex_destroy(&node->lock);
176177
wasm_runtime_free(node);
177178
}
@@ -200,7 +201,14 @@ shared_memory_set_memory_inst(WASMModuleCommon *module,
200201
node->module = module;
201202
node->memory_inst = memory;
202203
node->ref_count = 1;
204+
205+
if (os_mutex_init(&node->shared_mem_lock) != 0) {
206+
wasm_runtime_free(node);
207+
return NULL;
208+
}
209+
203210
if (os_mutex_init(&node->lock) != 0) {
211+
os_mutex_destroy(&node->shared_mem_lock);
204212
wasm_runtime_free(node);
205213
return NULL;
206214
}

core/iwasm/common/wasm_shared_memory.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ typedef struct WASMSharedMemNode {
2626
WASMModuleCommon *module;
2727
/* The memory information */
2828
WASMMemoryInstanceCommon *memory_inst;
29+
/* Lock used for atomic operations */
30+
korp_mutex shared_mem_lock;
2931

3032
/* reference count */
3133
uint32 ref_count;

core/iwasm/interpreter/wasm.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -510,8 +510,8 @@ struct WASMModule {
510510
uint64 load_size;
511511
#endif
512512

513-
#if WASM_ENABLE_DEBUG_INTERP != 0 \
514-
|| (WASM_ENABLE_FAST_JIT != 0 && WASM_ENABLE_JIT \
513+
#if WASM_ENABLE_DEBUG_INTERP != 0 \
514+
|| (WASM_ENABLE_FAST_JIT != 0 && WASM_ENABLE_JIT != 0 \
515515
&& WASM_ENABLE_LAZY_JIT != 0)
516516
/**
517517
* List of instances referred to this module. When source debugging

0 commit comments

Comments
 (0)