Skip to content

Commit b079fa0

Browse files
deps: update simdjson to 4.2.2
PR-URL: nodejs#60740 Reviewed-By: Michaël Zasso <[email protected]> Reviewed-By: Antoine du Hamel <[email protected]> Reviewed-By: Ulises Gascón <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Rafael Gonzaga <[email protected]>
1 parent 6f35f89 commit b079fa0

File tree

2 files changed

+138
-12
lines changed

2 files changed

+138
-12
lines changed

deps/simdjson/simdjson.cpp

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* auto-generated on 2025-11-03 11:03:21 -0500. version 4.2.1 Do not edit! */
1+
/* auto-generated on 2025-11-11 14:17:08 -0500. version 4.2.2 Do not edit! */
22
/* including simdjson.cpp: */
33
/* begin file simdjson.cpp */
44
#define SIMDJSON_SRC_SIMDJSON_CPP
@@ -2752,6 +2752,8 @@ struct simdjson_result_base : protected std::pair<T, error_code> {
27522752
*/
27532753
simdjson_inline T&& value_unsafe() && noexcept;
27542754

2755+
using value_type = T;
2756+
using error_type = error_code;
27552757
}; // struct simdjson_result_base
27562758

27572759
} // namespace internal
@@ -2863,6 +2865,8 @@ struct simdjson_result : public internal::simdjson_result_base<T> {
28632865
*/
28642866
simdjson_inline T&& value_unsafe() && noexcept;
28652867

2868+
using value_type = T;
2869+
using error_type = error_code;
28662870
}; // struct simdjson_result
28672871

