yeptris 0.6.7.5-aarch64-linux → 0.6.8.2-aarch64-linux

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0b7d5fc414b1459a5bd7507b2cc3f4dc308efd75010d82f132bd7da078c3e999
4
- data.tar.gz: a27ba76d7a111dd8902ff058e1a26cadd05c3cfa921034bcab70bbad48deff0f
3
+ metadata.gz: 46a4f1d6dc8636db7110437e3afe0985f49152298c060fc73d4b02f5ed2e6abc
4
+ data.tar.gz: d92e8fde0b7426298944b1f924c399d5058b2617735d95a748efdf97cc185c27
5
5
  SHA512:
6
- metadata.gz: 86c23e8e229b87eff443d7e2be1cc16ad57b07a80b8edf5feb7a757e4b611aff34822c78eca5548c72e7eb42a1895f3023b4a50948147e654cb119003ad21a57
7
- data.tar.gz: 75ef4719add9a892912352792c0fd8e28347a079ccfee167b1520082d77c1d7a17d83baa593024d2c1b03d8ff0e2d9881f85e6dd1ec56dd00a8606fa25dcaf6f
6
+ metadata.gz: d4bc2b0bed370abc98f07715e7df696fd6f5516c483bb29f17caafcc073dda41fd5f60a4a4e3203626b53d040e05a79cba50032dafdbf3cf6257e3f9496ff58b
7
+ data.tar.gz: eec5e2d60e290339cf003ac2a7bc5b27a736ea48ac0f38c13161ec3f8fa008b85ead5b927c1f5799761ef674fb87467f05b0cb20584dc7dd8df573c75d716c6b
data/lib/yeptris/cbor.rb CHANGED
@@ -41,17 +41,26 @@ module Yeptris
41
41
  raise Error, "libyeptris has no CBOR support" unless available?
42
42
 
43
43
  items = []
44
+ pending_error = nil
44
45
  receiver = ::FFI::Function.new(:int, %i[pointer pointer size_t]) do |_ctx, item, _index|
45
46
  # the callback owns the item; materialize then free in place
46
- # (through the wrapper — the finalizer frees too)
47
- doc = ::Yeptris::Document.new(item)
48
- items << doc.root&.to_ruby
49
- doc.free
50
- 0
47
+ # (through the wrapper — the finalizer frees too). A raise
48
+ # inside an FFI callback leaves the return value undefined —
49
+ # abort the C iteration cleanly (nonzero) and re-raise after
50
+ begin
51
+ doc = ::Yeptris::Document.new(item)
52
+ items << doc.root&.to_ruby
53
+ doc.free
54
+ 0
55
+ rescue ::Exception => e # rubocop:disable Lint/RescueException
56
+ pending_error = e
57
+ 1
58
+ end
51
59
  end
52
60
  st = ::Yeptris::FFI.yeptris_cbor_decode_sequence(
53
61
  data, data.bytesize, strict ? STRICT : 0, receiver, nil, nil
54
62
  )
63
+ raise pending_error if pending_error
55
64
  raise ParseError, ::Yeptris::FFI.last_error_message if st.zero? && !data.empty?
56
65
 
57
66
  items
@@ -21,3 +21,22 @@ end
21
21
  # rebind is this file's whole purpose
22
22
  Object.class_eval { remove_const(:Psych) } if defined?(::Psych) && !::Psych.equal?(Yeptris::Psych)
23
23
  ::Psych = Yeptris::Psych
24
+
25
+ # yaml-first boot order: ::YAML still references the ORIGINAL stdlib
26
+ # module object, whose singleton methods route through stdlib's parse
27
+ # stream — the UTF-8 tagging (and every other normalization) never
28
+ # runs (#135's spec/sdo discriminant). Delegate the original's public
29
+ # singleton surface to the Yeptris face so BOTH constants behave
30
+ # identically regardless of which module object a caller holds.
31
+ # ORIGINAL exists only when stdlib psych was already loaded (the
32
+ # drop-in-before-psych order needs no delegation — nothing references
33
+ # the original yet).
34
+ if ::Yeptris::Psych.const_defined?(:ORIGINAL, false)
35
+ ::Psych::ORIGINAL.singleton_class.class_eval do
36
+ ::Psych::ORIGINAL.singleton_methods(false).each do |m|
37
+ define_method(m) do |*args, **kwargs, &block|
38
+ ::Yeptris::Psych.public_send(m, *args, **kwargs, &block)
39
+ end
40
+ end
41
+ end
42
+ end
data/lib/yeptris.rb CHANGED
@@ -3,7 +3,7 @@
3
3
  module Yeptris
4
4
  # The gem's version lives in the parent namespace's file — the last
5
5
  # internal require (yeptris/version) retired with it.
6
- VERSION = "0.6.7.5".freeze
6
+ VERSION = "0.6.8.2".freeze
7
7
  # The error hierarchy lives in THIS file (the parent namespace's
8
8
  # own file): nested constants do not trigger a parent-constant
9
9
  # autoload, and the law forbids internal requires — defining the
data/libyeptris.so CHANGED
Binary file
@@ -3,7 +3,7 @@
3
3
  cmake_minimum_required(VERSION 3.20)
4
4
 
