yeptris 0.6.18.2-arm-linux-eabihf → 0.6.20.1-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.
Files changed (32) hide show
  1. checksums.yaml +4 -4
  2. data/ext/build_windows_native.rb +31 -12
  3. data/lib/yeptris/3.4/native.so +0 -0
  4. data/lib/yeptris/materializer.rb +12 -11
  5. data/lib/yeptris/psych/handler.rb +5 -0
  6. data/lib/yeptris/psych/parser.rb +8 -3
  7. data/lib/yeptris/psych/tree_builder.rb +119 -0
  8. data/lib/yeptris/psych.rb +4 -0
  9. data/lib/yeptris.rb +15 -11
  10. data/libyeptris.so +0 -0
  11. data/vendor/libyeptris/CMakeLists.txt +1 -1
  12. data/vendor/libyeptris/src/CMakeLists.txt +1 -0
  13. data/vendor/libyeptris/src/include/yeptris/events.h +8 -1
  14. data/vendor/libyeptris/src/yeptris/cbor/decode.c +1 -0
  15. data/vendor/libyeptris/src/yeptris/common/simd_text.h +47 -13
  16. data/vendor/libyeptris/src/yeptris/common/simd_text_avx2.c +86 -8
  17. data/vendor/libyeptris/src/yeptris/common/simd_text_neon.c +82 -8
  18. data/vendor/libyeptris/src/yeptris/common/simd_text_scalar.c +10 -6
  19. data/vendor/libyeptris/src/yeptris/doc.h +8 -4
  20. data/vendor/libyeptris/src/yeptris/dom/ytape.c +640 -0
  21. data/vendor/libyeptris/src/yeptris/dom/ytape.h +77 -0
  22. data/vendor/libyeptris/src/yeptris/emit/writer.c +7 -2
  23. data/vendor/libyeptris/src/yeptris/events/capture.c +5 -1
  24. data/vendor/libyeptris/src/yeptris/parse/engine.c +150 -3
  25. data/vendor/libyeptris/src/yeptris/parse/events.h +6 -0
  26. data/vendor/libyeptris/src/yeptris/parse.c +144 -42
  27. data/vendor/libyeptris/src/yeptris/scan/json.c +43 -5
  28. data/vendor/libyeptris/src/yeptris/scan/json.h +9 -2
  29. data/vendor/libyeptris/src/yeptris/tape.c +539 -163
  30. data/vendor/libyeptris/src/yeptris/tape_in.h +12 -0
  31. metadata +5 -2
  32. data/lib/yeptris/native-3.4.so +0 -0
