yeptris 0.6.18.2-arm-linux-eabihf
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 +7 -0
- data/README.adoc +141 -0
- data/ext/build_windows_native.rb +41 -0
- data/ext/libyeptris/extconf.rb +57 -0
- data/ext/yeptris_native/cbor_ruby.c +193 -0
- data/ext/yeptris_native/extconf.rb +47 -0
- data/ext/yeptris_native/json_ruby.c +354 -0
- data/ext/yeptris_native/yeptris_native.c +497 -0
- data/lib/yeptris/cbor.rb +130 -0
- data/lib/yeptris/document.rb +255 -0
- data/lib/yeptris/ffi.rb +426 -0
- data/lib/yeptris/json/descriptor.rb +266 -0
- data/lib/yeptris/json.rb +394 -0
- data/lib/yeptris/materializer.rb +354 -0
- data/lib/yeptris/native-3.4.so +0 -0
- data/lib/yeptris/node.rb +453 -0
- data/lib/yeptris/psych/class_loader.rb +24 -0
- data/lib/yeptris/psych/coder_shim.rb +55 -0
- data/lib/yeptris/psych/drop_in.rb +63 -0
- data/lib/yeptris/psych/encodable.rb +14 -0
- data/lib/yeptris/psych/handler.rb +90 -0
- data/lib/yeptris/psych/parser.rb +105 -0
- data/lib/yeptris/psych/scalar_scanner.rb +149 -0
- data/lib/yeptris/psych/visitors.rb +545 -0
- data/lib/yeptris/psych.rb +622 -0
- data/lib/yeptris/schema.rb +253 -0
- data/lib/yeptris/valueml.rb +455 -0
- data/lib/yeptris/yaml/descriptor.rb +56 -0
- data/lib/yeptris/yaml.rb +422 -0
- data/lib/yeptris.rb +113 -0
- data/libyeptris.so +0 -0
- data/vendor/libyeptris/CMakeLists.txt +254 -0
- data/vendor/libyeptris/cmake/yeptris-config.cmake.in +5 -0
- data/vendor/libyeptris/cmake/yeptris.pc.in +11 -0
- data/vendor/libyeptris/src/CMakeLists.txt +167 -0
- data/vendor/libyeptris/src/include/yeptris/api.h +32 -0
- data/vendor/libyeptris/src/include/yeptris/cbor.h +101 -0
- data/vendor/libyeptris/src/include/yeptris/dom.h +190 -0
- data/vendor/libyeptris/src/include/yeptris/emit.h +81 -0
- data/vendor/libyeptris/src/include/yeptris/error.h +41 -0
- data/vendor/libyeptris/src/include/yeptris/events.h +157 -0
- data/vendor/libyeptris/src/include/yeptris/json.h +45 -0
- data/vendor/libyeptris/src/include/yeptris/json.hpp +258 -0
- data/vendor/libyeptris/src/include/yeptris/jsonc_compat.h +115 -0
- data/vendor/libyeptris/src/include/yeptris/marshal.h +52 -0
- data/vendor/libyeptris/src/include/yeptris/parse.h +48 -0
- data/vendor/libyeptris/src/include/yeptris/plan.h +100 -0
- data/vendor/libyeptris/src/include/yeptris/resolve.h +71 -0
- data/vendor/libyeptris/src/include/yeptris/schema.h +121 -0
- data/vendor/libyeptris/src/include/yeptris/tape.h +123 -0
- data/vendor/libyeptris/src/include/yeptris/types.h +38 -0
- data/vendor/libyeptris/src/include/yeptris/values.h +102 -0
- data/vendor/libyeptris/src/include/yeptris/version.h.in +29 -0
- data/vendor/libyeptris/src/include/yeptris/visit.h +77 -0
- data/vendor/libyeptris/src/include/yeptris/yajl_compat.h +135 -0
- data/vendor/libyeptris/src/include/yeptris.h +23 -0
- data/vendor/libyeptris/src/yeptris/build.c +376 -0
- data/vendor/libyeptris/src/yeptris/cbor/cbor.h +25 -0
- data/vendor/libyeptris/src/yeptris/cbor/decode.c +981 -0
- data/vendor/libyeptris/src/yeptris/cbor/encode.c +835 -0
- data/vendor/libyeptris/src/yeptris/cbor/sink.h +58 -0
- data/vendor/libyeptris/src/yeptris/common/chartype.c +41 -0
- data/vendor/libyeptris/src/yeptris/common/chartype.h +77 -0
- data/vendor/libyeptris/src/yeptris/common/cpu.c +81 -0
- data/vendor/libyeptris/src/yeptris/common/cpu.h +40 -0
- data/vendor/libyeptris/src/yeptris/common/error.c +65 -0
- data/vendor/libyeptris/src/yeptris/common/error.h +79 -0
- data/vendor/libyeptris/src/yeptris/common/mutex.h +45 -0
- data/vendor/libyeptris/src/yeptris/common/nametab.c +275 -0
- data/vendor/libyeptris/src/yeptris/common/nametab.h +68 -0
- data/vendor/libyeptris/src/yeptris/common/port.h +74 -0
- data/vendor/libyeptris/src/yeptris/common/simd_text.c +49 -0
- data/vendor/libyeptris/src/yeptris/common/simd_text.h +295 -0
- data/vendor/libyeptris/src/yeptris/common/simd_text_avx2.c +534 -0
- data/vendor/libyeptris/src/yeptris/common/simd_text_neon.c +662 -0
- data/vendor/libyeptris/src/yeptris/common/simd_text_scalar.c +298 -0
- data/vendor/libyeptris/src/yeptris/common/string_view.c +34 -0
- data/vendor/libyeptris/src/yeptris/common/string_view.h +93 -0
- data/vendor/libyeptris/src/yeptris/doc.h +56 -0
- data/vendor/libyeptris/src/yeptris/dom/dom.c +1192 -0
- data/vendor/libyeptris/src/yeptris/dom/dom.h +312 -0
- data/vendor/libyeptris/src/yeptris/dom/hpool.c +107 -0
- data/vendor/libyeptris/src/yeptris/dom/mapindex.c +173 -0
- data/vendor/libyeptris/src/yeptris/dom/mapindex.h +61 -0
- data/vendor/libyeptris/src/yeptris/dom/mutate.c +431 -0
- data/vendor/libyeptris/src/yeptris/emit/emit.c +434 -0
- data/vendor/libyeptris/src/yeptris/emit/float/api.h +38 -0
- data/vendor/libyeptris/src/yeptris/emit/float/dragon.c +405 -0
- data/vendor/libyeptris/src/yeptris/emit/float/floatint.h +231 -0
- data/vendor/libyeptris/src/yeptris/emit/float/print.c +396 -0
- data/vendor/libyeptris/src/yeptris/emit/style.c +81 -0
- data/vendor/libyeptris/src/yeptris/emit/style.h +24 -0
- data/vendor/libyeptris/src/yeptris/emit/writer.c +816 -0
- data/vendor/libyeptris/src/yeptris/emit/writer.h +76 -0
- data/vendor/libyeptris/src/yeptris/encoding/bom.c +31 -0
- data/vendor/libyeptris/src/yeptris/encoding/encoding.h +63 -0
- data/vendor/libyeptris/src/yeptris/encoding/transcode.c +148 -0
- data/vendor/libyeptris/src/yeptris/encoding/utf8_validate.c +178 -0
- data/vendor/libyeptris/src/yeptris/events/capture.c +150 -0
- data/vendor/libyeptris/src/yeptris/events/capture.h +39 -0
- data/vendor/libyeptris/src/yeptris/events/iterparse.c +208 -0
- data/vendor/libyeptris/src/yeptris/events/pull.c +97 -0
- data/vendor/libyeptris/src/yeptris/events/push.c +104 -0
- data/vendor/libyeptris/src/yeptris/events/recorder.c +107 -0
- data/vendor/libyeptris/src/yeptris/events/values.c +527 -0
- data/vendor/libyeptris/src/yeptris/events/values_priv.h +51 -0
- data/vendor/libyeptris/src/yeptris/events/yaml_compat.c +86 -0
- data/vendor/libyeptris/src/yeptris/events/yaml_compat.h +90 -0
- data/vendor/libyeptris/src/yeptris/jsonapi/jsonc_compat.c +687 -0
- data/vendor/libyeptris/src/yeptris/jsonapi/yajl_compat.c +728 -0
- data/vendor/libyeptris/src/yeptris/marshal.c +782 -0
- data/vendor/libyeptris/src/yeptris/memory/allocator.c +20 -0
- data/vendor/libyeptris/src/yeptris/memory/allocator.h +43 -0
- data/vendor/libyeptris/src/yeptris/memory/arena.c +134 -0
- data/vendor/libyeptris/src/yeptris/memory/arena.h +52 -0
- data/vendor/libyeptris/src/yeptris/memory/pool.c +122 -0
- data/vendor/libyeptris/src/yeptris/memory/pool.h +36 -0
- data/vendor/libyeptris/src/yeptris/parse/engine.c +3698 -0
- data/vendor/libyeptris/src/yeptris/parse/engine.h +65 -0
- data/vendor/libyeptris/src/yeptris/parse/events.h +124 -0
- data/vendor/libyeptris/src/yeptris/parse/numbers.c +349 -0
- data/vendor/libyeptris/src/yeptris/parse/numbers.h +33 -0
- data/vendor/libyeptris/src/yeptris/parse/scalars.c +416 -0
- data/vendor/libyeptris/src/yeptris/parse/scalars.h +75 -0
- data/vendor/libyeptris/src/yeptris/parse.c +737 -0
- data/vendor/libyeptris/src/yeptris/plan.c +824 -0
- data/vendor/libyeptris/src/yeptris/resolve/compat11.c +334 -0
- data/vendor/libyeptris/src/yeptris/resolve/core12.c +143 -0
- data/vendor/libyeptris/src/yeptris/resolve/resolver.h +56 -0
- data/vendor/libyeptris/src/yeptris/resolve/tags.c +58 -0
- data/vendor/libyeptris/src/yeptris/scan/json.c +792 -0
- data/vendor/libyeptris/src/yeptris/scan/json.h +109 -0
- data/vendor/libyeptris/src/yeptris/scan/scan.c +463 -0
- data/vendor/libyeptris/src/yeptris/scan/scan.h +150 -0
- data/vendor/libyeptris/src/yeptris/schema.c +308 -0
- data/vendor/libyeptris/src/yeptris/tape.c +1308 -0
- data/vendor/libyeptris/src/yeptris/tape_in.h +19 -0
- data/vendor/libyeptris/src/yeptris/version.c +7 -0
- data/vendor/libyeptris/src/yeptris/visit/dom_visit.c +115 -0
- data/vendor/libyeptris/src/yeptris/visit/json_visit.c +293 -0
- data/vendor/libyeptris/src/yeptris/visit/yaml_visit.c +127 -0
- metadata +199 -0
|
@@ -0,0 +1,534 @@
|
|
|
1
|
+
/* simd_text_avx2.c — AVX2 kernels (TODO.impl/04).
|
|
2
|
+
*
|
|
3
|
+
* Compiled with -mavx2 -mpopcnt on x86 (src/CMakeLists.txt). Chunked
|
|
4
|
+
* 32-byte processing with scalar tails: reads never pass len. The
|
|
5
|
+
* differential suite proves equivalence with the scalar reference.
|
|
6
|
+
*
|
|
7
|
+
* Deferred (recorded in the item ledger): SIMD stopset_find returned
|
|
8
|
+
* with TODO.restructure/68 — the nibble-class kernel above (the
|
|
9
|
+
* campaign profiles made it the hottest kernel in the block paths).
|
|
10
|
+
* Still scalar: the runtime-bitmap path never vectorized well; a
|
|
11
|
+
* consumer that needs it can adopt the yep_stopset form.
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
#include "port.h" /* defines YEP_ARCH_* — must precede the guard below */
|
|
15
|
+
|
|
16
|
+
#if defined(YEP_ARCH_X86)
|
|
17
|
+
|
|
18
|
+
#include <immintrin.h>
|
|
19
|
+
#include <stdint.h>
|
|
20
|
+
#include <string.h>
|
|
21
|
+
|
|
22
|
+
#include "simd_text.h"
|
|
23
|
+
|
|
24
|
+
#define YEP_AVX2_CHUNK 32
|
|
25
|
+
|
|
26
|
+
static inline uint32_t yep_avx2_eq_mask(const char* p, char c) {
|
|
27
|
+
__m256i v = _mm256_loadu_si256((const __m256i*)(const void*)p);
|
|
28
|
+
__m256i eq = _mm256_cmpeq_epi8(v, _mm256_set1_epi8(c));
|
|
29
|
+
return (uint32_t)_mm256_movemask_epi8(eq);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
static int yep_avx2_contains(const char* s, size_t len, char c) {
|
|
33
|
+
size_t i = 0;
|
|
34
|
+
for (; i + YEP_AVX2_CHUNK <= len; i += YEP_AVX2_CHUNK) {
|
|
35
|
+
if (yep_avx2_eq_mask(s + i, c)) {
|
|
36
|
+
return 1;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
return yep_text_contains_scalar(s + i, len - i, c);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
static ptrdiff_t yep_avx2_find(const char* s, size_t len, char c) {
|
|
43
|
+
size_t i = 0;
|
|
44
|
+
for (; i + YEP_AVX2_CHUNK <= len; i += YEP_AVX2_CHUNK) {
|
|
45
|
+
uint32_t m = yep_avx2_eq_mask(s + i, c);
|
|
46
|
+
if (m) {
|
|
47
|
+
return (ptrdiff_t)(i + (size_t)yep_ctz32(m));
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
ptrdiff_t tail = yep_text_find_scalar(s + i, len - i, c);
|
|
51
|
+
return tail < 0 ? -1 : (ptrdiff_t)i + tail;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
static size_t yep_avx2_count(const char* s, size_t len, char c) {
|
|
55
|
+
size_t n = 0, i = 0;
|
|
56
|
+
for (; i + YEP_AVX2_CHUNK <= len; i += YEP_AVX2_CHUNK) {
|
|
57
|
+
n += (size_t)yep_popcount32(yep_avx2_eq_mask(s + i, c));
|
|
58
|
+
}
|
|
59
|
+
return n + yep_text_count_char_scalar(s + i, len - i, c);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
static void yep_avx2_count3(const char* s, size_t len, char c0, char c1, char c2, size_t* n0,
|
|
63
|
+
size_t* n1, size_t* n2) {
|
|
64
|
+
size_t a = 0, b = 0, d = 0, i = 0;
|
|
65
|
+
for (; i + YEP_AVX2_CHUNK <= len; i += YEP_AVX2_CHUNK) {
|
|
66
|
+
uint32_t m0 = yep_avx2_eq_mask(s + i, c0);
|
|
67
|
+
uint32_t m1 = yep_avx2_eq_mask(s + i, c1);
|
|
68
|
+
uint32_t m2 = yep_avx2_eq_mask(s + i, c2);
|
|
69
|
+
a += (size_t)yep_popcount32(m0);
|
|
70
|
+
b += (size_t)yep_popcount32(m1);
|
|
71
|
+
d += (size_t)yep_popcount32(m2);
|
|
72
|
+
}
|
|
73
|
+
size_t ta = 0, tb = 0, td = 0;
|
|
74
|
+
yep_text_count3_scalar(s + i, len - i, c0, c1, c2, &ta, &tb, &td);
|
|
75
|
+
*n0 = a + ta;
|
|
76
|
+
*n1 = b + tb;
|
|
77
|
+
*n2 = d + td;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
static void yep_avx2_copy_count3(char* dst, const char* src, size_t len, char c0, char c1, char c2,
|
|
81
|
+
size_t* n0, size_t* n1, size_t* n2) {
|
|
82
|
+
size_t a = 0, b = 0, d = 0, i = 0;
|
|
83
|
+
for (; i + YEP_AVX2_CHUNK <= len; i += YEP_AVX2_CHUNK) {
|
|
84
|
+
__m256i v = _mm256_loadu_si256((const __m256i*)(const void*)(src + i));
|
|
85
|
+
_mm256_storeu_si256((__m256i*)(void*)(dst + i), v);
|
|
86
|
+
__m256i s0 = _mm256_set1_epi8(c0), s1 = _mm256_set1_epi8(c1), s2 = _mm256_set1_epi8(c2);
|
|
87
|
+
a += (size_t)yep_popcount32((uint32_t)_mm256_movemask_epi8(_mm256_cmpeq_epi8(v, s0)));
|
|
88
|
+
b += (size_t)yep_popcount32((uint32_t)_mm256_movemask_epi8(_mm256_cmpeq_epi8(v, s1)));
|
|
89
|
+
d += (size_t)yep_popcount32((uint32_t)_mm256_movemask_epi8(_mm256_cmpeq_epi8(v, s2)));
|
|
90
|
+
}
|
|
91
|
+
if (i < len) {
|
|
92
|
+
memcpy(dst + i, src + i, len - i);
|
|
93
|
+
}
|
|
94
|
+
size_t ta = 0, tb = 0, td = 0;
|
|
95
|
+
yep_text_count3_scalar(dst + i, len - i, c0, c1, c2, &ta, &tb, &td);
|
|
96
|
+
*n0 = a + ta;
|
|
97
|
+
*n1 = b + tb;
|
|
98
|
+
*n2 = d + td;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
static ptrdiff_t yep_avx2_find_not(const char* s, size_t len, char c) {
|
|
102
|
+
size_t i = 0;
|
|
103
|
+
for (; i + YEP_AVX2_CHUNK <= len; i += YEP_AVX2_CHUNK) {
|
|
104
|
+
uint32_t m = yep_avx2_eq_mask(s + i, c) ^ 0xFFFFFFFFu;
|
|
105
|
+
if (m) {
|
|
106
|
+
return (ptrdiff_t)(i + (size_t)yep_ctz32(m));
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
ptrdiff_t tail = yep_text_find_not_scalar(s + i, len - i, c);
|
|
110
|
+
return tail < 0 ? -1 : (ptrdiff_t)i + tail;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
static ptrdiff_t yep_avx2_find3(const char* s, size_t len, char c0, char c1, char c2) {
|
|
114
|
+
if (len < 3) {
|
|
115
|
+
return -1;
|
|
116
|
+
}
|
|
117
|
+
size_t i = 0;
|
|
118
|
+
for (; i + YEP_AVX2_CHUNK <= len; i += YEP_AVX2_CHUNK) {
|
|
119
|
+
uint32_t m = yep_avx2_eq_mask(s + i, c0);
|
|
120
|
+
while (m) {
|
|
121
|
+
size_t k = (size_t)yep_ctz32(m);
|
|
122
|
+
size_t at = i + k;
|
|
123
|
+
if (at + 2 < len && s[at + 1] == c1 && s[at + 2] == c2) {
|
|
124
|
+
return (ptrdiff_t)at;
|
|
125
|
+
}
|
|
126
|
+
m &= m - 1;
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
ptrdiff_t tail = yep_text_find3_scalar(s + i, len - i, c0, c1, c2);
|
|
130
|
+
return tail < 0 ? -1 : (ptrdiff_t)i + tail;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
static ptrdiff_t yep_avx2_qbc_find(const char* s, size_t len) {
|
|
134
|
+
size_t i = 0;
|
|
135
|
+
const __m256i dq = _mm256_set1_epi8('"');
|
|
136
|
+
const __m256i bs = _mm256_set1_epi8('\\');
|
|
137
|
+
const __m256i c1f = _mm256_set1_epi8(0x1F);
|
|
138
|
+
for (; i + YEP_AVX2_CHUNK <= len; i += YEP_AVX2_CHUNK) {
|
|
139
|
+
__m256i v = _mm256_loadu_si256((const __m256i*)(const void*)(s + i));
|
|
140
|
+
/* unsigned v < 0x20 <=> min_epu8(v, 0x1F) == v */
|
|
141
|
+
__m256i m =
|
|
142
|
+
_mm256_or_si256(_mm256_or_si256(_mm256_cmpeq_epi8(v, dq), _mm256_cmpeq_epi8(v, bs)),
|
|
143
|
+
_mm256_cmpeq_epi8(_mm256_min_epu8(v, c1f), v));
|
|
144
|
+
uint32_t bits = (uint32_t)_mm256_movemask_epi8(m);
|
|
145
|
+
if (bits != 0) {
|
|
146
|
+
return (ptrdiff_t)(i + (size_t)yep_ctz32(bits));
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
ptrdiff_t r = yep_text_qbc_find_scalar(s + i, len - i);
|
|
150
|
+
return r < 0 ? r : (ptrdiff_t)i + r;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
static ptrdiff_t yep_avx2_quote_scan(const char* s, size_t len, char q, int* has_escape) {
|
|
154
|
+
int esc = 0;
|
|
155
|
+
size_t i = 0;
|
|
156
|
+
while (i < len) {
|
|
157
|
+
for (; i + YEP_AVX2_CHUNK <= len;) {
|
|
158
|
+
uint32_t m = yep_avx2_eq_mask(s + i, q);
|
|
159
|
+
if (q == '"') {
|
|
160
|
+
m |= yep_avx2_eq_mask(s + i, '\\');
|
|
161
|
+
}
|
|
162
|
+
if (!m) {
|
|
163
|
+
i += YEP_AVX2_CHUNK;
|
|
164
|
+
continue;
|
|
165
|
+
}
|
|
166
|
+
size_t k = (size_t)yep_ctz32(m);
|
|
167
|
+
if (q == '"' && s[i + k] == '\\') {
|
|
168
|
+
esc = 1;
|
|
169
|
+
i += k + 2; /* skip the escaped byte */
|
|
170
|
+
break;
|
|
171
|
+
}
|
|
172
|
+
if (q == '\'' && i + k + 1 < len && s[i + k + 1] == '\'') {
|
|
173
|
+
esc = 1;
|
|
174
|
+
i += k + 2; /* doubled quote inside a single-quoted scalar */
|
|
175
|
+
break;
|
|
176
|
+
}
|
|
177
|
+
if (has_escape != NULL) {
|
|
178
|
+
*has_escape = esc;
|
|
179
|
+
}
|
|
180
|
+
return (ptrdiff_t)(i + k);
|
|
181
|
+
}
|
|
182
|
+
if (i + YEP_AVX2_CHUNK > len) {
|
|
183
|
+
int tail_esc = 0;
|
|
184
|
+
ptrdiff_t r = yep_text_quote_scan_scalar(s + i, len - i, q, &tail_esc);
|
|
185
|
+
esc |= tail_esc;
|
|
186
|
+
if (r >= 0) {
|
|
187
|
+
if (has_escape != NULL) {
|
|
188
|
+
*has_escape = esc;
|
|
189
|
+
}
|
|
190
|
+
return (ptrdiff_t)i + r;
|
|
191
|
+
}
|
|
192
|
+
break;
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
if (has_escape != NULL) {
|
|
196
|
+
*has_escape = esc;
|
|
197
|
+
}
|
|
198
|
+
return -1;
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
static void yep_avx2_scan_stats(const char* s, size_t len, yep_text_stats* out) {
|
|
202
|
+
if (s == NULL || len == 0) {
|
|
203
|
+
memset(out, 0, sizeof(*out));
|
|
204
|
+
return;
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
const __m256i ktab = _mm256_set1_epi8('\n'), kcomma = _mm256_set1_epi8(','),
|
|
208
|
+
kdash = _mm256_set1_epi8('-'), kcolon = _mm256_set1_epi8(':'),
|
|
209
|
+
kbrk = _mm256_set1_epi8('['), kbrce = _mm256_set1_epi8('{'),
|
|
210
|
+
kdq = _mm256_set1_epi8('"'), ksq = _mm256_set1_epi8('\''),
|
|
211
|
+
kpipe = _mm256_set1_epi8('|'), kamp = _mm256_set1_epi8('&');
|
|
212
|
+
const __m256i kflip = _mm256_set1_epi8((char)(unsigned char)0x80),
|
|
213
|
+
klow = _mm256_set1_epi8((char)(unsigned char)0xA0),
|
|
214
|
+
ktab9 = _mm256_set1_epi8('\t'), klf = _mm256_set1_epi8('\n'),
|
|
215
|
+
kcr = _mm256_set1_epi8('\r'), kdel = _mm256_set1_epi8((char)(unsigned char)0x7F);
|
|
216
|
+
size_t c_nl = 0, c_co = 0, c_da = 0, c_cl = 0, c_br = 0, c_bc = 0, c_dq = 0, c_sq = 0, c_pi = 0,
|
|
217
|
+
c_am = 0;
|
|
218
|
+
uint32_t bad = 0, hi = 0;
|
|
219
|
+
size_t i = 0;
|
|
220
|
+
for (; i + YEP_AVX2_CHUNK <= len; i += YEP_AVX2_CHUNK) {
|
|
221
|
+
const __m256i* pp = (const __m256i*)(const void*)(s + i);
|
|
222
|
+
__m256i v = _mm256_loadu_si256(pp);
|
|
223
|
+
hi |= (uint32_t)_mm256_movemask_epi8(v); /* sign bit = bit7 = non-ASCII */
|
|
224
|
+
c_nl += (size_t)yep_popcount32((uint32_t)_mm256_movemask_epi8(_mm256_cmpeq_epi8(v, ktab)));
|
|
225
|
+
c_co +=
|
|
226
|
+
(size_t)yep_popcount32((uint32_t)_mm256_movemask_epi8(_mm256_cmpeq_epi8(v, kcomma)));
|
|
227
|
+
c_da += (size_t)yep_popcount32((uint32_t)_mm256_movemask_epi8(_mm256_cmpeq_epi8(v, kdash)));
|
|
228
|
+
c_cl +=
|
|
229
|
+
(size_t)yep_popcount32((uint32_t)_mm256_movemask_epi8(_mm256_cmpeq_epi8(v, kcolon)));
|
|
230
|
+
c_br += (size_t)yep_popcount32((uint32_t)_mm256_movemask_epi8(_mm256_cmpeq_epi8(v, kbrk)));
|
|
231
|
+
c_bc += (size_t)yep_popcount32((uint32_t)_mm256_movemask_epi8(_mm256_cmpeq_epi8(v, kbrce)));
|
|
232
|
+
c_dq += (size_t)yep_popcount32((uint32_t)_mm256_movemask_epi8(_mm256_cmpeq_epi8(v, kdq)));
|
|
233
|
+
c_sq += (size_t)yep_popcount32((uint32_t)_mm256_movemask_epi8(_mm256_cmpeq_epi8(v, ksq)));
|
|
234
|
+
c_pi += (size_t)yep_popcount32((uint32_t)_mm256_movemask_epi8(_mm256_cmpeq_epi8(v, kpipe)));
|
|
235
|
+
c_am += (size_t)yep_popcount32((uint32_t)_mm256_movemask_epi8(_mm256_cmpeq_epi8(v, kamp)));
|
|
236
|
+
/* c-printable ASCII violations: b < 0x20 (signed trick: flip
|
|
237
|
+
* the sign bit, then b < 0x20 <=> w < 0xA0), except TAB/LF/CR;
|
|
238
|
+
* plus DEL. Non-ASCII is tracked separately in `hi`. */
|
|
239
|
+
__m256i flipped = _mm256_xor_si256(v, kflip);
|
|
240
|
+
__m256i lo = _mm256_cmpgt_epi8(klow, flipped); /* w < 0xA0 signed */
|
|
241
|
+
__m256i allowed =
|
|
242
|
+
_mm256_or_si256(_mm256_cmpeq_epi8(v, ktab9),
|
|
243
|
+
_mm256_or_si256(_mm256_cmpeq_epi8(v, klf), _mm256_cmpeq_epi8(v, kcr)));
|
|
244
|
+
/* non-ASCII bytes are the validator's business, not the
|
|
245
|
+
* c-printable-ASCII rule — mask them out (flipped < 0 <=> b < 0x80) */
|
|
246
|
+
__m256i is_ascii = _mm256_cmpgt_epi8(_mm256_setzero_si256(), flipped);
|
|
247
|
+
__m256i badv = _mm256_and_si256(is_ascii, _mm256_or_si256(_mm256_andnot_si256(allowed, lo),
|
|
248
|
+
_mm256_cmpeq_epi8(v, kdel)));
|
|
249
|
+
bad |= (uint32_t)_mm256_movemask_epi8(badv);
|
|
250
|
+
}
|
|
251
|
+
yep_text_stats tail = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
|
|
252
|
+
yep_text_scan_stats_scalar(s + i, len - i, &tail);
|
|
253
|
+
out->nl = c_nl + tail.nl;
|
|
254
|
+
out->comma = c_co + tail.comma;
|
|
255
|
+
out->dash = c_da + tail.dash;
|
|
256
|
+
out->colon = c_cl + tail.colon;
|
|
257
|
+
out->bracket = c_br + tail.bracket;
|
|
258
|
+
out->brace = c_bc + tail.brace;
|
|
259
|
+
out->dq = c_dq + tail.dq;
|
|
260
|
+
out->sq = c_sq + tail.sq;
|
|
261
|
+
out->pipe = c_pi + tail.pipe;
|
|
262
|
+
out->amp = c_am + tail.amp;
|
|
263
|
+
out->nonascii = (hi != 0) || tail.nonascii;
|
|
264
|
+
out->bad_printable = (bad != 0) || tail.bad_printable;
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
static int yep_avx2_gate_scan(const char* s, size_t len) {
|
|
268
|
+
const __m256i sp = _mm256_set1_epi8(0x20), del = _mm256_set1_epi8(0x7F);
|
|
269
|
+
const __m256i tab = _mm256_set1_epi8(0x09), lf = _mm256_set1_epi8(0x0A),
|
|
270
|
+
cr = _mm256_set1_epi8(0x0D), ones = _mm256_set1_epi8(-1);
|
|
271
|
+
size_t i = 0;
|
|
272
|
+
for (; i + 32 <= len; i += 32) {
|
|
273
|
+
__m256i x = _mm256_loadu_si256((const __m256i*)(s + i));
|
|
274
|
+
/* ctrl is SIGNED 0x20 > x: catches C0 (0x00-0x1F, the full
|
|
275
|
+
* range — 0x1F included) AND every byte >= 0x80 (they read
|
|
276
|
+
* negative); allow clears TAB/LF/CR only; DEL is separate */
|
|
277
|
+
__m256i ctrl = _mm256_cmpgt_epi8(sp, x);
|
|
278
|
+
__m256i allow =
|
|
279
|
+
_mm256_or_si256(_mm256_cmpeq_epi8(x, tab),
|
|
280
|
+
_mm256_or_si256(_mm256_cmpeq_epi8(x, lf), _mm256_cmpeq_epi8(x, cr)));
|
|
281
|
+
__m256i bad = _mm256_or_si256(_mm256_and_si256(ctrl, _mm256_andnot_si256(allow, ones)),
|
|
282
|
+
_mm256_cmpeq_epi8(x, del));
|
|
283
|
+
if (_mm256_movemask_epi8(_mm256_cmpeq_epi8(bad, _mm256_set1_epi8(0))) != -1) {
|
|
284
|
+
return 1;
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
return yep_text_gate_scan_scalar(s + i, len - i);
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
/* First member byte via two pshufb lookups per nibble-class group
|
|
291
|
+
* (TODO.restructure/68): lane matches iff lo[b&15] & hi[b>>4] != 0 —
|
|
292
|
+
* exact for the whole class, so the first nonzero lane IS the answer.
|
|
293
|
+
* Tables broadcast to both 128-bit halves (pshufb is per-lane);
|
|
294
|
+
* indices are 0-15 by construction, so no zeroing surprises. */
|
|
295
|
+
static ptrdiff_t yep_avx2_stopset_find(const yep_stopset* ss, const char* s, size_t len) {
|
|
296
|
+
/* two loaded groups is the sweet spot (every YAML stop class is
|
|
297
|
+
* 1-2); wider classes take the scalar bitmap walk */
|
|
298
|
+
if (ss->groups == 0 || ss->groups > 2) {
|
|
299
|
+
return yep_text_stopset_find_scalar(ss, s, len);
|
|
300
|
+
}
|
|
301
|
+
const __m256i tlo0 =
|
|
302
|
+
_mm256_broadcastsi128_si256(_mm_loadu_si128((const __m128i*)(const void*)ss->lo[0]));
|
|
303
|
+
const __m256i thi0 =
|
|
304
|
+
_mm256_broadcastsi128_si256(_mm_loadu_si128((const __m128i*)(const void*)ss->hi[0]));
|
|
305
|
+
const __m256i tlo1 =
|
|
306
|
+
_mm256_broadcastsi128_si256(_mm_loadu_si128((const __m128i*)(const void*)ss->lo[1]));
|
|
307
|
+
const __m256i thi1 =
|
|
308
|
+
_mm256_broadcastsi128_si256(_mm_loadu_si128((const __m128i*)(const void*)ss->hi[1]));
|
|
309
|
+
const __m256i f = _mm256_set1_epi8(15);
|
|
310
|
+
const int two = ss->groups > 1;
|
|
311
|
+
size_t i = 0;
|
|
312
|
+
for (; i + YEP_AVX2_CHUNK <= len; i += YEP_AVX2_CHUNK) {
|
|
313
|
+
__m256i v = _mm256_loadu_si256((const __m256i*)(const void*)(s + i));
|
|
314
|
+
__m256i lo = _mm256_and_si256(v, f);
|
|
315
|
+
__m256i hi = _mm256_and_si256(_mm256_srli_epi16(v, 4), f);
|
|
316
|
+
__m256i m = _mm256_and_si256(_mm256_shuffle_epi8(tlo0, lo), _mm256_shuffle_epi8(thi0, hi));
|
|
317
|
+
if (two) {
|
|
318
|
+
m = _mm256_or_si256(
|
|
319
|
+
m, _mm256_and_si256(_mm256_shuffle_epi8(tlo1, lo), _mm256_shuffle_epi8(thi1, hi)));
|
|
320
|
+
}
|
|
321
|
+
/* nonzero test via the eq-zero complement: a lane's bitmask
|
|
322
|
+
* can be 0x80 (a group's 8th member) — cmpgt_epi8 is SIGNED
|
|
323
|
+
* and read that as negative, missing the hit (the CI AVX2
|
|
324
|
+
* run's first catch; NEON's unsigned vmaxv never had it) */
|
|
325
|
+
uint32_t z = (uint32_t)_mm256_movemask_epi8(_mm256_cmpeq_epi8(m, _mm256_setzero_si256()));
|
|
326
|
+
uint32_t nz = ~z;
|
|
327
|
+
if (nz != 0) {
|
|
328
|
+
return (ptrdiff_t)(i + (size_t)yep_ctz32(nz));
|
|
329
|
+
}
|
|
330
|
+
}
|
|
331
|
+
ptrdiff_t tail = yep_text_stopset_find_scalar(ss, s + i, len - i);
|
|
332
|
+
return tail < 0 ? -1 : (ptrdiff_t)i + tail;
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
/* The fused line-facts sweep (TODO.restructure/76), AVX2 flavor:
|
|
336
|
+
* movemask + ctz extract the hit lanes with no spill. Gated to >=64B
|
|
337
|
+
* remaining spans like NEON (short lines keep the scalar walk). */
|
|
338
|
+
static void yep_avx2_line_facts(const char* s, size_t len, size_t pos, yep_line_facts* out) {
|
|
339
|
+
/* the capped SWAR walk settles short lines in one pass — it is
|
|
340
|
+
* BOTH the test and the answer (TODO 84's probe-then-rescan paid
|
|
341
|
+
* the line content twice) */
|
|
342
|
+
if (yep_text_line_facts_capped(s, len, pos, 128, out)) {
|
|
343
|
+
return;
|
|
344
|
+
}
|
|
345
|
+
const __m256i knl = _mm256_set1_epi8('\n'), kcr = _mm256_set1_epi8('\r'),
|
|
346
|
+
ksp = _mm256_set1_epi8(' '), kco = _mm256_set1_epi8(':'),
|
|
347
|
+
khash = _mm256_set1_epi8('#');
|
|
348
|
+
size_t i = pos;
|
|
349
|
+
int have_end = 0, have_indent = 0, have_stop = 0;
|
|
350
|
+
uint32_t end = 0, indent = 0, stop = 0;
|
|
351
|
+
for (; i + 32 <= len; i += 32) {
|
|
352
|
+
if (have_end) {
|
|
353
|
+
break; /* indent <= end, stop < end: settled or absent */
|
|
354
|
+
}
|
|
355
|
+
__m256i v = _mm256_loadu_si256((const __m256i*)(const void*)(s + i));
|
|
356
|
+
uint32_t br = (uint32_t)_mm256_movemask_epi8(
|
|
357
|
+
_mm256_or_si256(_mm256_cmpeq_epi8(v, knl), _mm256_cmpeq_epi8(v, kcr)));
|
|
358
|
+
if (!have_indent) {
|
|
359
|
+
uint32_t nsp = (uint32_t)_mm256_movemask_epi8(
|
|
360
|
+
_mm256_xor_si256(_mm256_cmpeq_epi8(v, ksp), _mm256_set1_epi8(-1)));
|
|
361
|
+
if (nsp) {
|
|
362
|
+
indent = (uint32_t)(i + (size_t)yep_ctz32(nsp));
|
|
363
|
+
have_indent = 1;
|
|
364
|
+
}
|
|
365
|
+
}
|
|
366
|
+
if (br) {
|
|
367
|
+
end = (uint32_t)(i + (size_t)yep_ctz32(br));
|
|
368
|
+
have_end = 1;
|
|
369
|
+
}
|
|
370
|
+
if (!have_stop && have_indent) {
|
|
371
|
+
uint32_t st = br;
|
|
372
|
+
st |= (uint32_t)_mm256_movemask_epi8(_mm256_cmpeq_epi8(v, kco));
|
|
373
|
+
st |= (uint32_t)_mm256_movemask_epi8(_mm256_cmpeq_epi8(v, khash));
|
|
374
|
+
if (st) {
|
|
375
|
+
/* bytes left of the indent are spaces — no set lane can
|
|
376
|
+
* sit before `from`; a set lane at/after end means every
|
|
377
|
+
* later one is too: one ctz answers exactly */
|
|
378
|
+
uint32_t from = (uint32_t)(indent > i ? indent - i : 0);
|
|
379
|
+
uint32_t at = (uint32_t)yep_ctz32(st);
|
|
380
|
+
if (at >= from && (!have_end || (uint32_t)(i + at) < end)) {
|
|
381
|
+
stop = (uint32_t)(i + at);
|
|
382
|
+
have_stop = 1;
|
|
383
|
+
}
|
|
384
|
+
}
|
|
385
|
+
}
|
|
386
|
+
}
|
|
387
|
+
uint32_t stop_set = 0;
|
|
388
|
+
if (!have_end || !have_indent || !have_stop) {
|
|
389
|
+
yep_line_facts t;
|
|
390
|
+
yep_text_line_facts_scalar(s, len, i, &t);
|
|
391
|
+
if (!have_end) {
|
|
392
|
+
end = t.end;
|
|
393
|
+
}
|
|
394
|
+
if (!have_indent) {
|
|
395
|
+
indent = t.indent;
|
|
396
|
+
}
|
|
397
|
+
if (!have_stop) {
|
|
398
|
+
if (have_end) {
|
|
399
|
+
stop = end;
|
|
400
|
+
stop_set = 0;
|
|
401
|
+
} else {
|
|
402
|
+
stop = t.stop;
|
|
403
|
+
stop_set = t.stop_set;
|
|
404
|
+
}
|
|
405
|
+
}
|
|
406
|
+
}
|
|
407
|
+
out->end = end;
|
|
408
|
+
out->indent = indent;
|
|
409
|
+
out->stop = stop;
|
|
410
|
+
out->stop_set = have_stop ? 1u : stop_set;
|
|
411
|
+
}
|
|
412
|
+
|
|
413
|
+
/* The flow-kernel chunk classifier: one 256-bit lane pass -> four
|
|
414
|
+
* byte-class masks (movemask-native). Chunks are exactly 32 bytes
|
|
415
|
+
* except the final partial one, which the scalar reference settles
|
|
416
|
+
* (reads exactly n bytes). The c0 class is an UNSIGNED < 0x20 —
|
|
417
|
+
* cmplt_epi8 is signed and would flag every >= 0x80 byte — so the
|
|
418
|
+
* class is min_epu8(v, 0x1F) == v (the same identity qbc_find uses). */
|
|
419
|
+
yep_chunk_masks yep_text_json_chunk_avx2(const char* p, size_t n) {
|
|
420
|
+
if (n < 32) {
|
|
421
|
+
return yep_text_json_chunk_scalar(p, n);
|
|
422
|
+
}
|
|
423
|
+
yep_chunk_masks m;
|
|
424
|
+
const __m256i v = _mm256_loadu_si256((const __m256i*)(const void*)p);
|
|
425
|
+
const __m256i c0t = _mm256_set1_epi8(0x1F);
|
|
426
|
+
m.quote = (uint32_t)_mm256_movemask_epi8(_mm256_cmpeq_epi8(v, _mm256_set1_epi8('"')));
|
|
427
|
+
m.bs = (uint32_t)_mm256_movemask_epi8(_mm256_cmpeq_epi8(v, _mm256_set1_epi8('\\')));
|
|
428
|
+
__m256i s = _mm256_or_si256(
|
|
429
|
+
_mm256_or_si256(_mm256_cmpeq_epi8(v, _mm256_set1_epi8('{')),
|
|
430
|
+
_mm256_cmpeq_epi8(v, _mm256_set1_epi8('}'))),
|
|
431
|
+
_mm256_or_si256(_mm256_or_si256(_mm256_cmpeq_epi8(v, _mm256_set1_epi8('[')),
|
|
432
|
+
_mm256_cmpeq_epi8(v, _mm256_set1_epi8(']'))),
|
|
433
|
+
_mm256_or_si256(_mm256_cmpeq_epi8(v, _mm256_set1_epi8(',')),
|
|
434
|
+
_mm256_cmpeq_epi8(v, _mm256_set1_epi8(':')))));
|
|
435
|
+
m.structurals = (uint32_t)_mm256_movemask_epi8(s);
|
|
436
|
+
/* valstart: the unsigned digit range as the min/max identity —
|
|
437
|
+
* max(v,'0')==v gives v >= '0' (signed cmpeq_epi8 can't); the
|
|
438
|
+
* saturating form would false-flag every byte below '0' */
|
|
439
|
+
const __m256i d0 = _mm256_set1_epi8('0'), d9 = _mm256_set1_epi8('9');
|
|
440
|
+
__m256i dig = _mm256_and_si256(_mm256_cmpeq_epi8(_mm256_max_epu8(v, d0), v),
|
|
441
|
+
_mm256_cmpeq_epi8(_mm256_min_epu8(v, d9), v));
|
|
442
|
+
__m256i vs = _mm256_or_si256(
|
|
443
|
+
_mm256_or_si256(dig, _mm256_cmpeq_epi8(v, _mm256_set1_epi8('-'))),
|
|
444
|
+
_mm256_or_si256(_mm256_or_si256(_mm256_cmpeq_epi8(v, _mm256_set1_epi8('t')),
|
|
445
|
+
_mm256_cmpeq_epi8(v, _mm256_set1_epi8('f'))),
|
|
446
|
+
_mm256_cmpeq_epi8(v, _mm256_set1_epi8('n'))));
|
|
447
|
+
m.valstart = (uint32_t)_mm256_movemask_epi8(vs);
|
|
448
|
+
m.c0 = (uint32_t)_mm256_movemask_epi8(_mm256_cmpeq_epi8(_mm256_min_epu8(v, c0t), v));
|
|
449
|
+
m.valid = 0xFFFFFFFFu;
|
|
450
|
+
return m;
|
|
451
|
+
}
|
|
452
|
+
|
|
453
|
+
/* The JSON structural indexer (the token-contract front): vector
|
|
454
|
+
* classification of 64-byte blocks into QUOTE/BS/OP/WS u64 masks
|
|
455
|
+
* (two 32-byte lane passes each, movemask-native), then the shared
|
|
456
|
+
* mask resolver (simd_text.h). The final partial block builds its
|
|
457
|
+
* masks byte-wise — no loads past len. */
|
|
458
|
+
int yep_text_json_stage1_avx2(const char* p, size_t len, uint32_t* idx, size_t* nidx) {
|
|
459
|
+
size_t n = 0;
|
|
460
|
+
uint64_t prev_in_string = 0, esc_carry = 0, follows_carry = 0;
|
|
461
|
+
size_t off = 0;
|
|
462
|
+
for (; off + 64 <= len; off += 64) {
|
|
463
|
+
uint64_t q = 0, bs = 0, op = 0, ws = 0;
|
|
464
|
+
for (unsigned half = 0; half < 2; half++) {
|
|
465
|
+
const __m256i v =
|
|
466
|
+
_mm256_loadu_si256((const __m256i*)(const void*)(p + off + 32 * half));
|
|
467
|
+
uint64_t fq = (uint64_t)(uint32_t)_mm256_movemask_epi8(
|
|
468
|
+
_mm256_cmpeq_epi8(v, _mm256_set1_epi8('"')));
|
|
469
|
+
uint64_t fb = (uint64_t)(uint32_t)_mm256_movemask_epi8(
|
|
470
|
+
_mm256_cmpeq_epi8(v, _mm256_set1_epi8('\\')));
|
|
471
|
+
__m256i o = _mm256_or_si256(
|
|
472
|
+
_mm256_or_si256(_mm256_cmpeq_epi8(v, _mm256_set1_epi8('{')),
|
|
473
|
+
_mm256_cmpeq_epi8(v, _mm256_set1_epi8('}'))),
|
|
474
|
+
_mm256_or_si256(_mm256_or_si256(_mm256_cmpeq_epi8(v, _mm256_set1_epi8('[')),
|
|
475
|
+
_mm256_cmpeq_epi8(v, _mm256_set1_epi8(']'))),
|
|
476
|
+
_mm256_or_si256(_mm256_cmpeq_epi8(v, _mm256_set1_epi8(',')),
|
|
477
|
+
_mm256_cmpeq_epi8(v, _mm256_set1_epi8(':')))));
|
|
478
|
+
uint64_t fo = (uint64_t)(uint32_t)_mm256_movemask_epi8(o);
|
|
479
|
+
__m256i w =
|
|
480
|
+
_mm256_or_si256(_mm256_or_si256(_mm256_cmpeq_epi8(v, _mm256_set1_epi8(' ')),
|
|
481
|
+
_mm256_cmpeq_epi8(v, _mm256_set1_epi8('\t'))),
|
|
482
|
+
_mm256_or_si256(_mm256_cmpeq_epi8(v, _mm256_set1_epi8('\n')),
|
|
483
|
+
_mm256_cmpeq_epi8(v, _mm256_set1_epi8('\r'))));
|
|
484
|
+
uint64_t fw = (uint64_t)(uint32_t)_mm256_movemask_epi8(w);
|
|
485
|
+
q |= fq << (32 * half);
|
|
486
|
+
bs |= fb << (32 * half);
|
|
487
|
+
op |= fo << (32 * half);
|
|
488
|
+
ws |= fw << (32 * half);
|
|
489
|
+
}
|
|
490
|
+
n = yep_json_stage1_resolve(q, bs, op, ws, ~0ull, &prev_in_string, &esc_carry,
|
|
491
|
+
&follows_carry, off, idx, n);
|
|
492
|
+
}
|
|
493
|
+
if (off < len) {
|
|
494
|
+
size_t cn = len - off;
|
|
495
|
+
uint64_t q = 0, bs = 0, op = 0, ws = 0;
|
|
496
|
+
for (size_t k = 0; k < cn; k++) {
|
|
497
|
+
unsigned char c = (unsigned char)p[off + k];
|
|
498
|
+
uint64_t bit = 1ull << k;
|
|
499
|
+
if (c == '"') {
|
|
500
|
+
q |= bit;
|
|
501
|
+
} else if (c == '\\') {
|
|
502
|
+
bs |= bit;
|
|
503
|
+
} else if (c == '{' || c == '}' || c == '[' || c == ']' || c == ',' || c == ':') {
|
|
504
|
+
op |= bit;
|
|
505
|
+
} else if (c == ' ' || c == '\t' || c == '\n' || c == '\r') {
|
|
506
|
+
ws |= bit;
|
|
507
|
+
}
|
|
508
|
+
}
|
|
509
|
+
n = yep_json_stage1_resolve(q, bs, op, ws, (1ull << cn) - 1ull, &prev_in_string, &esc_carry,
|
|
510
|
+
&follows_carry, off, idx, n);
|
|
511
|
+
}
|
|
512
|
+
*nidx = n;
|
|
513
|
+
return prev_in_string ? 0 : 1;
|
|
514
|
+
}
|
|
515
|
+
|
|
516
|
+
const yep_text_kernels yep_text_kernels_avx2 = {
|
|
517
|
+
yep_avx2_contains,
|
|
518
|
+
yep_avx2_find,
|
|
519
|
+
yep_avx2_find3,
|
|
520
|
+
yep_avx2_count,
|
|
521
|
+
yep_avx2_count3,
|
|
522
|
+
yep_avx2_copy_count3,
|
|
523
|
+
yep_avx2_find_not,
|
|
524
|
+
yep_avx2_stopset_find,
|
|
525
|
+
yep_avx2_quote_scan,
|
|
526
|
+
yep_avx2_scan_stats,
|
|
527
|
+
yep_avx2_qbc_find,
|
|
528
|
+
yep_avx2_gate_scan,
|
|
529
|
+
yep_avx2_line_facts,
|
|
530
|
+
yep_text_json_chunk_avx2,
|
|
531
|
+
yep_text_json_stage1_avx2,
|
|
532
|
+
};
|
|
533
|
+
|
|
534
|
+
#endif /* YEP_ARCH_X86 */
|