leptris 1.9.197.0 → 1.9.197.2

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: 1fe0d9ad19af1ea0312a5a04daf2f3fededf7c630490ebcf337bd231c5e86f76
4
- data.tar.gz: 69ba7d9ba6b929220068d310d98e06e42480764828f023ed981b4f6625adb193
3
+ metadata.gz: 8de0724486489f72c2c7e2443165f3800ecf9d6c2982eb3a246dd3cd6ab6e70f
4
+ data.tar.gz: cfad76439cb742b582a4afa79e1ab029db61073843e5443a5c1d8250ee43c65e
5
5
  SHA512:
6
- metadata.gz: 4eb77398a80e630172e14fe9d4ae3cbed2dc0416d3b6f6ed5d2343b394eb24477e9b824d8cfa5d18cdcc61cc2788d812de9b9ea533bf15a34f7478c51882aee7
7
- data.tar.gz: 2a10f88e73dceb1ae6b48bb3aeacd8f5f696d54cbb5906acece5d2dac19c81925742b575f42a51a5a5eab750981fa4e9691570359cfa7dafd97c617b5adefff8
6
+ metadata.gz: c545ac6185a58d3628c4abbf9312a1fa54cf58878b357f6cabc64e1d84bb2624e15711872dea4d939b822a040fcbf3f753fc5c30186a393a3ecabe44d0043194
7
+ data.tar.gz: cf7246e381117269bad72dbb6213533d849f05b2573e5c611535a2826251c4d8f1f25e1c72a9381b179b7a4bd7656a0e41ca7caee5467ed2fc14563ec97636b6
data/CHANGELOG.md CHANGED
@@ -5,6 +5,35 @@ All notable changes to Leptris will be documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/1.0.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [1.9.199.0] - 2026-09-19
9
+
10
+ ### Changed — libleptris 1.9.197 → 1.9.199 (lockstep; 1.9.198/199
11
+ released before this gem, entries folded)
12
+
13
+ - **The 32-bit port shipped (upstream #1174 closed)** — per-wordsize
14
+ layout pins replace the 64-bit-only ABI asserts, xsl:number values
15
+ are 64-bit end to end (ILP32 truncation fixed), and SSE2 paths
16
+ gate on `__SSE2__` rather than x86-ness. **The `arm-linux` and
17
+ `arm-linux-musl` platform gems compile for the first time** —
18
+ their release legs (experimental, with in-container install +
19
+ round-trip smoke) validate the port directly.
20
+ - **The root_doc_map TLS memo no longer resolves
21
+ namebp-carrying elements** (1.9.198, leptris/leptris#1189,
22
+ closed) — upstream adopted exactly the one-line guard filed from
23
+ our ubuntu-3.4 CI investigation: a recycled root address no
24
+ longer makes `set_root` mis-reject a same-document attach as
25
+ "cross-document". The seam_and_reads spec that exposed it runs
26
+ green across the full grid, deterministically.
27
+ - HTML: memchr prefilter in the raw-text close-tag scan; 256-entry
28
+ LUT for the attribute-name scan (#1177).
29
+ - `leptris validate --dtd` + DTD content-model fixes (cli; the
30
+ binding's DTD surface unchanged).
31
+ - Still experimental pending upstream: ppc64le (LTO export
32
+ internalization, #1196 — the no-LTO release build ships working
33
+ gems) and s390x big-endian parser (#1197/#1194, engine work
34
+ in progress upstream).
35
+ - No public-symbol changes: audit 323/323. 727/0 both modes.
36
+
8
37
  ## [1.9.197.0] - 2026-09-18
9
38
 
10
39
  ### Changed — libleptris 1.9.194 → 1.9.197 (lockstep)
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.197"
11
+ LIBLEPTRIS_VERSION = "1.9.199"
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
@@ -128,6 +128,12 @@ task :compile do
128
128
  # LEPTRIS_PGO=0 escapes to the single-stage build.
129
129
  pgo = ENV["LEPTRIS_PGO"] != "0" && !Gem.win_platform?
130
130
  if pgo
131
+ # The trainer is disposable infrastructure — an engine-side
132
+ # trainer break (e.g. leptris/leptris#1204: GCC LTO internalizes
133
+ # CLI-only API symbols and the CLI link dies) must degrade the
134
+ # gem to the plain build (loudly, with the issue pointer), not
135
+ # block every platform's release.
136
+ begin
131
137
  # _GNU_SOURCE for the TRAIN build only: the CLI (the trainer, not
132
138
  # built in normal gems) uses fileno, which musl hides without a
133
139
  # POSIX feature macro (glibc is lenient). Upstream fix pending in
@@ -168,6 +174,15 @@ task :compile do
168
174
  sh "cmake -B #{build}/build -S #{build} #{cmake_base} " \
169
175
  "-DLEPTRIS_BUILD_CLI=OFF -DLEPTRIS_ENABLE_PGO=USE"
170
176
  sh "cmake --build #{build}/build --config Release -j 4"
177
+ rescue => e
178
+ warn "leptris: PGO trainer failed (#{e.message.to_s[0, 160]}); " \
179
+ "shipping the single-stage build — the parse path loses the " \
180
+ "~20% PGO gain this release (leptris/leptris#1204 tracks the " \
181
+ "engine-side trainer break)"
182
+ rm_rf(File.join(build, "build"))
183
+ sh "cmake -B #{build}/build -S #{build} #{cmake_base}"
184
+ sh "cmake --build #{build}/build --config Release -j 4"
185
+ end
171
186
  else
172
187
  sh "cmake -B #{build}/build -S #{build} #{cmake_base}"
173
188
  sh "cmake --build #{build}/build --config Release -j 4"
@@ -1941,6 +1941,122 @@ static VALUE nf_snapshot_rows(VALUE self, VALUE document, VALUE addr)
1941
1941
  return out;
1942
1942
  }
1943
1943
 
1944
+ /* ---- Struct plan executor (moxml "miles faster" round) ------------
1945
+ * The consumer's shape compiles to spec: name (interned String) ->
1946
+ * [Struct class, attrs Hash (name -> slot Symbol), text slot Symbol
1947
+ * or nil, children slot Symbol or nil]. C walks the subtree
1948
+ * pre-order, mints typed structs directly (rb_struct_new +
1949
+ * rb_struct_aset), and attaches each to the nearest OPEN frame —
1950
+ * exactly Moxml::Plan's semantics: an unmatched element is a
1951
+ * barrier (its matched descendants surface at top level). Zero
1952
+ * Ruby frames and zero intermediate rows per element. */
1953
+ static void plan_walk(void *node, int depth, VALUE spec, VALUE stack,
1954
+ VALUE roots)
1955
+ {
1956
+ if (f_node_type(node) == WS_NODE_ELEMENT) {
1957
+ const char *name_c = f_elem_name(node);
1958
+ VALUE entry = name_c ? rb_hash_aref(spec,
1959
+ rb_enc_interned_str(name_c, strlen(name_c),
1960
+ rb_utf8_encoding()))
1961
+ : Qnil;
1962
+
1963
+ /* Complete deeper frames: pre-order means any open frame at
1964
+ * depth >= this element's depth belongs to an earlier
1965
+ * subtree that ended before this row. */
1966
+ while (RARRAY_LEN(stack) >= 2 &&
1967
+ NUM2INT(rb_ary_entry(stack, RARRAY_LEN(stack) - 2)) >=
1968
+ depth) {
1969
+ rb_ary_pop(stack);
1970
+ rb_ary_pop(stack);
1971
+ }
1972
+
1973
+ if (!NIL_P(entry)) {
1974
+ /* volatile: keep live VALUEs on the C stack so the
1975
+ * conservative scanner sees them on every ABI (windows
1976
+ * x64 keeps some only in callee-saved registers). */
1977
+ volatile VALUE klass = rb_ary_entry(entry, 0);
1978
+ volatile VALUE attrs_spec = rb_ary_entry(entry, 1);
1979
+ volatile VALUE text_slot = rb_ary_entry(entry, 2);
1980
+ volatile VALUE children_slot = rb_ary_entry(entry, 3);
1981
+ VALUE value = rb_struct_new(klass);
1982
+
1983
+ for (void *a = f_attr_first(node); a; a = f_attr_next(a)) {
1984
+ const char *an = f_attr_name(a);
1985
+ VALUE slot = an ? rb_hash_aref(attrs_spec,
1986
+ rb_enc_interned_str(an, strlen(an),
1987
+ rb_utf8_encoding()))
1988
+ : Qnil;
1989
+ if (!NIL_P(slot)) {
1990
+ const char *av = f_attr_value(node, a);
1991
+ rb_struct_aset(value, slot,
1992
+ av ? rb_utf8_str_new_cstr(av) : Qnil);
1993
+ }
1994
+ }
1995
+ if (!NIL_P(text_slot)) {
1996
+ void *c;
1997
+ for (c = f_first_child(node); c; c = f_next_sibling(c)) {
1998
+ if (f_node_type(c) == WS_NODE_TEXT) {
1999
+ const char *t = f_text_content(c);
2000
+ rb_struct_aset(value, text_slot,
2001
+ t ? rb_utf8_str_new_cstr(t) : Qnil);
2002
+ break;
2003
+ }
2004
+ }
2005
+ }
2006
+
2007
+ /* attach: nearest open frame carrying a children array;
2008
+ * barriers (unmatched ancestors) and the root surface
2009
+ * the value at top level — Moxml::Plan's contract. */
2010
+ if (RARRAY_LEN(stack) >= 2 &&
2011
+ rb_ary_entry(stack, RARRAY_LEN(stack) - 1) != Qnil) {
2012
+ rb_ary_push(rb_ary_entry(stack, RARRAY_LEN(stack) - 1),
2013
+ value);
2014
+ } else {
2015
+ rb_ary_push(roots, value);
2016
+ }
2017
+ RB_GC_GUARD(value);
2018
+ RB_GC_GUARD(entry);
2019
+
2020
+ if (!NIL_P(children_slot)) {
2021
+ VALUE children = rb_ary_new();
2022
+ rb_struct_aset(value, children_slot, children);
2023
+ rb_ary_push(stack, INT2NUM(depth));
2024
+ rb_ary_push(stack, children);
2025
+ }
2026
+ } else {
2027
+ /* unmatched: barrier frame — descendants must not
2028
+ * attach through it (Moxml::Plan parity). */
2029
+ rb_ary_push(stack, INT2NUM(depth));
2030
+ rb_ary_push(stack, Qnil);
2031
+ }
2032
+
2033
+ void *c;
2034
+ for (c = f_first_child(node); c; c = f_next_sibling(c)) {
2035
+ plan_walk(c, depth + 1, spec, stack, roots);
2036
+ }
2037
+ } else if (f_node_type(node) == WS_NODE_DOCTYPE ||
2038
+ f_node_type(node) == 9) {
2039
+ void *dc = f_first_child(node);
2040
+ while (dc) {
2041
+ plan_walk(dc, depth, spec, stack, roots);
2042
+ dc = f_next_sibling(dc);
2043
+ }
2044
+ }
2045
+ }
2046
+
2047
+ static VALUE nf_plan_structs(VALUE self, VALUE document, VALUE addr,
2048
+ VALUE spec)
2049
+ {
2050
+ (void)self;
2051
+ (void)document;
2052
+ VALUE roots = rb_ary_new();
2053
+ VALUE stack = rb_ary_new();
2054
+ plan_walk((void *)(uintptr_t)NUM2ULL(addr), 0, spec, stack, roots);
2055
+ RB_GC_GUARD(spec);
2056
+ RB_GC_GUARD(stack);
2057
+ return roots;
2058
+ }
2059
+
1944
2060
  /* ---- inner_html in one C pass (TODO.perf/18) --------------------
1945
2061
  * Serializes the receiver's children into one growable buffer:
1946
2062
  * elements via leptris_element_serialize_into (the same opts the
@@ -2490,6 +2606,8 @@ void Init_native(void)
2490
2606
  nf_snapshot_subtree, 2);
2491
2607
  rb_define_module_function(m_native, "snapshot_rows",
2492
2608
  nf_snapshot_rows, 2);
2609
+ rb_define_module_function(m_native, "plan_structs",
2610
+ nf_plan_structs, 3);
2493
2611
  rb_define_module_function(m_native, "doc_handle_attach",
2494
2612
  nf_doc_handle_attach, 1);
2495
2613
  rb_define_module_function(m_native, "doc_handle_release",
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Leptris
4
- VERSION = "1.9.197.0"
4
+ VERSION = "1.9.197.2"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: leptris
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.9.197.0
4
+ version: 1.9.197.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
@@ -144,6 +144,10 @@ files:
144
144
  - lib/leptris/vendor/aarch64-linux-musl/libutf8proc.so.3
145
145
  - lib/leptris/vendor/aarch64-linux/libleptris.so
146
146
  - lib/leptris/vendor/aarch64-linux/libutf8proc.so.3
147
+ - lib/leptris/vendor/arm-linux-musl/libleptris.so
148
+ - lib/leptris/vendor/arm-linux-musl/libutf8proc.so.3
149
+ - lib/leptris/vendor/arm-linux/libleptris.so
150
+ - lib/leptris/vendor/arm-linux/libutf8proc.so.3
147
151
  - lib/leptris/vendor/arm64-darwin/libleptris.dylib
148
152
  - lib/leptris/vendor/arm64-darwin/libutf8proc.3.dylib
149
153
  - lib/leptris/vendor/ppc64le-linux/libleptris.so