Skip to content

Commit bb3f8d9

Browse files
release CI: Add another iwasm binary that supports Garbage Collection and Exception Handling (#3866)
As suggested in #3829, in release CI, we add zip/tar.gz artifacts named iwasm-gc-eh-{version}-{platform} for `iwasm` which supports features garbage collection and exception handling(classic interpreter only). Also, add a command line option to control GC heap size for `iwasm` on the Windows platform.
1 parent 48eaa22 commit bb3f8d9

File tree

2 files changed

+91
-35
lines changed

2 files changed

+91
-35
lines changed

.github/workflows/build_iwasm_release.yml

Lines changed: 73 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,72 @@ on:
3131
type: string
3232
required: false
3333

34+
env:
35+
DEFAULT_BUILD_OPTIONS:
36+
"-DWAMR_BUILD_AOT=1 -DWAMR_BUILD_INTERP=1 -DWAMR_BUILD_FAST_JIT=1 -DWAMR_BUILD_JIT=1 \
37+
-DWAMR_BUILD_CUSTOM_NAME_SECTION=0 \
38+
-DWAMR_BUILD_DEBUG_INTERP=0 \
39+
-DWAMR_BUILD_DEBUG_AOT=0 \
40+
-DWAMR_BUILD_DUMP_CALL_STACK=0 \
41+
-DWAMR_BUILD_LIBC_UVWASI=0 \
42+
-DWAMR_BUILD_LIBC_EMCC=0 \
43+
-DWAMR_BUILD_LIB_RATS=0 \
44+
-DWAMR_BUILD_LOAD_CUSTOM_SECTION=0 \
45+
-DWAMR_BUILD_MEMORY_PROFILING=0 \
46+
-DWAMR_BUILD_MINI_LOADER=0 \
47+
-DWAMR_BUILD_MULTI_MODULE=0 \
48+
-DWAMR_BUILD_PERF_PROFILING=0 \
49+
-DWAMR_BUILD_SPEC_TEST=0 \
50+
-DWAMR_BUILD_BULK_MEMORY=1 \
51+
-DWAMR_BUILD_LIB_PTHREAD=1 \
52+
-DWAMR_BUILD_LIB_PTHREAD_SEMAPHORE=1 \
53+
-DWAMR_BUILD_LIB_WASI_THREADS=1 \
54+
-DWAMR_BUILD_LIBC_BUILTIN=1 \
55+
-DWAMR_BUILD_LIBC_WASI=1 \
56+
-DWAMR_BUILD_REF_TYPES=1 \
57+
-DWAMR_BUILD_SIMD=1 \
58+
-DWAMR_BUILD_SHARED_MEMORY=1 \
59+
-DWAMR_BUILD_TAIL_CALL=1 \
60+
-DWAMR_BUILD_THREAD_MGR=1"
61+
GC_EH_BUILD_OPTIONS:
62+
"-DWAMR_BUILD_AOT=1 -DWAMR_BUILD_INTERP=1 -DWAMR_BUILD_FAST_INTERP=0 -DWAMR_BUILD_FAST_JIT=0 -DWAMR_BUILD_JIT=0 \
63+
-DWAMR_BUILD_CUSTOM_NAME_SECTION=0 \
64+
-DWAMR_BUILD_DEBUG_INTERP=0 \
65+
-DWAMR_BUILD_DEBUG_AOT=0 \
66+
-DWAMR_BUILD_DUMP_CALL_STACK=0 \
67+
-DWAMR_BUILD_LIBC_UVWASI=0 \
68+
-DWAMR_BUILD_LIBC_EMCC=0 \
69+
-DWAMR_BUILD_LIB_RATS=0 \
70+
-DWAMR_BUILD_LOAD_CUSTOM_SECTION=0 \
71+
-DWAMR_BUILD_MEMORY_PROFILING=0 \
72+
-DWAMR_BUILD_MINI_LOADER=0 \
73+
-DWAMR_BUILD_MULTI_MODULE=0 \
74+
-DWAMR_BUILD_PERF_PROFILING=0 \
75+
-DWAMR_BUILD_SPEC_TEST=0 \
76+
-DWAMR_BUILD_BULK_MEMORY=1 \
77+
-DWAMR_BUILD_LIB_PTHREAD=1 \
78+
-DWAMR_BUILD_LIB_PTHREAD_SEMAPHORE=1 \
79+
-DWAMR_BUILD_LIB_WASI_THREADS=1 \
80+
-DWAMR_BUILD_LIBC_BUILTIN=1 \
81+
-DWAMR_BUILD_LIBC_WASI=1 \
82+
-DWAMR_BUILD_REF_TYPES=1 \
83+
-DWAMR_BUILD_SIMD=1 \
84+
-DWAMR_BUILD_SHARED_MEMORY=1 \
85+
-DWAMR_BUILD_TAIL_CALL=1 \
86+
-DWAMR_BUILD_THREAD_MGR=1 \
87+
-DWAMR_BUILD_EXCE_HANDLING=1 \
88+
-DWAMR_BUILD_GC=1"
89+
3490
jobs:
3591
build:
3692
runs-on: ${{ inputs.runner }}
93+
strategy:
94+
matrix:
95+
include:
96+
- build_options: $DEFAULT_BUILD_OPTIONS
97+
suffix: ''
98+
- build_options: $GC_EH_BUILD_OPTIONS
99+
suffix: '-gc-eh'
37100
steps:
38101
- uses: actions/checkout@v4
39102

@@ -53,48 +116,23 @@ jobs:
53116
- name: generate iwasm binary release
54117
shell: bash
55118
run: |
56-
cmake -S . -B build \
57-
-DWAMR_BUILD_AOT=1 -DWAMR_BUILD_INTERP=1 -DWAMR_BUILD_FAST_JIT=1 -DWAMR_BUILD_JIT=1 \
58-
-DWAMR_BUILD_CUSTOM_NAME_SECTION=0 \
59-
-DWAMR_BUILD_DEBUG_INTERP=0 \
60-
-DWAMR_BUILD_DEBUG_AOT=0 \
61-
-DWAMR_BUILD_DUMP_CALL_STACK=0 \
62-
-DWAMR_BUILD_LIBC_UVWASI=0 \
63-
-DWAMR_BUILD_LIBC_EMCC=0 \
64-
-DWAMR_BUILD_LIB_RATS=0 \
65-
-DWAMR_BUILD_LOAD_CUSTOM_SECTION=0 \
66-
-DWAMR_BUILD_MEMORY_PROFILING=0 \
67-
-DWAMR_BUILD_MINI_LOADER=0 \
68-
-DWAMR_BUILD_MULTI_MODULE=0 \
69-
-DWAMR_BUILD_PERF_PROFILING=0 \
70-
-DWAMR_BUILD_SPEC_TEST=0 \
71-
-DWAMR_BUILD_BULK_MEMORY=1 \
72-
-DWAMR_BUILD_LIB_PTHREAD=1 \
73-
-DWAMR_BUILD_LIB_PTHREAD_SEMAPHORE=1 \
74-
-DWAMR_BUILD_LIB_WASI_THREADS=1 \
75-
-DWAMR_BUILD_LIBC_BUILTIN=1 \
76-
-DWAMR_BUILD_LIBC_WASI=1 \
77-
-DWAMR_BUILD_REF_TYPES=1 \
78-
-DWAMR_BUILD_SIMD=1 \
79-
-DWAMR_BUILD_SHARED_MEMORY=1 \
80-
-DWAMR_BUILD_TAIL_CALL=1 \
81-
-DWAMR_BUILD_THREAD_MGR=1
119+
cmake -S . -B build ${{ matrix.build_options }}
82120
cmake --build build --config Release --parallel 4
83121
working-directory: ${{ inputs.cwd }}
84122

85123
- name: Compress the binary on Windows
86124
if: inputs.runner == 'windows-latest'
87125
run: |
88-
tar -czf iwasm-${{ inputs.ver_num }}-${{ inputs.runner }}.tar.gz iwasm.exe
89-
Compress-Archive -Path iwasm.exe -DestinationPath iwasm-${{ inputs.ver_num }}-${{ inputs.runner }}.zip
90-
mv iwasm-${{ inputs.ver_num }}-${{ inputs.runner }}.* ../
126+
tar -czf iwasm${{ matrix.suffix }}-${{ inputs.ver_num }}-${{ inputs.runner }}.tar.gz iwasm.exe
127+
Compress-Archive -Path iwasm.exe -DestinationPath iwasm${{ matrix.suffix }}-${{ inputs.ver_num }}-${{ inputs.runner }}.zip
128+
mv iwasm${{ matrix.suffix }}-${{ inputs.ver_num }}-${{ inputs.runner }}.* ../
91129
working-directory: ${{ inputs.cwd }}/build/Release
92130

93131
- name: compress the binary on non-Windows
94132
if: inputs.runner != 'windows-latest'
95133
run: |
96-
tar czf iwasm-${{ inputs.ver_num }}-${{ inputs.runner }}.tar.gz iwasm
97-
zip iwasm-${{ inputs.ver_num }}-${{ inputs.runner }}.zip iwasm
134+
tar czf iwasm${{ matrix.suffix }}-${{ inputs.ver_num }}-${{ inputs.runner }}.tar.gz iwasm
135+
zip iwasm${{ matrix.suffix }}-${{ inputs.ver_num }}-${{ inputs.runner }}.zip iwasm
98136
working-directory: ${{ inputs.cwd }}/build
99137

100138
- name: upload release tar.gz
@@ -103,8 +141,8 @@ jobs:
103141
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
104142
with:
105143
upload_url: ${{ inputs.upload_url }}
106-
asset_path: ${{ inputs.cwd }}/build/iwasm-${{ inputs.ver_num }}-${{ inputs.runner }}.tar.gz
107-
asset_name: iwasm-${{ inputs.ver_num }}-${{ inputs.arch }}-${{ inputs.runner }}.tar.gz
144+
asset_path: ${{ inputs.cwd }}/build/iwasm${{ matrix.suffix }}-${{ inputs.ver_num }}-${{ inputs.runner }}.tar.gz
145+
asset_name: iwasm${{ matrix.suffix }}-${{ inputs.ver_num }}-${{ inputs.arch }}-${{ inputs.runner }}.tar.gz
108146
asset_content_type: application/x-gzip
109147

110148
- name: upload release zip
@@ -113,6 +151,6 @@ jobs:
113151
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
114152
with:
115153
upload_url: ${{ inputs.upload_url }}
116-
asset_path: ${{ inputs.cwd }}/build/iwasm-${{ inputs.ver_num }}-${{ inputs.runner }}.zip
117-
asset_name: iwasm-${{ inputs.ver_num }}-${{ inputs.arch }}-${{ inputs.runner }}.zip
154+
asset_path: ${{ inputs.cwd }}/build/iwasm${{ matrix.suffix }}-${{ inputs.ver_num }}-${{ inputs.runner }}.zip
155+
asset_name: iwasm${{ matrix.suffix }}-${{ inputs.ver_num }}-${{ inputs.arch }}-${{ inputs.runner }}.zip
118156
asset_content_type: application/zip

product-mini/platforms/windows/main.c

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,10 @@ print_help()
4545
#endif
4646
printf(" --stack-size=n Set maximum stack size in bytes, default is 64 KB\n");
4747
printf(" --heap-size=n Set maximum heap size in bytes, default is 16 KB\n");
48+
#if WASM_ENABLE_GC != 0
49+
printf(" --gc-heap-size=n Set maximum gc heap size in bytes,\n");
50+
printf(" default is %u KB\n", GC_HEAP_SIZE_DEFAULT / 1024);
51+
#endif
4852
#if WASM_ENABLE_JIT != 0
4953
printf(" --llvm-jit-size-level=n Set LLVM JIT size level, default is 3\n");
5054
printf(" --llvm-jit-opt-level=n Set LLVM JIT optimization level, default is 3\n");
@@ -271,6 +275,9 @@ main(int argc, char *argv[])
271275
#else
272276
uint32 heap_size = 16 * 1024;
273277
#endif
278+
#if WASM_ENABLE_GC != 0
279+
uint32 gc_heap_size = GC_HEAP_SIZE_DEFAULT;
280+
#endif
274281
#if WASM_ENABLE_JIT != 0
275282
uint32 llvm_jit_size_level = 3;
276283
uint32 llvm_jit_opt_level = 3;
@@ -346,6 +353,13 @@ main(int argc, char *argv[])
346353
return print_help();
347354
heap_size = atoi(argv[0] + 12);
348355
}
356+
#if WASM_ENABLE_GC != 0
357+
else if (!strncmp(argv[0], "--gc-heap-size=", 15)) {
358+
if (argv[0][15] == '\0')
359+
return print_help();
360+
gc_heap_size = atoi(argv[0] + 15);
361+
}
362+
#endif
349363
#if WASM_ENABLE_JIT != 0
350364
else if (!strncmp(argv[0], "--llvm-jit-size-level=", 22)) {
351365
if (argv[0][22] == '\0')
@@ -456,6 +470,10 @@ main(int argc, char *argv[])
456470
init_args.mem_alloc_option.allocator.free_func = free_func;
457471
#endif
458472

473+
#if WASM_ENABLE_GC != 0
474+
init_args.gc_heap_size = gc_heap_size;
475+
#endif
476+
459477
#if WASM_ENABLE_JIT != 0
460478
init_args.llvm_jit_size_level = llvm_jit_size_level;
461479
init_args.llvm_jit_opt_level = llvm_jit_opt_level;

0 commit comments

Comments
 (0)