@@ -588,9 +588,10 @@ yep_chunk_masks yep_text_json_chunk_neon(const char* p, size_t n) {
588
588
  * (four 16-byte halves each), then the shared mask resolver (the
589
589
  * simdjson identity set, simd_text.h). The final partial block
590
590
  * builds its masks byte-wise — no loads past len. */
591
- int yep_text_json_stage1_neon(const char* p, size_t len, uint32_t* idx, size_t* nidx) {
591
+ int yep_text_json_stage1_neon(const char* p, size_t len, uint32_t* idx, size_t* nidx,
592
+ unsigned* flags) {
592
593
  size_t n = 0;
593
- uint64_t prev_in_string = 0, esc_carry = 0, follows_carry = 0;
594
+ uint64_t prev_in_string = 0, esc_carry = 0;
594
595
  size_t off = 0;
595
596
  const uint8x16_t dq = vdupq_n_u8('"'), dbs = vdupq_n_u8('\\');
596
597
  const uint8x16_t d1 = vdupq_n_u8('{'), d2 = vdupq_n_u8('}');
@@ -598,8 +599,9 @@ int yep_text_json_stage1_neon(const char* p, size_t len, uint32_t* idx, size_t*
598
599
  const uint8x16_t d5 = vdupq_n_u8(','), d6 = vdupq_n_u8(':');
599
600
  const uint8x16_t wsp = vdupq_n_u8(' '), wtab = vdupq_n_u8('\t');
600
601
  const uint8x16_t wnl = vdupq_n_u8('\n'), wcr = vdupq_n_u8('\r');
602
+ const uint8x16_t c0t = vdupq_n_u8(0x20);
601
603
  for (; off + 64 <= len; off += 64) {
602
- uint64_t q = 0, bs = 0, op = 0, ws = 0;
604
+ uint64_t q = 0, bs = 0, op = 0, ws = 0, c0 = 0;
603
605
  for (unsigned half = 0; half < 4; half++) {
604
606
  uint8x16_t v = vld1q_u8((const uint8_t*)(const void*)(p + off + 16 * half));
605
607
  uint64_t fq = yep_neon_bits(vceqq_u8(v, dq));
@@ -610,17 +612,19 @@ int yep_text_json_stage1_neon(const char* p, size_t len, uint32_t* idx, size_t*
610
612
  vorrq_u8(vceqq_u8(v, d5), vceqq_u8(v, d6))));
611
613
  uint64_t fw = yep_neon_bits(vorrq_u8(vorrq_u8(vceqq_u8(v, wsp), vceqq_u8(v, wtab)),
612
614
  vorrq_u8(vceqq_u8(v, wnl), vceqq_u8(v, wcr))));
615
+ uint64_t fc = yep_neon_bits(vcltq_u8(v, c0t));
613
616
  q |= fq << (16 * half);
614
617
  bs |= fb << (16 * half);
615
618
  op |= fo << (16 * half);
616
619
  ws |= fw << (16 * half);
620
+ c0 |= fc << (16 * half);
617
621
  }
618
- n = yep_json_stage1_resolve(q, bs, op, ws, ~0ull, &prev_in_string, &esc_carry,
619
- &follows_carry, off, idx, n);
622
+ n = yep_json_stage1_resolve(q, bs, op, ws, c0, ~0ull, &prev_in_string, &esc_carry, off, idx,
623
+ n, flags);
620
624
  }
621
625
  if (off < len) { /* the tail: byte-wise masks, no loads past len */
622
626
  size_t cn = len - off;
623
- uint64_t q = 0, bs = 0, op = 0, ws = 0;
627
+ uint64_t q = 0, bs = 0, op = 0, ws = 0, c0 = 0;
624
628
  for (size_t k = 0; k < cn; k++) {
625
629
  unsigned char c = (unsigned char)p[off + k];
626
630
  uint64_t bit = 1ull << k;
@@ -633,14 +637,83 @@ int yep_text_json_stage1_neon(const char* p, size_t len, uint32_t* idx, size_t*
633
637
  } else if (c == ' ' || c == '\t' || c == '\n' || c == '\r') {
634
638
  ws |= bit;
635
639
  }
640
+ if (c < 0x20) {
641
+ c0 |= bit;
642
+ }
636
643
  }
637
- n = yep_json_stage1_resolve(q, bs, op, ws, (1ull << cn) - 1ull, &prev_in_string, &esc_carry,
638
- &follows_carry, off, idx, n);
644
+ n = yep_json_stage1_resolve(q, bs, op, ws, c0, (1ull << cn) - 1ull, &prev_in_string,
645
+ &esc_carry, off, idx, n, flags);
639
646
  }
640
647
  *nidx = n;
641
648
  return prev_in_string ? 0 : 1;
642
649
  }
643
650
 
651
+ /* The classification half of the structural indexer: the same
652
+ * 64-byte/4-half mask build, no emission, blocks out instead of idx. */
653
+ int yep_text_json_stage1_masks_neon(const char* p, size_t len, struct yep_s1_block* blocks,
654
+ size_t* nblocks, unsigned* flags) {
655
+ size_t nb = 0;
656
+ uint64_t prev_in_string = 0, esc_carry = 0;
657
+ size_t off = 0;
658
+ const uint8x16_t dq = vdupq_n_u8('"'), dbs = vdupq_n_u8('\\');
659
+ const uint8x16_t d1 = vdupq_n_u8('{'), d2 = vdupq_n_u8('}');
660
+ const uint8x16_t d3 = vdupq_n_u8('['), d4 = vdupq_n_u8(']');
661
+ const uint8x16_t d5 = vdupq_n_u8(','), d6 = vdupq_n_u8(':');
662
+ const uint8x16_t c0t = vdupq_n_u8(0x20);
663
+ for (; off + 64 <= len; off += 64) {
664
+ uint64_t q = 0, bs = 0, op = 0, c0 = 0;
665
+ for (unsigned half = 0; half < 4; half++) {
666
+ uint8x16_t v = vld1q_u8((const uint8_t*)(const void*)(p + off + 16 * half));
667
+ uint64_t fq = yep_neon_bits(vceqq_u8(v, dq));
668
+ uint64_t fb = yep_neon_bits(vceqq_u8(v, dbs));
669
+ uint64_t fo =
670
+ yep_neon_bits(vorrq_u8(vorrq_u8(vorrq_u8(vceqq_u8(v, d1), vceqq_u8(v, d2)),
671
+ vorrq_u8(vceqq_u8(v, d3), vceqq_u8(v, d4))),
672
+ vorrq_u8(vceqq_u8(v, d5), vceqq_u8(v, d6))));
673
+ uint64_t fc = yep_neon_bits(vcltq_u8(v, c0t));
674
+ q |= fq << (16 * half);
675
+ bs |= fb << (16 * half);
676
+ op |= fo << (16 * half);
677
+ c0 |= fc << (16 * half);
678
+ }
679
+ blocks[nb].q = q;
680
+ blocks[nb].bs = bs;
681
+ blocks[nb].op = op;
682
+ blocks[nb].c0 = c0;
683
+ blocks[nb].tokens =
684
+ yep_json_stage1_tokens(q, bs, op, c0, ~0ull, &prev_in_string, &esc_carry, flags);
685
+ nb++;
686
+ }
687
+ if (off < len) {
688
+ size_t cn = len - off;
689
+ uint64_t q = 0, bs = 0, op = 0, c0 = 0;
690
+ for (size_t k = 0; k < cn; k++) {
691
+ unsigned char c = (unsigned char)p[off + k];
692
+ uint64_t bit = 1ull << k;
693
+ if (c == '"') {
694
+ q |= bit;
695
+ } else if (c == '\\') {
696
+ bs |= bit;
697
+ } else if (c == '{' || c == '}' || c == '[' || c == ']' || c == ',' || c == ':') {
698
+ op |= bit;
699
+ }
700
+ if (c < 0x20) {
701
+ c0 |= bit;
702
+ }
703
+ }
704
+ uint64_t valid = (1ull << cn) - 1ull;
705
+ blocks[nb].q = q;
706
+ blocks[nb].bs = bs;
707
+ blocks[nb].op = op;
708
+ blocks[nb].c0 = c0;
709
+ blocks[nb].tokens =
710
+ yep_json_stage1_tokens(q, bs, op, c0, valid, &prev_in_string, &esc_carry, flags);
711
+ nb++;
712
+ }
713
+ *nblocks = nb;
714
+ return prev_in_string ? 0 : 1;
715
+ }
716
+
644
717
  const yep_text_kernels yep_text_kernels_neon = {
645
718
  yep_neon_contains,
646
719
  yep_neon_find,
@@ -657,6 +730,7 @@ const yep_text_kernels yep_text_kernels_neon = {
657
730
  yep_neon_line_facts,
658
731
  yep_text_json_chunk_neon,
659
732
  yep_text_json_stage1_neon,
733
+ yep_text_json_stage1_masks_neon,
660
734
  };
661
735
 
662
736
  #endif /* YEP_ARCH_AARCH64 */
@@ -287,12 +287,16 @@ yep_chunk_masks yep_text_json_chunk_scalar(const char* p, size_t n) {
287
287
 
288
288
  /* the stage-1 scalar reference lives in scan/json.c (the grammar
289
289
  * home); the table carries it so dispatch stays one point */
290
- extern int yep_json_stage1_scalar(const char* p, size_t len, uint32_t* idx, size_t* nidx);
290
+ extern int yep_json_stage1_scalar(const char* p, size_t len, uint32_t* idx, size_t* nidx,
291
+ unsigned* flags);
292
+ extern int yep_json_stage1_masks_scalar(const char* p, size_t len, struct yep_s1_block* blocks,
293
+ size_t* nblocks, unsigned* flags);
291
294
 
292
295
  const yep_text_kernels yep_text_kernels_scalar = {
293
- yep_text_contains_scalar, yep_text_find_scalar, yep_text_find3_scalar,
294
- yep_text_count_char_scalar, yep_text_count3_scalar, yep_text_copy_count3_scalar,
295
- yep_text_find_not_scalar, yep_text_stopset_find_scalar, yep_text_quote_scan_scalar,
296
- yep_text_scan_stats_scalar, yep_text_qbc_find_scalar, yep_text_gate_scan_scalar,
297
- yep_text_line_facts_scalar, yep_text_json_chunk_scalar, yep_json_stage1_scalar,
296
+ yep_text_contains_scalar, yep_text_find_scalar, yep_text_find3_scalar,
297
+ yep_text_count_char_scalar, yep_text_count3_scalar, yep_text_copy_count3_scalar,
298
+ yep_text_find_not_scalar, yep_text_stopset_find_scalar, yep_text_quote_scan_scalar,
299
+ yep_text_scan_stats_scalar, yep_text_qbc_find_scalar, yep_text_gate_scan_scalar,
300
+ yep_text_line_facts_scalar, yep_text_json_chunk_scalar, yep_json_stage1_scalar,
301
+ yep_json_stage1_masks_scalar,
298
302
  };
@@ -23,10 +23,14 @@ typedef struct yeptris_document {
23
23
  escaped scalars outlive the engine through the
24
24
  document */
25
25
  void* lazy_tape; /* #342 slice 2: the parsed tape when the tree is
26
- * deferred (gate-clean strict JSON). dom==NULL until
27
- * the first tree access materializes via dom_from_tape;
28
- * freed with the document. void* to avoid a header
29
- * cycle — parse.c casts to yeptris_json_tape* */
26
+ * deferred (gate-clean strict JSON; #378: the YAML
27
+ * record tape). dom==NULL until the first tree
28
+ * access materializes; freed with the document.
29
+ * void* to avoid a header cycle — parse.c casts
30
+ * per lazy_kind */
31
+ int lazy_kind; /* 0 = none/json (yeptris_json_tape), 1 = yaml
32
+ * (yep_ytape) — every constructor must set it
33
+ * (the field-by-field ctor trap) */
30
34
  } yeptris_document;
31
35
 
32
36
  /* Node handle: a (document, node-id) pair so nodes stay usable even if