Skip to content

Commit 3403f0a

Browse files
committed
Merge main into dev/wasi_threads
2 parents 7d19b22 + bf2be80 commit 3403f0a

Some content is hidden

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

46 files changed

+1082
-528
lines changed

.github/workflows/build_wamr_lldb.yml

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ jobs:
5050
./core/deps/llvm-project/build/libexec
5151
./core/deps/llvm-project/build/share
5252
./core/deps/llvm-project/lldb/tools/
53-
./core/deps/llvm-project/inst/
53+
./core/deps/llvm-project/wamr-lldb/
5454
key: ${{inputs.arch}}-${{ inputs.runner }}-lldb_build
5555

5656
- name: setup xcode macos
@@ -92,10 +92,10 @@ jobs:
9292
if: steps.lldb_build_cache.outputs.cache-hit != 'true' && contains(inputs.runner, 'ubuntu')
9393
run: |
9494
echo "start to build lldb..."
95-
mkdir -p inst
95+
mkdir -p wamr-lldb
9696
cmake -S ./llvm -B build \
9797
-G Ninja \
98-
-DCMAKE_INSTALL_PREFIX=../inst \
98+
-DCMAKE_INSTALL_PREFIX=../wamr-lldb \
9999
-DCMAKE_BUILD_TYPE=Release -DLLVM_ENABLE_PROJECTS="clang;lldb" \
100100
-DLLVM_TARGETS_TO_BUILD=X86 \
101101
-DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DLLVM_BUILD_BENCHMARKS:BOOL=OFF \
@@ -111,10 +111,10 @@ jobs:
111111
if: steps.lldb_build_cache.outputs.cache-hit != 'true' && contains(inputs.runner, 'macos')
112112
run: |
113113
echo "start to build lldb..."
114-
mkdir -p inst
114+
mkdir -p wamr-lldb
115115
cmake -S ./llvm -B build \
116116
-G Ninja \
117-
-DCMAKE_INSTALL_PREFIX=../inst \
117+
-DCMAKE_INSTALL_PREFIX=../wamr-lldb \
118118
-DCMAKE_BUILD_TYPE:STRING="Release" \
119119
-DCMAKE_EXPORT_COMPILE_COMMANDS=ON \
120120
-DLLVM_ENABLE_PROJECTS="clang;lldb" \
@@ -134,30 +134,30 @@ jobs:
134134
- name: pack a distribution
135135
if: steps.lldb_build_cache.outputs.cache-hit != 'true'
136136
run: |
137-
mkdir -p inst/bin
138-
mkdir -p inst/lib
139-
cp build/bin/lldb* inst/bin
140-
cp lldb/tools/lldb-vscode/package.json inst
141-
cp -r lldb/tools/lldb-vscode/syntaxes/ inst
137+
mkdir -p wamr-lldb/bin
138+
mkdir -p wamr-lldb/lib
139+
cp build/bin/lldb* wamr-lldb/bin
140+
cp lldb/tools/lldb-vscode/package.json wamr-lldb
141+
cp -r lldb/tools/lldb-vscode/syntaxes/ wamr-lldb
142142
working-directory: core/deps/llvm-project
143143

144144
- name: pack ubuntu specific libraries
145145
if: steps.lldb_build_cache.outputs.cache-hit != 'true' && contains(inputs.runner, 'ubuntu')
146146
run: |
147-
cp build/lib/liblldb*.so inst/lib
148-
cp build/lib/liblldb*.so.* inst/lib
147+
cp build/lib/liblldb*.so wamr-lldb/lib
148+
cp build/lib/liblldb*.so.* wamr-lldb/lib
149149
working-directory: core/deps/llvm-project
150150

151151
- name: pack macos specific libraries
152152
if: steps.lldb_build_cache.outputs.cache-hit != 'true' && contains(inputs.runner, 'macos')
153153
run: |
154-
cp build/lib/liblldb*.dylib inst/lib
154+
cp build/lib/liblldb*.dylib wamr-lldb/lib
155155
working-directory: core/deps/llvm-project
156156