5
5
  project(yeptris
6
- VERSION 0.6.7
6
+ VERSION 0.6.8
7
7
  DESCRIPTION "Ultra-fast YAML 1.2 parser, emitter and streamer in C"
8
8
  LANGUAGES C CXX
9
9
  )
@@ -98,7 +98,10 @@ static uint16_t cbor_d2h(double d) {
98
98
  uint32_t exp = (uint32_t)((bits >> 52) & 0x7ffu);
99
99
  uint64_t man = bits & 0xfffffffffffffull;
100
100
  if (exp == 0x7ffu) {
101
- return (uint16_t)(sign | (man ? 0x7e00u : 0x7c00u)); /* canonical NaN */
101
+ /* canonical NaN: f9 7e00, sign DROPPED — NaN sign is not
102
+ * meaningful (and (double)NAN carries a SET sign bit on
103
+ * arm64-MSVC, which turned the "canonical" form negative) */
104
+ return man ? 0x7e00u : (uint16_t)(sign | 0x7c00u); /* inf keeps sign */
102
105
  }
103
106
  int e2 = (int)exp - 1023 + 15;
104
107
  if (e2 >= 0x1f) {
@@ -557,17 +560,25 @@ static size_t cbor_size_item(cenc* e, uint32_t id) {
557
560
  /* mapping */
558
561
  uint32_t pairs = n->count / 2;
559
562
  sz += cbor_arg_bytes(pairs);
560
- cmap* cm = NULL;
563
+ /* hold the INDEX, not the pointer: sizing a child recurses into
564
+ * nested maps whose preps REALLOC e->maps (#152 — a held cmap*
565
+ * dangled and the next pair read walked freed memory; n>=11 of
566
+ * the depth-3 users shape crossed the 16->32 growth) */
567
+ size_t canon_mi = 0;
568
+ int canon = 0;
561
569
  if (e->canonical) {
562
570
  if (!cbor_canon_prepare(e, id, pairs)) {
563
571
  return 0;
564
572
  }
565
- cm = &e->maps[e->nmaps - 1];
573
+ canon_mi = e->nmaps - 1;
574
+ canon = 1;
566
575
  }
567
- if (cm != NULL) {
576
+ if (canon) {
568
577
  for (uint32_t p = 0; p < pairs && !e->failed; p++) {
578
+ const cmap* cm = &e->maps[canon_mi];
569
579
  sz += cbor_size_item(e, cm->child[cm->order[p] * 2]);
570
580
  if (!e->failed) {
581
+ cm = &e->maps[canon_mi];
571
582
  sz += cbor_size_item(e, cm->child[cm->order[p] * 2 + 1]);
572
583
  }
573
584
  }
@@ -21,6 +21,9 @@ extern const yep_text_kernels yep_text_kernels_neon;
21
21
 
22
22
  static const yep_text_kernels* yep_text_pick(void) {
23
23
  yep_cpu_features cpu = yep_cpu_detect();
24
+ /* arm64-MSVC has no ISA branch: port.h keeps MSVC off the
25
+ * GCC/clang NEON TUs, so it dispatches straight to scalar */
26
+ (void)cpu;
24
27
  #if defined(YEP_ARCH_X86)
25
28
  if (cpu.avx2) {
26
29
  return &yep_text_kernels_avx2;
@@ -12,10 +12,17 @@ typedef struct yep_midx_slot {
12
12
  uint32_t key_child; /* key node id; UINT32_MAX = empty */
13
13
  } yep_midx_slot;
14
14
 
15
+ #if defined(_MSC_VER)
16
+ #pragma warning(push)
17
+ #pragma warning(disable : 4200) /* C99 flexible array member */
18
+ #endif
15
19
  typedef struct yep_midx_tab {
16
20
  uint32_t cap; /* slot count, power of two */
17
21
  yep_midx_slot slots[];
18
22
  } yep_midx_tab;
23
+ #if defined(_MSC_VER)
24
+ #pragma warning(pop)
25
+ #endif
19
26
 
20
27
  /* Table capacity: power of two, >= 2x pairs (load factor <= 50%). */
21
28
  static uint32_t tab_cap_for(uint32_t pairs) {
@@ -129,12 +129,19 @@ static inline int yep_u128_cmp(yep_u128 a, yep_u128 b) {
129
129
  #endif
130
130
  }
131
131
 
132
- #if defined(_MSC_VER)
132
+ #if defined(_MSC_VER) && defined(_M_X64)
133
133
  static inline yep_u128 yep_u128_mul64(uint64_t a, uint64_t b) {
134
134
  yep_u128 r;
135
135
  r.lo = _umul128(a, b, &r.hi);
136
136
  return r;
137
137
  }
138
+ #elif defined(_MSC_VER) && defined(_M_ARM64)
139
+ static inline yep_u128 yep_u128_mul64(uint64_t a, uint64_t b) {
140
+ yep_u128 r;
141
+ r.hi = __umulh(a, b);
142
+ r.lo = a * b;
143
+ return r;
144
+ }
138
145
  #endif
139
146
 
140
147
  /* x * 10 stays in range */
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: yeptris
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.7.5
4
+ version: 0.6.8.2
5
5
  platform: aarch64-linux
6
6
  authors:
7
7
  - Ribose Inc.