Skip to content

Fix CI to make actual release builds on Windows #346

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Apr 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
80 changes: 56 additions & 24 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -344,23 +344,23 @@ jobs:
- uses: actions/checkout@v4
- name: build
run: |
cmake -B build -DCMAKE_BUILD_TYPE=${{matrix.buildType}} -G "Visual Studio 17 2022"
cmake --build build --target qjs_exe
cmake --build build --target function_source
cmake -B build -G "Visual Studio 17 2022"
cmake --build build --config ${{matrix.buildType}} --target qjs_exe
cmake --build build --config ${{matrix.buildType}} --target function_source
- name: stats
run: |
build\Debug\qjs.exe -qd
build\${{matrix.buildType}}\qjs.exe -qd
- name: test
run: |
build\Debug\qjs.exe tests\test_bigint.js
build\Debug\qjs.exe tests\test_closure.js
build\Debug\qjs.exe tests\test_language.js
build\Debug\qjs.exe tests\test_builtin.js
build\Debug\qjs.exe tests\test_loop.js
build\Debug\qjs.exe tests\test_std.js
build\Debug\qjs.exe tests\test_worker.js
build\Debug\qjs.exe tests\test_queue_microtask.js
build\Debug\function_source.exe
build\${{matrix.buildType}}\qjs.exe tests\test_bigint.js
build\${{matrix.buildType}}\qjs.exe tests\test_closure.js
build\${{matrix.buildType}}\qjs.exe tests\test_language.js
build\${{matrix.buildType}}\qjs.exe tests\test_builtin.js
build\${{matrix.buildType}}\qjs.exe tests\test_loop.js
build\${{matrix.buildType}}\qjs.exe tests\test_std.js
build\${{matrix.buildType}}\qjs.exe tests\test_worker.js
build\${{matrix.buildType}}\qjs.exe tests\test_queue_microtask.js
build\${{matrix.buildType}}\function_source.exe

windows-clang:
runs-on: windows-latest
Expand All @@ -372,23 +372,55 @@ jobs:
- uses: actions/checkout@v4
- name: build
run: |
cmake -B build -DCMAKE_BUILD_TYPE=${{matrix.buildType}} -G "Visual Studio 17 2022" -T ClangCL
cmake -B build -G "Visual Studio 17 2022" -T ClangCL
cmake --build build --config ${{matrix.buildType}} --target qjs_exe
cmake --build build --config ${{matrix.buildType}} --target function_source
- name: stats
run: |
build\${{matrix.buildType}}\qjs.exe -qd
- name: test
run: |
build\${{matrix.buildType}}\qjs.exe tests\test_bigint.js
build\${{matrix.buildType}}\qjs.exe tests\test_closure.js
build\${{matrix.buildType}}\qjs.exe tests\test_language.js
build\${{matrix.buildType}}\qjs.exe tests\test_builtin.js
build\${{matrix.buildType}}\qjs.exe tests\test_loop.js
build\${{matrix.buildType}}\qjs.exe tests\test_std.js
build\${{matrix.buildType}}\qjs.exe tests\test_worker.js
build\${{matrix.buildType}}\qjs.exe tests\test_queue_microtask.js
build\${{matrix.buildType}}\function_source.exe

windows-ninja:
runs-on: windows-latest
strategy:
fail-fast: false
matrix:
buildType: [Debug, Release]
steps:
- uses: actions/checkout@v4
- name: install ninja
run: |
choco install ninja
ninja.exe --version
- name: build
run: |
cmake -B build -DCMAKE_BUILD_TYPE=${{matrix.buildType}} -G "Ninja"
cmake --build build --target qjs_exe
cmake --build build --target function_source
- name: stats
run: |
cmd /r build\Debug\qjs.exe -qd
build\qjs.exe -qd
- name: test
run: |
cmd /r build\Debug\qjs.exe tests\test_bigint.js
cmd /r build\Debug\qjs.exe tests\test_closure.js
cmd /r build\Debug\qjs.exe tests\test_language.js
cmd /r build\Debug\qjs.exe tests\test_builtin.js
cmd /r build\Debug\qjs.exe tests\test_loop.js
cmd /r build\Debug\qjs.exe tests\test_std.js
cmd /r build\Debug\qjs.exe tests\test_worker.js
cmd /r build\Debug\qjs.exe tests\test_queue_microtask.js
cmd /r build\Debug\function_source.exe
build\qjs.exe tests\test_bigint.js
build\qjs.exe tests\test_closure.js
build\qjs.exe tests\test_language.js
build\qjs.exe tests\test_builtin.js
build\qjs.exe tests\test_loop.js
build\qjs.exe tests\test_std.js
build\qjs.exe tests\test_worker.js
build\qjs.exe tests\test_queue_microtask.js
build\function_source.exe

