leptris 1.9.346.0-aarch64-linux → 1.9.351.0-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.
Files changed (50) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +26 -0
  3. data/Rakefile +1 -1
  4. data/lib/leptris/version.rb +1 -1
  5. data/lib/leptris/xml/ffi.rb +11 -0
  6. data/lib/leptris/xml/plan_value.rb +63 -19
  7. data/lib/libleptris.so +0 -0
  8. data/vendor-src/README.md +1 -1
  9. data/vendor-src/libleptris/CHANGELOG.md +145 -0
  10. data/vendor-src/libleptris/CMakeLists.txt +1 -1
  11. data/vendor-src/libleptris/cli/commands/xquery.c +1 -1
  12. data/vendor-src/libleptris/src/include/leptris/descriptor.h +26 -0
  13. data/vendor-src/libleptris/src/leptris/common/simd_text.c +0 -12
  14. data/vendor-src/libleptris/src/leptris/common/simd_text.h +19 -0
  15. data/vendor-src/libleptris/src/leptris/common/simd_text_neon.c +0 -1
  16. data/vendor-src/libleptris/src/leptris/core.c +2 -5
  17. data/vendor-src/libleptris/src/leptris/descriptor/plan.c +300 -58
  18. data/vendor-src/libleptris/src/leptris/dom/root_doc_map.h +3 -0
  19. data/vendor-src/libleptris/src/leptris/flat/direct_parse.c +8 -33
  20. data/vendor-src/libleptris/src/leptris/flat/direct_parse.h +4 -0
  21. data/vendor-src/libleptris/src/leptris/html/html_parse.c +0 -2
  22. data/vendor-src/libleptris/src/leptris/leptris.c +6 -41
  23. data/vendor-src/libleptris/src/leptris/leptris_internal.h +14 -0
  24. data/vendor-src/libleptris/src/leptris/memory/pool.h +4 -0
  25. data/vendor-src/libleptris/src/leptris/xpath/evaluator.c +0 -2
  26. data/vendor-src/libleptris/src/leptris/xpath/evaluator_operators.c +2 -8
  27. data/vendor-src/libleptris/src/leptris/xpath/functions.c +1 -5
  28. data/vendor-src/libleptris/src/leptris/xpath/functions.h +29 -0
  29. data/vendor-src/libleptris/src/leptris/xpath/functions_ext31.c +1 -19
  30. data/vendor-src/libleptris/src/leptris/xpath/xpath_carrier.h +32 -0
  31. data/vendor-src/libleptris/src/leptris/xpath/xpath_public.c +1 -15
  32. data/vendor-src/libleptris/src/leptris/xquery/xquery.c +1 -2
  33. data/vendor-src/libleptris/src/leptris/xsd/compile.c +158 -3
  34. data/vendor-src/libleptris/src/leptris/xsd/validate.c +13 -9
  35. data/vendor-src/libleptris/src/leptris/xsd/xsd_internal.h +8 -0
  36. data/vendor-src/libleptris/src/leptris/xslt/xslt_exec.c +0 -6
  37. data/vendor-src/libleptris/src/leptris/xslt/xslt_functions.c +0 -2
  38. data/vendor-src/libleptris/src/leptris/xslt/xslt_pattern.c +0 -1
  39. data/vendor-src/libleptris/src/leptris/xslt/xslt_public.c +1 -2
  40. data/vendor-src/libleptris/test/abi/test_descriptor.cpp +324 -0
  41. data/vendor-src/libleptris/test/xquery/test_xquery.cpp +1 -1
  42. data/vendor-src/libleptris/test/xsd/libxml2-cases/fwd_ref_ext/lib/base.xsd +23 -0
  43. data/vendor-src/libleptris/test/xsd/libxml2-cases/fwd_ref_ext/lib/more.xsd +8 -0
  44. data/vendor-src/libleptris/test/xsd/libxml2-cases/fwd_ref_ext/root.xsd +10 -0
  45. data/vendor-src/libleptris/test/xsd/libxml2-cases/fwd_ref_ext/sub/wrap.xsd +3 -0
  46. data/vendor-src/libleptris/test/xsd/libxml2-cases/ns_simple_collision/m.xsd +14 -0
  47. data/vendor-src/libleptris/test/xsd/libxml2-cases/ns_simple_collision/w.xsd +14 -0
  48. data/vendor-src/libleptris/test/xsd/test_xsd_compile.cpp +70 -0
  49. data/vendor-src/libleptris/vcpkg.json +1 -1
  50. metadata +9 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 113981fdc05f37441fd32dc2253a1a71cbec6d568debfc33ca805654aa1ac7b8
