leptris 1.9.222.2 → 1.9.222.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
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 65c927a5db55dcad7c2b10b3eb7f4dc568cddd7e9c1762693a19697b9e4adaf7
|
|
4
|
+
data.tar.gz: 472acbd73babf9608170f2f1f5d439d39e0dd97594034364db22cd5bacb94c21
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: fc9fb646488eade1050dbd2bb32cb88d94bf1df6858480480fc5f6b7aabe333225b689e72311483682367fe44f0bbbfbaa8624af2d65b91e4c88d963c24d896d
|
|
7
|
+
data.tar.gz: 56075f78ab3fff389106a27c819967de112b80dbbafdaab83d6e0cc8ba56c8d9993b1984a74f69ca8e16ab40eeda57938a040b439f14941a4778dfffe64bd18b
|
data/ext/leptris/native/native.c
CHANGED
|
@@ -135,6 +135,9 @@ static VALUE c_iteration_scope;
|
|
|
135
135
|
static VALUE c_leptris_error;
|
|
136
136
|
static VALUE c_b_document, c_b_freed, c_ffi_pointer;
|
|
137
137
|
static ID id_ptr_new, id_freed_new, id_alive;
|
|
138
|
+
static ID id_iv_c_address, id_iv_document, id_iv_parent;
|
|
139
|
+
static ID id_iv_structure_memoizable, id_iv_native_fast;
|
|
140
|
+
static ID id_iv_pub_document, id_iv_addr_reads_fast, id_iv_node_type;
|
|
138
141
|
static void check_status_c(int st);
|
|
139
142
|
|
|
140
143
|
#define NT_ELEMENT 0
|
|
@@ -839,8 +842,38 @@ struct trav_state {
|
|
|
839
842
|
VALUE err;
|
|
840
843
|
void *self_ptr;
|
|
841
844
|
int for_visit;
|
|
845
|
+
/* Hoisted per-walk state (was re-resolved per node): the
|
|
846
|
+
* document's wrapper cache and the iteration-scope class
|
|
847
|
+
* check. #312 item 1. */
|
|
848
|
+
VALUE cache;
|
|
849
|
+
VALUE klass_memo_flag;
|
|
842
850
|
};
|
|
843
851
|
|
|
852
|
+
/* Construct-or-fetch the binding wrapper for node_ptr against the
|
|
853
|
+
* per-walk hoisted cache (#312 item 1): static-ID ivar writes (no
|
|
854
|
+
* per-call string interning), the scope class check precomputed. */
|
|
855
|
+
static VALUE trav_wrapper_for(struct trav_state *st, void *node_ptr,
|
|
856
|
+
int kind)
|
|
857
|
+
{
|
|
858
|
+
VALUE key = ULL2NUM((uint64_t)(uintptr_t)node_ptr);
|
|
859
|
+
VALUE node = rb_hash_aref(st->cache, key);
|
|
860
|
+
if (!NIL_P(node)) return node;
|
|
861
|
+
|
|
862
|
+
node = rb_obj_alloc(binding_klass_for(kind));
|
|
863
|
+
rb_ivar_set(node, id_iv_c_address, key);
|
|
864
|
+
rb_ivar_set(node, id_iv_document, st->document);
|
|
865
|
+
rb_ivar_set(node, id_iv_parent, Qnil);
|
|
866
|
+
VALUE fast = st->klass_memo_flag;
|
|
867
|
+
rb_ivar_set(node, id_iv_structure_memoizable, fast);
|
|
868
|
+
rb_ivar_set(node, id_iv_native_fast, fast);
|
|
869
|
+
rb_ivar_set(node, id_iv_pub_document,
|
|
870
|
+
fast == Qtrue ? st->document : Qnil);
|
|
871
|
+
rb_ivar_set(node, id_iv_addr_reads_fast, Qtrue);
|
|
872
|
+
rb_ivar_set(node, id_iv_node_type, INT2FIX(kind));
|
|
873
|
+
rb_hash_aset(st->cache, key, node);
|
|
874
|
+
return node;
|
|
875
|
+
}
|
|
876
|
+
|
|
844
877
|
static VALUE trav_yield_one(VALUE arg)
|
|
845
878
|
{
|
|
846
879
|
return rb_yield(arg);
|
|
@@ -849,33 +882,13 @@ static VALUE trav_yield_one(VALUE arg)
|
|
|
849
882
|
static int trav_cb(void *node_ptr, void *user)
|
|
850
883
|
{
|
|
851
884
|
struct trav_state *st = user;
|
|
852
|
-
VALUE
|
|
885
|
+
VALUE node;
|
|
853
886
|
int kind, state;
|
|
854
887
|
|
|
855
888
|
if (st->err != Qnil)
|
|
856
889
|
return 1;
|
|
857
890
|
kind = f_node_type(node_ptr);
|
|
858
|
-
|
|
859
|
-
key = ULL2NUM((uint64_t)(uintptr_t)node_ptr);
|
|
860
|
-
node = rb_hash_aref(cache, key);
|
|
861
|
-
if (NIL_P(node)) {
|
|
862
|
-
node = rb_obj_alloc(binding_klass_for(kind));
|
|
863
|
-
rb_iv_set(node, "@c_address", key);
|
|
864
|
-
rb_iv_set(node, "@document", st->document);
|
|
865
|
-
rb_iv_set(node, "@parent", Qnil);
|
|
866
|
-
if (rb_obj_class(st->document) == c_iteration_scope) {
|
|
867
|
-
rb_iv_set(node, "@structure_memoizable", Qfalse);
|
|
868
|
-
rb_iv_set(node, "@native_fast", Qfalse);
|
|
869
|
-
rb_iv_set(node, "@pub_document", Qnil);
|
|
870
|
-
} else {
|
|
871
|
-
rb_iv_set(node, "@structure_memoizable", Qtrue);
|
|
872
|
-
rb_iv_set(node, "@native_fast", Qtrue);
|
|
873
|
-
rb_iv_set(node, "@pub_document", st->document);
|
|
874
|
-
}
|
|
875
|
-
rb_iv_set(node, "@addr_reads_fast", Qtrue);
|
|
876
|
-
rb_iv_set(node, "@node_type", INT2FIX(kind));
|
|
877
|
-
rb_hash_aset(cache, key, node);
|
|
878
|
-
}
|
|
891
|
+
node = trav_wrapper_for(st, node_ptr, kind);
|
|
879
892
|
rb_protect(trav_yield_one, node, &state);
|
|
880
893
|
if (state) {
|
|
881
894
|
st->err = rb_errinfo();
|
|
@@ -894,6 +907,9 @@ static VALUE nf_traverse_binding(VALUE self, VALUE document,
|
|
|
894
907
|
st.document = document;
|
|
895
908
|
st.err = Qnil;
|
|
896
909
|
st.self_ptr = (void *)(uintptr_t)NUM2ULL(addr);
|
|
910
|
+
st.cache = binding_cache_of(document);
|
|
911
|
+
st.klass_memo_flag =
|
|
912
|
+
rb_obj_class(document) == c_iteration_scope ? Qfalse : Qtrue;
|
|
897
913
|
st.for_visit = 0;
|
|
898
914
|
f_node_traverse(st.self_ptr, 1 /* TRAVERSE_POST_ORDER */,
|
|
899
915
|
trav_cb, &st);
|
|
@@ -922,33 +938,13 @@ static void visit_cb(void *user, void *node_ptr, int entering,
|
|
|
922
938
|
* happens after the walk, same observable outcome. */
|
|
923
939
|
struct trav_state *st = user;
|
|
924
940
|
struct visit_yield_args va;
|
|
925
|
-
VALUE
|
|
941
|
+
VALUE node;
|
|
926
942
|
int kind, state;
|
|
927
943
|
|
|
928
944
|
if (st->err != Qnil)
|
|
929
945
|
return;
|
|
930
946
|
kind = f_node_type(node_ptr);
|
|
931
|
-
|
|
932
|
-
key = ULL2NUM((uint64_t)(uintptr_t)node_ptr);
|
|
933
|
-
node = rb_hash_aref(cache, key);
|
|
934
|
-
if (NIL_P(node)) {
|
|
935
|
-
node = rb_obj_alloc(binding_klass_for(kind));
|
|
936
|
-
rb_iv_set(node, "@c_address", key);
|
|
937
|
-
rb_iv_set(node, "@document", st->document);
|
|
938
|
-
rb_iv_set(node, "@parent", Qnil);
|
|
939
|
-
if (rb_obj_class(st->document) == c_iteration_scope) {
|
|
940
|
-
rb_iv_set(node, "@structure_memoizable", Qfalse);
|
|
941
|
-
rb_iv_set(node, "@native_fast", Qfalse);
|
|
942
|
-
rb_iv_set(node, "@pub_document", Qnil);
|
|
943
|
-
} else {
|
|
944
|
-
rb_iv_set(node, "@structure_memoizable", Qtrue);
|
|
945
|
-
rb_iv_set(node, "@native_fast", Qtrue);
|
|
946
|
-
rb_iv_set(node, "@pub_document", st->document);
|
|
947
|
-
}
|
|
948
|
-
rb_iv_set(node, "@addr_reads_fast", Qtrue);
|
|
949
|
-
rb_iv_set(node, "@node_type", INT2FIX(kind));
|
|
950
|
-
rb_hash_aset(cache, key, node);
|
|
951
|
-
}
|
|
947
|
+
node = trav_wrapper_for(st, node_ptr, kind);
|
|
952
948
|
va.node = node;
|
|
953
949
|
va.entering = entering ? Qtrue : Qfalse;
|
|
954
950
|
va.depth = INT2NUM(depth);
|
|
@@ -966,6 +962,9 @@ static VALUE nf_visit_binding(VALUE self, VALUE document, VALUE addr)
|
|
|
966
962
|
st.document = document;
|
|
967
963
|
st.err = Qnil;
|
|
968
964
|
st.self_ptr = (void *)(uintptr_t)NUM2ULL(addr);
|
|
965
|
+
st.cache = binding_cache_of(document);
|
|
966
|
+
st.klass_memo_flag =
|
|
967
|
+
rb_obj_class(document) == c_iteration_scope ? Qfalse : Qtrue;
|
|
969
968
|
st.for_visit = 1;
|
|
970
969
|
f_node_visit(st.self_ptr, visit_cb, &st);
|
|
971
970
|
if (st.err != Qnil)
|
|
@@ -2648,6 +2647,14 @@ LEPTRIS_INIT_EXPORT void Init_native(void)
|
|
|
2648
2647
|
id_iv_c_address = rb_intern("@c_address");
|
|
2649
2648
|
id_iv_native_cache = rb_intern("@native_cache");
|
|
2650
2649
|
id_iv_binding_cache = rb_intern("@wrapper_cache");
|
|
2650
|
+
id_iv_c_address = rb_intern("@c_address");
|
|
2651
|
+
id_iv_document = rb_intern("@document");
|
|
2652
|
+
id_iv_parent = rb_intern("@parent");
|
|
2653
|
+
id_iv_structure_memoizable = rb_intern("@structure_memoizable");
|
|
2654
|
+
id_iv_native_fast = rb_intern("@native_fast");
|
|
2655
|
+
id_iv_pub_document = rb_intern("@pub_document");
|
|
2656
|
+
id_iv_addr_reads_fast = rb_intern("@addr_reads_fast");
|
|
2657
|
+
id_iv_node_type = rb_intern("@node_type");
|
|
2651
2658
|
id_iv_version = rb_intern("@version");
|
|
2652
2659
|
id_iv_readonly = rb_intern("@readonly");
|
|
2653
2660
|
id_address = rb_intern("address");
|
|
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.222.
|
|
4
|
+
version: 1.9.222.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-09-
|
|
11
|
+
date: 2026-09-23 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: ffi
|