157157
- name: compress the binary
158158
run: |
159-
tar czf wamr-lldb-${{ inputs.ver_num }}-${{ inputs.runner }}.tar.gz inst
160-
zip -r wamr-lldb-${{ inputs.ver_num }}-${{ inputs.runner }}.zip inst
159+
tar czf wamr-lldb-${{ inputs.ver_num }}-${{ inputs.runner }}.tar.gz wamr-lldb
160+
zip -r wamr-lldb-${{ inputs.ver_num }}-${{ inputs.runner }}.zip wamr-lldb
161161
working-directory: core/deps/llvm-project
162162

163163
- name: upload release tar.gz

.github/workflows/build_wamr_vscode_ext.yml

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,9 @@ jobs:
4141

4242
- name: compress the vscode extension
4343
run: |
44-
tar czf wamr_ide-${{ inputs.ver_num }}.tar.gz wamride-*.vsix
45-
zip wamr_ide-${{ inputs.ver_num }}.zip wamride-*.vsix
44+
mv wamride-*.vsix wamr-ide.vsix
45+
tar czf wamr-ide-${{ inputs.ver_num }}.tar.gz wamr-ide.vsix
46+
zip wamr-ide-${{ inputs.ver_num }}.zip wamr-ide.vsix
4647
working-directory: test-tools/wamr-ide/VSCode-Extension
4748

4849
- name: upload release tar.gz
@@ -51,8 +52,8 @@ jobs:
5152
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
5253
with:
5354
upload_url: ${{ inputs.upload_url }}
54-
asset_path: test-tools/wamr-ide/VSCode-Extension/wamr_ide-${{ inputs.ver_num }}.tar.gz
55-
asset_name: wamr_ide-${{ inputs.ver_num }}.tar.gz
55+
asset_path: test-tools/wamr-ide/VSCode-Extension/wamr-ide-${{ inputs.ver_num }}.tar.gz
56+
asset_name: wamr-ide-${{ inputs.ver_num }}.tar.gz
5657
asset_content_type: application/x-gzip
5758

5859
- name: upload release zip
@@ -61,6 +62,6 @@ jobs:
6162
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
6263
with:
6364
upload_url: ${{ inputs.upload_url }}
64-
asset_path: test-tools/wamr-ide/VSCode-Extension/wamr_ide-${{ inputs.ver_num }}.zip
65-
asset_name: wamr_ide-${{ inputs.ver_num }}.zip
65+
asset_path: test-tools/wamr-ide/VSCode-Extension/wamr-ide-${{ inputs.ver_num }}.zip
66+
asset_name: wamr-ide-${{ inputs.ver_num }}.zip
6667
asset_content_type: application/zip

.github/workflows/spec_test_on_nuttx.yml

Lines changed: 31 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,21 @@ on:
99

1010
workflow_dispatch:
1111