4
- data.tar.gz: dd5440744bb94d2c9b9193aebb13dea33822b9b83c6a7c299b09754fcf30a7ad
3
+ metadata.gz: 7c45d7b57be086e1a8ecac69ab89cb4c9a0894b933ad48ee7509e7ab061df51f
4
+ data.tar.gz: 5ab08b6656b40008c429fe133b618567ad0a34450bb9d8f3b1fa37a083a730b6
5
5
  SHA512:
6
- metadata.gz: 94b9f1173ac920e3e4f06ce86b48cb8033bfa0b6ffd676f9fd95f5bef4491990a3780fde502050158b51509a9ce50c08545bd1979bae1ed7e0c73731d77b5e98
7
- data.tar.gz: beac13393875ea660296404fa58fb8197b84a2d13b8729115dfda09559640f95aefb3997e8d796eebb4e7d006304581dd1ea3c3de3cd67372f0fbdafdfa55606
6
+ metadata.gz: e59dea08636304ffc7869b22b1ee2c3df947d41c64cd56f1252ab96055922d9d2fcde9c3fa9de262650a110144d050bbdd95691fd91a56e7d7c4be91cfbebebb
7
+ data.tar.gz: 46534e96774c19bb47617f81507bdb9775f0c09e6c6d0df555690dc82683cc90130672b6584f77f870d56b0ea82801f89d3c2ab3399ba8d84267c9f71619ca44
data/CHANGELOG.md CHANGED
@@ -1,3 +1,29 @@
1
+ ## [1.9.351.0] - 2026-10-14
2
+
3
+ ### Fixed — engine sync (libleptris 1.9.350/1.9.351)
4
+
5
+ - **Chain-compiled XSD: forward-referenced extension bases fold
6
+ after the schema merges, subfiles resolve their own relative
7
+ schemaLocations, and attribute types resolve (ns, name)-first
8
+ (leptris-ruby#440; libleptris 1.9.350, PR leptris/leptris#1679)**:
9
+ the corpus-stuck-at-8 family. The engine's visited memo (#1644)
10
+ stopped each schema unit being captured twice and unmasked three
11
+ latent defects: the extension fold ran at capture time (a base
12
+ defined after its derived type — CT_TcPr -> CT_TcPrInner —
13
+ silently dropped), a subfile's own schemaLocations resolved
14
+ against the COMPILED file's directory (wml.xsd's same-dir
15
+ shared-*.xsd imports vanished), and attribute type names resolved
16
+ by bare local name (wml's ST_Jc shadowed shared-math's, so
17
+ m:defJc val="centerGroup" failed). Pinned through the binding API
18
+ in spec/xml/xsd_chain_shapes_spec.rb (tempdir chain trees — no
19
+ vendored corpus needed).
20
+ - **GCC LTO carrier link (#1681, libleptris 1.9.350/1.9.351)**:
21
+ ppc64le/s390x/truffleruby legs failed the engine link
22
+ (undefined xpath_carrier_node_of) — fixed engine-side; the
23
+ #445-family legs go green. libleptris 1.9.351 additionally
24
+ removed every function-scope extern (84 sites across 18 TUs), so
25
+ the class cannot recur.
26
+
1
27
  ## [1.9.346.0] - 2026-10-12
2
28
 
3
29
  ### Fixed — engine sync (libleptris 1.9.346)
data/Rakefile CHANGED
@@ -8,7 +8,7 @@ RSpec::Core::RakeTask.new(:spec)
8
8
  # Pin for `rake compile` and the platform-gem builds. Keep in lockstep
9
9
  # with .github/workflows/build.yml (which calls `rake compile`) and the
10
10
  # CHANGELOG when libleptris releases.
11
- LIBLEPTRIS_VERSION = "1.9.346"
11
+ LIBLEPTRIS_VERSION = "1.9.351"
12
12
  # Vendored alongside libleptris for fn:normalize-unicode (TODO
13
13
  # .restructure/20): built per platform with a RELOCATABLE @rpath
14
14
  # install name, loaded by ffi.rb before libleptris so the
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Leptris
4
- VERSION = "1.9.346.0"
4
+ VERSION = "1.9.351.0"
5
5
  end
@@ -494,6 +494,17 @@ module Leptris
494
494
  [:leptris_plan_result, :size_t], :leptris_plan_result
495
495
  attach_function :leptris_plan_value_attribute,
496
496
  [:leptris_plan_result, :string], UTF8_STRING
497
+ # #1670 (libleptris 1.9.347): the ELEMENT value's attribute
498
+ # census + one-call flat read (ParallelArrays mirrors
499
+ # children_snapshot: NULL blobs size, retry at the returned
500
+ # capacity; (size_t)-1 = still too small). Engine-face
501
+ # coverage — the plan-value consumer port rides the #425/#426
502
+ # Descriptor round.
503
+ attach_function :leptris_plan_value_attribute_count,
504
+ [:leptris_plan_result], :size_t
505
+ attach_function :leptris_plan_value_attributes_snapshot,
506
+ [:leptris_plan_result, :pointer, :size_t, :pointer, :pointer,
507
+ :size_t, :pointer], :size_t
497
508
  # One-call flat child list: names blob with per-child offsets
498
509
  # (SIZE_MAX = NULL name, i.e. content runs), type tags, and
499
510
  # borrowed child handles. Returns 0 on success or the blob
@@ -18,16 +18,29 @@ class Leptris::XML::PlanValue
18
18
  Leptris::XML::FFI::PLAN_VALUE_SCALAR => :scalar,
19
19
  Leptris::XML::FFI::PLAN_VALUE_COLLECTION => :collection,
20
20
  Leptris::XML::FFI::PLAN_VALUE_RAW => :raw,
21
- Leptris::XML::FFI::PLAN_VALUE_CALLBACK => :callback,
21
+ Leptris::XML::FFI::PLAN_VALUE_CALLBACK => :callback
22
22
  }.freeze
