Commit graph

529 commits

Author SHA1 Message Date
Jean Boussier
1c6b36af18
Only define String.json_create & al when json/add is required
All the `json/add` related methods for string were
always defined unconditionally from the generators.

It's preferable to only define them if `json/add` is actually used.
2025-08-04 09:29:53 +09:00
Jean Boussier
8e426a3aee [ruby/json] Release 2.13.2
9e3efbfa22
2025-07-29 10:41:09 +09:00
Jean Boussier
48a79cd492 [ruby/json] Improve deprecation warning location detection
132049bde2
2025-07-28 09:39:12 +09:00
Jean Boussier
d0020d58f4 [ruby/json] Fix duplicated key warning location
Followup: https://github.com/ruby/json/pull/818

Now the warning should point at the `JSON.parse` caller, and not
inside the json gem itself.

cd51557387
2025-07-28 09:39:12 +09:00
Jean Boussier
b4ef5da70b [ruby/json] Improve duplicate key warning and errors to include the key name
Followup: https://github.com/ruby/json/pull/818

e3de4cc59c
2025-07-28 09:39:11 +09:00
Nobuyoshi Nakada
0adecf500a
[ruby/json] Keep indentation consistent across functions [ci skip]
1988a3ae4c
2025-07-27 16:35:14 +09:00
Nobuyoshi Nakada
f5aee2480a [ruby/json] Functions defined in headers should be static inline
If `load_uint8x16_4` has an external linkage, it is defined in
both `generator` and `parser` extension libraries.  This duplicate
symbol causes a linker error when `--with-static-linked-ext` is
given, on some platforms.

020693b17a
2025-07-27 15:08:19 +09:00
Jean Boussier
93eed37e66 [ruby/json] Release 2.13.1
cfe9337eda
2025-07-25 11:11:24 +09:00
Jean Boussier
069a24c93c [ruby/json] Don't assume __builtin_cpu_supports exists
Fix: https://github.com/ruby/json/issues/827

On very old compilers it might not exist, at that point
might as well skip SIMD entirely.

da878435dc
2025-07-25 11:11:23 +09:00
John Hawthorn
b48904273a [ruby/json] Fix missing write barrier on Generator State
Found by wbcheck

   WBCHECK ERROR: Missed write barrier detected!
     Parent object: 0x7b7b8487c450 (wb_protected: true)
       rb_obj_info_dump: 0x00007b7b8487c450 JSON/Generator/State/JSON::Ext::Generator::State JSON/Generator/State
     Reference counts - snapshot: 1, writebarrier: 0, current: 6, missed: 5
     Missing reference to: 0x7b7b82f35a10
       rb_obj_info_dump: 0x00007b7b82f35a10 T_STRING/String  len: 1, capa: 15 "1"
     Missing reference to: 0x7b7b82f35e90
       rb_obj_info_dump: 0x00007b7b82f35e90 T_STRING/String  len: 1, capa: 15 "2"
     Missing reference to: 0x7b7b83629e50
       rb_obj_info_dump: 0x00007b7b83629e50 T_STRING/String  len: 1, capa: 15 "3"
     Missing reference to: 0x7b7b83b62190
       rb_obj_info_dump: 0x00007b7b83b62190 T_STRING/String  len: 1, capa: 15 "4"
     Missing reference to: 0x7b7b83629490
       rb_obj_info_dump: 0x00007b7b83629490 T_STRING/String  len: 1, capa: 15 "5"

c24342d801
2025-07-25 11:11:21 +09:00
Jean Boussier
1e65f0d93e
[ruby/json] Release 2.13.0
8d08494dee
2025-07-18 14:33:26 +09:00
Jeremy Evans
0b23a8db60 Update dependencies for addition of set.h to public headers 2025-07-11 15:24:23 +09:00
Jean Boussier
d0fdbef4ea [ruby/json] Improve consistency of code style
a497c71960
2025-07-07 11:53:23 +09:00
Nobuyoshi Nakada
9d080765cc [ruby/json] Run have_func with the header providing the declarations
95fb084027
2025-07-01 20:28:47 +09:00
Jean Boussier
ae605b652d [ruby/json] Stop calling __builtin_cpu_init
It's only needed if using GCC `ifunc` mecanism, which
we don't.

d3317b9f82
2025-07-01 20:28:45 +09:00
Takashi Kokubun
9f14857418 [ruby/json] Suppress -Wunused-function
94ed471814
2025-07-01 15:35:37 +09:00
Nobuyoshi Nakada
8a2210b351 [ruby/json] Refactor simd/conf.rb - duplicate code
Integrate duplicate code by extracting headers, types and
initialization code.

1a768d9179
2025-07-01 15:35:36 +09:00
Nobuyoshi Nakada
f909c907bb [ruby/json] Refactor simd/conf.rb - unnecessary have_type
Remove `have_type` calls because the next `try_compile` calls check
those types.

b08e1ca2c1
2025-07-01 15:35:35 +09:00
Nobuyoshi Nakada
7d9c3004cf [ruby/json] Refactor simd/conf.rb - conditions to enable
See the results of `have_type` and `try_compile` in addition to
`have_header` for NEON as well as x86_64.  The former results were
just ignored, and `HAVE_TYPE_` macros are unused too.

fdbb6062c2
2025-07-01 15:35:35 +09:00
Nobuyoshi Nakada
a9e2a818bd [ruby/json] Refactor simd/conf.rb - balance
Align code for arm and x86_64 in parallel.

2211e30a59
2025-07-01 15:35:34 +09:00
Nobuyoshi Nakada
60eb1d5d23 [ruby/json] Refactor simd/conf.rb - compiler warnings
Suppress warnings for old style function definition and unused
variable.

