bootsnap 1.11.1 → 1.12.0

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: 1cc142349008790c310bcbc875a437996403242e579f85fb48f46eceecb383ad
4
- data.tar.gz: fa1d21fafa8a4fa4d44ced76d597b773d3321e077dc815ccbcae3fe9dc4e661a
3
+ metadata.gz: 761e97c3b4772e9c0af1bd8391d70dddebd94addf88e9295e72a790a85deb5e0
4
+ data.tar.gz: 17f80fcf67adc6a4e7f9fb475d3e7d5c008c89b491e23804da1f2603e859888c
5
5
  SHA512:
6
- metadata.gz: 81445538692ae0dc34b7309c44195fce5c864e508afe6eed4124d3d87bc1bfa07fd2ddb2c602faa2409f1537f8da63b885fd692bdc74e961febdd2a39e6e1919
7
- data.tar.gz: 6389ce3a667c528660976665ce8184fb61d638da6cd4040e7b2d55441679574bdf691e4991294396c19a6e79bbf185ba1cdca848d5ea499a5b8e197dca143a5f
6
+ metadata.gz: dca99dc5e57a644e627e8705958c8c4916a9c444c2a64788fd4214aa174d6c3eed7fc15ef7bdb6e06922fb8d1eef3beeff08e316aadbc3015a36e82b1a232309
7
+ data.tar.gz: 1c9ffc9c5c04694f4838693edda976f58925649f7b14411d61bec64eca10bb04548c5bb4e2be6ff897c8d5a0e929aa2cd885d017ccd1770530971fedba831ec3
data/CHANGELOG.md CHANGED
@@ -1,5 +1,14 @@
1
1
  # Unreleased
2
2
 
3
+ # 1.12.0
4
+
5
+ * `bootsnap precompile` CLI will now also precompile `Rakefile` and `.rake` files.
6
+
7
+ * Stop decorating `Module#autoload` as it was only useful for supporting Ruby 2.2 and older.
8
+
9
+ * Remove `uname` and other patform specific version from the cache keys. `RUBY_PLATFORM + RUBY_REVISION` should be
10
+ enough to ensure bytecode compatibility. This should improve caching for alpine based setups. See #409.
11
+
3
12
  # 1.11.1
4
13
 
5
14
  * Fix the `can't modify frozen Hash` error on load path cache mutation. See #411.
data/README.md CHANGED
@@ -232,9 +232,9 @@ Bootsnap writes a cache file containing a 64 byte header followed by the cache c
232
232
  is a cache key including several fields:
233
233
 
234
234
  * `version`, hardcoded in bootsnap. Essentially a schema version;
235
- * `ruby_platform`, A hash of `RUBY_PLATFORM` (e.g. x86_64-linux-gnu) variable and glibc version (on Linux) or OS version (`uname -v` on BSD, macOS)
235
+ * `ruby_platform`, A hash of `RUBY_PLATFORM` (e.g. x86_64-linux-gnu) variable.
236
236
  * `compile_option`, which changes with `RubyVM::InstructionSequence.compile_option` does;
237
- * `ruby_revision`, the version of Ruby this was compiled with;
237
+ * `ruby_revision`, A hash of `RUBY_REVISION`, the exact version of Ruby;
238
238
  * `size`, the size of the source file;
239
239
  * `mtime`, the last-modification timestamp of the source file when it was compiled; and
240
240
  * `data_size`, the number of bytes following the header, which we need to read it into a buffer.
@@ -19,12 +19,6 @@
19
19
  #include <errno.h>
20
20
  #include <fcntl.h>
21
21
  #include <sys/stat.h>
22
- #ifndef _WIN32
23
- #include <sys/utsname.h>
24
- #endif
25
- #ifdef __GLIBC__
26
- #include <gnu/libc-version.h>
27
- #endif
28
22
 
29
23
  /* 1000 is an arbitrary limit; FNV64 plus some slashes brings the cap down to
30
24
  * 981 for the cache dir */
@@ -205,29 +199,6 @@ bs_compile_option_crc32_set(VALUE self, VALUE crc32_v)
205
199
  return Qnil;
206
200
  }
207
201
 