23
23
  private_constant :VALUE_KINDS
24
24
 
25
- def initialize(ptr, owner: nil, plans: nil, plan: nil, counter: nil)
25
+ def initialize(ptr, owner: nil, plans: nil, plan: nil, counter: nil,
26
+ root: nil)
26
27
  @ptr = ptr
27
28
  @owner = owner
28
29
  @plans = plans
29
30
  @plan = plan
30
31
  @counter = counter || [0]
32
+ # #1673: child views borrow their pointer from the root's
33
+ # result arena — retaining the root here (transitively) keeps
34
+ # the whole-result handle alive for as long as any borrowed
35
+ # view exists. Without it a Ruby-3.3-timed GC can free the
36
+ # root mid-read (the ride's linux/3.3 segfault).
37
+ @root = root
38
+ end
39
+
40
+ # The whole-result owner this view borrows from (self for a
41
+ # root). Retained by every borrowed child via #at.
42
+ def lifetime_root
43
+ @root || self
31
44
  end
32
45
 
33
46
  # The engine value handle — the ROOT value's is the whole-result
@@ -75,18 +88,21 @@ class Leptris::XML::PlanValue
75
88
  def int_value
76
89
  out = ::FFI::MemoryPointer.new(:int64)
77
90
  return nil unless Leptris::XML::FFI.leptris_plan_value_int(@ptr, out).zero?
91
+
78
92
  out.read_int64
79
93
  end
80
94
 
81
95
  def float_value
82
96
  out = ::FFI::MemoryPointer.new(:double)
83
97
  return nil unless Leptris::XML::FFI.leptris_plan_value_float(@ptr, out).zero?
98
+
84
99
  out.read_double
85
100
  end
86
101
 
87
102
  def bool_value
88
103
  out = ::FFI::MemoryPointer.new(:int)
89
104
  return nil unless Leptris::XML::FFI.leptris_plan_value_bool(@ptr, out).zero?
105
+
90
106
  out.read_int != 0
91
107
  end
92
108
 
@@ -114,9 +130,11 @@ class Leptris::XML::PlanValue
114
130
  @counter[0] += 1
115
131
  ptr = Leptris::XML::FFI.leptris_plan_value_at(@ptr, i)
116
132
  return nil if ptr.null?
133
+
117
134
  child_plan = child_plan_for_position(ptr)
118
135
  Leptris::XML::PlanValue.new(ptr, plans: @plans, plan: child_plan,
119
- counter: @counter)
136
+ counter: @counter,
137
+ root: lifetime_root)
120
138
  end
121
139
 
122
140
  # ELEMENT: the whole child list in one FFI crossing — parallel
@@ -136,7 +154,8 @@ class Leptris::XML::PlanValue
136
154
  tags = ::FFI::MemoryPointer.new(:uint8, n)
137
155
  handles = ::FFI::MemoryPointer.new(:pointer, n)
138
156
  needed = Leptris::XML::FFI.leptris_plan_value_children_snapshot(
139
- @ptr, blob, cap, offsets, tags, handles)
157
+ @ptr, blob, cap, offsets, tags, handles
158
+ )
140
159
  break snapshot_build(blob, offsets, tags, handles, n) if needed.zero?
141
160
 
142
161
  cap = needed
@@ -187,7 +206,7 @@ class Leptris::XML::PlanValue
187
206
  name: name,
188
207
  type_tag: type_tag,
189
208
  attributes: kwarg_attributes,
190
- children: kwarg_children,
209
+ children: kwarg_children
191
210
  }
192
211
  when :collection
193
212
  kwarg_collection_children
@@ -212,7 +231,7 @@ class Leptris::XML::PlanValue
212
231
  name: name,
213
232
  type_tag: type_tag,
