bootsnap 1.4.4 → 1.4.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +5 -0
- data/ext/bootsnap/bootsnap.c +22 -1
- data/lib/bootsnap/compile_cache.rb +1 -1
- data/lib/bootsnap/load_path_cache/store.rb +12 -9
- data/lib/bootsnap/version.rb +1 -1
- metadata +3 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: be54a60d54f32f824d5c2fdccf189cdcb5409d1848c55f6e654fe44ace1d3f21
|
4
|
+
data.tar.gz: c6239c30984a936b76e218c2b1292a7e72d817d3e4847a6c58f0121c1e3068dc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c251990457406cd51726eec8d62e0e1028bbeade6e24f266cb743d6f00f53650841beed9ee8e1795c78febd18ea234691125920c16aa5a95031718a28619bb31
|
7
|
+
data.tar.gz: 554a885bf2264f088618c41864fb84069d0664b35af0ae4b619c8fbb1cf285c80fad564d36845161f8044c35c6b53a33e66f27eb75c6715f25869af2795c97f6
|
data/CHANGELOG.md
CHANGED
data/ext/bootsnap/bootsnap.c
CHANGED
@@ -96,6 +96,7 @@ static int cache_key_equal(struct bs_cache_key * k1, struct bs_cache_key * k2);
|
|
96
96
|
static VALUE bs_fetch(char * path, VALUE path_v, char * cache_path, VALUE handler);
|
97
97
|
static int open_current_file(char * path, struct bs_cache_key * key, char ** errno_provenance);
|
98
98
|
static int fetch_cached_data(int fd, ssize_t data_size, VALUE handler, VALUE * output_data, int * exception_tag, char ** errno_provenance);
|
99
|
+
static uint32_t get_ruby_revision(void);
|
99
100
|
static uint32_t get_ruby_platform(void);
|
100
101
|
|
101
102
|
/*
|
@@ -136,7 +137,7 @@ Init_bootsnap(void)
|
|
136
137
|
rb_mBootsnap_CompileCache_Native = rb_define_module_under(rb_mBootsnap_CompileCache, "Native");
|
137
138
|
rb_eBootsnap_CompileCache_Uncompilable = rb_define_class_under(rb_mBootsnap_CompileCache, "Uncompilable", rb_eStandardError);
|
138
139
|
|
139
|
-
current_ruby_revision =
|
140
|
+
current_ruby_revision = get_ruby_revision();
|
140
141
|
current_ruby_platform = get_ruby_platform();
|
141
142
|
|
142
143
|
uncompilable = rb_intern("__bootsnap_uncompilable__");
|
@@ -196,6 +197,26 @@ fnv1a_64(const char *str)
|
|
196
197
|
return fnv1a_64_iter(h, str);
|
197
198
|
}
|
198
199
|
|
200
|
+
/*
|
201
|
+
* Ruby's revision may be Integer or String. CRuby 2.7 or later uses
|
202
|
+
* Git commit ID as revision. It's String.
|
203
|
+
*/
|
204
|
+
static uint32_t
|
205
|
+
get_ruby_revision(void)
|
206
|
+
{
|
207
|
+
VALUE ruby_revision;
|
208
|
+
|
209
|
+
ruby_revision = rb_const_get(rb_cObject, rb_intern("RUBY_REVISION"));
|
210
|
+
if (RB_TYPE_P(ruby_revision, RUBY_T_FIXNUM)) {
|
211
|
+
return FIX2INT(ruby_revision);
|
212
|
+
} else {
|
213
|
+
uint64_t hash;
|
214
|
+
|
215
|
+
hash = fnv1a_64(StringValueCStr(ruby_revision));
|
216
|
+
return (uint32_t)(hash >> 32);
|
217
|
+
}
|
218
|
+
}
|
219
|
+
|
199
220
|
/*
|
200
221
|
* When ruby's version doesn't change, but it's recompiled on a different OS
|
201
222
|
* (or OS version), we need to invalidate the cache.
|
@@ -28,7 +28,7 @@ module Bootsnap
|
|
28
28
|
raise(
|
29
29
|
PermissionError,
|
30
30
|
"bootsnap doesn't have permission to write cache entries in '#{cpath}' " \
|
31
|
-
"(or, less likely, doesn't have
|
31
|
+
"(or, less likely, doesn't have permission to read '#{path}')",
|
32
32
|
)
|
33
33
|
end
|
34
34
|
|
@@ -11,7 +11,8 @@ module Bootsnap
|
|
11
11
|
|
12
12
|
def initialize(store_path)
|
13
13
|
@store_path = store_path
|
14
|
-
|
14
|
+
# TODO: Remove conditional once Ruby 2.2 support is dropped.
|
15
|
+
@txn_mutex = defined?(::Mutex) ? ::Mutex.new : ::Thread::Mutex.new
|
15
16
|
@dirty = false
|
16
17
|
load_data
|
17
18
|
end
|
@@ -21,7 +22,7 @@ module Bootsnap
|
|
21
22
|
end
|
22
23
|
|
23
24
|
def fetch(key)
|
24
|
-
raise(SetOutsideTransactionNotAllowed) unless @
|
25
|
+
raise(SetOutsideTransactionNotAllowed) unless @txn_mutex.owned?
|
25
26
|
v = get(key)
|
26
27
|
unless v
|
27
28
|
@dirty = true
|
@@ -32,7 +33,7 @@ module Bootsnap
|
|
32
33
|
end
|
33
34
|
|
34
35
|
def set(key, value)
|
35
|
-
raise(SetOutsideTransactionNotAllowed) unless @
|
36
|
+
raise(SetOutsideTransactionNotAllowed) unless @txn_mutex.owned?
|
36
37
|
if value != @data[key]
|
37
38
|
@dirty = true
|
38
39
|
@data[key] = value
|
@@ -40,12 +41,14 @@ module Bootsnap
|
|
40
41
|
end
|
41
42
|
|
42
43
|
def transaction
|
43
|
-
raise(NestedTransactionError) if @
|
44
|
-
@
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
44
|
+
raise(NestedTransactionError) if @txn_mutex.owned?
|
45
|
+
@txn_mutex.synchronize do
|
46
|
+
begin
|
47
|
+
yield
|
48
|
+
ensure
|
49
|
+
commit_transaction
|
50
|
+
end
|
51
|
+
end
|
49
52
|
end
|
50
53
|
|
51
54
|
private
|
data/lib/bootsnap/version.rb
CHANGED
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.4.
|
4
|
+
version: 1.4.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Burke Libbey
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-08-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -167,8 +167,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
167
167
|
- !ruby/object:Gem::Version
|
168
168
|
version: '0'
|
169
169
|
requirements: []
|
170
|
-
|
171
|
-
rubygems_version: 2.7.6
|
170
|
+
rubygems_version: 3.0.2
|
172
171
|
signing_key:
|
173
172
|
specification_version: 4
|
174
173
|
summary: Boot large ruby/rails apps faster
|