leptris 1.9.420.0-arm-linux → 1.9.420.1-arm-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: 5ad82073dfdf75345e6adbb01d2af07b0be13b4ba098885f7fdd3b0220ff2556
4
- data.tar.gz: 2091520873efe5a504a79f6782c85fd565834727488f6c88c34f6c8a564fcf93
3
+ metadata.gz: f91f6a7f81afdee0f085118510b273435750711b0721daf7ebc274834c5643a9
4
+ data.tar.gz: 02ba02d1d36ccd5e56c524e6b40e8576229fb0ec49a48d58961ae831b9cc47b5
5
5
  SHA512:
6
- metadata.gz: 784eae5ae8cfe51bf2cf1ce0afe21c5e32d95f6353d38d530d2f445ff6c38d3b8a577b38b18f7cbcd3f96597ef69e2110d2390a2b7f13b662f227b076bb07c3f
7
- data.tar.gz: 0cff032c94f0c3b684c3b8721d5be2513f430a2679a241a66a733a3d54bb159d92a5681fb7327acc5ddf626e800de4461ecc6d80a2dca7ac2a0307ec01199a4e
6
+ metadata.gz: 9d21b5a325b5a3918acd3b9dff70f1fed778f161fc0ed39736e3140c6b768ce883863763256223ff2fbc72859d48d92a856b481eb8fe7f1c2376b3b04af588d4
7
+ data.tar.gz: 0a87c95caf8970e391ae3a6b059112141f638c145b47299964318ca1d200af011cf5d34c7df023501cdb7bd20f94b43b9dfd08884107a8af02cacfc2c60eda07
@@ -235,6 +235,12 @@ struct native_node {
235
235
  * memo) — treat it as read-only, like an interned String. */
236
236
  VALUE name_val, name_ver;
237
237
  VALUE children_val, children_ver;
238
+ /* Shape (b) hydration (leptris-ruby#631): the flat attribute
239
+ * pairs array in exactly nf_attribute_pairs' shape, filled by
240
+ * the subtree prime — the walk+read lane's attribute reads
241
+ * answer from the crossing instead of a per-element pairs
242
+ * crossing. Version-stamped like the other memos. */
243
+ VALUE attrs_val, attrs_ver;
238
244
  };
239
245
 
240
246
  static VALUE columnar_node_for(VALUE document, VALUE owner_klass,
@@ -258,6 +264,8 @@ static void nn_mark(void *p)
258
264
  rb_gc_mark(n->name_val);
259
265
  if (n->children_val != Qnil)
260
266
  rb_gc_mark(n->children_val);
267
+ if (n->attrs_val != Qnil)
268
+ rb_gc_mark(n->attrs_val);
261
269
  }
262
270
 
263
271
  static size_t nn_size(const void *p) { (void)p; return sizeof(struct native_node); }
@@ -2724,8 +2732,25 @@ static void walk_rows_impl(void *node, int depth, VALUE out)
2724
2732
  static VALUE nf_attribute_pairs(VALUE self, VALUE document, VALUE addr)
2725
2733
  {
2726
2734
  (void)self;
2727
- (void)document;
2728
2735
  void *node = (void *)(uintptr_t)NUM2ULL(addr);
2736
+ /* Shape (b) cache-first (leptris-ruby#631): the subtree prime
2737
+ * hydrates the flat pairs array per element — when the
2738
+ * address-keyed wrapper exists and its memo matches the
2739
+ * document version, the answer IS the memo (zero crossings,
2740
+ * the same object identity on repeat reads). */
2741
+ if (document != Qnil) {
2742
+ VALUE key = ULL2NUM((uint64_t)(uintptr_t)node);
2743
+ VALUE w = rb_hash_aref(native_cache_of(document), key);
2744
+ if (!NIL_P(w) &&
2745
+ rb_typeddata_is_kind_of(w, &nn_type)) {
2746
+ struct native_node *cn;
2747
+ TypedData_Get_Struct(w, struct native_node, &nn_type, cn);
2748
+ if (cn->document != Qnil && cn->attrs_val != Qnil &&
2749
+ cn->attrs_ver ==
2750
+ rb_ivar_get(cn->document, id_iv_version))
2751
+ return cn->attrs_val;
2752
+ }
2753
+ }
2729
2754
  VALUE out = rb_ary_new();
2730
2755
  if (f_node_type(node) != WS_NODE_ELEMENT) return out;
2731
2756
 
@@ -2748,6 +2773,22 @@ static VALUE nf_attribute_pairs(VALUE self, VALUE document, VALUE addr)
2748
2773
  }
2749
2774
  xfree(names);
2750
2775
  xfree(values);