214
233
  attributes: collected_attributes,
215
- children: Array.new(count) { |i| at(i).to_ruby },
234
+ children: Array.new(count) { |i| at(i).to_ruby }
216
235
  }
217
236
  when :collection
218
237
  Array.new(count) { |i| at(i).to_ruby }
@@ -225,7 +244,6 @@ class Leptris::XML::PlanValue
225
244
 
226
245
  private
227
246
 
228
-
229
247
  def kwarg_attributes
230
248
  ((@plan && @plan[:attributes]) || []).each_with_object({}) do |row, result|
231
249
  v = attribute(row[:name])
@@ -234,18 +252,19 @@ class Leptris::XML::PlanValue
234
252
  end
235
253
 
236
254
  def kwarg_children
237
- rows = ((@plan && @plan[:children]) || [])
255
+ rows = (@plan && @plan[:children]) || []
238
256
  result = {}
239
257
  rows.each_with_index do |row, i|
240
258
  value = at(i)
241
259
  next if value.nil?
260
+
242
261
  key = row[:name]
243
262
  coerced = coerce_kwarg(value, row[:kind])
244
263
  result[key] = if result.key?(key)
245
- Array(result[key]) << coerced
246
- else
247
- coerced
248
- end
264
+ Array(result[key]) << coerced
265
+ else
266
+ coerced
267
+ end
249
268
  end
250
269
  result
251
270
  end
@@ -273,14 +292,23 @@ class Leptris::XML::PlanValue
273
292
 
274
293
  def typed_string_value_for(value)
275
294
  case value.type_tag
276
- when 1 then value.int_value || (Integer(value.string_value, 10) rescue value.string_value)
277
- when 2 then value.float_value || (Float(value.string_value) rescue value.string_value)
295
+ when 1 then value.int_value || begin
296
+ Integer(value.string_value, 10)
297
+ rescue StandardError
298
+ value.string_value
299
+ end
300
+ when 2 then value.float_value || begin
301
+ Float(value.string_value)
302
+ rescue StandardError
303
+ value.string_value
304
+ end
278
305
  when 3
279
306
  v = value.bool_value
280
307
  v.nil? ? typed_bool_fallback(value.string_value) : v
281
308
  else value.string_value
282
309
  end
283
310
  end
311
+
284
312
  # contract): 1=Integer, 2=Float, 3=boolean. Executed in-pass by
285
313
  # the engine (#1269a); on its soft-fail (non-numeric source) the
286
314
  # lenient Ruby path applies, then the raw String wins.
@@ -288,9 +316,17 @@ class Leptris::XML::PlanValue
288
316
  def typed_string_value
289
317
  case type_tag
290
318
  when 1
291
- int_value || (string_value && (Integer(string_value, 10) rescue string_value))
319
+ int_value || (string_value && begin
320
+ Integer(string_value, 10)
321
+ rescue StandardError
322
+ string_value
323
+ end)
292
324
  when 2
293
- float_value || (string_value && (Float(string_value) rescue string_value))
325
+ float_value || (string_value && begin
326
+ Float(string_value)
327
+ rescue StandardError
328
+ string_value
329
+ end)
294
330
  when 3
295
331
  v = bool_value
296
332
  v.nil? ? typed_bool_fallback(string_value) : v
@@ -331,14 +367,16 @@ class Leptris::XML::PlanValue
331
367
  ptr = handles.get_pointer(i * POINTER_SIZE)
332
368
  child_plan = child_plan_for_position(ptr, name: names[i])
333
369
  children[i] = Leptris::XML::PlanValue.new(ptr, plans: @plans,
334
- plan: child_plan,
335
- counter: @counter)
370
+ plan: child_plan,
371
+ counter: @counter,
372
+ root: lifetime_root)
336
373
  end
337
374
  [names, tag_values, children]
338
375
  end
339
376
 
340
377
  def child_plan_for_position(ptr, name: nil)
341
378
  return nil unless @plan
379
+
342
380
  rows = @plan[:children] || []
343
381
  row = rows.size == 1 ? rows.first : nil
344
382
  unless row
@@ -350,6 +388,7 @@ class Leptris::XML::PlanValue
350
388
  row = rows.find { |r| r[:name] == child_name }
351
389
  end
352
390
  return nil unless row && @plans
391
+
353
392
  row[:kind] == :nested ? @plans[row[:child_plan_index]] : nil
354
393
  end
355
394
 
@@ -358,6 +397,7 @@ class Leptris::XML::PlanValue
358
397
  r[:kind] == :nested && r[:name] == child_wire_name
359
398
  end
360
399
  return nil unless row && @plans
400
+
361
401
  @plans[row[:child_plan_index]]
362
402
  end
363
403
 
@@ -376,7 +416,11 @@ class Leptris::XML::PlanValue
376
416
  def cast_attribute(value, row)
