Skip to content

Commit edb184f

Browse files
authored
Implement most missing wasm-c-api APIs (bytecodealliance#303) (bytecodealliance#676)
Remove unnecessary functions and implement more APIs: - wasm_##name##same - wasm##name##as_ref - wasm_ref_as##name## - wasm_ref_delete - wasm_module_validate - wasm_table_get/set/size - wasm_memory_size - wasm_config_new - wasm_foreign_new And add more wasm-c-api samples, update the related documen, add more CI rules. Signed-off-by: Wenyong Huang <[email protected]>
1 parent 4193949 commit edb184f

24 files changed

+1874
-452
lines changed

.github/workflows/android.yml

+23-2
Original file line numberDiff line numberDiff line change
@@ -33,14 +33,14 @@ jobs:
3333
cmake ..
3434
make -j $(nproc)
3535
cd .. && rm -rf build
36-
- name: Build iwasm [Classic interp]
36+
- name: Build iwasm [classic interp]
3737
run: |
3838
cd product-mini/platforms/android
3939
mkdir build && cd build
4040
cmake .. -DWAMR_BUILD_FAST_INTERP=0
4141
make -j $(nproc)
4242
cd .. && rm -rf build
43-
- name: Build iwasm [Multi module]
43+
- name: Build iwasm [multi module]
4444
run: |
4545
cd product-mini/platforms/android
4646
mkdir build && cd build
@@ -89,3 +89,24 @@ jobs:
8989
cmake .. -DWAMR_BUILD_CUSTOM_NAME_SECTION=1
9090
make -j $(nproc)
9191
cd .. && rm -rf build
92+
- name: Build iwasm [disable hardware boundary check]
93+
run: |
94+
cd product-mini/platforms/android
95+
mkdir build && cd build
96+
cmake .. -DWAMR_DISABLE_HW_BOUND_CHECK=1
97+
make -j $(nproc)
98+
cd .. && rm -rf build
99+
- name: Build iwasm [reference types]
100+
run: |
101+
cd product-mini/platforms/android
102+
mkdir build && cd build
103+
cmake .. -DWAMR_BUILD_REF_TYPES=1
104+
make -j $(nproc)
105+
cd .. && rm -rf build
106+
- name: Build iwasm [128-bit SIMD]
107+
run: |
108+
cd product-mini/platforms/android
109+
mkdir build && cd build
110+
cmake .. -DWAMR_BUILD_SIMD=1
111+
make -j $(nproc)
112+
cd .. && rm -rf build

.github/workflows/linux.yml

+39-2
Original file line numberDiff line numberDiff line change
@@ -31,14 +31,14 @@ jobs:
3131
cmake ..
3232
make -j $(nproc)
3333
cd .. && rm -rf build
34-
- name: Build iwasm [Classic interp]
34+
- name: Build iwasm [classic interp]
3535
run: |
3636
cd product-mini/platforms/linux
3737
mkdir build && cd build
3838
cmake .. -DWAMR_BUILD_FAST_INTERP=0
3939
make -j $(nproc)
4040
cd .. && rm -rf build
41-
- name: Build iwasm [Multi module]
41+
- name: Build iwasm [multi module]
4242
run: |
4343
cd product-mini/platforms/linux
4444
mkdir build && cd build
@@ -87,6 +87,27 @@ jobs:
8787
cmake .. -DWAMR_BUILD_CUSTOM_NAME_SECTION=1
8888
make -j $(nproc)
8989
cd .. && rm -rf build
90+
- name: Build iwasm [disable hardware boundary check]
91+
run: |
92+
cd product-mini/platforms/linux
93+
mkdir build && cd build
94+
cmake .. -DWAMR_DISABLE_HW_BOUND_CHECK=1
95+
make -j $(nproc)
96+
cd .. && rm -rf build
97+
- name: Build iwasm [reference types]
98+
run: |
99+
cd product-mini/platforms/linux
100+
mkdir build && cd build
101+
cmake .. -DWAMR_BUILD_REF_TYPES=1
102+
make -j $(nproc)
103+
cd .. && rm -rf build
104+
- name: Build iwasm [128-bit SIMD]
105+
run: |
106+
cd product-mini/platforms/linux
107+
mkdir build && cd build
108+
cmake .. -DWAMR_BUILD_SIMD=1
109+
make -j $(nproc)
110+
cd .. && rm -rf build
90111
- name: Cache LLVM libraries
91112
uses: actions/cache@v2
92113
id: cache_llvm
@@ -132,7 +153,10 @@ jobs:
132153
./callback_chain
133154
./global
134155
./hello
156+
./hostref
157+
./memory
135158
./reflect
159+
./table
136160
./trap
137161
cd .. && rm -r build
138162
- name: Build Sample [wasm-c-api] [Jit]
@@ -145,7 +169,10 @@ jobs:
145169
./callback_chain
146170
./global
147171
./hello
172+
./hostref
173+
./memory
148174
./reflect
175+
./table
149176
./trap
150177
cd .. && rm -r build
151178
- name: Build Sample [wasm-c-api] [Aot]
@@ -158,7 +185,10 @@ jobs:
158185
./callback_chain
159186
./global
160187
./hello
188+
./hostref
189+
./memory
161190
./reflect
191+
./table
162192
./trap
163193
cd .. && rm -r build
164194
- name: Build Sample [basic]
@@ -187,3 +217,10 @@ jobs:
187217
cmake ..
188218
make -j $(nproc)
189219
./spawn_thread
220+
- name: Build Sample [ref-types]
221+
run: |
222+
cd samples/ref-types
223+
mkdir build && cd build
224+
cmake ..
225+
make -j $(nproc)
226+
./hello

.github/workflows/mac.yml

+40-13
Original file line numberDiff line numberDiff line change
@@ -26,63 +26,84 @@ jobs:
2626
cd product-mini/platforms/darwin
2727
mkdir build && cd build
2828
cmake ..
29-
make
29+
make -j $(nproc)
3030
cd .. && rm -rf build
31-
- name: Build iwasm [Classic interp]
31+
- name: Build iwasm [classic interp]
3232
run: |
3333
cd product-mini/platforms/darwin
3434
mkdir build && cd build
3535
cmake .. -DWAMR_BUILD_FAST_INTERP=0
36-
make
36+
make -j $(nproc)
3737
cd .. && rm -rf build
38-
- name: Build iwasm [Multi module]
38+
- name: Build iwasm [multi module]
3939
run: |
4040
cd product-mini/platforms/darwin
4141
mkdir build && cd build
4242
cmake .. -DWAMR_BUILD_MULTI_MODULE=1
43-
make
43+
make -j $(nproc)
4444
cd .. && rm -rf build
4545
- name: Build iwasm [lib-pthread]
4646
run: |
4747
cd product-mini/platforms/darwin
4848
mkdir build && cd build
4949
cmake .. -DWAMR_BUILD_LIB_PTHREAD=1
50-
make
50+
make -j $(nproc)
5151
cd .. && rm -rf build
5252
- name: Build iwasm [aot only]
5353
run: |
5454
cd product-mini/platforms/darwin
5555
mkdir build && cd build
5656
cmake .. -DWAMR_BUILD_AOT=1 -DWAMR_BUILD_INTERP=0
57-
make
57+
make -j $(nproc)
5858
cd .. && rm -rf build
5959
- name: Build iwasm [interp only]
6060
run: |
6161
cd product-mini/platforms/darwin
6262
mkdir build && cd build
6363
cmake .. -DWAMR_BUILD_AOT=0
64-
make
64+
make -j $(nproc)
6565
cd .. && rm -rf build
6666
- name: Build iwasm [memory profiling]
6767
run: |
6868
cd product-mini/platforms/darwin
6969
mkdir build && cd build
7070
cmake .. -DWAMR_BUILD_MEMORY_PROFILING=1
71-
make
71+
make -j $(nproc)
7272
cd .. && rm -rf build
7373
- name: Build iwasm [tail call]
7474
run: |
7575
cd product-mini/platforms/darwin
7676
mkdir build && cd build
7777
cmake .. -DWAMR_BUILD_TAIL_CALL=1
78-
make
78+
make -j $(nproc)
7979
cd .. && rm -rf build
8080
- name: Build iwasm [custom name section]
8181
run: |
8282
cd product-mini/platforms/darwin
8383
mkdir build && cd build
8484
cmake .. -DWAMR_BUILD_CUSTOM_NAME_SECTION=1
85-
make
85+
make -j $(nproc)
86+
cd .. && rm -rf build
87+
- name: Build iwasm [disable hardware boundary check]
88+
run: |
89+
cd product-mini/platforms/darwin
90+
mkdir build && cd build
91+
cmake .. -DWAMR_DISABLE_HW_BOUND_CHECK=1
92+
make -j $(nproc)
93+
cd .. && rm -rf build
94+
- name: Build iwasm [ref types]
95+
run: |
96+
cd product-mini/platforms/darwin
97+
mkdir build && cd build
98+
cmake .. -DWAMR_BUILD_REF_TYPES=1
99+
make -j $(nproc)
100+
cd .. && rm -rf build
101+
- name: Build iwasm [128-bit SIMD]
102+
run: |
103+
cd product-mini/platforms/darwin
104+
mkdir build && cd build
105+
cmake .. -DWAMR_BUILD_SIMD=1
106+
make -j $(nproc)
86107
cd .. && rm -rf build
87108
- name: download and install wabt
88109
run: |
@@ -96,6 +117,12 @@ jobs:
96117
mkdir build && cd build
97118
cmake ..
98119
make
99-
./hello
100-
./global
101120
./callback
121+
./callback_chain
122+
./global
123+
./hello
124+
./hostref
125+
./memory
126+
./reflect
127+
./table
128+
./trap

.github/workflows/windows.yml

+21
Original file line numberDiff line numberDiff line change
@@ -60,4 +60,25 @@ jobs:
6060
cmake .. -DWAMR_BUILD_CUSTOM_NAME_SECTION=1
6161
cmake --build . --config Release
6262
cd .. && rm -force -r build
63+
- name: Build iwasm [disable hardware boundary check]
64+
run: |
65+
cd product-mini/platforms/windows
66+
mkdir build && cd build
67+
cmake .. -DWAMR_DISABLE_HW_BOUND_CHECK=1
68+
cmake --build . --config Release
69+
cd .. && rm -force -r build
70+
- name: Build iwasm [reference types]
71+
run: |
72+
cd product-mini/platforms/windows
73+
mkdir build && cd build
74+
cmake .. -DWAMR_BUILD_REF_TYPES=1
75+
cmake --build . --config Release
76+
cd .. && rm -force -r build
77+
- name: Build iwasm [128-bit SIMD]
78+
run: |
79+
cd product-mini/platforms/windows
80+
mkdir build && cd build
81+
cmake .. -DWAMR_BUILD_SIMD=1
82+
cmake --build . --config Release
83+
cd .. && rm -force -r build
6384

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ The WAMR [samples](./samples) integrate the iwasm VM core, application manager a
132132

133133
Project Technical Steering Committee
134134
====================================
135-
The [WAMR PTSC Charter](./TSC_Charter.md) governs the operations of the project TSC.
135+
The [WAMR PTSC Charter](./TSC_Charter.md) governs the operations of the project TSC.
136136
The current TSC members:
137137
- [lum1n0us](https://github.com/lum1n0us) - **Liang He**, <[email protected]>
138138
- [qinxk-inter](https://github.com/qinxk-inter) - **Xiaokang Qin**, <[email protected]>

TSC_Charter.md

+5-5
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22

33
## Section 1. Guiding Principle
44

5-
The WebAssembly Micro Runtime (WAMR) project is part of the
6-
Bytecode Alliance (BA) which operates transparently, openly,
7-
collaboratively, and ethically. Project proposals, timelines, and status
5+
The WebAssembly Micro Runtime (WAMR) project is part of the
6+
Bytecode Alliance (BA) which operates transparently, openly,
7+
collaboratively, and ethically. Project proposals, timelines, and status
88
must not merely be open, but also easily visible to outsiders.
99

1010
## Section 2. Project Governance under Bytecode Alliance
@@ -17,8 +17,8 @@ there is misalignment between the project charter and the BA mission and values.
1717

1818

1919

20-
The PTSC structure described in this document may be overhauled as part of
21-
establishing a BA TSC in order to adhere to constraints or requirements that
20+
The PTSC structure described in this document may be overhauled as part of
21+
establishing a BA TSC in order to adhere to constraints or requirements that
2222
TSC will impose on project-level governance.
2323

2424
## Section 3. Establishment of the PTSC

core/iwasm/aot/aot_runtime.c

+5-2
Original file line numberDiff line numberDiff line change
@@ -2822,9 +2822,12 @@ aot_table_grow(AOTModuleInstance *module_inst, uint32 tbl_idx,
28222822
return orig_tbl_sz;
28232823
}
28242824

2825+
if (tbl_inst->cur_size > UINT32_MAX - inc_entries) {
2826+
return (uint32)-1;
2827+
}
2828+
28252829
entry_count = tbl_inst->cur_size + inc_entries;
2826-
/* prevent from integer overflow */
2827-
if (entry_count < tbl_inst->cur_size || entry_count > tbl_inst->max_size) {
2830+
if (entry_count > tbl_inst->max_size) {
28282831
return (uint32)-1;
28292832
}
28302833

0 commit comments

Comments
 (0)