58dc0aa938
2025-07-01 15:35:33 +09:00
Nobuyoshi Nakada
91d5db5505 [ruby/json] Use load simd/conf.rb
When both extconf.rb of generator and parser are run in one process,
the second `require_relative` does nothing.

8e775320b7
2025-07-01 15:35:32 +09:00
Hiroshi SHIBATA
5ee6315704 Use Dir.glob and base keyword arg for the installer of Ruby package 2025-07-01 11:50:11 +09:00
Nobuyoshi Nakada
400793426a [ruby/json] Remove trailing spaces [ci skip]
68ee9cf188
2025-07-01 00:43:41 +09:00
Hiroshi SHIBATA
54cb133eea ruby tool/update-deps --fix 2025-06-30 12:56:50 +09:00
Hiroshi SHIBATA
43d27eb129 Adjust ruby/ruby directory structure 2025-06-30 12:56:50 +09:00
Jean Boussier
bc334be4db [ruby/json] Reduce duplication in extconf.rb
3ae3eeb9d3
2025-06-30 12:56:50 +09:00
Scott Myron
50b6cd409a Optimize 'json_parse_string' using SIMD. 2025-06-30 12:56:50 +09:00
Nobuyoshi Nakada
ac02bf2b72 [ruby/json] Remove trailing spaces [ci skip]
6c41162522
2025-06-24 18:19:04 +09:00
Jean Boussier
93fc29c65c
[ruby/json] Deprecate duplicate keys in object
There are few legitimate use cases for duplicate keys, and can
in some case be exploited.

Rather to always silently accept them, we should emit a warning,
and in the future require to explictly allow them.

06f00a42e8
2025-06-24 12:10:50 +09:00
Jean Boussier
b310e7b3c7
[ruby/json] Add missing parser options documentation
eed753ffde
2025-06-24 12:10:50 +09:00
Nobuyoshi Nakada
e9d35671d2 [ruby/json] Fix a typo
ruby/ruby#13636

6fc2c4b6ab

Co-Authored-By: Tim Smith <tsmith84@gmail.com>
2025-06-17 17:45:40 +09:00
Jean Boussier
d565d809af
[ruby/json] Release 2.12.2
a29cb77d52
2025-05-26 11:46:12 +09:00
Jean Boussier
54a314233c
[ruby/json] Release 2.12.1
8603a57a91
2025-05-26 11:46:12 +09:00
Jean Boussier
212213a552
[ruby/json] fbuffer.c: add debug mode with bound checks.
This would have caught https://github.com/ruby/json/pull/808
on CI.

8109421fb4
2025-05-26 11:46:12 +09:00
Jean Boussier
f171a263f7
[ruby/json] Fix: generate_json_float to reserve enough memory for large negative floats.
Fix: https://github.com/ruby/json/issues/807

Since https://github.com/ruby/json/pull/800, `fpconv_dtoa` can actually
generate up to 28 chars.

d73ae93d3c
2025-05-26 11:46:12 +09:00
Jean Boussier
4759550967
[ruby/json] Remove some unnecessary top level constant lookups
7c03ffc3e0
2025-05-19 11:19:17 +09:00
GrantBirki
e4a44b1f2a
[ruby/json] remove redundant self.
c060943d04
2025-05-19 11:19:17 +09:00
GrantBirki
9b25023fe4
[ruby/json] use . over :: for consistency
f5c1b8c45d
2025-05-19 11:19:17 +09:00
Cody Horton
3468811ed1
[ruby/json] fix for pretty_generate throwing wrong number of arguments error
8433571dcf
2025-05-19 11:19:17 +09:00
Jean Boussier
cd7495a1d0 [ruby/json] Further improve parsing errors
Report EOF when applicable instead of an empty fragment.

Also stop fragment extraction on first whitespace.

cc1daba860
2025-05-13 14:12:22 +09:00
Jean Boussier
8cc1aa82f1 [ruby/json] Add missing single quotes in error messages
f3dde3cb2f
2025-05-13 14:12:22 +09:00
Jean Boussier
73d0bd5e90 [ruby/json] Release 2.12.0
41f1f6939d
2025-05-13 14:12:22 +09:00
Jean Boussier
50ef208369 [ruby/json] parser.c: include line and column in error messages
30e35b9ba5
2025-05-13 14:12:22 +09:00
Jean Boussier
8f008598c3 [ruby/json] parser.c: refactor raise_parse_error to have document start
832b5b1a4c
2025-05-13 14:12:22 +09:00
Nobuyoshi Nakada
d2ffdb1088 Explicit cast down from double to int 2025-05-12 17:45:39 +09:00
Jean Boussier
af79914002 [ruby/json] Favor decimal notation over scientific notation for floats
e.g.
```
JSON.dump(1746861937.7842371)
```

master:
```
"1.7468619377+9"
```

This branch and older json versions:
```
1746861937.7842371
```

In the end it's shorter, and according to `canada.json` benchmark
performance is the same.

866f72a437
2025-05-12 11:09:11 +09:00
Nobuyoshi Nakada
61b6f226e8
[ruby/json] Constify static data in fpconv.c
3b605d9b1e
2025-05-08 18:03:04 +09:00
Jean Boussier
de6e59e5ba Sync ruby/json
Fix: https://github.com/ruby/json/issues/796
2025-05-01 10:06:04 +02:00
Jean Boussier
6e7825316e [ruby/json] Remove explicit include of extconf.h
6b059900de

.
2025-04-30 08:12:41 +02:00