208
- /*
209
- * We use FNV1a-64 to derive cache paths. The choice is somewhat arbitrary but
210
- * it has several nice properties:
211
- *
212
- * - Tiny implementation
213
- * - No external dependency
214
- * - Solid performance
215
- * - Solid randomness
216
- * - 32 bits doesn't feel collision-resistant enough; 64 is nice.
217
- */
218
- static uint64_t
219
- fnv1a_64_iter_cstr(uint64_t h, const char *str)
220
- {
221
- unsigned char *s = (unsigned char *)str;
222
-
223
- while (*s) {
224
- h ^= (uint64_t)*s++;
225
- h += (h << 1) + (h << 4) + (h << 5) + (h << 7) + (h << 8) + (h << 40);
226
- }
227
-
228
- return h;
229
- }
230
-
231
202
  static uint64_t
232
203
  fnv1a_64_iter(uint64_t h, const VALUE str)
233
204
  {
@@ -272,10 +243,6 @@ get_ruby_revision(void)
272
243
  /*
273
244
  * When ruby's version doesn't change, but it's recompiled on a different OS
274
245
  * (or OS version), we need to invalidate the cache.
275
- *
276
- * We actually factor in some extra information here, to be extra confident
277
- * that we don't try to re-use caches that will not be compatible, by factoring
278
- * in utsname.version.
279
246
  */
280
247
  static uint32_t
281
248
  get_ruby_platform(void)
@@ -285,22 +252,7 @@ get_ruby_platform(void)
285
252
 
286
253
  ruby_platform = rb_const_get(rb_cObject, rb_intern("RUBY_PLATFORM"));
287
254
  hash = fnv1a_64(ruby_platform);
288
-
289
- #ifdef _WIN32
290
- return (uint32_t)(hash >> 32) ^ (uint32_t)GetVersion();
291
- #elif defined(__GLIBC__)
292
- hash = fnv1a_64_iter_cstr(hash, gnu_get_libc_version());
293
255
  return (uint32_t)(hash >> 32);
294
- #else
295
- struct utsname utsname;
296
-
297
- /* Not worth crashing if this fails; lose extra cache invalidation potential */
298
- if (uname(&utsname) >= 0) {
299
- hash = fnv1a_64_iter_cstr(hash, utsname.version);
300
- }
301
-
302
- return (uint32_t)(hash >> 32);
303
- #endif
304
256
  }
305
257
 
306
258
  /*
data/lib/bootsnap/cli.rb CHANGED
@@ -172,7 +172,7 @@ module Bootsnap
172
172
 
173
173
  load_paths.each do |path|
174
174
  if !exclude || !exclude.match?(path)
175
- list_files(path, "**/*.rb").each do |ruby_file|
175
+ list_files(path, "**/{*.rb,*.rake,Rakefile}").each do |ruby_file|
176
176
  if !exclude || !exclude.match?(ruby_file)
177
177
  @work_pool.push(:ruby, ruby_file)
178
178
  end
@@ -42,24 +42,3 @@ module Kernel
42
42
  end
43
43
  end
44
44
  end
45
-
46
- class Module
47
- alias_method(:autoload_without_bootsnap, :autoload)
48
- def autoload(const, path)
49
- # NOTE: This may defeat LoadedFeaturesIndex, but it's not immediately
50
- # obvious how to make it work. This feels like a pretty niche case, unclear
51
- # if it will ever burn anyone.
52
- #
53
- # The challenge is that we don't control the point at which the entry gets
54
- # added to $LOADED_FEATURES and won't be able to hook that modification
55
- # since it's done in C-land.
56
- resolved = Bootsnap::LoadPathCache.load_path_cache.find(Bootsnap.rb_get_path(path))
57
- if Bootsnap::LoadPathCache::FALLBACK_SCAN.equal?(resolved)
58
- autoload_without_bootsnap(const, path)
59
- elsif resolved == false
60
- return false
61
- else
62
- autoload_without_bootsnap(const, resolved || path)
63
- end
64
- end
65
- end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Bootsnap
4
- VERSION = "1.11.1"
4
+ VERSION = "1.12.0"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bootsnap
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.11.1
4
+ version: 1.12.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Burke Libbey
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-03-08 00:00:00.000000000 Z
11
+ date: 2022-05-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: msgpack