bootsnap 1.4.4-java → 1.4.5-java
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 +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: 5b500e88c916d4f157bc2bcb5d412fec363fa12efc3e9554c983934c89a08a43
|
4
|
+
data.tar.gz: d4fc038bb787798938b56ddcf98c348f0c5a93da350e3e588eb6bfd55203bbc8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f4fa5023df7724fd9f1b076b644f5537b5b35ddd6efd1a04a3a87e0f2808b2c123f99cdd7f3772f566237aa0edcb2d9bb07236b6175e2097f044b0d25a690c32
|
7
|
+
data.tar.gz: cad79a047f47abb66944b7809e613f57b0312674b1289722d2b7ad365c7d83d708a078d7cbacbe5b5ab4a452f15fb89a605612ddfe843a6913cb2b06b098e645
|
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: java
|
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
|
requirement: !ruby/object:Gem::Requirement
|
@@ -166,8 +166,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
166
166
|
- !ruby/object:Gem::Version
|
167
167
|
version: '0'
|
168
168
|
requirements: []
|
169
|
-
|
170
|
-
rubygems_version: 2.7.6
|
169
|
+
rubygems_version: 3.0.2
|
171
170
|
signing_key:
|
172
171
|
specification_version: 4
|
173
172
|
summary: Boot large ruby/rails apps faster
|