leptris 1.9.412.1 → 1.9.412.3
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 +4 -4
- data/Rakefile +20 -1
- data/ext/leptris/native/extconf.rb +13 -1
- data/ext/leptris/native/native.c +96 -6
- data/lib/leptris/vendor/aarch64-linux/libleptris.so +0 -0
- data/lib/leptris/vendor/aarch64-linux-musl/libleptris.so +0 -0
- data/lib/leptris/vendor/arm-linux/libleptris.so +0 -0
- data/lib/leptris/vendor/arm-linux-musl/libleptris.so +0 -0
- data/lib/leptris/vendor/ppc64le-linux/libleptris.so +0 -0
- data/lib/leptris/vendor/s390x-linux-musl/libleptris.so +0 -0
- data/lib/leptris/vendor/x86_64-linux/libleptris.so +0 -0
- data/lib/leptris/vendor/x86_64-linux-musl/libleptris.so +0 -0
- data/lib/leptris/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 23754da81606e76e6815c12c8b77546c0783c05bb603d5420124fc1a3bc0b2ac
|
|
4
|
+
data.tar.gz: fd0891a2b1e2d9d50baee2d5502027824166b8aacba64ebbf68896bdef267edb
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 1215b67e2ef2289b06899397cf59d1793597e7fe411d64a5b07f4a7bb4fb642b2114c8b3f51e614ad73958bf7778a3cd292892f35107be01bb12949a99c4d530
|
|
7
|
+
data.tar.gz: 4e751fc8332cdfc223acd66d86904dd7b882aad66e51d2eafec4e9eb3526192552aa869c1188d13d7ec9a5d158eb0e1a91826ac0001ce613c5a53449ebd165ae
|
data/Rakefile
CHANGED
|
@@ -181,9 +181,28 @@ task :compile do
|
|
|
181
181
|
# 11.0 = the oldest macOS GitHub still hosts runners for;
|
|
182
182
|
# matches extconf.rb.
|
|
183
183
|
ENV["MACOSX_DEPLOYMENT_TARGET"] ||= "11.0" if RUBY_PLATFORM =~ /darwin/
|
|
184
|
+
# Linux: the vendored libutf8proc sits BESIDE libleptris in the gem's
|
|
185
|
+
# lib/ — resolve it by $ORIGIN, not by the build prefix's absolute
|
|
186
|
+
# RUNPATH and not by the ffi pre-load trick. The trick works on glibc
|
|
187
|
+
# and dyld (both reuse an already-loaded SONAME/install-name when
|
|
188
|
+
# resolving a later NEEDED entry) but NOT on musl, whose dependency
|
|
189
|
+
# search consults the filesystem paths only — the tebako musl smoke
|
|
190
|
+
# (packed-metanorma) failed exactly there: libleptris loaded, its
|
|
191
|
+
# libutf8proc.so.3 unfound. $ORIGIN is honored by glibc, musl, and
|
|
192
|
+
# any ELF loader; `-z origin` sets DF_ORIGIN for the loaders that
|
|
193
|
+
# gate on it. The `\$` survives Rake's `sh` (a shell).
|
|
194
|
+
# macOS keeps @rpath + the ffi pre-load (working, and $ORIGIN is not
|
|
195
|
+
# the macOS spelling); Windows has no rpath at all.
|
|
196
|
+
origin_rpath =
|
|
197
|
+
if RUBY_PLATFORM =~ /linux/
|
|
198
|
+
"-DCMAKE_SHARED_LINKER_FLAGS=-Wl,-z,origin -Wl,-rpath,\\$ORIGIN"
|
|
199
|
+
else
|
|
200
|
+
""
|
|
201
|
+
end
|
|
184
202
|
cmake_base =
|
|
185
203
|
"#{CMAKE_FLAGS.join(' ').sub('-DLEPTRIS_ENABLE_UTF8PROC=OFF', '-DLEPTRIS_ENABLE_UTF8PROC=ON')} " \
|
|
186
|
-
"-DCMAKE_PREFIX_PATH=#{u8_prefix} #{cflags.empty? ? '' : "-DCMAKE_C_FLAGS=#{cflags}"}"
|
|
204
|
+
"-DCMAKE_PREFIX_PATH=#{u8_prefix} #{cflags.empty? ? '' : "-DCMAKE_C_FLAGS=#{cflags}"} " \
|
|
205
|
+
"#{origin_rpath}".strip
|
|
187
206
|
|
|
188
207
|
# Two-stage PGO (engine CMake: LEPTRIS_ENABLE_PGO GENERATE/USE;
|
|
189
208
|
# measured ~20% CPU on the DOM parse path, v1.9.188 worktree A/B,
|
|
@@ -69,13 +69,25 @@ if !prebuilt && File.directory?(File.join(vendored, "libleptris")) &&
|
|
|
69
69
|
eng_src = File.join(vendored, "libleptris")
|
|
70
70
|
eng_bld = File.join(vendored, "libleptris-build")
|
|
71
71
|
FileUtils.mkpath(eng_bld)
|
|
72
|
+
# Linux: resolve the vendored libutf8proc by $ORIGIN (it installs
|
|
73
|
+
# BESIDE libleptris in the gem's lib/). glibc/dyld forgive the
|
|
74
|
+
# missing rpath through their soname/install-name reuse of the ffi
|
|
75
|
+
# pre-load; musl does not (its dependency search reads filesystem
|
|
76
|
+
# paths only). Array spawn: no shell, `$ORIGIN` passes literally.
|
|
77
|
+
origin_flags =
|
|
78
|
+
if RUBY_PLATFORM =~ /linux/
|
|
79
|
+
["-DCMAKE_SHARED_LINKER_FLAGS=-Wl,-z,origin -Wl,-rpath,$ORIGIN"]
|
|
80
|
+
else
|
|
81
|
+
[]
|
|
82
|
+
end
|
|
72
83
|
sh_ok.call("cmake", "-B", eng_bld, "-S", eng_src,
|
|
73
84
|
"-DCMAKE_BUILD_TYPE=Release",
|
|
74
85
|
"-DLEPTRIS_BUILD_SHARED=ON", "-DLEPTRIS_BUILD_STATIC=OFF",
|
|
75
86
|
"-DBUILD_TESTING=OFF", "-DLEPTRIS_BUILD_CLI=OFF",
|
|
76
87
|
"-DLEPTRIS_BUILD_BENCHMARKS=OFF", "-DLEPTRIS_BUILD_MAN_PAGES=OFF",
|
|
77
88
|
"-DLEPTRIS_ENABLE_UTF8PROC=ON",
|
|
78
|
-
"-DCMAKE_PREFIX_PATH=#{u8_pre}"
|
|
89
|
+
"-DCMAKE_PREFIX_PATH=#{u8_pre}",
|
|
90
|
+
*origin_flags)
|
|
79
91
|
sh_ok.call("cmake", "--build", eng_bld, "--config", "Release",
|
|
80
92
|
ENV.fetch("MAKEFLAGS", "-j4").split.first || "-j4")
|
|
81
93
|
built = Dir.glob(File.join(eng_bld, "**", "libleptris.{so,dylib,dll}")).first
|
data/ext/leptris/native/native.c
CHANGED
|
@@ -183,6 +183,7 @@ static VALUE c_sax_parser;
|
|
|
183
183
|
* C address and the caches in plain ivars, so the hot C faces skip
|
|
184
184
|
* rb_funcall dispatch entirely. */
|
|
185
185
|
static ID id_iv_c_address, id_iv_native_cache, id_iv_binding_cache;
|
|
186
|
+
static ID id_iv_token_cache;
|
|
186
187
|
static ID id_iv_version, id_iv_readonly, id_address;
|
|
187
188
|
static ID id_iv_nn_content, id_iv_nn_content_ver;
|
|
188
189
|
static ID id_iv_nn_attrs, id_iv_nn_attrs_ver;
|
|
@@ -864,6 +865,85 @@ static VALUE native_cache_of(VALUE document)
|
|
|
864
865
|
return cache;
|
|
865
866
|
}
|
|
866
867
|
|
|
868
|
+
/* #603 ask 2: the token lane. A SECOND address-keyed cache on the
|
|
869
|
+
* document holding frozen [addr, kind] pairs — identity views with
|
|
870
|
+
* no NativeNode TypedData, no klass injection, no wrapper
|
|
871
|
+
* lifecycle. Tokens key on the same raw addr Integers the native
|
|
872
|
+
* cache uses, so a token and a native for one address are two
|
|
873
|
+
* views of one identity (equality by address); a consumer holds
|
|
874
|
+
* tokens across calls and resolves reads through the address-keyed
|
|
875
|
+
* faces. Lifecycle matches native_cache: the hash lives on the
|
|
876
|
+
* document and dies with it. */
|
|
877
|
+
static VALUE token_cache_of(VALUE document)
|
|
878
|
+
{
|
|
879
|
+
VALUE cache = rb_ivar_get(document, id_iv_token_cache);
|
|
880
|
+
if (NIL_P(cache)) {
|
|
881
|
+
cache = rb_hash_new();
|
|
882
|
+
rb_ivar_set(document, id_iv_token_cache, cache);
|
|
883
|
+
}
|
|
884
|
+
return cache;
|
|
885
|
+
}
|
|
886
|
+
|
|
887
|
+
static VALUE token_for(VALUE cache, uint64_t addr, int kind)
|
|
888
|
+
{
|
|
889
|
+
VALUE key = ULL2NUM(addr);
|
|
890
|
+
VALUE tok = rb_hash_aref(cache, key);
|
|
891
|
+
if (NIL_P(tok)) {
|
|
892
|
+
tok = rb_ary_new3(2, key, INT2NUM(kind));
|
|
893
|
+
rb_obj_freeze(tok);
|
|
894
|
+
rb_hash_aset(cache, key, tok);
|
|
895
|
+
}
|
|
896
|
+
return tok;
|
|
897
|
+
}
|
|
898
|
+
|
|
899
|
+
/* The walk_addresses walk minus the names column — same preorder,
|
|
900
|
+
* same kind classification, no name materialization. */
|
|
901
|
+
static void tokens_walk_impl(void *node, VALUE addrs, VALUE kinds)
|
|
902
|
+
{
|
|
903
|
+
int kind = f_node_type(node);
|
|
904
|
+
void *c;
|
|
905
|
+
|
|
906
|
+
if (kind == WS_NODE_ELEMENT) {
|
|
907
|
+
rb_ary_push(addrs, ULL2NUM((uint64_t)(uintptr_t)node));
|
|
908
|
+
rb_ary_push(kinds, INT2NUM(kind));
|
|
909
|
+
for (c = f_first_child(node); c; c = f_next_sibling(c)) {
|
|
910
|
+
tokens_walk_impl(c, addrs, kinds);
|
|
911
|
+
}
|
|
912
|
+
} else if (kind == WS_NODE_TEXT || kind == WS_NODE_COMMENT ||
|
|
913
|
+
kind == WS_NODE_CDATA || kind == WS_NODE_PI) {
|
|
914
|
+
rb_ary_push(addrs, ULL2NUM((uint64_t)(uintptr_t)node));
|
|
915
|
+
rb_ary_push(kinds, INT2NUM(kind));
|
|
916
|
+
} else if (kind == WS_NODE_DOCTYPE || kind == 9 /* DOCUMENT */) {
|
|
917
|
+
for (c = f_first_child(node); c; c = f_next_sibling(c)) {
|
|
918
|
+
tokens_walk_impl(c, addrs, kinds);
|
|
919
|
+
}
|
|
920
|
+
}
|
|
921
|
+
}
|
|
922
|
+
|
|
923
|
+
/* ONE C-side walk returning [addrs, kinds, tokens]: the token-lane
|
|
924
|
+
* entry for the moxml consumer — no per-parent children_addrs
|
|
925
|
+
* crossing, no TypedData mint, identity held across calls through
|
|
926
|
+
* the token cache. */
|
|
927
|
+
static VALUE nf_children_tokens(VALUE self, VALUE root)
|
|
928
|
+
{
|
|
929
|
+
struct native_node *n;
|
|
930
|
+
VALUE addrs, kinds, tokens, cache;
|
|
931
|
+
long i;
|
|
932
|
+
(void)self;
|
|
933
|
+
TypedData_Get_Struct(root, struct native_node, &nn_type, n);
|
|
934
|
+
addrs = rb_ary_new();
|
|
935
|
+
kinds = rb_ary_new();
|
|
936
|
+
tokens_walk_impl(n->ptr, addrs, kinds);
|
|
937
|
+
tokens = rb_ary_new();
|
|
938
|
+
cache = token_cache_of(n->document);
|
|
939
|
+
for (i = 0; i < RARRAY_LEN(addrs); i++) {
|
|
940
|
+
uint64_t addr = NUM2ULL(rb_ary_entry(addrs, i));
|
|
941
|
+
int kind = NUM2INT(rb_ary_entry(kinds, i));
|
|
942
|
+
rb_ary_push(tokens, token_for(cache, addr, kind));
|
|
943
|
+
}
|
|
944
|
+
return rb_ary_new3(3, addrs, kinds, tokens);
|
|
945
|
+
}
|
|
946
|
+
|
|
867
947
|
static VALUE binding_cache_of(VALUE document)
|
|
868
948
|
{
|
|
869
949
|
VALUE cache = rb_ivar_get(document, id_iv_binding_cache);
|
|
@@ -2798,8 +2878,12 @@ static VALUE nf_walk_columnar(VALUE self, VALUE root)
|
|
|
2798
2878
|
* unchanged. This is the shadow-binding read half: Ruby objects
|
|
2799
2879
|
* exist only where the consumer holds state, never per visited
|
|
2800
2880
|
* node. */
|
|
2881
|
+
/* #603 ask 1: the walk carries a fourth kinds column — the
|
|
2882
|
+
* f_node_type ints (0 element, 1 text, 2 comment, 3 cdata, 4 pi) —
|
|
2883
|
+
* so a token-backed consumer classifies the nil-name rows without
|
|
2884
|
+
* a second children_addrs crossing per parent. */
|
|
2801
2885
|
static void walk_addresses_impl(void *node, int depth, VALUE names,
|
|
2802
|
-
VALUE addrs, VALUE depths)
|
|
2886
|
+
VALUE addrs, VALUE depths, VALUE kinds)
|
|
2803
2887
|
{
|
|
2804
2888
|
int kind = f_node_type(node);
|
|
2805
2889
|
void *c;
|
|
@@ -2812,17 +2896,19 @@ static void walk_addresses_impl(void *node, int depth, VALUE names,
|
|
|
2812
2896
|
: Qnil);
|
|
2813
2897
|
rb_ary_push(addrs, ULL2NUM((uint64_t)(uintptr_t)node));
|
|
2814
2898
|
rb_ary_push(depths, INT2NUM(depth));
|
|
2899
|
+
rb_ary_push(kinds, INT2NUM(kind));
|
|
2815
2900
|
for (c = f_first_child(node); c; c = f_next_sibling(c)) {
|
|
2816
|
-
walk_addresses_impl(c, depth + 1, names, addrs, depths);
|
|
2901
|
+
walk_addresses_impl(c, depth + 1, names, addrs, depths, kinds);
|
|
2817
2902
|
}
|
|
2818
2903
|
} else if (kind == WS_NODE_TEXT || kind == WS_NODE_COMMENT ||
|
|
2819
2904
|
kind == WS_NODE_CDATA || kind == WS_NODE_PI) {
|
|
2820
2905
|
rb_ary_push(names, Qnil);
|
|
2821
2906
|
rb_ary_push(addrs, ULL2NUM((uint64_t)(uintptr_t)node));
|
|
2822
2907
|
rb_ary_push(depths, INT2NUM(depth));
|
|
2908
|
+
rb_ary_push(kinds, INT2NUM(kind));
|
|
2823
2909
|
} else if (kind == WS_NODE_DOCTYPE || kind == 9 /* DOCUMENT */) {
|
|
2824
2910
|
for (c = f_first_child(node); c; c = f_next_sibling(c)) {
|
|
2825
|
-
walk_addresses_impl(c, depth, names, addrs, depths);
|
|
2911
|
+
walk_addresses_impl(c, depth, names, addrs, depths, kinds);
|
|
2826
2912
|
}
|
|
2827
2913
|
}
|
|
2828
2914
|
}
|
|
@@ -2830,14 +2916,15 @@ static void walk_addresses_impl(void *node, int depth, VALUE names,
|
|
|
2830
2916
|
static VALUE nf_walk_addresses(VALUE self, VALUE root)
|
|
2831
2917
|
{
|
|
2832
2918
|
struct native_node *n;
|
|
2833
|
-
VALUE names, addrs, depths;
|
|
2919
|
+
VALUE names, addrs, depths, kinds;
|
|
2834
2920
|
(void)self;
|
|
2835
2921
|
TypedData_Get_Struct(root, struct native_node, &nn_type, n);
|
|
2836
2922
|
names = rb_ary_new();
|
|
2837
2923
|
addrs = rb_ary_new();
|
|
2838
2924
|
depths = rb_ary_new();
|
|
2839
|
-
|
|
2840
|
-
|
|
2925
|
+
kinds = rb_ary_new();
|
|
2926
|
+
walk_addresses_impl(n->ptr, 0, names, addrs, depths, kinds);
|
|
2927
|
+
return rb_ary_new3(4, names, addrs, depths, kinds);
|
|
2841
2928
|
}
|
|
2842
2929
|
|
|
2843
2930
|
/* ---- Raw child addresses (leptris-ruby#587 shadow lane) ----------
|
|
@@ -4149,6 +4236,7 @@ static void leptris_native_setup(void)
|
|
|
4149
4236
|
id_iv_element = rb_intern("@element");
|
|
4150
4237
|
id_iv_c_address = rb_intern("@c_address");
|
|
4151
4238
|
id_iv_native_cache = rb_intern("@native_cache");
|
|
4239
|
+
id_iv_token_cache = rb_intern("@token_cache");
|
|
4152
4240
|
id_iv_binding_cache = rb_intern("@wrapper_cache");
|
|
4153
4241
|
id_iv_c_address = rb_intern("@c_address");
|
|
4154
4242
|
id_iv_document = rb_intern("@document");
|
|
@@ -4316,6 +4404,8 @@ static void leptris_native_setup(void)
|
|
|
4316
4404
|
nf_snapshot_rows, 2);
|
|
4317
4405
|
rb_define_module_function(m_native, "walk_columnar",
|
|
4318
4406
|
nf_walk_columnar, 1);
|
|
4407
|
+
rb_define_module_function(m_native, "children_tokens",
|
|
4408
|
+
nf_children_tokens, 1);
|
|
4319
4409
|
rb_define_module_function(m_native, "walk_addresses",
|
|
4320
4410
|
nf_walk_addresses, 1);
|
|
4321
4411
|
rb_define_module_function(m_native, "children_addrs",
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
data/lib/leptris/version.rb
CHANGED
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.412.
|
|
4
|
+
version: 1.9.412.3
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Ribose Inc.
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2026-11-
|
|
11
|
+
date: 2026-11-07 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: ffi
|