yeptris 0.3.0.1-aarch64-linux → 0.4.0.1-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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4639faf83e98440ebb4973f881db719fb6629ccbf7949f8bed6052e5be53184a
4
- data.tar.gz: a0b7ed9983184783e89a590cc317b147c6eb41e39ab6801c41dd744391573020
3
+ metadata.gz: b0564531041910fb120994e2f4cac8c9f3ddf0b176bf5ae9ca3289cb58f6ac87
4
+ data.tar.gz: 4b6da94d1b0706fdfdd597bc173ca9556e26482a517b391670ef2bb1471f17df
5
5
  SHA512:
6
- metadata.gz: 775dd41728fd5171efb2a0e895498a7c2f98dc6cba9c68c0593c476d3b320c0a17e0f9d83efe69bae90b5cadcce53ab8c516d54eb0478065095aa6a2f37f802c
7
- data.tar.gz: e11d2650357819532da00d1749b1fcfda1d948886f9d445b106b9eba22dab88ec4d688daab5bb0ca921500d9ca1eadf1fdec8ae8511a4287506c74822f53ba28
6
+ metadata.gz: 47c6f2bfe6920039b2e2e0a69f84688cac61bd11e61df76d1f9ec39ccfad227ff5a831b0b7bdbc644829c8dd364bd4b112b7b54183758dee182f66f325371350
7
+ data.tar.gz: 1e7e5b9bbe7b38b3db23b7c16bf03f3981178f6e52f2db99e091a5560c21c2a98a50823b9598bbeb4d93bb14302c34a3f1e5e2fe97eb0de5c3b8c6ac873cc36f
@@ -0,0 +1,41 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Builds the native materializer DLL for the CURRENT Ruby and
4
+ # installs it under its minor-versioned name
5
+ # (lib/yeptris/native-<major.minor>.so).
6
+ #
7
+ # The leptris-ruby Windows lesson (#207/#227): a PE DLL cannot
8
+ # resolve Ruby imports lazily — it must bind the build Ruby's
9
+ # x64-ucrt-rubyNNN.dll. One DLL per supported minor therefore ships
10
+ # in the Windows platform gems, and the loader in lib/yeptris.rb
11
+ # picks by RUBY_VERSION at require. Ruby 3.3 has no arm64 build:
12
+ # that cell ships no artifact and falls back loudly to the FFI
13
+ # ladder.
14
+ #
15
+ # Standalone by design: the release workflow runs this under each
16
+ # Ruby minor (3.3/3.4/4.0) with no bundler context.
17
+
18
+ require "rbconfig"
19
+ require "fileutils"
20
+
21
+ root = File.expand_path("..", __dir__)
22
+ ext_dir = File.join(root, "ext", "yeptris_native")
23
+ minor = RUBY_VERSION[/\A\d+\.\d+/]
24
+
25
+ Dir.chdir(ext_dir) do
26
+ system(RbConfig.ruby, "extconf.rb") or abort "extconf failed under #{RUBY_VERSION}"
27
+ # mkmf's link binds the CURRENT Ruby's runtime DLL — exactly
28
+ # what the versioned naming is for.
29
+ success = system("make")
30
+ abort "make failed under #{RUBY_VERSION}" unless success
31
+ so = Dir.glob("native.{so,dll}").first
32
+ abort "native bundle not produced under #{RUBY_VERSION}" unless so
33
+ dest = File.join(root, "lib", "yeptris", "native-#{minor}.so")
34
+ # The artifact must reference only this minor's Ruby DLL.
35
+ imported = `strings #{so} 2>/dev/null`[/[a-z0-9-]*ruby\d{3,}\.dll/i]
36
+ if imported && !imported.include?("ruby#{minor.delete('.')}")
37
+ abort "#{so} imports #{imported} but was built under #{RUBY_VERSION} — refuse to mis-name it"
38
+ end
39
+ FileUtils.cp(so, dest)
40
+ puts "Installed native materializer for Ruby #{minor} -> #{dest} (#{imported || 'no ruby dll string found'})"
41
+ end
data/lib/yeptris/ffi.rb CHANGED
@@ -60,15 +60,19 @@ module Yeptris
60
60
  attach_function :yeptris_parse_json, %i[pointer size_t yeptris_status_out], :yeptris_document
61
61
 
62
62
  # The JSON tape (TODO.restructure/85; the JSON surface's load
63
- # engine — issue #81): ONE call, four bulk columns, spans borrow
63
+ # engine — issue #81): ONE call, three bulk columns, spans borrow
64
64
  # the caller's string (no arena copy, no second validating parse).
65
+ # v2 records: numbers are spans at parse; yeptris_tape_convert
66
+ # materializes them in one bulk call.
65
67
  class JsonTape < ::FFI::Struct
66
68
  layout :count, :size_t, :kinds, :pointer, :offs, :pointer,
67
- :lens, :pointer, :vals, :pointer, :int_min, :int64, :_block, :pointer
69
+ :lens, :pointer, :int_min, :int64, :_src, :pointer, :_srclen, :size_t,
70
+ :_block, :pointer
68
71
  end
69
72
 
70
73
  attach_function :yeptris_parse_json_tape, %i[pointer size_t pointer], :int
71
74
  attach_function :yeptris_tape_free, [:pointer], :void
75
+ attach_function :yeptris_tape_convert, %i[pointer size_t size_t pointer pointer], :size_t
72
76
 
73
77
  attach_function :yeptris_document_free, [:yeptris_document], :void