377
417
  tag = Leptris::XML::Descriptor.type_tag_code(row)
378
418
  case tag
379
- when 1 then Integer(value, 10) rescue value
419
+ when 1 then begin
420
+ Integer(value, 10)
421
+ rescue StandardError
422
+ value
423
+ end
380
424
  when 2
381
425
  begin
382
426
  Float(value)
data/lib/libleptris.so CHANGED
Binary file
data/vendor-src/README.md CHANGED
@@ -1,7 +1,7 @@
1
1
  Sources vendored in this gem (recompile rights; the ruby
2
2
  variant builds them at install via extconf.rb):
3
3
 
4
- - libleptris v1.9.346
4
+ - libleptris v1.9.351
5
5
  - utf8proc v2.11.0
6
6
 
7
7
  Rebuild by hand:
@@ -1,5 +1,150 @@
1
1
  ## [Unreleased]
2
2
 
3
+ ## [1.9.351] - 2026-10-13
4
+
5
+ ### Changed
6
+
7
+ - **Block-scope externs removed engine-wide (leptris#1681,
8
+ PR #1684).** #1683 fixed the one symbol GCC LTO internalized
9
+ out from under a function-scope reference; this removes the
10
+ class — the count of block-scope extern declarations is now
11
+ zero across all 18 TUs that carried them (84 sites). Every
12
+ cross-TU symbol resolves through a shared internal header:
13
+ most declarations already existed and the TUs just didn't
14
+ include them; new homes were added where none existed (the
15
+ XSLT/Schematron bridge registrations, EXSLT pack, fn31 pack
16
+ and shared helpers in xpath/functions.h; per-arch simd
17
+ kernels in common/simd_text.h; xsd_builtin_valid in
18
+ xsd/xsd_internal.h; the HTML tree-builder document
19
+ constructor and the parse-default TLS in leptris_internal.h;
20
+ direct_parse_flags in flat/direct_parse.h;
21
+ leptris_root_doc_unregister_doc in dom/root_doc_map.h;
22
+ leptris_pool_drain_recycler in memory/pool.h). No ABI
23
+ change: symbols keep their definitions and visibility; only
24
+ the declaration home moved. Verified under gcc-16 -flto
25
+ (the configuration where the class manifests): shared +
26
+ CLI + tests link with zero errors; full suite 1996/1996 on
27
+ clang Release.
28
+
29
+
30
+ ## [1.9.350] - 2026-10-13
31
+
32
+ ### Fixed
33
+
34
+ - **GCC LTO: the XPath carrier decode survives link
35
+ internalization (leptris#1681, PR #1683).** The binding's
36
+ ppc64le (qemu, gcc-12), s390x (qemu, alpine) and truffleruby
37
+ source-install legs failed the engine link with `undefined
38
+ reference to xpath_carrier_node_of`: with Release LTO on, GCC
39
+ internalizes a hidden out-of-line definition when the only
40
+ cross-TU references are block-scope externs. The decode is now
41
+ `static inline` in a shared internal header
42
+ (xpath/xpath_carrier.h) — the definition travels with every
43
+ referencing TU, so internalization cannot orphan the externs.
44
+ The interim definition-side attributes (9985185d) stay and
45
+ remain no-ops for clang. Verified under gcc-16 -flto: the full
46
+ build (shared + CLI + tests) links clean, test_xquery 72/72.
47
+
48
+ - **Chain-compiled XSD: forward-referenced extension bases fold
49
+ after the schema merges, and subfiles resolve their own
50
+ schemaLocations (leptris-ruby#440, PR #1679).** Two defects in
51
+ the flat merged-import compile, both masked until the #1644
52
+ visited memo made each file capture exactly once. (A) The
53
+ content-model extension fold ran at CAPTURE time, so a base
54
+ defined AFTER its derived type in the same file (CT_TcPr
55
+ extends CT_TcPrInner, wml.xsd:2339 -> :2351) resolved to
56
+ nothing and its content was silently dropped - the direct
57
+ compile of wml.xsd had been saved only by dml's re-import
58
+ capturing the file twice. Extensions whose base is not yet
59
+ captured (or is itself still deferred) now record the base
60
+ name and fold in a post-capture resolver that iterates to a
61
+ fixpoint, splicing base content first and inherited attribute
62
+ rows before the derived type's own - with the same one-root-
63
+ particle sequence normalization capture applies. (B) The
64
+ subfile's OWN relative schemaLocations resolved against the
65
+ COMPILED file's directory: wml-2010 -> word12 -> ../iso/
66
+ wml.xsd worked, but wml.xsd's same-dir shared-*.xsd imports
67
+ then resolved against microsoft/ and silently vanished,
68
+ truncating every model referencing them. Each import unit now
69
+ threads base_dir to the subfile's directory for its own
70
+ capture and restores it on every exit path. (C) Attribute
71
+ type names resolved by bare local name, so same-name
72
+ simpleTypes across namespaces shadowed each other - wml's
73
+ ST_Jc (no centerGroup) beat shared-math's ST_Jc (centerGroup)
74
+ and m:defJc's val="centerGroup" failed lexical validation.
75
+ XsdSimple now carries the declaring unit's targetNamespace and
76
+ the lexical checks resolve (ns, name)-first, falling back to
77
+ unstamped and then cross-namespace spellings (prefix-stripped
78
+ names legitimately cross namespaces). Fixtures:
79
+ fwd_ref_ext/ (forward-ref chain through chameleon + subfile
80
+ dirs), ns_simple_collision/ (ST_Jc shadowing both ways).
81
+
82
+
83
+ ## [1.9.349] - 2026-10-13
84
+
85
+ ### Fixed
86
+
87
+ - **Plan arena: the window is owned by a wrapper
88
+ (leptris#1677, PR #1678).** The "multiple roots" early
89
+ return in leptris_plan_result_build neither restored the
90
+ thread-local current-arena window nor freed the arena -
91
+ the only return path that missed both. After it,
92
+ dp_cur_arena stayed pointing at the leaked arena for the
93
+ rest of the thread: every later malloc-lane mint (serialize
94
+ joins, dp_decls tables) rode the dead arena, and freeing
95
+ those interior pointers corrupted the heap - the ~50%
96
+ intermittent garbage/segfault the leptris-py suite hit
97
+ (in-process sequencing; ASAN-per-test could not see it).
98
+ The window and arena are now owned by a WRAPPER - restored
99
+ and freed unconditionally on every exit; the windowed body
100
+ touches neither. In-process regression spec: 50 rounds of
101
+ failing two-root build then walk + serialize, aborts at
102
+ round 0 pre-fix. Full suite 1994/1994.
103
+
104
+
105
+ ## [1.9.348] - 2026-10-13
106
+
107
+ ### Fixed
108
+
109
+ - **Plan walk: zero the arena-routed attribute arrays
110
+ (leptris#1673, PR #1675).** The #1670 walk arena returns
111
+ non-zeroed memory, but the walk's fixed-capacity attribute
112
+ arrays relied on calloc's NULL-fill: unbound attribute rows
113
+ left their slots unwritten, and the serialize lane's
114
+ declaration walk then read malloc-fill garbage through
115
+ attr_ns_prefixes - the segfault the 1.9.347 ride's
116
+ nested-capture specs hit (segv at 0x0 on Ruby 3.3/Linux/PGO
117
+ legs; allocation layout decided what landed in the
118
+ unwritten slots). The four arrays memset to zero at
119
+ allocation, restoring the calloc contract; dp_arena_alloc
120
+ stays raw by design. ASAN repro faulted pre-fix and passes
121
+ clean post-fix. Red-first spec pins both serialize faces on
122
+ the binding's nested-capture shape. Full suite 1992/1992.
123
+
124
+
125
+ ## [1.9.347] - 2026-10-13
126
+
127
+ ### Changed
128
+
129
+ - **Plan walk: arena-backed results + batch attribute face
130
+ (leptris#1670, PR #1671).** The ordered plan-lane walk
131
+ minted ~33K more allocations per parse than the
132
+ interpretive lane (the walk-side sibling of #408). The walk
133
+ and build lanes now mint every value struct, name/value
134
+ string, kids array, and attribute array from a root-owned
135
+ chunked bump arena (threaded via a TLS current-arena slot;
136
+ plan capture and serialization stay on malloc), and
137
+ leptris_plan_result_free releases the chunks wholesale.
138
+ Measured: 0 allocations inside the walk window on a
139
+ 5000-row walk + 10K-attribute read pass (malloc_logger).
140
+ New ABI: leptris_plan_value_attribute_count sizes the
141
+ buffers and leptris_plan_value_attributes_snapshot returns
142
+ ALL attribute names + values in ONE crossing (two-phase
143
+ capacity/retry contract) - a node with N attributes costs
144
+ O(1) crossings instead of O(N) mints. Red-first spec;
145
+ full suite 1990/1991-total green; descriptor ASAN-clean.
146
+
147
+
3
148
  ## [1.9.346] - 2026-10-12
4
149
 
5
150
  ### Fixed
@@ -3,7 +3,7 @@
3
3
  cmake_minimum_required(VERSION 3.20)
4
4
 
5
5
  project(leptris
6
- VERSION 1.9.346
6
+ VERSION 1.9.351
7
7
  DESCRIPTION "Fast XML parser and XPath evaluator in pure C"
8
8
  LANGUAGES C CXX
9
9
  )
@@ -8,6 +8,7 @@
8
8
  */
9
9
 
10
10
  #include "../cli.h"
11
+ #include "../../src/leptris/xpath/xpath_carrier.h"
11
12
  #include "../options.h"
12
13
  #include "../error.h"
13
14
  #include "../src/include/leptris.h"
@@ -121,7 +122,6 @@ static cli_result_t xquery_run(int argc, char** argv) {
121
122
  } else if (leptris_xpath_result_type(r) == LEPTRIS_XPATH_NODESET) {
122
123
  /* carrier-by-pointer (fold-left-009/016): synth members may
123
124
  * carry a node pointer — render its markup. */
124
- extern void* xpath_carrier_node_of(const char* s);
125
125
  size_t n = leptris_xpath_result_count(r);
126
126
  for (size_t k = 0; k < n; k++) {
127
127
  if (k) putchar(' ');
@@ -257,6 +257,10 @@ LEPTRIS_API LeptrisPlanResult leptris_plan_walk(LeptrisDocument doc,
257
257
  LeptrisElement ctx,
258
258
  LeptrisPlan plan,
259
259
  LeptrisStatus* status);
260
+ /* Release a walk result. Pass the ROOT handle the walk returned —
261
+ * #1670 backs the whole tree with one root-owned bump arena, so
262
+ * the wholesale release is O(chunks); subtree handles share the
263
+ * arena and are dropped with it. */
260
264
  LEPTRIS_API void leptris_plan_result_free(LeptrisPlanResult result);
261
265
 
262
266
  /* #408 ask 2: build a standalone result natively from a flat op
@@ -376,6 +380,28 @@ LEPTRIS_API size_t leptris_plan_value_children_snapshot(
376
380
  LEPTRIS_API const char* leptris_plan_value_attribute(const LeptrisPlanResult v,
377
381
  const char* wire_name);
378
382
 
383
+ /* #1670: number of attributes carried on an ELEMENT value (0 for
384
+ * non-ELEMENT values and NULL). Sizes the attributes_snapshot
385
+ * buffers. */
386
+ LEPTRIS_API size_t leptris_plan_value_attribute_count(
387
+ const LeptrisPlanResult v);
388
+
389
+ /* #1670: ALL attribute names + values in ONE crossing (the
390
+ * per-name `leptris_plan_value_attribute` walk mints one
391
+ * FFI/wrapper round trip per attribute per node). ParallelArrays
392
+ * contract mirrors children_snapshot: call once with NULL blobs /
393
+ * caps 0 to size (returns the required per-blob byte capacity;
394
+ * both blobs need the same capacity), then call again with
395
+ * buffers of at least that capacity — 0 on success,
396
+ * (size_t)-1 when either buffer is still too small. Offsets are
397
+ * byte offsets into the respective blobs; entries are
398
+ * NUL-terminated. Attribute ORDER is the plan's attribute-row
399
+ * order (only bound attributes appear). NULL v returns 0. */
400
+ LEPTRIS_API size_t leptris_plan_value_attributes_snapshot(
401
+ const LeptrisPlanResult v,
402
+ char* names_blob, size_t names_cap, size_t* name_offsets,
403
+ char* values_blob, size_t values_cap, size_t* value_offsets);
404
+
379
405
  /* #1269a in-pass type execution (#1269a): for SCALAR/RAW values
380
406
  * whose producing row carried type_tag in {1=int, 2=float, 3=bool},
381
407
  * the walk parses the string once and stores typed values. The str
@@ -97,9 +97,6 @@ static void dispatch_init(void) {
97
97
  leptris_cpu_level lvl = leptris_cpu_detect();
98
98
  #if defined(LEPTRIS_ARCH_X86) && defined(LEPTRIS_HAS_AVX2_BUILD)
99
99
  if (lvl >= LEPTRIS_CPU_AVX2) {
100
- extern int leptris_text_contains_avx2(const char*, size_t, char);
101
- extern ptrdiff_t leptris_text_find3_avx2(const char*, size_t, char, char, char);
102
- extern size_t leptris_text_count_char_avx2(const char*, size_t, char);
103
100
  g_contains_fn = leptris_text_contains_avx2;
104
101
  g_find3_fn = leptris_text_find3_avx2;
105
102
  g_count_fn = leptris_text_count_char_avx2;
@@ -108,13 +105,6 @@ static void dispatch_init(void) {
108
105
  #endif
109
106
  #if defined(LEPTRIS_ARCH_ARM) && defined(__aarch64__)
110
107
  if (lvl >= LEPTRIS_CPU_NEON) {
111
- extern int leptris_text_contains_neon(const char*, size_t, char);
112
- extern ptrdiff_t leptris_text_find3_neon(const char*, size_t, char, char, char);
113
- extern size_t leptris_text_count_char_neon(const char*, size_t, char);
114
- extern void leptris_text_count3_neon(const char*, size_t, char, char, char,
115
- size_t*, size_t*, size_t*);
116
- extern void leptris_copy_count3_neon(char*, const char*, size_t, char, char, char,
117
- size_t*, size_t*, size_t*);
118
108
  g_contains_fn = leptris_text_contains_neon;
119
109
  g_find3_fn = leptris_text_find3_neon;
120
110
  g_count_fn = leptris_text_count_char_neon;
@@ -227,8 +217,6 @@ size_t leptris_text_scan_events(const char* buf, size_t len,
227
217
  g_scan_fn = scan_events_scalar;
228
218
  #if defined(LEPTRIS_ARCH_ARM) && defined(__aarch64__)
229
219
  if (leptris_cpu_detect() >= LEPTRIS_CPU_NEON) {
230
- extern size_t leptris_text_scan_events_neon(const char*, size_t,
231
- LeptrisScanEvent*, size_t);
232
220
  g_scan_fn = leptris_text_scan_events_neon;
233
221
  }
234
222
  #endif
@@ -90,6 +90,25 @@ extern unsigned char leptris_dp_class_table[256];
90
90
  * rely on leptris_text_scan_events to call it). */
91
91
  void leptris_dp_class_table_init(void);
92
92
 
93
+ /* Per-arch kernels (simd_text_avx2.c / simd_text_neon.c): declared
94
+ * unconditionally, defined only under their platform gates. */
95
+ int leptris_text_contains_avx2(const char* s, size_t len, char c);
96
+ ptrdiff_t leptris_text_find3_avx2(const char* s, size_t len,
97
+ char a, char b, char c);
98
+ size_t leptris_text_count_char_avx2(const char* s, size_t len, char c);
99
+ int leptris_text_contains_neon(const char* s, size_t len, char c);
100
+ ptrdiff_t leptris_text_find3_neon(const char* s, size_t len,
101
+ char a, char b, char c);
102
+ size_t leptris_text_count_char_neon(const char* s, size_t len, char c);
103
+ void leptris_text_count3_neon(const char* s, size_t len,
104
+ char a, char b, char c,
105
+ size_t* ca, size_t* cb, size_t* cc);
106
+ void leptris_copy_count3_neon(char* dst, const char* src, size_t len,
107
+ char a, char b, char c,
108
+ size_t* ca, size_t* cb, size_t* cc);
109
+ size_t leptris_text_scan_events_neon(const char* buf, size_t len,
110
+ LeptrisScanEvent* events, size_t max);
111
+
93
112
  /* Append events for every structural byte to out (capacity max).
94
113
  * Returns the number of events written; returns max unchanged as
95
114
  * an overflow signal (caller must detect return == max and treat
@@ -214,7 +214,6 @@ void leptris_copy_count3_neon(char* dst, const char* src, size_t len,
214
214
  * each bit appears once (no carries). */
215
215
  size_t leptris_text_scan_events_neon(const char* buf, size_t len,
216
216
  LeptrisScanEvent* out, size_t max) {
217
- extern void leptris_dp_class_table_init(void);
218
217
  leptris_dp_class_table_init();
219
218
  const uint8x16_t k_lt = vdupq_n_u8('<');
220
219
  const uint8x16_t k_gt = vdupq_n_u8('>');
@@ -12,6 +12,8 @@
12
12
  #include "../../include/leptris.h"
13
13
  #include "../leptris_internal.h"
14
14
  #include "common/port.h"
15
+ #include "memory/arena.h"
16
+ #include "dom/compact.h"
15
17
 
16
18
  /* Library version. Single source of truth; CMakeLists.txt should
17
19
  * keep this in sync with project(leptris VERSION ...). */
@@ -71,10 +73,6 @@ LEPTRIS_API void leptris_version_components(int* major, int* minor, int* patch)
71
73
  }
72
74
 
73
75
  LEPTRIS_API void leptris_thread_cleanup(void) {
74
- extern void leptris_xpath_drain_thread_caches(void);
75
- extern void leptris_root_doc_drain_thread_caches(void);
76
- extern void leptris_pool_drain_recycler(void);
77
- extern void leptris_arena_retain_drain(void);
78
76
  leptris_xpath_drain_thread_caches();
79
77
  leptris_root_doc_drain_thread_caches();
80
78
  leptris_pool_drain_recycler();
@@ -155,7 +153,6 @@ LEPTRIS_API int leptris_document_get_strict(LeptrisDocument doc) {
155
153
  }
156
154
 
157
155
  LEPTRIS_API void leptris_explicit_cleanup(void) {
158
- extern void leptris_compact_cleanup(void);
159
156
  leptris_compact_cleanup();
160
157
  }
161
158