bootsnap 1.24.5 → 1.25.0
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/CHANGELOG.md +17 -0
- data/ext/bootsnap/bootsnap.c +14 -5
- data/lib/bootsnap/compile_cache/iseq.rb +9 -7
- data/lib/bootsnap/compile_cache/ruby_bug_22023_canary.rb +0 -6
- data/lib/bootsnap/compile_cache/yaml.rb +87 -42
- data/lib/bootsnap/version.rb +1 -1
- data/lib/bootsnap.rb +3 -0
- metadata +5 -8
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: e46c28f258eb76b8c90fa22a7fa2c83887695b7c12d3aff8dbbefda5051dca87
|
|
4
|
+
data.tar.gz: 33aaa301627c53d2f4db1b8e98db0b2f52dc8d20aa533c8de8dc9448bf0c0b8e
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 77f885b700f2d249da6afd6ed4a70e4b37bf27303ddabefdfbed915fea6e61587d3e0fa56ee5159a95416072d58d4994498ee29bf69a3ab70c3b9e98471c3a0a
|
|
7
|
+
data.tar.gz: 7044ce0c6a30d7312d947da11b20755dbd496ee7b5f460293bf9188c83493ac951e6e683f75009b17860c45a7ff31e3264abffd69dcaf5a0e8c6b759b7631332
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,22 @@
|
|
|
1
1
|
# Unreleased
|
|
2
2
|
|
|
3
|
+
# 1.25.0
|
|
4
|
+
|
|
5
|
+
* Improve YAML parsing cache to more efficiently handle `Time`, `Date` and `DateTime`.
|
|
6
|
+
|
|
7
|
+
* Don't invalidate the compile cache when YJIT is toggled. YJIT is a runtime JIT and doesn't change the
|
|
8
|
+
serialized instruction sequences that are cached, but enabling it (via `--yjit`, `RUBYOPT`, or
|
|
9
|
+
`RubyVM::YJIT.enable`) adds a ` +YJIT` marker to `RUBY_DESCRIPTION` (` +YJIT <token>` on `YJIT_SUPPORT`
|
|
10
|
+
builds), which is part of the cache key. This previously discarded the entire compile cache whenever YJIT
|
|
11
|
+
was enabled at runtime but not at precompile time (or vice versa). The marker is now stripped before hashing.
|
|
12
|
+
|
|
13
|
+
* Fix `CompileCache::Native.fetch` and `.precompile` reading a non-`String` path argument (e.g. a `Pathname`)
|
|
14
|
+
with `RSTRING_PTR`. Regression from 1.24.0.
|
|
15
|
+
|
|
16
|
+
# 1.24.6
|
|
17
|
+
|
|
18
|
+
* Fix detection of Ruby bug #22023 on some patch versions of Ruby 3.4, and properly apply the workaround.
|
|
19
|
+
|
|
3
20
|
# 1.24.5
|
|
4
21
|
|
|
5
22
|
* No longer load the config file by default when setup is done manually. This is so cli applications like homebrew
|
data/ext/bootsnap/bootsnap.c
CHANGED
|
@@ -79,7 +79,7 @@ struct bs_cache_key {
|
|
|
79
79
|
STATIC_ASSERT(sizeof(struct bs_cache_key) == KEY_SIZE);
|
|
80
80
|
|
|
81
81
|
/* Effectively a schema version. Bumping invalidates all previous caches */
|
|
82
|
-
static const uint32_t bootsnap_cache_version =
|
|
82
|
+
static const uint32_t bootsnap_cache_version = 8;
|
|
83
83
|
|
|
84
84
|
/* Invalidates cache when switching ruby version, platform or ABI */
|
|
85
85
|
static uint64_t base_ruby_version_digest = 0;
|
|
@@ -384,7 +384,7 @@ bs_compile_option_crc32_set(VALUE self, VALUE crc32_v)
|
|
|
384
384
|
static uint64_t
|
|
385
385
|
get_ruby_version_digest(void)
|
|
386
386
|
{
|
|
387
|
-
uint64_t hash = fnv1a_64_str(rb_const_get(
|
|
387
|
+
uint64_t hash = fnv1a_64_str(rb_const_get(rb_mBootsnap, rb_intern("RUBY_CACHE_KEY")));
|
|
388
388
|
hash = fnv1a_64_iter(hash, (unsigned char *)&bootsnap_cache_version, sizeof(bootsnap_cache_version));
|
|
389
389
|
return hash;
|
|
390
390
|
}
|
|
@@ -395,19 +395,24 @@ get_ruby_version_digest(void)
|
|
|
395
395
|
* be stored.
|
|
396
396
|
*
|
|
397
397
|
* The path will look something like: <cachedir>/12/34567890abcdef
|
|
398
|
+
*
|
|
399
|
+
* `path_v` must already have been through FilePathValue(): the callers read it
|
|
400
|
+
* with RSTRING_PTR() too, so the conversion has to happen in the frame that
|
|
401
|
+
* owns the variable.
|
|
398
402
|
*/
|
|
399
403
|
static void
|
|
400
404
|
bs_cache_path(VALUE cachedir_v, VALUE namespace_v, VALUE path_v, char (* cache_path)[MAX_CACHEPATH_SIZE])
|
|
401
405
|
{
|
|
402
|
-
FilePathValue(path_v);
|
|
403
|
-
|
|
404
406
|
Check_Type(cachedir_v, T_STRING);
|
|
405
407
|
Check_Type(path_v, T_STRING);
|
|
408
|
+
|
|
409
|
+
long namespace_len = 0;
|
|
406
410
|
if (!NIL_P(namespace_v)) {
|
|
407
411
|
Check_Type(namespace_v, T_STRING);
|
|
412
|
+
namespace_len = RSTRING_LEN(namespace_v);
|
|
408
413
|
}
|
|
409
414
|
|
|
410
|
-
if (RSTRING_LEN(cachedir_v) > MAX_CACHEDIR_SIZE) {
|
|
415
|
+
if (RSTRING_LEN(cachedir_v) + namespace_len > MAX_CACHEDIR_SIZE) {
|
|
411
416
|
rb_raise(rb_eArgError, "cachedir too long");
|
|
412
417
|
}
|
|
413
418
|
|
|
@@ -489,6 +494,8 @@ static void bs_cache_key_digest(struct bs_cache_key *key,
|
|
|
489
494
|
static VALUE
|
|
490
495
|
bs_rb_fetch(VALUE self, VALUE cachedir_v, VALUE namespace_v, VALUE path_v, VALUE handler, VALUE args)
|
|
491
496
|
{
|
|
497
|
+
FilePathValue(path_v);
|
|
498
|
+
|
|
492
499
|
char cache_path[MAX_CACHEPATH_SIZE];
|
|
493
500
|
|
|
494
501
|
/* generate cache path to cache_path */
|
|
@@ -505,6 +512,8 @@ bs_rb_fetch(VALUE self, VALUE cachedir_v, VALUE namespace_v, VALUE path_v, VALUE
|
|
|
505
512
|
static VALUE
|
|
506
513
|
bs_rb_precompile(VALUE self, VALUE cachedir_v, VALUE namespace_v, VALUE path_v, VALUE handler)
|
|
507
514
|
{
|
|
515
|
+
FilePathValue(path_v);
|
|
516
|
+
|
|
508
517
|
char cache_path[MAX_CACHEPATH_SIZE];
|
|
509
518
|
/* generate cache path to cache_path */
|
|
510
519
|
bs_cache_path(cachedir_v, namespace_v, path_v, &cache_path);
|
|
@@ -48,13 +48,15 @@ module Bootsnap
|
|
|
48
48
|
true
|
|
49
49
|
end
|
|
50
50
|
|
|
51
|
-
has_ruby_bug_22023 =
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
51
|
+
has_ruby_bug_22023 = case RUBY_VERSION
|
|
52
|
+
when /^3\.3\./
|
|
53
|
+
true
|
|
54
|
+
when /^3\.4\.(\d+)/
|
|
55
|
+
$1.to_i < 10
|
|
56
|
+
when /^4\.0\.(\d+)/
|
|
57
|
+
$1.to_i < 4
|
|
58
|
+
else
|
|
59
|
+
false
|
|
58
60
|
end
|
|
59
61
|
|
|
60
62
|
if has_ruby_bug_22023 && RUBY_DESCRIPTION.include?("+PRISM")
|
|
@@ -47,14 +47,6 @@ module Bootsnap
|
|
|
47
47
|
SUPPORTED_INTERNAL_ENCODINGS.include?(Encoding.default_internal)
|
|
48
48
|
end
|
|
49
49
|
|
|
50
|
-
module EncodingAwareSymbols
|
|
51
|
-
extend self
|
|
52
|
-
|
|
53
|
-
def unpack(payload)
|
|
54
|
-
(+payload).force_encoding(Encoding::UTF_8).to_sym
|
|
55
|
-
end
|
|
56
|
-
end
|
|
57
|
-
|
|
58
50
|
def init!
|
|
59
51
|
require "yaml"
|
|
60
52
|
require "msgpack"
|
|
@@ -86,28 +78,78 @@ module Bootsnap
|
|
|
86
78
|
0x00,
|
|
87
79
|
Symbol,
|
|
88
80
|
packer: :to_msgpack_ext,
|
|
89
|
-
unpacker:
|
|
81
|
+
unpacker: :from_msgpack_ext,
|
|
82
|
+
optimized_symbol_parsing: true,
|
|
90
83
|
)
|
|
91
84
|
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
)
|
|
85
|
+
factory.register_type(
|
|
86
|
+
MessagePack::Timestamp::TYPE, # or just -1
|
|
87
|
+
Time,
|
|
88
|
+
packer: MessagePack::Time::Packer,
|
|
89
|
+
unpacker: MessagePack::Time::Unpacker,
|
|
90
|
+
)
|
|
99
91
|
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
92
|
+
factory.register_type(
|
|
93
|
+
0x01,
|
|
94
|
+
Date,
|
|
95
|
+
packer: lambda { |date, packer|
|
|
96
|
+
packer.write(date.year)
|
|
97
|
+
packer.write(date.month)
|
|
98
|
+
packer.write(date.day)
|
|
99
|
+
},
|
|
100
|
+
unpacker: lambda { |unpacker|
|
|
101
|
+
::Date.new(unpacker.read, unpacker.read, unpacker.read)
|
|
102
|
+
},
|
|
103
|
+
recursive: true,
|
|
104
|
+
)
|
|
105
|
+
|
|
106
|
+
factory.register_type(
|
|
107
|
+
0x02,
|
|
108
|
+
Regexp,
|
|
109
|
+
packer: ->(value) { Marshal.dump(value) },
|
|
110
|
+
unpacker: ->(payload) { Marshal.load(payload) },
|
|
111
|
+
)
|
|
112
|
+
|
|
113
|
+
factory.register_type(
|
|
114
|
+
0x03,
|
|
115
|
+
DateTime,
|
|
116
|
+
packer: lambda { |dt, packer|
|
|
117
|
+
packer.write(dt.year)
|
|
118
|
+
packer.write(dt.month)
|
|
119
|
+
packer.write(dt.day)
|
|
120
|
+
packer.write(dt.hour)
|
|
121
|
+
packer.write(dt.minute)
|
|
122
|
+
|
|
123
|
+
sec = dt.sec + dt.sec_fraction
|
|
124
|
+
packer.write(sec.numerator)
|
|
125
|
+
packer.write(sec.denominator)
|
|
126
|
+
|
|
127
|
+
offset = dt.offset
|
|
128
|
+
packer.write(offset.numerator)
|
|
129
|
+
packer.write(offset.denominator)
|
|
130
|
+
},
|
|
131
|
+
unpacker: lambda { |unpacker|
|
|
132
|
+
::DateTime.new(
|
|
133
|
+
unpacker.read, # year
|
|
134
|
+
unpacker.read, # month
|
|
135
|
+
unpacker.read, # day
|
|
136
|
+
unpacker.read, # hour
|
|
137
|
+
unpacker.read, # minute
|
|
138
|
+
Rational(unpacker.read, unpacker.read), # sec fraction
|
|
139
|
+
Rational(unpacker.read, unpacker.read), # offset fraction
|
|
140
|
+
)
|
|
141
|
+
},
|
|
142
|
+
recursive: true,
|
|
143
|
+
)
|
|
144
|
+
|
|
145
|
+
require "msgpack/bigint"
|
|
146
|
+
factory.register_type(
|
|
147
|
+
0x04,
|
|
148
|
+
Integer,
|
|
149
|
+
packer: MessagePack::Bigint.method(:to_msgpack_ext),
|
|
150
|
+
unpacker: MessagePack::Bigint.method(:from_msgpack_ext),
|
|
151
|
+
oversized_integer_extension: true,
|
|
152
|
+
)
|
|
111
153
|
|
|
112
154
|
self.msgpack_factory = factory
|
|
113
155
|
|
|
@@ -116,7 +158,7 @@ module Bootsnap
|
|
|
116
158
|
if params.include?([:key, :symbolize_names])
|
|
117
159
|
supported_options << :symbolize_names
|
|
118
160
|
end
|
|
119
|
-
if params.include?([:key, :freeze])
|
|
161
|
+
if params.include?([:key, :freeze])
|
|
120
162
|
supported_options << :freeze
|
|
121
163
|
end
|
|
122
164
|
supported_options.freeze
|
|
@@ -135,6 +177,14 @@ module Bootsnap
|
|
|
135
177
|
|
|
136
178
|
NoTagsVisitor.new(scanner, loader).visit(ast)
|
|
137
179
|
end
|
|
180
|
+
|
|
181
|
+
def msgpack_unpacker_options(kwargs)
|
|
182
|
+
return kwargs unless kwargs&.key?(:symbolize_names)
|
|
183
|
+
|
|
184
|
+
kwargs = kwargs.dup
|
|
185
|
+
kwargs[:symbolize_keys] = kwargs.delete(:symbolize_names)
|
|
186
|
+
kwargs
|
|
187
|
+
end
|
|
138
188
|
end
|
|
139
189
|
|
|
140
190
|
module Psych4
|
|
@@ -164,11 +214,9 @@ module Bootsnap
|
|
|
164
214
|
end
|
|
165
215
|
|
|
166
216
|
def storage_to_output(data, kwargs)
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
unpacker = CompileCache::YAML.msgpack_factory.unpacker(kwargs)
|
|
217
|
+
unpacker = CompileCache::YAML.msgpack_factory.unpacker(
|
|
218
|
+
CompileCache::YAML.msgpack_unpacker_options(kwargs),
|
|
219
|
+
)
|
|
172
220
|
unpacker.feed(data)
|
|
173
221
|
_safe_loaded = unpacker.unpack
|
|
174
222
|
result = unpacker.unpack
|
|
@@ -202,11 +250,9 @@ module Bootsnap
|
|
|
202
250
|
end
|
|
203
251
|
|
|
204
252
|
def storage_to_output(data, kwargs)
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
unpacker = CompileCache::YAML.msgpack_factory.unpacker(kwargs)
|
|
253
|
+
unpacker = CompileCache::YAML.msgpack_factory.unpacker(
|
|
254
|
+
CompileCache::YAML.msgpack_unpacker_options(kwargs),
|
|
255
|
+
)
|
|
210
256
|
unpacker.feed(data)
|
|
211
257
|
safe_loaded = unpacker.unpack
|
|
212
258
|
if safe_loaded
|
|
@@ -282,10 +328,9 @@ module Bootsnap
|
|
|
282
328
|
end
|
|
283
329
|
|
|
284
330
|
def storage_to_output(data, kwargs)
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
unpacker = CompileCache::YAML.msgpack_factory.unpacker(kwargs)
|
|
331
|
+
unpacker = CompileCache::YAML.msgpack_factory.unpacker(
|
|
332
|
+
CompileCache::YAML.msgpack_unpacker_options(kwargs),
|
|
333
|
+
)
|
|
289
334
|
unpacker.feed(data)
|
|
290
335
|
_safe_loaded = unpacker.unpack
|
|
291
336
|
unpacker.unpack
|
data/lib/bootsnap/version.rb
CHANGED
data/lib/bootsnap.rb
CHANGED
|
@@ -6,6 +6,9 @@ require_relative "bootsnap/bundler"
|
|
|
6
6
|
module Bootsnap
|
|
7
7
|
InvalidConfiguration = Class.new(StandardError)
|
|
8
8
|
|
|
9
|
+
# JITs shouldn't change the cache key as they have no impact on iseq generation
|
|
10
|
+
RUBY_CACHE_KEY = RUBY_DESCRIPTION.gsub(/\s\+\wJIT/, "").freeze
|
|
11
|
+
|
|
9
12
|
class << self
|
|
10
13
|
attr_reader :cache_dir, :logger
|
|
11
14
|
|
metadata
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: bootsnap
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.
|
|
4
|
+
version: 1.25.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Burke Libbey
|
|
8
|
-
autorequire:
|
|
9
8
|
bindir: exe
|
|
10
9
|
cert_chain: []
|
|
11
|
-
date:
|
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
|
12
11
|
dependencies:
|
|
13
12
|
- !ruby/object:Gem::Dependency
|
|
14
13
|
name: msgpack
|
|
@@ -16,14 +15,14 @@ dependencies:
|
|
|
16
15
|
requirements:
|
|
17
16
|
- - "~>"
|
|
18
17
|
- !ruby/object:Gem::Version
|
|
19
|
-
version: '1.
|
|
18
|
+
version: '1.5'
|
|
20
19
|
type: :runtime
|
|
21
20
|
prerelease: false
|
|
22
21
|
version_requirements: !ruby/object:Gem::Requirement
|
|
23
22
|
requirements:
|
|
24
23
|
- - "~>"
|
|
25
24
|
- !ruby/object:Gem::Version
|
|
26
|
-
version: '1.
|
|
25
|
+
version: '1.5'
|
|
27
26
|
description: Boot large ruby/rails apps faster
|
|
28
27
|
email:
|
|
29
28
|
- burke.libbey@shopify.com
|
|
@@ -68,7 +67,6 @@ metadata:
|
|
|
68
67
|
changelog_uri: https://github.com/rails/bootsnap/blob/main/CHANGELOG.md
|
|
69
68
|
source_code_uri: https://github.com/rails/bootsnap
|
|
70
69
|
allowed_push_host: https://rubygems.org
|
|
71
|
-
post_install_message:
|
|
72
70
|
rdoc_options: []
|
|
73
71
|
require_paths:
|
|
74
72
|
- lib
|
|
@@ -83,8 +81,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
83
81
|
- !ruby/object:Gem::Version
|
|
84
82
|
version: '0'
|
|
85
83
|
requirements: []
|
|
86
|
-
rubygems_version:
|
|
87
|
-
signing_key:
|
|
84
|
+
rubygems_version: 4.0.16
|
|
88
85
|
specification_version: 4
|
|
89
86
|
summary: Boot large ruby/rails apps faster
|
|
90
87
|
test_files: []
|