74
78
  attach_function :yeptris_document_count, [:yeptris_document], :size_t
data/lib/yeptris/json.rb CHANGED
@@ -46,13 +46,14 @@ module Yeptris
46
46
  # three, which is where medium/large throughput went).
47
47
  T_DOC = 0
48
48
  T_NULL = 1
49
- T_BOOL = 2
50
- T_INT = 3
51
- T_FLOAT = 4
52
- T_STR = 5
53
- T_SEQ_OPEN = 6
54
- T_MAP_OPEN = 7
55
- T_CLOSE = 8
49
+ T_TRUE = 2
50
+ T_FALSE = 3
51
+ T_INT = 4
52
+ T_FLOAT = 5
53
+ T_STR = 6
54
+ T_SEQ_OPEN = 7
55
+ T_MAP_OPEN = 8
56
+ T_CLOSE = 9
56
57
 
57
58
  # The tape keeps RAW string spans (escapes untouched — the C
58
59
  # contract); the walk decodes them here. The hot path (no
@@ -120,11 +121,16 @@ module Yeptris
120
121
  kinds = tape[:kinds].read_bytes(n).unpack("C*")
121
122
  offs = tape[:offs].read_bytes(n * 4).unpack("V*")
122
123
  lens = tape[:lens].read_bytes(n * 4).unpack("V*")
123
- raw = tape[:vals].read_bytes(n * 8)
124
- vals_i = raw.unpack("q<*")
125
- vals_f = raw.unpack("E*")
124
+ # v2: parse records number spans only — ONE bulk convert call
125
+ # materializes them (per-number FFI calls would sink the ladder)
126
+ ivp = ::FFI::MemoryPointer.new(:int64, n, true)
127
+ dvp = ::FFI::MemoryPointer.new(:double, n, true)
128
+ ::Yeptris::FFI.yeptris_tape_convert(tape, 0, n, ivp, dvp)
129
+ vals_i = ivp.read_bytes(n * 8).unpack("q<*")
130
+ vals_f = dvp.read_bytes(n * 8).unpack("E*")
126
131
  # any integer text beyond int64: every INT rebuilds from its span
127
- # (exact Bignum; JSON.parse parity)
132
+ # (exact Bignum; JSON.parse parity) — int_min is set by the
133
+ # convert call above
128
134
  exact_ints = !tape[:int_min].zero?
129
135
  utf8 = src.encoding == Encoding::UTF_8
130
136
 
@@ -169,9 +175,8 @@ module Yeptris
169
175
  v = vals_f[i]
170
176
  place(docs, stack, pending_key) { v }
171
177
  pending_key = nil
172
- when T_BOOL
173
- v = vals_i[i] == 1
174
- place(docs, stack, pending_key) { v }
178
+ when T_TRUE, T_FALSE # v2: the kind IS the value
179
+ place(docs, stack, pending_key) { kinds[i] == T_TRUE }
175
180
  pending_key = nil
176
181
  when T_NULL
177
182
  place(docs, stack, pending_key) { nil }
Binary file
data/lib/yeptris.rb CHANGED
@@ -3,7 +3,7 @@
3
3
  module Yeptris
4
4
  # The gem's version lives in the parent namespace's file — the last
5
5
  # internal require (yeptris/version) retired with it.
6
- VERSION = "0.3.0.1".freeze
6
+ VERSION = "0.4.0.1".freeze
7
7
  # The error hierarchy lives in THIS file (the parent namespace's
8
8
  # own file): nested constants do not trigger a parent-constant
9
9
  # autoload, and the law forbids internal requires — defining the
@@ -70,8 +70,21 @@ end
70
70
  # Optional C-API materializer (TODO.restructure/22): fused visit →
71
71
  # Ruby objects via the Ruby C API. Feature-detected — LoadError leaves
72
72
  # the FFI ladder (Marshal → columns → records) as the sole path.
73
+ # Windows names the artifact per Ruby minor (the leptris-ruby #207/
74
+ # #227 lesson): a PE DLL must bind its build Ruby's runtime, so one
75
+ # DLL per supported minor ships and RUBY_VERSION selects. A missing
76
+ # cell (Ruby 3.3 arm64 has no build) falls back LOUDLY to the ladder.
73
77
  begin
74
- require "yeptris/native"
75
- rescue LoadError
78
+ if Gem.win_platform?
79
+ require "yeptris/native-#{RUBY_VERSION[/\A\d+\.\d+/]}"
80
+ else
81
+ require "yeptris/native"
82
+ end
83
+ rescue LoadError => e
84
+ if Gem.win_platform?
85
+ warn "yeptris: no precompiled native materializer for Ruby " \
86
+ "#{RUBY_VERSION[/\A\d+\.\d+/]} on this platform " \
87
+ "(#{e.message}); the FFI ladder carries the load"
88
+ end
76
89
  # FFI ladder only
77
90
  end
data/libyeptris.so CHANGED
Binary file
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: yeptris
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0.1
4
+ version: 0.4.0.1
5
5
  platform: aarch64-linux
6
6
  authors:
7
7
  - Ribose Inc.
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2026-09-15 00:00:00.000000000 Z
11
+ date: 2026-09-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ffi
@@ -34,6 +34,7 @@ extensions: []
34
34
  extra_rdoc_files: []
35
35
  files:
36
36
  - README.adoc
37
+ - ext/build_windows_native.rb
37
38
  - ext/yeptris_native/extconf.rb
38
39
  - ext/yeptris_native/json_ruby.c
39
40
  - ext/yeptris_native/yeptris_native.c