json 2.7.3 → 2.12.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGES.md +114 -0
- data/LEGAL +0 -52
- data/README.md +61 -57
- data/ext/json/ext/fbuffer/fbuffer.h +156 -66
- data/ext/json/ext/generator/extconf.rb +29 -0
- data/ext/json/ext/generator/generator.c +1166 -478
- data/ext/json/ext/generator/simd.h +112 -0
- data/ext/json/ext/parser/extconf.rb +4 -27
- data/ext/json/ext/parser/parser.c +1138 -1971
- data/ext/json/ext/vendor/fpconv.c +479 -0
- data/ext/json/ext/vendor/jeaiii-ltoa.h +267 -0
- data/json.gemspec +7 -5
- data/lib/json/add/bigdecimal.rb +1 -1
- data/lib/json/add/symbol.rb +7 -2
- data/lib/json/common.rb +594 -219
- data/lib/json/ext/generator/state.rb +2 -31
- data/lib/json/ext.rb +28 -11
- data/lib/json/{pure → truffle_ruby}/generator.rb +264 -154
- data/lib/json/version.rb +1 -1
- data/lib/json.rb +15 -20
- metadata +11 -17
- data/ext/json/ext/generator/generator.h +0 -129
- data/ext/json/ext/parser/parser.h +0 -60
- data/ext/json/ext/parser/parser.rl +0 -997
- data/lib/json/pure/parser.rb +0 -331
- data/lib/json/pure.rb +0 -16
@@ -6,5 +6,34 @@ if RUBY_ENGINE == 'truffleruby'
|
|
6
6
|
else
|
7
7
|
append_cflags("-std=c99")
|
8
8
|
$defs << "-DJSON_GENERATOR"
|
9
|
+
|
10
|
+
if enable_config('generator-use-simd', default=!ENV["JSON_DISABLE_SIMD"])
|
11
|
+
if RbConfig::CONFIG['host_cpu'] =~ /^(arm.*|aarch64.*)/
|
12
|
+
# Try to compile a small program using NEON instructions
|
13
|
+
if have_header('arm_neon.h')
|
14
|
+
have_type('uint8x16_t', headers=['arm_neon.h']) && try_compile(<<~'SRC')
|
15
|
+
#include <arm_neon.h>
|
16
|
+
int main() {
|
17
|
+
uint8x16_t test = vdupq_n_u8(32);
|
18
|
+
return 0;
|
19
|
+
}
|
20
|
+
SRC
|
21
|
+
$defs.push("-DJSON_ENABLE_SIMD")
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
if have_header('x86intrin.h') && have_type('__m128i', headers=['x86intrin.h']) && try_compile(<<~'SRC')
|
26
|
+
#include <x86intrin.h>
|
27
|
+
int main() {
|
28
|
+
__m128i test = _mm_set1_epi8(32);
|
29
|
+
return 0;
|
30
|
+
}
|
31
|
+
SRC
|
32
|
+
$defs.push("-DJSON_ENABLE_SIMD")
|
33
|
+
end
|
34
|
+
|
35
|
+
have_header('cpuid.h')
|
36
|
+
end
|
37
|
+
|
9
38
|
create_makefile 'json/ext/generator'
|
10
39
|
end
|