bootsnap 1.9.2 → 1.9.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/CHANGELOG.md +7 -1
- data/lib/bootsnap/compile_cache/iseq.rb +29 -4
- data/lib/bootsnap/version.rb +1 -1
- data/lib/bootsnap.rb +6 -29
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8741381213652a6e3fc633bb87c69446d65ded8ccc5dcf72e64a8fa4a796955b
|
4
|
+
data.tar.gz: e72c311d1417b7c4d174c5b95cc6d95b1b0078dfd5dfb71c213f6704cd011665
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 804f427e8dd71b5aab1fe772f0f44f9fd8598cd2cd9bfc2348a13bff85fb1d65f59711188ca52b8dabc26e688655b4565e2aca2b2b8bf2a85e2635a299fe2f3a
|
7
|
+
data.tar.gz: a679ccfd21df451edf3e77c750f92388ab746afbb5e5d84e3265e8e2fbd52f6c17d6a303efc179e24fa994de95762d30e2b31683517d500236fe0c2ba5f23d25
|
data/CHANGELOG.md
CHANGED
@@ -1,8 +1,14 @@
|
|
1
1
|
# Unreleased
|
2
2
|
|
3
|
+
# 1.9.3
|
4
|
+
|
5
|
+
* Only disable the compile cache for source files impacted by [Ruby 3.0.3 [Bug 18250]](https://bugs.ruby-lang.org/issues/18250).
|
6
|
+
This should keep the performance loss to a minimum.
|
7
|
+
|
3
8
|
# 1.9.2
|
4
9
|
|
5
|
-
* Disable compile cache if Ruby 3.0.3's ISeq cache bug is detected.
|
10
|
+
* Disable compile cache if [Ruby 3.0.3's ISeq cache bug](https://bugs.ruby-lang.org/issues/18250) is detected.
|
11
|
+
AKA `iseq.rb:13 to_binary: wrong argument type false (expected Symbol)`
|
6
12
|
* Fix `Kernel.load` behavior: before `load 'a'` would load `a.rb` (and other tried extensions) and wouldn't load `a` unless `development_mode: true`, now only `a` would be loaded and files with extensions wouldn't be.
|
7
13
|
|
8
14
|
# 1.9.1
|
@@ -9,10 +9,35 @@ module Bootsnap
|
|
9
9
|
attr_accessor(:cache_dir)
|
10
10
|
end
|
11
11
|
|
12
|
-
|
13
|
-
RubyVM::InstructionSequence
|
14
|
-
|
15
|
-
|
12
|
+
has_ruby_bug_18250 = begin # https://bugs.ruby-lang.org/issues/18250
|
13
|
+
if defined? RubyVM::InstructionSequence
|
14
|
+
RubyVM::InstructionSequence.compile("def foo(*); ->{ super }; end; def foo(**); ->{ super }; end").to_binary
|
15
|
+
end
|
16
|
+
false
|
17
|
+
rescue TypeError
|
18
|
+
true
|
19
|
+
end
|
20
|
+
|
21
|
+
if has_ruby_bug_18250
|
22
|
+
def self.input_to_storage(_, path)
|
23
|
+
iseq = begin
|
24
|
+
RubyVM::InstructionSequence.compile_file(path)
|
25
|
+
rescue SyntaxError
|
26
|
+
raise(Uncompilable, 'syntax error')
|
27
|
+
end
|
28
|
+
|
29
|
+
begin
|
30
|
+
iseq.to_binary
|
31
|
+
rescue TypeError
|
32
|
+
raise(Uncompilable, 'ruby bug #18250')
|
33
|
+
end
|
34
|
+
end
|
35
|
+
else
|
36
|
+
def self.input_to_storage(_, path)
|
37
|
+
RubyVM::InstructionSequence.compile_file(path).to_binary
|
38
|
+
rescue SyntaxError
|
39
|
+
raise(Uncompilable, 'syntax error')
|
40
|
+
end
|
16
41
|
end
|
17
42
|
|
18
43
|
def self.storage_to_output(binary, _args)
|
data/lib/bootsnap/version.rb
CHANGED
data/lib/bootsnap.rb
CHANGED
@@ -57,15 +57,9 @@ module Bootsnap
|
|
57
57
|
"If you use Ruby 2.5 or newer this option is useless, if not upgrading is recommended."
|
58
58
|
end
|
59
59
|
|
60
|
-
if compile_cache_iseq
|
61
|
-
|
62
|
-
|
63
|
-
"to turn `compile_cache_iseq` off on Ruby 2.5"
|
64
|
-
end
|
65
|
-
|
66
|
-
if iseq_cache_anonymous_params_bug?
|
67
|
-
warn "Your version of Ruby 3.1.0-dev has a bug that break bytecode caching (https://github.com/ruby/ruby/pull/4961)."
|
68
|
-
end
|
60
|
+
if compile_cache_iseq && !iseq_cache_supported?
|
61
|
+
warn "Ruby 2.5 has a bug that break code tracing when code is loaded from cache. It is recommened " \
|
62
|
+
"to turn `compile_cache_iseq` off on Ruby 2.5"
|
69
63
|
end
|
70
64
|
|
71
65
|
Bootsnap::LoadPathCache.setup(
|
@@ -81,28 +75,11 @@ module Bootsnap
|
|
81
75
|
)
|
82
76
|
end
|
83
77
|
|
84
|
-
def self.
|
85
|
-
return @
|
78
|
+
def self.iseq_cache_supported?
|
79
|
+
return @iseq_cache_supported if defined? @iseq_cache_supported
|
86
80
|
|
87
81
|
ruby_version = Gem::Version.new(RUBY_VERSION)
|
88
|
-
@
|
89
|
-
end
|
90
|
-
|
91
|
-
def self.iseq_cache_anonymous_params_bug?
|
92
|
-
return @iseq_cache_anonymous_params_bug if defined? @iseq_cache_anonymous_params_bug
|
93
|
-
begin
|
94
|
-
if defined? RubyVM::InstructionSequence
|
95
|
-
RubyVM::InstructionSequence.compile("def foo(*); ->{ super }; end").to_binary
|
96
|
-
RubyVM::InstructionSequence.compile("def foo(**); ->{ super }; end").to_binary
|
97
|
-
end
|
98
|
-
false
|
99
|
-
rescue TypeError
|
100
|
-
true
|
101
|
-
end
|
102
|
-
end
|
103
|
-
|
104
|
-
def self.iseq_cache_supported?
|
105
|
-
!(iseq_cache_tracing_bug? || iseq_cache_anonymous_params_bug?)
|
82
|
+
@iseq_cache_supported = ruby_version < Gem::Version.new('2.5.0') || ruby_version >= Gem::Version.new('2.6.0')
|
106
83
|
end
|
107
84
|
|
108
85
|
def self.default_setup
|