windows-mingw:
runs-on: windows-latest
Expand Down
90 changes: 60 additions & 30 deletions quickjs.c
Original file line number Diff line number Diff line change
Expand Up @@ -11789,7 +11789,7 @@ int JS_IsArray(JSContext *ctx, JSValue val)
}
}

static double js_pow(double a, double b)
static double js_math_pow(double a, double b)
{
if (unlikely(!isfinite(b)) && fabs(a) == 1) {
/* not compatible with IEEE 754 */
Expand Down Expand Up @@ -12392,7 +12392,7 @@ static no_inline __exception int js_binary_arith_slow(JSContext *ctx, JSValue *s
}
break;
case OP_pow:
sp[-2] = js_number(js_pow(v1, v2));
sp[-2] = js_number(js_math_pow(v1, v2));
return 0;
default:
abort();
Expand Down Expand Up @@ -12425,7 +12425,7 @@ static no_inline __exception int js_binary_arith_slow(JSContext *ctx, JSValue *s
dr = fmod(d1, d2);
break;
case OP_pow:
dr = js_pow(d1, d2);
dr = js_math_pow(d1, d2);
break;
default:
abort();
Expand Down Expand Up @@ -41032,39 +41032,69 @@ static JSValue js_math_random(JSContext *ctx, JSValue this_val,
return js_float64(u.d - 1.0);
}

/* use local wrappers for math functions to
- avoid initializing data with dynamic library entry points.
- avoid some overhead if the call can be inlined at compile or link time.
*/
static double js_math_fabs(double d) { return fabs(d); }
static double js_math_floor(double d) { return floor(d); }
static double js_math_ceil(double d) { return ceil(d); }
static double js_math_sqrt(double d) { return sqrt(d); }
static double js_math_acos(double d) { return acos(d); }
static double js_math_asin(double d) { return asin(d); }
static double js_math_atan(double d) { return atan(d); }
static double js_math_atan2(double a, double b) { return atan2(a, b); }
static double js_math_cos(double d) { return cos(d); }
static double js_math_exp(double d) { return exp(d); }
static double js_math_log(double d) { return log(d); }
static double js_math_sin(double d) { return sin(d); }
static double js_math_tan(double d) { return tan(d); }
static double js_math_trunc(double d) { return trunc(d); }
static double js_math_cosh(double d) { return cosh(d); }
static double js_math_sinh(double d) { return sinh(d); }
static double js_math_tanh(double d) { return tanh(d); }
static double js_math_acosh(double d) { return acosh(d); }
static double js_math_asinh(double d) { return asinh(d); }
static double js_math_atanh(double d) { return atanh(d); }
static double js_math_expm1(double d) { return expm1(d); }
static double js_math_log1p(double d) { return log1p(d); }
static double js_math_log2(double d) { return log2(d); }
static double js_math_log10(double d) { return log10(d); }
static double js_math_cbrt(double d) { return cbrt(d); }

static const JSCFunctionListEntry js_math_funcs[] = {
JS_CFUNC_MAGIC_DEF("min", 2, js_math_min_max, 0 ),
JS_CFUNC_MAGIC_DEF("max", 2, js_math_min_max, 1 ),
JS_CFUNC_SPECIAL_DEF("abs", 1, f_f, fabs ),
JS_CFUNC_SPECIAL_DEF("floor", 1, f_f, floor ),
JS_CFUNC_SPECIAL_DEF("ceil", 1, f_f, ceil ),
JS_CFUNC_SPECIAL_DEF("abs", 1, f_f, js_math_fabs ),
JS_CFUNC_SPECIAL_DEF("floor", 1, f_f, js_math_floor ),
JS_CFUNC_SPECIAL_DEF("ceil", 1, f_f, js_math_ceil ),
JS_CFUNC_SPECIAL_DEF("round", 1, f_f, js_math_round ),
JS_CFUNC_SPECIAL_DEF("sqrt", 1, f_f, sqrt ),

JS_CFUNC_SPECIAL_DEF("acos", 1, f_f, acos ),
JS_CFUNC_SPECIAL_DEF("asin", 1, f_f, asin ),
JS_CFUNC_SPECIAL_DEF("atan", 1, f_f, atan ),
JS_CFUNC_SPECIAL_DEF("atan2", 2, f_f_f, atan2 ),
JS_CFUNC_SPECIAL_DEF("cos", 1, f_f, cos ),
JS_CFUNC_SPECIAL_DEF("exp", 1, f_f, exp ),
JS_CFUNC_SPECIAL_DEF("log", 1, f_f, log ),
JS_CFUNC_SPECIAL_DEF("pow", 2, f_f_f, js_pow ),
JS_CFUNC_SPECIAL_DEF("sin", 1, f_f, sin ),
JS_CFUNC_SPECIAL_DEF("tan", 1, f_f, tan ),
JS_CFUNC_SPECIAL_DEF("sqrt", 1, f_f, js_math_sqrt ),

JS_CFUNC_SPECIAL_DEF("acos", 1, f_f, js_math_acos ),
JS_CFUNC_SPECIAL_DEF("asin", 1, f_f, js_math_asin ),
JS_CFUNC_SPECIAL_DEF("atan", 1, f_f, js_math_atan ),
JS_CFUNC_SPECIAL_DEF("atan2", 2, f_f_f, js_math_atan2 ),
JS_CFUNC_SPECIAL_DEF("cos", 1, f_f, js_math_cos ),
JS_CFUNC_SPECIAL_DEF("exp", 1, f_f, js_math_exp ),
JS_CFUNC_SPECIAL_DEF("log", 1, f_f, js_math_log ),
JS_CFUNC_SPECIAL_DEF("pow", 2, f_f_f, js_math_pow ),
JS_CFUNC_SPECIAL_DEF("sin", 1, f_f, js_math_sin ),
JS_CFUNC_SPECIAL_DEF("tan", 1, f_f, js_math_tan ),
/* ES6 */
JS_CFUNC_SPECIAL_DEF("trunc", 1, f_f, trunc ),
JS_CFUNC_SPECIAL_DEF("trunc", 1, f_f, js_math_trunc ),
JS_CFUNC_SPECIAL_DEF("sign", 1, f_f, js_math_sign ),
JS_CFUNC_SPECIAL_DEF("cosh", 1, f_f, cosh ),
JS_CFUNC_SPECIAL_DEF("sinh", 1, f_f, sinh ),
JS_CFUNC_SPECIAL_DEF("tanh", 1, f_f, tanh ),
JS_CFUNC_SPECIAL_DEF("acosh", 1, f_f, acosh ),
JS_CFUNC_SPECIAL_DEF("asinh", 1, f_f, asinh ),
JS_CFUNC_SPECIAL_DEF("atanh", 1, f_f, atanh ),
JS_CFUNC_SPECIAL_DEF("expm1", 1, f_f, expm1 ),
JS_CFUNC_SPECIAL_DEF("log1p", 1, f_f, log1p ),
JS_CFUNC_SPECIAL_DEF("log2", 1, f_f, log2 ),
JS_CFUNC_SPECIAL_DEF("log10", 1, f_f, log10 ),
JS_CFUNC_SPECIAL_DEF("cbrt", 1, f_f, cbrt ),
JS_CFUNC_SPECIAL_DEF("cosh", 1, f_f, js_math_cosh ),
JS_CFUNC_SPECIAL_DEF("sinh", 1, f_f, js_math_sinh ),
JS_CFUNC_SPECIAL_DEF("tanh", 1, f_f, js_math_tanh ),
JS_CFUNC_SPECIAL_DEF("acosh", 1, f_f, js_math_acosh ),
JS_CFUNC_SPECIAL_DEF("asinh", 1, f_f, js_math_asinh ),
JS_CFUNC_SPECIAL_DEF("atanh", 1, f_f, js_math_atanh ),
JS_CFUNC_SPECIAL_DEF("expm1", 1, f_f, js_math_expm1 ),
JS_CFUNC_SPECIAL_DEF("log1p", 1, f_f, js_math_log1p ),
JS_CFUNC_SPECIAL_DEF("log2", 1, f_f, js_math_log2 ),
JS_CFUNC_SPECIAL_DEF("log10", 1, f_f, js_math_log10 ),
JS_CFUNC_SPECIAL_DEF("cbrt", 1, f_f, js_math_cbrt ),
JS_CFUNC_DEF("hypot", 2, js_math_hypot ),
JS_CFUNC_DEF("random", 0, js_math_random ),
JS_CFUNC_SPECIAL_DEF("fround", 1, f_f, js_math_fround ),
Expand Down