28682872
#if SIMDJSON_EXCEPTIONS
@@ -10105,6 +10109,9 @@ struct implementation_simdjson_result_base {
1010510109
*/
1010610110
simdjson_inline T&& value_unsafe() && noexcept;
1010710111

10112+
using value_type = T;
10113+
using error_type = error_code;
10114+
1010810115
protected:
1010910116
/** users should never directly access first and second. **/
1011010117
T first{}; /** Users should never directly access 'first'. **/
@@ -16600,6 +16607,9 @@ struct implementation_simdjson_result_base {
1660016607
*/
1660116608
simdjson_inline T&& value_unsafe() && noexcept;
1660216609

16610+
using value_type = T;
16611+
using error_type = error_code;
16612+
1660316613
protected:
1660416614
/** users should never directly access first and second. **/
1660516615
T first{}; /** Users should never directly access 'first'. **/
@@ -22950,6 +22960,9 @@ struct implementation_simdjson_result_base {
2295022960
*/
2295122961
simdjson_inline T&& value_unsafe() && noexcept;
2295222962

22963+
using value_type = T;
22964+
using error_type = error_code;
22965+
2295322966
protected:
2295422967
/** users should never directly access first and second. **/
2295522968
T first{}; /** Users should never directly access 'first'. **/
@@ -29457,6 +29470,9 @@ struct implementation_simdjson_result_base {
2945729470
*/
2945829471
simdjson_inline T&& value_unsafe() && noexcept;
2945929472

29473+
using value_type = T;
29474+
using error_type = error_code;
29475+
2946029476
protected:
2946129477
/** users should never directly access first and second. **/
2946229478
T first{}; /** Users should never directly access 'first'. **/
@@ -36323,6 +36339,9 @@ struct implementation_simdjson_result_base {
3632336339
*/
3632436340
simdjson_inline T&& value_unsafe() && noexcept;
3632536341

36342+
using value_type = T;
36343+
using error_type = error_code;
36344+
3632636345
protected:
3632736346
/** users should never directly access first and second. **/
3632836347
T first{}; /** Users should never directly access 'first'. **/
@@ -43011,6 +43030,9 @@ struct implementation_simdjson_result_base {
4301143030
*/
4301243031
simdjson_inline T&& value_unsafe() && noexcept;
4301343032

43033+
using value_type = T;
43034+
using error_type = error_code;
43035+
4301443036
protected:
4301543037
/** users should never directly access first and second. **/
4301643038
T first{}; /** Users should never directly access 'first'. **/
@@ -49145,6 +49167,9 @@ struct implementation_simdjson_result_base {
4914549167
*/
4914649168
simdjson_inline T&& value_unsafe() && noexcept;
4914749169

49170+
using value_type = T;
49171+
using error_type = error_code;
49172+
4914849173
protected:
4914949174
/** users should never directly access first and second. **/
4915049175
T first{}; /** Users should never directly access 'first'. **/
@@ -54871,6 +54896,9 @@ struct implementation_simdjson_result_base {
5487154896
*/
5487254897
simdjson_inline T&& value_unsafe() && noexcept;
5487354898

54899+
using value_type = T;
54900+
using error_type = error_code;
54901+
5487454902
protected:
5487554903
/** users should never directly access first and second. **/
5487654904
T first{}; /** Users should never directly access 'first'. **/

deps/simdjson/simdjson.h

Lines changed: 109 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* auto-generated on 2025-11-03 11:03:21 -0500. version 4.2.1 Do not edit! */
1+
/* auto-generated on 2025-11-11 14:17:08 -0500. version 4.2.2 Do not edit! */
22
/* including simdjson.h: */
33
/* begin file simdjson.h */
44
#ifndef SIMDJSON_H
@@ -2513,7 +2513,7 @@ namespace std {
25132513
#define SIMDJSON_SIMDJSON_VERSION_H
25142514

25152515
/** The version of simdjson being used (major.minor.revision) */
2516-
#define SIMDJSON_VERSION "4.2.1"
2516+
#define SIMDJSON_VERSION "4.2.2"
25172517

25182518
namespace simdjson {
25192519
enum {
@@ -2528,7 +2528,7 @@ enum {
25282528
/**
25292529
* The revision (major.minor.REVISION) of simdjson being used.
25302530
*/
2531-
SIMDJSON_VERSION_REVISION = 1
2531+
SIMDJSON_VERSION_REVISION = 2
25322532
};
25332533
} // namespace simdjson
25342534

@@ -2815,6 +2815,8 @@ struct simdjson_result_base : protected std::pair<T, error_code> {
28152815
*/
28162816
simdjson_inline T&& value_unsafe() && noexcept;
28172817

2818+
using value_type = T;
2819+
using error_type = error_code;
28182820
}; // struct simdjson_result_base
28192821

28202822
} // namespace internal
@@ -2926,6 +2928,8 @@ struct simdjson_result : public internal::simdjson_result_base<T> {
29262928
*/
29272929
simdjson_inline T&& value_unsafe() && noexcept;
29282930

2931+
using value_type = T;
2932+
using error_type = error_code;
29292933
}; // struct simdjson_result
29302934

29312935
#if SIMDJSON_EXCEPTIONS
@@ -4165,6 +4169,19 @@ struct padded_string final {
41654169
**/
41664170
inline static simdjson_result<padded_string> load(std::string_view path) noexcept;
41674171

4172+
#if defined(_WIN32) && SIMDJSON_CPLUSPLUS17
4173+
/**
4174+
* This function accepts a wide string path (UTF-16) and converts it to
4175+
* UTF-8 before loading the file. This allows windows users to work
4176+
* with unicode file paths without manually converting the paths everytime.
4177+
*
4178+
* @return IO_ERROR on error, including conversion failures.
4179+
*
4180+
* @param path the path to the file as a wide string.
4181+
**/
4182+
inline static simdjson_result<padded_string> load(std::wstring_view path) noexcept;
4183+
#endif
4184+
41684185
private:
41694186
padded_string &operator=(const padded_string &o) = delete;
41704187
padded_string(const padded_string &o) = delete;
@@ -4476,6 +4493,7 @@ inline padded_string_view pad_with_reserve(std::string& s) noexcept {
44764493
/* end file simdjson/padded_string_view-inl.h */
44774494

44784495
#include <climits>
4496+
#include <cwchar>
44794497

44804498
namespace simdjson {
44814499
namespace internal {
@@ -4653,6 +4671,62 @@ inline simdjson_result<padded_string> padded_string::load(std::string_view filen
46534671
return s;
46544672
}
46554673

4674+
#if defined(_WIN32) && SIMDJSON_CPLUSPLUS17
4675+
inline simdjson_result<padded_string> padded_string::load(std::wstring_view filename) noexcept {
4676+
// Open the file using the wide characters
4677+
SIMDJSON_PUSH_DISABLE_WARNINGS
4678+
SIMDJSON_DISABLE_DEPRECATED_WARNING // Disable CRT_SECURE warning on MSVC: manually verified this is safe
4679+
std::FILE *fp = _wfopen(filename.data(), L"rb");
4680+
SIMDJSON_POP_DISABLE_WARNINGS
4681+
4682+
if (fp == nullptr) {
4683+
return IO_ERROR;
4684+
}
4685+
4686+
// Get the file size
4687+
int ret;
4688+
#if SIMDJSON_VISUAL_STUDIO && !SIMDJSON_IS_32BITS
4689+
ret = _fseeki64(fp, 0, SEEK_END);
4690+
#else
4691+
ret = std::fseek(fp, 0, SEEK_END);
4692+
#endif // _WIN64
4693+
if(ret < 0) {
4694+
std::fclose(fp);
4695+
return IO_ERROR;
4696+
}
4697+
#if SIMDJSON_VISUAL_STUDIO && !SIMDJSON_IS_32BITS
4698+
__int64 llen = _ftelli64(fp);
4699+
if(llen == -1L) {
4700+
std::fclose(fp);
4701+
return IO_ERROR;
4702+
}
4703+
#else
4704+
long llen = std::ftell(fp);
4705+
if((llen < 0) || (llen == LONG_MAX)) {
4706+
std::fclose(fp);
4707+
return IO_ERROR;
4708+
}
4709+
#endif
4710+
4711+
// Allocate the padded_string
4712+
size_t len = static_cast<size_t>(llen);
4713+
padded_string s(len);
4714+
if (s.data() == nullptr) {
4715+
std::fclose(fp);
4716+
return MEMALLOC;
4717+
}
4718+
4719+
// Read the padded_string
4720+
std::rewind(fp);
4721+
size_t bytes_read = std::fread(s.data(), 1, len, fp);
4722+
if (std::fclose(fp) != 0 || bytes_read != len) {
4723+
return IO_ERROR;
4724+
}
4725+
4726+
return s;
4727+
}
4728+
#endif
4729+
46564730
} // namespace simdjson
46574731

46584732
inline simdjson::padded_string operator ""_padded(const char *str, size_t len) {
@@ -12996,6 +13070,9 @@ struct implementation_simdjson_result_base {
1299613070
*/
1299713071
simdjson_inline T&& value_unsafe() && noexcept;
1299813072

13073+
using value_type = T;
13074+
using error_type = error_code;
13075+
1299913076
protected:
1300013077
/** users should never directly access first and second. **/
1300113078
T first{}; /** Users should never directly access 'first'. **/
@@ -15191,6 +15268,9 @@ struct implementation_simdjson_result_base {
1519115268
*/
1519215269
simdjson_inline T&& value_unsafe() && noexcept;
1519315270

15271+
using value_type = T;
15272+
using error_type = error_code;
15273+
1519415274
protected:
1519515275
/** users should never directly access first and second. **/
1519615276
T first{}; /** Users should never directly access 'first'. **/
@@ -17885,6 +17965,9 @@ struct implementation_simdjson_result_base {
1788517965
*/
1788617966
simdjson_inline T&& value_unsafe() && noexcept;
1788717967

17968+
using value_type = T;
17969+
using error_type = error_code;
17970+
1788817971
protected:
1788917972
/** users should never directly access first and second. **/
1789017973
T first{}; /** Users should never directly access 'first'. **/
@@ -20579,6 +20662,9 @@ struct implementation_simdjson_result_base {
2057920662
*/
2058020663
simdjson_inline T&& value_unsafe() && noexcept;
2058120664

20665+
using value_type = T;
20666+
using error_type = error_code;
20667+
2058220668
protected:
2058320669
/** users should never directly access first and second. **/
2058420670
T first{}; /** Users should never directly access 'first'. **/
@@ -23388,6 +23474,9 @@ struct implementation_simdjson_result_base {
2338823474
*/
2338923475
simdjson_inline T&& value_unsafe() && noexcept;
2339023476

23477+
using value_type = T;
23478+
using error_type = error_code;
23479+
2339123480
protected:
2339223481
/** users should never directly access first and second. **/
2339323482
T first{}; /** Users should never directly access 'first'. **/
@@ -26513,6 +26602,9 @@ struct implementation_simdjson_result_base {
2651326602
*/
2651426603
simdjson_inline T&& value_unsafe() && noexcept;
2651526604

26605+
using value_type = T;
26606+
using error_type = error_code;
26607+
2651626608
protected:
2651726609
/** users should never directly access first and second. **/
2651826610
T first{}; /** Users should never directly access 'first'. **/
@@ -29115,6 +29207,9 @@ struct implementation_simdjson_result_base {
2911529207
*/
2911629208
simdjson_inline T&& value_unsafe() && noexcept;
2911729209

29210+
using value_type = T;
29211+
using error_type = error_code;
29212+
2911829213
protected:
2911929214
/** users should never directly access first and second. **/
2912029215
T first{}; /** Users should never directly access 'first'. **/
@@ -31730,6 +31825,9 @@ struct implementation_simdjson_result_base {
3173031825
*/
3173131826
simdjson_inline T&& value_unsafe() && noexcept;
3173231827

31828+
using value_type = T;
31829+
using error_type = error_code;
31830+
3173331831
protected:
3173431832
/** users should never directly access first and second. **/
3173531833
T first{}; /** Users should never directly access 'first'. **/
@@ -46859,7 +46957,7 @@ template <std::ranges::range R>
4685946957
simdjson_inline void string_builder::append(const R &range) noexcept {
4686046958
auto it = std::ranges::begin(range);
4686146959
auto end = std::ranges::end(range);
46862-
if constexpr (concepts::is_pair<typename R::value_type>) {
46960+
if constexpr (concepts::is_pair<std::ranges::range_value_t<R>>) {
4686346961
start_object();
4686446962

4686546963
if (it == end) {
@@ -61324,7 +61422,7 @@ template <std::ranges::range R>
6132461422
simdjson_inline void string_builder::append(const R &range) noexcept {
6132561423
auto it = std::ranges::begin(range);
6132661424
auto end = std::ranges::end(range);
61327-
if constexpr (concepts::is_pair<typename R::value_type>) {
61425+
if constexpr (concepts::is_pair<std::ranges::range_value_t<R>>) {
6132861426
start_object();
6132961427

6133061428
if (it == end) {
@@ -76288,7 +76386,7 @@ template <std::ranges::range R>
7628876386
simdjson_inline void string_builder::append(const R &range) noexcept {
7628976387
auto it = std::ranges::begin(range);
7629076388
auto end = std::ranges::end(range);
76291-
if constexpr (concepts::is_pair<typename R::value_type>) {
76389+
if constexpr (concepts::is_pair<std::ranges::range_value_t<R>>) {
7629276390
start_object();
7629376391

7629476392
if (it == end) {
@@ -91252,7 +91350,7 @@ template <std::ranges::range R>
9125291350
simdjson_inline void string_builder::append(const R &range) noexcept {
9125391351
auto it = std::ranges::begin(range);
9125491352
auto end = std::ranges::end(range);
91255-
if constexpr (concepts::is_pair<typename R::value_type>) {
91353+
if constexpr (concepts::is_pair<std::ranges::range_value_t<R>>) {
9125691354
start_object();
9125791355

9125891356
if (it == end) {
@@ -106331,7 +106429,7 @@ template <std::ranges::range R>
106331106429
simdjson_inline void string_builder::append(const R &range) noexcept {
106332106430
auto it = std::ranges::begin(range);
106333106431
auto end = std::ranges::end(range);
106334-
if constexpr (concepts::is_pair<typename R::value_type>) {
106432+
if constexpr (concepts::is_pair<std::ranges::range_value_t<R>>) {
106335106433
start_object();
106336106434

106337106435
if (it == end) {
@@ -121726,7 +121824,7 @@ template <std::ranges::range R>
121726121824
simdjson_inline void string_builder::append(const R &range) noexcept {
121727121825
auto it = std::ranges::begin(range);
121728121826
auto end = std::ranges::end(range);
121729-
if constexpr (concepts::is_pair<typename R::value_type>) {
121827+
if constexpr (concepts::is_pair<std::ranges::range_value_t<R>>) {
121730121828
start_object();
121731121829

121732121830
if (it == end) {
@@ -136598,7 +136696,7 @@ template <std::ranges::range R>
136598136696
simdjson_inline void string_builder::append(const R &range) noexcept {
136599136697
auto it = std::ranges::begin(range);
136600136698
auto end = std::ranges::end(range);
136601-
if constexpr (concepts::is_pair<typename R::value_type>) {
136699+
if constexpr (concepts::is_pair<std::ranges::range_value_t<R>>) {
136602136700
start_object();
136603136701

136604136702
if (it == end) {
@@ -151483,7 +151581,7 @@ template <std::ranges::range R>
151483151581
simdjson_inline void string_builder::append(const R &range) noexcept {
151484151582
auto it = std::ranges::begin(range);
151485151583
auto end = std::ranges::end(range);
151486-
if constexpr (concepts::is_pair<typename R::value_type>) {
151584+
if constexpr (concepts::is_pair<std::ranges::range_value_t<R>>) {
151487151585
start_object();
151488151586

151489151587
if (it == end) {

0 commit comments

Comments
 (0)