Commit graph

62 commits

Author SHA1 Message Date
Saúl Ibarra Corretgé
685a9bc171 Install qjsc as part of the install target
Fixes: https://github.com/quickjs-ng/quickjs/issues/730
2024-12-02 21:16:53 +01:00
Saúl Ibarra Corretgé
55b67a6591 Bump CMake version to 3.10
Fixes a deprecation warning with new CMake versions.
2024-11-18 11:02:29 +01:00
Ben Noordhuis
b29332697b Don't use _Thread_local in run-test262.c
Allows building with tcc and old gcc versions again.
2024-11-09 23:14:20 +01:00
Ben Noordhuis
56e5ffa2db
Auto-detect ASan at compile time (#638)
Fixes: https://github.com/quickjs-ng/quickjs/issues/636
2024-10-29 19:54:33 +01:00
Ben Noordhuis
bed51fab0a
Allow turning on multiple sanitizers (#611)
Consolidate the ASan and UBSan buildbots and turn on both sanitizers
when fuzzing.
2024-10-20 12:41:17 +02:00
Ben Noordhuis
3c3c487e11 Build and run run-test262 on Windows
The ulterior motive here is not that I want to increase CI times
further but that I want to repurpose run-test262 for running our
own tests.
2024-10-10 21:52:34 +02:00
Saúl Ibarra Corretgé
a51c77efd8
Build all Windows targets when building in CI 2024-10-08 16:58:08 +02:00
satk0
86b1853a21 Improve gcc warning fix 2024-10-07 22:34:01 +02:00
Ben Noordhuis
ddabcf5e93
Run ThreadSanitizer on push to master (#575)
Fixes: https://github.com/quickjs-ng/quickjs/issues/557
2024-10-06 20:17:50 +02:00
Ben Noordhuis
e1564526ea
Run test262 tests in parallel (#564)
This commit introduces a couple of changes in order to make run-test262
go brr and execute tests in parallel:

- Remove CONFIG_AGENT build option. The disabled version of the build
  was already broken and no one noticed, Remove the define altogether.

- Remove the -C switch. Hard to support in multi-threaded mode.
  I may bring it back some day because it _is_ useful.

- Remove the -r switch. Also hard to support and I never look at
  test262_report.txt anyway so on the chopping block it goes.

- Judicious use of thread-local storage so I don't have to thread
  through state everywhere and embiggen the diff even more.

This is what Real Programmers(TM) do: stay up coding way past midnight
just so the test suite finishes in one minute instead of four.

Fixes: https://github.com/quickjs-ng/quickjs/issues/547
2024-09-30 18:35:35 +02:00
Saúl Ibarra Corretgé
c963112349 Fix use of js_malloc_usable_size
Make sure the one set in the malloc functions is used rather than the
default one, since it will likely use a different allocator.

For some reason, this didn't cause a problem on macOS, but it does in
Linux. Opsie! Added some CI to prevent these kinds of bugs.
2024-09-24 18:36:23 +02:00
Saúl Ibarra Corretgé
6ce2dcc938 Add ability to compile the CLI with mimalloc
Some (unscientific) benchmark results:

| Benchmark (Higher scores are better)  | QuickJS           | QuickJS (mimalloc) |
|---------------------------------------|-------------------|--------------------|
| Richards                              | 1217              | 1229               |
| DeltaBlue                             | 1192              | 1297               |
| Crypto                                | 1195              | 1191               |
| RayTrace                              | 1477              | 2186               |
| EarleyBoyer                           | 2441              | 3246               |
| RegExp                                | 275               | 315                |
| Splay                                 | 2461              | 3765               |
| NavierStokes                          | 2156              | 2119               |
| Score                                 | 1318              | 1553               |

Running the V8 benchmark suite (version 7) on an M1 MacBook Pro.

Fixes: https://github.com/quickjs-ng/quickjs/issues/142
2024-09-20 09:49:01 +02:00
Saúl Ibarra Corretgé
5765855089 Silence noisy (and useless) MSVC warnings 2024-09-11 20:15:53 +02:00
Saúl Ibarra Corretgé
d6b4c7d24f Actuall fix zero-length gnu_printf format string warning
Turns out it cannot be disabled through the pragma.
2024-09-11 19:49:52 +02:00
Saúl Ibarra Corretgé
dc6745a4b8
Mark required link libraries as PUBLIC (#520)
This way dependent projects only need to add this:

```
link_libraries(qjs)
```

or

```
target_link_libraries(mytarget qjs)
```

And CMake will link the resulting target with the libraries that qjs
needs too.
2024-09-10 23:42:31 +02:00
zeromake
902cc2cf0e
Add native module support on Windows 2024-09-10 22:47:40 +02:00
Saúl Ibarra Corretgé
54afb19745 Make the timeout test more resilient
Since we don't keep timers sorted by deadline but by insertion order,
the test is flaky in slow environments (GHA seemingly). Increase the
timeouts to give it a bigger chance of success.

ASan / UBSan builds are notoriously slow, so skip the test in those.
2024-09-09 22:42:51 +02:00
Saúl Ibarra Corretgé
114b8a4095 Enable all debug flags when compiling in debug mode
They still need to be individually enabled either via API or with the -D
CLI flag, but there is no need to modify the code and re-compile.
2024-09-05 23:24:57 +02:00
Ben Noordhuis
5a50ce3b08
Export bjson module (#478)
I find it convenient to have access to JS_ReadObject and JS_WriteObject
from JS land. That's precisely the functionality that tests/bjson.c
provides, ergo, move it into quickjs-libc.c
2024-08-11 11:04:08 +02:00
Andrew Johnson
b9de2b0bf8 Ignore maybe-uninitialised on MacOS with GCC >= 11 2024-07-01 23:14:06 +02:00
Andrew Johnson
845150232f Remove quickjs-libc from sources when BUILD_QJS_LIBC enabled 2024-06-27 22:53:43 +02:00
Andrew Johnson
136f5a2c66 Cleanup unused-variable warnings 2024-06-24 17:35:01 +02:00
Jonathan Barronville
5ca3c509d0
Fixed CMakeLists.txt for Emscripten builds (#403)
Prevent compilation of __run-test262__  for Emscripten (fails due to the `ftw()` usage, but not needed anyway).
2024-05-14 08:44:46 +02:00
Charlie Gordon
83726bb00c
Add utility functions for string to integer conversions (#366)
* Add utility functions, improve integer conversion functions

- move `is_be()` to cutils.h
- add `is_upper_ascii()` and `to_upper_ascii()`
- add extensive benchmark for integer conversion variants in **tests/test_conv.c**
- add `u32toa()`, `i32toa()`, `u64toa()`, `i64toa()` based on register shift variant
- add  `u32toa_radix()`, `u64toa_radix()`, `i64toa_radix()` based on length_loop variant
- use direct converters instead of `snprintf()`
- copy NaN and Infinity directly in `js_dtoa1()`
- optimize `js_number_toString()` for small integers
- use `JS_NewStringLen()` instead of `JS_NewString()` when possible
- add more precise conversion tests in microbench.js
- disable some benchmark tests for gcc (they cause ASAN failures)
2024-04-19 11:35:44 +02:00
Saúl Ibarra Corretgé
bb674c0c3b
Add iOS build to CI 2024-04-12 12:24:18 +02:00
Saúl Ibarra Corretgé
569b238ec4
Add cross-platform Atomics support
Fixes: https://github.com/quickjs-ng/quickjs/issues/1
2024-04-02 21:50:42 +02:00
aabajyan
48cb3ac410 Do not link to pthread when targeting Android
I had issues compiling this for Android, and as it turns out, pthread functionality
is part of Bionic itself and linking is not required.
2024-03-20 07:30:39 +01:00
henrydf
4d6c98115b
Fix Emscripten build
Co-authored-by: Henry <henrydf2018@gmail.com>
2024-03-06 08:56:45 +01:00
Saúl Ibarra Corretgé
fb03ca24d2 Add WASI support 2024-02-14 08:59:15 +01:00
Saúl Ibarra Corretgé
7f928d289f Check-in all generated C files
Closes: https://github.com/quickjs-ng/quickjs/issues/262
2024-02-13 09:49:57 +01:00
Nathan Rajlich
119f2c1b4c
Add support for cmake -DDEBUG_LEAKS=1 (#230)
I want to do a Release build (so that assert is disabled), but still
log leaks. This adds the option to enable that through CMake.
2023-12-22 21:30:10 +01:00
Ben Noordhuis
5cbf8727a6
Retain function source code in serialized bytecode (#218)
Also fix a small memory leak in the output from `qjsc -e`.

Fixes: https://github.com/quickjs-ng/quickjs/issues/217
2023-12-16 01:01:26 +01:00
Saúl Ibarra Corretgé
478bcf74f2 Add OpenBSD support 2023-12-05 12:34:02 +01:00
Saúl Ibarra Corretgé
0745c3a12b Add Emscripten target to CI
No testing, just making sure it compiles, and keeps on doing so.

Ref: https://github.com/quickjs-ng/quickjs/issues/75
2023-11-30 21:29:51 +01:00
Saúl Ibarra Corretgé
bfd8c381cb Add support for building with ClangCL on Windows
Since ClangCL is compatible with MSVC this should get us almost there.

Ref: https://clang.llvm.org/docs/MSVCCompatibility.html
2023-11-30 01:23:09 +01:00
Saúl Ibarra Corretgé
00d104e519 Add clang64 MinGW environment to CI
run-test262 required pthreads, so let's add that. In addition, in MinGW,
clock_gettime is implemented in the pthreads library, so we want to link
it too.

This doesn't get us anywhere closer to building with ClangCL on Windows,
but hey, another target that required some tweaking...
2023-11-28 09:11:27 +01:00
Saúl Ibarra Corretgé
fb1b1ced26
Set default visibility to hidden and export the public API (#140) 2023-11-26 01:41:32 +01:00
Saúl Ibarra Corretgé
d4c1244045 Ignore -Wimplicit-fallthrough 2023-11-26 00:08:48 +01:00
Saúl Ibarra Corretgé
d74b2e7ec1 Squelch a -Wcast-function-type warnings
Ref: https://github.com/quickjs-ng/quickjs/issues/131
2023-11-26 00:08:48 +01:00
Saúl Ibarra Corretgé
0bbb78ce5e Fix not making library include path public
This broke embedding the qjs library via CMake.
2023-11-24 23:05:12 +01:00
Saúl Ibarra Corretgé
af456e6c11 Add workflow for making releases 2023-11-23 14:43:56 +01:00
Saúl Ibarra Corretgé
1dcb61b521 CMake: dynamically detect compiler options 2023-11-22 19:33:59 +01:00
Saúl Ibarra Corretgé
d88b6734e9 Make MinGW builds fully statically linked
Note the pthread usage is due to the Worker support, which is gated out
on Windows so there should be no need to link with pthreads on MinGW.
2023-11-22 19:25:37 +01:00
Divy Srivastava
5d2e74fbbd Add -DBUILD_QJS_LIBC option 2023-11-18 12:34:59 +01:00
Saúl Ibarra Corretgé
f03ab48a85 Drop "LTO mode" from qjsc 2023-11-18 00:31:31 +01:00
Saúl Ibarra Corretgé
bebdfcea48
Drop ability to generate executables from qjsc (#76)
It's too brittle, and compiling the result is one command away.
2023-11-17 23:56:22 +01:00
Saúl Ibarra Corretgé
54a4f2907e Refactor build system to use CMake only 2023-11-17 13:10:18 +01:00
Saúl Ibarra Corretgé
f162a181b5 Add ability to set CMake options with env variables 2023-11-17 13:10:18 +01:00
Saúl Ibarra Corretgé
da3688f33d
Build examples on CMake (#67) 2023-11-17 10:45:04 +01:00
Saúl Ibarra Corretgé
ab534123a6 Add CMake install targets 2023-11-16 11:02:18 +01:00