bootsnap 1.9.2 → 1.9.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: de52d100052f98bd60ccbc71d3172b7f7951df2fb45fb8dab4a5c4f8e95e4528
4
- data.tar.gz: a09dacba13131d47509d41d729748a7d80703779bcbbb0a4c0474f0960cf5025
3
+ metadata.gz: 8741381213652a6e3fc633bb87c69446d65ded8ccc5dcf72e64a8fa4a796955b
4
+ data.tar.gz: e72c311d1417b7c4d174c5b95cc6d95b1b0078dfd5dfb71c213f6704cd011665
5
5
  SHA512:
6
- metadata.gz: 31fe33d4e05c9c85f4950434481131396dcc06485651144783767485da5ff887a6293aeb21d6baee22d3beeeb4c8e0a1ddb869f6f50b148bb241c674ee2b9f6a
7
- data.tar.gz: 3e9a66ee5d26a54fa9c36515806c89f0757232b3191768f9769333155f08b5eda43d426c23a7ac144bd84ebd6d352042562bce8c828cbb2e8d624484d5adeb72
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
- def self.input_to_storage(_, path)
13
- RubyVM::InstructionSequence.compile_file(path).to_binary
14
- rescue SyntaxError
15
- raise(Uncompilable, 'syntax error')
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)
@@ -1,4 +1,4 @@
1
1
  # frozen_string_literal: true
2
2
  module Bootsnap
3
- VERSION = "1.9.2"
3
+ VERSION = "1.9.3"
4
4
  end
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
- if iseq_cache_tracing_bug?
62
- warn "Ruby 2.5 has a bug that break code tracing when code is loaded from cache. It is recommended " \
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.iseq_cache_tracing_bug?
85
- return @iseq_cache_tracing_bug if defined? @iseq_cache_tracing_bug
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
- @iseq_cache_tracing_bug = ruby_version < Gem::Version.new('2.5.0') || ruby_version >= Gem::Version.new('2.6.0')
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
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bootsnap
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.9.2
4
+ version: 1.9.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Burke Libbey