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
Saúl Ibarra Corretgé
0b09109151
Add shared library target to CMake ( #60 )
2023-11-14 22:29:00 +01:00
Saúl Ibarra Corretgé
9749a90cc6
Skip stack checks whenbuilding with ASAN
2023-11-14 12:44:16 +01:00
Saúl Ibarra Corretgé
7926755704
Leave symbols in for Release CMake builds too
2023-11-13 13:02:44 +01:00
Saúl Ibarra Corretgé
1ccb36eee8
Add ASAN/MSAN/UBSAN support to CMake
2023-11-12 23:15:41 +01:00
Saúl Ibarra Corretgé
c17371b42a
Don't set global compilation flags on CMake
2023-11-11 18:33:51 +01:00
Saúl Ibarra Corretgé
0dc99e4ac2
Don't use -Werror by default on CMake
2023-11-10 22:06:23 +01:00
Saúl Ibarra Corretgé
f603aef16b
Export library incldue directories
2023-11-10 22:03:50 +01:00
Saúl Ibarra Corretgé
087f66247c
Drop unused definition
2023-11-10 21:57:01 +01:00
Saúl Ibarra Corretgé
68f7b1be3c
Fix CMake generated artifact location
2023-11-10 21:42:40 +01:00
Saúl Ibarra Corretgé
55e845c5dd
Add JS_GetVersion
2023-11-10 16:48:49 +01:00