12+
env:
13+
LLVM_CACHE_SUFFIX: "build-llvm_libraries_ex"
14+
1215
jobs:
16+
build_llvm_libraries:
17+
uses: ./.github/workflows/build_llvm_libraries.yml
18+
with:
19+
runs-on: "['ubuntu-22.04']"
20+
1321
spec_test_on_qemu:
14-
runs-on: ubuntu-22.04
22+
runs-on: ${{ matrix.os }}
23+
needs: [build_llvm_libraries]
1524
strategy:
1625
matrix:
26+
os: [ubuntu-22.04]
1727
nuttx_board_config: [
1828
# cortex-a9
1929
"boards/arm/imx6/sabre-6quad/configs/nsh",
@@ -61,6 +71,25 @@ jobs:
6171
repository: ${{ github.repository }}
6272
path: apps/interpreters/wamr/wamr
6373

74+
- name: Get LLVM libraries
75+
id: cache_llvm
76+
uses: actions/cache@v3
77+
with:
78+
path: |
79+
./core/deps/llvm/build/bin
80+
./core/deps/llvm/build/include
81+
./core/deps/llvm/build/lib
82+
./core/deps/llvm/build/libexec
83+
./core/deps/llvm/build/share
84+
key: ${{ matrix.os }}-${{ env.LLVM_CACHE_SUFFIX }}
85+
86+
- name: Quit if cache miss
87+
if: steps.cache_llvm.outputs.cache-hit != 'true'
88+
run: echo "::error::can not get prebuilt llvm libraries" && exit 1
89+
90+
- name: Copy LLVM
91+
run: cp -r core/deps/llvm apps/interpreters/wamr/wamr/core/deps/llvm
92+
6493
- name: Enable WAMR for NuttX
6594
run: |
6695
find nuttx/boards -name defconfig | xargs sed -i '$a\CONFIG_INTERPRETERS_WAMR=y\nCONFIG_INTERPRETERS_WAMR_AOT=y\nCONFIG_INTERPRETERS_WAMR_FAST=y\nCONFIG_INTERPRETERS_WAMR_LOG=y\nCONFIG_INTERPRETERS_WAMR_LIBC_BUILTIN=y\nCONFIG_INTERPRETERS_WAMR_REF_TYPES=y\nCONFIG_INTERPRETERS_WAMR_ENABLE_SPEC_TEST=y\nCONFIG_INTERPRETERS_WAMR_SHARED_MEMORY=y\nCONFIG_INTERPRETERS_WAMR_BULK_MEMORY=y\n'
@@ -69,8 +98,7 @@ jobs:
6998
- name: Build wamrc
7099
working-directory: apps/interpreters/wamr/wamr/wamr-compiler
71100
run: |
72-
sudo apt install llvm-13-dev
73-
cmake -Bbuild -DWAMR_BUILD_WITH_CUSTOM_LLVM=1 .
101+
cmake -Bbuild .
74102
cmake --build build
75103
76104
- name: Build

core/iwasm/aot/aot_intrinsic.c

Lines changed: 37 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,8 @@ static const aot_intrinsic g_intrinsic_mapping[] = {
5858
{ "i32_trunc_f64_u", "aot_intrinsic_f64_to_u32", AOT_INTRINSIC_FLAG_F64_TO_U32 },
5959
{ "i32_trunc_f64_s", "aot_intrinsic_f64_to_i32", AOT_INTRINSIC_FLAG_F64_TO_I32 },
6060
{ "i64_trunc_f64_u", "aot_intrinsic_f64_to_u64", AOT_INTRINSIC_FLAG_F64_TO_U64 },
61+
{ "i64_trunc_f32_s", "aot_intrinsic_f32_to_i64", AOT_INTRINSIC_FLAG_F32_TO_I64 },
62+
{ "i64_trunc_f32_u", "aot_intrinsic_f32_to_u64", AOT_INTRINSIC_FLAG_F32_TO_U64 },
6163
{ "i64_trunc_f64_s", "aot_intrinsic_f64_to_i64", AOT_INTRINSIC_FLAG_F64_TO_I64 },
6264
{ "f32_demote_f64", "aot_intrinsic_f64_to_f32", AOT_INTRINSIC_FLAG_F64_TO_F32 },
6365
{ "f64_promote_f32", "aot_intrinsic_f32_to_f64", AOT_INTRINSIC_FLAG_F32_TO_F64 },
@@ -134,7 +136,7 @@ aot_intrinsic_fdiv_f64(float64 a, float64 b)
134136
float32
135137
aot_intrinsic_fabs_f32(float32 a)
136138
{
137-
return (float32)fabs(a);
139+
return fabsf(a);
138140
}
139141

140142
float64
@@ -146,7 +148,7 @@ aot_intrinsic_fabs_f64(float64 a)
146148
float32
147149
aot_intrinsic_ceil_f32(float32 a)
148150
{
149-
return (float32)ceilf(a);
151+
return ceilf(a);
150152
}
151153

152154
float64
@@ -158,7 +160,7 @@ aot_intrinsic_ceil_f64(float64 a)
158160
float32
159161
aot_intrinsic_floor_f32(float32 a)
160162
{
161-
return (float32)floorf(a);
163+
return floorf(a);
162164
}
163165

164166
float64
@@ -170,7 +172,7 @@ aot_intrinsic_floor_f64(float64 a)
170172
float32
171173
aot_intrinsic_trunc_f32(float32 a)
172174
{
173-
return (float32)trunc(a);
175+
return truncf(a);
174176
}
175177

176178
float64
@@ -182,7 +184,7 @@ aot_intrinsic_trunc_f64(float64 a)
182184
float32
183185
aot_intrinsic_rint_f32(float32 a)
184186
{
185-
return (float32)rint(a);
187+
return rintf(a);
186188
}
187189

188190
float64
@@ -194,7 +196,7 @@ aot_intrinsic_rint_f64(float64 a)
194196
float32
195197
aot_intrinsic_sqrt_f32(float32 a)
196198
{
197-
return (float32)sqrt(a);
199+
return sqrtf(a);
198200
}
199201

200202
float64
@@ -206,7 +208,7 @@ aot_intrinsic_sqrt_f64(float64 a)
206208
float32
207209
aot_intrinsic_copysign_f32(float32 a, float32 b)
208210
{
209-
return signbit(b) ? (float32)-fabs(a) : (float32)fabs(a);
211+
return signbit(b) ? -fabsf(a) : fabsf(a);
210212
}
211213

212214
float64
@@ -218,41 +220,45 @@ aot_intrinsic_copysign_f64(float64 a, float64 b)
218220
float32
219221
aot_intrinsic_fmin_f32(float32 a, float32 b)
220222
{
221-
if (isnan(a))
222-
return a;
223-
else if (isnan(b))
224-
return b;
223+
if (isnan(a) || isnan(b))
224+
return NAN;
225+
else if (a == 0 && a == b)
226+
return signbit(a) ? a : b;
225227
else
226-
return (float32)fmin(a, b);
228+
return a > b ? b : a;
227229
}
228230

229231
float64
230232
aot_intrinsic_fmin_f64(float64 a, float64 b)
231233
{
232-
float64 c = fmin(a, b);
233-
if (c == 0 && a == b)
234+
if (isnan(a) || isnan(b))
235+
return NAN;
236+
else if (a == 0 && a == b)
234237
return signbit(a) ? a : b;
235-
return c;
238+
else
239+
return a > b ? b : a;
236240
}
237241

238242
float32
239243
aot_intrinsic_fmax_f32(float32 a, float32 b)
240244
{
241-
if (isnan(a))
242-
return a;
243-
else if (isnan(b))
244-
return b;
245+
if (isnan(a) || isnan(b))
246+
return NAN;
247+
else if (a == 0 && a == b)
248+
return signbit(a) ? b : a;
245249
else
246-
return (float32)fmax(a, b);
250+
return a > b ? a : b;
247251
}
248252

249253
float64
250254
aot_intrinsic_fmax_f64(float64 a, float64 b)
251255
{
252-
float64 c = fmax(a, b);
253-
if (c == 0 && a == b)
256+
if (isnan(a) || isnan(b))
257+
return NAN;
258+
else if (a == 0 && a == b)
254259
return signbit(a) ? b : a;
255-
return c;
260+
else
261+
return a > b ? a : b;
256262
}
257263

258264
uint32
@@ -442,7 +448,7 @@ aot_intrinsic_f32_cmp(AOTFloatCond cond, float32 lhs, float32 rhs)
442448
{
443449
switch (cond) {
444450
case FLOAT_EQ:
445-
return (float32)fabs(lhs - rhs) <= WA_FLT_EPSILON ? 1 : 0;
451+
return lhs == rhs ? 1 : 0;
446452

447453
case FLOAT_LT:
448454
return lhs < rhs ? 1 : 0;
@@ -473,7 +479,7 @@ aot_intrinsic_f64_cmp(AOTFloatCond cond, float64 lhs, float64 rhs)
473479
{
474480
switch (cond) {
475481
case FLOAT_EQ:
476-
return fabs(lhs - rhs) <= WA_DBL_EPSILON ? 1 : 0;
482+
return lhs == rhs ? 1 : 0;
477483

478484
case FLOAT_LT:
479485
return lhs < rhs ? 1 : 0;
@@ -631,6 +637,12 @@ add_f64_common_intrinsics(AOTCompContext *comp_ctx)
631637
add_intrinsic_capability(comp_ctx, AOT_INTRINSIC_FLAG_F64_FADD);
632638
add_intrinsic_capability(comp_ctx, AOT_INTRINSIC_FLAG_F64_FSUB);
633639
add_intrinsic_capability(comp_ctx, AOT_INTRINSIC_FLAG_F64_FMUL);
640+
add_intrinsic_capability(comp_ctx, AOT_INTRINSIC_FLAG_F64_MIN);
641+
add_intrinsic_capability(comp_ctx, AOT_INTRINSIC_FLAG_F64_MAX);
642+
add_intrinsic_capability(comp_ctx, AOT_INTRINSIC_FLAG_F64_CEIL);
643+
add_intrinsic_capability(comp_ctx, AOT_INTRINSIC_FLAG_F64_FLOOR);
644+
add_intrinsic_capability(comp_ctx, AOT_INTRINSIC_FLAG_F64_TRUNC);
645+
add_intrinsic_capability(comp_ctx, AOT_INTRINSIC_FLAG_F64_RINT);
634646
add_intrinsic_capability(comp_ctx, AOT_INTRINSIC_FLAG_F64_FDIV);
635647
add_intrinsic_capability(comp_ctx, AOT_INTRINSIC_FLAG_F64_SQRT);
636648
add_intrinsic_capability(comp_ctx, AOT_INTRINSIC_FLAG_F64_CMP);

core/iwasm/aot/aot_reloc.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,8 @@ typedef struct {
101101
REG_SYM(aot_intrinsic_f64_to_f32), \
102102
REG_SYM(aot_intrinsic_f32_to_i32), \
103103
REG_SYM(aot_intrinsic_f32_to_u32), \
104+
REG_SYM(aot_intrinsic_f32_to_i64), \
105+
REG_SYM(aot_intrinsic_f32_to_u64), \
104106
REG_SYM(aot_intrinsic_f64_to_i32), \
105107
REG_SYM(aot_intrinsic_f64_to_u32), \
106108
REG_SYM(aot_intrinsic_f64_to_i64), \

core/iwasm/aot/arch/aot_reloc_riscv.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ void __adddf3();
2020
void __addsf3();
2121
void __divdi3();
2222
void __divsi3();
23+
void __divdf3();
2324
void __divsf3();
2425
void __eqsf2();
2526
void __eqdf2();
@@ -42,9 +43,12 @@ void __floatunsisf();
4243
void __floatunsidf();
4344
void __gedf2();
4445
void __gesf2();
46+
void __gtdf2();
4547
void __gtsf2();
4648
void __ledf2();
4749
void __lesf2();
50+
void __ltdf2();
51+
void __ltsf2();
4852
void __moddi3();
4953
void __modsi3();
5054
void __muldf3();
@@ -70,12 +74,16 @@ static SymbolMap target_sym_map[] = {
7074
#ifndef __riscv_flen
7175
REG_SYM(__adddf3),
7276
REG_SYM(__addsf3),
77+
REG_SYM(__divdf3),
7378
REG_SYM(__divsf3),
7479
REG_SYM(__gedf2),
7580
REG_SYM(__gesf2),
81+
REG_SYM(__gtdf2),
7682
REG_SYM(__gtsf2),
7783
REG_SYM(__ledf2),
7884
REG_SYM(__lesf2),
85+
REG_SYM(__ltdf2),
86+
REG_SYM(__ltsf2),
7987
REG_SYM(__muldf3),
8088
REG_SYM(__nedf2),
8189
REG_SYM(__nesf2),

0 commit comments

Comments
 (0)