bootsnap 1.4.4-java → 1.4.5-java

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: 7fbe5730c11c8b3d6088b4a328a05e5cf3a364e949f3df1a68412d6e4331da9b
4
- data.tar.gz: c45de758cc5b2649b54e57f4e8b56959f2138834f75ec13588fa203c3ed58a18
3
+ metadata.gz: 5b500e88c916d4f157bc2bcb5d412fec363fa12efc3e9554c983934c89a08a43
4
+ data.tar.gz: d4fc038bb787798938b56ddcf98c348f0c5a93da350e3e588eb6bfd55203bbc8
5
5
  SHA512:
6
- metadata.gz: 5df01b2d8caa55aaae85f8d3144d03805b2e964fb0da7178601d8771a3414001fdd914a3973d508d15d733db6fbfe27617a8d0ffe8a18f6dd6c052d872530c55
7
- data.tar.gz: 8b3d127f57624a9bd2faaf61f87573fc938b1bce59b56b65cd5fc817230b399f2d4b42002f0bd2695b04a9be1247d3c8e4d2e2faf6a49500443a246807287cdd
6
+ metadata.gz: f4fa5023df7724fd9f1b076b644f5537b5b35ddd6efd1a04a3a87e0f2808b2c123f99cdd7f3772f566237aa0edcb2d9bb07236b6175e2097f044b0d25a690c32
7
+ data.tar.gz: cad79a047f47abb66944b7809e613f57b0312674b1289722d2b7ad365c7d83d708a078d7cbacbe5b5ab4a452f15fb89a605612ddfe843a6913cb2b06b098e645
@@ -1,3 +1,8 @@
1
+ # 1.4.5
2
+
3
+ * MRI 2.7 support
4
+ * Fixed concurrency bugs
5
+
1
6
  # 1.4.4
2
7
 
3
8
  * Disable ISeq cache in `bootsnap/setup` by default in Ruby 2.5
@@ -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 = FIX2INT(rb_const_get(rb_cObject, rb_intern("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 permisison to read '#{path}')",
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
- @in_txn = false
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 @in_txn
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 @in_txn
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 @in_txn
44
- @in_txn = true
45
- yield
46
- ensure
47
- commit_transaction
48
- @in_txn = false
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
@@ -1,3 +1,3 @@
1
1
  module Bootsnap
2
- VERSION = "1.4.4"
2
+ VERSION = "1.4.5"
3
3
  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.4.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-04-24 00:00:00.000000000 Z
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
- rubyforge_project:
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