2776
+ /* Shape (b) write-back: when the address-keyed wrapper exists,
2777
+ * the captured array lands in its memo — the next read (or any
2778
+ * consumer reading the same address again) answers from it
2779
+ * until the version moves. */
2780
+ if (document != Qnil && out != Qnil) {
2781
+ VALUE key = ULL2NUM((uint64_t)(uintptr_t)node);
2782
+ VALUE w = rb_hash_aref(native_cache_of(document), key);
2783
+ if (!NIL_P(w) && rb_typeddata_is_kind_of(w, &nn_type)) {
2784
+ struct native_node *cn;
2785
+ TypedData_Get_Struct(w, struct native_node, &nn_type, cn);
2786
+ if (cn->document != Qnil)
2787
+ rb_ivar_get(cn->document, id_iv_version);
2788
+ cn->attrs_val = out;
2789
+ cn->attrs_ver = rb_ivar_get(cn->document, id_iv_version);
2790
+ }
2791
+ }
2751
2792
  return out;
2752
2793
  }
2753
2794
 
@@ -2865,6 +2906,33 @@ static VALUE nn_prime_children_of(VALUE document, VALUE owner_klass,
2865
2906
  rb_utf8_encoding())
2866
2907
  : Qnil;
2867
2908
  nn->name_ver = ver;
2909
+ /* Shape (b) hydration (leptris-ruby#631): the attr
2910
+ * packet rides the SAME crossing — the pairs face's
2911
+ * exact output shape, served cache-first by the face
2912
+ * afterwards. Zero attributes leaves the memo nil (the
2913
+ * face's empty answer is cheap to recompute). */
2914
+ size_t total = f_attr_pairs(c, NULL, NULL, NULL, 0);
2915
+ if (total > 0) {
2916
+ const char **anames = ALLOC_N(const char *, total);
2917
+ const char **avalues = ALLOC_N(const char *, total);
2918
+ size_t n2 = f_attr_pairs(c, anames, avalues, NULL, total);
2919
+ VALUE flat = rb_ary_new_capa(2 * n2);
2920
+ for (size_t i = 0; i < n2; i++) {
2921
+ rb_ary_push(flat, anames[i]
2922
+ ? rb_enc_interned_str(
2923
+ anames[i],
2924
+ strlen(anames[i]),
2925
+ rb_utf8_encoding())
2926
+ : Qnil);
2927
+ rb_ary_push(flat, avalues[i]
2928
+ ? rb_utf8_str_new_cstr(avalues[i])
2929
+ : Qnil);
2930
+ }
2931
+ xfree(anames);
2932
+ xfree(avalues);
2933
+ nn->attrs_val = flat;
2934
+ nn->attrs_ver = ver;
2935
+ }
2868
2936
  nn->children_val = nn_prime_children_of(document, owner_klass,
2869
2937
  c, ver);
2870
2938
  nn->children_ver = ver;
@@ -2872,12 +2940,29 @@ static VALUE nn_prime_children_of(VALUE document, VALUE owner_klass,
2872
2940
  /* leaf kinds: memo the name exactly as nn_name computes
2873
2941
  * it (f_elem_name answers "" for nameless kinds); their
2874
2942
  * (empty) children keep the fetch path, which
2875
- * memo-stores the same way. */
2943
+ * memo-stores the same way. Shape (b): the leaf's
2944
+ * CONTENT hydrates on the same crossing — nn_content's
2945
+ * memo serves it afterwards with zero crossings. nil
2946
+ * content stays uncached (nn_content's nil discipline). */
2876
2947
  const char *name = f_elem_name(c);
2877
2948
  nn->name_val = name ? rb_enc_interned_str(name, strlen(name),
2878
2949
  rb_utf8_encoding())
2879
2950
  : Qnil;
2880
2951
  nn->name_ver = ver;
2952
+ {
2953
+ const char *cs = NULL;
2954
+ switch (kind) {
2955
+ case WS_NODE_TEXT: cs = f_text_content(c); break;
2956
+ case WS_NODE_COMMENT: cs = f_comment_content(c); break;
2957
+ case WS_NODE_CDATA: cs = f_cdata_content(c); break;
2958
+ case WS_NODE_PI: cs = f_pi_data(c); break;
2959
+ default: cs = NULL; break;
2960
+ }
2961
+ if (cs) {
2962
+ nn->content_val = rb_utf8_str_new_cstr(cs);
2963
+ nn->content_ver = ver;
2964
+ }
2965
+ }
2881
2966
  }
2882
2967
  rb_ary_push(out, wrapper);
2883
2968
  }
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Leptris
4
- VERSION = "1.9.420.0"
4
+ VERSION = "1.9.420.1"
5
5
  end
Binary file
Binary file
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: leptris
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.9.420.0
4
+ version: 1.9.420.1
5
5
  platform: arm-linux
6
6
  authors:
7
7
  - Ribose Inc.
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2026-11-13 00:00:00.000000000 Z
11
+ date: 2026-11-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ffi